?? cpu.lst
字號:
137 1 }
138
139
140 /********************************************************************************/
141 /* fun_name : CPU_timer_2_initialize() */
142 /* version : v1.00 */
143 /* created : xillinx */
144 /* descript : 定時器2初始化,用作紅外部分接收 */
145 /* T=12/OSC=12/44236800=0.01736
146 /********************************************************************************/
147 void CPU_timer_2_initialize(void)
148 { C_T2 =0x00; //* 內部定時器
149 1 T2MOD &=0xFE; //* DCEN=0x0,遞增計數器,遞增計數到0xFFFF后,溢出,然后在把RCAP2L和RCAP2H加載到TL2和T
-H2
150 1 RCAP2L =0x00; //* 如果溢出了,就重新從0開始遞增計數
151 1 RCAP2H =0x00;
152 1 TL2 =0x00;
153 1 TH2 =0x00;
154 1 TR2 =0x00;
155 1 }
156
157
158 /********************************************************************************/
159 /* fun_name : CPU_extern_0_interrupt() */
160 /* version : v1.00 */
161 /* created : xillinx */
162 /********************************************************************************/
163 void CPU_extern_0_interrupt(void) interrupt 0
164 { CPU_extern_0_process();
165 1 }
166
167 /********************************************************************************/
168 /* fun_name : CPU_extern_1_interrupt() */
169 /* descript : For USB */
170 /* version : v1.00 */
171 /* created : xillinx */
172 /********************************************************************************/
173 void CPU_extern_1_interrupt(void) interrupt 2
174 { CPU_extern_1_process();
175 1 }
176
177 /********************************************************************************/
C51 COMPILER V8.02 CPU 10/19/2008 17:05:12 PAGE 4
178 /* fun_name : CPU_serial_1_interrupt() */
179 /* version : v1.00 */
180 /* created : xillinx */
181 /* descript : For uart */
182 /********************************************************************************/
183 void CPU_serial_1_interrupt(void) interrupt 4
184 { if( RI==1)
185 1 { RI=0;
186 2 UART_recv_isr_process();
187 2 }
188 1 else if(TI==1)
189 1 { TI=0;
190 2 UART_xmit_isr_process();
191 2 }
192 1 }
193
194 /********************************************************************************/
195 /* fun_name : CPU_source_initialize() */
196 /* version : v1.00 */
197 /* created : xillinx */
198 /* descript : 控制CPU的資源使用 */
199 /********************************************************************************/
200 void CPU_source_initialize (void)
201 { CPU_timer_0_initialize();
202 1 CPU_timer_2_initialize();
203 1 CPU_uart_serial_initial();
204 1 IT0 = 0x1; //* 選擇中斷類型: 0<==>低電平,1<==>下降沿
205 1 EX0 = 0x1; //* 外部中斷0
206 1 ET0 = 0x1; //* 定時器0
207 1 EX1 = 0x0; //* 外部中斷1
208 1 ET1 = 0x0; //* 定時器1
209 1 ES = 0x1; //* UART串口0
210 1 EA = 0x1; //* 全局中斷控制
211 1 }
212
213
214 /********************************************************************************/
215 /* fun_name : CPU_timer_0_interrupt() */
216 /* version : v1.00 */
217 /* created : xillinx */
218 /********************************************************************************/
219 void CPU_timer_interrupt(void)
220 { CPU_soft_timer_lo++;
221 1 system_timer++; //* for system time operator
222 1 CPU_001_tick_process();
223 1 if((CPU_soft_timer_lo&0x01)==0x0)
224 1 { CPU_002_tick_process();
225 2 }
226 1 if((CPU_soft_timer_lo&0x03)==0x0)
227 1 { CPU_004_tick_process();
228 2 }
229 1 if((CPU_soft_timer_lo&0x07)==0x0)
230 1 { CPU_008_tick_process();
231 2 }
232 1 if((CPU_soft_timer_lo&0x0F)==0x0)
233 1 { CPU_010_tick_process();
234 2 }
235 1 if((CPU_soft_timer_lo&0x1F)==0x0)
236 1 { CPU_020_tick_process();
237 2 }
238 1 if((CPU_soft_timer_lo&0x3F)==0x0)
239 1 { CPU_040_tick_process();
C51 COMPILER V8.02 CPU 10/19/2008 17:05:12 PAGE 5
240 2 }
241 1 if((CPU_soft_timer_lo&0x7F)==0x0)
242 1 { CPU_080_tick_process();
243 2 }
244 1 if((CPU_soft_timer_lo&0xFF)==0x0)
245 1 { CPU_100_tick_process();
246 2 CPU_soft_timer_hi++;
247 2 if((CPU_soft_timer_hi&0x01)==0x0)
248 2 { CPU_200_tick_process();
249 3 }
250 2 if((CPU_soft_timer_hi&0x03)==0x0)
251 2 { CPU_400_tick_process();
252 3 }
253 2 }
254 1 }
255
256
257 /********************************************************************************/
258 /* fun_name : CPU_timer_2_interrupt() */
259 /* descript : 定時器2中斷 */
260 /* version : v1.00 */
261 /* created : xillinx */
262 /********************************************************************************/
263 void CPU_timer_2_interrupt(void) interrupt 5
264 { TF2=0x0;
265 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 562 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = 44 ----
PDATA SIZE = ---- ----
DATA SIZE = 2 ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -