在avr Xmega设备中,只有两个IO口中断向量INT0和INT1。
我有三个应该产生三个中断的开关。我已经使用 INT0 为第一个开关编写了中断代码。现在,我可以使用 INT1 编写第二个中断,这将耗尽我的向量。以下是我的 INT0 ISR 代码:
ISR (PORTD_INT0_vect){
PORTD.INTFLAGS = 0x01; // clear INT0IF flag.
PORTD_OUT = PORTD_OUT | (1<<4); // led on.
}
我可以重新定义此 ISR 以启用第二个开关的中断吗?
我在 main 函数中设置的寄存器如下:
PORTD.INT0MASK = 0x04; // PD2 is the source of interrupt for INT0.
PORTD.INTCTRL = 0x03; // Disable INT1, enable INT0 and place it a high-priority level.
PORTD.PIN2CTRL = 0x03; // configure PD2 pin to interrupt on the low level of signal.
PMIC.CTRL = 0x07; // enable high,medium, and low level interrupts.
sei(); // enable interrupt globally.