G14 A03 Report
G14 A03 Report
G14 A03 Report
Group : 14
NAME : HARSHIT TAK AND MIRIYALA PRANAY KAMAL
ROLL NO. : EE23MT007 AND 200030033
FACULTY ; Dr. ABHIJIT KSHIRSAGAR
What is SysTick?
Cortex-M4 includes an integrated system timer, SysTick, which provides a simple, 24-bit
clear-on-write, decrementing, wrap-on-zero counter with a flexible control mechanism which can
be configured using three registers, which are:
Code :
#include <stdint.h>
#include <stdbool.h>
#include "tm4c123gh6pm.h"
#include <time.h>
#define CLOCK_MHZ 16
//STCTRL = 1;
return;
}
int main(void)
{
SYSCTL_RCGC2_R |= 0x00000020;; /* enable clock to GPIOF */
GPIO_PORTF_LOCK_R = 0x4C4F434B; /* unlock commit register */
GPIO_PORTF_CR_R = 0x01; /* make PORTF0 configurable */
GPIO_PORTF_DIR_R = 0xFF; /* set PORTF3+PORTF2+PORTF1 pin as output
(LED) pin */
/* and PORTF4 and PORTF0 as input, SW1 is on PORTF4
and SW2 is PORTF0*/
GPIO_PORTF_DEN_R = 0xFF; /* set PORTF pins 4-3-2-1 as digital pins */
GPIO_PORTF_PUR_R = 0x00; /* enable pull up for pin 4 and 0 */
while(1)
{
GPIO_PORTF_DATA_R = 0xFF;
Delay(3200);
GPIO_PORTF_DATA_R = 0x00;
Delay(12800);
}
}
CALCULATION:
System Clock Frequency (f) = 16 MHz
Time period = 1/f = 62.5 ns
Count value for ON for 20% duty cycle = desired period / time period
= 200 μs /62.5 ns
= 3200
Count value for OFF = desired period / time period
= 800 μs / 62.5 ns
= 12800
Total time period = 200 μs + 800 μs = 1ms
Count value for ON for 50% duty cycle = desired period / time period
= 500 μ/62.5n
= 8000 ms
Count value for OFF = desired period / time period
= 500 μ / 62.5n
= 8000 ms
Total time period = 500 μs + 500 μs = 1ms