方法一:
#include<reg51.h>
#define uchar unsigned char
#define Led_port P1
uchar code Led_code[8]={0x7e,0xbd,0xdb,0xe7,0xdb,0xbd,0x7e,0xff};
void deplay(uchar x)
{
uchar i,j,k;
for(i=0;i<x;i++)
for(j=0;j<200;j++)
for(k=0;k<165;k++);
}
void main(void)
{
uchar i;
Led_port=0xff;
while(1)
{
for(i=0;i<8;i++)
{
Led_port=Led_code[i];
deplay(2);
}
}
}