|
M16C30P_07 Datasheet, PDF (197/317 Pages) Renesas Technology Corp – 16-BIT SINGLE-CHIP MICROCOMPUTER M16C FAMILY / M16C/30 SERIES | |||
|
◁ |
M16C/30P Group
17. CRC Calculation
Setup procedure and CRC operation when generating CRC code â80C4hâ
⢠CRC operation performed by the M16C
CRC code: Remainder of a division in which the value written to the CRCIN register with its bit positions reversed is
divided by the generator polynomial
Generator polynomial: X16 + X12 + X5 + 1 (1 0001 0000 0010 0001b)
⢠Setting procedure
(1) Reverse the bit positions of the value â80C4hâ by program in 1-byte units.
â80hâ â01hâ, âC4hâ â23hâ
b15
(2) Write 0000h (initial value)
b0
CRCD register
(3) Write 01h
(4) Write 23h
b7
b0
CRCIN register
Two cycles later, the CRC code for â80h,â i.e.,
9188h, has its bit positions reversed to become
â1189hâ which is stored in the CRCD register.
b15
b0
1189h
CRCD register
b7
b0
CRCIN register
Two cycles later, the CRC code for â80C4h,â i.e.,
8250h, has its bit positions reversed to become
â0A41hâ which is stored in the CRCD register.
b15
b0
0A41h
CRCD register
⢠Details of CRC operation
As shown in (3) above, bit position of â01hâ (00000001b) written to the CRCIN register is inversed and becomes
â10000000bâ.
Add â1000 0000 0000 0000 0000 0000bâ, as â10000000bâ plus 16 digits, to â0000 0000 0000 0000 0000 0000bâ,
as â0000 0000 0000 0000bâ plus 8 digits as the default value of the CRCD register to perform the modulo-2 division.
1 0001 0000 0010 0001
Generator polynomial
1000 1000
1000 0000 0000 0000 0000 0000
1000 1000 0001 0000 1
1000 0001 0000 1000 0
1000 1000 0001 0000 1
1001 0001 1000 1000
Data
Modulo-2 operation is
operation that complies
with the law given below.
0+0=0
0+1=1
1+0=1
1+1=0
-1 = 1
CRC code
â0001 0001 1000 1001b (1189h)â, the remainder â1001 0001 1000 1000b (9188h)â with inversed bit position, can
be read from the CRCD register.
When going on to (4) above, â23h (00100011b)â written in the CRCIN register is inversed and becomes
â11000100bâ.
Add â1100 0100 0000 0000 0000 0000bâ, as â11000100bâ plus 16 digits, to â1001 0001 1000 1000 0000 0000bâ, as
â1001 0001 1000 1000bâ plus 8 digits as a remainder of (3) left in the CRCD register to perform the modulo-2 division.
â0000 1010 0100 0001b (0A41h)â, the remainder with inversed bit position, can be read from CRCD register.
Figure 17.3 CRC Calculation
Rev.1.22 Mar 29, 2007 Page 181 of 291
REJ09B0179-0122
|
▷ |