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

📄 test03.lst

📁 8051单片机学习源码 包括定时器、键盘、液晶显示等
💻 LST
字号:
C51 COMPILER V6.12  TEST03                                                                 12/11/2007 19:25:52 PAGE 1   


C51 COMPILER V6.12, COMPILATION OF MODULE TEST03
OBJECT MODULE PLACED IN test03.OBJ
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE test03.c BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          
   2          #include<reg52.h>
   3          #define uchar unsigned char
   4          #define ul unsigned long
   5          
   6          sbit dula=P2^6;
   7          sbit wela=P2^7;
   8          
   9          uchar code tabledu[]={
  10          0x3f,0x06,0x5b,0x4f,
  11          0x66,0x6d,0x7d,0x07,
  12          0x7f,0x6f,0x77,0x7c,
  13          0x39,0x5e,0x79,0x71};
  14          
  15          uchar code tablewe[]={
  16          0x01,0x02,0x04,0x08,
  17          0x10,0x20  
  18          };
  19          
  20          uchar temp;
  21          ul n;
  22          
  23          
  24          void delay(uchar);
  25          void display(uchar,uchar,uchar);
  26          
  27          void main()
  28          {
  29   1       while(1)
  30   1       		{
  31   2      			
  32   2      		    P3=0xfe;    
  33   2      			temp=P3;
  34   2      			temp=temp&0xf0;
  35   2      				//-----------------------------;
  36   2      				 if(temp!=0xf0)
  37   2      				 	{delay(20);
  38   3      					if(temp!=0xf0)
  39   3      					switch(temp)
  40   3      						{   
  41   4      						    case 0xe0:n=1;n*=n;break;
  42   4      							case 0xd0:n=2;n*=n;break;
  43   4      							case 0xb0:n=3;n*=n;break;
  44   4      							case 0x70:n=4;n*=n;break;
  45   4      						}
  46   3      					while(temp!=0xf0)//detect losing hand
  47   3      						{
  48   4      						  	temp=P3;
  49   4      						    temp=temp&0xf0;
  50   4      						}
  51   3      
  52   3      
  53   3      					}
  54   2      		    P3=0Xfd;    
  55   2      			temp=P3;
C51 COMPILER V6.12  TEST03                                                                 12/11/2007 19:25:52 PAGE 2   

  56   2      			temp=temp&0xf0;
  57   2      				//-----------------------------
  58   2      				 if(temp!=0xf0)
  59   2      				 	{delay(20);
  60   3      					if(temp!=0xf0)
  61   3      					switch(temp)
  62   3      						{   
  63   4      						    case 0xe0:n=5;n*=n;break;
  64   4      							case 0xd0:n=6;n*=n;break;
  65   4      							case 0xb0:n=7;n*=n;break;
  66   4      							case 0x70:n=8;n*=n;break;
  67   4      						}
  68   3      								
  69   3      						while(temp!=0xf0)//detect losing hand
  70   3      						{
  71   4      						  	temp=P3;
  72   4      						    temp=temp&0xf0;
  73   4      						}
  74   3      					}
  75   2      		    P3=0Xfb;    
  76   2      			temp=P3;
  77   2      			temp=temp&0xf0;
  78   2      				//-----------------------------
  79   2      				 if(temp!=0xf0)
  80   2      				 	{delay(20);
  81   3      					if(temp!=0xf0)
  82   3      					switch(temp)
  83   3      						{   
  84   4      						    case 0xe0:n=9;n*=n;break;
  85   4      							case 0xd0:n=10;n*=n;break;
  86   4      							case 0xb0:n=11;n*=n;break;
  87   4      							case 0x70:n=12;n*=n;break;
  88   4      						}
  89   3      			       while(temp!=0xf0)//detect losing hand
  90   3      						{
  91   4      						  	temp=P3;
  92   4      						    temp=temp&0xf0;
  93   4      						}
  94   3      					}
  95   2      		    P3=0Xf7;    
  96   2      			temp=P3;
  97   2      			temp=temp&0xf0;
  98   2      				//-----------------------------
  99   2      				 if(temp!=0xf0)
 100   2      				 	{delay(20);
 101   3      				    if(temp!=0xf0)
 102   3      					switch(temp)
 103   3      						{   
 104   4      						    case 0xe0:n=13;n*=n;break;
 105   4      							case 0xd0:n=14;n*=n;break;
 106   4      							case 0xb0:n=15;n*=n;break;
 107   4      							case 0x70:n=16;n*=n;break;
 108   4      						}
 109   3      					while(temp!=0xf0)//detect losing hand
 110   3      						{
 111   4      						  	temp=P3;
 112   4      						    temp=temp&0xf0;
 113   4      						}
 114   3      					}  
 115   2      		display(n/100,n%100/10,n%10);
 116   2      		}//while(1)
 117   1      	
C51 COMPILER V6.12  TEST03                                                                 12/11/2007 19:25:52 PAGE 3   

 118   1      }
 119          
 120          void display(uchar b,uchar s,uchar g)
 121          {
 122   1       P0=0x00;
 123   1       wela=1;
 124   1       wela=0;
 125   1       P0=~tabledu[b];
 126   1       dula=1;
 127   1       dula=0;
 128   1       P0=tablewe[0];
 129   1       wela=1;
 130   1       wela=0;
 131   1       delay(5);
 132   1      //---------
 133   1       P0=0x00;
 134   1       wela=1;
 135   1       wela=0;
 136   1       P0=~tabledu[s];
 137   1       dula=1;
 138   1       dula=0;
 139   1       P0=tablewe[1];
 140   1       wela=1;
 141   1       wela=0;
 142   1       delay(5);
 143   1       //--------------
 144   1        P0=0x00;
 145   1       wela=1;
 146   1       wela=0;
 147   1       P0=~tabledu[g];
 148   1       dula=1;
 149   1       dula=0;
 150   1       P0=tablewe[2];
 151   1       wela=1;
 152   1       wela=0;
 153   1       delay(5);
 154   1      }
 155          
 156          
 157          
 158          void delay(uchar x)
 159          {uchar a,b;
 160   1       for(a=x;a>0;a--)
 161   1       	for(b=255;b>0;b--);
 162   1      }
 163          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1085    ----
   CONSTANT SIZE    =     22    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      5       2
   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 + -