This chapter continues from the previous chapters on programming and introduces internal relays. A variety of other terms are often used to describe these elements, such as auxiliary relays, markers, flags, coils, and bit storage. These are one of the elements included among the special built-in functions with PLCs and are very widely used in programming. A small PLC might have a hundred or more internal relays, some of them battery backed so that they can be used in situations where it is necessary to ensure safe shutdown of a plant in the event of power failure. Later chapters consider other common built-in elements.
7.1 Internal Relays
In PLCs there are elements that are used to hold data, that is, bits, and behave like relays,being able to be switched on or off and to switch other devices on or off. Hence the term internal relay. Such internal relays do not exist as real-world switching devices but are merely bits in the storage memory that behave in the same way as relays. For programming, they can be treated in the same way as an external relay output and input. Thus inputs to external switches can be used to give an output from an internal relay. This then results in the internal relay contacts being used, in conjunction with other external input switches, to give an output, such as activating a motor. Thus we might have (Figure 7.1)
On one rung of the program:
Inputs to external inputs activate the internal relay output. On a later rung of the program:
As a consequence of the internal relay output, internal relay contacts are activated and so
control some output.
In using an internal relay, it has to be activated on one rung of a program and then its output used to operate switching contacts on another rung, or rungs, of the program. Internal relays can be programmed with as many sets of associated contacts as desired.
To distinguish internal relay outputs from external relay outputs, they are given different types of addresses. Different manufacturers tend to use different terms for internal relays and
have different ways of expressing their addresses. For example, Mitsubishi uses the term auxiliary relay or marker and the notation M100, M101, and so on. Siemens uses the term flag and the notation F0.0, F0.1, and so on. Telemecanique uses the term bit and the notation B0, B1, and so on. Toshiba uses the term internal relay and the notation R000, R001, and so on. Allen-Bradley uses the term bit storage and notation in the PLC-5 of the form B3/001,B3/002, and so on. 7.2 Ladder Programs
With ladder programs, an internal relay output is represented using the symbol for an output device, namely , with an address that indicates that it is an internal relay. Thus, with a Mitsubishi PLC, we might have the address M100, the M indicating that it is an internal relay or marker rather than an external device. The internal relay switching contacts are designated with the symbol for an input device, namely , and given the same address as the internal relay output, such as M100.
7.2.1 Programs with Multiple Input Conditions
As an illustration of the use that can be made of internal relays, consider the following situation. A system is to be activated when two different sets of input conditions are realized.We might just program this as an AND logic gate system; however, if a number of inputs have to be checked in order that each of the input conditions can be realized, it may be simpler to use an internal relay. The first input conditions then are used to give an output to an internal relay. This relay has associated contacts that then become part of the input conditions with the second input
Figure 7.2 shows a ladder program for such a task. For the first rung, when
input In 1 or input In 3 is closed and input In 2 closed, internal relay IR 1 is activated. This results in the contacts for IR 1 closing. If input In 4 is then activated, there is an output from output Out 1. Such a task might be involved in the automatic lifting of a barrier when someone approaches from either side. Input In 1 and input In 3 are inputs from photoelectric sensors that detect the presence of a person
approaching or leaving from either side of the barrier, input In 1 being activated from one side of it and input In 3 from the other. Input In 2 is an enabling switch to enable the system to be closed down. Thus when input In 1 or input In 3, and input In 2, are activated, there is an output from internal relay 1. This will close the internal relay contacts. If input In 4, perhaps a limit switch,detects that the barrier is closed, then it is activated and closes. The result is then an output from
Out 1, a motor that lifts the barrier. If the limit switch detects that the barrier is already open, the person having passed through it, then it opens and so output Out 1 is no longer energized and a counterweight might then close the barrier. The internal relay has enabled two parts of the program to be linked, one part being the detection of the presence of a person and the second part the detection of whether the barrier is already up or down. Figure 7.3a shows how Figure 7.2 would appear in Mitsubishi notation and Figure 7.3b shows how it would appear in Siemens notation.
Figure 7.4 is another example of a ladder program involving internal relays. Output 1 is controlled by two input arrangements. The first rung shows the
internal relay IR 1, which is
energized if input In 1 or In 2 is activated and closed. The second rung shows internal relay IR 2, which is energized if inputs In 3 and In 4 are both energized. The third rung shows that output Out 1 is energized if internal relay IR 1 or IR 2 is activated. Thus there is an output from the system if either of two sets of input conditions is realized. 7.2.2 Latching Programs
Another use of internal relays is for resetting a latch circuit. Figure 7.5 shows an example of such a ladder program.