pascalSCADA OPM: crc16utils

Pascal SCADA OPM

Unit crc16utils

Uses
Classes, Interfaces, Objects and Records
Types
Constants
Variables

Description

Unit that implement CRC-16 functions

:

Overview

Functions and Procedures

function Test_crc(const Pkg:BYTES):Boolean;
function Calcul_crc(var Pkg:BYTES):Cardinal;

Description

Functions and Procedures

function Test_crc(const Pkg:BYTES):Boolean;

: Verifies an package of BYTES ultil their length - 2 and returns True if the value calculated is the same on that is stored in the last 2 bytes of the package.

If the Pkg has 10 bytes of length, it will calculate the CRC using the first 8 bytes and it will check the result with bytes 9 and 10 of Pkg. The byte number 9 is the most significative.

Parameters
Pkg
BYTES. Buffer that stores the data that will be checked the CRC-16. Must have at least 2 bytes of length.
Returns

True if the CRC-16 calculated is the same that is stored on the last 2 bytes of Pkg.

function Calcul_crc(var Pkg:BYTES):Cardinal;

: Calculate the CRC-16 of the package until their size - 2. If the package has 10 bytes of length, it will use to calculate the first 8 bytes and will store the result of the calculation on bytes 9 and 10. The byte number 9 is the most significative.

Parameters
Pkg
BYTES. Buffer that contains the data that will be used to calculate the CRC-16 and that will store the result on the last 2 bytes. Must have at least 2 bytes of length.
Returns

A Cardinal number with the CRC-16 calculated with length of Pkg - 2.

Author


Generated by PasDoc 0.14.0.