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

📄 clock.lst

📁 Keil c51 开发的一个日历时钟小程序
💻 LST
字号:
C51 COMPILER V7.50   CLOCK                                                                 05/21/2008 22:42:34 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE CLOCK
OBJECT MODULE PLACED IN Clock.OBJ
COMPILER INVOKED BY: D:\Program Files\Keil\C51\BIN\C51.EXE Clock.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include <reg52.h>
   2          #define uchar unsigned char
   3          #define uint unsigned int
   4          uchar code constantcode[8]={0x70,0x60,0x50,0x40,0x30,0x20,0x10,0x00};
   5          uchar data table[8]={0,0,0,0,0,0,0,0};
   6          uchar data curled=0;
   7          uchar data timearrive=0;
   8          uchar data timelength=20;
   9          uchar data sl=0;
  10          uchar data sh=0;
  11          uchar data ml=0;
  12          uchar data mh=0;
  13          uchar data hl=0;
  14          uchar data hh=0;
  15          void init(void);
  16          void inittable(uchar*,uchar);
  17          void buildtable(uchar*);
  18          void OnTimer0Event(void) interrupt 1
  19          {
  20   1      if(curled<7)
  21   1      {
  22   2      curled++;
  23   2      }
  24   1      else
  25   1      {
  26   2      curled=0;
  27   2      }
  28   1      P0=table[curled];
  29   1      TH0=(65535-1000)/256;
  30   1      TL0=(65535-1000)%256;
  31   1      }
  32          void OnTimer1Event(void) interrupt 3
  33          {
  34   1      if(--timelength<=0)
  35   1      {
  36   2      timelength=20;
  37   2      timearrive=1;
  38   2      }
  39   1      if(timearrive)
  40   1      {
  41   2              if(sl==9)
  42   2              {
  43   3                  sl=0;
  44   3                      if(sh<5)
  45   3                      {
  46   4                      sh++;
  47   4                      }
  48   3                      else
  49   3                      {
  50   4                      sh=0;
  51   4                              if(ml==9)
  52   4                              {
  53   5                              ml=0;
  54   5                                      if(mh<5)
  55   5                                      {
C51 COMPILER V7.50   CLOCK                                                                 05/21/2008 22:42:34 PAGE 2   

  56   6                                      mh++;
  57   6                                      }
  58   5                                      else
  59   5                                      {
  60   6                                              mh=0;
  61   6                                              if(hh<=1)
  62   6                                              {
  63   7                                                      if(hl==9)
  64   7                                                      {
  65   8                                                      hh++;
  66   8                                                      hl=0;
  67   8                                                      }
  68   7                                                      else
  69   7                                                      {
  70   8                                                      hl++;
  71   8                                                      }
  72   7                                              }
  73   6                                              else
  74   6                                              {
  75   7                                                      if(hl==3)
  76   7                                                      {
  77   8                                                      hl=0;
  78   8                                                      hh=0;
  79   8                                                      }
  80   7                                                      else
  81   7                                                      {
  82   8                                                      hl++;
  83   8                                                      }
  84   7                                              }
  85   6                                              
  86   6                                              
  87   6                                      }
  88   5                              }
  89   4                              else
  90   4                              {
  91   5                              ml++;
  92   5                              }
  93   4                      }
  94   3              }
  95   2              else
  96   2              {
  97   3              sl++;
  98   3              }
  99   2              timearrive=0;
 100   2              buildtable(table);
 101   2              }
 102   1      TH1=(65535-50000)/256;
 103   1      TL1=(65535-50000)%256;
 104   1      }
 105          void main(void)
 106          {
 107   1      init();
 108   1      while(1);
 109   1      }
 110          void init(void)
 111          {
 112   1      TMOD=0x11;
 113   1      TCON=0;
 114   1      IE=0x8A;
 115   1      IP=0x02;
 116   1      TH0=(65536-1000)/256;
 117   1      TL0=(65535-1000)%256;
C51 COMPILER V7.50   CLOCK                                                                 05/21/2008 22:42:34 PAGE 3   

 118   1      TH1=(65535-50000)/256;
 119   1      TL1=(65535-50000)%256;
 120   1      inittable(table,8);
 121   1      TR0=1;
 122   1      TR1=1;
 123   1      }
 124          void buildtable(uchar *p)
 125          {
 126   1      *p=constantcode[0];
 127   1      *(p+1)=constantcode[1];
 128   1      *(p+2)=constantcode[2]+hh;
 129   1      *(p+3)=constantcode[3]+hl;
 130   1      *(p+4)=constantcode[4]+mh;
 131   1      *(p+5)=constantcode[5]+ml;
 132   1      *(p+6)=constantcode[6]+sh;
 133   1      *(p+7)=constantcode[7]+sl;
 134   1      }
 135          void inittable(uchar *p,uchar len)
 136          {
 137   1      uchar data i=0;
 138   1      do{
 139   2      *(p+i)=*(p+i)+constantcode[i];
 140   2      }while(++i<len);
 141   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    402    ----
   CONSTANT SIZE    =      8    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     17       3
   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 + -