Skip to main content

Class Rs485Connector

Represents a connector for RS485 (serial) communication

Assembly: Meadow.Contracts.dll​
View Source​
Declaration
public abstract class Rs485Connector : IConnector, IPinController

Implements:
Meadow.IConnector, Meadow.Hardware.IPinController

Properties​

Name​

The Connector's name

View Source​
Declaration
public string Name { get; }

SerialPortName​

The serial port name

View Source​
Declaration
public SerialPortName SerialPortName { get; }

Pins​

The pins in the Connector

View Source​
Declaration
public IPinDefinitions Pins { get; }

Methods​

CreateSerialPort(int, int, Parity, StopBits, int)​

Creates and initializes a serial port with the specified configuration parameters.

View Source​
Declaration
public virtual ISerialPort CreateSerialPort(int baudRate = 9600, int dataBits = 8, Parity parity = Parity.None, StopBits stopBits = StopBits.One, int readBufferSize = 1024)
Returns​

Meadow.Hardware.ISerialPort: An instance of Meadow.Hardware.ISerialPort representing the configured serial port.

Parameters​
TypeNameDescription
System.Int32baudRateThe baud rate for the serial port communication. Defaults to 9600.
System.Int32dataBitsThe number of data bits per byte in the communication. Defaults to 8.
Meadow.Hardware.ParityparityThe parity-checking protocol to use for the communication. Defaults to Meadow.Hardware.Parity.None.
Meadow.Hardware.StopBitsstopBitsThe number of stop bits to use in the communication. Defaults to Meadow.Hardware.StopBits.One.
System.Int32readBufferSizeThe size, in bytes, of the buffer used for reading data from the serial port. Defaults to 1024.
Exceptions​

System.ArgumentException
Thrown if the serial port is already open with a different baud rate.

CreateModbusBusRtuClient(int, int, Parity, StopBits)​

Creates a Modbus RTU client configured with the specified serial communication parameters.

View Source​
Declaration
public abstract IModbusBusClient CreateModbusBusRtuClient(int baudRate = 19200, int dataBits = 8, Parity parity = Parity.None, StopBits stopBits = StopBits.One)
Returns​

Meadow.Modbus.IModbusBusClient: An instance of Meadow.Modbus.IModbusBusClient configured for Modbus RTU communication.

Parameters​
TypeNameDescription
System.Int32baudRateThe baud rate for the serial communication. Defaults to 19200. Must be a positive integer.
System.Int32dataBitsThe number of data bits per byte in the communication. Defaults to 8. Typical values are 7 or 8.
Meadow.Hardware.ParityparityThe parity-checking protocol to use for error detection. Defaults to Meadow.Hardware.Parity.None.
Meadow.Hardware.StopBitsstopBitsThe number of stop bits to use in the communication. Defaults to Meadow.Hardware.StopBits.One.

CreateModbusBusRtuServer(int, int, Parity, StopBits)​

Creates a Modbus RTU server instance configured with the specified serial communication parameters.

View Source​
Declaration
public abstract IModbusServer CreateModbusBusRtuServer(int baudRate = 19200, int dataBits = 8, Parity parity = Parity.None, StopBits stopBits = StopBits.One)
Returns​

Meadow.Modbus.IModbusServer: An instance of Meadow.Modbus.IModbusServer configured for Modbus RTU communication.

Parameters​
TypeNameDescription
System.Int32baudRateThe baud rate for the serial communication. Defaults to 19200. Must be a positive integer.
System.Int32dataBitsThe number of data bits per byte in the communication. Defaults to 8. Valid values are typically 7 or 8.
Meadow.Hardware.ParityparityThe parity checking mode for the communication. Defaults to Meadow.Hardware.Parity.None.
Meadow.Hardware.StopBitsstopBitsThe number of stop bits used in the communication. Defaults to Meadow.Hardware.StopBits.One.

Implements​