Instruction Lists - Programmable Logic controllers

A programming method that can be considered to be the entering of a ladder programing text is the instruction list (IL). An instruction list gives programs as a series of instructions, with each instruction on a new line. Each instruction consists of an operator followed by one or more operands, that is, the subjects of the operator. Thus we might have: LD A to indicate that the operand A is to be loaded, LD being the operator used to indicate loading.

In terms of ladder diagrams, an operator may be regarded as a ladder element, and LD is equivalent to starting a rung with open contacts for input A. Another instruction might be: OUT Q to indicate that there is to be an output to Q.

Mnemonic codes are used for operators, each code corresponding to an operator/ladder element. The codes used differ to some extent from manufacturer to manufacturer, though a standard under IEC 1131-3 has been proposed and is being widely adopted. Table 6.1 shows some of the codes used by manufacturers and the proposed standard for instructions used in this chapter (see later chapters for codes for other functions). Instruction List is a low-level textual language that is simple to implement and used by a number of PLC manufacturers, mainly for small and medium-sized PLCs. It is particularly suitable for small, straightforward programs. Some manufactures do not support ILs but use only higher-level language of structured text (ST).

Instruction code Mnemonics

As an illustration of the use of IEC 1131-3 operators, consider the following:

LD A (*Load A*) AND B (*AND B*) ST Q (*Store result in Q, i.e. output to Q*)

In the first line of the program, LD is the operator, A the operand, and the words at the ends of program lines and in parentheses shown and preceded and followed by * are comments added to explain what the operation is and are not part of the program operation instructions to the PLC. LD A is thus the instruction to load A into the memory register. It can then later be called on for further operations. The next line of the program has the Boolean operation AND performed with A and B. The last line has the result stored in Q, that is,output to Q.

Labels can be used to identify various entry points to a program, useful, as we will find later,for jumps in programs; these precede the instruction and are separated from it by a colon. Thus we might have:

PUMP_OK: LD C (*Load C*)

with the instruction earlier in the program to jump to PUMP_OK if a particular condition isrealized.

With the IEC 1131-3 operators, an N after the operator is used to negate its value. Forexample, if we have:

LD A (*Load A*) ANDN B (*AND NOT B*)

the ANDN operator inverts the value of ladder contacts and ANDs the result.

Ladder Programs and Instruction Lists

When looked at in terms of ladder diagrams, whenever a rung is started, it must use a “start a rung” code. This might be LD, or perhaps A or L, to indicate that the rung is starting with open contacts, or LDI, or perhaps LDN, LD NOT, AN, or LN, to indicate it is starting with closed contacts. All rungs must end with an output or store result code. This might be OUT or ¼ or ST. The following shows how individual rungs on a ladder are entered using the Mitsubishi mnemonics for the AND gate, shown in Figure.

The rung starts with LD because it is starting with open contacts. For Figure, since the address of the input is X400, the instruction is LD X400. This is followed by another open contacts input, and so the next program line involves the instruction AND with the address of the element; thus the instruction is AND X401. The rung terminates with an output, so the instruction OUT is used with the address of the output, that is, OUT Y430. The single rung of a ladder would thus be entered as:

LD X400 AND X401 OUT Y430 For the same rung with Siemens notation, we have: A I0.1 A I0.2¼ Q2.0

Consider another example: an OR gate. Figure shows the gate with Mitsubishi notation.

The instruction for the rung in Figure starts with an open contact and is LD X400. The next item is the parallel OR set of contacts X401. Thus the next instruction is OR X401.

The last step is the output, hence OUT Y430. The instruction list would thus be:

LD X400 AND X401 OR Y430Ladder Programs and Instruction Lists

Figure shows the Siemens version of the OR gate. The following is the Siemens instruction list:

A I0.1 A I0.2¼ Q2.0

Figure shows the ladder system for a NOR gate in Mitsubishi notation

The rung in Figure starts with normally closed contacts, so the instruction is LDI. When added to Mitsubishi instruction, I is used to indicate the inverse of the instruction. The next step is a series of normally closed contacts and so the instruction is ANI, again the I being used to make an AND instruction the inverse. I is also the instruction for a NOT gate. The instructions for the NOR gate rung of the ladder would thus be entered as:

ladder system for a NOR gate

Nand gate Mitsubishi and siemens

