在
P0=Table[key];}} 和
void main()
之间再添个 }
你的代码太乱,最好写成规范的锯齿风格,就容易发现这种错误
贴代码
#include
unsigned char key;
unsigned char temp;
unsigned char code Table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x84};
void delay(unsigned x)
{unsigned char i,j;
for(i=x;i>0;i--)
for(j=110;j>0;j--);}
void keydown()
{
P1=0xfe;
temp=P1;
temp=temp&0xf0;
if(temp!=0xf0)
{delay(10);
temp=P1;
temp=temp&0xf0;
}
if(temp!=0xf0)
{temp=P1;
switch(temp)
{
case 0xee:key=0;
break;
case 0xde:key=1;
break;
case 0xbe:key=2;
break;
case 0x7e:key=3;
break;
}
while(temp!=0xf0)
{temp=P1;
temp=temp&0xf0;}
P0=Table[key];
}
}
void main()
{P2=0x00;P2=0xff;
while(1){keydown();}}
在
P0=Table[key];}} 和
void main()
之间再添个 }
什么问题