beautypg.com

Protected bits, Protection scheme, Protected bits -2 – Maxim Integrated Ultra-High-Speed Flash Microcontroller User Manual

Page 150: Protection scheme -2

background image

13-2

Ultra-High-Speed Flash

Microcontroller User’s Guide

SECTION 13: TIMED-ACCESS PROTECTION

The ultra-high-speed microcontroller uses a protection feature called timed access to prevent accidental writes to critical SFR bits. These

bits could cause a system failure or prevent the watchdog timer from doing its job if improperly written. The timed access involves open-

ing a timing window during which the protected bit can be modified. If the window is opened correctly, it remains open long enough to

alter one protected register. This section explains which bits are protected, why, and how to use the timed-access feature.

Protected Bits

Bits that are protected by the timed-access feature are shown below. Only critical function bits unique to the ultra-high-speed micro-

controller are protected, ensuring code compatibility with the original 80C51 or 80C52. A full description of the function of each bit is

provided in Section 4:

WDCON.0

RWT

Reset watchdog timer

WDCON.1

EWT

Watchdog reset enable

WDCON.3

WDIF

Watchdog interrupt flag

WDCON.6

POR

Power-on reset flag

EXIF.0

BGS

Bandgap select

ACON.5

PAGES0

Page mode select bit 0

ACON.6

PAGES1

Page mode select bit 1

ACON.7

PAGEE

Page mode enable

ROMSIZE.0

RMS0

Program memory size select bit 0

ROMSIZE.1

RMS1

Program memory size select bit 1

ROMSIZE.2

RMS2

Program memory size select bit 2

ROMSIZE.3

RMS3

Program RAM enable

FCNTL.0

FC0

Flash command bit 0

FCNTL.1

FC1

Flash command bit 1

FCNTL.2

FC2

Flash command bit 2

FCNTL.3

FC3

Flash command bit 3

Protection Scheme

Each bit mentioned above is protected against an accidental write by requiring the software to perform a procedure before writing the

bit. Timed access requires the software to write two specific values to the timed-access register during two consecutive instruction

cycles. The values AAh, then 55h, must be written in consecutive instructions to the TA register at SFR location C7h. If the writes are

performed correctly, the write-access window opens for three memory cycles. During this window, the software may modify a protect-

ed bit. The suggested code to open a timed-access window is:

MOV 0C7h, #0AAh

MOV 0C7h, #55h

The procedure to modify a timed-access-protected bit begins by writing the value AAh to the timed-access register (TA;C7h). The value

55h must then be written to the timed-access register within three memory cycles of writing AAh. This opens a three memory-cycle win-

dow, after the write of 55h, during which any timed-access protected bits may be modified. Failure to complete any of the required

steps also requires the procedure to begin again, starting with the write of AAh to the timed-access register. Attempts to modify timed-

access-protected bits after the window has closed are ignored. This is regardless of whether any bits were modified. Figure 13-1 illus-

trates a number of examples of correct and incorrect use of the timed-access procedure.

Maxim Integrated