level 8
#include<reg52.h>
sbit duan_latch=P2^2;
sbit wei_latch=P2^3;
void delay();
main()
{
unsigned char weima[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
unsigned char duanma[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
unsigned int i;
while(1)
{
for(i=0;i<8;i++)
{
P1=weima[i];
wei_latch=1;
duan_latch=0;
P1=duanma[i];
duan_latch=1;
duan_latch=0;
delay(555);
}
}
}
void delay(unsigned int j)
{
unsigned int i=0;
for(i=0;i<j;i++);
}
2014年04月05日 07点04分