Setup COM Port for Modbus

mbo = modbus.set(cpo, [prot])

Sets the port to use the RS485/Modbus interface.

Parameter Type Description
cpo object COM Port Object
prot string Protocol string, e.g. 19200N8
Returns Type Description
mbo object table An object that can be used for Modbus calls. See Modbus Object
Note

Set the protocol using cpo﹕set

Caution

Make sure the N4X PCB has the RS485 adapter fitted to the COM Port.

e.g.

cpo = serial.port(3)
mbo = modbus.set(cpo, '19200E8')

Or

cpo = serial.port(3)
cpo:set('19200E8')
modbus.set(cpo)
...