Siemens and Mitsubishi PLC Programming Instructions

PointSiemens and Mitsubishi PLC Programming Instructions“Jinan CNC Mold Technology Research Institute” focuses on

Industry frontier, mechanical videos, CNC processing technology, 3D printing, industrial robots, productioncrafts, molds, machine tools, and other cutting-edge information are waiting for you here!

Siemens PLC Programming Instructions

1. Bit Logic Instructions

1.1 -||- Normally Open Contact (Address)1.2 -|/|- Normally Closed Contact (Address)1.3 XOR Bit Exclusive OR1.4 -|NOT|- Signal Flow Inversion1.5 -( ) Output Coil1.6 -(#)- Intermediate Output1.7 -(R) Coil Reset1.8 -(S) Coil Set1.9 RS Reset Set Trigger1.10 RS Set Reset Trigger1.11 -(N)- RLO Falling Edge Detection1.12 -(P)- PLO Rising Edge Detection1.13 -(SAVE) Save RLO to BR Memory1.14 MEG Address Falling Edge Detection1.15 POS Address Rising Edge Detection

2. Comparison Instructions2.1 CMP?I Integer Comparison2.2 CMP?D Double Integer Comparison2.3 CMP?R Real Number Comparison

3. Conversion Instructions3.1 BCD_IBCD Code Conversion to Integer3.2 I_BCD Integer Conversion toBCD Code3.3 I_DINT Integer Conversion to Double Integer3.4 BCD_DIBCD Code Conversion to Double Integer3.5 DI_BCD Double Integer Conversion to BCD Code3.6 DI_REAL Double Integer Conversion to Floating Point3.7 INV_I Integer’s Binary Complement3.8 INV_DI Double Integer’s Binary Complement3.9 NEG_I Integer’s Binary Two’s Complement3.10 NEG_DI Double Integer’s Binary Two’s Complement3.11 NEG_R Floating Point Negation3.12 ROUND Round to Double Integer3.13 TRUNC Truncate to Integer3.14 CEIL Round Up3.15 FLOOR Round Down

4. Counter Instructions4.1 S_CUD Increment/Decrement Counter4.2 S_CU Increment Counter4.3 S_CD Decrement Counter4.4 -(SC) Set Initial Value for Counter4.5 -(CU) Increment Counter Coil4.6 -(CD) Decrement Counter Coil

5. Data Block Instructions5.1 -(OPN) Open Data Block: DB or DI

6. Logic Control Instructions6.1 -(JMP) Unconditional Jump6.2 -(JMP) Conditional Jump6.3 -(JMPN) Jump if Not6.4 LABEL Label

7. Integer Arithmetic Operation Instructions7.1 ADD_I Integer Addition7.2 SUB_I Integer Subtraction7.3 MUL_I Integer Multiplication7.4 DIV_I Integer Division7.5 ADD_DI Double Integer Addition7.6 SUB_DI Double Integer Subtraction7.7 MUL_DI Double Integer Multiplication7.8 DIV_DI Double Integer Division 7.9 MOD_DI Return Remainder of Double Integer

8. Floating Point Arithmetic Operation Instructions

8.1 Basic Instructions8.1.1 ADD_R Real Number Addition8.1.2 SUB_R Real Number Subtraction8.1.3 MUL_R Real Number Multiplication8.1.4 DIV_R Real Number Division8.1.5 ABS Floating Point Absolute Value Operation

8.2 Extended Instructions8.2.1 SQR Floating Point Square8.2.2 SQRT Floating Point Square Root8.2.3 EXP Floating Point Exponential Operation8.2.4 LN Floating Point Natural Logarithm Operation8.2.5 SIN Floating Point Sine Operation8.4.6 COS Floating Point Cosine Operation8.2.7 TAN Floating Point Tangent Operation8.2.8 ASIN Floating Point Arcsine Operation8.2.9 ACOS Floating Point Arccosine Operation8.2.10ATAN Floating Point Arctangent Operation

9. Assignment Instructions9.1 MOVE Assignment

10. Program Control Instructions10.1 -(Call) Call FC/SFC from Coil (No Parameters)10.2 CALL_FB Call FB from Block10.3 CALL_FC Call FC from Block10.4 CALL_SFB Call SFB from Block10.5 CALL_SFC Call SFC from Block10.6 -(MCR<) Main Control Relay On10.7 -(MCR>) Main Control Relay Off10.8 -(MCRA) Main Control Relay Start10.9 -(MCRD) Main Control Relay Stop10.10 -(RET) Return

11. Shift and Loop Instructions

11.1 Shift Instructions11.1.1 SHR_I Integer Right Shift11.1.2 SHR_DI Double Integer Right Shift11.1.3 SHL_W Word Left Shift11.1.4 SHR_W Word Right Shift11.1.5 SHL_DW Double Word Left Shift11.1.6 SHR_DW Double Word Right Shift

11.2 Loop Instructions11.2.1 ROL_DW Double Word Left Rotate11.2.2 ROR_DW Double Word Right Rotate

12. Status Bit Instructions12.1 OV -||- Overflow Exception Bit12.2 OS -||- Storage Overflow Exception Bit12.3 UO -||- Disorder Exception Bit12.4 BR -||- Exception Bit Binary Result12.5 ==0-||- Result Bit Equals “0”12.6 <>0-||- Result Bit Not Equal “0”12.7 >0-||- Result Bit Greater Than “0”12.8 <0-||- Result Bit Less Than “0”12.9 >=0-||- Result Bit Greater Than or Equal to “0”12.10 <=0-||- Result Bit Less Than or Equal to “0”

13. Timer Instructions13.1 S_PULSE Pulse S5 Timer13.2 S_PEXT Extended Pulse S5 Timer13.3 S_ODT On Delay S5 Timer13.4 S_ODTS Retentive On Delay S5 Timer13.5 S_OFFDT Off Delay S5 Timer13.6 -(SP) Pulse Timer Coil13.7 -(SE) Extended Pulse Timer Coil13.8 -(SD) On Delay Timer Coil13.9 -(SS) Retentive On Delay Timer Coil13.10 -(SF) Off Delay Timer Coil

14. Word Logic Instructions14.1 WAND_W Word AND Operation14.2 WOR_W Word OR Operation14.3 WAND_DW Double Word AND Operation14.4 WOR_DW Double Word OR Operation14.5 WXOR_W Word XOR Operation14.6 WXOR_DW Double Word XOR Operation

Mitsubishi FX Series PLC Basic Logic Instructions

Input and Output Instructions (LD/LDI/LDP/LDF/OUT) (1) LD (Input Instruction) An instruction that connects a normally open contact to the left bus, each logical line starting with a normally open contact uses this instruction.

(2) LDI (Input Inversion Instruction) An instruction that connects a normally closed contact to the left bus, each logical line starting with a normally closed contact uses this instruction.

(3) LDP (Rising Edge Input Instruction) An instruction that detects the rising edge of a normally open contact connected to the left bus, only activates for one scan cycle when the specified element’s rising edge occurs (from OFF to ON).

(4) LDF (Falling Edge Input Instruction) An instruction that detects the falling edge of a normally closed contact connected to the left bus.

(5) OUT (Output Instruction) An instruction that drives the coil, also known as the output instruction.

Usage Instructions for Input and Output Instructions: 1) LD and LDI instructions can be used for contacts connected to the left bus and can also be combined with ANB and ORB instructions to achieve block logic operations;

