English
Language : 

PD17012_15 Datasheet, PDF (276/320 Pages) Renesas Technology Corp – 4-BIT SINGLE-CHIP MICROCONTROLLERS WITH DIGITAL TUNING SYSTEM HARDWARE
µPD17012, 17P012
Example 2.
R1
MEM
R2
MEM
R3
MEM
R4
MEM
M1
MEM
M2
MEM
CHANGE FLG
0.01H
0.02H
0.03H
0.04H
0.11H
0.12H
0.13H.0
; First digit of key input data of security code
; Second digit of key input data of security code
; First digit data for changing security code
; Second digit data for changing security code
; First digit of current security code
; Second digit of current security code
; “1” while security code is changed
START:
Key input processing
R1 ← contents of key A
R2 ← contents of key B
; Security code input wait mode
; Substitutes contents of pressed key into R1 and R2.
SKT1 CHANGE ;<4> ; If CHANGE flag is “1”
BR
SECURITY_CHK
ST
M1, R3
; rewrites M1 and M2.
ST
M2, R4
CLR1 CHANGE
SECURITY_CHK:
SET2 CMP, Z ;<1> ; Compares security code with input data.
SUB R1, M1
SUB R2, M2
SKT1 Z
BR
ERROR
; Input data is different from security code.
MAIN:
Key input processing
R3 ← contents of key C
R4 ← contents of key D
; Security code rewriting mode
; Substitutes contents of pressed key into R3 and R4.
SET1
ST
ST
CLR1
BR
ERROR:
CHANGE ;<5> ; Until security code is changed
; Sets CHANGE flag to 1.
M1, R3 ;<2> ; Rewrites security code
M2, R4 ;<3>
CHANGE
; When security code has been changed, sets
; CHANGE flag to 0.
MAIN
Must not operate
In the program in Example 2, the CHANGE flag is set to 1 in <5> before the security code is changed in <2>
and <3>.
Therefore, the security code is rewritten in <4> even if a CE reset is effected before <3> is executed.
274
Data Sheet U10101EJ4V0DS