Receiving characters on serial port
I am developing a serial port( RS232) application. I have soemproblem in receiving characters. There is communication between two processors.
Receiving a single byte works fine. But if I do not know, how many bytes are there I will have to use following bytes. Since following loop in infinite loop it will never come out. Please let me know..
This is sample routine to read a characters from the serial port.
char lsr, rbr,typeahead;
Int nextput = 0;
lsr = inbyte ( 0x3FD);
if ( (lsr & 0x01) != 0 )
rbr = inbyte(0x3F8);
typeahead[nextput++] = rbr;
lsr = lsr & FE; // Clear RI bit