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); } } }
It seems like problem with the initialization of array. You first declare the array and next you initialize the array. Now you try.
What parity setting is Hyperterminal using? I note that '#' and '?' characters have an odd number of high bits in their ascii coding while '0' and '3' have an even number of high bits.
hello Mr.Patrick, not only with 0's with any character only garbage value is transmitting
hello Mr.Neo, I tried that too. its not working
Then you do one thing. In the section
for(i = 0; i < 8; i++) { TI = 0; SBUF = hmi[i]; while(!TI); }
SBUF = hmi[i]
SBUF = 0x41
char * hmi ="0003030"