PIC12F635/PIC16F636/639
Data Sheet
8/14-Pin Flash-Based,
8-Bit CMOS Microcontrollers
with nanoWatt Technology
*8-bit, 8-pin Devices Protected by Microchip’s Low Pin Count Patent: U. S. Patent No. 5,847,450. Additional U.S. and
foreign patents and applications may be issued or pending.
©
2005 Microchip Technology Inc.
Preliminary
DS41232B
Note the following details of the code protection feature on Microchip devices:
•
•
Microchip products meet the specification contained in their particular Microchip Data Sheet.
Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
Microchip is willing to work with the customer who is concerned about the integrity of their code.
Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
•
•
•
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Information contained in this publication regarding device
applications and the like is provided only for your convenience
and may be superseded by updates. It is your responsibility to
ensure that your application meets with your specifications.
MICROCHIP MAKES NO REPRESENTATIONS OR WAR-
RANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED,
WRITTEN OR ORAL, STATUTORY OR OTHERWISE,
RELATED TO THE INFORMATION, INCLUDING BUT NOT
LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE,
MERCHANTABILITY OR FITNESS FOR PURPOSE.
Microchip disclaims all liability arising from this information and
its use. Use of Microchip’s products as critical components in
life support systems is not authorized except with express
written approval by Microchip. No licenses are conveyed,
implicitly or otherwise, under any Microchip intellectual property
rights.
Trademarks
The Microchip name and logo, the Microchip logo, Accuron,
dsPIC, K
EE
L
OQ
, microID, MPLAB, PIC, PICmicro, PICSTART,
PRO MATE, PowerSmart, rfPIC, and SmartShunt are
registered trademarks of Microchip Technology Incorporated
in the U.S.A. and other countries.
AmpLab, FilterLab, Migratable Memory, MXDEV, MXLAB,
PICMASTER, SEEVAL, SmartSensor and The Embedded
Control Solutions Company are registered trademarks of
Microchip Technology Incorporated in the U.S.A.
Analog-for-the-Digital Age, Application Maestro, dsPICDEM,
dsPICDEM.net, dsPICworks, ECAN, ECONOMONITOR,
FanSense, FlexROM, fuzzyLAB, In-Circuit Serial
Programming, ICSP, ICEPIC, MPASM, MPLIB, MPLINK,
MPSIM, PICkit, PICDEM, PICDEM.net, PICLAB, PICtail,
PowerCal, PowerInfo, PowerMate, PowerTool, rfLAB,
rfPICDEM, Select Mode, Smart Serial, SmartTel and Total
Endurance are trademarks of Microchip Technology
Incorporated in the U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated
in the U.S.A.
All other trademarks mentioned herein are property of their
respective companies.
© 2005, Microchip Technology Incorporated, Printed in the
U.S.A., All Rights Reserved.
Printed on recycled paper.
Microchip received ISO/TS-16949:2002 quality system certification for
its worldwide headquarters, design and wafer fabrication facilities in
Chandler and Tempe, Arizona and Mountain View, California in
October 2003. The Company’s quality system processes and
procedures are for its PICmicro
®
8-bit MCUs, K
EE
L
OQ
®
code hopping
devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchip’s quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.
DS41232B-page ii
Preliminary
©
2005 Microchip Technology Inc.
PIC12F635/PIC16F636/639
8/14-Pin Flash-Based, 8-Bit CMOS Microcontrollers
With nanoWatt Technology
High-Performance RISC CPU:
• Only 35 instructions to learn:
- All single-cycle instructions except branches
• Operating speed:
- DC – 20 MHz oscillator/clock input
- DC – 200 ns instruction cycle
• Interrupt capability
• 8-level deep hardware stack
• Direct, Indirect and Relative Addressing modes
Peripheral Features:
• 6/12 I/O pins with individual direction control:
- High-current source/sink for direct LED drive
- Interrupt-on-pin change
- Individually programmable weak pull-ups/
pull-downs
- Ultra Low-Power Wake-up
• Analog comparator module with:
- Up to two analog comparators
- Programmable on-chip voltage reference
(CV
REF
) module (% of V
DD
)
- Comparator inputs and outputs externally
accessible
• Timer0: 8-bit timer/counter with 8-bit
programmable prescaler
• Enhanced Timer1:
- 16-bit timer/counter with prescaler
- External Gate Input mode
- Option to use OSC1 and OSC2 in LP mode
as Timer1 oscillator if INTOSC mode
selected
• K
EE
L
OQ
®
compatible hardware Cryptographic
module
• In-Circuit Serial Programming
TM
(ICSP
TM
) via
two pins
Special Microcontroller Features:
• Precision Internal Oscillator:
- Factory calibrated to ±1%
- Software selectable frequency range of
8 MHz to 31 kHz
- Software tunable
- Two-Speed Start-up mode
- Crystal fail detect for critical applications
• Clock mode switching for low power operation
• Power-saving Sleep mode
• Wide operating voltage range (2.0V-5.5V)
• Industrial and Extended Temperature range
• Power-on Reset (POR)
• Wake-up Reset (WUR)
• Independent weak pull-up/pull-down resistors
• Programmable Low-Voltage Detect (PLVD)
• Power-up Timer (PWRT) and Oscillator Start-up
Timer (OST)
• Brown-out Detect (BOD) with software control
option
• Enhanced Low-Current Watchdog Timer (WDT)
with on-chip oscillator (software selectable
nominal 268 seconds with full prescaler) with
software enable
• Multiplexed Master Clear with pull-up/input pin
• Programmable code protection (program and
data independent)
• High-Endurance Flash/EEPROM cell:
- 100,000 write Flash endurance
- 1,000,000 write EEPROM endurance
- Flash/Data EEPROM Retention: > 40 years
Low Frequency Analog Front-End Features
(PIC16F639 only):
• Three input pins for 125 kHz LF input signals
• High input detection sensitivity (3 mV
PP
, typical)
• Demodulated data, Carrier clock or RSSI output
selection
• Input carrier frequency: 125 kHz, typical
• Input modulation frequency: 4 kHz, maximum
• 8 internal configuration registers
• Bidirectional transponder communication
(LF talk back)
• Programmable antenna tuning capacitance
(up to 63 pF, 1 pF/step)
• Low standby current: 5
μA
(with 3 channels
enabled), typical
• Low operating current: 15
μA
(with 3 channels
enabled), typical
• Serial Peripheral Interface (SPI™) with internal
MCU and external devices
• Supports Battery Back-up mode and batteryless
operation with external circuits
Low Power Features:
• Standby Current:
- 1 nA @ 2.0V, typical
• Operating Current:
- 8.5
μA
@ 32 kHz, 2.0V, typical
- 100
μA
@ 1 MHz, 2.0V, typical
• Watchdog Timer Current:
- 1
μA
@ 2.0V, typical
©
2005 Microchip Technology Inc.
Preliminary
DS41232B-page 1
PIC12F635/PIC16F636/639
Program Memory
Device
Flash (words)
PIC12F635
PIC16F636
PIC16F639
1024
2048
2048
SRAM (bytes)
64
128
128
EEPROM (bytes)
128
256
256
6
12
12
Data Memory
I/O
Low Frequency
Comparators
Analog
Front-End
1
2
2
N
N
Y
Pin Diagrams
8-Pin PDIP, SOIC, DFN-S
V
DD
GP5/T1CKI/OSC1/CLKIN
GP4/T1G/OSC2/CLKOUT
GP3/MCLR/V
PP
1
2
3
4
8
7
6
5
V
SS
GP0/C1IN+/ICSPDAT/ULPWU
GP1/C1IN-/ICSPCLK
GP2/T0CKI/INT/C1OUT
14-Pin PDIP, SOIC, TSSOP
V
DD
RA5/T1CKI/OSC1/CLKIN
RA4/T1G/OSC2/CLKOUT
RA3/MCLR/V
PP
RC5
RC4/C2OUT
RC3
1
2
3
4
5
6
7
V
SS
RA0/C1IN+/ICSPDAT/ULPWU
RA1/C1IN-/V
REF
/ICSPCLK
RA2/T0CKI/INT/C1OUT
RC0/C2IN+
RC1/C2IN-
RC2
PIC12F635
PIC16F636
14
13
12
11
10
9
8
20-Pin SSOP
V
DD
RA5/T1CKI/OSC1/CLKIN
RA4/T1G/OSC2/CLKOUT
RA3/MCLR/V
PP
RC5
RC4/C2OUT
RC3/LFDATA/RSSI/CCLK/SDIO
V
DDT
(3)
LCZ
LCY
V
SS
RA0/C1IN+/ICSPDAT/ULPWU
RA1/C1IN-/V
REF
/ICSPCLK
RA2/TOCKI/INT/C1OUT
RC0/C2IN+
RC1/C2IN-/CS
RC2/SCLK/ALERT
V
SST
(4)
LCCOM
LCX
1
2
3
4
5
6
7
8
9
10
20
19
18
17
16
15
14
13
12
11
Note 1:
Any references to PORTA, RAn, TRISA and TRISAn refer to GPIO, GPn, TRISIO and TRISIOn, respectively.
2:
Additional information on I/O ports may be found in the “PICmicro
®
Mid-Range MCU Family Reference
Manual”
(DS33023).
3:
V
DDT
is the supply voltage of the Analog Front-End section (PIC16F639 only). V
DDT
is treated as V
DD
in
this document unless otherwise stated.
4:
V
SST
is the ground reference voltage of the Analog Front-End section (PIC16F639 only). V
SST
is treated
as V
SS
in this document unless otherwise stated.
DS41232B-page 2
Preliminary
PIC16F639
©
2005 Microchip Technology Inc.
PIC12F635/PIC16F636/639
Table of Contents
1.0 Device Overview .......................................................................................................................................................................... 5
2.0 Memory Organization ................................................................................................................................................................. 11
3.0 Clock Sources ............................................................................................................................................................................ 29
4.0 I/O Ports ..................................................................................................................................................................................... 39
5.0 Timer0 Module ........................................................................................................................................................................... 53
6.0 Timer1 Module with Gate Control............................................................................................................................................... 56
7.0 Comparator Module.................................................................................................................................................................... 61
8.0 Programmable Low-Voltage Detect (PLVD) Module.................................................................................................................. 71
9.0 Data EEPROM Memory ............................................................................................................................................................. 73
10.0 KeeLoq Compatible Cryptographic Module................................................................................................................................ 77
11.0 Analog Front-End (AFE) Functional Description (PIC16F639 Only) .......................................................................................... 79
12.0 Special Features of the CPU.................................................................................................................................................... 111
13.0 Instruction Set Summary .......................................................................................................................................................... 131
14.0 Development Support............................................................................................................................................................... 141
15.0 Electrical Specifications............................................................................................................................................................ 147
16.0 DC and AC Characteristics Graphs and Tables....................................................................................................................... 173
17.0 Packaging Information.............................................................................................................................................................. 175
On-Line Support
185
Systems Information and Upgrade Hot Line ..................................................................................................................................... 185
Reader Response ............................................................................................................................................................................. 186
Appendix A: Data Sheet Revision History......................................................................................................................................... 187
Appendix B: Product Identification System ....................................................................................................................................... 193
Worldwide Sales and Service ........................................................................................................................................................... 194
TO OUR VALUED CUSTOMERS
It is our intention to provide our valued customers with the best documentation possible to ensure successful use of your Microchip
products. To this end, we will continue to improve our publications to better suit your needs. Our publications will be refined and
enhanced as new volumes and updates are introduced.
If you have any questions or comments regarding this publication, please contact the Marketing Communications Department via
E-mail at
docerrors@microchip.com
or fax the
Reader Response Form
in the back of this data sheet to (480) 792-4150. We
welcome your feedback.
Most Current Data Sheet
To obtain the most up-to-date version of this data sheet, please register at our Worldwide Web site at:
http://www.microchip.com
You can determine the version of a data sheet by examining its literature number found on the bottom outside corner of any page.
The last character of the literature number is the version number, (e.g., DS30000A is version A of document DS30000).
Errata
An errata sheet, describing minor operational differences from the data sheet and recommended workarounds, may exist for current
devices. As device/documentation issues become known to us, we will publish an errata sheet. The errata will specify the revision
of silicon and revision of document to which it applies.
To determine if an errata sheet exists for a particular device, please check with one of the following:
• Microchip’s Worldwide Web site; http://www.microchip.com
• Your local Microchip sales office (see last page)
When contacting a sales office, please specify which device, revision of silicon and data sheet (include literature number) you are
using.
Customer Notification System
Register on our web site at
www.microchip.com
to receive the most current information on all of our products.
©
2005 Microchip Technology Inc.
Preliminary
DS41232B-page 3