sec.lst

来自「单片及c语言轻松入门的随书光盘」· LST 代码 · 共 129 行

LST
129
字号
C51 COMPILER V7.06   SEC                                                                   02/28/2006 10:31:11 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE SEC
OBJECT MODULE PLACED IN sec.OBJ
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE sec.c BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          #include "intrins.h"
   2          #include <rtx51tny.h> 
   3          #include "reg51.h"
   4          #include "intrins.h"
   5          #define uchar unsigned char
   6          #define uint unsigned int
   7          #define Init 0  //初始化
   8          #define Disp 1   //显示程序定为任务1
   9          #define Led  2  //LED闪烁定为任务2
  10          #define Data 3  //数值处理
  11          #define Key  4   //键盘操作定义为任务3
  12          
  13          bit   StartLedFlash;    //启停LED流动
  14          bit     LeftRight;              //流动方向
  15          
  16           uchar BitTab[]={0x7F,0xBF,0xDF,0xEf,0xF7,0xFB};
  17          uchar DispTab[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90,0x88,0x83,
  18          0xC6,0xA1,0x86,0x8E,0xFF};
  19          uchar DispBuf[6];
  20          uint  Count=0;  //计数值
  21          void job0 (void ) _task_ Init {
  22   1              TH1=-(10000/256);
  23   1              TL1=-(10000%256);       
  24   1          TMOD|=0x10;         
  25   1              ET1=1;                          
  26   1              TR1=1;                          
  27   1          PT1=1;                              
  28   1      os_create_task (Disp); 
  29   1      os_create_task (Led); 
  30   1      os_create_task (Data);
  31   1      os_create_task (Key);
  32   1      os_delete_task (0);
  33   1      }
  34          void Display(void) _task_ Disp{
  35   1          static uchar DispCount;
  36   1              while(1){
  37   2                      P2=0xff;                //全灭
  38   2                      P0=DispTab[DispBuf[DispCount]];
  39   2                      P2=BitTab[DispCount];
  40   2                      DispCount++;
  41   2                      if(DispCount==6)
  42   2                              DispCount=0;
  43   2                      os_wait2(K_IVL,4);      
  44   2              }
  45   1      }
  46          void Timer1() interrupt 3
  47          {       TH1=-(10000/256);
  48   1              TL1=-(10000%256);       
  49   1              isr_send_signal(Led);//送出信号
  50   1      }
  51          void LedFlash(void) _task_ Led{
  52   1              static uchar FlashLed=0xfe;
  53   1              static uchar LedCount;
  54   1              while(1)
  55   1              {       LedCount++;
C51 COMPILER V7.06   SEC                                                                   02/28/2006 10:31:11 PAGE 2   

  56   2                      Count++;                //计数值不断加1
  57   2                      if(LedCount>=100) 
  58   2                      {       if(StartLedFlash)  // 
  59   3                              {       P1=FlashLed;
  60   4                                      if(LeftRight)   
  61   4                                              FlashLed=_crol_(FlashLed,1);
  62   4                                      else                                    
  63   4                                              FlashLed=_cror_(FlashLed,1);
  64   4                              }               
  65   3                              LedCount=0;
  66   3                      }
  67   2                      os_wait(K_SIG,1,0);     //等待信号
  68   2              }
  69   1      }
  70          void DataProcess(void) _task_ Data{
  71   1              uint tmp;
  72   1              while(1){       tmp=Count;
  73   2                      DispBuf[4]=tmp%10;
  74   2                      tmp/=10;
  75   2                      DispBuf[3]=tmp%10;
  76   2                      tmp/=10;
  77   2                      DispBuf[2]=tmp%10;
  78   2                      tmp/=10;
  79   2                      DispBuf[1]=tmp%10;
  80   2                      DispBuf[0]=tmp/10;
  81   2              }
  82   1      }
  83          void KeyValue(uchar KeyV)
  84          {       if((KeyV|0xfb)!=0xff)   
  85   1                      StartLedFlash=1;
  86   1              else if((KeyV|0xf7)!=0xff)
  87   1                      StartLedFlash=0;
  88   1              else if((KeyV|0xef)!=0xff)
  89   1                      LeftRight=1;
  90   1              else if((KeyV|0xdf)!=0xff)
  91   1                      LeftRight=0;
  92   1      }
  93          void KeyProcess(void) _task_ Key{
  94   1              uchar tmp;
  95   1              while(1)
  96   1              {       P3|=0x3c;       //中间4位置高电平
  97   2                      tmp=P3;
  98   2                      tmp|=0xc3;      //两边4位置高电平
  99   2                      if(tmp!=0xff)
 100   2                              KeyValue(tmp);
 101   2                      os_wait(K_IVL,2,0);
 102   2              }
 103   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    385    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     34    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =      2    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?