#include<reg51.h>
unsigned char uchar;
unsigned int uint;
#define led P1;
sbit voice=P2^4;
uchar tab1[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
uchar tab2[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
uchar tab3[]={0xe7,0xdb,0xbd,0x7e};
uchar tab4[]={0x7e,0xbd,0xdb,0xe7};
uchar he [4] = {0,0,0,0};
uchar num=0;
uchar counter=0;
uchar counter1=0;
bit flag=0;
bit flag1=0;
void delay1m(uint x)
{
uint i,j;
for(i=0;i<x;i++)
for(j=0;j<120;j++)
}
void time0_time1_init()
{
TMOD=0x11;
TH1=(65535-50000)/256;
TL1=(65535-50000)%256;
TH0=(65535-50000)/256;
TL0=(65535-50000)%256;
TR0=0;
ET1=ET0=TR1=EA=1;
}
void main()
{
time0_time1_init();
delay1m(2000);
while(1)
{
if(!flag1)
{
if(!voice)
{
num++;flag1=1;
he[0]=he[1]=he[2]=he[3]=0;
if(num>=5){num=0;}
TR0=1;
}
}
}
编译结果:
compiling 声控流水灯.c...
声控流水灯.c(3): warning C317: attempt to redefine macro 'unsigned'
声控流水灯.c(6): error C129: missing ';' before 'tab1'
Target not created
|