2) LDP and LDF instructions only maintain activation for one scan cycle when the corresponding element is valid.

3) The target elements for LD, LDI, LDP, and LDF instructions are X, Y, M, T, C, S; 4) The OUT instruction can be used continuously several times (equivalent to parallel coils), for timers and counters, a constant K or data register should be set after the OUT instruction.

5) The target elements for 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) An instruction that connects normally open contacts in series to complete the logical “AND” operation. (2) ANI (AND NOT Instruction) An instruction that connects normally closed contacts in series to complete the logical “AND NOT” operation. (3) ANDP Rising edge detection series connection instruction. (4) ANDF Falling edge detection series connection instruction.

Siemens and Mitsubishi PLC Programming Instructions

Usage Instructions for Contact Series Instructions: 1) AND, ANI, ANDP, ANDF are all instructions for connecting single contacts in series, with no limit on the number of series connections, can be reused. 2) The target elements for AND, ANI, ANDP, ANDF are X, Y, M, T, C, and S. 3) After the OUT M101 instruction, driving Y4 through the T1 contact is called continuous output.

Contact Parallel Instructions (OR/ORI/ORP/ORF) (1) OR (OR Instruction) Used for a single normally open contact in parallel to achieve logical “OR” operation. (2) ORI (OR NOT Instruction) Used for a single normally closed contact in parallel to achieve logical “OR NOT” operation. (3) ORP Rising edge detection parallel connection instruction. (4) ORF Falling edge detection parallel connection instruction.

Usage Instructions for Contact Parallel Instructions: 1) OR, ORI, ORP, ORF instructions are all for parallel connections of single contacts, with the left end of the parallel contacts connected to LD, LDI, LDP or LPF, and the right end connected to the corresponding right end of the previous instruction’s contact. The number of times contact parallel instructions can be used continuously is unlimited;

2) The target elements for OR, ORI, ORP, ORF instructions are X, Y, M, T, C, S.

Block Operation Instructions (ORB / ANB) (1) ORB (Block OR Instruction) Used for parallel connection between two or more series-connected circuits.

