Siemens Industry Online Support
Siemens AG
Entry type: FAQ Entry ID: 97552147, Entry date: 07/16/2014

How do you address securely and indirectly in STEP 7 (TIA Portal)?

  • Entry
  • Associated product(s)
With indirect addressing the address whose value is to be read or written is determined only while the program is being executed.

Using this method you can reduce the programming required and make your program more flexible. Usually, the access addresses are known when the program is created. How to make indirect addressing more flexible and more secure:

  • Use the "Array" data type for combined data of the same data type.
  • For different areas, use the index via which access to the variable concerned is made in each case.

In the following example access is made to three variables with different memory areas. The following table shows the access list of the three variables that are each assigned to one index:

 IndexAccess to variable Memory area 
 1 Input_Word_0 IW 0
 2 "Processdata".Temperature DB 1
 3 Output_Word_4 OW 4

Create a function and declare an input variable with the data type "Int". Also define the return value with the same data type. Fig. 1 shows an example for programming the "AccessGroupInt" function, in which indirect access is declared and returned by means of the index. You can use the indirect access directly in the program, for example with the instruction #TempValue:= "AccessGroupInt"(#Index);. This method of programming is now

  • Traceable, because you can use the cross-reference list.
  • Secure, because you use only the pre-defined memory area.
  • Universal, because you can use it for standard as well as for optimized data areas.

Fig. 1

In the following example data is read and written from/to three different optimized data blocks. The three data blocks "Silo_Water", "Silo_Sugar" and "Silo_Milk" each contains the same variable declarations:

  • DB variable 1: "MyBool" of the Bool data type.
  • DB variable 2: "MyInt" of the Int data type.
  • DB variable 3: "MyWord" of the Word data type.

Fig. 2

The PLC data type "SiloUDT" is created for addressing the DB variables with the different data types. Reading out is done with the return value of the "AccessGroupSiloRead" function, which is defined with the PLC data type "SiloUDT". On this basis you can program the indirect access in an FB, for example with the instruction shown in Fig. 03:

  • "Silo_Handling_OnlyReading"("AccessGroupSiloRead"(Index:= #Silo_Index));

Fig. 3

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

Additional Keywords

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
Rate entry
no rating
Requests and feedback
What do you want to do?
Note: The feedback always relates to the current entry / product. Your message will be forwarded to our technical editors working in the Online Support. In a few days, you will receive a response if your feedback requires one. If we have no further questions, you will not hear from us.