串口调试助手发数据单片机接收不对
55 AA 03 0F 05 00 17串口调试助手向单片机发送的这个数据在程序里把数据发回来是这个ff 55 aa 03 0f 05收到的数据不对#include<reg52.h>#define uchar unsigned char
#define uint unsigned int
//sbit ledhong=P1^3;
//sbit rxd=P3^0;
//sbit ledlv=P1^2;
sbit led=P1^3;//1为灯指示灯亮0为灭
uchar aa=0;
uchar bb[7];
/*void delays()//1.3s
{
uint c;
for(c=0;c<32800;c++);
}*/
void main()
{
uchar cc;
EA=1;
ES=1;
REN=1;
TI=0;
RI=0;
SM0=0;
SM1=1;
PCON=0x00;
TMOD=0x20;
TH1=0xe8;
TL1=0xe8;
TR1=1;
while(1)
{
cc=bb[0];
if(cc==0x55)
{
led=0;
}
}
}
void ser() interrupt 4
{
if(TI==1)
{
TI=0;
aa++;
if(aa<7)
{
SBUF=bb[aa];
}
}
else
{
RI=0;
if(aa<7)
{bb[aa]=SBUF;}
aa++;
if(aa==7)
{aa=0;SBUF=bb[aa];}
}
}