Usage Instructions for ORB Instruction: 1) When several series circuit blocks are connected in parallel, each series circuit block should start with LD or LDI instruction;

2) When there are multiple parallel circuit blocks, if using ORB instruction for each block, there is no limit to the number of parallel blocks;

3) The ORB instruction can also be used continuously, but this programming style is not recommended, the number of LD or LDI instruction uses should not exceed 8 times, meaning ORB can only be used continuously below 8 times.

(2) ANB (Block AND Instruction) Used for series connection between two or more parallel-connected circuits.

Usage Instructions for ANB Instruction: 1) When parallel circuit blocks are connected in series, the start of the parallel circuit blocks should use LD or LDI instruction;

2) When multiple parallel circuit blocks are connected in order and in series with the previous circuit, there is no limit to the number of times ANB instruction can be used. ANB can also be used continuously, but like ORB, the number of uses should be below 8.

Set and Reset Instructions (SET/RST) (1) SET (Set Instruction) Its function is to set the target element and maintain it.

(2) RST (Reset Instruction) Resets the target element and maintains it in a zero state. The usage of SET and RST instructions, when the normally open X0 is connected, Y0 becomes ON and remains in that state, even if X0 is disconnected, Y0’s ON state still remains unchanged; only when the normally open X1 is closed, Y0 becomes OFF and remains, even if X1 is disconnected, Y0 is still OFF.

Usage Instructions for SET and RST Instructions: 1) The target elements for SET instructions are Y, M, S, and for RST instructions are Y, M, S, T, C, D, V, Z. RST instructions are often used to reset the contents of D, Z, V, and to reset accumulated timers and counters.

2) For the same target element, SET and RST can be used multiple times, and the order can be arbitrary, but the last executor is effective.

Differential Instructions (PLS/PLF) (1) PLS (Rising Edge Differential Instruction) Generates a one-scan-cycle pulse output on the rising edge of the input signal

(2) PLF (Falling Edge Differential Instruction) Generates a one-scan-cycle pulse output on the falling edge of the input signal. The differential instructions detect the edges of the signal and control the state of Y0 through set and reset commands.

Usage Instructions for PLS and PLF Instructions: 1) The target elements for PLS and PLF instructions are Y and M;

2) When using PLS, the target element is ON only for one scan cycle after the driving input is ON, M0 is only ON for one scan cycle when the normally open contact of X0 changes from OFF to ON; when using PLF instruction, it only drives using the falling edge of the input signal, other uses are the same as PLS.

Main Control Instructions (MC/MCR)

1) MC (Main Control Instruction) Used for connecting common series contacts. After executing MC, the left bus moves behind the MC contact.

2) MCR (Main Control Reset Instruction) It is the reset instruction of the MC instruction, that is, using the MCR instruction to restore the original position of the left bus.

In programming, it often occurs that multiple coils are controlled by one or a group of contacts, if the same contacts are inserted into the control circuit of each coil, it will occupy many storage units, using main control instructions can solve this problem.

MC, MCR instructions use MC N0 M100 to achieve left bus right shift, making Y0, Y1 controlled by X0, where N0 indicates the nesting level, in a non-nested structure, the usage of N0 is unlimited; using MCR N0 to restore to the original left bus state. If X0 is disconnected, it will skip the instructions between MC and MCR and execute downwards.

Usage Instructions for MC and MCR Instructions: 1) The target elements for MC and MCR instructions are Y and M, but cannot use special auxiliary relays. MC occupies 3 program steps, MCR occupies 2 program steps;

2) The main control contact is vertical to the general contact in the ladder diagram. The main control contact is a normally open contact connected to the left bus, which is the master switch controlling a group of circuits. Contacts connected to the main control contact must use LD or LDI instructions.

3) When the input contacts of the MC instruction are disconnected, the accumulated timers, counters, and elements driven by reset/set instructions within the MC and MCR will maintain their previous states unchanged. Non-accumulated timers and counters, elements driven by OUT instructions will reset, when X0 is disconnected, Y0 and Y1 will become OFF.

4) If another MC instruction is used within an MC instruction area, it is called nesting. The maximum nesting level is 8, numbered in increasing order from N0 to N7, each level’s return uses the corresponding MCR instruction, starting to reset from the larger numbered nested level.

Stack Instructions (MPS/MRD/MPP) Stack instructions are new basic instructions added in the FX series, used for multiple output circuits, bringing convenience to programming. In the FX series PLC, there are 11 storage units specifically used to store intermediate results of program calculations, referred to as stack memory. (1) MPS (Push Instruction) Sends the calculation result into the first segment of the stack memory, while moving previously sent data to the next segment of the stack. (2) MRD (Read Stack Instruction) Reads the first segment of data from the stack memory (the last data pushed) and keeps that data in the first segment of the stack memory, the data in the stack does not move. (3) MPP (Pop Instruction) Reads the first segment of data from the stack memory (the last data pushed) and that data disappears from the stack, while the other data in the stack moves up sequentially.

