|
pc一次向单片机发送5个字节的数,可在仿真时查看数组变量就不对,数组指针也不对,请教各位高手怎么解决?
源程序如下:
#include<Reg52.h> unsigned char inbuf1[4]; unsigned char count3; void init() { TMOD=0X20; TH1=0XFD; TL1=0XFD; SCON=0X50; TR1=1; ET0=1; REN=1; EA=1; ES=1; }
void ser ()intrerupt 4 { if(RI) { unsigned char data1; RI=0; data1=SBUF; inbuf1[count]=data1; count++; } if(count==3) count=0;
}
void main() { unsigned int a,b,c,d; void init() a=inbuf1[0]; b=inbuf1[1]; c=inbuf1[2]; d=inbuf1[3]; }
|
|