点击或拖拽改变大小

ReadWriteNetHelperWriteBoolWithWordAsync 方法

写入位到字寄存器的功能,该功能先读取字寄存器的字数据,然后修改其中的位,再写入回去,可能存在脏数据的风险
The function of writing bit-to-word registers, which first reads the word data of the word register, then modifies the bits in it, and then writes back, which may be the risk of dirty data

命名空间:  HslCommunication.Core.Net
程序集:  HslCommunication (在 HslCommunication.dll 中) 版本:11.8.2.0 (11.8.2.0)
语法
public static Task<OperateResult> WriteBoolWithWordAsync(
	IReadWriteNet readWrite,
	string address,
	bool[] values,
	int addLength = 16
)

参数

readWrite
类型:HslCommunication.CoreIReadWriteNet
通信对象信息
address
类型:SystemString
写入的地址信息,需要携带.号
values
类型:SystemBoolean
写入的值信息
addLength (Optional)
类型:SystemInt32
多少长度的bit位组成一个字地址信息

返回值

类型:TaskOperateResult
是否写入成功
备注
关于脏数据风险:从读取数据,修改位,再次写入数据时,大概需要经过3ms~10ms不等的时间,如果此期间内PLC修改了该字寄存器的其他位,再次写入数据时会恢复该点位的数据到读取时的初始值,可能引发设备故障,请谨慎开启此功能。
参见