×
Siemens Industry Online Support
Siemens AG
Entry type: FAQ Entry ID: 104983207, Entry date: 11/17/2014
(3)
Rate

In STEP 7 V5.5, how do you read out the IP address of the S7-300 CPU in the user program?

  • Entry
  • Associated product(s)
Call the system function SFC51 "RDSYSST" in the user program in STEP 7 V5.5 to read out the IP address of the S7-300 CPU.

With the system function SFC51 "RDSYSST" you can read out a partial list or excerpt of a partial list of the system status lists (SSL or in German SZL). With the SSL ID and the INDEX you specify the partial list or excerpt of the partial list and the type or number of an object in a partial list. Use the SSL ID = 37 (hex) and the INDEX = 0 (hex) to read out the IP address of the S7-300 CPU.

In this example the system function SFC51 "RDSYSST" is called in the function block FB1. FB1 is called cyclically in OB1.


Fig. 01

Inputs and outputs of the system function SFC51 "RDSYSST"
Table 01 shows the inputs of the system function SFC51 "RDSYSST".
   

Parameter Data type Description
REQ BOOLEAN REQ=1: Trigger for processing
SZL_ID WORD SZL_ID of the partial list or of the excerpt of the partial list

SSL_ID=w#16#37: Read out of the IP address of the S7-300 CPU

INDEX WORD Type or number of an object in a partial list

INDEX=w#16#0: Read out of the IP address of the S7-300 CPU

Table 01

Table 02 shows the outputs of the system function SFC51 "RDSYSST".
 

Parameter Data type Description
RET_VAL INT If an error occurs during processing of the instruction, the RET_VAL parameter receives an error code.
BUSY BOOLEAN TRUE: Read procedure has not yet finished
SZL_HEADER STRUCT The SZL_HEADER is a structure. The structure is described under "SZL_HEADER structure".
DR ANY Target area for the read SSL partial list or read excerpt of SSL partial list.

Table 02

SZL_HEADER structure
The SZL_HEADER output is a structure defined as follows:

SZL_HEADER:    STRUCT
        LENTHDR:    WORD
        N_DR:            WORD
END_STRUCT

LENTHDR is the length of a data record of the SZL partial list or of the excerpt of the SZL partial list.

  • If you have only read out the header information of an SZL parts list, N_DR contains the number of the associated data records available.
  • Otherwise N_DR contains the number of data records transferred to the target area.

Target area for the read SSL partial list or read excerpt of the SSL partial list
In this example the read SSL parts list is saved in the data block DB100 "SYS_DATA" starting at address 0. The IP address of the S7-300 CPU, consisting of 4 bytes, is stored in DB100 "SYS_DATA" starting at Address 2, byte for byte as hexadecimal value.


Fig. 02

When you have read out the IP address of the CPU, you can then evaluate it in the user program. In this example, the IP address is saved as a decimal value in the instance data block DB1 of FB1.


Fig. 03


Fig. 04


Fig. 05


Fig. 06


Fig. 07

Download
The download contains the project "Read_IP_Address_STEP7_V55.zip".
Copy the "Read_IP_Address_STEP7_V55.zip" file into a separate directory and then start the file with a double-click. You can then use STEP 7 to open and process the extracted project data.

Read_IP_Address_STEP7_V55.zip ( 247 KB )

Creation environment
The pictures and download in this FAQ response were created with STEP 7 V5.5.

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
https://www.siemens.com/cybersecurity#Ouraspiration.