PIC12F639 Microchip Technology, PIC12F639 Datasheet - Page 55

no-image

PIC12F639

Manufacturer Part Number
PIC12F639
Description
(PIC12F635 / PIC12F636 / PIC12F639) 8/14-PIN FLASH-BASED / 8-BIT CMOS MICROCONTROLLERS WITH NANOWATT TECHNOLOGY
Manufacturer
Microchip Technology
Datasheet
5.0
The Timer0 module timer/counter has the following
features:
• 8-bit timer/counter
• Readable and writable
• 8-bit software programmable prescaler
• Internal or external clock select
• Interrupt on overflow from FFh to 00h
• Edge select for external clock
Figure 5-1 is a block diagram of the Timer0 module and
the prescaler shared with the WDT.
5.1
Timer mode is selected by clearing the T0CS bit
(OPTION_REG<5>). In Timer mode, the Timer0
module will increment every instruction cycle (without
prescaler). If TMR0 is written, the increment is inhibited
for the following two instruction cycles. The user can
work around this by writing an adjusted value to the
TMR0 register.
FIGURE 5-1:
© 2005 Microchip Technology Inc.
T0CKI
Note:
SWDTEN
pin
Note 1: T0SE, T0CS, PSA, PS<2:0> are bits in the Option register, WDTPS<3:0> are bits in the WDTCON register.
WDTE
(= F
CLKOUT
LFINTOSC
TIMER0 MODULE
Timer0 Operation
OSC
T0SE
Additional information on the Timer0
module is available in the “PICmicro
Range MCU Family Reference Manual”
(DS33023).
/4)
BLOCK DIAGRAM OF THE TIMER0/WDT PRESCALER
Watchdog
Timer
T0CS
0
1
PSA
Prescaler
0
1
16-bit
®
16
Prescaler
WDTPS<3:0>
Mid-
PIC12F635/PIC16F636/639
8-bit
Preliminary
8
PS<2:0>
Counter mode is selected by setting the T0CS bit
(OPTION_REG<5>). In this mode, the Timer0 module
will increment either on every rising or falling edge of
pin RA2/T0CKI. The incrementing edge is determined
by
(OPTION_REG<4>). Clearing the T0SE bit selects the
rising edge.
5.2
A Timer0 interrupt is generated when the TMR0
register timer/counter overflows from FFh to 00h. This
overflow sets the T0IF bit (INTCON<2>). The interrupt
can be masked by clearing the T0IE bit (INTCON<5>).
The T0IF bit must be cleared in software by the Timer0
module Interrupt Service Routine before re-enabling
this interrupt. The Timer0 interrupt cannot wake the
processor from Sleep since the timer is shut off during
Sleep.
Note:
the
Timer0 Interrupt
Counter mode has specific external clock
requirements. Additional information on
these requirements is available in the
“PICmicro
Reference Manual” (DS33023).
source
PSA
PSA
1
0
1
0
SYNC/2
®
Cycles
Time-out
edge
WDT
Mid-Range
(T0SE)
DS41232B-page 53
Data Bus
Set Flag bit T0IF
8
TMR0
MCU
on Overflow
control
Family
bit

Related parts for PIC12F639