Usage Instructions for Stack Instructions: 1) Stack instructions have no target elements;

2) MPS and MPP must be used in pairs;

3) Since there are only 11 stack memory units, the stack can have a maximum of 11 levels.

Logic Inversion, No Operation and End Instructions (INV/NOP/END) 1) INV (Inversion Instruction) Executes this instruction to invert the original calculation result. The usage of the inversion instruction is as shown in the figure, if X0 is disconnected, then Y0 is ON, otherwise Y0 is OFF. When using, note that INV cannot be connected to the bus like the LD, LDI, LDP, LDF instructions in the instruction table, nor can it be used alone like the OR, ORI, ORP, ORF instructions in the instruction table.

2) NOP (No Operation Instruction) Does not perform any operation but occupies a program step. When executing NOP, nothing is done, sometimes NOP instruction can short-circuit certain contacts or cover unnecessary instructions. When the PLC executes the clear user memory operation, the contents of the user memory all become no operation instructions.

3) END (End Instruction) Indicates the end of the program. If the last program does not write the END instruction, the PLC will execute from the first step of the user program storage to the last step regardless of the actual length of the user program; if there is an END instruction, when scanning to END, the program execution ends, which can shorten the scan cycle. During program debugging, several END instructions can be inserted into the program to divide the program into several segments, and after confirming that the previous program segment is correct, delete the END instructions one by one until debugging is complete.

FX Series PLC Step Instructions1. Step Instructions (STL/RET) Step instructions are designed for sequential control. Many control processes in industrial control can be implemented using sequential control, and using step instructions for sequential control is both convenient to implement and easy to read and modify.

In FX2N, there are two step instructions: STL (Step Contact Instruction) and RET (Step Return Instruction).

STL and RET instructions can only have stepping functionality when used with status devices S. For example, STL S200 indicates a status normally open contact, referred to as an STL contact, its symbol in the ladder diagram is -|| ||-, it does not have normally closed contacts. We use each status device S to record a step, for example, when STL S200 is effective (ON), it enters the step represented by S200 (similar to the master switch of this step), starts to execute the work that should be done in this phase, and checks whether the conditions for entering the next step are met. Once the end of this step signal is ON, S200 is turned off to enter the next step, such as step S201. The RET instruction is used to reset the STL instruction. After executing RET, it returns to the bus, exiting the stepping state.

2. State Transition Diagram A sequential control process can be divided into several phases, also called steps or states, each state has different actions. When the transition conditions between adjacent two states are met, the transition is realized, that is, from the previous state to the next state execution. We often use state transition diagrams (function block diagrams) to describe this sequential control process. Use status devices S to record each state, X for transition conditions. For example, when X1 is ON, the system transitions from state S20 to state S21.

Each step in the state transition diagram contains three contents: the content driven by this step, the transition condition, and the target of the instruction transition.

Step drives Y0, when X1 is valid (ON), the system transitions from state S20 to state S21, X1 is the transition condition, and the target of the transition is step S21.

3. Usage Instructions for Step Instructions

1) STL contacts are normally open contacts connected to the left bus, when a certain STL contact is connected, the corresponding state is the active step;

2) The contacts connected to the STL contact should use LD or LDI instructions, and only return to the left bus after executing RET;

3) STL contacts can directly drive or drive coils of elements Y, M, S, T, etc. through other contacts;

4) Since the PLC only executes the circuit block corresponding to the active step, using STL instructions allows dual coil outputs (the sequential control program can drive the same coil multiple times in different steps);

5) Circuit blocks driven by STL contacts cannot use MC and MCR instructions, but CJ instructions can be used;

6) STL instructions cannot be used in interrupt programs and subprograms.

Siemens and Mitsubishi PLC Programming Instructions

Scan the QR code in the image to follow this public account

Siemens and Mitsubishi PLC Programming Instructions
Jinan CNC Mold Technology Research Institute

The pre-employment training base for college graduates——Jinan CNC Mold Technology Research Institute has mainly carried outCAD/CAM Advanced Programming, UG Five-axis Programming, CNC Machine Maintenance, Injection Mold Design, Stamping Mold Design, Reverse Modeling, Industrial Robots, 3D Printing, etc. pre-employment training. Once registered, lifelong learning, during the training period, teachers use phased testing to fully control students’ learning progress, small class teaching, one-on-one tutoring, combining theory and practice, until learned, and after completion, free job placement recommendation. The research institute has long provided technical support and employment services for students. All teachers and students of Jinan CNC Mold Technology Research Institute welcome your visit and study, the research institute is currently located at20333 Panwang Road, Shengjing Street, Zhangqiao District, Jinan City.

Consultation Hotline: 0531-85708996

Leave a Comment