本人新手呵呵,编译通过了,目标实现不了啊,请高手指教下错误啊
#include<reg52.h>
char receive;
void main()
{
TMOD=0x20;
SCON=0x50;
PCON=0X80; //12hz,19200baud
TH1=0XF3;
TL1=0XF3;
TR1=1;
ES=1;
EA=1;
if(RI)
{
receive=SBUF; //串口助手中发送16进制0x02.回显0x01
//发送0x00则回显示3;其他显示0X10;
switch(receive)
{
case 0x02:
SBUF=0X01;
while(!TI);
TI=0;
break;
case 0x00:
SBUF=0X03;
while(!TI);
TI=0;
break;
default:
SBUF=0X10;
while(!TI);
TI=0;
break;
}
RI=0;
}
while(1);
} |