Modbus TCP Demo Project Explained
Goals
1. Describe this demo project in detail to help developers customize their own Modbus TCP protocol
2. Describe how to export this project to a Nexus Panel
Preparation
- Install and launch ADE: Please go to ADE Reference Manual for downloading ADE
- Download Modbus TCP Demo project: Please go to IOT Website download the demo project. Please make sure you download the demo project that fits your ADE version.
Step 1: Launch ADE
Launch ADE:

Step 2: Click to open the demo project “ADE demo_modbus_tcp.epgz”
Click the System Menu, press Open and then choose "ADE demo_modbus_tcp.epgz".

Once the project is successfully loaded, you will see:


Step 3: Demo Project Explained
Page 1
| Code | Function Name | Description |
|---|---|---|
| 0x01 | Read Coils | Read ON/OFF status of discrete coils in the slave (0 or 1). |
| 0x02 | Read Discrete Inputs | Read the ON/OFF status of discrete inputs in the slave (0 or 1). |
| 0x03 | Read Holding Registers | Read the binary contents of holding registers in the slave (16 bits). |
| 0x04 | Read Input Registers | Read the binary contents of input registers in the slave (16 bits). |
| 0x05 | Write Single Coil | Writes a single coil to either ON or OFF. |
| 0x06 | Write Single Register | Writes a value into a single holding register (16 bits). |
| 0x0F | Write Multiple Coils | Writes each coil in a sequence of coils to either ON or OFF. |
| 0x10 | Write Multiple Registers | Writes values into a sequence of holding registers. |
-IFILE: modbus_tcp_protocol.py, modbus TCP settings for the corresponding functions
-ICO_Modbus_TCP: Import modbus TCP and init (including IP and Port).
-INB_READ_COILS: Click to read ON/OFF status of discrete coils in the slave.
-IIP1: Popup Input Pad widget.
-ITA_unit_id: Click to enter the Unit ID for connection.
-ITA_unit_addr: Click to enter the Unit Address.
-Reg_00~07: Display the values read from registers
-unit_id: Display the entered Unit ID.
-unit_addr: Display the entered Unit Address.
-ITA_unit_qty: Click to enter the quantity for connection.
-unit_qty: Display the entered quantity.
-INB_READ_DISCRETE_INPUTS: Click to read the status of coils (ON or OFF).
-INB_READ_HOLDING_REGISTERS: Click to read the holding register's value (16 bits).
-INB_READ_INPUT_REGISTERS: Click to the contents of input registers (16 bits).
-single_coil: Display the status of a single coil (ON/OFF).
-ITA_single_coil: Click to enter the ON/OFF of a single coil.
-INB_WRITE_SINGLE_COIL: Click to write a single coil to either ON or OFF.
-single_reg: Display the entered register value.
-ITA_single_reg: Click to enter the register value.
-INB_WRITE_SINGLE_REGISTER: Click to write a value to a single holding register (16 bits).
-ITA_reg_00~07: Click to enter values for writing to the holding registers in the slave.
-INB_WRITE_MULTIPLE_COILS: Click to write a sequence of coils to either ON or OFF in the slave.
-INB_WRITE_MULTIPLE_REGISTERS: Click to write values into a sequence of holding registers in the slave.


Page 2
Enable IO:
-Backlight: The screen is locked after 180 seconds of inactivity.
-RTC: Set the real time clock.

Step 4: Export Demo Project
It is recommended to run the demo project in the built-in simulator before exporting the project to an IOT product.
Launch the built-in simulator
Click "Launch Simulator" in the "Download" tool bar.
Once the simulator is launched successfully, users will see:

Export to an IOT panel
1. Please connect the panel with your PC with a USB cable. Then power on the panel.
2. In ADE, export the demo project.
3. As shown, in the Export window, please select the Output Type to "IOT Panel", match the template to your target IOT panel and set Options to download. The click Export at the bottom.


1. Once Export is executed successfully, remove the USB cable.
2. Please download ICDT Modbus TCP to your PC for using TCP/IP for communication.
3. Initial IP address is 127.0.0.1 Port: 502.
4. Switch to different mode to read/write coil and register values.
5. The results can be seen on the PC as well as on the Panel.

Conclusion
The demo project is to show how the basic Modbus TCP operations are done. Users can customize their own Modbus TCP communication based on the sample code offered in this project.