In my last article, I went through the necessary steps to read and write data to and from tags in a ControlLogix via a program in a Siemens S7 PLC.
In today’s article I’ll go a step further and implement the communication into an application as it could be used in a real life scenario.
Logic in the ControlLogix processor
As I stated in the previous article, I am simulating that the ControlLogix Processor is controlling a garage door unit. I have code written in the ControlLogix processor and simulation that the up and down limit switches make so many seconds after the direction commands are submitted.
The limit switches are written to the “DINT.0” and “DINT.1” tags. The commands to open and close the doors are coming from the S7 1200 “DINT2.0” and “DINT2.1”.
S7 1200 Data Mapping
I wanted to be able to take the “DINT” tag and split it into 32 bits. I created a data block called “Logix_ReadArray” and created an array of 32 BOOL tags.
I was then able to bring in the DINT tag from ControlLogix and use the “SCATTER” instruction to map it to the 32 bit array (data block) that I created in the previous step.
After this, the individual bits are accessible as BOOL data types.
As for the commands back to the ControlLogix processor, I created a 32 bit “Write_Array” as well.
As the opposite of the “SCATTER” block, I was able to use the “GATHER” block to collect the 32 bits that will write to the ControlLogix processor and put them in the “DINT2” DWORD.
HMI Controls – Basic HMI is connected to the S7 1200 – S7 1200 communicates with ControlLogix
Here I set the Up and Down Limit Switches to turn green when active and black when not active. I created two buttons with set bits and reset bits for up and down commands.
What are garage door controls without some animation? I created simulation timers for the garage door that will allow me to implement “Vertical Movement” properties into my garage door and make it open and close.
Garage Door Up
Garage Door Down
Once I was able to get the LCCF_CIPClient function block working and had the peer to peer communication established, then I had to decide what to do with the data.
I found the “SCATTER” and “GATHER” blocks to be very helpful and I am learning that any time I deal with arrays, I must create data blocks for them.
Mapping the data and keeping it from getting unorganized is very important, especially in a large project with many tags going back and forth.
Comments and descriptions are definitely worth the time and effort. I hope this series has been of help to you if you are looking to make your S7 “talk” with a ControlLogix controller.
Written by Brandon Cooper
Senior Controls Engineer and Freelance Writer
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.
- Rockwell Patch Rollup – How To Download and Install (2022) - August 4, 2022
- Studio 5000 – Resolve .Net Framework 3.5 Installation Error 0x80D05001 - July 26, 2022
- Studio 5000 – v34: What’s New - May 9, 2022