Problem: Need to change the properties of the Modbus Driver Object
Solution: The Modbus Driver Objects Controls three settings:
The Modbus.ini file is optional and when used it should be placed in the same directory as the modbus.cbx file. Most often, that is in the C:\Directsoft32 directory.
In this example, all Modbus objects except Modbus1 and Modbus5 update all their outputs every 200 polls. Modbus5 updates its outputs every 10 polls. Modbus1 does not update its outputs unless an output changes. In addition, all the Modbus objects except Modbus5 use the RTU protocol. Modbus5 always uses the ASCII protocol.
Example Modbus.ini file:
[all]
UpdateOutputs = 200 RefreshOutputs = 1 Protocol = RTU
[Modbus1] RefreshOutputs = 0
[Modbus5] UpdateOutputs = 10 RefreshOutputs = 1 Protocol = ASCII
As listed in the example file, the [all] group lists global parameters applied to every Modbus driver object. If you want the parameters to be identical for every device, it is sufficient to just specify this group. If, however you want to define different parameters for individual devices, you must specifically identify the tag names of the individual devices; e,g, [Modbus5]. For each group, you can specify one or more file settings. These are defined below.
UpdateOutputs specifies how many poll requests pass before the driver rewrites all outputs to the device. For example, if Update outputs equals 10, then every tenth time the Modbus object receives a poll request, it writes all output values to the device. This ensures that the device is synchronized with LookoutDirect. The default value is 100.
RefreshOutputs specifies whether the driver regularly rewrites all outputs every UpdateOutputs poll request. If RefreshOutputs is equal to 1 (the default value), the driver output rewrite function is turned on. If RefreshOutputs is equal to 0 (zero), the driver output rewrite function is turned off; no rewriting of output values occurs except when they change.
Note: the Modbus driver object always writes all outputs whenever it first starts, and whenever it recovers from a communication failure.
Protocol specifies if the driver will use only ASCII or only RTU. If you do not specify a protocol the default is to try by the RTU protocol first. If this fails it then tries the ASCII protocol.