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

📄 main.lst

📁 关于温度传感器和电机测速的单片机程序
💻 LST
字号:
C51 COMPILER V7.00  MAIN                                                                   11/14/2005 19:19:02 PAGE 1   


C51 COMPILER V7.00, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: D:\MCU\Keil51\C51\BIN\C51.EXE main.c BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          #include <absacc.h>
   2          #include <reg52.h> 
   3          // #define FIRST_TIM
   4          
   5          unsigned char code CharTab[] = {0x03,0x9F,0x25,0x0D,0x99,0x49,0x41,0x1F,0x01,0x09,0x11,0xC1,0x63,0x85,0x61
             -,0x71};
   6          unsigned char code LedSel[] =  {0x10,0x30,0x50,0x70,0x90,0xB0};
   7          
   8          extern void ReadTim(void);
   9          extern void WriteTim(void);
  10          
  11          bit xchg,update;
  12          unsigned char DispBuf[6];
  13          unsigned char data RTC_ARR[8] _at_ 0x20;
  14          unsigned char data Minute,Second,Hour;
  15          
  16          /*---------- Delay Time -----------*/
  17          void delay(unsigned int t)
  18          { 
  19   1              unsigned int i;
  20   1          for(i=0;i<t;i++)
  21   1               ;
  22   1      }
  23          
  24          /*-------- calculate SEG value --------*/
  25          void calculate()
  26          {
  27   1              DispBuf[0] = Second & 0x0F;
  28   1              DispBuf[1] = (Second & 0xF0)>>4;
  29   1              DispBuf[2] = Minute & 0x0F;
  30   1              DispBuf[3] = (Minute & 0xF0)>>4;
  31   1              DispBuf[4] = Hour & 0x0F;
  32   1              DispBuf[5] = (Hour & 0xF0)>>4;
  33   1      }
  34          
  35          /*-------- Extern Interrupt ----------*/ 
  36          void ex1(void) interrupt 2 using 1
  37          {
  38   1              xchg = 1;
  39   1              Second++;
  40   1          P1= ~P1;
  41   1              if((Second & 0x0F)>=10)
  42   1              {
  43   2                      Second += 6;
  44   2                      if(Second>=0x60) update = 1;
  45   2              }
  46   1      
  47   1      }
  48          
  49          void main()
  50          {  
  51   1              unsigned char i;        
  52   1              P1 = 0x55;      
  53   1              for(i=0;i<6;i++)        DispBuf[i] = 0;
  54   1      
C51 COMPILER V7.00  MAIN                                                                   11/14/2005 19:19:02 PAGE 2   

  55   1              /*----------- Setup time and enable oscillator -----------*/
  56   1              ReadTim();        
  57   1              RTC_ARR[0] = RTC_ARR[0] & 0x7F; // enable oscillator(bit 7=0)   
  58   1              #ifdef FIRST_TIM
                      RTC_ARR[0] = 0x00;      // Second
                      RTC_ARR[1] = 0x10;      // Minute
                      RTC_ARR[2] = 0x19;      // Hour, 24-hour mode
                      RTC_ARR[3] = 0x06;      // Day
                      RTC_ARR[4] = 0x12;      // Date
                      RTC_ARR[5] = 0x11;      // Month
                      RTC_ARR[6] = 0x05;      // Year
                      #endif
  67   1          RTC_ARR[7] = 0x90;  // Control: OUT=1; SQWE=1,Square Wave Enable; RS1 RS0=00,1Hz Square Wave
  68   1      
  69   1              Second = RTC_ARR[0];
  70   1              Minute = RTC_ARR[1];
  71   1          Hour = RTC_ARR[2];
  72   1      
  73   1              WriteTim();                     // Set RTC
  74   1      
  75   1              INT1 = 1;
  76   1          IT1 = 1;
  77   1          EX1 = 1;
  78   1              EA = 1;
  79   1              xchg = 1;
  80   1              update = 0;
  81   1      
  82   1              while(1)
  83   1              {
  84   2                      if(update)
  85   2                      {
  86   3                              ReadTim();        
  87   3                              Second = RTC_ARR[0];
  88   3                              Minute = RTC_ARR[1];
  89   3                              Hour = RTC_ARR[2];
  90   3                              calculate();
  91   3                              update = 0;             
  92   3                      }
  93   2                      if(xchg)
  94   2                      {
  95   3                              xchg = 0;
  96   3                              RTC_ARR[0] = Second;
  97   3                              calculate();            
  98   3                      }       
  99   2              for(i=0;i<6;i++)
 100   2                      {
 101   3                              P2 = 0x0F;
 102   3                              P0 = CharTab[DispBuf[i]];
 103   3                              P2 = LedSel[i] | 0x0F;
 104   3                  delay(100);
 105   3                      }
 106   2              }
 107   1      }
 108          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    232    ----
   CONSTANT SIZE    =     22    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      9       1
C51 COMPILER V7.00  MAIN                                                                   11/14/2005 19:19:02 PAGE 3   

   IDATA SIZE       =   ----    ----
   BIT SIZE         =      2    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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