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

📄 main.lst

📁 数码管显示数码管显示数码管显示数码管显示数码管显示数码管显示
💻 LST
字号:
C51 COMPILER V7.10   MAIN                                                                  11/08/2008 17:06:15 PAGE 1   


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

line level    source

   1          #include <reg51.h>
   2          #define uchar unsigned char
   3          #define schar  unsigned char
   4          #define uint  unsigned int
   5          sbit P3_5= P1^1;
   6          sbit P1_2= P1^2;//定义信号引脚 
   7              char DATA_7SEG [11]={0XC0,0XF9,0XA4,0XB0,0X99,0X92,0X82,0XF8,0X80,0X90,0XFF,};//0~9
   8            uchar hour=0,min=0,sec=0;
   9            uchar deda=0;
  10            schar t_hour=8;
  11            schar t_min=30;
  12            bit d_05s=0;
  13            uchar set=0;
  14            uchar m=0;
  15            uchar syh,sym;
  16            void delay(uint k);
  17            void conv();
  18            void p_out();
  19            void dirve (schar hm1,uchar hm2);
  20            void tdata1(schar hm3);
  21            void tdata2(schar hm4);
  22            void conv()
  23                {
  24   1                 if (deda<=100)d_05s=1;
  25   1                 else d_05s=0;
  26   1                 if (deda>=201){sec++;deda=0;}
  27   1                 if (sec==60){min++;sec=0;}
  28   1             if (min==60){hour++;min=0;}
  29   1                 if (hour==24){hour=0;}                 
  30   1                }
  31                   
  32          
  33                    void delay (uint k)
  34                    {
  35   1                 uint i,j;
  36   1                 for(i=0;i<k;i++){
  37   2                                  for(j=0;j<121;j++){;}}
  38   1                                        }
  39          
  40          
  41                 void drive(schar hm1,uchar hm2) 
  42                 {
  43   1                if(hm1/10>=1)
  44   1                {tdata1(hm1); P1=0xef;delay(1);}
  45   1                if(d_05s==1)
  46   1                  {SBUF=DATA_7SEG[hm1%10]&0x7F;
  47   2                  
  48   2                  while(TI==0);
  49   2                  TI=0;
  50   2                  P1=0xdf;delay(1);}
  51   1      
  52   1                              else
  53   1                              {tdata2(hm1);P1=0xdf;delay(1);}
  54   1                   tdata1(hm2);P1=0xbf;delay(1);
  55   1                               tdata2(hm2);P1=0x7f;delay(1);}
C51 COMPILER V7.10   MAIN                                                                  11/08/2008 17:06:15 PAGE 2   

  56          
  57                       void dispsy()
  58                                   {
  59   1                               if(min<=t_min)
  60   1                                  {
  61   2                                       sym=t_min-min;
  62   2                                       syh=t_hour-hour;
  63   2                                      }
  64   1                               else {sym=(60-min+t_min);syh=t_hour-hour-1;}
  65   1                               drive(syh,sym);
  66   1                               
  67   1                               }
  68          
  69          
  70          
  71          void time()
  72          { 
  73   1          conv();
  74   1              if(sec%5<=2)
  75   1              {
  76   2               P3_5=1;drive(hour,min);
  77   2              }
  78   1              else {
  79   2                    P3_5=0;dispsy();
  80   2                   }
  81   1         P_out();
*** WARNING C206 IN LINE 81 OF MAIN.C: 'P_out': missing function-prototype
  82   1         }
  83          
  84          
  85          
  86          
  87             void init_timer()
  88             {
  89   1          TMOD=0x01;
  90   1              TH0=-(5221/256);
  91   1              TL0=-(5221%256);
  92   1          IE=0x82;
  93   1              TR0=1;
  94   1           }
  95           
  96          
  97                   void scan_key()
  98                   {
  99   1                delay(1);
 100   1                if(P1_2==0)set++;
 101   1                if(set>=2)set=0;
 102   1                while(P1_2==0);
 103   1                }
 104                    void zd(void) interrupt 1
 105               { TH0=-(5221/256);
 106   1                 TL0=_(5221%256);
*** WARNING C206 IN LINE 106 OF MAIN.C: '_': missing function-prototype
*** ERROR C267 IN LINE 106 OF MAIN.C: '_': requires ANSI-style prototype
 107   1                 deda++;
 108   1                }
 109          
 110                       void time1_adj()
 111                           {
 112   1                        if(P1_1==0)delay(1);
*** ERROR C202 IN LINE 112 OF MAIN.C: 'P1_1': undefined identifier
 113   1                        if(P1_1==0)t_hour--;
C51 COMPILER V7.10   MAIN                                                                  11/08/2008 17:06:15 PAGE 3   

*** ERROR C202 IN LINE 113 OF MAIN.C: 'P1_1': undefined identifier
 114   1                        if(t_hour<0)t_hour=23;
 115   1                for(m=0;m<100;m++)
 116   1                        {
 117   2                        drive(t_hour,t_min);
 118   2                        
 119   2                        }
 120   1                        if(P1_0==0)delay(1);
*** ERROR C202 IN LINE 120 OF MAIN.C: 'P1_0': undefined identifier
 121   1                        if(P1_0==0)t_min=t_min-1;
*** ERROR C202 IN LINE 121 OF MAIN.C: 'P1_0': undefined identifier
 122   1                        if(t_min<=0)t_min=60;
 123   1                        for(m=0;m<100;m++)
 124   1                           {
 125   2                                drive(t_hour,t_min);
 126   2                               }               
 127   1                       
 128   1                       }
 129                              void tdata1(schar hm3)
 130                                   {
 131   1                                SUB=DATA_7SEG[hm3/10];
*** ERROR C202 IN LINE 131 OF MAIN.C: 'SUB': undefined identifier
 132   1                                while(TI==0);
 133   1                                TI=0;  
 134   1                               }
 135                                  void tdata2(schar hm4)
 136                                   {
 137   1                                SUB=DATA_7SEG[hm4%10];
*** ERROR C202 IN LINE 137 OF MAIN.C: 'SUB': undefined identifier
 138   1                                while(TI==0);
 139   1                                TI=0;  
 140   1                               }
 141          
 142          
 143          
 144          
 145                                   ///////
 146                                   void P_out()
 147                                   {
*** ERROR C231 IN LINE 147 OF MAIN.C: 'P_out': redefinition
 148   1                                if (hour>=t_hour&&min>=t_min)
 149   1                                {TR0=0;EA=0;P3_7=0;
*** ERROR C202 IN LINE 149 OF MAIN.C: 'P3_7': undefined identifier
 150   2                                 dirve(t_hour,t_min);
 151   2                                }
 152   1                                else P3_7=1;
*** ERROR C202 IN LINE 152 OF MAIN.C: 'P3_7': undefined identifier
 153   1                               
 154   1                               }
*** ERROR C231 IN LINE 154 OF MAIN.C: 'P_out': redefinition
 155                                   //////////////////////
 156                                   void main()
 157                                   {
 158   1                                init_timer();
 159   1                                while(1)
 160   1                                {
 161   2                                 if(P1_2==0)scan_key();
 162   2                                 switch(set)
 163   2                                 {case 0:time();break;
 164   3                                  case 1:time1_adj();break;
 165   3                                      default:break;
 166   3                                 }
C51 COMPILER V7.10   MAIN                                                                  11/08/2008 17:06:15 PAGE 4   

 167   2                                
 168   2                                
 169   2                                }
 170   1                               
 171   1                               
 172   1                               }

C51 COMPILATION COMPLETE.  2 WARNING(S),  11 ERROR(S)

⌨️ 快捷键说明

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