FieldTalk Modbus Master Library for .NET
FieldTalk Modbus Master Library for .NET
Namespaces
FieldTalk.Modbus.Master
MbusSerialClientBase Class
MbusSerialClientBase Methods
openProtocol Method
openProtocol Method
openProtocol Method (String, Int32, Int32, Int32, Int32)

# MbusSerialClientBase openProtocol Method (String, Int32, Int32, Int32, Int32)

Opens a serial Modbus protocol and the associated serial port with the port parameters configured via properties

Namespace: FieldTalk.Modbus.Master
Assembly: FieldTalk.Modbus.Master (in FieldTalk.Modbus.Master.dll) Version: 2.15.2-eval+3d8362b4bb861c05760d48b11d303e954bb8597c
Syntax
C#
VB
C++
Copy

    public int openProtocol(
    	string portName,
    	int baudRate,
    	int dataBits,
    	int stopBits,
    	int parity
    )

    Public Function openProtocol (
    	portName As String,
    	baudRate As Integer,
    	dataBits As Integer,
    	stopBits As Integer,
    	parity As Integer
    ) As Integer

    public:
    int openProtocol(
    	String^ portName,
    	int baudRate,
    	int dataBits,
    	int stopBits,
    	int parity
    )

#### Parameters

portName
  Type: System
  String
  Serial port identifier (eg "COM1")
baudRate
  Type: System
  Int32
  The port baud rate in bps (1200 - 115200, higher on some platforms)
dataBits
  Type: System
  Int32
  SER_DATABITS_7: 7 data bits (ASCII protocol only), SER_DATABITS_8: 8 data bits
stopBits
  Type: System
  Int32
  SER_STOPBITS_1: 1 stop bit, SER_STOPBITS_2: 2 stop bits
parity
  Type: System
  Int32
  SER_PARITY_NONE: no parity, SER_PARITY_ODD: odd parity, SER_PARITY_EVEN: even parity

#### Return Value

Type: Int32
BusProtocolErrors.FTALK_SUCCESS on success or error code. See BusProtocolErrors for possible error codes.
Remarks
This function opens the serial port with a specific port settings. After a port has been opened, data and control functions can be used.

Note
The Modbus standard requires two stop bits if no parity is chosen. This library is not enforcing this but it is a recommended configuration.

See Also

#### Reference

MbusSerialClientBase Class
openProtocol Overload
FieldTalk.Modbus.Master Namespace
FieldTalk Modbus Master Library for .NET
Library version 2.15.2