public class KeyenceNanoHelper extends Object
| 构造器和说明 |
|---|
KeyenceNanoHelper() |
| 限定符和类型 | 方法和说明 |
|---|---|
static OperateResultExOne<byte[]> |
BuildReadCommand(String address,
short length)
建立读取PLC数据的指令,需要传入地址数据,以及读取的长度,地址示例参照类的说明文档
To create a command to read PLC data, you need to pass in the address data, and the length of the read. |
static OperateResultExOne<byte[]> |
BuildWriteCommand(String address,
boolean value)
建立写入bool数据的指令,针对地址类型为 R,CR,MR,LR
Create instructions to write bool data, address type is R, CR, MR, LR+ |
static OperateResultExOne<byte[]> |
BuildWriteCommand(String address,
boolean[] value)
批量写入数据位到plc地址,针对地址格式为 R,B,CR,MR,LR,VB
Write data bits in batches to the plc address, and the address format is R, B, CR, MR, LR, VB |
static OperateResultExOne<byte[]> |
BuildWriteCommand(String address,
byte[] value)
建立写入PLC数据的指令,需要传入地址数据,以及写入的数据信息,地址示例参照类的说明文档
To create a command to write PLC data, you need to pass in the address data and the written data information. |
static OperateResultExOne<byte[]> |
BuildWriteExpansionMemoryCommand(byte unit,
int address,
byte[] value)
构建写入扩展单元缓冲寄存器的报文命令,需要传入单元编号,地址,写入的数据,实际写入的数据格式才有无符号的方式
To construct a message command to write to the buffer register of the expansion unit, the unit number, address, and data to be written need to be passed in, and the format of the actually written data is unsigned. |
static OperateResult |
CheckPlcReadResponse(byte[] ack)
校验读取返回数据状态,主要返回的第一个字节是不是E
Check the status of the data returned from reading, whether the first byte returned is E |
static OperateResult |
CheckPlcWriteResponse(byte[] ack)
校验写入返回数据状态,检测返回的数据是不是OK
Verify the status of the returned data written and check whether the returned data is OK |
static OperateResultExOne<boolean[]> |
ExtractActualBoolData(String addressType,
byte[] response)
从PLC反馈的数据进行提炼Bool操作
Refine Bool operation from data fed back from PLC |
static OperateResultExOne<byte[]> |
ExtractActualData(String addressType,
byte[] response)
从PLC反馈的数据进行提炼操作
Refining operation from data fed back from PLC |
static byte[] |
GetConnectCmd(byte station,
boolean useStation)
连接PLC的命令报文
Command message to connect to PLC |
static byte[] |
GetDisConnectCmd(byte station,
boolean useStation)
断开PLC连接的命令报文
Command message to disconnect PLC |
static int |
GetWordAddressMultiple(String type)
获取当前的地址类型是字数据的倍数关系
|
static OperateResultExTwo<String,Integer> |
KvAnalysisAddress(String address)
解析数据地址成不同的Keyence地址类型
Parse data addresses into different keyence address types |
static OperateResultExOne<byte[]> |
Read(IReadWriteDevice keyence,
String address,
short length) |
static OperateResultExOne<String> |
ReadAddressAnnotation(IReadWriteDevice keyence,
String address)
[Authorization] Read the comment information of the specified device |
static OperateResultExOne<boolean[]> |
ReadBool(IReadWriteDevice keyence,
String address,
short length) |
static OperateResultExOne<byte[]> |
ReadExpansionMemory(IReadWriteDevice keyence,
byte unit,
short address,
short length)
[Authorization] Continuously read the specified number of data from the expansion unit buffer memory, the unit is word |
static OperateResultExOne<Integer> |
ReadPlcMode(IReadWriteDevice keyence)
[Authorization] Read the current PLC mode, if it is 0, it means PROG mode or the ladder diagram is not registered, if it is 1, it means RUN mode |
static OperateResultExOne<KeyencePLCS> |
ReadPlcType(IReadWriteDevice keyence)
[Authorization] Query PLC model information |
static OperateResult |
SetPlcDateTime(IReadWriteDevice keyence,
Date dateTime)
[Authorization] Set PLC time |
static OperateResult |
Write(IReadWriteDevice keyence,
String address,
boolean value) |
static OperateResult |
Write(IReadWriteDevice keyence,
String address,
boolean[] value) |
static OperateResult |
Write(IReadWriteDevice keyence,
String address,
byte[] value) |
static OperateResult |
WriteExpansionMemory(IReadWriteDevice keyence,
byte unit,
short address,
byte[] value)
[Authorization] To write the original byte data to the extended buffer memory, you need to specify the unit number, offset address, and write data |
public static byte[] GetConnectCmd(byte station,
boolean useStation)
station - 当前PLC的站号信息useStation - 是否启动站号命令public static byte[] GetDisConnectCmd(byte station,
boolean useStation)
station - 当前PLC的站号信息useStation - 是否启动站号命令public static int GetWordAddressMultiple(String type)
type - 地址的类型public static OperateResultExOne<byte[]> BuildReadCommand(String address, short length)
address - 软元件地址length - 读取长度public static OperateResultExOne<byte[]> BuildWriteCommand(String address, byte[] value)
address - 软元件地址value - 转换后的数据public static OperateResultExOne<byte[]> BuildWriteExpansionMemoryCommand(byte unit, int address, byte[] value)
unit - 单元编号0~48address - 地址0~32767value - 写入的数据信息,单次交互最大256个字public static OperateResultExOne<byte[]> BuildWriteCommand(String address, boolean value)
address - 软元件地址value - 转换后的数据public static OperateResultExOne<byte[]> BuildWriteCommand(String address, boolean[] value)
address - PLC的地址value - 等待写入的bool数组public static OperateResult CheckPlcReadResponse(byte[] ack)
ack - 反馈信息public static OperateResult CheckPlcWriteResponse(byte[] ack)
ack - 反馈信息public static OperateResultExOne<boolean[]> ExtractActualBoolData(String addressType, byte[] response)
addressType - 地址的数据类型response - PLC反馈的真实数据public static OperateResultExOne<byte[]> ExtractActualData(String addressType, byte[] response)
addressType - 地址的数据类型response - PLC反馈的真实数据public static OperateResultExTwo<String,Integer> KvAnalysisAddress(String address)
address - 数据地址public static OperateResultExOne<byte[]> Read(IReadWriteDevice keyence, String address, short length)
public static OperateResult Write(IReadWriteDevice keyence, String address, byte[] value)
public static OperateResultExOne<boolean[]> ReadBool(IReadWriteDevice keyence, String address, short length)
public static OperateResult Write(IReadWriteDevice keyence, String address, boolean value)
public static OperateResult Write(IReadWriteDevice keyence, String address, boolean[] value)
public static OperateResultExOne<KeyencePLCS> ReadPlcType(IReadWriteDevice keyence)
keyence - PLC通信对象public static OperateResultExOne<Integer> ReadPlcMode(IReadWriteDevice keyence)
keyence - PLC通信对象public static OperateResult SetPlcDateTime(IReadWriteDevice keyence, Date dateTime)
keyence - PLC通信对象dateTime - 时间数据public static OperateResultExOne<String> ReadAddressAnnotation(IReadWriteDevice keyence, String address)
keyence - PLC通信对象address - 软元件的地址public static OperateResultExOne<byte[]> ReadExpansionMemory(IReadWriteDevice keyence, byte unit, short address, short length)
keyence - PLC的通信对象unit - 单元编号address - 偏移地址length - 读取的长度,单位为字public static OperateResult WriteExpansionMemory(IReadWriteDevice keyence, byte unit, short address, byte[] value)
keyence - PLC通信对象信息unit - 单元编号address - 偏移地址value - 等待写入的原始字节数据Copyright © 2022. All rights reserved.