CRC16

PLCopen motion icon

 Function - Calculates a CRC16 on the characters of a string.

Inputs

Input

Data Type

Range

Unit

Default

Description

IN

STRING

 

 

 

Character string.

Outputs

Output

Data Type

Range

Unit

Description

Q

INT

 

 

CRC16 calculated on all the characters of the string.

Remarks

  • The function calculates a Modbus CRC16, initialized at 16#FFFF value.

FBD Language Example

FFLD Language Example

  • In the FFLD Language, the input rung (EN) enables the operation.
    • The output rung (ENO) keeps the same value as the input rung.
    • The function is executed only if EN is TRUE.

IL Language Example

  • In the IL Language, the input must be loaded in the current result before calling the function.
Op1: LD    IN
     CRC16
     ST    Q

ST Language Example

Q := CRC16 (IN);