beautypg.com

Imed, Ccess, Rotects – Maxim Integrated High-Speed Microcontroller User Manual

Page 155: Atchdog, Figure 13-1. timed-access examples

background image

High-Speed Microcontroller User’s Guide

Rev: 062210

155 of 176

EXAMPLE: A TRANSIENT CAUSES THE WATCHDOG TO BE DISABLED

TABLE_READ:

C2D2 90 0A 00

MOV

DPTR, 0A00H

;LOAD TABLE POINTER

C2D5 79 FF

MOV

R1, #0FFH

;LOAD COUNTER

C2D7 78 90

MOV

R0, #90H

;DESTINATION POINTER


LOOP:

C2D9 E0

MOVX

A, @DPTR

;READ DATA BYTE

C2DA F6

MOV

@R0, A

;STORE IT IN RAM

C2DB 06

INC

R0

;NEXT TABLE LOCATION

C2DC A3

INC

DPTR

;NEXT DATA VALUE

C2DD D9 C2 D9

DJNZ

R1, LOOP

;NEXT BYTE OR DONE ?


A transient occurs while the op code is being fetched for the first instruction. The transient causes one bit
of the op code in the first instruction to be read as a 0 instead of 1. The resulting program is what the
microcontroller would actually execute:

TABLE_READ:

C2D2 80 0A 00

SJMP

0BH

;RELATIVE JUMP BY 10 LOCATIONS

C2D5 79 FF

MOV

R1, #0FFH ;LOAD COUNTER

C2D7

78

90

MOV

R0,

#90H

;DESTINATION

POINTER

LOOP:

C2D9 E0

MOVX

A, @DPTR ;READ DATA BYTE

C2DA F6

MOV

@R0, A

;STORE IT IN RAM

C2DB

06

INC

R0

;NEXT

TABLE

LOCATION

C2DC

A3

INC

DPTR

;NEXT

DATA

VALUE

C2DD D9 C2 D9

DJNZ

R1, LOOP

;NEXT BYTE OR DONE ?


The resulting jump is to address C2DE. This is not even a real op code, but would be treated as such. The
resulting fetch is the value C2 D9. This is the op code for CLR D9h. The bit addressable location D9h
corresponds to the EWT. If the timed-access procedure did not prevent it, this errant instruction would
disable the watchdog. Note that now, the program execution is completely lost. Real op codes are being
replaced by operands, data, and garbage. In the high-speed microcontroller, the watchdog will recover
from this state as soon as it times out since it could not have been disabled in this way.

In the high-speed microcontroller it is very hard to contrive a situation that will accidentally disable the
watchdog. Note that the timed access prevents accidentally writing a bit. It cannot prevent accidentally
calling the correct code that writes a bit. This is much more unlikely however.