In my ongoing quest to interface with some legacy equipment, I've discovered that the vendor supplied software sets the special characters to:
00 00 00 00 11 13
But the SerialPort class of .NET set them to:
1A 00 00 1A 11 13
I suppose that I have two questions:
The latter is all I really care about, but I suspect the former is going to be useful to know.
Update: The following doesn't work:
byte[] specialchars = {
0x00,
0x00,
0x00,
0x00,
0x11,
0x13
};
this.port.NewLine = System.Text.Encoding.ASCII.GetString(specialchars);
Update 2: As requested, here are Portmon logs for the vendor supplied app (filtered to remove the many thousands of IOCTL_SERIAL_GET_COMMSTATUS entries) and for my attempt to match even the first exchange.
NewLine
is not what you are looking for. It's the plain old 'new line' sequence, e.g. CR LF or LF alone.
The special characters are handled like this:
SerialPort.ParityReplace
It may be helpful for you to study the Win32 DCB structure as well. It's used by .NET internally to set the state of the serial port.