ModbusRtuOverTcpWriteAsync 方法 (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, it automatically switches to read the word data, modifies the bits, and writes the word in the way.
命名空间:
HslCommunication.ModBus
程序集:
HslCommunication (在 HslCommunication.dll 中) 版本:12.1.2.0 (12.1.2.0)
语法 public override Task<OperateResult> WriteAsync(
string address,
bool value
)
Public Overrides Function WriteAsync (
address As String,
value As Boolean
) As Task(Of OperateResult)
public:
virtual Task<OperateResult^>^ WriteAsync(
String^ address,
bool value
) override
abstract WriteAsync :
address : string *
value : bool -> Task<OperateResult>
override WriteAsync :
address : string *
value : bool -> Task<OperateResult>
参数
- address
- 类型:SystemString
要写入的数据地址,比如"12345" - value
- 类型:SystemBoolean
要写入的实际数据
返回值
类型:
TaskOperateResult返回写入结果
实现
IReadWriteNetWriteAsync(String, Boolean)IReadWriteNetWriteAsync(String, Boolean)参见