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

📄 clock_t.lst

📁 LCD显示和单片机中断定时,单片机不断中断
💻 LST
字号:
C51 COMPILER V7.50   CLOCK_T                                                               08/15/2007 21:16:16 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE CLOCK_T
OBJECT MODULE PLACED IN clock_t.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE clock_t.c BROWSE DEBUG OBJECTEXTEND

line level    source

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

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

 118   2      
 119   2            dispbitcnt++; 
 120   2      
 121   2            if(dispbitcnt==6) 
 122   2      
 123   2              { 
 124   3      
 125   3                dispbitcnt=0; 
 126   3      
 127   3              } 
 128   2      
 129   2          } 
 130   1      
 131   1        tcnt++; 
 132   1      
 133   1        if(tcnt==4000) 
 134   1          { 
 135   2            tcnt=0; 
 136   2            second++; 
 137   2            if(second==60) 
 138   2              { 
 139   3                second=0; 
 140   3                minite++; 
 141   3                if(minite==60) 
 142   3                  { 
 143   4                    minite=0; 
 144   4                    hour++; 
 145   4                    if(hour==24) 
 146   4                      { 
 147   5                       hour=0; 
 148   5                      } 
 149   4                  } 
 150   3              } 
 151   2            dispbuf[0]=second%10; 
 152   2            dispbuf[1]=second/10; 
 153   2            dispbuf[2]=minite%10; 
 154   2            dispbuf[3]=minite/10; 
 155   2            dispbuf[4]=hour%10; 
 156   2            dispbuf[5]=hour/10; 
 157   2          }
 158   1      }


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