Issue
Simple Modbus Lua Script
Product Line
EcoStruxure Building Expert
Environment
Lua Programming
Cause
Simple script to test Modbus function
Resolution
In each of the samples, the following needs to be observed:
- The Modbus port is closed and opened with the port settings. The samples can be combined but the port is only set once.
- The settings for the Modbus RS485 port requires an address, in this instance 99 is used. This must be different from the slaves.
- The nnn.MOD1 must be left unchecked so that it is not enabled. This will allow the Lua script ModbusB to work.
- For added functionality the "Print" command is used. The "print" command provides added functionality indicating a successful read / write in the output window. If the result = 0 then the read / write is successful. Anything else is an error code. Contact Product Support. The value = is the value that is either read in or written dependant on the function used.
The following samples provide simple read / write functions.: