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

📄 1275.lst

📁 51单片机C程序
💻 LST
字号:
C51 COMPILER V6.12  1275                                                                   03/28/2007 09:20:28 PAGE 1   


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

stmt level    source

   1          //在上题的基础上,用另外三个独立键盘实现按下第一个时计时
   2          //停止,按下第二个时计时开始,按下第三个是计数值清零从头开始。
   3          
   4          #include<reg52.h>
   5          #define uc unsigned char
   6          #define ui unsigned int
   7          sbit L4=P3^4;
   8          sbit L5=P3^5;
   9          sbit L6=P3^6;
  10          sbit L7=P3^7;
  11          sbit dus=P2^6;
  12          sbit wes=P2^7;
  13          uc code table[]={
  14          0x3f,0x06,0x5b,0x4f,0x66,0x6d,
  15          0x7d,0x07,0x7f,0x6f,0x77};
  16          uc code tableh[]={
  17          0xbf,0x86,0xdb,0xcf,0xe6,0xed,
  18          0xfd,0x87,0xff,0xef,0xf7};
  19          uc a2,a1,a0,count;
  20          ui num;
  21          display(uc,uc,uc);
  22          delay(uc);
  23          void main()
  24          {
  25   1      	EA=1;
  26   1      	ET1=1;
  27   1      	TMOD=0x10;
  28   1      	TH1=(65536-5000)/256;
  29   1      	TL1=(65536-5000)%256;
  30   1      	TR1=1;
  31   1      	while(1)
  32   1      	{		
  33   2      		if(count==20)
  34   2      		{		
  35   3      			count=0;
  36   3      			num++;
  37   3      			if(num==999)num=0;}	
  38   2      			if(L4==0)
  39   2                  {
  40   3      				delay(30);
  41   3      				if(L4==0)
  42   3      				TR1=0;
  43   3      				while(!L4)
  44   3      	            display(a2,a1,a0);
  45   3      				TR1=1;
  46   3      			}
  47   2      			if(L5==0)
  48   2      	        {
  49   3      	            delay(30);
  50   3      				if(L5==0)TR1=0;				
  51   3      				while(!L5)				
  52   3      				display(a2,a1,a0);					
  53   3      			}
  54   2      			if(L6==0)
  55   2      			{
C51 COMPILER V6.12  1275                                                                   03/28/2007 09:20:28 PAGE 2   

  56   3      				delay(30);
  57   3      				if(L6==0)TR1=1;       			
  58   3      		        while(!L6)
  59   3      		        display(a2,a1,a0);
  60   3      	        }	
  61   2              	if(L7==0)
  62   2      			{
  63   3      				delay(30);
  64   3      				if(L7==0)
  65   3      				num=0;				
  66   3      	            while(!L7)
  67   3      				{a2=num/100;
  68   4      				a1=num%100/10;
  69   4      				a0=num%100%10;
  70   4      				display(a2,a1,a0);}				
  71   3      				TR1=1;
  72   3      			}
  73   2      	
  74   2      			
  75   2      		a2=num/100;
  76   2      		a1=num%100/10;
  77   2      		a0=num%100%10;
  78   2      		display(a2,a1,a0);		
  79   2      	}
  80   1      }
  81          delay(uc x)
  82          {
  83   1      	uc i,j;
  84   1      	for(i=20;i>0;i--)
  85   1      	for(j=x;j>0;j--);
  86   1      }
  87          void time1() interrupt 3 using 1
  88          {
  89   1          TH1=(65536-5000)/256;
  90   1      	TL1=(65536-5000)%256;
  91   1      	count++;
  92   1      }
  93          display(uc bi,uc si,uc ge)
  94          {
  95   1      P0=0xff;
  96   1      wes=1;
  97   1      wes=0;
  98   1      
  99   1      P0=table[bi];
 100   1      dus=1;
 101   1      dus=0;
 102   1      P0=0xfe;
 103   1      wes=1;
 104   1      wes=0;
 105   1      delay(1);
 106   1      
 107   1      P0=0xff;
 108   1      wes=1;
 109   1      wes=0;
 110   1      
 111   1      P0=tableh[si];
 112   1      dus=1;
 113   1      dus=0;
 114   1      P0=0xfd;
 115   1      wes=1;
 116   1      wes=0;
 117   1      delay(1);
C51 COMPILER V6.12  1275                                                                   03/28/2007 09:20:28 PAGE 3   

 118   1      
 119   1      P0=0xff;
 120   1      wes=1;
 121   1      wes=0;
 122   1      
 123   1      P0=table[ge];
 124   1      dus=1;
 125   1      dus=0;
 126   1      P0=0xfb;
 127   1      wes=1;
 128   1      wes=0;
 129   1      delay(1);
 130   1      }


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