21.07.2015 Views

M16C User Manual.pdf

M16C User Manual.pdf

M16C User Manual.pdf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CRC Calculation CircuitMitsubishi microcomputers<strong>M16C</strong> / 62 GroupSINGLE-CHIP 16-BIT CMOS MICROCOMPUTER2.10.2 Operation of CRC Calculation CircuitThe following describes the operation of the CRC calculation. Figure 2.10.3 shows an example of calculationdata 012316 using the CRC calculation circuit.Operation (1) The CRC calculation circuit sets an initial value in the CRC data register.(2) Writing 1 byte data to the CRC input register generates CRC code based on the data register.CRC code generation for 1 byte data finishes in two machine cycles.(3) The CRC calculation circuit detects an error by means of comparing the CRC-checking datawith the content of the CRC data register, after the next data is written to the CRC inputregister.(4) The content of CRC data register after all data is written becomes CRC code.(1) Setting 000016b15b0CRC data registerCRCD[03BD16, 03BC16]b7b0(2) Setting CRC input register CRCIN0116[03BE16]2 cyclesAfter CRC calculation is completeb15118916b0CRC data registerCRCD[03BD16, 03BC16]Stores CRC codeThe code resulting from sending 0116 in LSB first mode is (1000 0000). Thus the CRC code in the generating polynomial,(X 16 + X 12 + X 5 + 1), becomes the remainder resulting from dividing (1000 0000) X 16 by (1 0001 0000 0010 0001) inconformity with the modulo-2 operation.LSB1000 10001 0001 0000 0010 0001 1000 0000 0000 0000 0000 00001000 1000 0001 0000 11000 0001 0000 1000 01000 1000 0001 0000 11001 0001 1000 1000LSB9 8 1 1MSBMSBModulo-2 operation isoperation that complieswith the law given below.0 + 0 = 00 + 1 = 11 + 0 = 11 + 1 = 0-1 = 1Thus the CRC code becomes (1001 0001 1000 1000). Since the operation is in LSB first mode, the (1001 0001 1000 1000)corresponds to 118916 in hexadecimal notation. If the CRC operation in MSB first mode is necessary in the CRC operationcircuit built in the <strong>M16C</strong>, switch between the LSB side and the MSB side of the input-holding bits, and carry out the CRCoperation. Also switch between the MSB and LSB of the result as stored in CRC data.(3) Setting 2316b7b0CRC input registerCRCIN[03BE16]After CRC calculation is completeb150A4116b0CRC data registerCRCD[03BD16, 03BC16]Stores CRC codeFigure 2.10.3. Calculation example using the CRC calculation circuit425

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!