Read Input Registers

t, err = mbo:rir(adr, regs, regc, [rfmt, [ms]])
t, err = modbus.rir(cpo, adr, regs, regc, [rfmt, [ms]])

Read input registers (Modbus function 04)

Parameter Type Description
mbo object table Modbus Object
cpo object COM Port Object
adr integer Slave address
regs integer First register to read
regc integer Number of registers to read
rfmt string Receive format string ([Modbus Format Strings])
ms integer Receive timeout

The receive format string allows unpacking of arbitrary data formats.

Returns Type Description
t table Boolean values (one for each input)
err string Modbus error (if applicable)

See also: modbus.rhr

Note

Each "Input Register" is 16-bits wide.