Added the code for changing the duty cycle
This commit is contained in:
parent
3c6628a463
commit
0c361f5a42
42
Lab6_Task2.c
42
Lab6_Task2.c
|
@ -58,6 +58,48 @@ void GPIOF_int_config()
|
|||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue