CRC16

Function - calculates a CRC16 on the characters of a string

Inputs

IN : STRING character string

Outputs

Q : INT     CRC16 calculated on all the characters of the string.

Remarks

In LD language, the input rung (EN) enables the operation, and the output rung keeps the same value as the input rung. In IL language, the input parameter (IN) must be loaded in the current result before calling the function.

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

ST Language

Q := CRC16 (IN);

FBD Language

LD Language

(* The function is executed only if EN is TRUE *)
(* ENO is equal to EN *)

IL Language:

Op1: LD    IN
     CRC16
     ST    Q