How structured PLC variables work

Publisher:AngelicWhisperLatest update time:2024-08-06 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Using structured PLC tags (S7-1200 V4 and higher / S7-1500)

To make it easier to view the program content, several input/output addresses can be grouped in a higher-level PLC tag. A higher-level PLC tag is a structure that contains several logically related inputs/outputs. When a block is called, the higher-level tag is transferred first, and then only the input/output parameters of all related inputs/outputs are required.


How it works

To create a structured PLC variable, you first need to define a PLC data type (UDT). In this data type, declare the required data elements and specify their names and data types.

Then, switch back to the PLC tag table and specify the higher-level PLC tag there. Select the PLC data type as the data type for the tag. Starting from the start address of the higher-level tag, the system will now reserve a certain number of input or output addresses. The number of reserved addresses depends on the length of the PLC data type.

If you call a block and the block needs to use reserved inputs or outputs during program execution, you can pass a higher-level variable as a block parameter.

Individual PLC tags are addressed in the same way as structure elements in the program code.

In the following sections, each processing step will be described in detail:

Application Examples

To group the inputs or outputs of a function module, you can use structured PLC tags. The following figure shows the semantic representation of Motor: In the "Datatype_Motor" PLC data type, an element is created for each of the three inputs.

However, the memory areas of the declared variables cannot overlap. In this example, the "Speed" component has the data type "Integer" and must therefore start with a word address. Therefore, the first input word will be filled with the "Dummy" filler variable. This means that "Speed" is in the second input word.

3c45e5e2-1ec5-11ee-962d-dac502259ad0.png

The following figure shows a higher-level "Motor" PLC tag based on the "Data type_Motor" data type. By declaring "Motor", the addresses IW0 and IW1 are reserved on the input module.

3c7250fa-1ec5-11ee-962d-dac502259ad0.png

The following figure shows how the "Motor" PLC tag is transferred as an input parameter of the "Motor_Control" block.

3c84c564-1ec5-11ee-962d-dac502259ad0.png

The individual members of this tag can be addressed in the "Motor_Control" block.

Addressing illustrate
"Motor" Addressing of higher-level PLC tags.
"Motor".On Addressing members of structured PLC tags.
"Motor".On:P Addressing I/O input or output (PI or PQ).

Rules for using structured PLC variables

Considerations to follow when creating and using structured PLC tags.

Structured PLC tags are available in the "Inputs" and "Outputs" operand areas.

Structured variables cannot be used in bit memory address areas.

Structured PLC tags cannot be addressed from the HMI.

Creating structured PLC variables

rule

When creating structured PLC tags, follow these rules:

For the "Inputs" and "Outputs" operand areas, different PLC data types are used.

Structured variables cannot be used in bit memory address areas.

Do not group inputs or outputs of different modules in PLC data types, as a synchronous update of the process images of the modules cannot be ensured.

step

To create a structured PLC tag, follow these steps:

In the project tree, double-click the command "Add new data type" in the "PLC data types" folder.
This creates and opens a new declaration table for creating a PLC data type.
Declare all required elements as PLC types. You can use all data types except the "STRING" and "WSTRING" data types.
Select the PLC data type in the project tree and select the command "Compile > Software (only changes)" in the shortcut menu.
The PLC data type is compiled and then used in the PLC tag table.
Even if you make changes to existing PLC data types, you must recompile the program. This will update all locations where the PLC data type is used.
Open a PLC tag table in the same CPU.
Declare a new tag or select an existing tag.
In the "Data type" column, select the PLC data type and assign it to the PLC tag.
The PLC tag adopts the structure of the PLC data type. A corresponding address is automatically assigned. Structured PLC tags always start with a word address.



Reference address:How structured PLC variables work

Previous article:Things about PWM modulation
Next article:Parameters of POINTER type in Siemens TIA Portal

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号