Added the code for changing the duty cycle

This commit is contained in:
Rajput R Vikramsingh Vikramsingh 2024-09-22 16:13:38 +05:30
parent 3c6628a463
commit 0c361f5a42
1 changed files with 42 additions and 0 deletions

View File

@ -58,6 +58,48 @@ void GPIOF_int_config()
GPIO_PORTF_IM_R |= MASK_BITS; GPIO_PORTF_IM_R |= MASK_BITS;
} }
void GPIOF_INT_Handler(void)
{
GPIO_PORTF_IM_R &= ~MASK_BITS;
int i;
if(GPIO_PORTF_RIS_R & ~MASK_BITS)
{
for(i=0;i<160000;i++){}
if(~(GPIO_PORTF_DATA_R)&0x01)
{
STCURRENT = 0;
STRELOAD = 1000000*8;
STCTRL |= (CLKINT | ENABLE);
}
else
{
if(STCTRL & COUNT_FLAG)
{
STCTRL = 0;
if(PWM1_2_CMPB_R < 155)
{
PWM1_2_CMPB_R += 5;
}
}
else
{
STCTRL = 0;
if(PWM1_2_CMPB_R > 5)
{
PWM1_2_CMPB_R -= 5;
}
}
}
}
GPIO_PORTF_ICR_R = MASK_BITS;
GPIO_PORTF_IM_R |= MASK_BITS;
}