8비트 디지털 파이프 동적 스캐닝 표시 변화 데이터

1297 단어 한 사람
#include //     ,         ,               

#define DataPort P0 //            DataPort   P0   
sbit LATCH1=P2^2;//            
sbit LATCH2=P2^3;//                    

unsigned char code dofly_DuanMa[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};//      0~F
unsigned char code dofly_WeiMa[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};//            ,   

void Delay(unsigned int t); //    

/*------------------------------------------------
                       
------------------------------------------------*/
main()
{
 unsigned char i=0,num;
 unsigned int j;
 while(1)
      {
	   DataPort=dofly_WeiMa[i]; //    
       LATCH2=1;     //   
       LATCH2=0;

       DataPort=dofly_DuanMa[num+i]; //     ,  
       LATCH1=1;     //   
       LATCH1=0;

	   Delay(200); //       ,       ,       
	   i++;j++;
	   if(8==i)    //  8       ?                8 
	     i=0;
	   if(j==500)  //               ,        1,         
	     {
		  j=0;
		  num++;
		  if(num==9)
		    num=0;
		 }
      }
}
/*------------------------------------------------
     ,       unsigned int t,    
 unsigned int           ,      
 0~65535
------------------------------------------------*/
void Delay(unsigned int t)
{
 while(--t);
}

좋은 웹페이지 즐겨찾기