Alter Endian from enum to partial class
This commit is contained in:
@@ -16,7 +16,7 @@ namespace Modbus.Net.Modbus.SelfDefinedSample
|
|||||||
/// <param name="masterAddress">主站号</param>
|
/// <param name="masterAddress">主站号</param>
|
||||||
/// <param name="endian">端格式</param>
|
/// <param name="endian">端格式</param>
|
||||||
public ModbusUtilityTime(int connectionType, byte slaveAddress, byte masterAddress,
|
public ModbusUtilityTime(int connectionType, byte slaveAddress, byte masterAddress,
|
||||||
Endian endian = Endian.BigEndianLsb)
|
Endian endian)
|
||||||
: base(connectionType, slaveAddress, masterAddress, endian)
|
: base(connectionType, slaveAddress, masterAddress, endian)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,7 @@ namespace Modbus.Net.Modbus.SelfDefinedSample
|
|||||||
/// <param name="masterAddress">主站号</param>
|
/// <param name="masterAddress">主站号</param>
|
||||||
/// <param name="endian">端格式</param>
|
/// <param name="endian">端格式</param>
|
||||||
public ModbusUtilityTime(ModbusType connectionType, string connectionString, byte slaveAddress, byte masterAddress,
|
public ModbusUtilityTime(ModbusType connectionType, string connectionString, byte slaveAddress, byte masterAddress,
|
||||||
Endian endian = Endian.BigEndianLsb)
|
Endian endian)
|
||||||
: base(connectionType, connectionString, slaveAddress, masterAddress, endian)
|
: base(connectionType, connectionString, slaveAddress, masterAddress, endian)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace Modbus.Net.Modbus
|
|||||||
/// <param name="endian">端格式</param>
|
/// <param name="endian">端格式</param>
|
||||||
public ModbusMachine(TKey id, ModbusType connectionType, string connectionString,
|
public ModbusMachine(TKey id, ModbusType connectionType, string connectionString,
|
||||||
IEnumerable<AddressUnit<TUnitKey>> getAddresses, bool keepConnect, byte slaveAddress, byte masterAddress,
|
IEnumerable<AddressUnit<TUnitKey>> getAddresses, bool keepConnect, byte slaveAddress, byte masterAddress,
|
||||||
Endian endian = Endian.BigEndianLsb)
|
Endian endian)
|
||||||
: base(id, getAddresses, keepConnect, slaveAddress, masterAddress)
|
: base(id, getAddresses, keepConnect, slaveAddress, masterAddress)
|
||||||
{
|
{
|
||||||
BaseUtility = new ModbusUtility(connectionType, connectionString, slaveAddress, masterAddress, endian);
|
BaseUtility = new ModbusUtility(connectionType, connectionString, slaveAddress, masterAddress, endian);
|
||||||
@@ -43,7 +43,7 @@ namespace Modbus.Net.Modbus
|
|||||||
/// <param name="endian">端格式</param>
|
/// <param name="endian">端格式</param>
|
||||||
public ModbusMachine(TKey id, ModbusType connectionType, string connectionString,
|
public ModbusMachine(TKey id, ModbusType connectionType, string connectionString,
|
||||||
IEnumerable<AddressUnit<TUnitKey>> getAddresses, byte slaveAddress, byte masterAddress,
|
IEnumerable<AddressUnit<TUnitKey>> getAddresses, byte slaveAddress, byte masterAddress,
|
||||||
Endian endian = Endian.BigEndianLsb)
|
Endian endian)
|
||||||
: this(id, connectionType, connectionString, getAddresses, true, slaveAddress, masterAddress, endian)
|
: this(id, connectionType, connectionString, getAddresses, true, slaveAddress, masterAddress, endian)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ namespace Modbus.Net.Modbus
|
|||||||
/// <param name="masterAddress">主站号</param>
|
/// <param name="masterAddress">主站号</param>
|
||||||
/// <param name="endian">端格式</param>
|
/// <param name="endian">端格式</param>
|
||||||
public ModbusUtility(int connectionType, byte slaveAddress, byte masterAddress,
|
public ModbusUtility(int connectionType, byte slaveAddress, byte masterAddress,
|
||||||
Endian endian = Endian.BigEndianLsb)
|
Endian endian)
|
||||||
: base(slaveAddress, masterAddress)
|
: base(slaveAddress, masterAddress)
|
||||||
{
|
{
|
||||||
Endian = endian;
|
Endian = endian;
|
||||||
@@ -97,7 +97,7 @@ namespace Modbus.Net.Modbus
|
|||||||
/// <param name="masterAddress">主站号</param>
|
/// <param name="masterAddress">主站号</param>
|
||||||
/// <param name="endian">端格式</param>
|
/// <param name="endian">端格式</param>
|
||||||
public ModbusUtility(ModbusType connectionType, string connectionString, byte slaveAddress, byte masterAddress,
|
public ModbusUtility(ModbusType connectionType, string connectionString, byte slaveAddress, byte masterAddress,
|
||||||
Endian endian = Endian.BigEndianLsb)
|
Endian endian)
|
||||||
: base(slaveAddress, masterAddress)
|
: base(slaveAddress, masterAddress)
|
||||||
{
|
{
|
||||||
Endian = endian;
|
Endian = endian;
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace Modbus.Net
|
|||||||
}
|
}
|
||||||
case "endian":
|
case "endian":
|
||||||
{
|
{
|
||||||
paramsSet.Add(FastEnum.Parse<Endian>(dic["endian"]));
|
paramsSet.Add(Endian.Parse(dic["endian"]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
145
Modbus.Net/Modbus.Net/Enum/Enum.cs
Normal file
145
Modbus.Net/Modbus.Net/Enum/Enum.cs
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Modbus.Net
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 端格式
|
||||||
|
/// </summary>
|
||||||
|
public partial class Endian
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 小端
|
||||||
|
/// </summary>
|
||||||
|
public const int LittleEndianLsb = 1;
|
||||||
|
/// <summary>
|
||||||
|
/// 大端-大端位
|
||||||
|
/// </summary>
|
||||||
|
public const int BigEndianLsb = 2;
|
||||||
|
/// <summary>
|
||||||
|
/// 大端-大端位
|
||||||
|
/// </summary>
|
||||||
|
public const int BigEndianMsb = 3;
|
||||||
|
|
||||||
|
#pragma warning disable
|
||||||
|
protected int Value { get; set; }
|
||||||
|
|
||||||
|
protected Endian(int value)
|
||||||
|
{
|
||||||
|
Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator int(Endian endian)
|
||||||
|
{
|
||||||
|
return endian.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator Endian(int value)
|
||||||
|
{
|
||||||
|
return new Endian(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator Endian(string value)
|
||||||
|
{
|
||||||
|
return Endian.Parse(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator string(Endian endian)
|
||||||
|
{
|
||||||
|
return endian.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Endian Parse(string value)
|
||||||
|
{
|
||||||
|
if (typeof(Endian).GetField(value) != null)
|
||||||
|
{
|
||||||
|
return (int)typeof(Endian).GetField(value).GetValue(null);
|
||||||
|
}
|
||||||
|
throw new NotSupportedException("Endian name " + value + " is not supported.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
foreach (var field in typeof(Endian).GetFields())
|
||||||
|
{
|
||||||
|
if ((int)field.GetValue(null) == Value)
|
||||||
|
{
|
||||||
|
return field.Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
#pragma warning restore
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 读写设备值的方式
|
||||||
|
/// </summary>
|
||||||
|
public enum MachineDataType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 地址
|
||||||
|
/// </summary>
|
||||||
|
Address,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 通讯标识
|
||||||
|
/// </summary>
|
||||||
|
CommunicationTag,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
Name,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Id
|
||||||
|
/// </summary>
|
||||||
|
Id
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 波特率
|
||||||
|
/// </summary>
|
||||||
|
public enum BaudRate
|
||||||
|
{
|
||||||
|
#pragma warning disable
|
||||||
|
BaudRate75 = 75,
|
||||||
|
BaudRate110 = 110,
|
||||||
|
BaudRate134 = 134,
|
||||||
|
BaudRate150 = 150,
|
||||||
|
BaudRate300 = 300,
|
||||||
|
BaudRate600 = 600,
|
||||||
|
BaudRate1200 = 1200,
|
||||||
|
BaudRate1800 = 1800,
|
||||||
|
BaudRate2400 = 2400,
|
||||||
|
BaudRate4800 = 4800,
|
||||||
|
BaudRate9600 = 9600,
|
||||||
|
BaudRate14400 = 14400,
|
||||||
|
BaudRate19200 = 19200,
|
||||||
|
BaudRate38400 = 38400,
|
||||||
|
BaudRate57600 = 57600,
|
||||||
|
BaudRate115200 = 115200,
|
||||||
|
BaudRate128000 = 128000,
|
||||||
|
BaudRate230400 = 230400,
|
||||||
|
BaudRate460800 = 460800,
|
||||||
|
BaudRate921600 = 921600,
|
||||||
|
#pragma warning restore
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据位
|
||||||
|
/// </summary>
|
||||||
|
public enum DataBits
|
||||||
|
{
|
||||||
|
#pragma warning disable
|
||||||
|
Seven = 7,
|
||||||
|
Eight = 8,
|
||||||
|
#pragma warning restore
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,46 +3,6 @@ using System.IO.Ports;
|
|||||||
|
|
||||||
namespace Modbus.Net
|
namespace Modbus.Net
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// 波特率
|
|
||||||
/// </summary>
|
|
||||||
public enum BaudRate
|
|
||||||
{
|
|
||||||
#pragma warning disable
|
|
||||||
BaudRate75 = 75,
|
|
||||||
BaudRate110 = 110,
|
|
||||||
BaudRate134 = 134,
|
|
||||||
BaudRate150 = 150,
|
|
||||||
BaudRate300 = 300,
|
|
||||||
BaudRate600 = 600,
|
|
||||||
BaudRate1200 = 1200,
|
|
||||||
BaudRate1800 = 1800,
|
|
||||||
BaudRate2400 = 2400,
|
|
||||||
BaudRate4800 = 4800,
|
|
||||||
BaudRate9600 = 9600,
|
|
||||||
BaudRate14400 = 14400,
|
|
||||||
BaudRate19200 = 19200,
|
|
||||||
BaudRate38400 = 38400,
|
|
||||||
BaudRate57600 = 57600,
|
|
||||||
BaudRate115200 = 115200,
|
|
||||||
BaudRate128000 = 128000,
|
|
||||||
BaudRate230400 = 230400,
|
|
||||||
BaudRate460800 = 460800,
|
|
||||||
BaudRate921600 = 921600,
|
|
||||||
#pragma warning restore
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 数据位
|
|
||||||
/// </summary>
|
|
||||||
public enum DataBits
|
|
||||||
{
|
|
||||||
#pragma warning disable
|
|
||||||
Seven = 7,
|
|
||||||
Eight = 8,
|
|
||||||
#pragma warning restore
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 串口连接对象
|
/// 串口连接对象
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -6,32 +6,6 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace Modbus.Net
|
namespace Modbus.Net
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// 读写设备值的方式
|
|
||||||
/// </summary>
|
|
||||||
public enum MachineDataType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 地址
|
|
||||||
/// </summary>
|
|
||||||
Address,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 通讯标识
|
|
||||||
/// </summary>
|
|
||||||
CommunicationTag,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 名称
|
|
||||||
/// </summary>
|
|
||||||
Name,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Id
|
|
||||||
/// </summary>
|
|
||||||
Id
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设备
|
/// 设备
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -4,27 +4,6 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 端格式
|
|
||||||
/// </summary>
|
|
||||||
public enum Endian
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 小端
|
|
||||||
/// </summary>
|
|
||||||
LittleEndianLsb,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 大端-小端位
|
|
||||||
/// </summary>
|
|
||||||
BigEndianLsb,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 大端-大端位
|
|
||||||
/// </summary>
|
|
||||||
BigEndianMsb
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Modbus.Net
|
namespace Modbus.Net
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace AnyType.Controllers
|
|||||||
Value = 0,
|
Value = 0,
|
||||||
Type = unitValue.DataType.Name
|
Type = unitValue.DataType.Name
|
||||||
};
|
};
|
||||||
var machine = new ModbusMachine("1", ModbusType.Tcp, "10.10.18.251:502", addressUnits, true, 2, 0);
|
var machine = new ModbusMachine("1", ModbusType.Tcp, "10.10.18.251:502", addressUnits, true, 2, 0, Endian.BigEndianLsb);
|
||||||
//启动任务
|
//启动任务
|
||||||
await MachineJobSchedulerCreator.CreateScheduler("Trigger1", -1, 1).Result.From(machine.Id, machine, MachineDataType.CommunicationTag).Result.Query("Query1",
|
await MachineJobSchedulerCreator.CreateScheduler("Trigger1", -1, 1).Result.From(machine.Id, machine, MachineDataType.CommunicationTag).Result.Query("Query1",
|
||||||
returnValues =>
|
returnValues =>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace CrossLamp.Controllers
|
|||||||
{
|
{
|
||||||
if (_utility == null)
|
if (_utility == null)
|
||||||
{
|
{
|
||||||
_utility = new ModbusUtility(ModbusType.Tcp, "10.10.18.251", 2, 0);
|
_utility = new ModbusUtility(ModbusType.Tcp, "10.10.18.251", 2, 0, Endian.BigEndianLsb);
|
||||||
await _utility.ConnectAsync();
|
await _utility.ConnectAsync();
|
||||||
}
|
}
|
||||||
Lamp light = new Lamp();
|
Lamp light = new Lamp();
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace TripleAdd.Controllers
|
|||||||
{
|
{
|
||||||
if (utility == null)
|
if (utility == null)
|
||||||
{
|
{
|
||||||
utility = new ModbusUtility(ModbusType.Tcp, "10.10.18.251", 2, 0);
|
utility = new ModbusUtility(ModbusType.Tcp, "10.10.18.251", 2, 0, Endian.BigEndianLsb);
|
||||||
utility.AddressTranslator = new AddressTranslatorModbus();
|
utility.AddressTranslator = new AddressTranslatorModbus();
|
||||||
await utility.ConnectAsync();
|
await utility.ConnectAsync();
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,7 @@ namespace TripleAdd.Controllers
|
|||||||
new AddressUnit() {Id = "2", Area = "4X", Address = 2, CommunicationTag = "Add2", DataType = typeof(ushort), Zoom = 1, DecimalPos = 0},
|
new AddressUnit() {Id = "2", Area = "4X", Address = 2, CommunicationTag = "Add2", DataType = typeof(ushort), Zoom = 1, DecimalPos = 0},
|
||||||
new AddressUnit() {Id = "3", Area = "4X", Address = 3, CommunicationTag = "Add3", DataType = typeof(ushort), Zoom = 1, DecimalPos = 0},
|
new AddressUnit() {Id = "3", Area = "4X", Address = 3, CommunicationTag = "Add3", DataType = typeof(ushort), Zoom = 1, DecimalPos = 0},
|
||||||
new AddressUnit() {Id = "4", Area = "4X", Address = 4, CommunicationTag = "Ans", DataType = typeof(ushort), Zoom = 1, DecimalPos = 0},
|
new AddressUnit() {Id = "4", Area = "4X", Address = 4, CommunicationTag = "Ans", DataType = typeof(ushort), Zoom = 1, DecimalPos = 0},
|
||||||
}, 2, 0);
|
}, 2, 0, Endian.BigEndianLsb);
|
||||||
machine.AddressCombiner = new AddressCombinerContinus<string>(machine.AddressTranslator, 100000);
|
machine.AddressCombiner = new AddressCombinerContinus<string>(machine.AddressTranslator, 100000);
|
||||||
machine.AddressCombinerSet = new AddressCombinerContinus<string>(machine.AddressTranslator, 100000);
|
machine.AddressCombinerSet = new AddressCombinerContinus<string>(machine.AddressTranslator, 100000);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace Modbus.Net.Tests
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetUtility()
|
public void GetUtility()
|
||||||
{
|
{
|
||||||
BaseMachine<int, int> baseMachine = new ModbusMachine<int, int>(1, ModbusType.Tcp, _machineIp, null, true, 2, 0);
|
BaseMachine<int, int> baseMachine = new ModbusMachine<int, int>(1, ModbusType.Tcp, _machineIp, null, true, 2, 0, Endian.BigEndianLsb);
|
||||||
var utility = baseMachine.GetUtilityMethods<IUtilityMethodDatas>();
|
var utility = baseMachine.GetUtilityMethods<IUtilityMethodDatas>();
|
||||||
var methods = utility.GetType().GetRuntimeMethods();
|
var methods = utility.GetType().GetRuntimeMethods();
|
||||||
Assert.AreEqual(methods.FirstOrDefault(method => method.Name == "GetDatasAsync") != null, true);
|
Assert.AreEqual(methods.FirstOrDefault(method => method.Name == "GetDatasAsync") != null, true);
|
||||||
@@ -23,7 +23,7 @@ namespace Modbus.Net.Tests
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task InvokeUtility()
|
public async Task InvokeUtility()
|
||||||
{
|
{
|
||||||
BaseMachine<int, int> baseMachine = new ModbusMachine<int, int>(1, ModbusType.Tcp, _machineIp, null, true, 2, 0);
|
BaseMachine<int, int> baseMachine = new ModbusMachine<int, int>(1, ModbusType.Tcp, _machineIp, null, true, 2, 0, Endian.BigEndianLsb);
|
||||||
await baseMachine.BaseUtility.ConnectAsync();
|
await baseMachine.BaseUtility.ConnectAsync();
|
||||||
var success = await baseMachine.BaseUtility.GetUtilityMethods<IUtilityMethodDatas>().SetDatasAsync("4X 1", new object[] { (byte)11 });
|
var success = await baseMachine.BaseUtility.GetUtilityMethods<IUtilityMethodDatas>().SetDatasAsync("4X 1", new object[] { (byte)11 });
|
||||||
Assert.AreEqual(success.IsSuccess, true);
|
Assert.AreEqual(success.IsSuccess, true);
|
||||||
@@ -46,7 +46,7 @@ namespace Modbus.Net.Tests
|
|||||||
CommunicationTag = "A1",
|
CommunicationTag = "A1",
|
||||||
DataType = typeof(bool)
|
DataType = typeof(bool)
|
||||||
}
|
}
|
||||||
}, true, 2, 0);
|
}, true, 2, 0, Endian.BigEndianLsb);
|
||||||
var success = await baseMachine.GetMachineMethods<IMachineMethodDatas>().SetDatasAsync(
|
var success = await baseMachine.GetMachineMethods<IMachineMethodDatas>().SetDatasAsync(
|
||||||
MachineDataType.Address,
|
MachineDataType.Address,
|
||||||
new Dictionary<string, double>
|
new Dictionary<string, double>
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ namespace Modbus.Net.Tests
|
|||||||
[TestInitialize]
|
[TestInitialize]
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
_modbusRtuMachine1 = new ModbusMachine<string, string>("1", ModbusType.Rtu, _machineCom, null, true, 1, 0);
|
_modbusRtuMachine1 = new ModbusMachine<string, string>("1", ModbusType.Rtu, _machineCom, null, true, 1, 0, Endian.BigEndianLsb);
|
||||||
_modbusRtuMachine2 = new ModbusMachine<string, string>("2", ModbusType.Rtu, _machineCom, null, true, 2, 0);
|
_modbusRtuMachine2 = new ModbusMachine<string, string>("2", ModbusType.Rtu, _machineCom, null, true, 2, 0, Endian.BigEndianLsb);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|||||||
@@ -21,11 +21,11 @@ namespace Modbus.Net.Tests
|
|||||||
[TestInitialize]
|
[TestInitialize]
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
_modbusTcpMachine = new ModbusMachine<string, string>("1", ModbusType.Tcp, _machineIp, null, true, 2, 0);
|
_modbusTcpMachine = new ModbusMachine<string, string>("1", ModbusType.Tcp, _machineIp, null, true, 2, 0, Endian.BigEndianLsb);
|
||||||
|
|
||||||
_modbusRtuMachine = new ModbusMachine<string, string>("2", ModbusType.Rtu, _machineCom, null, true, 2, 0);
|
_modbusRtuMachine = new ModbusMachine<string, string>("2", ModbusType.Rtu, _machineCom, null, true, 2, 0, Endian.BigEndianLsb);
|
||||||
|
|
||||||
_modbusAsciiMachine = new ModbusMachine<string, string>("3", ModbusType.Ascii, _machineCom2, null, true, 2, 0);
|
_modbusAsciiMachine = new ModbusMachine<string, string>("3", ModbusType.Ascii, _machineCom2, null, true, 2, 0, Endian.BigEndianLsb);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|||||||
Reference in New Issue
Block a user