User Tools

Site Tools

한국어

logicpython:cubloc_api:getcrc

This is an old revision of the document!


GetCrc

Calculate the MODBUS RTU CRC-16 of a byte array slice.

Syntax

from cubloc import GetCrc
 
GetCrc(arrayName: bytes, byteLength: int)

Parameters

  • arrayName: Source byte array.
  • byteLength: Number of bytes from the start of arrayName to include.

Return Value

Returns the MODBUS RTU CRC-16 value for the requested byte slice.

Exceptions

  • TypeError: arrayName is not bytes or byteLength is not an integer.
  • ValueError: byteLength is outside 1 to 65535 or larger than arrayName.

Example

from cubloc import GetCrc
 
# Example usage
result = GetCrc([1, 2, 3], 1)
print(result)
logicpython/cubloc_api/getcrc.1775786798.txt.gz · Last modified: by 127.0.0.1