English
Language : 

PD17012_15 Datasheet, PDF (275/320 Pages) Renesas Technology Corp – 4-BIT SINGLE-CHIP MICROCONTROLLERS WITH DIGITAL TUNING SYSTEM HARDWARE
µPD17012, 17P012
Example 1.
R1
MEM 0.01H
R2
MEM 0.02H
R3
MEM 0.03H
R4
MEM 0.04H
M1
MEM 0.11H
M2
MEM 0.12H
; 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
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.
SET2
SUB
SUB
SKT1
BR
MAIN:
CMP, Z ;<1> ; Compares security code with input data.
R1, M1
R2, M2
Z
ERROR
; Input data is different from security code.
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.
ST
ST
BR
ERROR:
M1, R3 ;<2> ; Rewrites security code.
M2, R4 ;<3>
MAIN
Must not operate
Suppose the current security code is “12H” in the above program, the contents of data memory areas M1 and
M2 are “1H” and “2H”, respectively.
If CE reset is effected, the contents of the key input are compared with security code “12H” in <1>. If they
match, normal processing is performed.
If the security code is changed by the main processing, the new code is written to M1 and M2 in <2> and <3>.
Suppose the security code is changed to “34H”, “3H”, and “4H” are written to M1 and M2, respectively, in <2>
and <3>.
If a CE reset is effected at the point where <2> is executed, the program is executed from address 0000H
without <3> being executed.
Consequently, the security code is changed to “32H”, making it impossible to clear the security.
In this case, use the program shown in Example 2 below.
Data Sheet U10101EJ4V0DS
273