点击或拖拽改变大小

IReadWriteCipWriteTag 方法

使用指定的类型写入指定的节点数据,类型信息参考API文档,地址支持携带类型代号信息,可以强制指定本次写入数据的类型信息,例如 "type=0xD1;A"
Use the specified type to write the specified node data. For the type information, refer to the API documentation. The address supports carrying type code information. You can force the type information of the data to be written this time. For example, "type=0xD1;A"

命名空间:  HslCommunication.Profinet.AllenBradley
程序集:  HslCommunication (在 HslCommunication.dll 中) 版本:11.8.2.0 (11.8.2.0)
语法
OperateResult WriteTag(
	string address,
	ushort typeCode,
	byte[] value,
	int length = 1
)

参数

address
类型:SystemString
节点的名称 -> Name of the node
typeCode
类型:SystemUInt16
类型代码,详细参见AllenBradleyHelper上的常用字段 -> Type code, see the commonly used Fields section on the AllenBradleyHelper in detail
value
类型:SystemByte
实际的数据值 -> The actual data value
length (Optional)
类型:SystemInt32
如果节点是数组,就是数组长度 -> If the node is an array, it is the array length

返回值

类型:OperateResult
是否写入成功 -> Whether to write successfully
备注
关于参数 length 的含义,表示的是地址长度,一般的标量数据都是 1,如果PLC有个标签是 A,数据类型为 byte[10],那我们写入 3 个byte就是 WriteTag( "A[5]", 0xD1, new byte[]{1,2,3}, 3 );
Regarding the meaning of the parameter length, it represents the address length. The general scalar data is 1. If the PLC has a tag of A and the data type is byte[10], then we write 3 bytes as WriteTag( "A[5 ]", 0xD1, new byte[]{1,2,3}, 3 );
参见