#include "isr.h" #include "command.h" #include "ina226.h" //UART1中断 void UART1_Isr() interrupt 4 { uint8 res; static uint8 dwon_count; if(UART1_GET_TX_FLAG) { UART1_CLEAR_TX_FLAG; busy[1] = 0; } if(UART1_GET_RX_FLAG) { UART1_CLEAR_RX_FLAG; res = SBUF; //程序自动下载 if(res == 0x7F) { if(dwon_count++ > 20) { IAP_CONTR = 0x60; } } else { dwon_count = 0; } command_uart_callback(res); } } //UART2中断 void UART2_Isr() interrupt 8 { if(UART2_GET_TX_FLAG) { UART2_CLEAR_TX_FLAG; busy[2] = 0; } if(UART2_GET_RX_FLAG) { UART2_CLEAR_RX_FLAG; //接收数据寄存器为:S2BUF } } //UART3中断 void UART3_Isr() interrupt 17 { if(UART3_GET_TX_FLAG) { UART3_CLEAR_TX_FLAG; busy[3] = 0; } if(UART3_GET_RX_FLAG) { UART3_CLEAR_RX_FLAG; //接收数据寄存器为:S3BUF } } //UART4中断 void UART4_Isr() interrupt 18 { if(UART4_GET_TX_FLAG) { UART4_CLEAR_TX_FLAG; busy[4] = 0; } if(UART4_GET_RX_FLAG) { UART4_CLEAR_RX_FLAG; //接收数据寄存器为:S4BUF; } } #define LED P52 void INT0_Isr() interrupt 0 { } void INT1_Isr() interrupt 2 { } void INT2_Isr() interrupt 10 { INT2_CLEAR_FLAG; //清除中断标志 } void INT3_Isr() interrupt 11 { INT3_CLEAR_FLAG; //清除中断标志 } void INT4_Isr() interrupt 16 { INT4_CLEAR_FLAG; //清除中断标志 } void TM0_Isr() interrupt 1 { } void TM1_Isr() interrupt 3 { INA226_Read(&ina226[0]); P07 ^= 0x01; } void TM2_Isr() interrupt 12 { TIM2_CLEAR_FLAG; //清除中断标志 } void TM3_Isr() interrupt 19 { TIM3_CLEAR_FLAG; //清除中断标志 } void TM4_Isr() interrupt 20 { TIM4_CLEAR_FLAG; //清除中断标志 } // void change_LED(); void P0_ISR() interrupt P0INT_VECTOR { if(P0INTF & 0x10) //P0.4 { P0INTF &= ~0x10; } if(P0INTF & 0x20) //P0.5 { P0INTF &= ~0x20; } } //void INT0_Isr() interrupt 0; //void TM0_Isr() interrupt 1; //void INT1_Isr() interrupt 2; //void TM1_Isr() interrupt 3; //void UART1_Isr() interrupt 4; //void ADC_Isr() interrupt 5; //void LVD_Isr() interrupt 6; //void PCA_Isr() interrupt 7; //void UART2_Isr() interrupt 8; //void SPI_Isr() interrupt 9; //void INT2_Isr() interrupt 10; //void INT3_Isr() interrupt 11; //void TM2_Isr() interrupt 12; //void INT4_Isr() interrupt 16; //void UART3_Isr() interrupt 17; //void UART4_Isr() interrupt 18; //void TM3_Isr() interrupt 19; //void TM4_Isr() interrupt 20; //void CMP_Isr() interrupt 21; //void I2C_Isr() interrupt 24; //void USB_Isr() interrupt 25; //void PWM1_Isr() interrupt 26; //void PWM2_Isr() interrupt 27;