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

📄 digital clock.lst

📁 用51单片机设计的时钟电路(毕业论文)很不错的设计.值得参考
💻 LST
字号:
C51 COMPILER V7.02b   DIGITAL_CLOCK                                                        08/14/2007 17:17:08 PAGE 1   


C51 COMPILER V7.02b, COMPILATION OF MODULE DIGITAL_CLOCK
OBJECT MODULE PLACED IN digital clock.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE digital clock.c DEBUG OBJECTEXTEND

stmt level    source

   1          #include <AT89X51.H> 
   2          unsigned char code dispcode[]={0x3f,0x06,0x5b,0x4f, 
   3                                         0x66,0x6d,0x7d,0x07, 
   4                                         0x7f,0x6f,0x77,0x7c, 
   5                                         0x39,0x5e,0x79,0x71,0x00}; 
   6          unsigned char dispbitcode[]={0xfe,0xfd,0xfb,0xf7, 
   7                                       0xef,0xdf,0xbf,0x7f}; 
   8          unsigned char dispbuf[8]={0,0,16,0,0,16,2,1}; 
   9          unsigned char dispbitcnt; 
  10          unsigned char second; 
  11          unsigned char minite; 
  12          unsigned char hour; 
  13          unsigned int tcnt; 
  14          unsigned char mstcnt;  
  15          unsigned char i,j; 
  16          void main(void) 
  17          {
  18   1        TMOD=0x02; 
  19   1        TH0=0x06; 
  20   1        TL0=0x06; 
  21   1        TR0=1; 
  22   1        ET0=1; 
  23   1        EA=1; 
  24   1        hour=12;
  25   1         while(1) 
  26   1          { 
  27   2            if(P0_0==0) 
  28   2              { 
  29   3                for(i=5;i>0;i--) 
  30   3                for(j=248;j>0;j--); 
  31   3                if(P0_0==0) 
  32   3                  { 
  33   4                    second++; 
  34   4                    if(second==60) 
  35   4                      { 
  36   5                        second=0; 
  37   5                      } 
  38   4                    dispbuf[0]=second%10; 
  39   4                    dispbuf[1]=second/10; 
  40   4                    while(P0_0==0); 
  41   4                  } 
  42   3              } 
  43   2            if(P0_1==0) 
  44   2              { 
  45   3                for(i=5;i>0;i--) 
  46   3                for(j=248;j>0;j--); 
  47   3                if(P0_1==0) 
  48   3                  { 
  49   4                    minite++; 
  50   4                    if(minite==60) 
  51   4                      { 
  52   5                        minite=0; 
  53   5                      } 
  54   4                    dispbuf[3]=minite%10; 
  55   4                    dispbuf[4]=minite/10; 
C51 COMPILER V7.02b   DIGITAL_CLOCK                                                        08/14/2007 17:17:08 PAGE 2   

  56   4                    while(P0_1==0); 
  57   4                  } 
  58   3              } 
  59   2            if(P0_2==0) 
  60   2              { 
  61   3                for(i=5;i>0;i--) 
  62   3                for(j=248;j>0;j--); 
  63   3                if(P0_2==0) 
  64   3                  { 
  65   4                    hour++; 
  66   4                    if(hour==24) 
  67   4                      { 
  68   5                        hour=0; 
  69   5                      } 
  70   4                    dispbuf[6]=hour%10; 
  71   4                    dispbuf[7]=hour/10; 
  72   4                    while(P0_2==0); 
  73   4                  } 
  74   3              } 
  75   2          } 
  76   1      } 
  77          void t0(void) interrupt 1 using 0 
  78          { 
  79   1       
  80   1        mstcnt++; 
  81   1        if(mstcnt==8) 
  82   1          { 
  83   2            mstcnt=0; 
  84   2                
  85   2            P3=0xff;      //关闭所有显示
  86   2            P1=dispcode[dispbuf[dispbitcnt]]; 
  87   2            P3=dispbitcode[dispbitcnt]; 
  88   2            dispbitcnt++; 
  89   2            if(dispbitcnt==8) 
  90   2              { 
  91   3                dispbitcnt=0; 
  92   3              } 
  93   2          } 
  94   1        tcnt++; 
  95   1        if(tcnt==4000) 
  96   1          { 
  97   2            tcnt=0; 
  98   2            second++; 
  99   2            if(second==60) 
 100   2              { 
 101   3                second=0; 
 102   3                minite++; 
 103   3                if(minite==60) 
 104   3                  { 
 105   4                    minite=0; 
 106   4                    hour++; 
 107   4                    if(hour==24) 
 108   4                      { 
 109   5                        hour=0; 
 110   5                      } 
 111   4                  } 
 112   3              } 
 113   2            dispbuf[0]=second%10; 
 114   2            dispbuf[1]=second/10; 
 115   2            dispbuf[3]=minite%10; 
 116   2            dispbuf[4]=minite/10; 
 117   2            dispbuf[6]=hour%10; 
C51 COMPILER V7.02b   DIGITAL_CLOCK                                                        08/14/2007 17:17:08 PAGE 3   

 118   2            dispbuf[7]=hour/10; 
 119   2          } 
 120   1      } 
 121          
 122          


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