2

I need to send and receive data from a AD101B board by rs232 serial port to my own c# application. So I made a trace to the suplier application. I obtained the data connection, baud rate, parity, stopbyte, etc.

            SerialPort port = new SerialPort();
            port.PortName = p_strPortName;                 //COM1
            port.BaudRate = p_uBaudRate;                   //9600
            port.DataBits = p_uDataBits;                   //8
            port.StopBits = StopBits.One;                  //1
            port.Parity = Parity.None;                     //None
            port.ReadTimeout = p_uReadTimeout;             //300
            port.WriteTimeout = p_uWriteTimeout;           //300
            port.Open();

I couldn't set the following values in the SerialPort class

IOCTL_SERIAL_SET_HANDFLOW: Set handshake information
ControlHandShake=1
FlowReplace=64
XonLimit=0
XoffLimit=0

I found this topic it was useful, but I cant set the value of FlowReplace or ControlHandShake, because they aren't part of the DCB structure.

If anyone knows how set the HandFlow value in C# or how to establish the connection between AD101B device and C # application it would help me.

Cœur
  • 37,241
  • 25
  • 195
  • 267
marziano23
  • 21
  • 2
  • You are looking at the driver IOCTL. Set the SerialPort.Handshake property to none and DtrEnable to true. The rest don't matter. – Hans Passant Apr 04 '15 at 10:30
  • https://www.codeproject.com/Questions/856414/Change-DCB-fields-from-SerialPort-instance-Csharp – AgentFire Mar 01 '18 at 13:58

0 Answers0