diff --git a/S7.Net/PlcSynchronous.cs b/S7.Net/PlcSynchronous.cs index c30e0cf..1b3af97 100644 --- a/S7.Net/PlcSynchronous.cs +++ b/S7.Net/PlcSynchronous.cs @@ -492,6 +492,18 @@ namespace S7.Net } } + /// + /// Read the current status from the PLC. A value of 0x08 indicates the PLC is in run status, regardless of the PLC type. + /// + /// The current PLC status. + public byte ReadStatus() + { + var dataToSend = BuildSzlReadRequestPackage(0x0424, 0); + var s7data = RequestTsdu(dataToSend); + + return (byte) (s7data[37] & 0x0f); + } + private byte[] RequestTsdu(byte[] requestData) => RequestTsdu(requestData, 0, requestData.Length); private byte[] RequestTsdu(byte[] requestData, int offset, int length)