dm_modbus_read_registers Function

public function dm_modbus_read_registers(modbus, address, registers, n) result(rc)

Reads many registers from address. The size of argument registers determines the number of registers to read, unless optional argument n is passed. The function uses the Modbus function code 0x03 (read holding registers).

The function returns the following error codes:

  • E_INVALID if argument registers is invalid.
  • E_MODBUS if reading the registers failed.
  • E_NULL if the Modbus context is not associated.

Arguments

Type IntentOptional Attributes Name
class(modbus_type), intent(inout) :: modbus

Modbus RTU/TCP type.

integer, intent(in) :: address

Address to read from.

integer(kind=u2), intent(inout) :: registers(:)

Register values (unsigned).

integer, intent(inout), optional :: n

Number of registers to read on input, number of registers read on output.

Return Value integer


Calls

proc~~dm_modbus_read_registers~~CallsGraph proc~dm_modbus_read_registers dm_modbus_read_registers modbus_read_registers modbus_read_registers proc~dm_modbus_read_registers->modbus_read_registers