813344143d85d245ea8490ed19aece026f3e8007.svn-base 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /******************************************************************************/
  2. /* -- 居加居-- */
  3. /*
  4. // 文件名:
  5. // 说明:
  6. // 编写人员:kinve
  7. // 编写日期:2018-8-21
  8. // 程序维护:
  9. // 维护记录:
  10. //
  11. //
  12. */
  13. // 免责声明:
  14. // (c) Anxinke Corporation. All rights reserved.
  15. /******************************************************************************/
  16. #include "Interrupt.h"
  17. #include "Timer.h"
  18. uint32 sys_ms = 0;
  19. uint16 TaskTime = 0;
  20. struct bit_def Status0, Status1;
  21. /*
  22. 源 中断地址 中断号 源 中断址地 中断号
  23. 复位 0000H - SPI 中断 004BH 9
  24. 外部中断0 0003H 0 WDT 中断 0053H 10
  25. 定时器0溢出 000BH 1 ADC 中断 005BH 11
  26. 外部中断 1 0013H 2 定时器输入捕获中断 0063H 12
  27. 定时器1溢出 001BH 3 PWM 中断 006BH 13
  28. 串口 0 中断 0023H 4 故障刹车中断 0073H 14
  29. 定时器2事件 002BH 5 串口1中断 007BH 15
  30. I2C状态/超时中断 0033H 6 定时器3溢出中断 0083H 16
  31. 管脚中断 003BH 7 WKT自唤醒定时器中断 008BH 17
  32. 欠压检测中断 0043H 8
  33. */
  34. /************************************************************************************************************
  35. * TIMER 0 interrupt subroutine
  36. ************************************************************************************************************/
  37. #ifdef N76E003_IAR
  38. #pragma vector=0x0B
  39. __interrupt void Timer0_ISR ( void )
  40. #else
  41. void Timer0_ISR ( void ) interrupt 1 //interrupt address is 0x000B
  42. #endif
  43. {
  44. TH0 = HIBYTE ( Timer0_THTL );
  45. TL0 = LOBYTE ( Timer0_THTL );
  46. sys_ms += TIMER_SCAN;
  47. if ( sys_ms >= 86400000 ) //2^32 >= 24个小时
  48. {
  49. sys_ms = 0;
  50. }
  51. TaskTime += TIMER_SCAN; //0~8000
  52. if ( TaskTime % 2 == 0 )
  53. {
  54. System_Flag_2Ms = 1;
  55. }
  56. if ( TaskTime % 10 == 0 )
  57. {
  58. System_Flag_10Ms = 1;
  59. //T10MS_Count_Handler();
  60. }
  61. if ( TaskTime % 20 == 0 )
  62. {
  63. System_Flag_20Ms = 1;
  64. //ScanKey();
  65. }
  66. if ( TaskTime % 100 == 0 )
  67. {
  68. System_Flag_100Ms = 1;
  69. }
  70. if ( TaskTime % 200 == 0 )
  71. {
  72. System_Flag_200Ms = 1;
  73. }
  74. if ( TaskTime % 500 == 0 )
  75. {
  76. System_Flag_500Ms = 1;
  77. }
  78. if ( TaskTime % 1000 == 0 )
  79. {
  80. System_Flag_1s = 1;
  81. }
  82. if ( TaskTime % 5000 == 0 )
  83. {
  84. System_Flag_5s = 1;
  85. TaskTime = 0;
  86. }
  87. /*
  88. if ( BeepCounter )
  89. {
  90. if ( --BeepCounter == 0 ) StopBeep();
  91. }
  92. */
  93. }
  94. /************************************************************************************************************
  95. * TIMER 1 interrupt subroutine
  96. ************************************************************************************************************/
  97. #ifdef N76E003_IAR
  98. #pragma vector=0x1B
  99. __interrupt void Timer1_ISR ( void )
  100. #else
  101. void Timer1_ISR ( void ) interrupt 3 //interrupt address is 0x001B
  102. #endif
  103. {
  104. }
  105. /*
  106. 中断源 中断地址 中断号
  107. 复位 0000H -
  108. 外部中断0 0003H 0
  109. 定时器0溢出 000BH 1
  110. 外部中断1 0013H 2
  111. 定时器1溢出 001BH 3
  112. 串口0 中断 0023H 4
  113. 定时器2事件 002BH 5
  114. I2C状态/超时中断 0033H 6
  115. 管脚中断 003BH 7
  116. 欠压检测中断 0043H 8
  117. SPI中断 004BH 9
  118. WDT中断 0053H 10
  119. ADC中断 005BH 11
  120. 定时器输入捕获中断 0063H 12
  121. PWM中断 006BH 13
  122. 故障刹车中断 0073H 14
  123. 串口1中断 007BH 15
  124. 定时器3溢出中断 0083H 16
  125. WKT自唤醒定时器中断 008BH 17
  126. */