From ff44507e265f488e82c3a66b793472a8c24687fb Mon Sep 17 00:00:00 2001 From: Uttam Ambappa Bhavimani Date: Mon, 28 Oct 2024 23:38:37 +0530 Subject: [PATCH] Update main.c Initialize Systick setting --- main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.c b/main.c index 676702e..f2ae194 100644 --- a/main.c +++ b/main.c @@ -9,3 +9,10 @@ #define CLKINT (1 << 2) // Bit 2 of CSR to specify CPU clock #define CLOCK_HZ 16000000 // Clock frequency of EK-TM4C123GXL #define SYSTICK_RELOAD_VALUE(us) ((CLOCK_HZ / 1000000) * (us) - 1) // SysTick reload value in microseconds based on clock frequency + +void systick_setting(void) +{ + STRELOAD = SYSTICK_RELOAD_VALUE(1000); // RELOAD VALUE FOR 1ms + STCTRL |= ENABLE | CLKINT; // Enable SysTick with system clock + STCURRENT = 0; // Clear current value +}