English
Language : 

W78IRD2 Datasheet, PDF (52/76 Pages) Winbond – 8-BIT MICROCONTROLLER
W78IRD2
14. TIMED-ACCESS PROTECTION
The W78IRD2 has features like Timer clock selecting by setting CKCON, software reset and ISP
function that are crucial to the proper operation of the system. Consequently, The SFR CHPCON and
CKCON, which control the functions, have restricted write access to protect CPU from errant operation.
The W78IRD2 provides has a timed-access protection scheme that controls write access to critical
bits.
In this scheme, protected bits have a timed write-enable window. A write is successful only if this
window is active; otherwise, the write is discarded. The write-enable window is opened in two steps.
First, the software writes 87h to the register CHPENR. This starts a counter, which expires in three
machine cycles. Then, if the software writes 59h to CHPENR before the counter expires, the write-
enable window is opened for three machine cycles. After three machine cycles, the window
automatically closes, and the procedure must be repeated again to access protected bits.
The suggested code for opening the write-enable window is
CHPENRREG 0F6h
; Define new register CHPENR, located at 0F6h
MOV CHPENR, #87h
MOV CHPENR, #59h
Five examples, some correct and some incorrect, of using timed-access protection are shown below.
Example 1: Valid access
MOV CHPENR, #87h
MOV CHPENR, #59h
MOV CKCON, #00h
;3 M/C, Note: M/C = Machine Cycles
;3 M/C
;3 M/C
Example 2: Valid access
MOV CHPENR, #87h
MOV CHPENR, #59h
NOP
SETB EWT
;3 M/C
;3 M/C
;1 M/C
;2 M/C
Example 3: Valid access
MOV CHPENR, #87h
MOV CHPENR, #59h
ORL CKCON, #01h
;3 M/C
;3 M/C
;3M/C
- 52 -