中断处理是单片机中必备的一个机能,Ai8051U中拥有多达50多个。
中断源 | 中断向量 |
外部中断 0 中断(INT0) | FF0003H |
定时器 0 中断(Timer0) | FF000BH |
外部中断 1 中断(INT1) | FF0013H |
定时器 1 中断(Timer1) | FF001BH |
串口 1 中断(UART1) | FF0023H |
模数转换中断(ADC) | FF002BH |
低压检测中断(LVD) | FF0033H |
CCP/PCA/PWM 中断 | FF003BH |
串口 2 中断(UART2) | FF0043H |
串行外设接口中断(SPI) | FF004BH |
外部中断 2 中断(INT2) | FF0053H |
外部中断 3 中断(INT3) | FF005BH |
定时器 2 中断(Timer2) | FF0063H |
外部中断 4 中断(INT4) | FF0083H |
串口 3 中断(UART3) | FF008BH |
串口 4 中断(UART4) | FF0093H |
定时器 3 中断(Timer3) | FF009BH |
定时器 4 中断(Timer4) | FF00A3H |
比较器中断(CMP) | FF00ABH |
I2C 总线中断 | FF00C3H |
USB中断 | FF00CBH |
PWMA | FF00D3H |
PWMB | FF00DBH |
RTC 中断 | FF0123H |
P0 口中断 | FF012BH |
P1 口中断 | FF0133H |
P2 口中断 | FF013BH |
P3 口中断 | FF0143H |
P4 口中断 | FF014BH |
P5 口中断 | FF0153H |
P6 中断 | FF015BH |
P7 中断 | FF0163H |
M2M_DMA 中断 | FF017BH |
ADC_DMA 中断 | FF0183H |
SPI_DMA 中断 | FF018BH |
串口 1 发送 DMA 中断 | FF0193H |
串口 1 接收 DMA 中断 | FF019BH |
串口 2 发送 DMA 中断 | FF01A3H |
串口 2 接收 DMA 中断 | FF01ABH |
串口 3 发送 DMA 中断 | FF01B3H |
串口 3 接收 DMA 中断 | FF01BBH |
串口 4 发送 DMA 中断 | FF01C3H |
串口 4 接收 DMA 中断 | FF01CBH |
TFT 彩屏 DMA 中断 | FF01D3H |
TFT 彩屏中断 | FF01DBH |
I2C 发送 DMA 中断 | FF01E3H |
I2C 接收 DMA 中断 | FF01EBH |
I2S 中断 | FF01F3H |
I2S 发送 DMA 中断 | FF01FBH |
I2S 接收 DMA 中断 | FF0203H |
QSPI_DMA 中断 | FF020BH |
QSPI 中断 | FF0213H |
定时器 11 中断(Timer11) | FF021BH |
PWMA 发送 DMA 中断 | FF0243H |
PWMA 接收 DMA 中断 | FF024BH |
在C语言中声明中断服务的代码:
void INT0_Routine(void) interrupt 0;
void TM0_Rountine(void) interrupt 1;
void INT1_Routine(void) interrupt 2;
void TM1_Rountine(void) interrupt 3;
void UART1_Routine(void) interrupt 4;
void ADC_Routine(void) interrupt 5;
void LVD_Routine(void) interrupt 6;
void PCA_Routine(void) interrupt 7;
void UART2_Routine(void) interrupt 8;
void SPI_Routine(void) interrupt 9;
void INT2_Routine(void) interrupt 10;
void INT3_Routine(void) interrupt 11;
void TM2_Routine(void) interrupt 12;
void INT4_Routine(void) interrupt 16;
void UART3_Routine(void) interrupt 17;
void UART4_Routine(void) interrupt 18;
void TM3_Routine(void) interrupt 19;
void TM4_Routine(void) interrupt 20;
void CMP_Routine(void) interrupt 21;
void I2C_Routine(void) interrupt 24;
void USB_Routine(void) interrupt 25;
void PWMA_Routine(void) interrupt 26;
void PWMB_Routine(void) interrupt 27;
中断号超过31的C语言中断服务程序不能直接用interrupt声明的,可以通过官网下载Keil用的中断扩展插件。具体操作参考《
如何下载 Keil 中断号拓展工具,及安装》章节。