beautypg.com

Timed-access protection, 1 protected bits, 2 protection scheme – Maxim Integrated High-Speed Microcontroller User Manual

Page 153

background image

High-Speed Microcontroller User’s Guide

Rev: 062210

153 of 176

13. TIMED-ACCESS PROTECTION

The 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 opening 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
bit. This section explains which bits are protected, why, and how to use the timed-access feature.

13.1 Protected Bits

Bits that are protected by the timed-access feature are shown below. Only critical function bits that are
unique to the high-speed microcontroller family are protected, assuring code compatibility with the
original 80C51 or 80C52. A full description of the function of each bit is provided in Section

4

.

EXIF

.0

BGS

Bandgap Select

WDCON

.6

POR

Power-On Reset Flag

WDCON

.1

EWT

Watchdog Reset Enable

WDCON

.0

RWT

Reset Watchdog Timer

WDCON

.3

WDIF

Watchdog Interrupt Flag

TRIM

.7

E4K

4096Hz RTC Output

TRIM

.6 X12/

6

12pF/6pF Crystal Select

TRIM

.5

TRM2

Capacitance Trim Bit 2

TRIM

.4

TRM2

Inverse Capacitance Trim Bit 2

TRIM

.3

TRM1

Capacitance Trim Bit 1

TRIM

.2

TRM1

Inverse Capacitance Trim Bit 1

TRIM

.1

TRM0

Capacitance Trim Bit 0

TRIM

.0

TRM0

Inverse Capacitance Trim Bit 0

ROMSIZE

.2 RMS2

ROM Size Select Bit 2

ROMSIZE

.1 RMS1

ROM Size Select Bit 1

ROMSIZE

.0 RMS0

ROM Size Select Bit 0

RTCC

.2

RTCWE RTC Write Enable

RTCC

.0

RTCE

RTC Enable

13.2 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 will open for three machine cycles. During this window, the software
may modify a protected bit. The suggested code to open a timed-access window is:

MOV 0C7h, #0AAh
MOV 0C7h, #55h


The procedure to modify a timed-accessprotected 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 machine

cycles of writing AAh. This opens a three-machine cycle window, after the write of 55h, during which
any timed-access protected bits may be modified. Failure to complete any of the required steps will also
require 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 will be ignored. This is regardless of