@ -184,6 +184,23 @@ public class ModbusTcpMaster
return ModbusTcpNet . ReadDiscrete ( address , length ) ;
return ModbusTcpNet . ReadDiscrete ( address , length ) ;
}
}
/// <summary>
/// 将数据写入到Modbus的寄存器上去, 需要指定起始地址和数据内容, 如果富文本地址不指定, 默认使用的功能码是 0x10<br />
/// To write data to Modbus registers, you need to specify the start address and data content. If the rich text address is not specified, the default function code is 0x10
/// </summary>
/// <param name="address">起始地址,比如"100", "x=4;100", "s=1;100","s=1;x=4;100"</param>
/// <param name="value">写入的数据, 长度根据data的长度来指示</param>
/// <returns>返回写入结果</returns>
/// <remarks>富地址格式,支持携带站号信息,功能码信息,具体参照类的示例代码</remarks>
/// <example>
/// 此处演示批量写入的示例
/// <code lang="cs" source="HslCommunication_Net45.Test\Documentation\Samples\Modbus\Modbus.cs" region="WriteExample1" title="Write示例" />
/// </example>
public OperateResult Write ( string address , byte [ ] value )
{
return ModbusTcpNet . Write ( address , value ) ;
}
public bool WriteValue < T > ( ModbusProperty < T > property )
public bool WriteValue < T > ( ModbusProperty < T > property )
{
{