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.1

Transcript

(open in window)

[00:00] Let's connect to a device with one of Ignition's Modbus drivers. From the homepage of your gateway, go to the Configure section. Scroll down to the OPC UA section, and select Device Connections. Here you can see I don't have any devices configured yet. Let's begin by clicking the Create New Device link. 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 select. 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.

[01:06] 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. Now, let's scroll down to the bottom of this list and 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 local IP saved on my clipboard already, so I'm just going to paste that in. You'll want to put in the host name or IP of the Modbus device that you want to 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.

[02:03] However, if your device is configured to communicate over a different port, you can fill in that value here. As of Ignition 8.1.8, 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 simply pick the address of an available network adapter to connect from. If you check the Show Advanced Properties checkbox here and scroll down, you'll see a list of other available properties. Most of these properties can also be left at the default setting, but there are a few especially useful ones I'd like to call attention to here. One new property added in Ignition version 8.1.0 is the property called Concurrent Requests. This 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 this too much could overwhelm the device and negatively impact communications with that device.

[03:07] Now let's talk about Reverse Word Order. Some device manufacturers read consecutive registers in varying word orders because the Modbus specification doesn't include a section for reading and writing 32-bit values. Because of 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 then return the expected tag value. 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.

[04:05] 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 and move to the next property, Span Gaps. The span gaps 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 amount of bad quality tags that appear in the tag browser. In this scenario, toggling Span Gaps can aid in finding those bad addresses. With that, I'm going to scroll back up and uncheck Show Advanced Properties, and then we can click Create New Device. We start off with a disconnected status, and then it'll switch over to connected. Now that we have 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.

You are editing this transcript.

Make any corrections to improve this transcript. We'll review any changes before posting them.