How to improve the operating efficiency of domestic PLCs and shorten the execution time to complete the same task. Let lower performance products complete higher performance processing requirements
1. When you can use a "word" (such as VW unit), try to avoid using a "double word" (VD unit). When you can use an integer, try to avoid using real numbers/floating point numbers.
2. Give priority to the use of surplus (other than hardware connections) IB, IW, ID, QB, QW, QD, followed by M and S;
3. Reduce unnecessary network scanning, and classify the networks that can be executed conditionally (especially AIW and AQW) into subroutines for conditional calls (such as timed interrupts);
4. Under the premise of ensuring process requirements, appropriately reduce the frequency of interruptions;
5. The subroutine should minimize the number of conditional judgments and standardize the subroutine import and export parameters to reduce code redundancy.
6. If SM0.0 is connected in series with other signals, it will only increase the program size and execution time, and will have no other effect (if the network already meets the required contacts on the left, there is no need to connect SM0.0 in series);
7. For subroutine calls with less input data, you can first determine whether the input data has changed. If there is no change (the comparison method can be referred to the 48th floor), you can directly skip the subroutine to reduce the scanning cycle.
8. Reasonable use of immediate IO instructions (minimize their use) can save the conversion time of domestic PLCs in processing immediate instructions.
9. Try to use calculation result memory instead of transition memory during calculation.
10. Avoid data type conversion. When necessary, use AC to store intermediate variables to reduce the number of conversions. Or reserve storage space when programming. For example, when using VW2 to store integers, leave VW0 empty and access the data in VW2 directly in the form of VD0.
11. Use the XOR instruction to implement the inversion of any bit (this instruction is slightly difficult and requires careful alignment during debugging);
12. For repetitive and time-consuming tasks, periodic processing should be adopted, including: allocating the initialization work to multiple cycles. Make the sampling time of multiple PID loops slightly different to avoid multiple interrupt calls in the same cycle, making the scanning cycle more uniform and stable.
13. Try to arrange the bit variables in the V area in V511.7, and arrange the frequently used VB/VW/VD variables in V4095, which can shorten the program scanning cycle.
14. When there is no need to share signals, multiple instructions placed in the same network will generate additional stack operations (which can be converted into STL for analysis), which will also increase the program size and execution time. The only benefit is that it is more compact in one network.
Previous article:Programming Skills of PLC in Automatic Tool Changing Process of Machining Center
Next article:Zero position of rotary encoder
Recommended ReadingLatest update time:2024-11-16 12:42
- 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
- Where can I get an evaluation board for Toshiba's rice-sized Bluetooth module?
- 16. Low-power intelligent TWS in-ear detection chip VK233DS, Shenzhen Yongjia Microelectronics is the first choice
- [Atria AT32WB415 Series Bluetooth BLE 5.0 MCU] PWM breathing light
- 30V8A stepper motor driver, step angle 1.8 degrees, required accuracy 0.1 degrees, should I choose chip or H bridge
- Can the 66AK2L06 SoC enable miniaturization of test and measurement equipment?
- Circuit diagram of leakage alarm automatic control socket
- How to detect mosquitoes using ultrasonic sensor circuit
- 2021 National College Student Electronics Competition Released
- Share the application manuals, library functions, routines and selection tables of the full range of MM32 MCU products of Lingdong Microelectronics
- 【Construction Monitoring and Security System】Work Submission Post