added systic handler 1

This commit is contained in:
Aravind 2024-09-21 21:25:50 +05:30
parent 4ec5552313
commit 9c440fe641
No known key found for this signature in database
GPG Key ID: A65B144ABA883771
1 changed files with 22 additions and 1 deletions

23
main.c
View File

@ -2,6 +2,9 @@
#include <stdbool.h> #include <stdbool.h>
#include "tm4c123gh6pm.h" #include "tm4c123gh6pm.h"
void Systick_Handler(void);
void systickInit(void);
int main(void) int main(void)
{ {
SYSCTL_RCGC2_R |= 0x00000020; /* enable clock to GPIOF */ 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();
}