第1个回答 2018-04-22
#include<reg51.h>
#define uchar unsigned char
uchar table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f};
void delay(uchar a)
{
uchar i,j;
for(i=0;i<a;i++)
for(j=0;j<120;j++);
}
main()
{
uchar i;
while(1)
{
P0=table[i];
P2=~0x01<<i;
delay(5);
i++;
i%=8;
}
}本回答被网友采纳