if i send one character from 8051 board to hyperterminal its working. suppose if i send an array to hyperterminal its not working. can anybody suggest whats wrong with my code. here is my sample code #include<reg52.h> void main() { char name; unsigned int i; char hmi[] = {'0','0','0','0','3','0','3','3'}; PCON |= 0x80; TMOD = 0x20; TH1 = 0xFD; SCON = 0x50; TR1 = 1; while(1) { while(!RI); RI = 0; name = SBUF; TI = 0; SBUF = '#'; while(!TI); for(i = 0; i < 8; i++) { TI = 0; SBUF = hmi[i]; while(!TI); } i = 0; TI = 0; SBUF = '?'; while(!TI); } } }
while(!RI); RI = 0; name = SBUF; TI = 0; SBUF = '#'; while(!TI); for(i = 0; i < 8; i++) { TI = 0; SBUF = hmi[i]; while(!TI); } i = 0; Just a glance at the above makes it obvious the you do oodles and bunches of stuff before detecting RI the second rime. Then, of course you will react to an "old" RI, seven more may have occured whay do I know. and read whatever is being there at that time. I can not evem guess what you are doing since you are insulting me by asking me to look at uncommented code. Erik Erik
hello Mr.Erik, sorry for uncommented codes. in my code, i am sending one character from hyperterminal to controller. Then iam sending '#' from controller to hyperterminal.all these things are happening perfectly. but when i transmit an array iam getting only garbage values in the hyperterminal. iam using 19200 baud rate. while(!RI); RI = 0; name = SBUF; TI = 0; SBUF = '#'; while(!TI); for(i = 0; i < 8; i++) { TI = 0; SBUF = hmi[i]; while(!TI); } i = 0;