/***********************************************************************/
/* */
/*Project:7 digital tube dynamic scanning 0518 */
/* Date: May 18 2012 */
/* Write : Ilymtics */
/*Contact:ilymtics@msn.com */
/*Describe : 7 digital tube dynamic scanning from left to right */
/***********************************************************************/
#include <reg52.h>
unsigned char const dofly[]={0x06,0x5b,0x4f,0x66,0x6d,0x7d};// 7 digital tube order 123456
unsigned char code seg[]={0x81,0x82,0x84,0x88,0x90,0xa0};//7 digital tube display code
/****************************************************************************/
/* Function :Delay */
/* Describe :Delay cnt crystal frequency in 12MHz */
/****************************************************************************/
void delay(unsigned int cnt)
{
while(--cnt);
}
main()
{
unsigned char i;
while(1)
{
P0=dofly[i];//显示字符码
P2=seg[i]; //显示段码(即所要点亮的数码管)
delay(300);
i++;
if(i==6)
i=0;
}
}