|
void TIM4_Init(void)
{
TIM4_IER=0X00;
TIM4_PSCR=0X04;
TIM4_CNTR=0X00;
TIM4_ARR=0X09;
TIM4_IER=0X01;
TIM4_CR1=0X01;
}
#define TIM4_OVR_UIF_vector 0x19
#pragma vector=TIM4_OVR_UIF_vector
__interrupt void TIM4_OVR_UIF_IRQHandler(void)
{
TIM4_SR=0X00;
switch(flag)
{
case 1:
count14++;
if(count14==3)
{PWMOFF2();}
if(count14==4)
{PWMON();count14=0}
break;
case 2:
TIM4_IER=0X00;count14=0;break;
}
}
正常应该在case 2后关闭中断回到主程序,但是偶尔性的会出现无法启动 |
|