27 plc basic logic instructions
Source: InternetPublisher:常思一二 Keywords: plc motor control circuit logic instructions Updated: 2020/04/06
Basic logic instructions of Mitsubishi FX series plc.
Fetch and output instructions (LD/LDI/LDP/LDF/OUT)
(1) LD (fetch instruction) An instruction that connects a normally open contact to the left bus. This instruction is used for every logic line starting with a normally open contact.
(2) LDI (reverse instruction) A normally closed contact is connected to the left busbar. This instruction is used for every logic line starting with a normally closed contact.
(3) LDP (rising edge command) The rising edge detection command of the normally open contact connected to the left bus is only turned on for one scan cycle when the rising edge of the specified bit element (from OFF→ON).
(4) LDF (Fetch falling edge command) The falling edge detection command of the normally closed contact connected to the left bus.
(5) OUT (output command) The command to drive the coil is also called the output command.
Instructions for using instruction fetch and output instructions:
1) The LD and LDI instructions can be used to input the contacts connected to the left bus, and can also be used in conjunction with the ANB and ORB instructions to implement block logic operations;
2) The LDP and LDF instructions only maintain on for one scan cycle when the corresponding components are valid.
3) The target components of the LD, LDI, LDP, and LDF instructions are X, Y, M, T, C, and S;
4) The OUT instruction can be used several times continuously (equivalent to coils connected in parallel). For timers and counters, the constant K or data register should be set after the OUT instruction.
5) The target components of the OUT instruction are Y, M, T, C and S, but cannot be used for X. Contact series instructions (AND/ANI/ANDP/ANDF)
(1)AND (AND instruction) A normally open contact is connected in series to complete the logical "AND" operation.
(2) ANI (AND and Negative Instruction) A normally closed contact is connected in series to complete the logical NAND operation.
(3)ANDP rising edge detection series connection instruction.
(4)ANDF falling edge detection series connection instruction.
Instructions for using contact series instructions:
1)AND, ANI, ANDP, and ANDF all refer to instructions for connecting a single contact in series. There is no limit to the number of series connections and can be used repeatedly.
2) The target elements of AND, ANI, ANDP and ANDF are X, Y, M, T, C and S.
3) After the OUT M101 instruction, driving Y4 through the contact of T1 is called continuous output.
Contact parallel connection instructions (OR/ORI/ORP/ORF)
(1)OR (or instruction) is used for parallel connection of a single normally open contact to realize logical "OR" operation.
(2) ORI (or not instruction) is used for parallel connection of a single normally closed contact to implement logical "OR" operation.
(3)ORP rising edge detection parallel connection command.
(4)ORF falling edge detection parallel connection instruction.
Instructions for use of contact parallel connection instructions:
1) OR, ORI, ORP, and ORF instructions 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 corresponding contact of the previous instruction. There is no limit to the number of times the contact parallel connection instructions can be used continuously;
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 for parallel connection between circuits with two or more contacts connected in series.
Instructions for using the ORB instruction:
1) When several series circuit blocks are connected in parallel, the 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 instruction is used for each circuit block, there is no limit on the number of parallel circuit blocks;
3) The ORB instruction can also be used continuously, but this method of program writing is not recommended. The LD or LDI instruction must not be used more than 8 times, that is, the ORB can only be used continuously less than 8 times.
(2) ANB (Block and Instruction) is used for series connection between circuits with two or more contacts connected in parallel.
Instructions for using the ANB instruction:
1) When parallel circuit blocks are connected in series, use the LD or LDI instruction at the beginning of the parallel circuit block;
2) When multiple parallel circuit blocks are connected in series with the previous circuit in sequence, there is no limit to the number of times the ANB instruction can be used. ANB can also be used continuously, but like ORB, the number of uses is limited to 8 times or less.
Set and reset instructions (SET/RST)
(1) SET (set command) Its function is to set and maintain the target component being operated.
(2) RST (reset instruction) resets the operated target component and maintains the cleared state. With the use of SET and RST instructions, when X0 is normally open and connected, Y0 becomes ON and remains in this state. Even if X0 is disconnected, the ON state of Y0 remains unchanged; only when the normally open of X1 is closed, Y0 It turns to OFF state and remains. Even if X1 is normally open and disconnected, Y0 is still in OFF state.
Instructions for using SET and RST instructions:
1) The target components of the SET instruction are Y, M, and S, and the target components of the 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 is also used to reset the accumulated timer and counter.
2) For the same target component, SET and RST can be used multiple times, and the order can be arbitrary, but the last executor is valid. Differential instructions (PLS/PLF)
(1)PLS (rising edge differential instruction) generates a pulse output of one scan cycle on the rising edge of the input signal.
(2) PLF (falling edge differential instruction) generates a pulse output of one scan cycle at the falling edge of the input signal.
Use differential instructions to detect the edge of the signal, and control the state of Y0 through set and reset commands.
Instructions for using PLS and PLF instructions:
1) The target components of PLS and PLF instructions are Y and M;
2) When using PLS, the target component is ON only in one scan cycle after the drive input is ON, and M0 is ON only in one scan cycle when the normally open contact of X0 is from off to on; when using the PLF instruction, just use Driven by the falling edge of the input signal, others are the same as PLS.
Master control command (MC/MCR)
(1)MC (Master Control Command) is used for the connection of public series contacts. After MC is executed, the left busbar moves behind the MC contact.
(2)MCR (Master Control Reset Command) It is the reset command of the MC command, that is, the MCR command is used to restore the original left bus position.
When programming, it often happens that multiple coils are controlled by one or a group of contacts at the same time. If the same contacts are connected in series to the control circuit of each coil, it will occupy a lot of storage units. Using the master control instruction can can solve this problem.
MC and MCR instructions use MC N0 M100 to move the left bus to the right, so that Y0 and Y1 are both under the control of Restore to the original left bus state. If X0 is disconnected, the instructions between MC and MCR will be skipped and executed downward.
Instructions for using MC and MCR instructions:
1) The target components of MC and MCR instructions are Y and M, but special auxiliary relays cannot be used. MC occupies 3 program steps, MCR occupies 2 program steps;
2) The main control contact is perpendicular to the general contact in the ladder diagram. The main control contact is a normally open contact connected to the left busbar and is the master switch that controls a group of circuits. The contact connected to the main control contact must use the LD or LDI instruction.
3) When the input contact of the MC instruction is disconnected, the accumulated timers, counters, and components driven by reset/set instructions within MC and MCR remain in their previous states. Non-accumulating timers and counters, components driven by the OUT instruction will be reset. When X0 is disconnected in 22, Y0 and Y1 will become OFF.
4) If MC instructions are used again within an MC instruction area, it is called nesting. The maximum number of nesting 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, starting from the nesting level with the larger number. Stack instructions (MPS/MRD/MPP)
The stack instruction is a new basic instruction in the FX series, which is used for multiple output circuits and brings convenience to programming. There are 11 storage units in the FX series PLC, which are specially used to store the intermediate results of program operations and are called stack memories.
(1) MPS (push instruction) sends the operation result to the first segment of the stack memory, and at the same time moves the previously sent data to the next segment of the stack.
(2) MRD (stack read instruction) reads the first segment of data in the stack memory (the last data pushed onto the stack) and continues to save the data in the first segment of the stack memory. The data in the stack does not move.
(3) MPP (pop instruction) reads the first piece of data from the stack memory (the last data pushed onto the stack) and the data disappears from the stack, and at the same time moves other data in the stack up in sequence.
Instructions for using stack instructions:
1) The stack instruction has no target component;
2) MPS and MPP must be used in pairs;
3) Since there are only 11 stack storage units, the stack can have up to 11 levels.
Logical inversion, no operation and end instructions (INV/NOP/END)
(1) INV (inverse instruction) After executing this instruction, the original operation result will be inverted. The use of reverse instructions is shown in Figure 10. If X0 is disconnected, Y0 is ON, otherwise Y0 is OFF. When using it, please note that INV cannot be connected to the bus like the LD, LDI, LDP, and LDF instructions in the instruction list, nor can it be used alone like the OR, ORI, ORP, and ORF instructions in the instruction list.
(2)NOP (no operation instruction) does not perform operations, but occupies one program step. Nothing is done when NOP is executed. Sometimes the NOP instruction can be used to short-circuit certain contacts or the NOP instruction can be used to overwrite unnecessary instructions. When the PLC performs the clear user memory operation, all the contents of the user memory become no-operation instructions.
(3)END (end command) indicates the end of the program. If the END instruction is not written at the end of the program, the PLC will execute from the first step to the last step of the user program memory no matter how long the actual user program is; if there is an END instruction, when the END is scanned, the execution of the program will end. This way Shorten the scan cycle. When debugging a program, you can insert several END instructions into the program to divide the program into several segments. After confirming that the previous program segments are correct, delete the END instructions in sequence until the debugging is completed.
Step instructions of FX series PLC
1. Stepping instructions (STL/RET)
Step instructions are instructions designed for sequential control. In the field of industrial control, many control processes can be implemented by sequential control. Using step instructions to achieve sequential control is both convenient to implement and easy to read and modify.
There are two stepping instructions in FX2N: STL (stepping contact instruction) and RET (stepping return instruction).
The STL and RET instructions can only have step functions in conjunction with the state device S. For example, STL S200 represents a normally open contact, which is called an STL contact. Its symbol in the ladder diagram is -|| ||-, and it does not have a normally closed contact. We use each state device S to record a work step. For example, STL S200 is valid (ON), then enter the step represented by S200 (similar to the main switch of this step), start to perform the work to be done in this stage, and judge to enter the next step. Whether the conditions of one step are met. Once the signal is ON at the end of this step, turn off S200 and enter the next step, such as step S201. The RET instruction is used to reset the STL instruction. After executing RET, it 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 called steps or states, and each state has different actions. When the transition conditions between two adjacent states are met, the transition will be realized, that is, the transition from the previous state to the next state will be executed. We often use state transition diagrams (function chart diagrams) to describe this sequential control process. Use state device S to record each state, and X is the transition condition. For example, when X1 is ON, the system changes from S20 state to S21 state.
Each step in the state transition diagram contains three contents: the content driven by this step, the transition condition and the conversion target of the instruction.
The step drives Y0. When X1 is effectively ON, the system changes from the S20 state to the S21 state. X1 is the conversion condition, and the conversion target is the S21 step.
3. Instructions for using step instructions
1) The STL contact is a normally open contact connected to the left busbar. When an STL contact is connected, the corresponding state is the active step;
2) The contact connected to the STL contact uses the LD or LDI instruction, and returns to the left bus only after RET is executed; 3) The STL contact can be driven directly or through other contacts to drive Y, M, S, T, etc. Components of coils;
4) Since the PLC only executes the circuit block corresponding to the active step, dual coil output is allowed when using STL instructions (the sequence program can drive the same coil multiple times in different steps);
5) MC and MCR instructions cannot be used in STL contact driven circuit blocks, but CJ instructions can be used; 6) STL instructions cannot be used in interrupt programs and subroutines.
- A simple door handle touch alarm circuit
- Introduction to the internal structure of the Delta winding motor
- A small improvement on the ordinary refrigerator motor starting circuit
- Motor control circuit for starting and running without phase loss
- Starting method of asynchronous motor with external frequency-sensitive resistor
- Design and principle analysis of practical electric curtain remote control device
- Design and production of wireless multi-location control switch circuit
- Amplitude and phase detection leakage protection device designed and manufactured using PIC16C711A
- Simple disconnection burglar alarm
- Using Waste Motors to Create Wind Turbines
- Paper tension control circuit
- CPU input and output and memory control circuit
- Haier KFR-25GW air conditioner control circuit schematic diagram
- Photoelectric output control circuit
- Bedside touch light detection control circuit
- Photoelectric detection output control circuit
- Range hood detection control circuit
- Intelligent iron control circuit
- Wiring b of PLC input and output terminals
- Wiring of PLC power supply part