数码管移动显示
#include
code unsigned char a[] = { 0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8 } ;
//code unsigned char segcode[8] = { 0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8 } ; //0-7移动显示
void delay (unsigned int t);
void main()
{
char i;
while(1)
{
/*
P2 = 0x7f;
P0 = segcode[5];
*/
for(i=0;i<8;i++)
{
P2 = ~(1<
//控制数码管位数
P0 = 0xff;
P0 = a[i];
//控制数码管显示
delay(40000 );
}
}
}
void delay (unsigned int t)
{
while( t --);
}