H
Henryk
I'm just exploring c# for the fun of it (being a long time MFC and WIN32
programmer).
I want to receive some binary data, which contains ascii values but is
wrapped by an STX (0x02) and an ETX (0x03) byte.
If I open the com port it just throws an IOException and I don't know why
The code looks like this:
this.rs232 = new SerialPort();
// setup the com port
this.rs232.BaudRate = 19200;
this.rs232.DataBits = 8;
this.rs232.Parity = Parity.None;
this.rs232.StopBits = StopBits.One;
this.rs232.PortName = "COM2";
this.rs232.ReadTimeout = 500; // 500 ms
this.rs232.WriteTimeout = 500; // 500 ms
this.rs232.Open()
If the transmitter is NOT connected the Open succeeds but as soon as I
connect the the transmitter to my com port the Open throws an exception.
Sometimes it succeeds but then the this.rs232.ReadByte failes with the same
exception.
What am I doing wrong? I'm trying this for quite a time. In WIN32 it would
be plain simple and I would be done with the whole program already ... (
Thank you for any hint!
Henryk
programmer).
I want to receive some binary data, which contains ascii values but is
wrapped by an STX (0x02) and an ETX (0x03) byte.
If I open the com port it just throws an IOException and I don't know why
The code looks like this:
this.rs232 = new SerialPort();
// setup the com port
this.rs232.BaudRate = 19200;
this.rs232.DataBits = 8;
this.rs232.Parity = Parity.None;
this.rs232.StopBits = StopBits.One;
this.rs232.PortName = "COM2";
this.rs232.ReadTimeout = 500; // 500 ms
this.rs232.WriteTimeout = 500; // 500 ms
this.rs232.Open()
If the transmitter is NOT connected the Open succeeds but as soon as I
connect the the transmitter to my com port the Open throws an exception.
Sometimes it succeeds but then the this.rs232.ReadByte failes with the same
exception.
What am I doing wrong? I'm trying this for quite a time. In WIN32 it would
be plain simple and I would be done with the whole program already ... (
Thank you for any hint!
Henryk