From f5cc2ee6013cb463888796ae8d4f1f1ac4a36cc2 Mon Sep 17 00:00:00 2001 From: "parallelbgls@outlook.com" Date: Tue, 23 Aug 2016 15:22:16 +0800 Subject: [PATCH] Fix --- Modbus.Net/NA200H.UI.WPF/MainWindow.xaml.cs | 10 +++++----- .../Simense_S7_200.UI.WPF.TaskTest/MainWindow.xaml.cs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Modbus.Net/NA200H.UI.WPF/MainWindow.xaml.cs b/Modbus.Net/NA200H.UI.WPF/MainWindow.xaml.cs index 119cd12..3ce6843 100644 --- a/Modbus.Net/NA200H.UI.WPF/MainWindow.xaml.cs +++ b/Modbus.Net/NA200H.UI.WPF/MainWindow.xaml.cs @@ -53,13 +53,13 @@ namespace NA200H.UI.WPF //machine.AddressCombiner = new AddressCombinerContinus(); machine = new SiemensMachine(SiemensType.Tcp, "192.168.3.11:102", SiemensMachineModel.S7_300, new List() { - new AddressUnit() {Id = 1, Area = "V", Address = 0, CommunicationTag = "Add1", DataType = typeof(ushort), Zoom = 1, DecimalPos = 0}, - new AddressUnit() {Id = 2, Area = "V", Address = 2, CommunicationTag = "Add2", DataType = typeof(ushort), Zoom = 1, DecimalPos = 0}, - new AddressUnit() {Id = 3, Area = "V", Address = 4, CommunicationTag = "Add3", DataType = typeof(ushort), Zoom = 1, DecimalPos = 0}, - new AddressUnit() {Id = 4, Area = "V", Address = 6, CommunicationTag = "Ans", DataType = typeof(ushort), Zoom = 1, DecimalPos = 0} + new AddressUnit() {Id = "1", Area = "V", Address = 0, CommunicationTag = "Add1", DataType = typeof(ushort), Zoom = 1, DecimalPos = 0}, + new AddressUnit() {Id = "2", Area = "V", Address = 2, CommunicationTag = "Add2", DataType = typeof(ushort), Zoom = 1, DecimalPos = 0}, + new AddressUnit() {Id = "3", Area = "V", Address = 4, CommunicationTag = "Add3", DataType = typeof(ushort), Zoom = 1, DecimalPos = 0}, + new AddressUnit() {Id = "4", Area = "V", Address = 6, CommunicationTag = "Ans", DataType = typeof(ushort), Zoom = 1, DecimalPos = 0} }); machine.AddressCombiner = new AddressCombinerContinus(); - var result = machine.GetDatas(); + var result = machine.GetDatas(MachineGetDataType.CommunicationTag); var resultFormat = BaseMachine.MapGetValuesToSetValues(result); SetValue(new ushort[4] {(ushort)resultFormat["Add1"], (ushort)resultFormat["Add2"], (ushort)resultFormat["Add3"], (ushort)resultFormat["Ans"]}); } diff --git a/Modbus.Net/Simense_S7_200.UI.WPF.TaskTest/MainWindow.xaml.cs b/Modbus.Net/Simense_S7_200.UI.WPF.TaskTest/MainWindow.xaml.cs index 396f2e7..7342b49 100644 --- a/Modbus.Net/Simense_S7_200.UI.WPF.TaskTest/MainWindow.xaml.cs +++ b/Modbus.Net/Simense_S7_200.UI.WPF.TaskTest/MainWindow.xaml.cs @@ -30,8 +30,8 @@ namespace Siemens_S7_200.UI.WPF.TaskTest //增加需要通信的PLC地址 List addressUnits = new List { - new AddressUnit() {Id = 0, Area = "V", Address = 1, CommunicationTag = "D1", DataType = typeof (ushort), Zoom = 1}, - new AddressUnit() {Id = 1, Area = "V", Address = 3, CommunicationTag = "D2", DataType = typeof (float), Zoom = 1} + new AddressUnit() {Id = "0", Area = "V", Address = 1, CommunicationTag = "D1", DataType = typeof (ushort), Zoom = 1}, + new AddressUnit() {Id = "1", Area = "V", Address = 3, CommunicationTag = "D2", DataType = typeof (float), Zoom = 1} }; //初始化任务管理器 TaskManager task = new TaskManager(300, true);