导航: 老古网老古论坛XMOS公共讨论区XMOS开源项目区单片机程序设计嵌入式系统广告区域
→C51编程:恳请详细指导如下这段关于CRC校验的确切意思,谢[zbby]

 *第3244篇: C51编程:恳请详细指导如下这段关于CRC校验的确切意思,谢谢。

  
楼 主:zbby 2002年5月15日07:08
 C51编程:恳请详细指导如下这段关于CRC校验的确切意思,谢谢。
CRC SEQUENCE 
The frame check sequence is derived from a cyclic redundancy 

code best suited for frames with bit counts less than 127 bits 

(BCH Code).
In order to carry out the CRC calculation the polynomial to be 

diveded is defined as the polynomial, the coefficients of which 

are given by the destuffed bit stream consisting of START OF 

FRAME, ARBITRATION FIELD, CONTROL FIELD, DATA FIELD (if present) 

and , for the 15 lowest coefficient , by 0. This polynomial is 

divided (the coefficients are calculated modulo-2) by the 

generator -polynomial:
        
      x^15 + x^14 + x^10 + x^7 + x^4 + x^3 +1

The remainder of this polynomial division is the CRC SEQUENCE 

transmitted over the bus. In order to implement this function ,a 

15 bit shift register CRC_RG(14:0) can be used . If NXTBIT 

denotes the next bit of the bit stream, given by the destuffed 

bit sequence from START OF FRAME until the end of the DATA 

FIELD, the CRC  SEQUENCE is calculated as follows:

CRC_RG = 0;       //initialize shift register 
REPEAT 
         CRCNXT = NXTBIT EXOR CRC_RG(14);
         CRC_RG(14:1) = CRC_RG(13:0);    //shift left by
         CRC_RG(0) = 0;      //1 position 


         IF CRCNXT THEN 
                     CRC_RG(14:0) = CRC_RG(14:0) EXOR (4599hex);
         ENDIF

UNTIL(CRC SEQUENCE starts or there is an ERROR condition)

After the transmission/reception of the last bit of the DATA 

FIELD, CRC_RG contains the CRC sequence.


>>>>>>对该主题发表你的看法

本主题贴数1,分页: [第1页]


[上一篇主题]:老古,下载特区的的‘SST 89C54 89C58的中文资料’已经损坏,能帮忙修

[下一篇主题]:C51编程:请教w77e58的问题