[Logix] Trying to understand MSG vs Produce/Consume communications

defcon.klaxon

Lifetime Supporting Member
Join Date
Feb 2015
Location
Far NorCal
Posts
616
Hey guys,

So I've got my AB PLCs up and running, and now I'm trying to work out how to pass information between them. I've been reading about MSG vs produce/consume tags, but still have some questions about how I should set up my project and how these Logix PLCs work. In this project we're using a mix of ControlLogix and CompactLogix PLCs, though at the moment I only have ControlLogix spares at my desk.

We have several remote sites so we will poll them one at a time; I should mention here that we're using Ethernet/IP modules (1756-ENBT) and the remote sites will go through an Ethernet/IP radio (Xetawave 4x4E that I believe act as a router for all intents and purposes). Because we want to control the polling, I believe that requires me to use the MSG instruction since produce/consume tags seem to communicate automatically and there isn't a way to "schedule" reads/writes, is that correct? But when I read about MSG, according to this literature from Rockwell (page 13), MSG instructions can only access Controller Tags:
http://literature.rockwellautomation.com/idc/groups/literature/documents/pm/1756-pm012_-en-p.pdf
So doesn't that really limit what I can send with MSG? Aren't controller tags just whatever I/O modules you have in the backplane? What if I want to do some scaling to 4-20mA inputs before sending the data, or I'm making decisions/alarm statuses that I need to communicate? EDIT: So I figured out I can create tags in the Controller Tags section, but if I'm writing ladder logic and want to define a tag there, it's Local Tags only. So that's annoying, but at least I can apparently create tags there and send them via MSG.

I'm also trying to figure out how to send boolean values; I've seen mentions of creating UDTs to do this, but I'm somewhat confused; all of my PLC experience has been simply addressing registers when passing values, and the way Logix does it seems much more convoluted.

I guess a large part of my confusion comes from the fact that we're using Ethernet/IP connectivity and all the tutorials I've found focus on easy connections all on a local network. That seems pretty easily understood, but when I then add in the discrete polling of remote sites it seems much more complicated. Any help you guys can provided is as always very appreciated.
 
Last edited:
Aren't controller tags just whatever I/O modules you have in the backplane?
Controller tags are most definitely NOT just the I/O. CompactLogix and ControlLogix are all tag based - all Booleans, DINT's, heck timers, counters - everything is tag based.
 
You can definitely create tags in both the Controller and any of the Program scope databases.

The simple way is to open a Tag Database window, either the Controller one or any of the Program scope ones.

Sometimes you're creating tags in context by typing in a new tagname and allowing the software to prompt you to create it. You can definitely select either a Program or a Controller scope for that tag.

The MSG instruction only allows you to read and write tags that are part of the Controller scope database. It's just simpler.

BOOL tags can't be the source or target of a MSG or of a Produced/Consumed tag connection because it would be wasteful and inefficient, and A-B decided that instead of arguing with people about why they'd reached a resource limit by wasting resources sending BOOLs, they would simply not allow them to be used.

I always just select a bit inside a DINT when I need to send a true/false value and nothing else.
 
You can definitely create tags in both the Controller and any of the Program scope databases.

The simple way is to open a Tag Database window, either the Controller one or any of the Program scope ones.

Sometimes you're creating tags in context by typing in a new tagname and allowing the software to prompt you to create it. You can definitely select either a Program or a Controller scope for that tag.

Yeah I see what you mean. Apparently I need to change the "scope" of the tag I'm creating, and trying that was successful.

The MSG instruction only allows you to read and write tags that are part of the Controller scope database. It's just simpler.

Gotcha. Now I get the gist, it seems akin to global vs local variables in C++ and if your local tags are separate, my guess is that copying and pasting is much simpler.

BOOL tags can't be the source or target of a MSG or of a Produced/Consumed tag connection because it would be wasteful and inefficient, and A-B decided that instead of arguing with people about why they'd reached a resource limit by wasting resources sending BOOLs, they would simply not allow them to be used.

Thanks for the explanation.

I always just select a bit inside a DINT when I need to send a true/false value and nothing else.

Sounds like a good way to do it; do you have to convert the booleans you want to send into DINTs with add'l ladder logic? Would you package multiple boolean bits into a single DINT and then break it out on the receiving end?
 
Sounds like a good way to do it; do you have to convert the booleans you want to send into DINTs with add'l ladder logic? Would you package multiple boolean bits into a single DINT and then break it out on the receiving end?


It's more efficient to simply create a DINT array to use for bit references within your program, rather than creating individual BOOLs.

Each BOOL that you create consumes 32 bits of memory anyway.
 
"Because we want to control the polling, I believe that requires me to use the MSG instruction since produce/consume tags seem to communicate automatically and there isn't a way to "schedule" reads/writes, is that correct?"

Actually, when you set up the connection properties for a produced/consumed tag, you can specify the polling rate (RPI). So you are not limited to MSG instructions in this regard.
 
One important advantage of using the MSG instruction is the capability to modify messaging in online mode. You may also write logic to trigger data transfers only on exception, rather than unconditionally.
 
One important advantage of using the MSG instruction is the capability to modify messaging in online mode. You may also write logic to trigger data transfers only on exception, rather than unconditionally.

