02 Basic instruction

Last modified by Mora Zhou on 2023/12/22 10:57

LD, LDI, LDP,LDF OUT Instructions

Instruction description

LD, LDI takes 1 process step. LDP, LDF take 2 process steps. The operands of these 4 instructions could be X, Y, S, M, T, C.

The operand of OUT could be Y, S, T, M or C. Soft component Y and the general M takes 1 process step. S and special auxiliary relay M take 2 process steps. Timer T takes 3 process steps. Counter takes 3-5 process steps.

Connect the LDP and LDF instructions directly to the left hand bus bar. Or use LDP and LDF instructions to define a new block of program when using the ORB and ANB instructions (see later sections).

LDP is active for one scouldning cycle after the associated device switches from OFF to ON. LDF is active for one scouldning cycle after the associated device switches from ON to OFF.

The number of repetitions of LD, LDI, LDP and LDF instructions is below 8. That is, the maximum number of times used in series or parallel connection with the following ANB and ORB instructions is 8.

The steps of Y and normal M are 1; it is 2 for S and special M and 3 for T (timer), 3-5 for C (counter).

It is not possible to use the OUT instruction to drive ‘X’ type input devices. It is possible to connect multiple OUT instructions in parallel.

When using the OUT instruction to drive counter, when the front coil turns from ON to OFF, or from OFF to ON, the counter will add one.

Example

Ladder and Instruction List:

7-1 basic instruction_html_41277fe0243a38c8.jpg

Use LD, LDI, LDP, and LDF to connect with bus. Use OUT instruction to drive output coil. When using OUT instruction to drive timer or counter, it is no need to set the time value and count value. It could be a constant K, or indirectly set by the register.

AND, ADNI, ANDP, ANDF Instructions

Instruction description

The steps of AND and ANI is 1, the steps of ANDP and ANDF is 2. The operands of these 4 instructions could be X, Y, S, M, T, C.

Use the AND and ANI instructions for serial connection of contacts. As many contacts as required could be connected in series. Use the ANDP and ANDF instructions for the serial connection of pulse contacts.

ANP is active for one scouldning cycle after the associated device switches from OFF to ON. ANF is active for one scouldning cycle after the associated device switches from ON to OFF.

Program example:

Ladder and instruction list:

7-1 basic instruction_html_fa40ea16b727a053.jpg

In this example, X0, X3, Y1 are connected with preceding contacts as the cascade contacts.

OR, ORI, ORP, ORF Instructions

Instruction description

The steps of OR and ORI is 1, the steps of ORP and ORF is 2. The operands of these 4 instructions could be X, Y, S, M, T, C.

The instructions OR, ORI, ORP and ORF could only contact one circuit. For two or more series circuits, need to use ORB instruction when they connect in parallel.

ORP is active for one program scould after the associated device switches from OFF to ON. ORF is active for one program scould after the associated device switches from ON to OFF.

There are no limitations to the number of parallel circuits when using an OR, ORI, ORP, ORF instructions and LD, LDI, LDP, LDF instruction.

Program example

Ladder and instruction list:

7-1 basic instruction_html_26adb05be856d8c2.jpg

ANB and ORB Instructions

Instruction description

The ANB instruction has no operand, and the number of steps is 1. The ORB instruction operand could be X, Y, S, M, T, C, the step number is 1.

Use the ANB instruction to connect multi-contact circuits (usually parallel circuit blocks) to the preceding circuit in series. Parallel circuit blocks are those in which more than one contact connects in parallel or the ORB instruction is used.

To declare the starting point of the circuit block, use a LD or LDI instruction. After Completing the parallel circuit block, connect it to the preceding block in series using the ANB instruction.

ANB and ORB instruction is an independent instruction.

When using ANB instruction in a batch, use no more than 8 LD and LDI instructions in the definition of the program blocks (to be connected in parallel).

Program example

Ladder and instruction list:

7-1 basic instruction_html_f65e9ad0b1e1a313.jpg

