#include <reg51.h>
unsigned char code duan[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
unsigned char code wei[ ]={0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
void main(void)
{
void show(unsigned char d,unsigned char w);
unsigned char i=1,j=0;
while(1)
show(i++,j++);
i=i<10?i:1;
j=j< 6?j:0;
}
void show(unsigned char d,unsigned char w)
void delay(void);
P2=wei[w];
P0=duan[d];
delay();
P0=0x00;
void delay(void)
int i,j;
for(i=0;i<100;++i)
for(j=0;j<1000;++j);
#include <reg51.h>
unsigned char code duan[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
unsigned char code wei[ ]={0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
void main(void)
{
void show(unsigned char d,unsigned char w);
unsigned char i=1,j=0;
while(1)
{
show(i++,j++);
i=i<10?i:1;
j=j< 6?j:0;
}
}
void show(unsigned char d,unsigned char w)
{
void delay(void);
P2=wei[w];
P0=duan[d];
delay();
P0=0x00;
}
void delay(void)
{
int i,j;
for(i=0;i<100;++i)
for(j=0;j<1000;++j);
}