English
Language : 

M306H7MG-XXXFP Datasheet, PDF (190/329 Pages) Renesas Technology Corp – SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER with DATA ACQUISITION CONTROLLER
M306H7MG-XXXFP/MC-XXXFP/FGFP
14. EXPANSION FUNCTION
;
;
Equations (Constant definition)
;
_CRC_ADRS
.equ
_CRC_DATA
.equ
SLICE_WORD_NUM
.equ
00212h
00214h
17
; SFR address of CRC register address control register
; SFR address of CRC register data control register
; Code data length (in nuits of word)
;
;
;
_wait
.endm
Macro definition
.macro
nop
nop
nop
;
;
CRC operation routine
;
;--------- Setting of generator polynomial
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
mov.w
#0008H
, _CRC_ADRS
; Set the head address of the generator polynomial register
_wait
; Wait
mov.w
0000110000100011B
, _CRC_DATA
; Coefficient of generator polynomial 82nd to 66th ( x^77 +x~76 +x^71 +x^67 +x^66)
;------ Writing of code data ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
mov.w
#0000H
, _CRC_ADRS
; Initialization of CRC register address control register
mov.w
#9010H
, _CRC_ADRS
; Set up of CRCON=1, CRCCHANGE=0, CRCLOOP=10H, Increment=ON, and CRC address=00H.
mov.w
#0000H
, A0
; Initialization of a loop variable (A0)
L18:
; Branch label
cmp.w
#SLICE_WORD_NUM*2
, A0
; Comparison of the loop variable
jgeu
L20
; Go to L20 if writing code data is finished.
lde.w
_CrcCodeData[A0]
, _CRC_DATA
; Writing code data to the code data shift register.
add.w
#0002H
,A0
; Increment of the address storing code data.
jmp
L18
; Return to the head of this loop.
L20:
; Branch label
;--------- Dummy shift ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
; After finishing writing 272-bit code data,
; shift a bit for dummy surely in error correction mode.
; Specifying 1-bit is set up by CRCLOOP=01H.
mov.w
#8100H
, _CRC_ADRS
; Set up of CRCON=1, CRCCHANGE=0, CRCLOOP=10H, Increment=OFF, and CRC address=00H.
_wait
; Wait
mov.w
#0000H
, _CRC_DATA
; Writing data to the code data shift register for dummy shift.
;--------- Error detection -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
; Since the address automatic increment in dummy shift (Increment=OFF), set CRC address=01H here.
; When accessing other CRC registers, the processing shown in the following two lines is necessary.
;
mov.w
#9001H , _CRC_ADRS
; Set up of CRCON=1, CRCCHANGE=0, CRCLOOP=10H, Incremet=OFF and CRC address=01H.
;
_wait
; Wait
mov.w
_CRC_DATA
, R0
cmp.w
#0000H
, R0
jeq
L16
; Read of CRC error detection register.
; Judgement of CRC error.
; In the case of R0=0, branch to L16 since CRC error has not occurred (CRC error correction is skipped).
;--------- Error correction ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
mov.w
#0D010H
, _CRC_ADRS
; Set up of CRCON=1, CRCCHANGE=1, CRCLOOP=10H, Increment=ON and CRC address=00H.
_wait
; Wait
mov.w
#0000H
, A0
; Initialization of a loop variable (A0)
L22:
; Branch label
cmp.w
#SLICE_WORD_NUB
, A0
; Comparison of the loop variable
jgeu
L24
; Go to L24 if correction of error data is finished.
lde.w
_CrcCodeData[A0]
, _CRC_DATA
; Writing code data to the code data shift register.
jsr
_waitlong
; Wait for finish of error correction.
mov.w
_CRC_DATA
, _CrcCodeData[A0]
; Read of error correction data in the address storing code data.
add.w
#0002H
, A0
; Increment of the address storing code data.
jmp
L22
; Return to the head of this loop.
L24:
; Branch label
;------- The check of error correction data--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
mov.w
#8111H
, _CRC_ADRS
; Set up of CRCON=1, CRCCHANGE=0, CRCLOOP=10H, Increment=ON and CRC address=00H
_wait
; Wait
mov.w
_CRC_DATA
, R0
; Error check after error correction. R0=000H if correction is performed.
L16:
;
; The function sample for weight for error correction
;
.align
.glb
_waitlong
_waitlong:
rts
; Function label
Figure 14.8 Example of program
Rev.2.10 Oct 25, 2006 Page 190 of 326
REJ03B0152-0210