ORB instruction is used in the end of each branch, not in the end of all branches, as it shown above.

ANB instruction is only used to connect parallel circuit blocks as the picture shown above.

INV Instruction

Instruction description

INV is the instruction which invert the result that before the INV instruction. And it has no operands. The instruction takes up 1 process step.

Program example

Ladder and instruction list:

7-1 basic instruction_html_2095157251387cf2.jpg

MC, MCR Instruction

Instruction description      

The process step of MC instruction is 3 and the operands could be Y, M (except for special M). The process step of MCR instruction is 2 and the operands could be Y, M (except for special M).

After the execution of an MC instruction, the bus line (LD, LDI point) shifts to a point after the MC instruction. An MCR instruction returns this to the original bus line.

When using MC instruction, the number K of the nesting class increases in order, that is, only the K0 could nest K1. Instead, when using MCR instruction, it must return bus bar from large to small. Maximum nesting level is 7 (K6).

The MC instruction could be used as many times as necessary by changing the device number Y and M. Using the same device number twice is processed as a double coil

Program example

Ladder and instruction:

7-1 basic instruction_html_b6c5f9429fcbfbe0.jpg

When input X0=ON, all instructions between the MC and the MCR instruction execute.

When input X0=OFF, none of the instruction between the MC and MCR instruction execute; this resets all devices except for retentive timers, counters and devices driven by SET/RST instructions.

MPS, MRD and MPP Instruction

Instruction description     

Instruction MPS, MRD and MPP have no operand, the steps of all of these three instructions is 1.

Use these instructions to connect output coils to the left hand side of a contact.

Without these instructions connections could only be made to the right hand side of the last contact.

MPS stores the connection point of the ladder circuit so that further coil branches could recall the value later. MRD recalls or reads the previously stored connection point data and forces the next contact to connect to it.

MPP pops (recalls and removes) the stored connection point. First, it connects the next contact, and then it removes the point from the temporary storage area. For every MPS instruction there must be a corresponding MPP instruction. The last contact or coil circuit must connect to an MPP instruction.

At any programming step, the number of active MPS-MPP pairs must be no greater than 11.

Program example

Ladder 1 and instruction list 1:

7-1 basic instruction_html_d67d37356fe893a1.jpg

Example 1 uses a one-stage stack (one MPS, one MRD and one MPP).

Ladder 2 and instruction list 2:

7-1 basic instruction_html_a046f974630322dd.jpg

Example 2 uses a two-stage stack and it is mixed with OR, ORB, and ANB instructions.

PLS, PLF Instructions

Instruction description

The steps of PLS and PLF are 1, and operands could be Y and M (except for special M).

When a PLS instruction is executed, object devices Y and M operate for one operation cycle after the drive input signal has turned ON.

When a PLF instruction is executed, object devices Y and M operate for one operation cycle after the drive input signal has turned OFF.

If an M coil which is latched was used, then it only operates for one operation cycle for the first time.

Program example

Ladder and instruction list:

7-1 basic instruction_html_1add3b86dcc1fd9a.jpg

SET, RST Instructions

Instruction description

The operands of SET instruction are Y, M, S; RST operands are X, Y, S, M, T, C, D, V, Z.

The steps of Y and the general M is 1, the steps of S and special auxiliary relay M, timer T, counter C is 2, the steps of data register D and variable address register V and Z is 3.

SET and RST instructions could be used for the same device as many times as necessary. However, the last instruction activated determines the current status.

SET command set the soft component when the coil is connected, unless reset the soft component with RST instruction, it will remain 1. Similarly, the RST instructions reset the soft component, and it will remain 0, unless using the SET command to set.

It is also possible to use the RST instruction to reset the contents of data devices such as data registers, index registers, timer and counter. The effect is similar to moving ‘K0’ into the data device.

Program example

Ladder instruction list:

7-1 basic instruction_html_61a70375f93f8cd6.jpg