There are a number of bits that
the 80C320 considers vital to correct operation. If any of these
bits were to be inadvertently changed by a runaway (crashed)
CPU, system reliability could suffer. In order to insure that
these bits are not accidentally modified, a "timed access
protection system" was created to protect them.
Programming Tip:
The "Timed Accessed" procedure explained in this page also
applies to other Dallas Semiconductor high-speed
microcontrollers.
The timed access protection system requires that
the following instructions be executed immediately prior to
modifying a protected bit (note that the Timed Access TA
SFR is at C7h):
MOV TA,#0AAh MOV TA,#55h
Executing these two instructions (in the
specified order) opens a 3-cycle window during which a protected
bit can be modified. If an attempt is made to modify a protected
bit without these two instructions being executed immediately
beforehand, the modification will not take effect.
For example, if you wish to enable the Watchdog
by setting EWT (WDCON.1), you would need to
execute the following code:
MOV TA,#0AAh MOV TA,#55h SETB WDCON.1
You can also use the MOV command. So the above
example could also be written in the following manner:
MOV TA,#0AAh MOV TA,#55h MOV WDCON,#02h
It is very important to note that the following
code would not work:
MOV TA,#0AAh MOV TA,#55h SETB WDCON.0 ;This
instruction will take effect SETB WDCON.1 ;This instruction
will NOT take effect
The above code segment will not work because the
timed access window opened by the first two instructions is only
open for 3 instruction cycles. The first SETB instruction
requires 2 cycles to execute, so the timed access window will be
closed while the second SETB instruction is still executing--
thus it will not take effect. If you wish to set both WDCON.0
and WDCON.1, the most efficient way to do it is, again,
with a MOV command. For example:
MOV TA,#0AAh
MOV TA,#55h
MOV WDCON,#03h
Protected Bits
The following bits are protected and, thus, you
must execute the two MOV TA instructions before
attempting to modify any of them: