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. Note also the following restrictions in this case:
- The tags can be overlapped in S7-1200 if the modules of the S7-1200 have firmware version V2.0 (or higher).
- With the modules of S7-300/400 it is only possible to overlap tags in S7-SCL.
- You need at least STEP 7 V11.0+SP1+Update 2 (or higher).
- It is only possible to overlap tags in the interface of code blocks with standard access.
- It is no longer possible to change the "Optimized block access" attribute after creating a new block.
- It is possible to overlap tags from all types of code block and all declaration segments (Input, Output, InOut, Static, Temp).
- Overlapping tags must be equal or less than the overlapped tag and may be used in the block like any other tag.
- You cannot overlap tags of the VARIANT data type.
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.
||In the Temp area of the declaration table you enter first the tag that you wish to overlap with a new data type.
- For example: Name: "t_word", data type: "Word".
||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.
||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.|
||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.
- In this example: AT "t_word".
||Click again in the "Data type" field and enter the declaration for the array.
- For example: "Array[0..15] of Bool".
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_V11_AT_KeyWord.zip" file into a separate directory and then start the file with a double-click. The STEP 7 TIA Portal V11 project is now unpacked automatically with all the associated subdirectories. You can then use STEP 7 TIA Portal V11 to open and process the extracted project.
STEP7_V11_AT_KeyWord.zip ( 2962 KB )
The download in FAQ entry was created with the Totally Integrated Automation Portal V11 SP1.