Write Single Register

t, txt = mbo:wsr(adr, reg, v, [ms])
t, txt = modbus.wsr(cpo, adr, reg, v, [ms])

Write single register (Modbus function 6/0x06)

Parameter Type Description
mbo object table Modbus Object
cpo object COM Port Object
adr integer Slave address
reg integer Register to write
v integer Value to write
ms integer Receive timeout
Returns Type Description
t table Values returned
txt string Remaining string (if any)
Note

The "Register" is 16-bits wide.