📄 main.lst
字号:
164 3
165 3 }
166 2
167 2 }
168 1 if (type==1)
169 1 {
170 2 if (bits==8)
171 2 {
172 3 i = value&0x000000ff;
173 3
174 3 Uart0_SendByte(ASCII[i/100]);
175 3 Uart0_SendByte(ASCII[(i%100)/10]);
176 3 Uart0_SendByte(ASCII[i%10]);
177 3 }
178 2 else if (bits==16)
C51 COMPILER V8.08 MAIN 01/08/2009 16:11:56 PAGE 4
179 2 {
180 3 k = value&0x000000ff;
181 3
182 3 Uart0_SendByte(ASCII[k/10000]);
183 3 Uart0_SendByte(ASCII[(k%10000)/1000]);
184 3 Uart0_SendByte(ASCII[(k%1000)/100]);
185 3 Uart0_SendByte(ASCII[(k%100)/10]);
186 3 Uart0_SendByte(ASCII[i%10]);
187 3
188 3
189 3 }
190 2
191 2
192 2 }
193 1
194 1
195 1 }
196
197 void main(void)
198 {
199 1
200 1 WDTCN = 0xde; // disable watchdog timer
201 1 WDTCN = 0xad;
202 1
203 1 SYSCLK_Init(); // initialize oscillator
204 1 PORT_Init(); // initialize crossbar and GPIO
205 1
206 1 //LCDC_Init();
207 1 //LCDC_DisFull(Clr);
208 1 //dis_start0();
209 1
210 1 Uart0_Init(115200);
211 1 Uart0_SendString("*******************************************************************************\n");
212 1 Uart0_SendString("* Copyright (c) 2004,西安铭朗电子科技有限责任公司\n");
213 1 Uart0_SendString("* All rights reserved. \n");
214 1 Uart0_SendString("* \n");
215 1 Uart0_SendString("* web:www,mlarm.com\n");
216 1 Uart0_SendString("* UCOS-II Test program.\n");
217 1 Uart0_SendString("* Write By: Gavin Li\n");
218 1 Uart0_SendString("********************************************************************************\n");
219 1
220 1
221 1 OSInit();
222 1 InitTimer0(SYSCLK);
223 1 OSTaskCreate(TaskStart, (void *)0, (void *)&TaskStartStk[0], START_TASK_PRIO);
224 1
225 1 OSStart();
226 1 }
227
228
229 void TaskStart (void *ddata) //reentrant
230 {
231 1 ddata = ddata; /* Prevent compiler warning */
232 1
233 1 OSStatInit(); /* Initialize uC/OS-II's statistics */
234 1
235 1 OSTaskCreate(Task_A, (void *)0, &TaskStartStk_A[0],A_TASK_PRIO);
236 1 OSTaskCreate(Task_B, (void *)0, &TaskStartStk_B[0],B_TASK_PRIO);
237 1 OSTaskCreate(Task_C, (void *)0, &TaskStartStk_C[0],C_TASK_PRIO);
238 1
239 1 for (;;)
240 1 {
C51 COMPILER V8.08 MAIN 01/08/2009 16:11:56 PAGE 5
241 2 Uart0_SendString("Tasks =");
242 2 display_num(1,8,OSTaskCtr);
243 2 Uart0_SendString("\r\n");
244 2
245 2 Uart0_SendString("CPU Usage =");
246 2 display_num(1,8,OSCPUUsage);
247 2 Uart0_SendString("%\r\n");
248 2
249 2 Uart0_SendString("Task switch/sec =");
250 2 display_num(1,8,OSCtxSwCtr);
251 2 Uart0_SendString("\r\n");
252 2
253 2 OSCtxSwCtr = 0;
254 2 OSTimeDly(OS_TICKS_PER_SEC); /* Wait one second *
-/
255 2 }
256 1 }
257
258
259
260
261
262
263
264 void Task_A(void *yydata) //reentrant
265 {
266 1 unsigned char i;
267 1
268 1
269 1 for (i=0;i<255;i++)
270 1 buf[i] = i*1000;
271 1
272 1 yydata=yydata;
273 1
274 1 for(;;){
275 2 Uart0_SendString("Task_A is active.\n");
276 2 A_LED = ~A_LED;
277 2 for (i=0;i<255;i++)
278 2 buf[i] = buf[i]*buf[i];
279 2
280 2 OSTimeDly(OS_TICKS_PER_SEC/2);
281 2 }
282 1 }
283
284 void Task_B(void *yydata) //reentrant
285 {
286 1
287 1 unsigned char i;
288 1 for (i=0;i<255;i++)
289 1 bufb[i] = i*1000;
290 1
291 1 yydata=yydata;
292 1
293 1 for(;;){
294 2 Uart0_SendString("Task_B is active.\n");
295 2 B_LED = ~B_LED;
296 2 for (i=0;i<255;i++)
297 2 bufb[i] = bufb[i]*bufb[i];
298 2 OSTimeDly(OS_TICKS_PER_SEC);
299 2 }
300 1 }
301
C51 COMPILER V8.08 MAIN 01/08/2009 16:11:56 PAGE 6
302 void Task_C(void *yydata) //reentrant
303 {
304 1 signed long bufc[150];
305 1 unsigned char i;
306 1 for (i=0;i<150;i++)
307 1 bufc[i] = i*1000;
308 1
309 1 yydata=yydata;
310 1
311 1 for(;;){
312 2 Uart0_SendString("Task_C is active.\n");
313 2 C_LED = ~C_LED;
314 2 for (i=0;i<150;i++)
315 2 bufc[i] = bufc[i]*bufc[i];
316 2 OSTimeDly(2*OS_TICKS_PER_SEC);
317 2 }
318 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1771 ----
CONSTANT SIZE = 441 ----
XDATA SIZE = 2448 621
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
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 + -