I have an application that uses the system.io.ports .serial class to
receive data from a serial device. The device is sending a data stream
of stx then 15 readable ascii characters then a cr. My datareceived
event looks like:
int iBytesToRead = com.thePort.Byt esToRead;
string data = com.thePort.Rea dExisting();
// Make sure we are aligned on the <STXcharacter
if (data[0] != STX)
{
com.thePort.Dis cardInBuffer();
return;
}
//if (iBytesToRead != 17)
// return;
com.DataReceive d(data);
com.thePort.Dis cardInBuffer(); // discard the checksum
When I run the application in the debugger I 17 characters read but when
I do not run with the debugger I get a variable number of characters -
most often 8 and being the first n characters sent.
It is almost like something is interrupting the ReadExisting.
Any ideas on what is going on?
thanks
pete
Comment