I have an RS-232 to USB adapter that is assigned to COM3. I can read data from it using Putty with the following configuration:
- Serial line to connect to: COM3
- Speed (baud): 10000
- Data bits: 8
- Stop bits: 1
- Parity: None
- Flow Control: None
Yes, I know that 10000 is not a standard baud rate, but I have verified it multiple times with an oscilloscope, so I am using that value.
I am trying to write a trivial C# program to read data from the port and process it, but I cannot get it to read any data. The DataReceived handler is not called before the 10 seconds is over. Could someone suggest how to change the program so that it will read?
using (var port = new SerialPort("COM3", 10000, Parity.None, 8, StopBits.One)) { port.DataReceived +=port_DataReceived; port.Open(); Thread.Sleep(10000); }