I am using mqx3.5 .
I wrote a small code to read packet from rs485
int rxBytes = 0,BytesToBeRead = 0;
BOOL bytesPresent = FALSE ; /* To avoid blocking */
if( MQX_OK == ioctl(comPort->handle, IO_IOCTL_CHAR_AVAIL ,&bytesPresent))
if( bytesPresent )
rxBytes += fread(pBuffer+rxBytes, SINGLE_BYTE_ELEMENTS, 1, comPort->handle);
This code is working fine but it is getting an extra bit in the beginning of the packet which is not sent by other end device but received in pBuffer.
Please do help
Thanks in advance