Update Group21_Lab06_Task1/main.c

Initial Duty Cycle
This commit is contained in:
Uttam Bhavimani Bhavimani 2024-09-22 19:39:51 +05:30
parent 62519ab055
commit ffecc74e44
1 changed files with 5 additions and 0 deletions

View File

@ -27,3 +27,8 @@ void GPIO_PORT_F_init(void)
#define CLOCK_HZ 16000000 // Clock frequency of EK-TM4C123GXL #define CLOCK_HZ 16000000 // Clock frequency of EK-TM4C123GXL
#define INTEN (1 << 1) // Bit 1 of CSR to enable interrupt #define INTEN (1 << 1) // Bit 1 of CSR to enable interrupt
#define SYSTICK_RELOAD_VALUE(us) ((CLOCK_HZ / 1000000) * (us) - 1) // SysTick reload value in microseconds based on clock frequency #define SYSTICK_RELOAD_VALUE(us) ((CLOCK_HZ / 1000000) * (us) - 1) // SysTick reload value in microseconds based on clock frequency
volatile int duty = 50; // Initial duty cycle
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