How do you program the overlapping of tags with the keyword "AT" in the STEP 7 (TIA Portal)?
You program overlapping of tags in the block interface of a function or function block.
You need the following to overlap tags with the keyword "AT".
- For S7-1200 at least STEP 7 (TIA Portal) V11.0+SP1+Update 2 (or higher) and firmware V2.0 (or higher).
- For S7-1500 at least STEP 7 (TIA Portal) V12 (or higher).
More information is available in the STEP 7 (TIA Portal) Online Help or in the manual under Overlapping tags with AT.
The example below shows how to access the separate bits of a tag of the Word data type with an Array of Bool.
- Create a function block.
"Optimized" block access is set by default for all newly created blocks of the S7-1200/S7-1500. S7-300/S7-400 blocks have "Standard" block access. If you use these blocks for the S7-1200/S7-1500, we recommend that you change block access to "Optimized" to ensure better performance. For this you open the Properties of the block and in the "Attributes" tab you enable the "Optimized block access" function.
- Open the block and block interface.
- In the declaration table you enter first the tag that you wish to overlap with a new data type. For example: Name: "statConveyor", Data type: "Word".
- Select the option "Set in IDB" from the drop-down menu of the "Retain" column.
- Mark the line with the tag to be overlapped and right-click.
- In the pop-up menu that opens you select "Add Line". You must declare the overlapping tag in the line directly under the tag to be overlapped.
- Enter the name of the tag in the added line, "statMotors", for example.
- In the "Data type" column you enter first just the letter "A" and wait until the window opens with the data types you can select.
This option is only possible for the "Standard" block access for functions and temporary tags. For this you must go to the Properties of the block and in the "Attributes" tab you disable the "Optimized block access" function.
- In the drop-down menu you select the keyword "AT" and then click in the "Name" column. In addition to the name of the tag ("statMotors", for example) the keyword with the tag to be overlapped is also displayed in the same field. In this example: AT "statConveyor".
- Click again in the "Data type" field and enter the declaration for the array, "Array[0..15] of Bool", for example.
Now the overlapping of the tags is completely declared and you can enter your program in the editor.
With some applications, it is necessary to group multiple signals in one control word or extract separate signals from a control word.
You can use the FB "BoolToWordAT" to group up to 16 bits in a word. The separate input tags of the Bool data type are assigned to the static "statMotors" array tag and overlapped with the keyword "AT" of the "statConveyor" tag. Then the content of the static "statConveyor" tag is transferred to the "conveyor" output tag.
Using the FB "WordToBoolAT" you can extract up to 16 signals (tags of the "Bool" data type) from a tag of the "Word" data type. The content of the "conveyor" input tag is transferred to the static "statConveyor" tag and overlapped with the keyword "AT" of the declared "statMotors" tag. Then the separate bits of the "statMotors" array tag are assigned to the output tags of the Bool data type.
These two functions are called and parameterized in OB1 "Main".
Copy the "57132240_KeywordAT_Lib_TIA_Portal.zip" file into a separate directory and then start the file with a double-click. The library now unpacks automatically with all the associated subdirectories. Then you can use STEP 7 (TIA Portal) to open and edit the library.
- Drag-and-drop the blocks "BoolToWordAT", "BoolToWordAT_DB", "WordToBoolAT", "WordToBoolAT_DB", "DB" and "Main" to the block folder.
- Drag the "Tags" into the "PLC tags" folder.
For the example described above we recommend programming via slice accesses to achieve even better performance with the S7-1500. More information about slice accesses is available in Entry ID: 57374718.
The download and screens in this FAQ response were created with STEP 7 (TIA Portal) V13+SP1.