FieldTalk™ Modbus Master .NET Library

MbusSerialMasterProtocol.openProtocol Method (String, Int32, Int32, Int32, Int32)

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

[Visual Basic]
Overloads Public Function openProtocol( _
   ByVal portName As String, _
   ByVal baudRate As Integer, _
   ByVal dataBits As Integer, _
   ByVal stopBits As Integer, _
   ByVal parity As Integer _
) As Integer
[C#]
public int openProtocol(
   string portName,
   int baudRate,
   int dataBits,
   int stopBits,
   int parity
);

Parameters

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

Return Value

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.

See Also

MbusSerialMasterProtocol Class | FieldTalk Namespace | MbusSerialMasterProtocol.openProtocol Overload List