# ModBusMaster
| Valid For | #Open_Serial |
|---|---|
| Applies To | All |
This instruction opens a serial port for use as a MODBUS Master.
Function Prototype
#Open_Serial Port(PortNumber) ModbusMaster(
BaudRate,
Parity,
MessageGap,
QueryTimeout,
QueryAttempts
)
| Parameter | Option | Description |
|---|---|---|
| BaudRate | mandatory | The baudrate to be used. Legal values are 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 76800, 115200, (230400, 460800)* |
| Parity | mandatory | May be either:n = noneo = odde = even |
| MessageGap | mandatory | See description here. Set to 0 for the default. |
| QueryTimeout | optional | Time to wait for a Modbus Slave to respond in units of 10ms. So 50 would be 0.5 seconds. Defaults to 100 (ie, 1 second) |
| QueryAttempts | optional | Number of times to re-send to a slave that isn’t responding. Defaults to 0 which is taken to mean no retries, just send once. |
Description
This hash function sets the serial port up for use with the ModBusRTU master. Once initiated and configured, the SPLat controller Firmware takes care of all the low level communications activity. ModBus documentation.
Port() is only available on SPLat 32 bit controllers (black boards).
*The (high speed baud rates) are only available on SPLat 32 bit controllers (black boards).
Note that 32-bit controllers allow use of Modbus on multiple ports. It has been successfully tried with Master mode on one port and Slave mode on another.