PIC12CE67X
7.3.1
SWITCHING PRESCALER ASSIGNMENT
The prescaler assignment is fully under software con-
trol, i.e., it can be changed 鈥渙n the 铿倅鈥?during program
execution.
Note:
To avoid an unintended device RESET, the
following instruction sequence (shown in
Example 7-1) must be executed when
changing the prescaler assignment from
Timer0 to the WDT. This sequence must
be followed even if the WDT is disabled.
To change prescaler from the WDT to the Timer0 mod-
ule use the sequence shown in Example 7-2.
EXAMPLE 7-2:
CLRWDT
BSF
MOVLW
MOVWF
BCF
CHANGING PRESCALER
(WDT鈫扵IMER0)
;Clear WDT and
;prescaler
STATUS, RP0 ;Bank 1
b'xxxx0xxx' ;Select TMR0, new
;prescale value and
OPTION_REG ;clock source
STATUS, RP0 ;Bank 0
EXAMPLE 7-1:
BCF
CLRF
BSF
CLRWDT
MOVLW
MOVWF
BCF
CHANGING PRESCALER
(TIMER0鈫扺DT)
;Bank 0
;Clear TMR0 & Prescaler
;Bank 1
;Clears WDT
;Select new prescale
;value & WDT
;Bank 0
STATUS, RP0
TMR0
STATUS, RP0
b'xxxx1xxx'
OPTION_REG
STATUS, RP0
TABLE 7-1:
Address Name
01h
0Bh/8Bh
81h
85h
TMR0
REGISTERS ASSOCIATED WITH TIMER0
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on
POR
xxxx xxxx
INTE
T0SE
TRIS4
GPIE
PSA
TRIS3
T0IF
PS2
TRIS2
INTF
PS1
TRIS1
GPIF
PS0
TRIS0
0000 000x
1111 1111
--11 1111
Value on
all other
Resets
uuuu uuuu
0000 000u
1111 1111
--11 1111
Timer0 module鈥檚 register
GIE
PEIE
T0IE
T0CS
TRIS5
INTCON
OPTION GPPU INTEDG
TRIS
鈥?/div>
鈥?/div>
Legend:
x
= unknown,
u
= unchanged,
-
= unimplemented locations read as '0'. Shaded cells are not used by Timer0.
漏
1998 Microchip Technology Inc.
Preliminary
DS40181B-page 35
prev
next