Simon Chamlian

Sending values on UART (5282)

Discussion created by Simon Chamlian on Jul 18, 2008
Latest reply on Jul 21, 2008 by ioan petrescu
I am trying to design a communication protocol between the 5282 and a PC.

The 5282 sends characters from 0 to 0xFF and the PC is supposed to read them.
The problem I am having is reading the zeros! All other values (from 1 to 0xFF) work fine.
The code of the PC program is (in a while loop with timeouts):
unsigned char c;ReadFile(handle, &c, 1, &n_bytes_read, NULL);// read 1 character at a time

When the firmware sends a 0 integer, the ReadFile() function returns with n_bytes_read = 0.
So there is no way finding out if ReadFile() didn't read any value OR it read a 0 integer (which is the NULL character in ASCII).
I know that this is not a 5282 problem but rather a kernel32 but I thought someone might have solved this