MODBUS polling 'How to ...'. Applicable for MODBUS RTU/TCP
Download a Free Trial Version. It allows you to try all features! Plugins can be downloaded separately here
How to make sure that the application sends requests and receives responses?
We recommend configuring the data display mode as shown in Figure 8. The value in the "Split strings by data timeout" field must be greater than or equal to the timeout specified in the "Request timeout" field for the MODBUS request.
Figure 8: Configuring the data display mode
In this case, the data communication will look like shown in Figure 9. The requests sent to the MODBUS device are highlighted in yellow. Please note that the response message must be at least as long as the request message.
Figure 9: Data communication
How to view register values, not raw MODBUS packets?
On the tab shown in Figure 8, turn on the "Display parsed values" option. Please note that if you do that, requests will not be displayed.
How to make sure that the application correctly interprets the responses received from the device?
You can easily do that using the "DDE Server" data export module.
- Turn on that module on the "Data export" tab by checking the checkbox to the left of "DDE Server."
Figure 10: Selecting the data export module
- Click OK.
- Let the application send a request and receive a response.
- Reopen the data export module list and double-click "DDE Server."
- In the window that opens (Figure 11), switch to the "All active items" tab. There you should see the response items specified in the request properties.
Figure 11: Selecting the data export module
Note: The "srvi" prefix adds the "DDE Server" module. Just ignore that prefix.
How to view MODBUS register values in a more easy-to-grasp form (graphs, indicators, and so on)?
We provide OPC Scada Viewer that can receive data from the logger via the OPC interface (for example, like a SCADA system) and visualize them. To make the MODBUS data received from the logger available for OPC Scada Viewer, do the following:
- Download and install OPC Scada Viewer.
- Turn on "OPC server" on the data export modules tab (just like it was described above for "DDE server").
- Add the visualization block (please refer to the OPC Scada Viewer documentation).
How to combine the data of two requests?
You might need to do that if you read two registers located far from each other by using two different requests, and then want to write them in one row to an Excel file, a database, or a text file.
Note: Available only in the Enterprise or trial version.
- In each request, specify unique names for the response items. For example, for the first request, enter VALUE_A1; for the second request, VALUE_B1. You can combine up to eight requests this way.
- Turn on the "Aggregation" data filtering module (Figure 12).
- In the module properties, enter one name for each request (Figure 13).
Figure 12: Selecting a data filtering module
Figure 13: Configuring the data filtering module
What is the right way to poll multiple devices?
To speed up the polling of multiple MODBUS devices, you can connect them to different COM ports. If all MODBUS devices were initially connected to one COM port, you can double the polling speed by connecting them to two COM ports. To set up the polling of MODBUS devices connected to two or more ports, do the following:
- Create a separate configuration for each COM port by using the "green plus" button in the application’s main window.
- Set up the polling of devices separately for each configuration.
When you should not connect devices to different COM ports:
- You cannot connect devices to different COM ports if you are going to combine the data received from these devices using the "Aggregation" module as described above.
- If the total time of polling all devices is less than or equal to the "Polling interval" of any request in the queue. In that case, connecting devices to different COM ports will only increase the consumption of resources by the application.
MODBUS RTU, MODBUS ASCII, MODBUS/TCP