How To Communicate With Modbus RTU Slave Device in LabVIEW
How To Communicate With Modbus RTU Slave Device in LabVIEW
1. Make sure the Modbus ID and Baudrate used in the Modbus RTU slave device. If there
are multiple Modbus salve devices on the RS‐485 network, each of them needs be
assigned with a unique Modbus ID.
For ICP DAS Modbus RTU slave devices, the DCON Utility Pro is free download at
http://ftp.icpdas.com/pub/cd/8000cd/napdos/driver/dcon_utility/ to search modules
out and configure the searched devices.
2. Unzip the ModbusRTU.zip, open a suitable demo for the I/O type on the module, the
COM port and Baud Rate settings on the front panel need be the same as what the
module used in the DCON_Utility_pro. The modbus ID is 1 in the demo.
(The NI Modbus.llb is free download on the NI web site.)
3. On the Block Diagram, the first vi is MB Serial Init used to configure the COM port
connection parameters such as COM port, Baud Rate, Parity and Timeout.
Function code
Starting Address
Quantity
Data (Analog output data if needed)
Discrete (Digital output data if needed)
Mode: RTU
Slave Address: the unique Modbus ID for a module
5. Close the connection at the end of the program.