Knowledge Base
Showing results for 
Search instead for 
Did you mean: 

Simple Modbus Lua Script


Simple Modbus Lua Script


Lua Programming


Simple script to test modbus function


The following samples provide simple read / write functions:

In each of the samples, the following needs to be observed:

1. 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.

2. The nnn.MOD1 must be left unchecked so that it is not enabled, this will allow the LUA script modbus 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, please contact Product Support. The value = is the value that is either read in or written dependant on the function used.

Coil Registers

Digital Input Registers

Holding Registers

Input Registers

32bit Floating Point

Tags (1)
Labels (1)
Version history
Revision #:
1 of 1
Last update:
‎2018-09-11 09:06 AM
Updated by: