Obsidean_VM/01-Documentation/SIEMENS & WINCC/PLC Siemens/AT for overlays memory.md

1.8 KiB

#AT #Overlay_memory

Overlaying tags with AT:
Description

To access data areas within a declared tag, you can overlay the declared tags with an additional declaration. This provides you with the option of addressing an already declared tag with a different data type. You can, for example, address the individual bits of a tag of WORD data type with an ARRAY of BOOL.

Alternatively, you can also use the instructions "SCATTER" and "GATHER" to break down bit sequences into an ARRAY of BOOL or group together individual bits to form a bit sequence. You can find these instructions in the "Basic instructions" task card in the "Move" area.

Rules

The following general rules are valid for tag overlaying: Overlaying is possible in S7-1200 and S7-1500 in STL, LAD, FBD and GRAPH. SCL supports overlaying in all CPU families. Overlaying of tags is possible in the following blocks: In code blocks with standard access In code blocks with optimized access for tags with the retain setting "Set in IDB" The data width of the overlaying tag must be equal to or less than that of the overlaid tag. It is not possible to overlay tags of the VARIANT and INSTANCE data types. If the overlaid tag is of the data type STRING, ARRAY of BYTE, ARRAY of CHAR, etc., the length should correspond to an even number of bytes. Blocks from libraries which are declared as parameters in the interface cannot be overlaid. Structured PLC tags that are declared as parameters in the interface cannot be overlaid. You cannot address overlaying tags with slice access.

!Pasted image 20231017120328.png !Pasted image 20231017124924.png

To overlay a tag, declare an additional tag directly after the tag that is to be overlaid and identify it with the keyword "AT".

In same cases is needed to disabled optimized block access

!Pasted image 20231017124228.png