PIC16F627A/628A/648A
Data Sheet
FLASH-Based
8-Bit CMOS Microcontrollers
2002 Microchip Technology Inc.
Preliminary
DS40044A
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 knowl-
edge, 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.
Information contained in this publication regarding device
applications and the like is intended through suggestion only
and may be superseded by updates. It is your responsibility to
ensure that your application meets with your specifications.
No representation or warranty is given and no liability is
assumed by Microchip Technology Incorporated with respect
to the accuracy or use of such information, or infringement of
patents or other intellectual property rights arising from such
use or otherwise. Use of Microchip’s products as critical com-
ponents in life support systems is not authorized except with
express written approval by Microchip. No licenses are con-
veyed, implicitly or otherwise, under any intellectual property
rights.
Trademarks
The Microchip name and logo, the Microchip logo, K
EE
L
OQ
,
MPLAB, PIC, PICmicro, PICSTART and PRO MATE are
registered trademarks of Microchip Technology Incorporated
in the U.S.A. and other countries.
FilterLab, microID, MXDEV, MXLAB, PICMASTER, SEEVAL
and The Embedded Control Solutions Company are
registered trademarks of Microchip Technology Incorporated
in the U.S.A.
dsPIC, dsPICDEM.net, ECONOMONITOR, FanSense,
FlexROM, fuzzyLAB, In-Circuit Serial Programming, ICSP,
ICEPIC, microPort, Migratable Memory, MPASM, MPLIB,
MPLINK, MPSIM, PICC, PICDEM, PICDEM.net, rfPIC, Select
Mode and Total Endurance are trademarks of Microchip
Technology Incorporated in the U.S.A. and other countries.
Serialized Quick Turn Programming (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.
© 2002, Microchip Technology Incorporated, Printed in the
U.S.A., All Rights Reserved.
Printed on recycled paper.
Microchip received QS-9000 quality system
certification for its worldwide headquarters,
design and wafer fabrication facilities in
Chandler and Tempe, Arizona in July 1999
and Mountain View, California in March 2002.
The Company’s quality system processes and
procedures are QS-9000 compliant for its
PICmicro
®
8-bit MCUs, K
EE
L
OQ
®
code hopping
devices, Serial EEPROMs, microperipherals,
non-volatile memory and analog products. In
addition, Microchip’s quality system for the
design and manufacture of development
systems is ISO 9001 certified.
DS40044A - page ii
Preliminary
2002 Microchip Technology Inc.
PIC16F627A/628A/648A
18-pin FLASH-Based 8-Bit CMOS Microcontrollers
High Performance RISC CPU:
•
•
•
•
•
Operating speeds from DC - 20 MHz
Interrupt capability
8-level deep hardware stack
Direct, Indirect and Relative Addressing modes
35 single word instructions
- All instructions single cycle except branches
Low Power Features:
• Standby Current:
- 100 nA @ 2.0V, typical
• Operating Current:
- 12
µA
@ 32 kHz, 2.0V, typical
- 120
µA
@ 1 MHz, 2.0V, typical
• Watchdog Timer Current
- 1
µA
@ 2.0V, typical
• Timer1 oscillator current:
- 1.2
µA
@ 32 kHz, 2.0V, typical
• Dual Speed Internal Oscillator:
- Run-time selectable between 4 MHz and
37 kHz
- 4
µs
wake-up from SLEEP, 3.0V, typical
Special Microcontroller Features:
• Internal and external oscillator options
- Precision Internal 4 MHz oscillator factory
calibrated to ±1%
- Low Power Internal 37 kHz oscillator
- External Oscillator support for crystals and
resonators.
• Power saving SLEEP mode
• Programmable weak pull-ups on PORTB
• Multiplexed Master Clear/Input-pin
• Watchdog Timer with independent oscillator for
reliable operation
• Low voltage programming
• In-Circuit Serial Programming™ (via two pins)
• Programmable code protection
• Brown-out Reset
• Power-on Reset
• Power-up Timer and Oscillator Start-up Timer
• Wide operating voltage range. (2.0 - 5.5V)
• Industrial and extended temperature range
• High Endurance FLASH/EEPROM Cell
- 100,000 write FLASH endurance
- 1,000,000 write EEPROM endurance
- 100 year data retention
Peripheral Features:
• 16 I/O pins with individual direction control
• High current sink/source for direct LED drive
• Analog comparator module with:
- Two analog comparators
- Programmable on-chip voltage reference
(V
REF
) module
- Selectable internal or external reference
- Comparator outputs are externally accessible
• Timer0: 8-bit timer/counter with 8-bit
programmable prescaler
• Timer1: 16-bit timer/counter with external crystal/
clock capability
• Timer2: 8-bit timer/counter with 8-bit period regis-
ter, prescaler and postscaler
• Capture, Compare, PWM module
- 16-bit Capture/Compare
- 10-bit PWM
• Addressable Universal Synchronous/Asynchro-
nous Receiver/Transmitter USART/SCI
CCP
(PWM)
1
1
1
Timers
8/16-bit
2/1
2/1
2/1
Device
Program
Memory
FLASH
(words)
1024
2048
4096
Data Memory
SRAM
(bytes)
224
224
256
EEPROM
(bytes)
128
128
256
I/O
USART
Comparators
PIC16F627A
PIC16F628A
PIC16F648A
16
16
16
Y
Y
Y
2
2
2
2002 Microchip Technology Inc.
Preliminary
DS40044A-page 1
PIC16F627A/628A/648A
Pin Diagrams
PDIP, SOIC
RA2/AN2/V
REF
RA3/AN3/CMP1
RA4/TOCKI/CMP2
RA5/MCLR/V
PP
V
SS
RB0/INT
RB1/RX/DT
RB2/TX/CK
RB3/CCP1
1
2
3
4
5
6
7
8
9
PIC16F627A/628A/648A
PIC16F627A/628A/648A
18
17
16
15
14
13
12
11
10
RA1/AN1
RA0/AN0
RA7/OSC1/CLKIN
RA6/OSC2/CLKOUT
V
DD
RB7/T1OSI/PGD
RB6/T1OSO/T1CKI/PGC
RB5
RB4/PGM
RA1/AN1
RA0/AN0
RA7/OSC1/CLKIN
RA6/OSC2/CLKOUT
V
DD
V
DD
RB7/T1OSI/PGD
RB6/T1OSO/T1CKI/PGC
RB5
RB4/PGM
SSOP
28-Pin
QFN
RA4/T0CKI/CMP2
RA3/AN3/CMP1
RA2/AN2/V
REF
RA5/MCLR/V
DD
PIC16F627A/628A/648A
RA2/AN2/V
REF
RA3/AN3/CMP1
RA4/TOCKI/CMP2
RA5/MCLR/V
PP
V
SS
V
SS
RB0/INT
RB1/RX/DT
RB2/TX/CK
RB3/CCP1
DS40044A-page 2
Preliminary
RB1/RX/DT
RB2/TX/CK
RB3/CCP1
8
9
10
NC 11
12
RB4/PGM
13
RB5
NC 14
1
21
NC 2
20
V
SS
3
19
NC 4
PIC16F627A/628A
18 NC
PIC16F648A
V
SS
17
5
NC 6
16
RB0/INT
7
15
28
27
26
25 NC
24
23
22 NC
20
19
18
17
16
15
14
13
12
11
RA1/AN1
RA0/AN0
RA7/OSC1/CLKIN
RA6/OSC2/CLKOUT
V
DD
V
DD
RB7/T1OSI/PGD
RB6/T1OSO/T1CKI/PGC
1
2
3
4
5
6
7
8
9
10
2002 Microchip Technology Inc.
PIC16F627A/628A/648A
Table of Contents
1.0
2.0
3.0
4.0
5.0
6.0
7.0
8.0
9.0
10.0
11.0
12.0
13.0
14.0
15.0
16.0
17.0
18.0
19.0
General Description...................................................................................................................................................................... 5
PIC16F627A/628A/648A Device Varieties ................................................................................................................................... 7
Architectural Overview ................................................................................................................................................................. 9
Memory Organization ................................................................................................................................................................. 15
I/O Ports ..................................................................................................................................................................................... 31
Timer0 Module ........................................................................................................................................................................... 45
Timer1 Module ........................................................................................................................................................................... 48
Timer2 Module ........................................................................................................................................................................... 52
Capture/Compare/PWM (CCP) Module ..................................................................................................................................... 55
Comparator Module.................................................................................................................................................................... 61
Voltage Reference Module......................................................................................................................................................... 67
Universal Synchronous Asynchronous Receiver Transmitter (USART) Module........................................................................ 69
Data EEPROM Memory ............................................................................................................................................................. 89
Special Features of the CPU...................................................................................................................................................... 93
Instruction Set Summary .......................................................................................................................................................... 111
Development Support............................................................................................................................................................... 125
Electrical Specifications............................................................................................................................................................ 131
DC and AC Characteristics Graphs and Tables....................................................................................................................... 147
Packaging Information.............................................................................................................................................................. 149
TO OUR VALUED CUSTOMERS
It is our intention to provide our valued customers with the best documentation possible to ensure successful use of your Micro-
chip 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@mail.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)
• The Microchip Corporate Literature Center; U.S. FAX: (480) 792-7277
When contacting a sales office or the literature center, please specify which device, revision of silicon and data sheet (include lit-
erature number) you are using.
Customer Notification System
Register on our web site at
www.microchip.com/cn
to receive the most current information on all of our products.
2002 Microchip Technology Inc.
Preliminary
DS40044A-page 3