高手讲讲PORTB口的中断,
#pragma code HIGH_vector = 0x08
void HIGH_vector(void)
{
_asm
goto HIGHInterrupt_CODE
_endasm
}
#pragma code
#pragma interrupt HIGHInterrupt_CODE
void HIGHInterrupt_CODE(void)
{
if(INTCONbits.RBIF==1)
{
INTCONbits.RBIE = 0; //RB电平中断禁止
HIGHorLow=DRV_LEVEL_NOW;
INTCONbits.RBIF = 0; //清电平中断标志
if(HIGHorLow==1)
{
;
}
if(HIGHorLow==0)
{
;
}
INTCONbits.RBIE = 1; //RB电平中断
}
}
我的中断服务代码 |