Function - calculates a CRC16 on the characters of a string


IN : STRING character string


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


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
     ST    Q