Detailed explanation of how to use jump instructions in PLC programming

Publisher:忠正Latest update time:2023-07-26 Source: elecfansKeywords:PLC Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Conditional jump instructions:

The instruction name, mnemonics, instruction codes, and program steps are as follows:

e1c4037c-c9bc-11ed-bfe3-dac502259ad0.jpg

Program steps can be executed continuously or in pulses. CJ execution is 3 steps and CJ(P) is 1 step.

Instruction format:

e1df5b86-c9bc-11ed-bfe3-dac502259ad0.jpg

When we press X000, the program jump instruction starts to run, and the location where the program jumps is the location of the program pointer, which is label 10. Here we should note that the program pointer is written on the left side of the left bus. When we start the jump instruction, the X001 program will be skipped and not executed.


When X0 is ON, the program between the jump CJ command and the label is not executed. During the jump process, if Y, M, S are driven by OUT, SET, RST instructions to change the input, the state before the jump will remain. For example, after the jump occurs through X1 driving output Y10, even if X0 becomes ON during the jump process, the output Y10 is still valid.


Notice:

1. For T and C, if the timer or counter is in action when the jump occurs, the counting will be interrupted or stopped immediately, and the timing or counting will continue after the jump. However, the timers T192~T199 and high-speed counters C235~C255 in action will continue to work regardless of whether there is a jump or not.

2. Functional instructions are not executed during jump, except for PLSY, PLSR, and PWW instructions.

Subroutine call and return instructions:

The instruction name, mnemonics, instruction codes, and program steps are as follows:

e1f0998c-c9bc-11ed-bfe3-dac502259ad0.jpg

Instruction format:

e1ff666a-c9bc-11ed-bfe3-dac502259ad0.jpg

In the figure, FEND indicates the end of the main program. The program before FEND is called the main program, and the program after FEND is called the subprogram. SRET indicates the end of the subprogram, or the subprogram return. We should note that the program between FEND and SRET is called the first subprogram, and the program before the second SRET is called the second subprogram. When we press X001, the pointer is called to P11, and the program starts to execute from top to bottom from P11. When the first SRET is encountered, the program returns to the main program. However, if X002 is turned on in this program, the program pointer is called to P12, and the program starts to run from top to bottom. When the second SRET is encountered, the program returns to P12, and then returns to the main program when the first SRET is encountered. Because the P12 program is nested in the P11 program, we should note that this kind of program nesting can only use 5 levels at most in PLC.


Interrupt instruction:

There are 3 interrupt instructions in total. We use a table to explain them in detail:

e21b84da-c9bc-11ed-bfe3-dac502259ad0.jpg

Here, the main program is before FEND, and the interrupt subroutine is after FEND. Whether the interrupt subroutine can be carried out is related to the interrupt condition and the interrupt pointer, so here we have to tell you the format of the interrupt pointer:

Interrupt pointer:

e2353222-c9bc-11ed-bfe3-dac502259ad0.jpg

Timed interrupt:

e2467230-c9bc-11ed-bfe3-dac502259ad0.jpg

Program example:

e254c826-c9bc-11ed-bfe3-dac502259ad0.jpg

Let us first introduce this program to you: the program before FEND indicates the main program, the one after it indicates the interrupt subroutine, EI indicates interrupt enable, IRET indicates interrupt return instruction, I610 pointer indicates that the interrupt time is 10mm, and 6 indicates the highest interrupt level.


When we press X000, the data of K1 is transferred to D1, the data of K255 is transferred to D2, M1 is set and turned on, and the interrupt subroutine runs. RAMP means ramp instruction, which means generating a data D3, and the range of D3 is from D1 to D2, that is, from 1 to 255. Since this is a timed interrupt program, when M1 is turned on, the program is interrupted every 10ms. K1000 means 1000 scan cycles, because the range of D3 is from 1 to 255, and it takes 1000 10ms, that is, the time from X0 turning on to D3 becoming 255 is 1000X10ms=10 seconds. When D3 is equal to 255, M8029 is turned on, M1 is reset and disconnected, and then the interrupt instruction and ramp instruction are disconnected, and then the program returns when the IRET instruction is encountered.


Keywords:PLC Reference address:Detailed explanation of how to use jump instructions in PLC programming

Previous article:Summary of Common Programming Instructions for Siemens S7-200 SMART PLC
Next article:10 major control methods of frequency converter and their development direction

Recommended ReadingLatest update time:2024-11-17 01:39

How to implement free port communication with Siemens S7-1200 compact PLC
Siemens S7-1200 compact PLC is widely used in the current market. Due to its high cost performance, it is often used as a controller for small automation control equipment, which also makes it often communicate with third-party devices (scanners, printers, etc.). Because there is no third-party device, here we take
[Embedded]
How to implement free port communication with Siemens S7-1200 compact PLC
Communication and programming of Mitsubishi PLC, with practical examples
Mitsubishi FX series PLC is Mitsubishi's basic PLC. There are several common ways of communication between them, which are as follows: CC-LINK, N:N network connection, and parallel connection. 1. CC-LINK connection The CC-LINK connection diagram is as follows: The corresponding PLCs can
[Embedded]
Communication and programming of Mitsubishi PLC, with practical examples
Guoxin Sichen | PLC solution based on HME-M7 and domestic ferroelectric memory PB85RS2MC
PLC generally refers to a programmable logic controller (programmable control device), which is a digital operation electronic system designed specifically for use in industrial environments. It uses a programmable memory to store instructions for performing logical operations, sequential control, timing, counting a
[Embedded]
Guoxin Sichen | PLC solution based on HME-M7 and domestic ferroelectric memory PB85RS2MC
How to add modules to Mitsubishi PLC programming software FX2N PLC
Mitsubishi Electric's FX2N series PLC is a small, high-performance programmable logic controller that is widely used in industrial automation. FX2N PLC supports a variety of expansion modules, including input/output modules, analog modules, special function modules, etc. This article will detail how to add modules t
[Embedded]
Configuration example of connecting a soft starter to a PLC via a ModbusRTU to Profinet gateway
In the sewage treatment system, the ModbusRTU to Profinet gateway can be used to connect the PLC and the inverter to achieve communication between the two. It effectively improves the work efficiency in the production process and provides more convenience and flexibility for the production process. This case is a co
[Embedded]
Configuration example of connecting a soft starter to a PLC via a ModbusRTU to Profinet gateway
Configuration of Modbus to Ethernet/IP gateway module and Inovance PLC communication in gateway configuration software
Through the Modbus to Ethernet/IP gateway module (XD-MDEP100), interconnection between different protocols can be achieved, making data exchange between devices more convenient and efficient. As a slave station of the ETHERNET/IP network, the gateway can connect to PLCs of brands such as AB (Rockwell), Omron, Keyenc
[Embedded]
Configuration of Modbus to Ethernet/IP gateway module and Inovance PLC communication in gateway configuration software
PLC/DCS control system interference types and phenomena
Abstract: PLC/DCS control systems often encounter interference problems during actual operation, causing field instrument failures, abnormal analog display, and unstable data. Signal isolators can control external interference and have voltage and current limiting functions for lower-level equipment, thereby protect
[Embedded]
PLC/DCS control system interference types and phenomena
Design of control system for modular machine tools based on PLC
1 Introduction Programmable Controller ( PLC ) is a new type of industrial automatic control device developed based on microprocessor, integrating modern technologies such as computer technology, automatic control technology and communication technology. It has powerfu
[Power Management]
Design of control system for modular machine tools based on PLC
Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号