Weintek HMI To Multiple Modbus RTU Slave Devices
Weintek HMI To Multiple Modbus RTU Slave Devices
Page 1 of 14
Weintek HMI to multiple Modbus RTU (RS-485) Slave Devices
A Modbus slave device provides a Modbus master device with the following
memory tables to access data.
Object Type Access Address Range Read Write Single Write Multiple
(Read-write)
Coil R/W 00001-09999 FC01 FC05 FC15
(Bit) (0x)
Discrete input R 10001-19999 FC02 N/A N/A
(Bit) (1x) (Read only) (Read only)
Input register R 30001-39999 FC04 N/A N/A
(16-bits) (3x) (Read only) (Read only)
Holding register R/W 40001-49999 FC03 FC06 FC16
(16-bits) (4x)
Note: FC means Modbus Function Code
The supported Modbus Function Codes vary from the manufacturers. The
common function codes are shown below.
Page 2 of 14
Weintek HMI to multiple Modbus RTU (RS-485) Slave Devices
Prerequisites:
• Each Modbus RTU slave device must use the same serial configuration, including
Baud rate, Data bits, Stop bits, and Parity.
• Each Modbus RTU slave devices must be assigned a unique slave ID number (unit
address) from 1 to 247.
Detail of the HMI Programming: Open a new project and choose the HMI model
cMT3090. To get the HMI talking to the Modbus slaves, go to the [HOME] tab on the top
of the menu and then click on the [System Parameters] button.
You will need to select one of the drivers based on the specification of your
devices.
Page 3 of 14
Weintek HMI to multiple Modbus RTU (RS-485) Slave Devices
I/F: RS-485 2W
Device default station no.: You can enter the station number of the first slave
device.
Click on the [Settings..] button to enter the serial settings of your Modbus
slave devices, including Baud rate, Data bits, Stop bits, and Parity.
Page 4 of 14
Weintek HMI to multiple Modbus RTU (RS-485) Slave Devices
Click on the [Data Conversion] button to implement Byte swap, Word swap,
or Double Word swap.
Since the Modbus protocol does not define exactly how data is stored in the
registers. You will need to check with the manufacturer to find out which
ordering format your slave device stores data.
By default the Modbus RTU master driver in Weintek HMI uses Low byte (or word,
double word) first as ordering.
Page 5 of 14
Weintek HMI to multiple Modbus RTU (RS-485) Slave Devices
Page 6 of 14
Weintek HMI to multiple Modbus RTU (RS-485) Slave Devices
*1. The Modbus RTU (Zero-based Addressing) driver reads a group of 16 bits at a
time. Bit groups are 0-15, 16-31, 32-47,48-63, etc. All bits in the group must be available
in the controller for the HMI to read. Otherwise, errors will result.
*2. The 5x is exactly the same as the 4x. Use the 5x when reading/writing to a 32-bit
registers using the low word first format. For example,
Address 1 2
Data (word) 0x4E20 0x7530
Data (Double word) 0x075304E20
Address 1 2
Data (word) 0x4E20 0x7530
Data(Double word) 0x4E207530
*3. By default the Weintek HMI uses a Function Code 16 to write multiple registers,
even if it is only writing to one register. The 6x forces the HMI to transmit a Function
Code 06 to write a single register.
Page 7 of 14
Weintek HMI to multiple Modbus RTU (RS-485) Slave Devices
To read 32-bit unsinged data from register 40106 (combined with 40107 to generate 32-
bit data) with high word first format, please check the Word swap [ABCD ->CDAB]
option on [Data Conversion].
Create a Numeric object and specify the address 4x_Double - 106 on the
[General] tab as below.
Page 8 of 14
Weintek HMI to multiple Modbus RTU (RS-485) Slave Devices
Under the [Format] tab, enter the number of digits used in this parameter as
well as the device’s low limit and high limit. Click the [OK] button to finish setting
up this object.
Page 9 of 14
Weintek HMI to multiple Modbus RTU (RS-485) Slave Devices
The 4x_Bit is used to read/write to individual bits in the 4x memory table. To access a bit in 4x
memory table, select the 4x_Bit as the address for bit-type objects such as Bit Lamp. Under the
Address, use the format DDDDDdd to enter the word memory area, followed by the two-digit
bit reference.
For example, to monitor the second bit of 40030, enter "3001" into the Address. (DD=30, dd=01)
The 3x_Bit works the same as for the 4x_Bit, except that it is used for accessing bits in a 3x
memory table (input register, read only).
Page 10 of 14
Weintek HMI to multiple Modbus RTU (RS-485) Slave Devices
The ABC stands for device station number and ranges from 0 to 255. The
Addr stands for device address. The “#” is a sign that separates the station
number and the address.
Once finishing the input, the HMI will read address 0 in the 3x (The 3xxxx
table) Modbus table using Function Code 0x04.
If you input the address without a station number, the HMI will query the
default slave device. (where you set up on the Modbus RTU driver)
Page 11 of 14
Weintek HMI to multiple Modbus RTU (RS-485) Slave Devices
Station Number Variable allows you to change the station number (unit ID)
during runtime to monitor different slaves. Up to 16 Station Number
Variables can be used in one project.
The Addr stands for the device address. The “#” is a sign that separates the
station number and the address.
In this example, the station number is determined by var 1. You will need to
enter a station number to System Register LW-10001.
Page 12 of 14
Weintek HMI to multiple Modbus RTU (RS-485) Slave Devices
When you input the constant value 3 to the Numeric object that is specified
address LW-10001 during runtime, the other Numeric object will display the
value pulled out from the slave ID 3.
Page 13 of 14
Weintek HMI to multiple Modbus RTU (RS-485) Slave Devices
Page 14 of 14