Siemens Industry Online Support
Siemens AG
Entry type: FAQ, Entry ID: 57374718, Entry date: 06/21/2016

How in STEP 7 (TIA Portal) do you access the unstructured data types bit-by-bit, byte-by-byte or word-by-word and symbolically?

  • Entry
  • Associated product(s)
With the S7-1200/S7-1500 you can address specific areas in declared tags and access areas of the following widths: 1 bit, 8 bits, 16 bits and 32 bits.

In order to access tags of the data type Byte, Word or DWord you need

  • STEP 7 (TIA Portal) V11+SP1+Upd 2 (or higher) for S7-1200 (firmware V2.0 and higher).
  • STEP 7 (TIA Portal) V12 (or higher) for S7-1500.

The partitioning of a memory area (Byte or Word, for example) into a smaller memory area (Bool, for example) is also called memory slicing. Fig. 01 shows the symbolic bit, byte and word access to operands.

Fig. 1

Using slice access provides you with greater programming efficiency and there is no need for additional definition in the tag declaration.

The example below shows bit-by-bit symbolic slice access. The "X" stands for bit-by-bit access in the Word or Byte concerned and the number that follows specifies the offset of the Bit concerned.

Fig. 2

Fig. 03 shows a sample byte-by-byte slice access. Here, the "B" stands for byte-by-byte access and the number that follows specifies the offset of the byte concerned.

Fig. 3

A "W" stands for word-by-word slice access and the number that follows specifies the offset of the word concerned.

Fig. 4

In the case of some technical applications you only need the first 4 or 6 bits (Bit 0 to Bit 3 or to Bit 5 respectively) of the byte tags for converting a value of the Byte data type to a value of the Real data type. In this example a binary number (binary coded byte) is converted into a decimal number (real number). The lowest bit of the byte here has the value 2-5. This is not the places after the decimal point, but the decimal value itself that is calculated.

Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0

Total = 1.5625.

In the following SCL program code the first two instructions (slice accesses) set the bits not needed to the signal "False". Then, with the data type conversion, the change is made according to the value 2 -5.

Fig. 5

In STEP 7 (TIA Portal) V13 and higher, the syntax changes from "Tag.X0" to "Tag.%X0". After input as described above in the example "measure.X0", STEP 7 (TIA Portal) V13 and higher changes the syntax automatically to "measure.%X0".

Further Information

  • More information is available in the Online Help or in the manual under Addressing areas of a tag with slice access.
  • In the STEP 7 (TIA Portal) you can program the overlapping of tags with the keyword "AT". Information about this is available in Entry ID: 57132240.

Creation Environment
The screens in this FAQ response were created with STEP 7 (TIA Portal) V15.

Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about cyber security, please visit