<< modbus_readInRegs modbus modbus_readRegs >>

modbus >> modbus > modbus_readInRegsFloat

modbus_readInRegsFloat

read many input registers

Calling Sequence

res = modbus_readInRegsFloat(mbc, addr, nb, isBigEndian)
[res, ierr] = modbus_readInRegsFloat(mbc, addr, nb, isBigEndian)

Arguments

mbc

The Modbus connection created with modbus_newTcp or modbus_newRtu.

addr

The address on device where input registers should be read from.

nb

The number of input registers that should be read.

isBigEndian

Way to convert read data. BigEndian : res = addr[0] << 16 + addr[1] or LittelEndian : res = addr[1] << 16 + addr[0].

res

A double matrix (size 1 x nb) with registers values. An empty matrix in case of error when called with two output arguments.

ierr

Erreur number.

Description

This function reads the status of the nb input registers to the address addr of the remote device through mbc connection descriptor.

The function uses the Modbus function code 0x04 (read input registers).

The function uses Modbus 2 unsigned short (16 bits) catenation to create float (32 bits) values.

When called with one output argument, a Scilab error will occur when the reading fails. When called with two output arguments, no Scilab error will occur but ierr will contain the internal modbus error number.

Examples

mbc = modbus_newTcp("127.0.0.1", 502);
modbus_connect(mbc);
res = modbus_readInRegsFloat(mbc, 0, 8);
modbus_close(mbc);
modbus_free(mbc);

See Also


Report an issue
<< modbus_readInRegs modbus modbus_readRegs >>