How do you read out the IP address of the S7-300 CPU in the user program at run time?



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

Fig. 01
Inputs and outputs of the "RDSYSST" instructionsTable 01 shows the inputs of the "RDSYSST" instruction.
 
Parameter Data type Description
REQ BOOL REQ=1: Trigger for processing
SSL_ID WORD SSL_ID of the parts list or of the excerpt of the parts 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 parts 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 "RDSYSST" instruction.
 
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 BOOL 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 read SSL parts list or read excerpt of SSL parts list.
Table 02 SZL_HEADER structureThe 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 SSL parts list or excerpt of the SSL parts list .
  • If you have only read out the header information of an SSL parts list, N_DR contains the number of associated data records available.
  • Otherwise N_DR contains the number of data records transferred to the target area.
Target area for the read SSL parts list or read excerpt of the SSL parts listIn this example the read SSL parts list is saved in the data block DB2 "SZL_VALUE" starting at address 0. The IP address of the S7-300 CPU, consisting of 4 bytes, is stored in DB2 "SZL_VALUE" 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 evaluate it in the user program. In this example, the IP address is saved as a decimal value in the data block DB1 "DATA" starting at Address 8.

Fig. 03

Fig. 04

Fig. 05

Fig. 06






Comments

Popular posts from this blog

Why 27648 Analog Maximum Value in Siemens PLC???

Basics Of S7-400

The Advance PLC: Simatic S7-1500