PIC16F8X
6.3.1
SWITCHING PRESCALER ASSIGNMENT
EXAMPLE 6-1:
BCF
CLRF
BSF
CLRWDT
MOVLW
MOVWF
BCF
The prescaler assignment is fully under software
control (i.e., it can be changed 鈥渙n the 铿倅鈥?during
program execution).
Note:
To avoid an unintended device RESET, the
following
instruction
sequence
(Example 6-1) must be executed when
changing the prescaler assignment from
Timer0 to the WDT. This sequence must
be taken even if the WDT is disabled. To
change prescaler from the WDT to the
Timer0 module use the sequence shown in
Example 6-2.
CHANGING PRESCALER
(TIMER0鈫扺DT)
;Bank 0
;Clear TMR0
; and Prescaler
;Bank 1
;Clears WDT
;Select new
; prescale value
;Bank 0
STATUS, RP0
TMR0
STATUS, RP0
b'xxxx1xxx'
OPTION_REG
STATUS, RP0
EXAMPLE 6-2:
CLRWDT
BSF
MOVLW
CHANGING PRESCALER
(WDT鈫扵IMER0)
;Clear WDT and
; prescaler
;Bank 1
;Select TMR0, new
; prescale value
鈥?and clock source
;
;Bank 0
STATUS, RP0
b'xxxx0xxx'
MOVWF
BCF
OPTION_REG
STATUS, RP0
TABLE 6-1
REGISTERS ASSOCIATED WITH TIMER0
Value on
Power-on
Reset
xxxx xxxx
T0IF
PS2
TRISA2
INTF
PS1
TRISA1
RBIF
PS0
TRISA0
0000 000x
1111 1111
---1 1111
Value on all
other resets
uuuu uuuu
0000 0000
1111 1111
---1 1111
Address
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
01h
0Bh
81h
85h
TMR0
INTCON
OPTION_
REG
TRISA
GIE
RBPU
鈥?/div>
EEIE
INTEDG
鈥?/div>
T0IE
T0CS
鈥?/div>
Timer0 module鈥檚 register
INTE
T0SE
TRISA4
RBIE
PSA
TRISA3
Legend:
x
= unknown,
u
= unchanged.
-
= unimplemented read as '0'. Shaded cells are not associated with Timer0.
漏
1998 Microchip Technology Inc.
DS30430C-page 31
prev
next