Download Print this page

Renesas M16C/50 Series User Manual page 683

Advertisement

M16C/5L Group, M16C/56 Group
CRC calculation and setting procedure to generate CRC, 80C4h, with CRC-CCITT
(LSB first selected)
• CRC calculator specification
CRC: remainder of a division,
Generator polynomial: X
• Setting procedures
(1) Invert the bit position of the value 80C4h by a program in 1-byte units.
80h
01h, C4h
(2) Write 0000h (initial value) to the CRCD register.
(3) Write 01h (inverted value of 80h) to the CRCIN register.
(4) Write 23h (inverted value of C4h) to the CRCIN register.
• Details on CRC calculation
As shown in (3) above, bit position of 01h (0000 0001b) written to the CRCIN register is reversed and becomes 80h
(1000 0000b). Add 1000 0000 0000 0000 0000 0000b, as 1000 0000b 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.
1000 1000 0001 0000 1
Generator
polynomial
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 (0010 0011b) written in the CRCIN register is inversed and becomes C4h (1100
0100b). Add 1100 0100 0000 0000 0000 0000b, as 1100 0100b 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 1000 0010 0101 0000b (8250h) with inversed bit position, can be read
from the CRCD register.
Figure 25.2
CRC Calculation When Using CRC-CCITT
R01UH0127EJ0110 Rev.1.10
Sep 01, 2011
inverted value of the CRCIN register
generator polynomial
16
12
5
+ X
+ X
+ 1 (1 0001 0000 0010 0001b)
23h
b15
CRCD register
CRCIN register
b15
CRCD register
CRCIN register
b15
CRCD register
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
b0
0000h
b7
b0
01h
After two cycles, 1189h, which is a bit-
position-inverse value of 9188h (CRC for
80h) is stored in the CRCD register.
b0
1189h
b7
b0
23h
After two cycles, 0A41h, which is a bit-
position-inverse value of 8250h (CRC for
80C4h) is stored in the CRCD register.
b0
0A41h
1000 1000
Data
CRC
25. CRC Calculator
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
Page 646 of 803

Advertisement

loading