Modbus control

Last modified by writer on 2023/09/08 18:36

number, bool ReadModbusRegister(string name)

Getting Modbus-register value.

Options:

  • string name – the register name configured in the Modbus setup menu.

Return values:

  • value – Modbus-register value. Returns the last successfully read value from the cache, refreshed at 100ms intervals (the frequency of updates may vary depending on certain conditions). Returns 0 if the value has never been successfully read;
  • is_online – boolean value that determines whether the last attempt to read the value of the Modbus register was successful.
number, bool ReadModbusRegisterUpdated(string name)

Getting Modbus-register value without cash. The register value is requested every time the command is invoked.

Options:

  • string name – the register name configured in the Modbus setup menu.

Return values:

  • value – Modbus-register value;
  • is_online – boolean value that determines whether the last attempt to read the value of the Modbus register was successful.
bool WriteModbusRegister(string name, number value)

Setting Modbus-register value.

Options:

  • string name – register name configured in the Modbus setup menu;
  • number value – the register value to be set (16-bit integer).

Return value:

  • true – if the setting of the Modbus register value is successful.
number1, ... , numberN, bool ReadModbusMultipleRegistersUpdated(string name, number count)

Getting values of several Modbus registers in a row without using a cache.

Options:

  • string name – register name configures in the Modbus setup menu;
  • number count – number of requested registers.

Return values:

  • value1, ... , valueN – Modbus-register values;
  • is_online – boolean value that determines whether the last attempt to read the value of the Modbus register was successful.
bool WriteModbusMultipleRegisters(string name, number count, number value1, ... , number valueN)

Setting of several Modbus registers in a row.

Options:

  • string name – register name configured in the Modbus setup menu;
  • number count – number of registers to write;
  • number value1, ... , number valueN – the register value to be set (16-bit integer).

Return value:

  • true – if the setting of the Modbus register value is successful.