diff --git a/Modbus.Net/Modbus.Net/BaseMachine.cs b/Modbus.Net/Modbus.Net/BaseMachine.cs index f8eba1b..7cedbb7 100644 --- a/Modbus.Net/Modbus.Net/BaseMachine.cs +++ b/Modbus.Net/Modbus.Net/BaseMachine.cs @@ -423,20 +423,10 @@ namespace Modbus.Net } } //写入数据 - if (AddressCombinerSet is AddressCombinerSingle) - { - await - BaseUtility.SetDatasAsync(addressStart, - valueHelper.ByteArrayToObjectArray(datas, - new KeyValuePair(communicateAddress.DataType, 1))); - } - else - { - await - BaseUtility.SetDatasAsync(addressStart, - valueHelper.ByteArrayToObjectArray(datas, - new KeyValuePair(typeof (byte), datas.Length))); - } + await + BaseUtility.SetDatasAsync(addressStart, + valueHelper.ByteArrayToObjectArray(datas, + new KeyValuePair(communicateAddress.DataType, communicateAddress.GetCount))); } //如果不保持连接,断开连接 if (!KeepConnect)