Renesas M16C/62P Hardware Manual page 241

Renesas 16-bit single-chip microcomputer
Hide thumbs Also See for M16C/62P:
Table of Contents

Advertisement

M16C/62P Group (M16C/62P, M16C/62PT)
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: X
· Setting procedure
(1) Reverse the bit positions of the value "80C4h" by program in 1-byte units.
"80h"
"01h", "C4h"
(2) Write 0000h (initial value)
(3) Write 01h
(4) Write 23h
· Details of CRC operation
In the case of (3) above, the value written to the CRCIN register "01h (00000001b)" has its bit positions reversed to
become "10000000b." The value, "1000 0000 0000 0000 0000 0000b," derived from that by adding 16 digits and the
initial value of the CRCD register, "0000h" are added. The result is divided by the generator polynomial using modulo-2
arithmetic.
1 0001 0000 0010 0001 1000 0000 0000 0000 0000 0000
Generator polynomial
The value "0001 0001 1000 1001b (1189h)" derived from the remainder "1001 0001 1000 1000b (9188h)" by reversing
its bit positions may be read from the CRCD register.
If operation (4) above is performed subsequently, the value written to the CRCIN register "23h (00100011b)" has its bit
positions reversed to become "11000100b". The value "1100 0100 0000 0000 0000 0000b" derived from that by
adding 16 digits and the remainder in (3) "1001 0001 1000 1000b" which is left in the CRCD register are added, the
result of which is divided by the generator polynomial using modulo-2 arithmetic.
The value "0000 1010 0100 0001b (0A41h)" derived from the remainder by reversing its bit positions may be read
from the CRCD register.
Figure 20.3 CRC Calculation
R
e
. v
2
3 .
0
S
e
p
0
, 1
2
0
0
4
R
E
J
0
9
B
0
1
8
5
0 -
2
3
0
Z
16
12
5
+ X
+ X
+ 1 (1 0001 0000 0010 0001b)
"23h"
b15
b15
b15
1000 1000 0001 0000 1
1000 0001 0000 1000 0
1000 1000 0001 0000 1
CRC code
page 227
f o
3
6
4
b0
CRCD register
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.
b0
CRCD register
1189h
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.
b0
CRCD register
0A41h
1000 1000
Data
1001 0001 1000 1000
20. CRC Calculation
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

Advertisement

Table of Contents
loading

This manual is also suitable for:

M16c/62pt

Table of Contents