This is a great point. Using a MSG also does not count towards the limitation on active connections. Produce/Consume connections have quantity limitations. The only limitation on the quantity of MSG instructions is the messaging buffer.
 
[...] convert the booleans you want to send into DINTs with add'l ladder logic? Would you package multiple boolean bits into a single DINT and then break it out on the receiving end?

Exactly.

A typical command set for a pump drive would be something like:

CommandWord.0 Start
CommandWord.1 Stop
CommandWord.2 Reset Faults
CommandWord.3 Speed Select 1
CommandWord.4 Speed Select 2
(and so on)

All those bits get sent in a message, packed into CommandWord. Maybe I even copy CommandWord into an array like "Station1Outputs[x]" and send that whole array.

And on the other end, you just unpack them with simple sets of XIC/OTE rungs. Clarity counts for a lot... brute force logic to encode things might look inelegant, but when it has to be troubleshot a decade later it's wonderful.
 
"Because we want to control the polling, I believe that requires me to use the MSG instruction since produce/consume tags seem to communicate automatically and there isn't a way to "schedule" reads/writes, is that correct?"

Actually, when you set up the connection properties for a produced/consumed tag, you can specify the polling rate (RPI). So you are not limited to MSG instructions in this regard.

Yes you can adjust the RPI, but can you control the polling process from site to site? It seemed to me that RPI can adjust how fast the cycle is, but doesn't control each step. The customer wants to be able to take a site out of the radio loop entirely (seasonal wells for example, or maintenance of wastewater lift stations) and also wants to be able to "fast poll" a site where the radio link stops at a certain site for a temporary period and only focuses there (like if a lift station was close to overflowing, they want to not have to wait for the whole polling cycle to get an update on the level). Our radios are estimated to be about 20kbps bandwidth so I believe the idea was that we would rather poll each site separately instead of waiting for the data to trickle in and having the radio deal with the incoming connections.
 
Exactly.

A typical command set for a pump drive would be something like:

CommandWord.0 Start
CommandWord.1 Stop
CommandWord.2 Reset Faults
CommandWord.3 Speed Select 1
CommandWord.4 Speed Select 2
(and so on)

All those bits get sent in a message, packed into CommandWord. Maybe I even copy CommandWord into an array like "Station1Outputs[x]" and send that whole array.

And on the other end, you just unpack them with simple sets of XIC/OTE rungs. Clarity counts for a lot... brute force logic to encode things might look inelegant, but when it has to be troubleshot a decade later it's wonderful.

OK, thanks for describing this!
 
OK, I have been able to get the MSG command to pass data from one PLC to another, so I've been able to figure out the basic MSG functionality.

But what if I have a lot of data to pass back and forth? Do I have to create a MSG block for each tag, or can I do it in batches? I did mess around with creating arrays and passing multiple values, so I understand that functionality. But if I don't want to create a MSG for each individual tag, do I have to wrap them up into an array? And then manually alias every tag into the array? I sure hope I'm missing something here because I'm not seeing any easy way to do this.
 
[If] I don't want to create a MSG for each individual tag, do I have to wrap them up into an array?

Yes.

I suppose that an "easy way" would be to have an MSG where you create a little table of tags you want to transmit, and then export that table to the project that's receiving them. Logix doesn't have that sort of function.

But it's not a whole lot harder to just write a subroutine that copies tag values into each element of an array of DINTs and an array of REALs.

I do this all the time when I'm sending a variety of data through a low-bandwidth link like a radio. There's a routine called 'PACK_Data' and another one called 'UNPACK_Data'. I trigger them just once prior to and immediately after the MSG instruction handshaking.
 
Yes.

I suppose that an "easy way" would be to have an MSG where you create a little table of tags you want to transmit, and then export that table to the project that's receiving them. Logix doesn't have that sort of function.

That's what I would expect, yeah.

But it's not a whole lot harder to just write a subroutine that copies tag values into each element of an array of DINTs and an array of REALs.

I do this all the time when I'm sending a variety of data through a low-bandwidth link like a radio. There's a routine called 'PACK_Data' and another one called 'UNPACK_Data'. I trigger them just once prior to and immediately after the MSG instruction handshaking.

I am assuming you are naming your subroutine PACK_Data and UNPACK_Data and that those aren't functions native to Logix, right? As in, I need to create those rather than grabbing them as a Functional Block.
 
Last edited:

Similar Topics

I am trying to understand an Italian CompactLogix program. It is for a dough laminator . The block looks like ....., Linearization X1. -500...
Replies
22
Views
5,859
Hi all, I'm starting work on a system and the processor for said project is a Control Logix 1756-L82. When I open Logix, however, that CPU is...
Replies
9
Views
2,897
Does anyone have experience communicating with the MAGPOWR Cygus Tension Controller thru Ethernet. I have a Controllogix 1756-L73 PLC Version 30...
Replies
25
Views
4,026
Hey everyone, I have a Keyence LK-G5001P control module with 2 laser heads connected to it (the lasers are Keyence LK-H152). I have the control...
Replies
3
Views
2,131
Good Morning , I received a used 1756-L62 / A CPU , from a vendor that was using it for a trainer. I tried to download a program that is...
Replies
4
Views
1,455
Back
Top Bottom