Arithmetic instructions
85
Part II IEC Instructions
Input variables (VAR_INPUT):
Variable Data
type
Function
StartAddress ANY Starting address for the calculation of the check sum. For PLCs
which do not support the instruction F70_BCC (see page 411)
with CRC16 calculation (FP0, FP
5, FP10), the starting address
must be in the DT or FL area.
NumberOfBytes INT The number of bytes (8 bits), beginning with AdrStart, on which
the CRC16 calculation is performed.
Output variables (VAR_OUTPUT):
CRC ANY16 The calculated check sum, which is only valid if the flag IsValid
is set to TRUE.
IsValid BOOL Flag indicating whether the calculated check sum is valid or not.
For PLCs which do not support the instruction F70_BCC (see
page 411) with CRC16 calculation (FP0, FP5, FP10) the CRC is
not valid:
during the first eight execution scans wh
en an internal
table is built
if the address area of the variable StartAddress is not in
the DT or FL area.
For PLCs that support the instruction F70_BCC with CRC16
calculation, the CRC is always valid.
Data types
Example
In this example, the same POU header is used for all programming languages.
POU header
All input and output variables used for programming this function have been declared in the POU
header.
LD
ST
When programming with structured text, enter the following:
CRC16(StartAddress := Array1,
NumberOfBytes := ARRAY1_BYTES,
CRC => Array1Crc,
IsValid => CrcIsvalid);