Siemens S7-1200/1500 series PLC supports optimized block access. It is usually understood that data blocks (DB) have this function.
In fact, in addition to data blocks, organization blocks, function blocks and functions also have this function.
In the TIA Portal environment, when you create these four types of program organization units, their properties are all checked by default with "optimized block access".
In this article, let's talk about this function in detail.
1. Data Block (DB)
Create a new data block in the TIA Portal environment. In its properties, you can see that "Optimized block access" is checked, as shown in the following figure:
The optimized data blocks have the following characteristics:
① The variables in the data block can only be accessed in a symbolic manner (absolute address access is not supported). For example, if the name of an optimized data block is "optDB" and there is a start variable inside it, the access syntax is:
"optDB".start
Note: The double quotes around optDB are automatically added, indicating that this is a global variable; if the pound sign (#) is added, it means that it is a local variable;
To illustrate the difference in storage strategy between standard data blocks and optimized data blocks, let's take an example. Suppose variables are stored in the following order:
start: Boolean;
speed: real number type;
stop: Boolean;
For standard data blocks, variables are stored using absolute addresses (in bytes). The first Boolean variable occupies one byte (B0, although it actually only uses one bit).
The second variable is a real number and is stored starting from an even address, so its starting address is B2, occupying 4 bytes (B2~B5); the third variable is a Boolean type and occupies one byte (B6).
It can be seen that under this storage strategy, these three variables occupy 7 bytes of storage space.
Of course, if the order is adjusted and the two Boolean variables are put together, one byte of space will be saved, but this requires the programmer to be familiar with its storage strategy.
In the case of multiple data types, manual optimization of storage is often laborious and difficult to achieve the desired effect.
The optimized data block helps us solve this problem. It will automatically store variables of the same type together to maximize the use of storage space. The comparison between the two is shown in the figure below:
② The optimized data block can set the retention attribute for the variables in it separately, while the standard data block either retains all or cancels all retention;
③For S7-1200, the optimized data blocks adopt a storage priority strategy (because its data space is relatively small); for S7-1500, the optimized data blocks adopt an access priority strategy (because its data space is relatively large, in order to improve the access rate);
2. Organization block (OB)
Optimized the startup information.
After optimization, the organization block has only a few startup information. For example, after optimization, the Startup organization block has only two startup information, as shown in the following figure:
3. Function Block (FB)
① Optimize its background data block, similar to the optimization of data blocks;
② Complex variables can be addressed through symbols;
4. Function (FC)
①Optimize the use of temporary variables and initialize them before each block call;
② Complex variables can be addressed through symbols;
Previous article:30 Basic Knowledge of Frequency Converter (Part 2)
Next article:Diagram of the control circuit of the motor's inching and continuous operation
Recommended ReadingLatest update time:2024-11-16 09:49
- 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
- Chip Manufacturing: A Practical Tutorial on Semiconductor Process Technology (Sixth Edition)
- CircuitPython 6.0.0 Beta 2 released
- July 21 Live Replay: Microchip Timberwolf Audio Processor Online Seminar (including video, PPT, QA)
- MSP430 FAQ: FLASH storage
- [RISC-V MCU CH32V103 Review] Driving OLED Display
- Experience in using TI DSP/BIOS and CCS
- Four-layer PCB proofing matters needing attention
- Why your 4.7uF capacitor becomes 0.33uF, it's incredible!
- Industry 4.0 has a bright future, but the road is tortuous. Download the "Fluke Industrial Automation Industry Application Product Manual" to learn more!
- The relationship between capacitance and frequency