Skip to content

System information functions

Federico Barresi edited this page Jan 11, 2019 · 1 revision

these functions access to SZL (or SSL - System Status List) to give you all the same information that you can get from S7 Manager.

System Status List

The system status list (SSL) describes the current status of a programmable logic controller.

The contents of the SSL can only be read using information functions but cannot be modified. The partial lists are virtual lists, in other words, they are only created by the operating system of the CPUs when specifically requested.

You can access to system status list using SFC 51 too "RDSYSST."

To read a partial list you must specify its ID and Index.

For a detailed description of SZL see: §33 of "System Software for S7-300/400 System and Standard Functions".

Function Purpose
ReadSZL Reads a partial list of given ID and Index
GetOrderCode Returns the CPU order code
GetCpuInfo Returns some information about the AG
GetCpInfo Returns some information about the CP (communication processor)

ReadSZL

Description

Reads a partial list of given ID and INDEX.

Declaration

public int ReadSZL(int ID, int Index, ref S7SZL SZL, ref int Size)

Parameters

Name Type Note
ID int List ID
Index int List Index
SZL S7Szl S7Szl structure
Size int Size Read in bytes
S7SZL
[StructLayout(LayoutKind.Sequential, Pack = 1)]
 public struct SZL_HEADER
 {
     public UInt16 LENTHDR;
     public UInt16 N_DR;
 };

 [StructLayout(LayoutKind.Sequential, Pack = 1)]
 public struct S7SZL
 {
     public SZL_HEADER Header;
     [MarshalAs(UnmanagedType.ByValArray)]
     public byte[] Data;
 };
Name Type Meaning
LENTHDR int Length of a data record of the partial list in bytes
N_DR int Number of data records contained in the partial list

Return value

  • 0 : The function was accomplished with no errors.
  • Other values : see the Errors Code List.

Remarks

Remember to allocate the Data[] buffer

GetOrderCode

Description

Gets CPU order code and version info.

Declaration

public int GetOrderCode(S7OrderCode Info)

Parameters

Name Type Note
Info S7OrderCode see below
public struct S7OrderCode
{
    public string Code;
    public byte V1; // Version 1st digit
    public byte V2; // Version 2nd digit
    public byte V3; // Version 3th digit
};

The Order code is a string like: "6ES7 151-8AB01-0AB0"

GetCpuInfo

Description

Gets CPU module name, serial number and other info.

Declaration

public int GetCpuInfo(S7CpuInfo Info)

Parameters

Name Type Note
Info S7CpuInfo see below
public struct S7CpuInfo
{
    public string ModuleTypeName;
    public string SerialNumber;
    public string ASName;
    public string Copyright;
    public string ModuleName;
}

Return value

  • 0 : The function was accomplished with no errors.
  • Other values : see the Errors Code List.

GetCpInfo

Description

Gets CP (communication processor) info.

Declaration

public int GetCpInfo(S7CpInfo Info)

Parameters

Name Type Note
Info S7CpInfo see below
public struct S7CpInfo
{
    public int MaxPduLength;
    public int MaxConnections;
    public int MaxMpiRate;
    public int MaxBusRate;
}

Return value

  • 0 : The function was accomplished with no errors.
  • Other values : see the Errors Code List.