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

📄 led clock.lst

📁 一个时钟c语言的编程呵呵大家可以看看谢谢
💻 LST
字号:
C51 COMPILER V6.12  LED_CLOCK                                                              02/19/2009 13:55:42 PAGE 1   


C51 COMPILER V6.12, COMPILATION OF MODULE LED_CLOCK
OBJECT MODULE PLACED IN .\LED clock.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE .\LED clock.c DEBUG OBJECTEXTEND

stmt level    source

   1          #include <reg52.H>
   2          sbit P3_2=P3^5;sbit P3_3=P3^4;sbit P3_4=P3^3;
   3          unsigned char code dispcode[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90
   4          ,0x77,0x7c,
   5          0x39,0x5e,0x79,0x71,0x00};
   6          unsigned char dispbitcode[]={0xf9,0xf5,0xed,0xdd,
   7          0xbd,0x7d,0xfd,0xfd};
   8          unsigned char dispbuf[8]={0,0,16,0,0,16,0,0};
   9          unsigned char dispbitcnt;
  10          
  11          unsigned char second;
  12          unsigned char minite;
  13          unsigned char hour;
  14          unsigned int tcnt;
  15          unsigned char mstcnt;
  16          
  17          unsigned char i,j;
  18          
  19          void main(void)
  20          {
  21   1      TMOD=0x02;
  22   1      TH0=0x06;
  23   1      TL0=0x06;
  24   1      TR0=1;
  25   1      ET0=1;
  26   1      EA=1;
  27   1      
  28   1      while(1)
  29   1      {
  30   2      if(P3_2==0)
  31   2      {
  32   3      for(i=5;i>0;i--)
  33   3      for(j=248;j>0;j--);
  34   3      if(P3_2==0)
  35   3      {
  36   4      second++;
  37   4      if(second==60)
  38   4      {
  39   5      second=0;
  40   5      }
  41   4      dispbuf[0]=second%10;
  42   4      dispbuf[1]=second/10;
  43   4      while(P3_2==0);
  44   4      }
  45   3      }
  46   2      if(P3_3==0)
  47   2      {
  48   3      for(i=5;i>0;i--)
  49   3      for(j=248;j>0;j--);
  50   3      if(P3_3==0)
  51   3      {
  52   4      minite++;
  53   4      if(minite==60)
  54   4      {
  55   5      minite=0;
C51 COMPILER V6.12  LED_CLOCK                                                              02/19/2009 13:55:42 PAGE 2   

  56   5      }
  57   4      dispbuf[2]=minite%10;
  58   4      dispbuf[3]=minite/10;
  59   4      while(P3_3==0);
  60   4      }
  61   3      }
  62   2      if(P3_4==0)
  63   2      {
  64   3      for(i=5;i>0;i--)
  65   3      for(j=248;j>0;j--);
  66   3      if(P3_4==0)
  67   3      {
  68   4      hour++;
  69   4      if(hour==24)
  70   4      {
  71   5      hour=0;
  72   5      }
  73   4      dispbuf[4]=hour%10;
  74   4      dispbuf[5]=hour/10;
  75   4      while(P3_4==0);
  76   4      }
  77   3      }
  78   2      }
  79   1      }
  80          void t0(void) interrupt 1 using 0
  81          {
  82   1      mstcnt++;
  83   1      if(mstcnt==8)
  84   1      {
  85   2      mstcnt=0;
  86   2      P0=dispcode[dispbuf[dispbitcnt]];
  87   2      P2=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[2]=minite%10;
 116   2      dispbuf[3]=minite/10;
 117   2      dispbuf[4]=hour%10;
C51 COMPILER V6.12  LED_CLOCK                                                              02/19/2009 13:55:42 PAGE 3   

 118   2      dispbuf[5]=hour/10;
 119   2      }
 120   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    331    ----
   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 + -