CRC16_Modbus (FUN)

FUNCTION CRC16_Modbus : WORD

Function calculates the Modbus CRC16 checksum. Deviating from the initial value generally used the check sum will be initialized with 16#FFFF.

Example:

sTest : STRING(10) := '123456789' ;
->
MEM.CRC16_Modbus(ADR(sTest), 9) = 16#4B37
InOut:

Scope

Name

Type

Comment

Return

CRC16_Modbus

WORD

function returns the Modbus CRC16 checksum of “MemoryBlock”

Input

pMemoryBlock

POINTER TO BYTE

address of memory Block

uiLength

UINT

length of MemoryBlock in byte