×
Siemens Industry Online Support
Siemens AG
Entry type: FAQ, Entry ID: 57132240, Entry date: 05/31/2016
(12)
Rate

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

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

Instructions
You program overlaying of tags in the block interface of a function or function block.

You need the following to overlay 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 Overlaying 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.
    Overlaying of tags is possible in the following blocks:
    - FC/FB with standard access
    - FB with optimized access for tags with the retain setting "Set in IDB"
      
    Note
    Optimized access is set by default for all newly created blocks of the S7-1200/S7-1500. To set up standard access open the properties of the block and enable the "Optimized block access" function in the "Attributes".
      
  2. Open the block and block interface.
  3. In the declaration table you enter first the tag that you wish to overlay 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 overlaid and right-click.
  6. In the pop-up menu that opens you select "Add Line". You must declare the overlaying tag in the line directly under the tag to be overlaid.
  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.  
  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 overlaid 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 overlaying 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 overlaid 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 overlaid 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".

Download
The download contains a library with blocks and tags.

  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.

Following Entry describes, how you open a library in STEP 7 (TIA Portal) 37364723.

 Registrierung notwendig  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.

Security information
In order to protect plants, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art industrial security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about industrial security, please visit
http://www.siemens.com/industrialsecurity.