device, and the scan time of the program. A ladder program is read from left to right and from top to bottom. Thus if an output device, such as an internal relay, is set in one scan cycle and the output has to be fed back to earlier in the program, it will require a second scan of the program before it can be activated. Figure 7.7 illustrates this concept. 7.3 Battery-Backed Relays
If the power supply is cut off from a PLC while it is being used, all the output relays and internal relays will be turned off. Thus when the power is restored, all the contacts associated with those relays will be set differently from when the power was on. Therefore, if the PLC was in the middle of some sequence of control actions, it would resume at a different point in the sequence. To overcome this problem, some internal relays have battery backup so that they
can be used in circuits to ensure a safe shutdown of a plant in the event of a power failure and so enable it to restart in an appropriate manner. Such battery-backed relays retain their state of activation, even when the power supply is off. The relay is said to have been made retentive.The term retentive memory coil is frequently used for such elements. Figure 7.8a shows the IEC 1131-3 standard symbol for such elements. With Mitsubishi PLCs, battery-backed internal relay circuits use M300 to M377 as addresses for such relays. Other manufacturers use different addresses and methods of achieving retentive memory. The Allen-Bradley PLC-5 uses latch and unlatch rungs. If the relay is latched, it remains latched if power is lost and is unlatched when the unlatch relay is activated. (See Section 7.5 for a discussion of such relays in the context of set and reset coils.)As an example of the use of such a relay, Figure 7.8b shows a ladder diagram for a system designed to cope with a power failure. IR 1 is a battery-backed internal relay. When input In 1 contacts close, output IR 1 is energized. This closes the IR 1 contacts, latching so that IR 1 remains on even if input In 1 opens. The result is an output from Out 1. If there is a power failure, IR 1 still remains energized and so the IR 1 contacts remain closed and there is an output from Out 1.
7.4 One-Shot Operation
One of the functions provided by some PLC manufacturers is the ability to program an internal relay so that its contacts are activated for just one cycle, that is, one scan through the ladder program. Hence when operated, the internal relay provides a fixed duration pulse at its contacts. This function is often termed one-shot. Though some PLCs have such a function as part of their programs, such a function can also easily be developed with just two rungs of a ladder program. Figure 7.9 shows such a pair of rungs.
For Figure 7.9a, when the trigger input occurs, it gives a trigger output in rung
1. In rung 2 it gives a cycle control output on an internal relay. Because rung 2 occurs after rung 1, the effect of the cycle control is not felt until the next cycle of the PLC program, when it opens the cycle control contacts in rung 1 and stops the trigger output. The trigger output then remains off, despite there being a trigger input. The trigger output can only occur again when the trigger output is switched off and then switched on again.
Figures 7.9b and 7.9c show the built-in facilities with Allen-Bradley and Mitsubishi PLCs.With the Mitsubishi PLC (Figure 7.9c), the output internal relay—say, M100—is activated when the trigger input—say, X400—contacts close. Under normal circumstances, M100 would remain on for as long as the X400 contacts were closed. However, if M100 has been programmed for pulse operation, M100 only remains on for a fixed period of time—one program cycle. It then goes off, regardless of X400 being on. The programming instructions that would be used are LD X400, PLS M100. The preceding represents pulse operation when the input goes from off to on, that is, is positive-going. If, in Figure 7.9c, the trigger input is made normally closed rather than normally open, the pulse occurs when the input goes from on to off—in other words, is negative-going.The IEC 1131-3 gives standards for the symbols for positive transition-sensing and negative transition-sensing coils (Figure 7.10).
With the positive transition-sensing coil, if the power flow to it changes from off to on, the output is set on for one ladder rung evaluation. With the negative transition-sensing coil, if the power to it changes from off to on, the output is set on for one ladder rung evaluation. Thus, for the ladder rung of Figure 7.11, with the input off there is no output. When the input switches on, there is an output from the coil. However, the next and successive cycles of the program do not give outputs from the coil even though the switch remains on. The coil only gives an output the first time the switch is on.
7.5 Set and Reset
Another function that is often available is the ability to set and reset an internal relay. The set instruction causes the relay to self-hold, that is, latch. It then remains in that condition until the reset instruction is received. The term flip-flop is often used. Figure 7.12 shows the IEC 1131-3 standards for such coils. The SET coil is switched on when power is supplied to it and remains set until it is RESET. The RESET coil is reset to the off state when power is supplied to it and remains off until it is SET.
Figure 7.13 shows an example of a ladder diagram involving such a function. Activation of the first input, X400, causes the output Y430 to be turned on and set, that is, latched. Thus if the first input is turned off, the output remains on. Activation of the second input, X401,causes the output Y430 to be reset, that is, turned off and latched off. Thus the output Y430 is on for the time between X400 being momentarily switched on and X401 being momentarily switched
on. Between the two rungs indicated for the set and reset operations, there could be other rungs for other activities to be carried out, with the set rung switching on an output at the beginning of the sequence and off at the end.
The programming instructions for the ladder rungs in the program for Figure 7.13 are:
LD X400 S Y430 Other program rungs are:
LD X401 R Y430
With a Telemecanique PLC, the ladder diagram would be as shown in Figure 7.14 and the
programming instructions would be:
L I0,0 S O0,0 L I0,1 R O0,0