| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- /************************************************************************
- * ---- 居加居 ----
- * 文件名: Interrupt.c
- * 编写人员: Kinve JQ
- * 说明:
- * 版本: V0.1
- * 编写日期: 2018-09-30
- * 程序维护:
- * 维护记录:
- * 2018-09-30.Kinve:1.创建文件
- * 免责声明:
- * (c) Author Kinve JQ. All rights reserved.
- **************************************************************************/
- #include "Interrupt.h"
- #include "Timer.h"
- #include "Keys.h"
- uint32 sys_ms = 0;
- uint16 TaskTime = 0;
- struct bit_def Status0, Status1;
- /*
- 源 中断地址 中断号 源 中断址地 中断号
- 复位 0000H - SPI 中断 004BH 9
- 外部中断0 0003H 0 WDT 中断 0053H 10
- 定时器0溢出 000BH 1 ADC 中断 005BH 11
- 外部中断 1 0013H 2 定时器输入捕获中断 0063H 12
- 定时器1溢出 001BH 3 PWM 中断 006BH 13
- 串口 0 中断 0023H 4 故障刹车中断 0073H 14
- 定时器2事件 002BH 5 串口1中断 007BH 15
- I2C状态/超时中断 0033H 6 定时器3溢出中断 0083H 16
- 管脚中断 003BH 7 WKT自唤醒定时器中断 008BH 17
- 欠压检测中断 0043H 8
- */
- /************************************************************************************************************
- * TIMER 0 interrupt subroutine
- ************************************************************************************************************/
- #ifdef N76E003_IAR
- #pragma vector=0x0B
- __interrupt void Timer0_ISR ( void )
- #else
- void Timer0_ISR ( void ) interrupt 1 //interrupt address is 0x000B
- #endif
- {
- TH0 = HIBYTE ( Timer0_THTL );
- TL0 = LOBYTE ( Timer0_THTL );
- sys_ms += TIMER_SCAN;
- if ( sys_ms >= 86400000 ) //2^32 >= 24个小时
- {
- sys_ms = 0;
- }
- TaskTime += TIMER_SCAN; //0~8000
- if ( TaskTime % 2 == 0 )
- {
- System_Flag_2Ms = 1;
- }
- if ( TaskTime % 10 == 0 )
- {
- System_Flag_10Ms = 1;
- //T10MS_Count_Handler();
- }
- if ( TaskTime % 20 == 0 )
- {
- System_Flag_20Ms = 1;
- Keys_Even();
- }
- if ( TaskTime % 100 == 0 )
- {
- System_Flag_100Ms = 1;
- }
- if ( TaskTime % 200 == 0 )
- {
- System_Flag_200Ms = 1;
- }
- if ( TaskTime % 500 == 0 )
- {
- System_Flag_500Ms = 1;
- }
- if ( TaskTime % 1000 == 0 )
- {
- System_Flag_1s = 1;
- }
- if ( TaskTime % 5000 == 0 )
- {
- System_Flag_5s = 1;
- TaskTime = 0;
- }
- /*
- if ( BeepCounter )
- {
- if ( --BeepCounter == 0 ) StopBeep();
- }
- */
- }
- /************************************************************************************************************
- * TIMER 1 interrupt subroutine
- ************************************************************************************************************/
- #ifdef N76E003_IAR
- #pragma vector=0x1B
- __interrupt void Timer1_ISR ( void )
- #else
- void Timer1_ISR ( void ) interrupt 3 //interrupt address is 0x001B
- #endif
- {
- }
- /*
- 中断源 中断地址 中断号
- 复位 0000H -
- 外部中断0 0003H 0
- 定时器0溢出 000BH 1
- 外部中断1 0013H 2
- 定时器1溢出 001BH 3
- 串口0 中断 0023H 4
- 定时器2事件 002BH 5
- I2C状态/超时中断 0033H 6
- 管脚中断 003BH 7
- 欠压检测中断 0043H 8
- SPI中断 004BH 9
- WDT中断 0053H 10
- ADC中断 005BH 11
- 定时器输入捕获中断 0063H 12
- PWM中断 006BH 13
- 故障刹车中断 0073H 14
- 串口1中断 007BH 15
- 定时器3溢出中断 0083H 16
- WKT自唤醒定时器中断 008BH 17
- */
- /*************** (C) COPYRIGHT Kinve JQ *******END OF FILE **************/
|