# include & ltreg 51 . h & gt;
#定義uchar無符號字符
//這個表是LED的字體0?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 ?答?b?c?d?英·法
無符號字符碼LED7Code[] = {0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F,0x77,0x7C,0x39,0x5E,0x79,0x 71 };
無效延遲(uchar z)
{
uchar i,j;
for(I = 0;我& lt120;i++)
for(j = 0;j & ltz;j++);
}
void main()
{
uchar k;
while(1)
{
for(k = 0;k & lt50;k++)
{
P0 = 0xff
P2 = led 7 code[0];
P0 = 0xfe
延遲(5);
P0 = 0xff
P2 = led 7 code[0];
P0 = 0xfd
延遲(5);
P0 = 0xff
P2 = led 7 code[2];
P0 = 0xfb
延遲(5);
P0 = 0xff
P2 = led 7 code[0];
P0 = 0xf7
延遲(5);
P0 = 0xff
P2 = led 7 code[1];
P0 = 0xef
延遲(5);
P0 = 0xff
P2 = led 7 code[9];
P0 = 0xdf
延遲(5);
P0 = 0xff
P2 = led 7 code[0];
P0 = 0xbf
延遲(5);
P0 = 0xff
P2 = led 7 code[3];
P0 = 0x7f
延遲(5);
}
for(k = 0;k & lt50;k++)
{
P0 = 0xff
P2 = led 7 code[0];
P0 = 0xfe
延遲(5);
P0 = 0xff
P2 = led 7 code[0];
P0 = 0xfd
延遲(5);
P0 = 0xff
P2 = led 7 code[10];
P0 = 0xfb
延遲(5);
P0 = 0xff
P2 = led 7 code[11];
P0 = 0xf7
延遲(5);
P0 = 0xff
P2 = led 7 code[12];
P0 = 0xef
延遲(5);
P0 = 0xff
P2 = led 7 code[13];
P0 = 0xdf
延遲(5);
P0 = 0xff
P2 = led 7 code[14];
P0 = 0xbf
延遲(5);
P0 = 0xff
P2 = led 7 code[15];
P0 = 0x7f
延遲(5);
}
for(k = 0;k & lt50;k++)
{
P0 = 0xff
P2 = led 7 code[0];
P0 = 0xfe
延遲(5);
P0 = 0xff
P2 = led 7 code[0];
P0 = 0xfd
延遲(5);
P0 = 0xff
P2 = led 7 code[1];
P0 = 0xfb
延遲(5);
P0 = 0xff
P2 = led 7 code[2];
P0 = 0xf7
延遲(5);
P0 = 0xff
P2 = led 7 code[3];
P0 = 0xef
延遲(5);
P0 = 0xff
P2 = led 7 code[4];
P0 = 0xdf
延遲(5);
P0 = 0xff
P2 = led 7 code[5];
P0 = 0xbf
延遲(5);
P0 = 0xff
P2 = led 7 code[6];
P0 = 0x7f
延遲(5);
}
}
}?