#include<闭郑reg51.h>
#define uchar unsigned char
uchar table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f};
sbit rstkey=P2^2;
sbit 神姿speaker=P2^0;
void delay()//延时约400毫秒
{
uchar i,j;
for(i=0;i<200;i++)
for(j=0;j<250;j++);
}
main()
{
uchar i,key;
P2=0xff;
while(1)
{
i=9;
P1=table[i];
i--;
if(i>轿瞎颂9)i=9;
delay();
}
}
电路图给我吧,我帮你写好