Figure shows the NOR gate with Siemens notation. Note that N added to an instruction is used to make the inverse. The instruction list then becomes:

LN I0.1 AN I0.2¼ Q2.0

Consider the rung shown in Figure in Mitsubishi notation, a NAND gate. Figure starts with the normally closed contacts X400 and so starts with the instruction LDI X400. The next instruction is for a parallel set of normally closed contacts; thus the instruction is ORI X401. The last step is the output, hence OUT Y430. The instruction list is thus:

LDI X400 ORI X401 OUT Y430

Figure shows the NAND gate in Siemens notation. The instruction list is then:

AN I0.1 ON I0.2¼ Q2.0

Branch Codes

The EXCLUSIVE OR (XOR) gate shown in Figure has two parallel arms with an AND situation in each arm.

XOR gate Mitsubishi and siemens

Figure shows Mitsubishi notation. With such a situation, Mitsubishi uses an ORB instruction to indicate “OR together parallel branches.” The first instruction is for a normally open pair of contacts X400. The next instruction is for a series set of normally closed contacts X401, hence ANI X401. After reading the first two instructions, the third instruction starts a new line. It is recognized as a new line because it starts with LDI, all new lines starting with LD or LDI. But the first line has not been ended by an output.

The PLC thus recognizes that a parallel line is involved for the second line and reads together the listed elements until the ORB instruction is reached. The mnemonic ORB (OR branches/blocks together) indicates to the PLC that it should OR the results of the first and second instructions with that of the new branch with the third and fourth instructions. The list concludes with the output OUT Y430. The instruction list would thus be entered as:

ANI X400

LDI X401 AND X400 ORB X401 OUT Y430

Figure shows the Siemens version of an XOR gate. Brackets are used to indicate that certain instructions are to be carried out as a block. They are used in the same way as brackets in any mathematical equation. For example, (2 þ 3) / 4 means that the 2 and 3 must be added before dividing by 4. Thus with the Siemens instruction list we have instep 0 the instruction A(. The brackets close in step 3. This means that the A in step 0 is applied only after the instructions in steps 1 and 2 have been applied.

Siemens version of an XOR gate

The IEC 1131-3 standard for such programming is to use brackets in the way used in the previous Siemens example, that is, in the same way brackets are used in normal arithmetic. This enables instructions contained within brackets to be deferred until the bracket is completed. Thus the IEC instruction list program:

ADD(B)

MUL(C)

ADD D

Gives X þ (B Â (C þ D)).

Figure shows a circuit that can be considered as two branched AND blocks. Figure shows the circuit in Mitsubishi notation. The instruction used here is ANB. The instruction list is thus:

circuit in Mitsubishi notation

Figure shows the same circuit in Siemens notation. Such a program is written as an instruction list using brackets. The A instruction in step 0 applies to the result of steps 1 and 2. The A instruction in step 4 applies to the result of steps 5 and 6. The program instruction list is thus:

same circuit in Siemens notation

same circuit in Siemens notation

More Than One Rung

Figure shows a ladder, in Mitsubishi notation, with two rungs. In writing the instruction list we just write the instructions for each line in turn. The instruction LD or LDI indicates to the PLC that a new rung is starting. The instruction list is thus:

LD X400 OUT Y430 LDI X400 OUT Y431

The system is one where when X400 is not activated, there is an output from Y431 but not Y430. When X400 is activated, there is then an output from Y430 but not Y431.

Figure shows the same program in Siemens notation. The ¼ instruction indicates the end of a line. The A or AN instruction does not necessarily indicate the beginning of a rung since the same instruction is used for AND and AND NOT. The instruction listis then:

¼ 10.0

AN Q2.0

¼ 10.0

Programming Examples

The following tasks are intended to illustrate the application of the programming techniques given in this section and are the examples for which ladder diagrams and function block diagrams were derived in Section 5.7.

A signal lamp is required to be switched on if a pump is running and the pressure is satisfactory or if the lamp test switch is closed. Figure shows the ladder program and the related instruction list.

For a valve that is to be operated to lift a load when a pump is running and either the lift switch operated or a switch operated indicating that the load has not already been lifted and is at the bottom of its lift channel, Figure shows the ladder program and the related instruction list.

For a system in which there has to be no output when any one of four sensors gives an output and otherwise there is to be an output, Figure shows the ladder program and the instruction list.

Programming Examples


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Programmable Logic controllers Topics