Entry type: FAQ, Entry ID: 57132240, Entry date: 05/31/2016

How do you program the overlapping of tags with the keyword "AT" in the STEP 7 (TIA Portal)?

  • Entry
  • Associated product(s)
Using the keyword "AT" you can overlap a tag declared for the S7-1200/S7-1500 with a further declaration.

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.

  1. 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.
  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. For example: Name: "statConveyor", Data type: "Word".
  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, "statMotors", for example.
  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.
    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.
  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 ("statMotors", for example) the keyword with the tag to be overlapped is also displayed in the same field. In this example: AT "statConveyor".

    Fig. 1
  10. 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.

Sample program
With some applications, it is necessary to group multiple signals in one control word or extract separate signals from a control word.

FB "BoolToWordAT"
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.

Fig. 2
FB "WordToBoolAT"
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.

Fig. 3

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.

  1. Drag-and-drop the blocks "BoolToWordAT", "BoolToWordAT_DB", "WordToBoolAT", "WordToBoolAT_DB", "DB" and "Main" to the block folder.
  2. Drag the "Tags" into the "PLC tags" folder.

 Registration required 57132240_KeywordAT_Lib_TIA_Portal.zip (1.1 MB)

Further Information
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.

Creation Environment
The download and screens in this FAQ response were created with STEP 7 (TIA Portal) V13+SP1.