Microchip Technology MA160014 Data Sheet

Page of 560
 2010-2012 Microchip Technology Inc.
DS41412F-page 159
PIC18(L)F2X/4XK22
11.0
TIMER0 MODULE
The Timer0 module incorporates the following
features:
• Software selectable operation as a timer or 
counter in both 8-bit or 16-bit modes
• Readable and writable registers
• Dedicated 8-bit, software programmable 
prescaler
• Selectable clock source (internal or external)
• Edge select for external clock
• Interrupt-on-overflow
The T0CON register (
) controls all
aspects of the module’s operation, including the
prescale selection. It is both readable and writable. 
A simplified block diagram of the Timer0 module in 8-bit
mode is shown in 
 shows a
simplified block diagram of the Timer0 module in 16-bit
mode.
11.1
Register Definitions: Timer0 Control 
REGISTER 11-1:
T0CON: TIMER0 CONTROL REGISTER
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
TMR0ON
T08BIT
T0CS
T0SE
PSA
TOPS<2:0>
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
U = Unimplemented bit, read as ‘0’
-n = Value at POR
‘1’ = Bit is set
‘0’ = Bit is cleared
x = Bit is unknown
bit 7
TMR0ON: Timer0 On/Off Control bit
1
 = Enables Timer0
0
 = Stops Timer0
bit 6
T08BIT: Timer0 8-bit/16-bit Control bit
1
 = Timer0 is configured as an 8-bit timer/counter
0
 = Timer0 is configured as a 16-bit timer/counter 
bit 5
T0CS: Timer0 Clock Source Select bit 
1
 = Transition on T0CKI pin
0
 = Internal instruction cycle clock (CLKOUT) 
bit 4
T0SE: Timer0 Source Edge Select bit
1
 = Increment on high-to-low transition on T0CKI pin
0
 = Increment on low-to-high transition on T0CKI pin
bit 3
PSA: Timer0 Prescaler Assignment bit
1
 = TImer0 prescaler is NOT assigned. Timer0 clock input bypasses prescaler.
0
 = Timer0 prescaler is assigned. Timer0 clock input comes from prescaler output.
bit 2-0
T0PS<2:0>: Timer0 Prescaler Select bits
111
 = 1:256 prescale value
110
 = 1:128 prescale value
101
 = 1:64 prescale value
100
 = 1:32 prescale value
011
 = 1:16 prescale value
010
 = 1:8   prescale value
001
 = 1:4   prescale value
000
 = 1:2   prescale value