e7aeea4ef4be8b137cb8654f8b12a543914a04d8.svn-base 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. C51 COMPILER V9.53.0.0 DELAY 09/30/2018 11:45:28 PAGE 1
  2. C51 COMPILER V9.53.0.0, COMPILATION OF MODULE DELAY
  3. OBJECT MODULE PLACED IN .\Output\Delay.obj
  4. COMPILER INVOKED BY: D:\Keil_v5\C51\BIN\C51.EXE ..\..\Code\User\Common\Delay.c LARGE OPTIMIZE(0,SPEED) BROWSE INCDIR(../
  5. -../Code/Include;../../Code/User;../../Code/User/Common;../../Code/User/Driver) DEFINE(FOSC_160000=1) DEBUG OBJECTEXTEND
  6. -PRINT(.\Output\LST\Delay.lst) TABS(2) OBJECT(.\Output\Delay.obj)
  7. line level source
  8. 1 /*--------------------------------------------------------------------------------------------------------
  9. --*/
  10. 2 /*
  11. - */
  12. 3 /* Copyright(c) 2017 Nuvoton Technology Corp. All rights reserved.
  13. - */
  14. 4 /*
  15. - */
  16. 5 /*--------------------------------------------------------------------------------------------------------
  17. --*/
  18. 6
  19. 7 //********************************************************************************************************
  20. -***
  21. 8 // Website: http://www.nuvoton.com
  22. 9 // E-Mail : [email protected]
  23. 10 // Date : Jan/21/2017
  24. 11 //********************************************************************************************************
  25. -***
  26. 12 #include "Common.h"
  27. 13 #include "Delay.h"
  28. 14
  29. 15 uint8 BIT_TMP;
  30. 16
  31. 17 //-------------------------------------------------------------------------
  32. 18 void Timer0_Delay100us ( uint32 u32CNT )
  33. 19 {
  34. 20 1 clr_T0M; //T0M=0, Timer0 Clock = Fsys/12
  35. 21 1 TMOD |= 0x01; //Timer0 is 16-bit mode
  36. 22 1 set_TR0; //Start Timer0
  37. 23 1
  38. 24 1 while ( u32CNT != 0 )
  39. 25 1 {
  40. 26 2 TL0 = LOBYTE ( TIMER_DIV12_VALUE_100us ); //Find define in "Function_define.h" "TIMER VALUE"
  41. 27 2 TH0 = HIBYTE ( TIMER_DIV12_VALUE_100us );
  42. 28 2
  43. 29 2 while ( TF0 != 1 ); //Check Timer0 Time-Out Flag
  44. 30 2
  45. 31 2 clr_TF0;
  46. 32 2 u32CNT --;
  47. 33 2 }
  48. 34 1
  49. 35 1 clr_TR0; //Stop Timer0
  50. 36 1 }
  51. 37 //------------------------------------------------------------------------------
  52. 38 void Timer0_Delay1ms ( uint32 u32CNT )
  53. 39 {
  54. 40 1 clr_T0M; //T0M=0, Timer0 Clock = Fsys/12
  55. 41 1 TMOD |= 0x01; //Timer0 is 16-bit mode
  56. 42 1 set_TR0; //Start Timer0
  57. 43 1
  58. 44 1 while ( u32CNT != 0 )
  59. 45 1 {
  60. 46 2 TL0 = LOBYTE ( TIMER_DIV12_VALUE_1ms ); //Find define in "Function_define.h" "TIMER VALUE"
  61. C51 COMPILER V9.53.0.0 DELAY 09/30/2018 11:45:28 PAGE 2
  62. 47 2 TH0 = HIBYTE ( TIMER_DIV12_VALUE_1ms );
  63. 48 2
  64. 49 2 while ( TF0 != 1 ); //Check Timer0 Time-Out Flag
  65. 50 2
  66. 51 2 clr_TF0;
  67. 52 2 u32CNT --;
  68. 53 2 }
  69. 54 1
  70. 55 1 clr_TR0; //Stop Timer0
  71. 56 1 }
  72. 57
  73. 58 //------------------------------------------------------------------------------
  74. 59 void Timer1_Delay10ms ( uint32 u32CNT )
  75. 60 {
  76. 61 1 clr_T1M; //T1M=0, Timer1 Clock = Fsys/12
  77. 62 1 TMOD |= 0x10; //Timer1 is 16-bit mode
  78. 63 1 set_TR1; //Start Timer1
  79. 64 1
  80. 65 1 while ( u32CNT != 0 )
  81. 66 1 {
  82. 67 2 TL1 = LOBYTE ( TIMER_DIV12_VALUE_10ms ); //Find define in "Function_define.h" "TIMER VALUE"
  83. 68 2 TH1 = HIBYTE ( TIMER_DIV12_VALUE_10ms );
  84. 69 2
  85. 70 2 while ( TF1 != 1 ); //Check Timer1 Time-Out Flag
  86. 71 2
  87. 72 2 clr_TF1;
  88. 73 2 u32CNT --;
  89. 74 2 }
  90. 75 1
  91. 76 1 clr_TR1; //Stop Timer1
  92. 77 1 }
  93. 78 //------------------------------------------------------------------------------
  94. 79 void Timer2_Delay500us ( uint32 u32CNT )
  95. 80 {
  96. 81 1 clr_T2DIV2; //Timer2 Clock = Fsys/4
  97. 82 1 clr_T2DIV1;
  98. 83 1 set_T2DIV0;
  99. 84 1 set_TR2; //Start Timer2
  100. 85 1
  101. 86 1 while ( u32CNT != 0 )
  102. 87 1 {
  103. 88 2 TL2 = LOBYTE ( TIMER_DIV4_VALUE_500us ); //Find define in "Function_define.h" "TIMER VALUE"
  104. 89 2 TH2 = HIBYTE ( TIMER_DIV4_VALUE_500us );
  105. 90 2
  106. 91 2 while ( TF2 != 1 ); //Check Timer2 Time-Out Flag
  107. 92 2
  108. 93 2 clr_TF2;
  109. 94 2 u32CNT --;
  110. 95 2 }
  111. 96 1
  112. 97 1 clr_TR2; //Stop Timer2
  113. 98 1 }
  114. 99 //------------------------------------------------------------------------------
  115. 100 void Timer3_Delay100ms ( uint32 u32CNT )
  116. 101 {
  117. 102 1 T3CON = 0x07; //Timer3 Clock = Fsys/128
  118. 103 1 set_TR3; //Trigger Timer3
  119. 104 1
  120. 105 1 while ( u32CNT != 0 )
  121. 106 1 {
  122. 107 2 RL3 = LOBYTE ( TIMER_DIV128_VALUE_100ms ); //Find define in "Function_define.h" "TIMER VALUE"
  123. 108 2 RH3 = HIBYTE ( TIMER_DIV128_VALUE_100ms );
  124. C51 COMPILER V9.53.0.0 DELAY 09/30/2018 11:45:28 PAGE 3
  125. 109 2
  126. 110 2 while ( ( T3CON & SET_BIT4 ) != SET_BIT4 ); //Check Timer3 Time-Out Flag
  127. 111 2
  128. 112 2 clr_TF3;
  129. 113 2 u32CNT --;
  130. 114 2 }
  131. 115 1
  132. 116 1 clr_TR3; //Stop Timer3
  133. 117 1 }
  134. 118 //------------------------------------------------------------------------------
  135. 119 void Timer3_Delay10us ( uint32 u32CNT )
  136. 120 {
  137. 121 1 T3CON = 0x02; //Timer3 Clock = Fsys/4
  138. 122 1 set_TR3; //Trigger Timer3
  139. 123 1
  140. 124 1 while ( u32CNT != 0 )
  141. 125 1 {
  142. 126 2 RL3 = LOBYTE ( TIMER_DIV4_VALUE_10us ); //Find define in "Function_define.h" "TIMER VALUE"
  143. 127 2 RH3 = HIBYTE ( TIMER_DIV4_VALUE_10us );
  144. 128 2
  145. 129 2 while ( ( T3CON & SET_BIT4 ) != SET_BIT4 ); //Check Timer3 Time-Out Flag
  146. 130 2
  147. 131 2 clr_TF3;
  148. 132 2 u32CNT --;
  149. 133 2 }
  150. 134 1
  151. 135 1 clr_TR3; //Stop Timer3
  152. 136 1 }
  153. 137
  154. 138 //------------------------------------------------------------------------------
  155. 139 #define TIMER_DIV4_VALUE_1us 65536-4 //4*4/16000000 = 1 uS, // Timer divider = 4 for TM2/TM3
  156. 140 void Timer3_Delay1us ( uint32 u32CNT )
  157. 141 {
  158. 142 1 T3CON = 0x02; //Timer3 Clock = Fsys/4
  159. 143 1 set_TR3; //Trigger Timer3
  160. 144 1
  161. 145 1 while ( u32CNT != 0 )
  162. 146 1 {
  163. 147 2 RL3 = LOBYTE ( TIMER_DIV4_VALUE_1us ); //Find define in "Function_define.h" "TIMER VALUE"
  164. 148 2 RH3 = HIBYTE ( TIMER_DIV4_VALUE_1us );
  165. 149 2
  166. 150 2 while ( ( T3CON & SET_BIT4 ) != SET_BIT4 ); //Check Timer3 Time-Out Flag
  167. 151 2
  168. 152 2 clr_TF3;
  169. 153 2 u32CNT --;
  170. 154 2 }
  171. 155 1
  172. 156 1 clr_TR3; //Stop Timer3
  173. 157 1 }
  174. 158
  175. 159 //------------------------------------------------------------------------------
  176. 160 void Timer3_Delay1ms ( uint32 u32CNT )
  177. 161 {
  178. 162 1 T3CON = 0x02; //Timer3 Clock = Fsys/4
  179. 163 1 set_TR3; //Trigger Timer3
  180. 164 1
  181. 165 1 while ( u32CNT != 0 )
  182. 166 1 {
  183. 167 2 RL3 = LOBYTE ( TIMER_DIV4_VALUE_1ms ); //Find define in "Function_define.h" "TIMER VALUE"
  184. 168 2 RH3 = HIBYTE ( TIMER_DIV4_VALUE_1ms );
  185. 169 2
  186. 170 2 while ( ( T3CON & SET_BIT4 ) != SET_BIT4 ); //Check Timer3 Time-Out Flag
  187. C51 COMPILER V9.53.0.0 DELAY 09/30/2018 11:45:28 PAGE 4
  188. 171 2
  189. 172 2 clr_TF3;
  190. 173 2 u32CNT --;
  191. 174 2 }
  192. 175 1
  193. 176 1 clr_TR3; //Stop Timer3
  194. 177 1 }
  195. 178
  196. MODULE INFORMATION: STATIC OVERLAYABLE
  197. CODE SIZE = 795 ----
  198. CONSTANT SIZE = ---- ----
  199. XDATA SIZE = 33 ----
  200. PDATA SIZE = ---- ----
  201. DATA SIZE = ---- ----
  202. IDATA SIZE = ---- ----
  203. BIT SIZE = ---- ----
  204. END OF MODULE INFORMATION.
  205. C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)