> I am writing a window program to communicate with a embedded frimware
> device via PC RS232 serial port. My program requires sending and
> receiving data. In each frame, first and last bytes need parity bit
> set (MARK), the rest of bytes need parity bit reset (SPACE). The
> window program is the master.
> My question is when I set parity bit on PC is different than the one I
> receive, do I really receive this type (I am using ReadFile)?
> I used HyperTerminal to try out this test. I start HyperTerminal in
> two different PCs. Two PCs are connected via serial port. I set up
> one PC with MARK parity, the other one with SPACE parity. The rest of
> settings are the same. When I send only one byte, I did receive this
> type on the other PC, but if I send more bytes, I didn't receive
> anything on the other PC. Can someone explain the parity bit problem
> on PC in general? Should my program be ready to receive any data even
> in different parity bit?
Windows does not give you the received parity bit. The hardware checks
it and reports an error if it does not match what you have set. So you
might not be able to do this at all using the standard Windows serial
A possible work-around: If your device data format is 7 bits plus parity
try setting 8 bits with no parity in your program. I think the received
parity bit will then appear in the high bit of each received byte, with
no hardware checking. And if that works it would probably also let you
set the high bit when you send, letting you directly control the send
parity in each character.
Scott McPhillips [VC++ MVP]