⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 system.lst

📁 王绍伟先生的单片机入门资料
💻 LST
字号:
C51 COMPILER V7.10   SYSTEM                                                                01/02/2005 16:29:29 PAGE 1   


C51 COMPILER V7.10, COMPILATION OF MODULE SYSTEM
OBJECT MODULE PLACED IN .\system.obj
COMPILER INVOKED BY: C:\Program Files\Keil\C51\BIN\C51.EXE ..\SourceFile\system.c LARGE BROWSE DEBUG OBJECTEXTEND PRINT(
                    -.\system.lst) OBJECT(.\system.obj)

line level    source

   1          /*************************************************/
   2          
   3          /**************类型定义及说明*************/
   4          
   5          /***************2003年1月8日*******************/
   6          
   7          /************WROTE BY WANGSW********************/
   8          
   9          #include "reg52x2.h"
  10          #include <intrins.h>
  11          
  12          #include "define.h"
  13          #include "rtc.h"
  14          #include "routine.h"
  15          
  16          
  17          
  18          static bool bEA;
  19          static byte data i;
  20          static byte data MsgPoolPoint=0;
  21          static MSGTYPE data msgType;
  22          static byte data MsgPool[MSG_STACK_DEPTH][2];
  23          
  24          static byte data RTCCounter = 0;
  25          
  26          
  27          byte data g_MsgReturnValue=0;           /*for msg_queue_out return point*/
  28          
  29          byte code g_DAA[100] =                                                          /*用于十进制调整*/
  30          {
  31                  0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
  32                  0x16, 0x17, 0x18, 0x19, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x30, 0x31,
  33                  0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
  34                  0x48, 0x49, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x60, 0x61, 0x62, 0x63,
  35                  0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
  36                  0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95,
  37                  0x96, 0x97, 0x98, 0x99
  38          };
  39          
  40          /*r0~9,A~F的伪十六进制数字字符码表*/
  41          byte code g_Data2Char[16] =
  42          {
  43                  0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46
  44          };
  45          
  46          
  47          /******************************************************************************************
  48          *函数名:                Timer2Server
  49          *参数:                  无
  50          *返回值:                无
  51          *描述:                  定时器2中断服务程序,每5ms进入一次,产生一个节拍
  52                                                  Timer2Server是系统的核心
  53          *编写:                  王绍伟
  54          *版本信息:              V1.0                    2003年8月15日
C51 COMPILER V7.10   SYSTEM                                                                01/02/2005 16:29:29 PAGE 2   

  55          ******************************************************************************************/
  56          static void Timer2Server(void) interrupt 5 /*不要带指定寄存器,否则将产生移位指令出错*/
  57          {
  58   1              ET2 = 0;
  59   1              TF2 = 0;                        /*状态位必须得清除,否则中断占用时间很长*/
  60   1              /***************/
  61   1              if(++RTCCounter == 200)
  62   1              {
  63   2                      RTCCounter = 0;
  64   2                      rtc_soft_routine();                     /*定时器例行程序*/
  65   2              }
  66   1              
  67   1              routine_process();              /*r运行例行任务程序*/
  68   1      
  69   1              /****************/
  70   1              ET2 = 1;
  71   1      }
  72          
  73          /******************************************************************************************
  74          *函数名:                delay
  75          *参数:                  wData           递减字值
  76          *返回值:                无
  77          *描述:                  用来延迟一段时间
  78          *编写:                  王绍伟
  79          *版本信息:              V1.0            2003年8月15日
  80          ******************************************************************************************/
  81          extern void delay(word wData)
  82          {
  83   1              while(wData--)
  84   1              {
  85   2              #ifdef SPEEDUP
  86   2      
  87   2                      _nop_();
  88   2                      _nop_();
  89   2                      _nop_();
  90   2              #else
                              _nop_();
                      #endif
  93   2              }
  94   1      }
  95          
  96          /******************************************************************************************
  97          *函数名:                msg_queue_in            
  98          *参数:                  msgType                 消息类型
  99                                          msgPoint                消息指针
 100          *返回值:                无
 101          *描述:                  将消息添加到消息队列中去,消息堆栈最多记录4条消息.               
 102          *编写:                  王绍伟
 103          *版本信息:              V1.0                    2003年8月15日
 104          ******************************************************************************************/
 105          extern void msg_queue_in(MSGTYPE msgType, MSGPOINT msgPoint)    
 106          {
 107   1              if(MsgPoolPoint == MSG_STACK_DEPTH)                                     /*r如果消息堆栈满了,则退出*/
 108   1              {
 109   2                      return;
 110   2              }
 111   1              bEA = EA;                       /*r若消息堆栈未满,先将当前所有中断允许位保存起来*/
 112   1              EA = 0;                 /*r暂时禁止一切中断,待处理完消息后恢复*/
 113   1              MsgPool[MsgPoolPoint][0] = msgType;
 114   1              MsgPool[MsgPoolPoint++][1] = msgPoint;
 115   1              EA = bEA;
 116   1      }
