Nisha
Nisha

Reputation: 1853

how to set the flow control of serial port?

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

Answers (2)

user6522773
user6522773

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

sowjanya attaluri
sowjanya attaluri

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

Related Questions