Fix
This commit is contained in:
@@ -28,18 +28,23 @@ namespace NA200H.UI.WPF
|
||||
}
|
||||
|
||||
private void GetUtilityEnter()
|
||||
{
|
||||
if (utility == null)
|
||||
{
|
||||
utility = new ModbusUtility(ModbusType.Tcp, "192.168.3.12");
|
||||
utility.AddressTranslator = new AddressTranslatorNA200H();
|
||||
object[] getNum = utility.GetDatas(0x02, 0x00, "NW 1", new KeyValuePair<Type, int>(typeof(ushort), 4));
|
||||
//utility = new SiemensUtility(SiemensType.Tcp, "192.168.3.11", SiemensMachineModel.S7_300);
|
||||
//utility.AddressTranslator = new AddressTranslatorSiemens();
|
||||
}
|
||||
object[] getNum = utility.GetDatas(0x02, 0x00, "NW 1", new KeyValuePair<Type, int>(typeof(ushort), 4));
|
||||
//object[] getNum = utility.GetDatas(0x02, 0x00, "V 1", new KeyValuePair<Type, int>(typeof(ushort), 4));
|
||||
ushort[] getNumUshorts = BigEndianValueHelper.Instance.ObjectArrayToDestinationArray<ushort>(getNum);
|
||||
SetValue(getNumUshorts);
|
||||
}
|
||||
|
||||
private void GetMachineEnter()
|
||||
{
|
||||
if (machine == null)
|
||||
{
|
||||
//machine = new ModbusMachine(ModbusType.Tcp, "192.168.3.12", new List<AddressUnit>()
|
||||
//{
|
||||
@@ -52,7 +57,7 @@ namespace NA200H.UI.WPF
|
||||
//machine.AddressTranslator = new AddressTranslatorNA200H();
|
||||
//machine.AddressCombiner = new AddressCombinerContinus(machine.AddressTranslator);
|
||||
//machine.AddressCombinerSet = new AddressCombinerContinus(machine.AddressTranslator);
|
||||
machine = new SiemensMachine(SiemensType.Ppi, "COM4", SiemensMachineModel.S7_300, new List<AddressUnit>()
|
||||
machine = new SiemensMachine(SiemensType.Tcp, "192.168.3.11", SiemensMachineModel.S7_300, new List<AddressUnit>()
|
||||
{
|
||||
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},
|
||||
@@ -61,6 +66,7 @@ namespace NA200H.UI.WPF
|
||||
});
|
||||
machine.AddressCombiner = new AddressCombinerContinus(machine.AddressTranslator);
|
||||
machine.AddressCombinerSet = new AddressCombinerContinus(machine.AddressTranslator);
|
||||
}
|
||||
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"]});
|
||||
|
||||
Reference in New Issue
Block a user