LPC1227 help in receiving data from UART1

Status
Not open for further replies.

arunkollam

Junior Member level 2
Joined
Jun 26, 2008
Messages
20
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,412
Hi
i am writing a program which receives 0x03 and 0x04 strings continusly via UART0 and sends to a device through UART1.The device responds with a 3 bit data for each command(0x03 and 0x04).


DEVICE-1 sends 0x03 =>uart0----- LPC1227-----UART1=>0x03 to the device2
DEVICE-2 sends 0x01 0x0c 0xff =>uart1----- LPC1227-----UART0=>0x01 0x0c 0xffto the device1

DEVICE-1 sends 0x04 =>uart0----- LPC1227-----UART1=>0x04 to the device2
DEVICE-2 sends 0x01 0x0c 0xff =>uart1----- LPC1227-----UART0=>0x01 0x0c 0xffto the device1



The first bit of the receving bit is a command and it should be always 0x01.
my problem is in receiving the 3 bit data , some times the device 2 will not send 3 bits of data insted it will send 1 or 2 bits and my getchar waits for receiving it and the program enter into a endless loop.so any one can help me in writing a timer which waits for receiving the data for 5 ms and after 5ms , if there is no data received restart or clear the uart buffer.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…