//---------------------------------------------------------------中断
// High priority interrupt vector */
#pragma code
#pragma code InterruptVectorHigh = 0x08
void
InterruptVectorHigh (void)
{
_asm
goto InterruptHandlerHigh //jump to interrupt routine
_endasm
}
//---------------------------------------------------------------
// High priority interrupt routine */
#pragma code
#pragma interrupt InterruptHandlerHigh
void
InterruptHandlerHigh ()
{
unsigned char temp,gg;
if (PIR1bits.TMR2IF)
{
CCP1CONbits.P1M1 = ~CCP1CONbits.P1M1;
if (CCP1CONbits.P1M1) PR2 = P1M1_PR2_1reg; // 全桥正向输出占空比赋值
else PR2 = P1M1_PR2_2reg; // 全桥反向输出占空比赋值
}
}
文章评论(0条评论)
登录后参与讨论