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

📄 main.lst

📁 keil c 文件 @@##%%…… &……源代码程序
💻 LST
字号:
C51 COMPILER V7.06   MAIN                                                                  09/01/2008 00:04:39 PAGE 1   


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

stmt level    source

   1          #include<reg51.h>
   2          #include<stdio.h>
   3          #include<absacc.h>
   4          #include"key.h"
   5          #include"lcd1602.h"
   6          #define uint unsigned int
   7          #define uchar unsigned char
   8          #define DIGPORT  P2
   9          #define WORDPORT  P0
  10          bit int0_flag=0;   ///中断申请标记位
  11          /*数码管显示编码0-----9*/
  12          uchar data CLOCK[4]={0,0,0,0};
  13          
  14          //主函数
  15          void main(void){
  16   1        uchar temp[16];
  17   1        uchar key;
  18   1         EA=1;            
  19   1         TR0=1;ET0=1;TR0=1;
  20   1         TMOD=0X01;
  21   1         TH0=0Xdc;TL0=0x88;   //T0定时
  22   1         IT0=1;TR1=0;EX0=1;IE0=1;
  23   1        
  24   1       LCD_init();
  25   1      
  26   1         
  27   1        while(1)
  28   1         {
  29   2              
  30   2          
  31   2         if(int0_flag)
  32   2           {
  33   3                
  34   3               if(CLOCK[2]>35&&CLOCK[2]<60)
  35   3                 {CLOCK[3]=CLOCK[3]+1;
  36   4                  CLOCK[1]=0;
  37   4                  CLOCK[2]=0;
  38   4                      sprintf(temp,"TIME:%2bu:%2bu:%2bu",CLOCK[3],CLOCK[2],CLOCK[1]);
  39   4              LCD_setxy(1,1);
  40   4             LCD_string(temp);
  41   4                  }
  42   3                if(CLOCK[2]>0&&CLOCK[2]<25)
  43   3                  {CLOCK[3]=CLOCK[3];
  44   4                  CLOCK[2]=0;
  45   4                  CLOCK[1]=0;
  46   4                      sprintf(temp,"TIME:%2bu:%2bu:%2bu",CLOCK[3],CLOCK[2],CLOCK[1]);
  47   4             LCD_setxy(1,1);
  48   4              LCD_string(temp);
  49   4                  }
  50   3                      int0_flag=0;
  51   3                 }
  52   2        
  53   2          
  54   2      
  55   2          
C51 COMPILER V7.06   MAIN                                                                  09/01/2008 00:04:39 PAGE 2   

  56   2       //小时
  57   2              
  58   2               key=keyscan();
  59   2       
  60   2      
  61   2          sprintf(temp,"TIME:%2bu:%2bu:%2bu",CLOCK[3],CLOCK[2],CLOCK[1]);
  62   2          LCD_setxy(1,1);
  63   2          LCD_string(temp);
  64   2              switch(key)
  65   2              {
  66   3               case 1:
  67   3               {TR0=0;
  68   4               CLOCK[2]=CLOCK[2]+1;
  69   4               if(CLOCK[2]==60)CLOCK[2]=0;
  70   4               delay_10ms();
  71   4              
  72   4               }TR0=1;
  73   3           break;
  74   3               case 2:
  75   3               {TR0=0;
  76   4               CLOCK[3]=CLOCK[3]+1;
  77   4               if(CLOCK[3]==24)CLOCK[3]=0;
  78   4               delay_10ms();
  79   4               }TR0=1;
  80   3           break;
  81   3           case 3:
  82   3               {TR0=0;
  83   4               CLOCK[1]=CLOCK[1]+1;
  84   4               if(CLOCK[1]==60)CLOCK[1]=0;
  85   4               delay_10ms();
  86   4               }TR0=1;
  87   3           break;
  88   3               case 4:
  89   3           CLOCK[2]=0;
  90   3               CLOCK[1]=0;
  91   3               CLOCK[3]=0;
  92   3               break;
  93   3         }
  94   2         
  95   2         }
  96   1      }
  97          //子函数24小时时钟
  98          void timer0(void)  interrupt  1 using 1
  99          {
 100   1        TH0=0xdc;
 101   1        TL0=0x88;
 102   1      
 103   1         
 104   1        //时钟处理
 105   1        CLOCK[0]=CLOCK[0]+1;
 106   1      
 107   1        if (CLOCK[0]==100)
 108   1         {
 109   2           CLOCK[0]=0;
 110   2               CLOCK[1]=CLOCK[1]+1;
 111   2               if(CLOCK[1]==60)
 112   2               {
 113   3                 CLOCK[1]=0;
 114   3                 CLOCK[2]=CLOCK[2]+1;
 115   3                 if(CLOCK[2]==60)
 116   3                 {
 117   4                   CLOCK[2]=0;
C51 COMPILER V7.06   MAIN                                                                  09/01/2008 00:04:39 PAGE 3   

 118   4                       CLOCK[3]=CLOCK[3]+1;
 119   4                       if(CLOCK[3]==24)
 120   4                        {
 121   5                          CLOCK[3]=0;
 122   5                              }
 123   4      
 124   4                      }
 125   3                }
 126   2         }
 127   1        }
 128          /************外部中断函数*****************/
 129          void intflag() interrupt 0
 130          {  
 131   1         int0_flag=1;
 132   1      }
 133          
 134          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    344    ----
   CONSTANT SIZE    =     20    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      4      17
   IDATA SIZE       =   ----    ----
   BIT SIZE         =      1    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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