˜Ë(bi¨¡o)î}: ÎÒ×öµÄÓ‹•rÆ÷£¬°´ˆD朽Ӻó£¬led²»ÁÁ£¡ [´òÓ¡±¾í“]

×÷Õß: MJ1281360478    •rég: 2017-12-5 10:01
˜Ë(bi¨¡o)î}: ÎÒ×öµÄÓ‹•rÆ÷£¬°´ˆD朽Ӻó£¬led²»ÁÁ£¡
×öµÄÓ‹•rÆ÷£¬°´ˆD朽Ӻó£¬led²»ÁÁ£¡
1.ÎÒ™z²éÁËһϣ¬¸ÐÓXÊÇ74ls245òŒ(q¨±)„ÓµÄÔ­Òò£¬µ«ÊÇÎÒ²»ÖªµÀÔõô½â›Q£¡Ò²ÓпÉÄÜÊÇÆäËûÔ­Òò£¬´ý²é£¡
2.Õˆ´óÉñÌṩÅŲ醖î}µÄ·½·¨£¡
3.74ls245ÓÐÐ©Ê²Ã´ÌØÐÔ£¿ÎÒ°Ù¶ÈÁË£¬›]¿´¶®£¬Ï£ÍûÓÐͨË×üc(di¨£n)üc(di¨£n)½âጣ¡£¡£¡

image.jpg (56.29 KB, ÏÂÝd´Î”µ(sh¨´): 32)

image.jpg

image.jpg (62.58 KB, ÏÂÝd´Î”µ(sh¨´): 28)

image.jpg

×÷Õß: MJ1281360478    •rég: 2017-12-5 12:39
”µ(sh¨´)´a¹ÜÊǹ²ê–µÄ£¬¬F(xi¨¤n)ÔÚÎÒ¹ÀÓ‹Êǽo”µ(sh¨´)´a¹ÜµÄ¸ßµÍëŠÆ½åeÁË£¬Ô“Ôõô¸Ä?
#include<reg51.h>
sbit kh=P1^0;
sbit km=P1^1;
sbit ks=P1^2;        
sbit st=P1^3;
sbit b=P3^7;  
unsigned char table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88, 0x83,0xc6,0xa1,0x86,0x8e};     
unsigned char i=0,hour=0,minute=0,second=0;  
void delayms(unsigned int x)  
{
  unsigned char a=160;   
  while(x--)
{
  while(a--);  
  a=160;  
}
  }   
main()
{   
TH0=(65536-50000)/256;   
TL0=(65536-50000)%256;
TMOD=1;   
TR0=1;
ET0=1;
EA=1;   
while(1)
   {  
    P0=table[hour/10];
    P2=0x20;     
    delayms(1);
    P2=0;   
    P0=table[hour%10];  
    P2=0x10;
    delayms(1);  
    P2=0;
    P0=table[minute/10];   
    P2=0x08;
    delayms(1);     
    P2=0;      
    P0=table[minute%10];      
    P2=0x04;   
    delayms(1);  
    P2=0;  
    P0=table[second/10];   
    P2=0x02;
    delayms(1);   
    P2=0;         
    P0=table[second%10];
    P2=0x01;
    delayms(1);
    P2=0;        
    if(!kh)   
    {     
      delayms(200);   
      hour++;     
      if(hour>23)
      hour=23;  
     }  
      else if(!km)
      {      
        delayms(200);      
        minute++;        
        if(minute>59)   
        minute=59;      
       }  
    else if(!ks)
    {     
      delayms(200);      
      second++;   
      if(second>59)
      second=59;      
      }
    if(!st)
       {  
          delayms(200);      
          TR0=1;
        }   
    if(TR0==1&&hour==0&&minute==0&&second<3)
    b=!b;  
    delayms(1);
    }
         }  
void   t0() interrupt 1   
{  
TH0=(65536-50000)/256;   
TL0=(65536-50000)%256;
i++;   
if(i>=20)   
  {   
  i=0;   
  second--;  
  if(second>59)
   {
    second=59;
    minute--;
    if(minute>59)         
    {
     minute=59;   
     hour--;
     if(hour>23)     
      {
                hour=0;
                minute=0;
                second=0;
                TR0=0;
                }  
          }
        }
  }
}
×÷Õß: 1123212143255    •rég: 2017-12-5 22:27
°Ñp2µÈÓÚ0£¬¸Ä³Ép2µÈÓÚ0x00£¬Ô‡Ï°É¡£




šgÓ­¹âÅR (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1