C51 COMPILER V7.10   SYSTEM                                                                01/02/2005 16:29:29 PAGE 3   

 117          
 118          #ifdef FIFO                                     /*r如果定义为先入先出*/
              /******************************************************************************************
              *函数名:                msg_queue_out
              *参数:                  无
              *返回值:                MSG_NULL                当消息队列为空时返回MSG_NULL
                                              msgType                 当消息队列不为空时返回消息类型
              *描述:                  弹出消息队列中最早进入的消息类型.
              *编写:                  王绍伟
              *版本信息:              V1.0                    2003年8月15日
              ******************************************************************************************/
              extern byte msg_queue_out(void)
              {
                      if(MsgPoolPoint == 0)
                      {
                              return(MSG_NULL);
                      }
                      bEA = EA;
                      EA = 0;                                 /*r关断所有中断*/
                      g_MsgReturnValue = MsgPool[0][1];                               /*r推出最早进入的消息*/
                      msgType = MsgPool[0][0];
                      if(--MsgPoolPoint)                      /*r如果消息队列未空,则剩余消息前移*/
                      {
                              for(i = 0; i < MsgPoolPoint; i++)
                              {
                                      MsgPool[i][0] = MsgPool[i + 1][0];
                                      MsgPool[i][1] = MsgPool[i + 1][1];
                              }
                      }
                      EA = bEA;
                      return(msgType);
              }
              #endif  
 150          #ifdef FILO
              /*FILO  先入后出*/
              /******************************************************************************************
              *函数名:                msg_queue_out
              *参数:                  无
              *返回值:                MSG_NULL                当消息队列为空时返回MSG_NULL
                                              msgType                 当消息队列不为空时返回消息类型
              *描述:                  弹出消息队列中最后进入的消息类型.
              *编写:                  王绍伟
              *版本信息:              V1.0                    2003年8月15日
              ******************************************************************************************/
              extern byte msg_queue_out(void)
              {
                      if(MsgPoolPoint == 0)
                      {
                              return(MSG_NULL);
                      }
                      bEA = EA;
                      EA = 0;
                      g_MsgReturnValue = MsgPool[--MsgPoolPoint][1];
                      msgType = MsgPool[MsgPoolPoint][0];
                      EA = bEA;
                      return(msgType);
              }                                                                                                       
              #endif 
 175          
 176          #ifdef PRIORITY
 177          extern byte msg_queue_out(void)
 178          {
C51 COMPILER V7.10   SYSTEM                                                                01/02/2005 16:29:29 PAGE 4   

 179   1              if(MsgPoolPoint == 0)
 180   1              {
 181   2                      return(MSG_NULL);
 182   2              }
 183   1              bEA = EA;
 184   1              EA = 0;
 185   1              if(MsgPoolPoint == 1)
 186   1              {
 187   2                      g_MsgReturnValue = MsgPool[--MsgPoolPoint][1];
 188   2                      msgType = MsgPool[MsgPoolPoint][0];
 189   2                      EA = bEA;
 190   2                      return(msgType);
 191   2              }       
 192   1              
 193   1              msgType =MsgPool[0][0];
 194   1              g_MsgReturnValue = 0;
 195   1              for(i = 1; i < MsgPoolPoint; i++)
 196   1              {
 197   2                      if((msgType & 0xF0) < (MsgPool[i][0] & 0xF0))
 198   2                      {
 199   3                              msgType = MsgPool[i][0];
 200   3                              g_MsgReturnValue = i;
 201   3                      }
 202   2              }
 203   1              i = g_MsgReturnValue;
 204   1              g_MsgReturnValue = MsgPool[i][1];
 205   1              MsgPoolPoint--;
 206   1              for(; i < MsgPoolPoint; i++)
 207   1              {
 208   2                      MsgPool[i][0] = MsgPool[i + 1][0]; 
 209   2                      MsgPool[i][1] = MsgPool[i + 1][1]; 
 210   2              }
 211   1      
 212   1              EA = bEA;
 213   1              return(msgType);        
 214   1      }
 215          #endif
 216          
 217          
 218          
 219          extern void msg_queue_clear(byte selMSG)
 220          {
 221   1              if(selMSG ==ALL)
 222   1              {
 223   2                      MsgPoolPoint = 0;
 224   2              }
 225   1              else
 226   1              {
 227   2                      bEA = EA;
 228   2                      EA = 0;
 229   2                      
 230   2                      for(i = 0; i < MsgPoolPoint; i++)
 231   2                      {
 232   3                              
 233   3                              if(MsgPool[i][0] == selMSG)
 234   3                              {
 235   4                                      MsgPool[i][0] = MSG_NULL;
 236   4                              }
 237   3                      }
 238   2                      EA = bEA;
 239   2              }
 240   1      }
C51 COMPILER V7.10   SYSTEM                                                                01/02/2005 16:29:29 PAGE 5   

 241          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    340    ----
   CONSTANT SIZE    =    116    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     13    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =      1    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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