How do you program the overlapping of tags with the keyword "AT" in the TIA Portal V11?
With the "AT" keyword you can overlap a declared tag with another declaration if, for example, you want to access the separate bits of a tag of the Word data type with an Array of Bool. The processing time of this configuration is significantly shorter than with the data type conversion in earlier versions of STEP 7.
You need the following to overlap tags with the keyword "AT".
- S7-1200 at least STEP 7 (TIA Portal) V11.0+SP1+Update 2 (or higher) and the firmware version V2.0 (or higher).
- S7-1500 at least STEP 7 (TIA Portal) V12 (or higher).
- In STL, LAD, FBD and GRAPH it is possible to overlap in S7-1200 and S7-1500.
- In SCL it is possible to overlap in all CPU families.
- It is possible to overlap tags in the following blocks:
In code blocks with standard access.
In code blocks with optimized access for tags with Retain setting set to "Set in IDB".
- The data width of the overlapping tag must be equal to or less than the tag that is overlapped.
- You cannot overlap the VARIANT and INSTANCE data types.
- You cannot overlap blocks from libraries that are declared as parameters in the interface.
- You cannot overlap structured PLC tags that are declared as parameters in the interface.
You program overlapping of tags in the block interface of a function or function block. Proceed as described in the table below to declare the tags.
|1||Create a function or function block. You have two methods of overlapping tags with the code word "AT" in the block interface:
|2||Open the block and block interface.
|3||In the declaration table you enter first the tag that you wish to overlap with a new data type.
|4||Select the option "Set in IDB" from the drop-down menu of the "Retain" column.
|5||Mark the line with the tag to be overlapped and right-click.|
|6||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.|
|7||Enter the name of the tag in the added line.
|8||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.|
|9||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 ("t_bool", for example) the keyword with the tag to be overlapped is also displayed in the same field.
|10||Click again in the "Data type" field and enter the declaration for the array.
Now the overlapping of the tags is completely declared and you can enter your program in the editor.
With some applications, it might be necessary in STEP 7 to group multiple signals in one control word or extract separate signals from a control word. The "STEP7_V11_AT_KeyWord.zip" download attached includes a STEP 7 V11 program with which you can group signals (tags of the "Bool" data type) in a tag of the "Word" data type and extract them again. The following blocks are contained in the STEP 7 program:
Description of the "FC_Bool_to_Word_AT" function
You can use the "FC_Bool_to_Word_AT" function to group up to 16 bits in a word. The separate input tags of the Bool data type are assigned to the temporary "t_bool" array tag and overlapped with the keyword "AT" of the "t_word" tag. Then the content of the temporary "t_word" tag is transferred to the "SaveWord" output tag.
Description of the "FC_Word_to_Bool_AT" function
Using the "FC_Word_to_Bool_AT" function 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 "I_Word" input tag is transferred to the temporary "t_word" tag and overlapped with the keyword "AT" of the declared "t_bool" tag. Then the separate bits of the "t_bool" 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 "STEP7_(TIA_Portal)_AT_KeyWord.zip" file into a separate directory and then start the file with a double-click. The STEP 7 (TIA Portal) V12 project is now unpacked automatically with all the associated subdirectories. You can then use STEP 7 (TIA Portal) to open and process the extracted project.
STEP7_TIA_Portal_AT_KeyWord.zip ( 1440 KB )
The screens and download in this FAQ response were created with STEP 7 (TIA Portal) V12+SP1.