MTA85XXX
DS40115C-page 20
1995 Microchip Technology Inc.
8.0
PRESCALER
An 8-bit counter is available as a prescaler for the
T0CKI, or as a post-scaler for the Watchdog Timer.
(Figure 8-1). For simplicity, this counter is being
referred to as "prescaler" throughout this data sheet.
Note that there is only one prescaler available which is
mutually exclusively shared between the T0CKI and
the Watchdog Timer. Thus, a prescaler assignment for
the T0CKI means that there is no prescaler for the
Watchdog Timer, and vice-versa.
The PSA and PS0-PS2 bits in the OPTION register
determine the prescaler assignment and pre-scale
ratio. When assigned to the T0CKI, all instructions
writing to the T0CKI (e.g., CLRF
T0CKI,
MOVWF
T0CKI, BSF T0CKI,x
....etc.) will clear the prescaler.
When assigned to WDT, a CLRWDT instruction will clear
the prescaler along with the Watchdog Timer.
8.1
Switching Prescaler Assignment
Changing prescaler from T0CKI to WDT
The prescaler assignment is fully under software
control, (i.e., it can be changed "on the fly" during
program execution). To avoid an unintended device
RESET, the following instruction sequence must be
executed when changing the prescaler assignment
from T0CKI to WDT:
1. MOVLW
'xx0x0xxx'b
; Select internal
; clock and select new
2. OPTION
; prescaler value. If
; new prescale value
; is = '000' or '001',
; then select any
; other prescale
; value temporarily.
3. CLRF 1
; Clear T0CKI and
; prescaler.
4. MOVLW
xxxx1xxx'b
; Select WDT, do not
; change prescale
; value.
5. OPTION
;
6. CLRWDT
; Clears WDT and
; prescaler.
7. MOVLW
'xxxx1xxx'b
; Select new prescale
; value.
8. OPTION
;
Steps 1 and 2 are only required if an external T0CKI
source is used. Steps 7 and 8 are necessary only if the
desired prescale value is '000' or '001'.
Changing prescaler from WDT to T0CKI
To change prescaler from WDT to T0CKI use the fol-
lowing sequence:
1. CLRWDT
; Clear WDT and
; prescaler.
2. MOVLW
'xxxx0xxx'b ; Select T0CKI, new
; prescale value
; and clock source
3. OPTION
;
FIGURE 8-1:
BLOCK DIAGRAM T0CKI/WDT PRESCALER
T0CKI
RTE
pin
M
U
X
CLKOUT (= Fosc/4)
SYNC
2
Cycles
T0CKI
8-bit Counter
8 - to - 1MUX
M
U
X
M U X
Watchdog
timer
PSA
0
1
0
1
WDT
Time-out
PS2:PS0
Note: RTS, RTE, PSA, PS2-PS0 are bits
PSA
WDT Enable
M
U
X
0
1
0
1
Data Bus
8
PSA
RTS
in the OPTION register.
EEPROM Fuse