Talk about the function of optimizing block access in S7-1200/1500 series PLC

Publisher:Serendipitous33Latest update time:2024-03-28 Source: elecfansKeywords:S7-1200  PLC Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

009e99ae-5cc2-11ee-939d-92fbcf53809c.png

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:

00cb5890-5cc2-11ee-939d-92fbcf53809c.png

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:

00de4b94-5cc2-11ee-939d-92fbcf53809c.png

② 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:

00f525e4-5cc2-11ee-939d-92fbcf53809c.png

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;


Keywords:S7-1200  PLC Reference address:Talk about the function of optimizing block access in S7-1200/1500 series PLC

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

Specific application of Modbus485 to profinet gateway to connect servo spindle drive and PLC
The PN controller communicates with the INVT server through the Kaijiang intelligent Modbus485 to profinet gateway. This communication method greatly simplifies the control process in the industrial automation system. This case is a configuration case of connecting the INVT DriveServo200 series servo spindle driver
[Embedded]
Specific application of Modbus485 to profinet gateway to connect servo spindle drive and PLC
How do multiple PLCs exchange signals?
A common concept in industrial control systems: hard-wired exchange of signals and communication between different devices. In some large-scale smart factories, one or more large PLCs are usually used to form the processing core. All important equipment needs to be controlled by this unified core. The advantage
[Embedded]
How do multiple PLCs exchange signals?
A brief discussion on the method of controlling the frequency converter by Mitsubishi FX series PLC communication method
This article introduces a very simple method of controlling the frequency converter by Mitsubishi FX series PLC communication: it only requires installing an RS-485 communication board or hanging an RS-485 communication module on the PLC host; embedding a "function expansion storage box" costing only a few hundred y
[Embedded]
A brief discussion on the method of controlling the frequency converter by Mitsubishi FX series PLC communication method
The difference and connection method between PLC ladder diagram and relay contactor circuit diagram
The PLC ladder diagram is a circuit diagram used to program a programmable logic controller (PLC). It is mainly a logical operation sequence diagram of a control system based on logic functions. It uses graphical symbols to represent electrical components. Each line represents a logical relationship. Through the com
[Embedded]
Which one has higher technology content, PLC or DCS
The decision between a programmable logic controller (PLC) and a distributed control system (DCS) depends on the specific situation, because different applications have different requirements for the control system. Let's take a look. PLC 1. From switch quantity control to sequence control and transp
[Embedded]
Which one has higher technology content, PLC or DCS
8 common error types when PLC presents abnormal alarm
With the continuous development of science and technology, mainstream PLCs now have self-diagnosis functions. However, the skill of PLC repair lies in making full use of this function for analysis and then accurately locating the problem. Therefore, we have sorted out 8 common error types that PLC repair personnel n
[Embedded]
What is the function of adding filter to PLC control power supply?
The electrician in the front row asked: In many of my projects, I used Siemens 24V PLC and Mean Well DC switching power supply, and I never used filters. But I, like many other colleagues, particularly like to use a power filter, and I don’t understand the significance of this, especially in the cont
[Embedded]
What is the function of adding filter to PLC control power supply?
What is the working principle and structure of PLC
PLC is the abbreviation of Programmable Logic Controller. It is a digital computer used in automated control systems, usually in industrial automation, robot control, process control and other fields. PLC is highly programmable and flexible, and different programs can be written according to different application re
[Embedded]
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号