之前写的INT0中断已经对了,用同样的思路写了INT1中断,INT1设为低优先级中断,但是没有响应,没找到问题所在,求助高手。。程序如下#include<p18f26k80.h>
void int1_isr(void);
#pragma code InterruptVectorLow = 0x18
void InterruptVectorLow(void)
{
_asm
goto int1_isr
_endasm
}
#pragma code
#pragma interrupt int1_isr
void int1_isr(void)
{
if(INTCON3bits.INT1IF==1)
{
PORTC=~PORTC;
INTCON3bits.INT1IF=0;
}
}
void main(void)
{
TRISB=0xff; //config PORTB as Input
TRISC=0x00; //config PORTC as Output
ANCON0=0x00;
ANCON1=0x00; //config PORTB as Digtal Port
PORTC=0x44;
RCONbits.IPEN=1; //Enable Interrupt Priority
INTCON=0xC0; //Enable Low Priority Interrupt
INTCON2bits.INTEDG1=0; //下降沿触发中断
INTCON3bits.INT1IP=0; //INT1 Low Priority Interrupt
INTCON3bits.INT1IF=0; //Clear INT1 Flag
INTCON3bits.INT1IE=0; //Enable INT1
while(1);
}
此帖出自
小平头技术问答
晕,低级错误啊,呵呵
一周热门 更多>