Update Group21_Lab06_Task1/main.c

Add Systic_Setting
This commit is contained in:
Uttam Bhavimani Bhavimani 2024-09-22 19:41:11 +05:30
parent ffecc74e44
commit b44cc3d7d4
1 changed files with 7 additions and 0 deletions

View File

@ -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
}