Logix Programming Instructions Every Tech Needs to Know Part II
In part one of this series, we looked at an introduction to learning Studio 5000 programming instructions for ControlLogix processors as well as an application for using the CPT and ABS instructions.
I want to continue further and explore a few more instructions and hopefully provide a few tips along the way.
BTD (Bit Field Distribute)
The BTD instruction is a powerful instruction as it can allow you to map a word to another word and shift the bits in that word if needed.
As you will see in the illustration below, after a conversion to ControlLogix, when mapping 1771 I/O, the PLC-5 used octal addressing, so after bit 7, a BTD instruction is needed to shift the next bit to bit 10.
- In the first instruction, the 1771 I/O module data is moved from the source bit of 0 to the destination of input array I_113, bit 0 as well and we map 8 bits as the length.
- In the second instruction, bits 8 and 9 of the input array I_113 will not be used to keep in line with the octal addressing, so we start with the source bit of 8 and move it to the destination bit of 10 instead, still with a length of 8 bits (10-17). This is done to align the inputs read from ControlLogix to the arrays created by the conversion from PLC-5.
In a second use of the BTD instruction, it can be used for mapping DeviceNet data from a drive to another tag in the PLC such as a motor speed.
- In this instance below, the DeviceNet I/O mapping was set up so that the last 16 bits of this word was the drive’s feedback speed. The source bit of the instruction thus starts with bit 16 and moves it to the destination bit of 0 in the drive speed tag with a length of 16. We didn’t need but 16 bits of this 32 bit word from DeviceNet and this single instruction splits it apart and maps if for us perfectly.
MSG (Message Instruction)
Another instruction that will come in handy is the message instruction. This will allow your PLC to communicate with other PLCs over different network types as well as different PLCs in the Rockwell family.
For instance, the MSG instruction can take a communication path over backplanes and make hops if needed. It also allows a ControlLogix processor to message a MicroLogix or CompactLogix processor or other types as well.
- The MSG instruction only executes once when a rung is active, so you will need to add a timer as shown here to execute the instruction. This also allows you to execute as often or as little as needed. The tag MSG_TO_OTHER_PLC is a “Message” data type.
- Inside the MSG instruction, you will have several options including the message type. Here we can use CIP data read or write to MSG another ControlLogix. In other applications, such as communication with a MicroLogix, you can use a SLC data-type read or write.
- The Source Element is the array in this controller that we wish to write to the other PLC and the Number of Elements is how many values to write after this source. Here we will write 64 real numbers from this array.
- The Destination Element is the array in the other PLC that we wish to write the 64 real numbers to
- In the communication tab of the MSG instruction, you will browse the path between this PLC processor and the one that you wish to read from or in this case write to.
Editors Note: For more articles and videos covering the Message Instruction, check out our previous coverage here.
Whatever step of your journey, as a control system engineer, that you are currently in, hopefully you were able to pick up something here or reminisce about your own experiences with these instructions.
I know every time I see a BTD instruction, it reminds me of my first job doing a mill startup where I literally set up several hundred DeviceNet devices and how, someone that cared, taught me how to do it.
Written by Brandon Cooper
Senior Controls Engineer and Freelance Writer
Have a question? Join our community of pros to take part in the discussion! You'll also find all of our automation courses at TheAutomationSchool.com.
Sponsor and Advertise: Get your product or service in front of our 75K followers while also supporting independent automation journalism by sponsoring or advertising with us! Learn more in our Media Guide here, or contact us using this form.
- How To Download and Install the Latest Rockwell Patch Rollup (2022) - August 4, 2022
- How To Resolve .Net Framework 3.5 Installation Error 0x80D05001 - July 26, 2022
- What's New in Studio 5000 Logix Designer v34 - May 9, 2022