Obsidean_VM/01-Documentation/AllenBradley Rockwell/PLC/Configuring the MSG Instruc...

48 lines
6.4 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

https://www.solisplc.com/tutorials/plc-programming-msg-instruction-send-data-between-micrologix-compactlogix-plcs-studio-5000-tutorial
# PLC Programming MSG Instruction - Send Data Between MicroLogix & CompactLogix PLCs Studio 5000 Tutorial
### Introduction
Sending data between two Programmable Logic Controllers can pose a challenge. However, in the current manufacturing environments, its an absolute must. **_One of the simplest ways to pass data between two controllers would be through the use of the MSG instruction_**. This instruction would be utilized within the RSLogix 5000 or Studio 5000 programming environments on an Allen Bradley PLC and Write or Read data from a different PLC.
For the purpose of this tutorial, **_we will be covering the communication between a MicroLogix 1100 PLC and a CompactLogix L24ER PLC_**. Both of these are heavily utilized in the current manufacturing environments and provide an excellent testing platform. Furthermore, the same instruction would work between any RSLogix/Studio 5000 and RSLogix 500 based Programmable Logic Controllers.
## MSG Instruction Programming in Ladder Logic Studio 5000
Our first step is to establish a ladder logic structure in order to accommodate the MSG instruction. In order to accomplish this, were going to leverage a simple repetitive timer through a [TON Instruction](https://solisplc.com/plc-programming-intermediate-instructions-ton-timer-on/), paired with an [XIO Instruction](https://solisplc.com/plc-programming-fundamentals-xio-instruction/) based on the completion. This allows us to build a structure which will constantly increment the timer and reset once it reaches the peak. By using a [GRT Instruction](https://solisplc.com/plc-programming-comparison-instructions-grt-greater-than/), we can trigger the MSG Instruction once per cycle of our timer.
Keep in mind that you may increase or decrease the setpoint of the timer in order to execute the MSG more or less frequently. Theres no solid requirement here, but its definitely recommended not to send data too frequently if it isnt critical. Moreover, **if the data is critical, its recommended to use alternative methods, such as Produced/Consumed tags, to get the data across**.
![PLC Programming MSG Instruction - Send Data Between MicroLogix & CompactLogix PLCs Studio 5000 Guide](https://assets-global.website-files.com/63dea6cb95e58cb38bb98cbd/6415da06a3139e1d79d975c1_5e5869dd4172e8aa8d8858f4_Screen-Shot-2019-02-23-at-9.08.29-PM.png)
## Configuring the MSG Instruction
The ladder logic is an excellent start, but were not quite done yet. **_We now need to specify which tags are being read from, which tags are being written to and what the path of the communication between the devices is_**. By clicking the settings of the MSG instruction we access a menu which allows us to do just that. For the purpose of this tutorial, we specify that the instruction will be used as an “SLC Typed Read”, will read from the tag “B12:0” and store the data into a controller based tag “MSG_ML1100_B12_READ”. Do note that these tags are declared as arrays as we do want to make sure that the users can further expand this functionality when its needed.
![PLC Programming MSG Instruction - Send Data Between MicroLogix & CompactLogix PLCs Studio 5000 Tutorial](https://assets-global.website-files.com/63dea6cb95e58cb38bb98cbd/6415da06a3139e8352d975c3_5e5869dde4b5f5b83cc7f7c2_Screen-Shot-2019-02-23-at-9.21.22-PM.png)
![PLC Programming MSG Instruction - Send Data Between MicroLogix & CompactLogix PLCs Studio 5000 Example](https://assets-global.website-files.com/63dea6cb95e58cb38bb98cbd/6415da06a3139e2ac0d975c0_5e5869def68ab83bfda66d6b_Screen-Shot-2019-02-23-at-9.22.45-PM.png)
The second tab of the instruction allows us to **define the path through which the PLC will send & receive packets**. For an EtherNet based system, we need to input the address of the MicroLogix PLC and specify that this communication will be sent over CIP. CIP is an EtherNet based protocol which Allen Bradley utilizes for most of their hardware. The 2 which you see at the start of the path definition calls out the fact that were communicating over the backplane first. In other words, its something you always specify for CompactLogix processors and ControlLogix processors when they go through an ENxT network card.
![PLC Programming MSG Instruction - Send Data Between MicroLogix & CompactLogix PLCs Studio 5000](https://assets-global.website-files.com/63dea6cb95e58cb38bb98cbd/6415da06a3139e87ecd975c2_5e5869de4172e83d668858f5_Screen-Shot-2019-02-23-at-9.29.12-PM.png)
## Testing and Troubleshooting the MSG Instruction
Over the years, Ive seen many reasons for which an MSG Instruction will fail. Just like with anything else, its important to know how o troubleshoot.
**Step 1**  Make sure that the ladder is executing the instruction. This can be easily checked by looking at the .EN bit of the MSG Instruction.
**Step 2**  Make sure that your hardware is on the same network and IP Addresses allow them to communicate. Connect your laptop to the same network & use the “ping x.x.x.x” command to check connectivity to both PLCs.
**Step 3**  Make sure that the tags are in place and are correctly specified on both ends. Verify that the data types match as well. You cant write BOOLs into REALs.
**Step 4**  Verify the configuration of your instruction. You need to make sure that the instruction is set to read/write correctly and that the path is defined exactly as its established in the real world. If the path becomes a problem, you may add the secondary PLC into the I/O Tree of the one doing the messaging.
## Conclusion
The MSG instruction provides an easy way to establish communication between two Allen Bradley PLCs. In the tutorial above, weve demonstrated all the steps required for creating this connection between a MicroLogix 1100 and a CompactLogix L24ER PLCs.
There are a few things you should keep in mind when using MSG instructions. The first one is that this method of sending & receiving data isnt deterministic. In other words, the data transfer speed may be impacted by multiple factors thus making it somewhat unreliable. The second item is the fact that an MSG **instruction is difficult to track**. This comes into play when your control system changes and you now need to go back and redirect all the paths. It is thus advised to program all the MSG instructions within the same routine.