Reputation: 1853
I have a SerialPort
with a setup with flow control to be 1. How to set it in c#.
I have newline char
in my port setup and I assume that different to the flow control. My port setup so far is as below. Can anyone help me with setting the flow control please ? Thank you.
SerialPort _comm = new SerialPort
{
PortName = string.Concat("COM", comPort),
BaudRate = 9600,
Parity = Parity.None,
DataBits = 8,
StopBits = StopBits.One,
ReadTimeout = 1000,
WriteTimeout = 5000,
NewLine = "\r"
};
Upvotes: 3
Views: 17990
Reputation:
https://msdn.microsoft.com/en-us/library/system.io.ports.handshake(v=vs.110).aspx
You can use Handshake for that to control flow control
Upvotes: 8
Reputation: 911
In myproject I used below code for serial port initialization.
public void Serial_Port_Initialize(SerialPort port)
{
//Initializing the serial port
port.PortName = port.PortName;
port.BaudRate = port.BaudRate;
port.Parity = Parity.None;
port.StopBits = StopBits.One;
port.DataBits = 8;
port.Handshake = Handshake.None;
port.RtsEnable = true;
port.ReadTimeout = 250;
port.DataReceived += DataReceivedHandler;
}
Upvotes: 2