Chapter 16. Modbus Commands Methods from ModbusSupport.g

Table of Contents
apply — applies all scripted changes.
addPoint — configures a Modbus point.
addRange — configures a range of Modbus points.
cancel — cancels all scripted changes.
createSlave — creates a slave connection.
deletePoint — deletes point connections.
deleteSlave — deletes a slave connection.
enableMaster — enables and disables Modbus master functionality.
enableSlave — enables and disables Modbus slave connections.
reloadSettings — loads all Modbus configuration.
slaveExists — checks for the existence of a slave connection.

Access to the DataHub Modbus feature and command set is made available through the ModbusSupport.g script located in the require folder of your DataHub installation. To use the script, follow these steps:

  1. Ensure that the ModbusSupport.g file is present in your Program Files\Cogent\Cogent DataHub\require\ directory.

  2. Require the file by adding the following line at the top of your script:

    require (ModbusSupport);
  3. In your script, create a ModbusConfig instance:

    local x = new ModbusConfig();

All of the methods in ModbusSupport.g are wrappers of a corresponding set of DataHub commands, which are documented in the Cogent DataHub Command Set.