Introduction to ControlLogix Three-Way Switching
Standard three-way switches are wired to control a light from two different locations. In this post, we will write a simple program to control lights from many locations. We will also set up the ControlLogix three-way switching to end up in the correct position. In other words, if a switch is up at any location, you must move it to the down position to turn the light off. For example: Assume that a switch is down, and a light is on. In this case, you must move the switch up, and then back down to shut off the light. This will ensure the switch ends up in the correct position to reflect the state of the light. Using this method, it’s possible to add as many different switch locations as you will ever need.
Set up the I/O and Create Tags
First add the I/O Modules to the Controller Organizer window.
Next, set up the aliases to make our programming a bit easier. We need to add a tag for some oneshots as well. Another tag we will add is an EvenFlag, which is BOOL.
Write the Logic
Finally, we will write the logic. I will explain each line of code as we go.
At first, if any switch goes from false to true, we will set the event flag. Notice we are using the OneShots as to not hold the flag ON. As can be seen, other switches may be added by adding additional branch legs.
Secondly, we need a way to shut the EventFlag OFF. If any switch drops out, unlatch the event flag. As before, we do not want to hold this flag off, so we need the ONS instructions. Once again, if you have other switches, add them to addition branch legs.
Lastly, we will move the status of the EventFlag tag onto the real world output. Although you could use the real world output instead of the EventFlag, I like to have this additional step. This allows more flexibility for future expansion of the program such as other interlocks or time delays.
Using this same methodology, you can use this logic on the PLC-5 or SLC-500 as well.
For more information, visit the ControlLogix Category Page!
— Ricky Bryce