crcclass.h
来自「MODBUS主、子站规约模拟程序。可以做为MODBUS规约测试的工具」· C头文件 代码 · 共 52 行
H
52 行
//---------------------------------------------------------------------------
#ifndef CRCClassH
#define CRCClassH
//---------------------------------------------------------------------------
typedef char BYTE1 ;
typedef unsigned char UBYTE1 ;
typedef short BYTE2 ;
typedef unsigned short UBYTE2 ;
typedef int BYTE4 ;
typedef unsigned int UBYTE4 ;
const int MAXBYTEVALUES = 256;
const int BITSPERBYTE = 8 ;
class Crc
{
public:
Crc ( unsigned int BitCount,
unsigned long Polynominal,
bool Reverse,
unsigned long Initial,
unsigned long FinalMask) ;
~Crc () {}
BYTE4 Reverse (UBYTE4 value);
UBYTE4 value (void) const ;
void reset (void) ;
void update (const char *buffer, unsigned int length) ;
UBYTE4 getcrc(const char *buffer, unsigned int length) ;
bool GetReverse(void)
{
return FREVERSE;
};
_declspec( property( get=GetReverse, put=SetReverse ) ) bool REVERSE;
private:
unsigned int BITCOUNT;
unsigned long POLYNOMINAL;
bool FREVERSE;
unsigned long INITIAL;
unsigned long FINALMASK;
unsigned long mask;
static UBYTE4 bits [];//BITSPERBYTE * 4];
UBYTE4 values [MAXBYTEVALUES] ;
UBYTE4 crc_register ;
void SetReverse(bool reverse);
UBYTE4 ForwardTableEntry (unsigned int entryindex);
UBYTE4 ReverseTableEntry (unsigned int entryindex);
} ;
//---------------------------------------------------------------------------
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?