[00:00]
Since the Modbus protocol doesn't support browsing, we can manually create OPC tags from our Modbus device connections. To see how this process works, we'll start in the designer and go to our tag browser. Let's create a new OPC tag from scratch. I'll click on the plus sign, select new standard tag, and then OPC tag to open our tag editor window. I'll change the name of our new OPC tag to HR1. With this tag, I'm going to try to retrieve the first holding register within my device connection. To do this, we'll need to set the OPC server for the tag. I'll select our Ignition OPC UA server from the dropdown. Then we need to figure out what to set as the OPC item path. My device connection name is Modbus, so I'm going to begin the OPC item path with that device name in square brackets. Starting with the device name in brackets is a typical pattern with Ignition drivers.
[01:04]
Next, we need to reflect the fact that the holding registers for the Modbus protocol are in the 40,000 range. Assuming one-based addressing, I need to access the address at 40,001. To specify that address, you don't have to type out 40,001. Instead, you can use the HR designator, referencing the holding registers table. So, putting the HR shortcut in the OPC Item Path starts you with a 40,000 address, and then we just need to add a one to reach that first address. Let's test it. I'll click ok, and after a moment to connect, you can see that the HR1 tag now has good quality in the tag browser. I'll set that tag value manually. I also have a few other Modbus-related OPC tags pre-configured here. I'll double-click on this HR1_Bit0 tag, and we can see an example of how the Modbus driver can handle bit-level addressing. From the item path, I can specify individual bits that I want to retrieve.
[02:08]
This tag uses a very similar path to our HR1 tag, but I added this .0 so it will read and write to the first bit of the holding register. Your Modbus device must support the Mask Write command for this to work, and your device documentation should specify if it has that capability. Next, let's take a look at this BCD Value tag. Some devices that utilize the Modbus protocol store data in a BCD format. As a result, we have some designators for those situations. Here, you can see I have a holding register with a 16-bit BCD conversion, and it's starting at the fourth address. Next, we'll take a look at this Consecutive HR tag. This OPC item path contains an HRF designator. This represents two consecutive holding registers with a a float conversion at the sixth address. There are many ways to accommodate other data encoding commonly used by Modbus-supported devices.
[03:08]
For a full listing and description of each available designator, please check out the link to the Ignition User Manual article about Modbus Addressing below this video.