Type symbol in PLC
BENTLY's 20 basic logic instructions:
Fetch and output commands (LD/LDI/LDP/LDF/OUT)
(1) LD (Fetch instruction) An instruction that connects the normally open contact to the left bus. This instruction is used for each logical line starting with the normally open contact.
(2) LDI (take counter-instruction) An instruction to connect a normally closed contact with the left bus, which is used for each logical line starting with the normally closed contact.
(3) The rising edge detection command of LDP (take rising edge command) and the normally open contact connected to the left bus only switches ON one scan cycle when the rising edge of the specified bit element (from OFF to ON).
(4) LDF (take falling edge command) falling edge detection command of normally closed contact connected with the left bus.
(5) OUT (output instruction) The instruction that drives the coil, also known as the output instruction.
Instructions for taking instructions and output instructions:
1) LD and LDI commands can not only be used to input the contacts connected to the left bus, but also cooperate with ANB and ORB commands to realize block logic operation;
2) LDP and LDF commands only maintain the switch on for one scan cycle when the corresponding component is valid. In FIG. 1, when M1 has a falling edge, only one scan period of Y3 is ON.
3) The target components of LD, LDI, LDP, LDF commands are X, Y, M, T, C, and S;
4) The OUT instruction can be used continuously for several times (equivalent to the coil in parallel). For timers and counters, constant K or data register should be set after the OUT instruction.
5) The OUT instruction target elements are Y, M, T, C and S, but cannot be used for X.
Contact series command (AND/ANI/ANDP/ANDF)
(1) AND (with instructions) A normally open contact is connected in series with instructions to complete the logical "and" operation.
(2) ANI (and counterinstruction) A normally closed contact is connected in series with an instruction to perform the logical "and not" operation.
(3) ANDP rising edge detection series connection instruction.
(4) ANDF falling edge detection series connection instruction.
Instructions for the use of contact series instructions:
1) AND, ANI, ANDP, ANDF all refer to the instructions of connecting single contacts in series. There is no limit on the number of series and they can be used repeatedly.
2) The target elements of AND, ANI, ANDP and ANDF are X, Y, M, T, C and S.
3) OUT M101 command to drive Y4 through the contact of T1 is called continuous output.
Contact parallel instruction (OR/ORI/ORP/ORF)
(1) OR (or instruction) is used for the parallel connection of a single normally open contact to realize the logical "OR" operation.
(2) ORI (or non-instruction) is used for the parallel connection of a single normally closed contact to realize the logical "or not" operation.
(3) ORP rising edge detection parallel connection instruction.
(4) ORF falling edge detection parallel connection instruction.
Instructions for use of contact parallel instruction:
1) The OR, ORI, ORP and ORF commands all refer to the parallel connection of a single contact. The left end of the parallel contact is connected to LD, LDI, LDP or LPF, and the right end is connected to the right end of the contact corresponding to the previous command. The number of continuous use of contact parallel instruction is not limited;
2) The target components of OR, ORI, ORP and ORF instructions are X, Y, M, T, C and S.
Block Operation Instructions (ORB/ANB)
(1) ORB (block or instruction) is used in parallel between circuits connected by two or more contacts in series.
Instructions for the ORB directive:
1) When several series circuit blocks are connected in parallel, LD or LDI instruction should be used at the beginning of each series circuit block;
2) There are multiple circuit blocks connected in parallel. If the ORB command is used for each circuit block, there is no limit on the number of circuit blocks connected in parallel;
3) The ORB command can also be used consecutively, but this is not recommended. The LD or LDI command cannot be used more than 8 times, that is, the ORB can only be used consecutively less than 8 times.
(2) ANB (block and instruction) is used in series between circuits connected in parallel by two or more contacts. Instructions for ANB instruction:
1) When parallel circuit blocks are connected in series, LD or LDI instruction shall be used at the beginning of parallel circuit blocks;
2) When multiple parallel loop blocks are connected in series with the previous loop in sequence, there is no limit on the number of times ANB instruction can be used. ANB can also be used continuously, but as with ORB, it can be used up to eight times.
SET and Reset Instruction (SET/RST)
(1) SET (set instruction) Its function is to be operated on the target component set and hold.
(2) RST (reset command) causes the target element to reset and maintain the state of zero.
The use of SET and RST instructions is shown in Figure 6. When X0 is normally open and connected, Y0 changes to ON state and keeps this state. Even if X0 is disconnected, Y0's ON state remains unchanged. Only when the normal opening of X1 is closed, Y0 will turn into the OFF state and remain in the OFF state. Even if X1 is disconnected, Y0 will still be in the off state.
Instructions for use of SET and RST instructions:
1) The target components of SET instruction are Y, M and S, and the target components of RST instruction are Y, M, S, T, C, D, V and Z. The RST instruction is often used to clear the contents of D, Z, and V, and to reset integrator timers and counters.
2) For the same target component, SET, RST can be used many times, the order can also be arbitrary, but the last executor is effective.
Differential Instruction (PLS/PLF)
(1) PLS (rising edge differential instruction) produces a scan cycle pulse output on the rising edge of the input signal.
(2) PLF (descending edge differential instruction) produces a scan cycle pulse output on the descending edge of the input signal.
The differential instruction is used to detect the edge of the signal, and the state of Y0 is controlled by the set and reset commands.
PLS, PLF instructions for use:
1) The target components of PLS and PLF instructions are Y and M;
2) When using PLS, the target element is ON only in one scan period after the driver input is ON, as shown in Figure 3-21, M0 is ON only in one scan period when the normally open contact of X0 is switched from off to ON; When using PLF instruction, it only uses the falling edge of the input signal to drive, and other same as PLS.
Master Command (MC/MCR)
(1) MC (master command) is used for connecting common series contacts. After MC is executed, the left bus is moved behind the MC contact.
(2) MCR (master reset command) It is the reset command of MC command, that is, the MCR command is used to restore the position of the original left bus.
In programming, it is often the case that multiple coils are controlled by one or a group of contacts at the same time. If the same contacts are connected in the control circuit of each coil, many memory units will be occupied. This problem can be solved by using master control instructions. The use of MC and MCR instructions is shown in FIG. 8. MC N0 M100 is used to realize the right shift of the left bus, so that Y0 and Y1 are under the control of X0, where N0 represents the level of nesting, and the use times of N0 is unlimited in the non-nesting structure. Use MCR N0 to restore the original left bus state. If X0 is disconnected, the command between MC and MCR is skipped and executed downward.
Instructions for MC and MCR instructions:
1) The target components of MC and MCR commands are Y and M, but special auxiliary relays cannot be used. MC accounted for 3 procedure steps, MCR accounted for 2 procedure steps;
2) The main control contact is perpendicular to the general contact in the ladder diagram (M100 in Figure 3-22). The master contact is a normally open contact connected to the left bus and is the master switch that controls a set of circuits. Contacts connected to the master contact must use LD or LDI instructions.
3) When the input contact of the MC command is disconnected, the integrator timer, counter, and components driven by the reset/set command in the MC and MCR remain in their previous state. Non-integrator timers and counters, which are reset by the element driven by the OUT command, 22 when X0 is disconnected, Y0 and Y1 become OFF.
4) The use of MC instructions in an MC command area is called nesting. The maximum number of nested levels is 8, and the number increases in the order of N0→N1→N2→N3→N4→N5→N6→N7. The return of each level uses the corresponding MCR instruction, and the reset starts from the nested level with the large number.
Stack instruction (MPS/MRD/MPP)
Stack instruction is a basic instruction added to the FX series and used in multiple output circuits to facilitate programming. In FX series PLC, there are 11 memory cells, which are specially used to store the intermediate results of program operations. They are called stack memory.
(1) MPS (stack-instruction) sends the result of the operation to the first segment of the stack memory, while moving the previously sent data to the next segment of the stack in turn.
(2) MRD (read stack instruction) reads the first segment of the stack memory (the last data pushed into the stack) and the data continues to be stored in the first segment of the stack memory, and the data in the stack does not move.
(3) MPP (out of stack instruction) reads out the first section of data in the stack memory (the last data in the stack) and this data disappears from the stack, while moving the other data in the stack.
Instructions for stack instructions:
1) Stack instruction has no target element;
2) MPS and MPP must be used together;
3) Since the stack storage unit is only 11, so the stack layer is at most 11.
INV/NOP/END
(1) INV (counter instruction) After executing this instruction, the original operation result is reversed. The use of counterinstruction is shown in Figure 10. If X0 is disconnected, Y0 is ON, otherwise Y0 is OFF. When using INV, it should be noted that INV cannot be connected with the bus like LD, LDI, LDP, LDF in the instruction table, nor can it be used alone like OR, ORI, ORP, ORF in the instruction table.
(2) NOP (empty operation instruction) does not perform the operation, but occupies a program step. NOP is executed without doing anything, sometimes shorting certain contacts with NOP instructions or overwriting unwanted instructions with NOP instructions. When the PLC has executed the operation of clearing user memory, the contents of user memory all become empty operation instruction.
(3) END indicates the end of the program. If the END of the program does not write end instruction, the PLC regardless of the actual user program long, from the user program memory of the first step to the last step; If there is an END instruction, when the END is scanned, the execution program will be terminated, which can shorten the scan cycle. In the program debugging, you can insert a number of END instructions in the program, divide the program into a number of segments, after determining the previous program segment is correct, delete the END instruction in turn, until the end of debugging.
FX series PLC step instruction
1. Step Command (STL/RET)
Step instructions are instructions designed for sequential control. In the field of industrial control, many control processes can be realized by sequential control. The use of step instructions to realize sequential control is both convenient to realize and easy to read and modify.
There are two step instructions in FX2N: STL (step contact) and RET (step return).
STL and RET instructions can be stepped only in conjunction with the state device S. Such as STL S200 said state normally open contact, called the STL contact, its symbol in the ladder diagram for - | | | | -- - it's not normally closed contacts. We use each state device S to record a work step. For example, STL S200 is valid (ON), then enter the step indicated by S200 (similar to the master switch of this step), start to perform the work that should be done in this stage, and judge whether the conditions for entering the next step are met. Once the signal of this step is ON, turn off the S200 and proceed to the next step, such as S201. The RET command is used to reset the STL command. After executing RET, the bus will return to the bus and exit the step state.
2. State transition diagram
A sequential control process can be divided into several stages, also known as steps or states, each of which has a different action. When the transition conditions between two neighboring states are met, the transition will be realized, that is, the transition from the previous state to the next state. We often describe this sequential control process in a state transition diagram (function table diagram). , record each state with state device S, and X is the transition condition. For example, when X1 is ON, the system state changes from S20 to S21.
Each step in the state transition diagram contains three contents: the content of the step driver, the transition condition, and the transition goal of the instruction. As shown in Figure 1, S20 step drives Y0. When X1 is effective as ON, the system changes from S20 state to S21 state, X1 is the conversion condition, and the conversion target is S21 step.
3. Instructions for using step commands
1) The STL contact is a normally open contact connected to the left bus. If a certain STL contact is connected, the corresponding state is a movable step;
2) LD or LDI instruction should be applied to the contacts connected with STL contacts, and only after executing RET will they return to the left bus;
3) STL contacts can drive coils of Y, M, S, T and other components directly or through other contacts;
4) Since PLC only executes the circuit block corresponding to the activity step, double coil output is allowed when STL instruction is used (the sequential control program can drive the same coil multiple times in different steps);
5) MC and MCR commands cannot be used in circuit blocks driven by STL contacts, but CJ commands can be used;
6) STL instruction cannot be used in interrupt programs and subroutines.