Appendix K: Cyclic Redundancy Check (Crc) Calculation - Bosch Conettix D6600 Manual

Computer interface of receiver/gateway
Table of Contents

Advertisement

Conettix D6600/D6100IPv6/D6100i | Computer Interface Manual | Appendix K SafeCom Messages
(D6600 Only)
.

Appendix K: Cyclic Redundancy Check (CRC) Calculation

This CRC calculation section is referenced from the SIA DC-07 Computer Interface Standard. The
calculations for CRCs to the Bosch receivers are performed in the same manner.
CRCs are based on treating bit strings as representations of polynomials with coefficients of 0 and 1
only. An n-bit message is regarded as the coefficient list for a polynomial with n terms, ranging from
x ^ n-1 (high order bit) to x ^ 0 (low order bit).
For example, 110001 has 6 bits and thus represents a six term polynomial with coefficients
1, 1, 0, 0, 0, and 1: x ^ 5 + x ^ 4 + x ^ 0.
When the polynomial code method is employed, the sender and receiver must agree upon a generator
polynomial in advance. Both the high order and low order bits of the generator must be 1. The basic
idea is that the polynomial represented by the check summed message is divided by the generator. If
there is a remainder, then there has been a transmission error.
A 16 bit generator polynomial which has been widely implemented in data transfer protocols (such as
XMODEM CRC) is:
X ^ 16 + X ^ 15 + X ^ 2 + 1
This polynomial is called CRC-16. It catches all single and double errors, all errors with an odd
number of bits, all burst errors of 16 bits or less, 99.997% (1/32768 chance of failure) of 17 bit burst
errors, and 99.998% of 18 bit and longer burst errors (1/65536 chance of failure).
Polynomial arithmetic is done modulo 2, according to the rules of algebraic field theory, and therefore
should be performed with simple exclusive-ORs. Floating point is not required.
Calculation Routines
Two calculation routines are shown below, which each yield the same results. The second method of
CRC calculation greatly speeds CRC processing, but does require a 512 byte table.
Calculation Method 1
The following C Language program illustrates CRC calculation. It can be compiled as shown with many
compilers to demonstrate the CRC process.
/* THESE INCLUDES FOR MICROSOFT C 5.1 */
#include "stdio.h"
#include "stdlib.h"
/* FORWARDS */
unsigned int calcCRC(unsigned CRC, int ch);
void main(void)
{
unsigned int CRC;
int count, ch;
char *ptr, str[1024];
Bosch Security Systems, Inc. | 2012.09 | 4998122703-05
/* 16 BIT CRC RESULT */
181

Advertisement

Table of Contents
loading

This manual is also suitable for:

Conettix d6100ipv6Conettix d6100i

Table of Contents