TO TRANSFORM THE WAY STUDENTS READ
6.12 Writing a Ladder Logic Program
In most cases, it is possible to prepare a ladder logic program directly from the narrative description of a control process.
Some of the steps in planning a program are as follows:
• Define the process to be controlled.
• Draw a sketch of the process, including all sensors and manual controls needed to carry out the control sequence.
I:3/0
B3:1/0
I:3/1 B3:1/0
I:3/2
B3:1/0
I:3/1 O:2/2
O:2/2 Ladder logic program
Start
L1 L2
Inputs Stop Internal Output
relay
Jog Jog
Stop M
I:3/2 Start
Stop I:3/0
I:3/1
M OL
Figure 6-69 PLC program equivalent of the hardwired relay jog circuit.
Figure 6-70 shows the sketch of a drilling process that requires the drill press to turn on only if there is a part present and the operator has one hand on each of the start switches. This precaution will ensure that the opera- tor’s hands are not in the way of the drill.
The sequence of operation requires that switches 1 and 2 and the part sensor all be activated to make the drill motor operate. Figure 6-71 shows the ladder logic program required for the process implemented using an SLC 500 controller.
E X A M P L E 6 - 1
L1 Inputs
I:3/5 Sensor
I:3/6 I:3/4
Ladder logic program
Motor contactor
PB1 PB2 Sensor
Motor contactor PB1
PB2
I:3/4 I:3/5 I:3/6 O:4/0
O:4/0 Output L2
M
Figure 6-71 Drilling process PLC program.
Drill PB1 motor
Switches PB2
Part sensor
Figure 6-70 Sketch of the drilling process.
A motorized overhead garage door is to be operated au- tomatically to preset open and closed positions. The field devices include one of each of the following:
• Reversing motor contactor for the up and down directions.
• Normally open down limit switch to sense when the door is fully closed.
• Normally open-held closed up limit switch to sense when the door is fully opened.
• Normally open door up button for the up direction.
• Normally open door down button for the down direction.
• Normally closed door stop button for stopping the door.
• Red door ajar light to signal when the door is partially open.
• Green door open light to signal when the door is fully open.
• Yellow door closed light to signal when the door is fully closed.
The sequence of operation requires that:
• When the up button is pushed, the up motor contac- tor energizes and the door travels upward until the up limit switch is actuated.
• When the down button is pushed, the down motor contactor energizes and the door travels down until the down limit switch is actuated.
• When the stop button is pushed, the motor stops.
The motor must be stopped before it can change direction.
Figure 6-72 shows the ladder logic program required for the operation implemented using an SLC 500 controller.
E X A M P L E 6 - 2
Figure 6-72 Motorized overhead garage door PLC program.
L1
Input devices (shown in unactuated
condition)
Output devices
Up limit
L2
Door up
I:3/0 I:3/7
Program
O:4/3 O:4/0
Door ajar
Door down
Stop door
I:3/4 I:3/5
Down limit I:3/1
I:3/4
I:3/5
I:3/7
O:4/4 I:3/0
Stop Up Motor up
I:3/0 I:3/1 O:4/0
Up limit Down limit Door ajar
I:3/0 O:4/1
Up limit Door open
O:4/3 Motor up
Down Down
Intrlock Up limit
O:4/4
I:3/1 O:4/2
Down limit Door closed
Motor down
O:4/4 Motor down
I:3/7 I:3/5 I:3/4 O:4/3 I:3/1
Stop Down Up Up
intrlock Down limit
O:4/1
Door open
O:4/2 Door closed
O:4/3 Motor contactor
O:4/4 Motor contactor
R
G
Y
UP
DN
Figure 6-73 shows the sketch of a continuous filling opera- tion. This process requires that boxes moving on a con- veyor be automatically positioned and filled.
The sequence of operation for the continuous filling operation is as follows:
• Start the conveyor when the start button is momen- tarily pressed.
• Stop the conveyor when the stop button is momen- tarily pressed.
• Energize the run status light when the process is operating.
• Energize the standby status light when the process is stopped.
• Stop the conveyor when the right edge of the box is first sensed by the photosensor.
• With the box in position and the conveyor stopped, open the solenoid valve and allow the box to fill. Filling should stop when the level sensor goes true.
• Energize the full light when the box is full. The full light should remain energized until the box is moved clear of the photosensor.
Figure 6-74 shows the ladder logic program required for the operation.
E X A M P L E 6 - 3
Figure 6-73 Sketch of the continuous filling operation.
Run
Standby
PL PL
Level Full switch
Photo switch Motor
Start Solenoid
Hopper
Stop
PL
L1 Stop
Start
Photo
L2
Level
Stop Start
Run
Ladder logic program
Run
Run Standby
Outputs Inputs
Motor
Solenoid
Run
Standby
Full Level Photo
Full
Full
Photo Run
Level Photo
Motor
Run Full Solenoid
Full
Figure 6-74 Continuous filling operation PLC program.