Oc_calculatecrc -2 – Rockwell Automation 1747-PCINT API Software for 1746 I/O User Manual

Page 56

Advertising
background image

6–2

Library of Routines

OC_CalculateCRC

Publication 1747-6.5.3 June 1998

OC_CalculateCRC

OC_CalculateCRC calculates a 16-bit CRC.

Syntax:

void

OC_CalculateCRC(BYTE *bufPtr, WORD bLen, WORD *Crc);

Parameters:

Description:

This function is useful for verifying data integrity. For example, a CRC might be appended to data stored
in the host retentive data partition. When the data is later retrieved, a new CRC can be calculated and
compared to the old CRC to ensure the data is valid.

Return Value:

none

Considerations:

Supported in the DOS API library and the Windows NT API library

Example:

BYTE

buffer[100];

WORD

buffer_crc;

int

retcode;

retcode = OC_CalculateCRC( buffer, 100, &buffer_crc );

Parameter:

Description:

bufPtr

Points to the buffer that contains the bytes for the CRC calculation

bLen

Number of bytes for which to calculate the CRC

Crc

A word that returns the calculated CRC

Advertising
This manual is related to the following products: