In part 1 we looked at writing PLC programs to control a traffic light using discrete bits and then using timed sequencing using indirect addressing. Part 2 used indirect addressing for inputs as well as output to control the sequence of pneumatic (air) cylinders in the program. Part 3 returned to the traffic light application and expand our program significantly. We looked at the sequence of operations using Input, output, and mask tables. Part 4 will now continue with the programming of the logic in the PLC.
Let’s look at the sequence that we are controlling – Building a PLC Program – Traffic Light
Note that I have color-coded the outputs that will be on in the sequence. This makes it easier to read how the lights will behave. All bits without ‘1’ are assumed to be ‘0’. The pedestrian walk signals flash before they change to walk signals.
The weekend sequence looks like this. We have an overlap of the red signal lights. The arrows are not used.
It is important to note that the sequencing and information contained in these charts must be understood fully before programming can begin. Take the time to review and understand the following tables. Here is a copy of the excel table complete with the inputs, mask, and outputs.
Advantages of Sequencers – Building a PLC Program – Traffic Light
This method of programming can have a vast number of applications. Here are some of the advantages of using this method:
- Modification of the program without extensive rewriting
- Integration with a Human Machine Interface (HMI) to control, modify and/or troubleshoot
- Ability to sequence forward and backward
- Easily understood the logic to follow. Looking at the pointers can the on compare instruction will quickly tell you what sensor is not being made.
Troubleshooting this method of programming is easily done. Compare the bits in the input pointed word to the actual bits form the input in binary format. The difference is the input/output that is not working.
The program is basically broken down into three sections:
- Inputs – Setting bits in the input channel based upon actual and internal conditions.
- Control – Control of the pointers, mask and setting the output channel.
- Outputs – Using the output channel to activate the actual and internal actions required.
Inputs – Building a PLC Program – Traffic Light
Control – Building a PLC Program – Traffic Light
This section of the control will tell the PLC what to do when the unit is first powered on. It resets the pointers and moves the initial output setting to the output word. You will see that since we have three different sequences running, there are three different reset rungs in parallel. The table input pointer is compared to the last value +1 of the sequence running.
Outputs – Building a PLC Program – Traffic Light
The actual outputs are set using the output word bits. You will note that the flashing green lights are done when both green outputs are not on. This way will give me the greatest flexibility when developing different sequences. The ‘do not walk signal’ is not part of the sequence but is controlled when the flashing walk or walk is not on.
The program will not change much for completely different sequences.
This program and the data tables can be downloaded here. Note that in order to run this program you must call up the input, mask, and output tables and write them to the simulator or PLC.
Part 5 will make a Game of Simon by learning all about bit manipulation and sequencers.
If you have any questions or need further information please contact me.
If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLCs are not difficult to learn and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimal, Hexadecimal, ASCII, and Floating Point.
To get this free article, subscribe to my free email newsletter.
Use the information to inform other people how numbering systems work. Sign up now.
The ‘Robust Data Logging for Free’ eBook is also available as a free download. The link is included when you subscribe to ACC Automation.