From b44cc3d7d4ca2075664ba5ee5cbb63ea8dec4eea Mon Sep 17 00:00:00 2001 From: Uttam Bhavimani Bhavimani Date: Sun, 22 Sep 2024 19:41:11 +0530 Subject: [PATCH] Update Group21_Lab06_Task1/main.c Add Systic_Setting --- Group21_Lab06_Task1/main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Group21_Lab06_Task1/main.c b/Group21_Lab06_Task1/main.c index d899106..e4adfd9 100644 --- a/Group21_Lab06_Task1/main.c +++ b/Group21_Lab06_Task1/main.c @@ -32,3 +32,10 @@ volatile int duty = 50; // Initial duty const volatile int PWM_PERIOD = 1000000; // Period for 100kHz in microseconds (10ms) volatile int ontime = 0; // Variable to track on time //volatile bool ledState = false; // State of the LED + +void systick_setting(void) +{ + STRELOAD = SYSTICK_RELOAD_VALUE(PWM_PERIOD/100); // Set reload value for 10 µs intervals (100 kHz) + STCTRL |= (CLKINT | ENABLE | INTEN); // Set internal clock, enable the timer + STCURRENT = 0; // Clear STCURRENT value +}