ReadWriteNetHelperWriteBoolWithWord 方法 |
写入位到字寄存器的功能,该功能先读取字寄存器的字数据,然后修改其中的位,再写入回去,可能存在脏数据的风险
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 中) 版本:12.1.2.0 (12.1.2.0)
语法 public static OperateResult WriteBoolWithWord(
IReadWriteNet readWrite,
string address,
bool[] values,
int addLength = 16,
bool reverseWord = false,
string bitStr = null
)
Public Shared Function WriteBoolWithWord (
readWrite As IReadWriteNet,
address As String,
values As Boolean(),
Optional addLength As Integer = 16,
Optional reverseWord As Boolean = false,
Optional bitStr As String = Nothing
) As OperateResult
public:
static OperateResult^ WriteBoolWithWord(
IReadWriteNet^ readWrite,
String^ address,
array<bool>^ values,
int addLength = 16,
bool reverseWord = false,
String^ bitStr = nullptr
)
static member WriteBoolWithWord :
readWrite : IReadWriteNet *
address : string *
values : bool[] *
?addLength : int *
?reverseWord : bool *
?bitStr : string
(* Defaults:
let _addLength = defaultArg addLength 16
let _reverseWord = defaultArg reverseWord false
let _bitStr = defaultArg bitStr null
*)
-> OperateResult
参数
- readWrite
- 类型:HslCommunication.CoreIReadWriteNet
通信对象信息 - address
- 类型:SystemString
写入的地址信息,需要携带'.'号 - values
- 类型:SystemBoolean
写入的值信息 - addLength (Optional)
- 类型:SystemInt32
多少长度的bit位组成一个字地址信息 - reverseWord (Optional)
- 类型:SystemBoolean
对原始数据是否按照字单位进行反转操作 - bitStr (Optional)
- 类型:SystemString
额外指定的位索引,如果为空,则使用address中的地址位偏移信息
返回值
类型:
OperateResult是否写入成功
备注
关于脏数据风险:从读取数据,修改位,再次写入数据时,大概需要经过3ms~10ms不等的时间,如果此期间内PLC修改了该字寄存器的其他位,再次写入数据时会恢复该点位的数据到读取时的初始值,可能引发设备故障,请谨慎开启此功能。
参见