
Serial Port error handling
I need to read ASCII data coming from a device through the serial port. I
have a set of routines using the Windows 3.1 API which work fine when the
data is nice and clean. The trouble is that the data stream isnt always
clean - I get noise on the line which causes errors like Break or Framing
error. The way my code is written this has the effect of obscuring the
valid ASCII that is coming in.
I know that there must be a way of cleaning it up or getting past the
errors somehow to get the data as the Windows Terminal applet (not noted
for its sophistication) can still read and display the ASCII no problems at
all.
I have tried reading the receive buffer only when a data event has occured,
filtering the data to keep only the ASCII that I want, adjusting the timing
of reads, reading in bunches or characters one by one. Nothing works.
Can anybody point me in the right direction here or even send me some code
snippets?
regards
David