Introduction to ControlLogix Messaging
ControlLogix messaging is used to send or receive information to another processor. In this post, we will receive data from a tag in another ControlLogix processor. Messaging can be used to send or receive information from an SLC-500 or PLC-5 as well. I always recommend reading values from another processor (vs writing). The reason for this is for troubleshooting. If a troubleshooter is tracing through logic, and values are being dumped into the processor, it’s hard to trace where the data is coming from. If the processor is going out to get the data, the troubleshooter will find the MSG instruction when doing a cross-reference.
Another way to transfer data between processors is with the producer/consumer model. The producer/consumer model is scheduled. This means that it updates at regular intervals. Also, it is more efficient with using multi-cast communication when communicating with more than one processor.
The MSG instruction is still used, though when sending or receiving data from older processors. Also, if we only need to gather data one time per day, we would use the MSG instruction. Producer/Consumer update intervals are a maximum of 750ms. Another advantage of the message instruction is that no I/O Configuration is required to make it work. We will specify a path to our target processor without the target processor being in our I/O Configuration tree.
Here is our goal: We will read the target’s “Outbox” tag into our “Inbox” tag.
Configuring the Target Processor
No configuration is required for the target processor (where the “Outbox” tag resides). All we need is a tag that we can read data from (or send data to). For this example, we need a tag in the target processor named “Outbox”. Go to the controller tag database, and in “Edit Tags”, create the Outbox tag as a DINT. I’m also going to place a random value into the outbox tag (in “Monitor Tags” mode), and download the project to the target processor. The target processor is the lower processor in the diagram above. Do not mark it as produced. It’s just a standard DINT that we will be reading a value from. Remember that when you download, your processor will stop executing it’s program! If you are working with a running system, the tag can be created while you are online without the need to download.
Setting up the Initiating Processor
The initiating processor is the processor on the top of the diagram above. Here, we’ll be working with the project of the Initiating processor which will contain the MSG instruction that is getting the data.
Before we start, let’s create some tags that we will need for this example. Open the controller tag database, and in “Edit Tags” mode, add the following tags. Please pay attention to the data types when you add these tags:
The Inbox is the tag that we will place data into that we get from the target’s Outbox. The MessageTimer will be used in logic to give the message instruction a pulse at regular intervals. MessageControl is the “workspace” for the message instruction. This tag will store the status of the data transfer.
Now, let’s write the logic:
Step 1: Add a self-running timer for ControlLogix Messaging
A self-running timer is a timer that resets itself at regular intervals. I will add this logic to the MainRoutine:
This timer will set it’s DN bit when the accumulator reaches 40ms. When the DN bit is set, the timer resets.
Step 2: Add the MSG instruction
Add the MSG instruction as follows:
You will notice the Enable (EN) bit, the Done (DN) bit, and the Error (ER) bits to the right. The purpose of the MessageControl tag is to store the status of these bits, as well as other information about the MSG instruction.
Step 3: Set up the message instruction
Click the “Setup” button within the message instruction. This will bring up the configuration screen.
Set up the MSG instruction as follows: We will do a CIP data table read. The source element is “Outbox”. This is the tag in the target processor that we are receiving data from. The destination tag is “Inbox” This is where we place the data we receive from the target’s Outbox tag. When finished, click the “Communication” tab of the setup screen.
Configure the path for ControlLogix Messaging
This is the most difficult part of messaging. If the target processor is already in your I/O configuration tree, you could just browse for the processor. In our case, we cannot browse for the processor because it is not in our I/O configuration tree. We will build the path manually.
The problem with placing the target processor in the I/O tree is that communication is constantly on-going to check the health of the modules along the path. Therefore it’s generally more efficient to build the path manually. Once you are used to how the path works, it’s very easy to understand.
Look at our path for the Message Instruction:
Now look at this diagram to develop our path
When we build the path, we MUST go from Step A to Step B, then repeat the process until we are at the target.
- From the Initiating L71 processor, look at Step “A”. We must specify “1” to get to the backplane.
- Now that we are on the backplane, look at Step “B”. We specify “3” because that is the Slot # of our ENBT module.
- We are on the ENBT module now, and back on Step “A”, so we specify “2” to come out the front port.
- Back on Step “B”, we will be going into the ENBT on the target chassis, so specify the IP of the target module, “192.168.0.6”
- Now that we are on the ENBT module, back on Step “A”, specify “1” to get to the backplane.
- To enter the processor from the backplane (Step “B”), specify “0” for the processor slot #.
The path will be “1, 3, 2, 192.168.0.6, 1, 0” Go through those steps a few more times until you are comfortable and understand how we got this path. Each of the green arrows represent a step in building the path to the target processor.
Now let’s enter this path into our MSG Instruction.
Test your work for ControlLogix Messaging
Next, I’ll download to the processor, then we’ll verify the Inbox tag of the Initiating processor matches the Outbox tag of the target processor.
Hint: to transfer larger amounts of data, you could use an Array. Instead of a single DINT for the inbox and outbox, we could use DINT as the data type, and change our number of elements to 10 on the “Configuration” tab of the MSG instruction.
Check out this link if you are interested in learning how to message over DH+ to the older processors. Another resource to check out is DF1 Messaging. Additionally, you can check out the post on SLC-500 Messaging. On the other hand, if your SLC-500 needs to initiate a message to the ControlLogix, I have a post for that as well. Lastly, I’ve done a speed test on the message response time.
For more information, visit the ControlLogix post page!
— Ricky Bryce