作者: zjjhtony 时间: 2018-5-22 18:44
所有的“case0xfe:”改成case 0xfe:
软件不会有warnings。功能没有帮你看。
至少能学会能查出语法错误,再查自己的功能错误。作者: wulin 时间: 2018-5-22 20:54
程序本身没有语法错误,是你没有留空格。
switch(P2) //检测按键,输出数码管、载入定时器初值、允许中断
{
case 0xfe:shumaguan=0x1;tone1=0xfb;tone2=0xe9;EA=1;break;
case 0xfd:shumaguan=0x2;tone1=0xfc;tone2=0x5c;EA=1;break;
case 0xfb:shumaguan=0x3;tone1=0xfc;tone2=0xc1;EA=1;break;
case 0xf7:shumaguan=0x4;tone1=0xfc;tone2=0xef;EA=1;break;
case 0xef:shumaguan=0x5;tone1=0xfd;tone2=0x45;EA=1;break;
case 0xdf:shumaguan=0x6;tone1=0xfd;tone2=0x92;EA=1;break;
case 0xbf:shumaguan=0x7;tone1=0xfd;tone2=0xd0;EA=1;break;
case 0x7f:shumaguan=0x1;tone1=0xfd;tone2=0xee;EA=1;break;
default: EA=0;SPK=0;shumaguan=0x00;//没有键按下则关闭中断和数码管
}