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

📄 cs12-3.lst

📁 《手把手教你学单片机的C程序设计》及实验程序
💻 LST
字号:
C51 COMPILER V7.06   CS12_3                                                                01/06/2007 16:22:05 PAGE 1   


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

stmt level    source

   1          #include <REG51.H>                      
   2          #include <MATH.H>                       
   3          #define uchar unsigned char     
   4          #define uint unsigned int               
   5          uchar code SEG7[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
   6          uchar ACT[4]={0xfe,0xfd,0xfb,0xf7}; 
   7          /*********************************************************/
   8          sbit P3_2=P3^2;
   9          sbit P3_3=P3^3;
  10          sbit P3_5=P3^5;                 
  11          int c,f;                                                        
  12          int temp;                                               
  13          uchar status;                                   
  14          /*******************************************************/
  15          void key_s1(void);                      
  16          void key_s2(void);                              
  17          void key_s4(void);                              
  18          int conv(int fin);                              
  19          void delay_1ms(void);                   
  20          /********************************************************/
  21          void main(void)                         
  22          {int temp_f,temp_c;                     
  23   1      while(1)                                        
  24   1      {                                                               
  25   2        key_s1();                                     
  26   2        key_s2();                                     
  27   2        key_s4();                                     
  28   2        if(status==0)                                 
  29   2        {                                                     
  30   3                      if(f<0)                         
  31   3                      {temp_f=abs(f);                 
  32   4                      P0=SEG7[temp_f%10];P2=ACT[0];
  33   4                      delay_1ms();                    
  34   4                      P0=SEG7[(temp_f%100)/10];P2=ACT[1];
  35   4                      delay_1ms();                    
  36   4                      P0=SEG7[(temp_f/100)%10];P2=ACT[2];
  37   4                      delay_1ms();                    
  38   4                      P0=0x40;P2=ACT[3];              
  39   4                       delay_1ms();                   
  40   4                       }                                      
  41   3                       else                                   
  42   3                      {                                               
  43   4                       P0=SEG7[f%10];P2=ACT[0];
  44   4                      delay_1ms();                    
  45   4                      P0=SEG7[(f%100)/10];P2=ACT[1];
  46   4                      delay_1ms();                    
  47   4                      P0=SEG7[(f/100)%10];P2=ACT[2];
  48   4                      delay_1ms();                    
  49   4                      }                                       
  50   3        }                                                     
  51   2        else                                  
  52   2        {                                             
  53   3                       c=conv(f);                     
  54   3                      if(c<0)                         
  55   3                      {temp_c=abs(c);         
C51 COMPILER V7.06   CS12_3                                                                01/06/2007 16:22:05 PAGE 2   

  56   4                       P0=SEG7[temp_c%10];P2=ACT[0];
  57   4                       delay_1ms();                   
  58   4                        P0=SEG7[(temp_c%100)/10];P2=ACT[1];
  59   4                        delay_1ms();          
  60   4                        P0=SEG7[(temp_c/100)%10];P2=ACT[2];
  61   4                        delay_1ms();                  
  62   4                              P0=0x40;P2=ACT[3];      
  63   4                        delay_1ms();                  
  64   4                      }                                       
  65   3                      else                                    
  66   3                      {                                       
  67   4                       P0=SEG7[c%10];P2=ACT[0];
  68   4                        delay_1ms();                  
  69   4                        P0=SEG7[(c%100)/10];P2=ACT[1];
  70   4                        delay_1ms();                          
  71   4                       P0=SEG7[(c/100)%10];P2=ACT[2];
  72   4                       delay_1ms();                   
  73   4                       }                                              
  74   3        }                                                             
  75   2      }                                                               
  76   1      }                                                               
  77          /***********************************************************/
  78          void key_s1(void)                                       
  79          {                                                               
  80   1        if(!P3_2)                                             
  81   1        {if(temp>50)temp=0;                           
  82   2              if(temp==0)f++;                         
  83   2              if(f>999)f=999;                         
  84   2              temp++;                                         
  85   2        }                                                             
  86   1      }                                                               
  87          /*******************************************************/       
  88          void key_s2(void)                                       
  89          {                                                       
  90   1        if(!P3_3)                                     
  91   1        {if(temp>50)temp=0;                   
  92   2              if(temp==0)f--;                         
  93   2              if(f<-500)f=-500;                               
  94   2              temp++;                                         
  95   2        }                                                             
  96   1      }                                                                       
  97          /************************************************************/
  98          void key_s4(void)                                       
  99          {                                                               
 100   1              if(!P3_5)status=1;                      
 101   1              else status=0;                          
 102   1      }                                                               
 103          /****************************************************************/
 104          int conv(int fin)                                               
 105          {int ddata;                                             
 106   1      ddata=fin-32;                                           
 107   1      ddata=(ddata*5)/9;                              
 108   1      return ddata;                                           
 109   1      }                                                               
 110          /*************************************************************/
 111          void delay_1ms(void)                                    
 112          {                                                               
 113   1      uint k;                                                 
 114   1      for(k=0;k<121;k++);                             
 115   1      }


C51 COMPILER V7.06   CS12_3                                                                01/06/2007 16:22:05 PAGE 3   

MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    553    ----
   CONSTANT SIZE    =     10    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     11       4
   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 + -