PLC Programming Exercises

By Tony Oldhand

Most automated machinery today is controlled by PLCs
i roller blades image by Umair Mohsin from

Programmable Logic Controllers (PLCs) have revolutionized factory automation systems and robotics. Unlike electromechanical relays, they have no lag time, and one PLC will replace hundreds, if not thousands, of relays. Comparing PLCs to relays is like comparing computers of 2010 to computers in the 1950's. PLCs are complex and learning how to program one is an arduous task. This is compounded by the fact that there is no one standard open source language. Because of these complexities, educational institutions such as the University of Alabama has developed training exercises to learn how to program a PLC. (see reference 1)

Exercise 1

In this exercise, a PLC is programmed to extend a piston (and attached rod) and then retract it on two cylinders. This is the most basic of machine operations such as to feed a part into a press and then retract the part out. The pistons has to extend and retract three times with a 2.2 second delay between the two actions. First, the ladder-rung logic is drawn up (the schematic involved, drawing limit sensors and related components by symbols, commonly called ladder logic). After the ladder logic is drawn, a sequence of events is written (what happens to what component and when). After these two steps, the PLC is programmed, and if the programming is right the pistons will extend and retract three times.

Exercise 2

Only one cylinder is used in this exercise. The PLC is first programed to cycle (extend and retract) a cylinder once with the push of a button. Another advanced step in this exercise is to cycle twice with a single push of a button. Still a more advanced step is to cycle the cylinder three times with a single push of a button. All three steps need to have the ladder logic drawn up and a sequence of events written out.

Exercise 3

This is a complex cycle, involving an entire sequence of operations (the criteria set forth for the machine to function) for three cylinders. First, the automation criteria is read through, involving three cylinders and three timing sequences. From the criteria, a sequence of events is drawn up and ladder logic is developed and the PLC is programmed in. If the programming is correct, the pistons will work according to the written criteria. Since a time delay is stipulated between the cylinders, time delay parameters have to be programmed in.