main.lst
资源名称:QFI4ddQe.rar [点击查看]
上传用户:tzjinxin1
上传日期:2022-08-08
资源大小:272k
文件大小:4k
源码类别:
嵌入式/单片机编程
开发平台:
Visual C++
- C51 COMPILER V8.02 MAIN 06/22/2006 12:13:15 PAGE 1
- C51 COMPILER V8.02, COMPILATION OF MODULE MAIN
- OBJECT MODULE PLACED IN .objmain.obj
- COMPILER INVOKED BY: C:KeilC51BINC51.EXE Sourcemain.c LARGE BROWSE DEBUG OBJECTEXTEND PRINT(.lstmain.lst) OBJECT(
- -.objmain.obj)
- line level source
- 1 /*
- 2
- 3 www.mcu123.net/bbs
- 4 学习论坛
- 5
- 6 本例程ucOS-II 版本为2.51
- 7
- 8 */
- 9
- 10
- 11 #include "includes.h"
- 12 #include "serial.h"
- 13
- 14 sbit LED1=P1^5;
- 15 sbit LED2=P1^6;
- 16 unsigned char xdata strbuf[8];
- 17
- 18 OS_STK TaskStartStk1[MaxStkSize],TaskStartStk2[MaxStkSize],TaskStartStk3[MaxStkSize];
- 19
- 20 void Task1(void *nouse) reentrant;
- 21 void Task2(void *nouse) reentrant;
- 22 void Task3(void *nouse) reentrant;
- 23
- 24 void DecTochar(unsigned int n,unsigned char *buf)
- 25 { unsigned char i;
- 26 1 unsigned char buffer[8];
- 27 1 for(i=0;i<5;i++)
- 28 1 {
- 29 2 buffer[i]=n%10+0x30;
- 30 2 n=n/10;
- 31 2 if(n==0)break;
- 32 2 }
- 33 1
- 34 1 for(;i>0;i--)*buf++=buffer[i];
- 35 1
- 36 1 *buf++=buffer[i];
- 37 1 *buf='r';
- 38 1 buf++;
- 39 1 *buf='n';
- 40 1 }
- 41
- 42 void main(void)
- 43 {
- 44 1 OSInit();
- 45 1 InitHardware();
- 46 1 OSTaskCreate(Task1, (void *)0, &TaskStartStk1[0],2);
- 47 1 OSTaskCreate(Task2, (void *)0, &TaskStartStk2[0],3);
- 48 1 OSTaskCreate(Task3, (void *)0, &TaskStartStk3[0],4);
- 49 1 OSStart();
- 50 1 }
- 51
- 52 void Task1(void *nouse) reentrant
- 53 {
- 54 1 unsigned char const Str0[]="Welcome to MCU123.COM rn";
- C51 COMPILER V8.02 MAIN 06/22/2006 12:13:15 PAGE 2
- 55 1 unsigned char const Str1[]="Task1 is running! LED1=ON rn";
- 56 1 unsigned char const Strv[]="uCosII_Ver";
- 57 1 nouse=nouse;
- 58 1
- 59 1 SendStr(Str0, sizeof(Str0));
- 60 1 DecTochar(OSVersion(),strbuf);
- 61 1 SendStr(Strv,sizeof(Strv));
- 62 1 SendStr(strbuf, sizeof(strbuf));
- 63 1 for(;;)
- 64 1 {
- 65 2 LED1 = 0;
- 66 2 SendStr(Str1, sizeof(Str1));
- 67 2
- 68 2 OSTimeDly(OS_TICKS_PER_SEC*2);
- 69 2 }
- 70 1 }
- 71
- 72 void Task2(void *nouse) reentrant
- 73 { unsigned char const Str2[]="Task2 is running! LED2=ON rn";
- 74 1 nouse=nouse;
- 75 1 for(;;)
- 76 1 {
- 77 2 LED2 = 0;
- 78 2 SendStr(Str2, sizeof(Str2));
- 79 2 OSTimeDly(OS_TICKS_PER_SEC*2);
- 80 2 }
- 81 1 }
- 82
- 83 void Task3(void *nouse) reentrant
- 84 { unsigned char const Str3[]="Task3 is running! LED1=OFF LED2=OFF rn";
- 85 1 nouse=nouse;
- 86 1 for(;;)
- 87 1 {
- 88 2 LED1 = 1;
- 89 2 LED2 = 1;
- 90 2 SendStr(Str3, sizeof(Str3));
- 91 2 OSTimeDly(OS_TICKS_PER_SEC);
- 92 2 }
- 93 1 }
- MODULE INFORMATION: STATIC OVERLAYABLE
- CODE SIZE = 847 ----
- CONSTANT SIZE = 133 ----
- XDATA SIZE = 308 14
- PDATA SIZE = ---- ----
- DATA SIZE = ---- ----
- IDATA SIZE = ---- ----
- BIT SIZE = ---- ----
- END OF MODULE INFORMATION.
- C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)