You can help by commenting or suggesting your edit directly into the transcript. We'll review any changes before posting them. All comments are completely anonymous. For any comments that need a reply, consider emailing docs@inductiveautomation.com.
Version:
LESSON LIST
-
4:55Connecting to Modbus Device
-
3:21Modbus Addressing
-
5:04About Modbus Address Mapping
Supplemental Videos
LESSON
Connecting to Modbus Device
Description
There are three Modbus protocols you can connect with: Modbus RTU over Serial, Modbus RTU over TCP, and Modbus TCP. Typically, you connect using the Modbus TCP driver.
Video recorded using: Ignition 8.3
Transcript
(open in window)[00:00] Let's connect to a device with one of Ignition's Modbus drivers. From the homepage of our gateway, we'll go to Connections, Devices, and Connections in the side navigation menu. I don't have any devices configured yet, so we can begin by clicking Create Device Connection. The next page will contain a list of all your installed drivers. Scroll down to the Modbus section and you'll see that there are several options available. In most scenarios, you'll probably be using the Modbus TCP driver here. However, if you know you're working with an RTU that connects to a device via Modbus RTU over serial, the Modbus RTU driver is what you should pick. If you're working with Modbus RTU that implements the Modbus protocol over TCP, choose Modbus RTU over TCP. If you're uncertain about what to use, check the device's documentation to determine what protocols it supports. The different RTU drivers will only connect with RTU configurations that match their requirements. I know I'm not working with an RTU over serial or an RTU over TCP, so I'll select the Modbus TCP driver.
[01:10] Now we can click the next button. We need to give the device connection a name, so I'm gonna call this Modbus. Under Connectivity, we need to specify a host name. For this demonstration, I'm working with a local Modbus simulator, and I have that IP saved on my clipboard already, so I'll just paste that in. You'll wanna put in the host name or the IP of the Modbus device that you wanna connect to. Next, I'd like to highlight a few specific properties. First, the port defaults to 502. Typically, this is the default port from Modbus TCP over IP, so in most cases you can leave this setting alone. However, if your device is configured to communicate over a different port, you can fill in that value here. The local address property allows you to specify what local address to connect from when establishing a TCP connection. If this box is left blank, then the driver will pick the address of an available network adapter to connect from.
[02:06] If you're looking for ways to fine-tune request handling for better performance, the request optimization and read/write request config sections give users a more granular control over those functions. Most of these properties can be left at their default settings, but there are a few especially useful ones I'd like to call attention to here. The concurrent requests value represents the number of requests that Ignition will try to send to the device at the same time. Increasing this number can sometimes help with your request throughput, but increasing it too much could overwhelm the device and negatively impact communications. With the span gaps property, you can also choose whether or not to span address gaps when optimizing requests. This property optimizes requests by grouping them into large chunks, but if a bad address is present in that range, then every other address in that request will also be flagged with bad quality. This leads to a large number of bad quality tags that appear in the tag browser. In this scenario, toggling span gaps can aid in finding those bad addresses.
[03:06] It can also reduce the number of requests, but it will increase the amount of data requested at once. For more information about the other read/write properties, please check out the link to the Ignition User Manual below this video. The advanced settings give us additional options to tailor the device connection. The reverse word order property can be particularly useful since some device manufacturers read consecutive registers in varying word orders. This is because the Modbus specification doesn't include a section for reading and writing 32-bit values. Due to this potential variation, when someone tries to read a multi-word 32-bit value, they might get an incorrect tag value initially. The reverse word order property is set to false by default, so when reading and writing 32-bit values from or to a Modbus device, the high word comes before the low word. If this option is set to true, however, the low word comes before the high word instead. If an incorrect tag value is coming through due to this variation, toggling this property would return the expected tag value.
[04:09] Another important property to focus on is zero-based addressing. The driver defaults to one-based, meaning that the address range will start at one. However, you can toggle this property to start the address range at zero instead. The device I'm trying to connect to is one-based, so I can leave this setting as is. Last, the string handling properties available can also help with factors like byte order, padding, and null characters. Now that our settings are in place, we can click Create Device Connection. With an active connection, we can start creating tags manually or with Ignition's address mapping feature. We'll see examples of both methods in upcoming videos.