LADDER PROGRAMMING
LADDER PROGRAMMING
There are many control situations requiring actions to be initiated when a certain combination of conditions is
realised. Thus, for an automatic drilling machine (as illustrated in Figure 15, there might be the condition that the
drill motor is to be activated when the limit switches are activated that indicate the presence of the workpiece and
the drill position as being at the surface of the workpiece. Such a situation involves the AND logic function,
condition A and condition B having both to be realised for an output to occur. This section is a consideration of
such logic functions.
An example of an AND gate is an interlock control system for a machine tool so that it can only be operated
when the safety guard is in position and the power switched on. Figure 5.8(a) shows an AND gate system on a
ladder diagram. The ladder diagram starts with | |, a normally open set of contacts labelled input A, to represent
switch A and in series with it | |, another normally open set of contacts labelled input B, to represent switch B.
The line then terminates with O to represent the output. For there to be an output, both input A and input B
have to occur, i.e. input A and input B contacts have to be closed (Figure 5.8(b)). In general:
On a ladder diagram contacts in a horizontal rung, i.e., contacts in series, represent the logical AND
operations.
Figure 5.10(a) shows an OR logic gate system on a ladder diagram, Figure 5.10(b) showing an equivalent
alternative way of drawing the same diagram. The ladder diagram starts with | |, normally open contacts
labelled input A, to represent switch A and in parallel with it | |, normally open contacts labelled input B, to
represent switch B. Either input A or input B have to be closed for the output to be energised (Figure 5.10(c)).
The line then terminates with O to represent the output. In general:
Alternative paths provided by vertical paths from the main rung of a ladder diagram, i.e. paths in parallel,
represent logical OR operations.
3) NOT
Figure 5.11(a) shows an electrical circuit controlled by a switch that is normally closed. When there is an input
to the switch, it opens and there is then no current in the circuit. This illustrates a NOT gate in that there is an
output when there is no input and no output when there is an input (Figure 5.11(c)). The gate is sometimes
referred to as an inverter. The truth table is:
Figure 5.11 (a) NOT circuit, (b) NOT logic with a ladder rung, (c) high output when no input to A
4) NAND
Suppose we follow an AND gate with a NOT gate (Figure 5.12(a)). The consequence of having the NOT gate is
to invert all the outputs from the AND gate. An alternative, which gives exactly the same results, is to put a
NOT gate on each input and then follow that with OR (Figure 5.12(b)). The same truth table occurs, namely:
Figure 4.18 shows a ladder diagram which gives a NAND gate. When the inputs to input A and input B are
both 0 then the output is 1. When the inputs to input A and input B are both 1, or one is 0 and the other 1, then
the output is 0.
An example of a NAND gate control system is a warning light that comes on if, with a machine tool, the safety
guard switch has not been activated and the limit switch signalling the presence of the workpiece has not been
activated.
5) NOR
Suppose we follow an OR gate by a NOT gate (Figure 5.14(a)). The consequence of having the NOT gate is to
invert the outputs of the OR gate. An alternative, which gives exactly the same results, is to put a NOT gate on
each input and then an AND gate for the resulting inverted inputs (Figure 5.14(b)). The following is the
resulting truth table:
The combination of OR and NOT gates is termed a NOR gate. There is an output when neither input A or input
B is 1.
Figure 5.15 shows a ladder diagram of a NOR system. When input A and input B are both not activated, there
is a 1 output. When either X400 or X401 are 1 there is a 0 output.
6) Exclusive OR (XOR)
Figure 5.17 shows a ladder diagram for an XOR gate system. When input A and input B are not activated then
there is 0 output. When just input A is activated, then the upper branch results in the output being 1.
When just input B is activated, then the lower branch results in the output being 1. When both input A and input
B are activated, there is no output.
In this example of a logic gate, input A and input B have two sets of contacts in the circuits, one set being
normally open and the other normally closed. With PLC programming, each input may have as many sets of
contacts as necessary.