-
-
Notifications
You must be signed in to change notification settings - Fork 75
System information functions
these functions access to SZL (or SSL - System Status List) to give you all the same information that you can get from S7 Manager.
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) |
Reads a partial list of given ID and INDEX.
public int ReadSZL(int ID, int Index, ref S7SZL SZL, ref int Size)
Name | Type | Note |
---|---|---|
ID | int | List ID |
Index | int | List Index |
SZL | S7Szl | S7Szl structure |
Size | int | Size Read in bytes |
[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 |
- 0 : The function was accomplished with no errors.
- Other values : see the Errors Code List.
Remember to allocate the Data[] buffer
Gets CPU order code and version info.
public int GetOrderCode(S7OrderCode Info)
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"
Gets CPU module name, serial number and other info.
public int GetCpuInfo(S7CpuInfo Info)
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;
}
- 0 : The function was accomplished with no errors.
- Other values : see the Errors Code List.
Gets CP (communication processor) info.
public int GetCpInfo(S7CpInfo Info)
Name | Type | Note |
---|---|---|
Info | S7CpInfo | see below |
public struct S7CpInfo
{
public int MaxPduLength;
public int MaxConnections;
public int MaxMpiRate;
public int MaxBusRate;
}
- 0 : The function was accomplished with no errors.
- Other values : see the Errors Code List.