From 06da4922f9f73a32754a2bf6e9d10545efa65b23 Mon Sep 17 00:00:00 2001 From: CZ Date: Tue, 28 May 2024 13:17:36 +0800 Subject: [PATCH] =?UTF-8?q?PLC=E5=BF=83=E8=B7=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Service/Plc/Client/PlcMgr.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Service/Plc/Client/PlcMgr.cs b/Service/Plc/Client/PlcMgr.cs index 90078a4..1307953 100644 --- a/Service/Plc/Client/PlcMgr.cs +++ b/Service/Plc/Client/PlcMgr.cs @@ -193,6 +193,9 @@ public class PlcMgr { heart = !heart; HostToPlc writeHostToPlc = new HostToPlc(); + writeHostToPlc.ProtocolVersion1.Value = 2; + writeHostToPlc.ProtocolVersion2.Value = 0; + writeHostToPlc.ProtocolVersion3.Value = 1; writeHostToPlc.CommunicationDiagnosis.Value = (ushort)(heart ? 1 : 0); writeHostToPlc.Years.Value = (ushort)DateTime.Now.Year; writeHostToPlc.Month.Value = (ushort)DateTime.Now.Month; @@ -201,6 +204,9 @@ public class PlcMgr writeHostToPlc.Points.Value = (ushort)DateTime.Now.Minute; writeHostToPlc.Seconds.Value = (ushort)DateTime.Now.Second; + bool write01 = PlcClient.WriteValue(writeHostToPlc.ProtocolVersion1); + bool write02 = PlcClient.WriteValue(writeHostToPlc.ProtocolVersion2); + bool write03 = PlcClient.WriteValue(writeHostToPlc.ProtocolVersion3); bool write0 = PlcClient.WriteValue(writeHostToPlc.CommunicationDiagnosis); bool write1 = PlcClient.WriteValue(writeHostToPlc.Years); bool write2 = PlcClient.WriteValue(writeHostToPlc.Month);