User manual
V002450_25_CR1200-CR2-CR3-CR2500-CR3500_Interface_Configuration_Document_CLIENT.docx
2011-04-27 Page 63 of 65
© 2011 The Code Corporation
•
14870 S. Pony Express Rd., Suite 200, Bluffdale, UT 84065
•
(801) 495-2200
•
FAX (801) 495-0280
14 Appendix: Example CRC16 C Code
/* crc16.h
*/
#ifndef crc16_h
#define crc16_h
#include <stdint.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef uint16_t crc_t;
crc_t crc
( crc_t initialCrc
, const unsigned char* bufPtr
, size_t length
);
#ifdef __cplusplus
} // extern "C"
#endif
#endif
/* crc16.c
*/
#include <crc16.h>
crc_t crc
( crc_t initialCrc
, const unsigned char* p
, size_t n
)
{
enum