Conditional jump instructions:
The instruction name, mnemonics, instruction codes, and program steps are as follows:
Program steps can be executed continuously or in pulses. CJ execution is 3 steps and CJ(P) is 1 step.
Instruction format:
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.
Note:
1. For T and C, if the timer or counter is in action when jumping, 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:
Instruction format:
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:
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:
Timed interrupt:
Program example:
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.
Previous article:A brief discussion on the PID control technology function of Siemens S7-1200PLC
Next article:Analysis of EMC interference and suppression technology in servo system
Recommended ReadingLatest update time:2024-11-16 13:33
- Popular Resources
- Popular amplifiers
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- ADC and DAC special study
- MicroPython drives Weixue 2.13-inch ink screen (electronic paper)
- IC1B logic probe circuit diagram
- ESP32-S2-Saola-1 running circuitpython(1)
- [2022 Digi-Key Innovation Design Competition] Multi-platform IoT Hazardous Gas Detection System Based on STM32F7508-DK
- "Recommended Chinese chips" + domestic high-precision ADC and ultrasonic measurement circuit
- [Hua Diao Experience] 18-line empty board lights up WS2812B's 256-bit LED hard screen
- JTAG does not recognize FPGA
- [SAMR21 new gameplay] 17. Download python firmware
- LLC circuit dead time