diff --git a/main.c b/main.c index 1e97729..a8db78f 100644 --- a/main.c +++ b/main.c @@ -2,6 +2,9 @@ #include #include "tm4c123gh6pm.h" +void Systick_Handler(void); +void systickInit(void); + int main(void) { SYSCTL_RCGC2_R |= 0x00000020; /* enable clock to GPIOF */ @@ -26,4 +29,22 @@ int main(void) } -void Syst +void systickInit() +{ + NVIC_ST_CURRENT_R = 0; + NVIC_ST_CTRL_R = 0x07; + NVIC_ST_RELOAD_R = 8000000; +} + +void Systick_Handler() +{ + systickInit(); + if (GPIO_PORTF_DATA_R & 0x04) { + GPIO_PORTF_DATA_R &= ~0x04; + + } + else { + GPIO_PORTF_DATA_R |= 0x04; + } + systickInit(); + }