原创 全桥输出中断

2009-12-19 12:23 1960 8 8 分类: MCU/ 嵌入式

//---------------------------------------------------------------中断
// 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;                   // 全桥反向输出占空比赋值
 }
}

PARTNER CONTENT

文章评论0条评论)

登录后参与讨论
EE直播间
更多
我要评论
0
8
关闭 站长推荐上一条 /3 下一条