PLC learning series 14: Ladder logic Instructions
PLC 

PLC ladder logic programming language is a collection of many instruction sets. To become a programmer in ladder logic one have to know more about the list of the instruction set that can be used at appropriate positions.

The journal discusses the different ladder logic instruction, as follows:

Normally Open & Normally Closed instruction:

The normally opened contact turns ON when related bit turns ON. It resembles the physical contact switch.

The normally closed contact turn ON when the related bit turns OFF. It also resembles the contact switch but turns ON when the related bit turns OFF.

Output Energize (OTE) Instruction:

Typically this Output Energize (OTE) instruction is used in combination with XIC and XIO or any other PLC output instructions.

The OTE instruction would be energized if the logic preceding the OTE instruction is valid.

Compare instruction:

Comparison instructions are used for checking pairs of values in ladder logics to condition a rung’s logical consistency.

The instructions for comparison would therefore seldom, if ever, be the last instruction on a rung. There are different kinds of comparison instructions, are listed below:

Equal

In ladder logic, the Equal (EQU) instruction is used to test if two values are equal.

The instruction is logically true if source A and source B are equal. The instruction is logically false if these values are not equal

Not-Equal:

The Not Equal (NEQ) instruction in ladder logic is used to test whether two values are not equal.

If source A and source B are not equal, the instruction is logically true.

Less than (LES) Instruction:

The instruction in ladder logics Less Than (LES) is used to check if one value (source A) is less than another (source B) When source A is less than the value in source B, the instruction is logically true

Less than or Equal (LEQ) instruction:

The instruction in ladder logics Less Than or Equal (LEQ) is used to check whether one value (source A) is less than or equal to another (source B).

The instruction is logically true if the value at source A is less than or equivalent to the value at source B.

Greater than (GRT) instruction:

The instruction of the Greater Than or Equal (GEQ) to check whether one value (source A) is greater than or equal to another (source B). The instruction is logically true if the value at source A is greater than or equal to the value at source B.

Greater than or equal to (GEQ):

The instruction of Greater Than or Equal (GEQ) to test if one value (source A) is greater than or equal to another (source B). The instruction is logically true if the value at source A is greater than or equal to the value at source B.

Masked Comparison for Equal (MEQ):

The instruction for Masked Comparison for Equal (MEQ) to compare data at a source address with data at a comparison address. Using this instruction requires a separate word to mask portions of the data.

Math Instructions:

There are a couple of Math instructions used in ladder logic for various arithmetic operations like, addition, subtraction, multiplication, division etc.,

Source is thevalue(s)address(s) to be used for the numerical, logical, and moving operation.

An instruction with two source operands in both operands does not accept program constants.

Destination is the address of the operation’s end. Signed integers are contained in the complementary shape of two and refer to parameters of source and destination.

Location of math instructions in ladder logic will decide the operation performed (i.e. if the A(B+C) operation is required, the ADD operation will occur before the MUL).

There are math instruction such as ADD, SUB, MUL(multiplication), DIV(division), SQR (square root), NEG(Negate a value – 2’s complement) TOD (convert integer to BCD), FRD (convert from BCD to integer)

Move instructions:

Move instruction is used to move a source value to the destination location. As long as the rung remains true, the instruction moves the data each scan.

The parameter enter in the source will the address of the data you wanted to move. The destination is the address where the instruction moves the data.

Masked Move (MVM) instruction

The Masked Move (MVM) instruction is a word instruction that moves data to a destination from a source location and allows a separate word to mask portions of destination data.

Jump Instruction (JMP)

The jump instruction is used to skip a portion of the ladder program.

Jumping to a label saves the scanning time of the program by omitting a segment of the program until necessary.

Jumping backwards allows the controller to repeatedly execute program segments

Jump to subroutine (JSR)

The instructions for Jump to Subroutine (JSR), Subroutine (SBR), and Return (RET) are used to guide the controller to execute a separate subroutine file within the ladder system and return to the instructions as per the instructions for JSR.

When the JSR instruction is executed, the controller jumps to the subroutine instruction (SBR) at the beginning of the target subroutine file and resumes execution at that point.

You cannot jump into any part of a subroutine except the first instruction in that file.

Master Control Reset (MCR)

Use pair-based Master Control Reset (MCR) instructions to create program zones that turn off all non-retentive outputs in the area.

Rungs within the MCR zone are still scanned, but the scanning time is reduced due to the false state of non-retentive outputs MCR zones allow you to enable or inhibit segments of your program, e.g.

Temporary End (TND) Instruction:

Temporary End (TND) instruction, if its rung is true:

  • Stop the processor from scanning the rest of the program file
  • Update the I/O and resume scanning at rung 0 of the main program.

if the rung of this instruction is wrong, the processor will continue the scan until the next TND instruction or the END statement.

Use this TND command to gradually debug a program or omit the balance of your current program file or subroutines

Suspend(SUS) instruction:

Upon execution of the Suspend (SUS) instruction, the processor enters the Suspend Idle mode and stores the Suspend ID in the status file’s word 7 (S:7).


PLC Learning series:

PLC learning Series I: What is PLC? Functions of PLC
PLC learning series 2: PLC programming languages
PLC learning series 3: PLC Architecture and wiring of PLC
PLC learning series 5: 8 Rules for ladder diagram programming
PLC learning series 6: PLC process Scan basics
PLC learning series 8: Instruction List programming
PLC learning series 9: PLC selection criteria.
PLC learning Series 10: PLC timers
PLC learning series 11 : How to interface PLC with SCADA?
PLC learning series 12: Troubleshooting PLC
PLC learning Series 13: Counters in PLC

News Reporter
Instrumentation Engineer