点击或拖拽改变大小

ModbusTcpNetWriteAsync 方法 (String, Boolean)

向线圈中写入bool数值,返回是否写入成功,如果富文本地址不指定,默认使用的功能码是 0x05, 如果你的地址为字地址,例如100.2,那么将使用0x16的功能码,通过掩码的方式来修改寄存器的某一位,需要Modbus服务器支持,否则写入无效。
Write bool value to the coil and return whether the writing is successful. If the rich text address is not specified, the default function code is 0x05. If your address is a word address, such as 100.2, then you will use the function code of 0x16 to modify a bit of the register through a mask. It needs Modbus server support, otherwise the writing is invalid.

命名空间:  HslCommunication.ModBus
程序集:  HslCommunication (在 HslCommunication.dll 中) 版本:11.8.2.0 (11.8.2.0)
语法
public override Task<OperateResult> WriteAsync(
	string address,
	bool value
)

参数

address
类型:SystemString
要写入的数据地址,比如"12345"
value
类型:SystemBoolean
要写入的实际数据

返回值

类型:TaskOperateResult
返回写入结果

实现

IReadWriteNetWriteAsync(String, Boolean)
IReadWriteNetWriteAsync(String, Boolean)
参见