点击或拖拽改变大小

MelsecMcNetReadTags 方法 (String, UInt16)

[商业授权] 读取PLC的标签信息,需要传入标签的名称,读取的字长度,标签举例:A; label[1]; bbb[10,10,10]
[Authorization] To read the label information of the PLC, you need to pass in the name of the label, the length of the word read, and an example of the label: A; label [1]; bbb [10,10,10]

命名空间:  HslCommunication.Profinet.Melsec
程序集:  HslCommunication (在 HslCommunication.dll 中) 版本:11.8.2.0 (11.8.2.0)
语法
public OperateResult<byte[]> ReadTags(
	string tag,
	ushort length
)

参数

tag
类型:SystemString
数据标签
length
类型:SystemUInt16
读取的数据长度

返回值

类型:OperateResultByte
是否成功
备注
不可以访问局部标签。
不可以访问通过GX Works2设置的全局标签。
为了访问全局标签,需要通过GX Works3的全局标签设置编辑器将“来自于外部设备的访问”的设置项目置为有效。(默认为无效。)
以ASCII代码进行数据通信时,由于需要从UTF-16将标签名转换为ASCII代码,因此报文容量将增加
参见