|
|
@ -193,6 +193,9 @@ public class PlcMgr
|
|
|
|
{
|
|
|
|
{
|
|
|
|
heart = !heart;
|
|
|
|
heart = !heart;
|
|
|
|
HostToPlc writeHostToPlc = new HostToPlc();
|
|
|
|
HostToPlc writeHostToPlc = new HostToPlc();
|
|
|
|
|
|
|
|
writeHostToPlc.ProtocolVersion1.Value = 2;
|
|
|
|
|
|
|
|
writeHostToPlc.ProtocolVersion2.Value = 0;
|
|
|
|
|
|
|
|
writeHostToPlc.ProtocolVersion3.Value = 1;
|
|
|
|
writeHostToPlc.CommunicationDiagnosis.Value = (ushort)(heart ? 1 : 0);
|
|
|
|
writeHostToPlc.CommunicationDiagnosis.Value = (ushort)(heart ? 1 : 0);
|
|
|
|
writeHostToPlc.Years.Value = (ushort)DateTime.Now.Year;
|
|
|
|
writeHostToPlc.Years.Value = (ushort)DateTime.Now.Year;
|
|
|
|
writeHostToPlc.Month.Value = (ushort)DateTime.Now.Month;
|
|
|
|
writeHostToPlc.Month.Value = (ushort)DateTime.Now.Month;
|
|
|
@ -201,6 +204,9 @@ public class PlcMgr
|
|
|
|
writeHostToPlc.Points.Value = (ushort)DateTime.Now.Minute;
|
|
|
|
writeHostToPlc.Points.Value = (ushort)DateTime.Now.Minute;
|
|
|
|
writeHostToPlc.Seconds.Value = (ushort)DateTime.Now.Second;
|
|
|
|
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 write0 = PlcClient.WriteValue(writeHostToPlc.CommunicationDiagnosis);
|
|
|
|
bool write1 = PlcClient.WriteValue(writeHostToPlc.Years);
|
|
|
|
bool write1 = PlcClient.WriteValue(writeHostToPlc.Years);
|
|
|
|
bool write2 = PlcClient.WriteValue(writeHostToPlc.Month);
|
|
|
|
bool write2 = PlcClient.WriteValue(writeHostToPlc.Month);
|
|
|
|