d7140feb833f208dd797607a56a01d6e60b98e2f.svn-base 3.4 KB

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