通过指定多项式码来获取对应的数据的CRC校验码
The CRC check code of the corresponding data is obtained by specifying the polynomial code
命名空间:
HslCommunication.Serial
程序集:
HslCommunication (在 HslCommunication.dll 中) 版本:12.1.2.0 (12.1.2.0)
语法 public static byte[] CRC16Only(
byte[] value,
int index,
int length,
byte CH,
byte CL,
byte preH = 255,
byte preL = 255
)
Public Shared Function CRC16Only (
value As Byte(),
index As Integer,
length As Integer,
CH As Byte,
CL As Byte,
Optional preH As Byte = 255,
Optional preL As Byte = 255
) As Byte()
public:
static array<unsigned char>^ CRC16Only(
array<unsigned char>^ value,
int index,
int length,
unsigned char CH,
unsigned char CL,
unsigned char preH = 255,
unsigned char preL = 255
)
static member CRC16Only :
value : byte[] *
index : int *
length : int *
CH : byte *
CL : byte *
?preH : byte *
?preL : byte
(* Defaults:
let _preH = defaultArg preH 255
let _preL = defaultArg preL 255
*)
-> byte[]
参数
- value
- 类型:SystemByte
需要校验的数据,不包含CRC字节 - index
- 类型:SystemInt32
计算的起始字节索引 - length
- 类型:SystemInt32
计算的字节长度 - CH
- 类型:SystemByte
多项式码高位 - CL
- 类型:SystemByte
多项式码地位 - preH (Optional)
- 类型:SystemByte
预置的高位值 - preL (Optional)
- 类型:SystemByte
预置的低位值
返回值
类型:
Byte返回带CRC校验码的字节数组,可用于串口发送
参见