Professional Documents
Culture Documents
41202F Print PDF
41202F Print PDF
Data Sheet
14-Pin, Flash-Based 8-Bit
CMOS Microcontrollers
with nanoWatt Technology
DS41202F
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 Microchips 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 Microchips 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.
Trademarks
The Microchip name and logo, the Microchip logo, Accuron,
dsPIC, KEELOQ, KEELOQ logo, 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, Linear Active Thermistor, Migratable
Memory, MXDEV, MXLAB, PS logo, 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, CodeGuard,
dsPICDEM, dsPICDEM.net, dsPICworks, ECAN,
ECONOMONITOR, FanSense, FlexROM, fuzzyLAB,
In-Circuit Serial Programming, ICSP, ICEPIC, Mindi, MiWi,
MPASM, MPLAB Certified logo, MPLIB, MPLINK, PICkit,
PICDEM, PICDEM.net, PICLAB, PICtail, PowerCal,
PowerInfo, PowerMate, PowerTool, REAL ICE, rfLAB,
rfPICDEM, Select Mode, Smart Serial, SmartTel, Total
Endurance, UNI/O, WiperLock and ZENA 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.
2007, Microchip Technology Incorporated, Printed in the
U.S.A., All Rights Reserved.
Printed on recycled paper.
Microchip received ISO/TS-16949:2002 certification for its worldwide
headquarters, design and wafer fabrication facilities in Chandler and
Tempe, Arizona, Gresham, Oregon and Mountain View, California. The
Companys quality system processes and procedures are for its PIC
MCUs and dsPIC DSCs, KEELOQ code hopping devices, Serial
EEPROMs, microperipherals, nonvolatile memory and analog
products. In addition, Microchips quality system for the design and
manufacture of development systems is ISO 9001:2000 certified.
DS41202F-page ii
PIC16F684
14-Pin Flash-Based, 8-Bit CMOS Microcontrollers with nanoWatt Technology
High-Performance RISC CPU:
Low-Power Features:
Standby Current:
- 50 nA @ 2.0V, typical
Operating Current:
- 11 A @ 32 kHz, 2.0V, typical
- 220 A @ 4 MHz, 2.0V, typical
Watchdog Timer Current:
- 1 A @ 2.0V, typical
Peripheral Features:
Special Microcontroller Features:
Device
PIC16F684
Program
Memory
Data Memory
Flash
(words)
SRAM
(bytes)
EEPROM
(bytes)
2048
128
256
I/O
10-bit A/D
(ch)
Comparators
Timers
8/16-bit
12
2/1
DS41202F-page 1
PIC16F684
14-Pin Diagram (PDIP, SOIC, TSSOP)
TABLE 1:
14
VSS
13
RA0/AN0/C1IN+/ICSPDAT/ULPWU
RA4/AN3/T1G/OSC2/CLKOUT
RA3/MCLR/VPP
RC5/CCP1/P1A
RC4/C2OUT/P1B
RC3/AN7/P1C
PIC16F684
VDD
RA5/T1CKI/OSC1/CLKIN
12
RA1/AN1/C1IN-/VREF/ICSPCLK
11
RA2/AN2/T0CKI/INT/C1OUT
10
RC0/AN4/C2IN+
RC1/AN5/C2IN-
RC2/AN6/P1D
I/O
Pin
Analog
Comparators
Timer
CCP
Interrupts
Pull-ups
Basic
RA0
13
AN0
C1IN+
IOC
ICSPDAT/ULPWU
RA1
12
AN1/VREF
C1IN-
IOC
ICSPCLK
RA2
11
AN2
C1OUT
T0CKI
INT/IOC
IOC
Y(2)
MCLR/VPP
RA3(1)
RA4
AN3
T1G
IOC
OSC2/CLKOUT
RA5
T1CKI
IOC
OSC1/CLKIN
RC0
10
AN4
C2IN+
RC1
AN5
C2IN-
RC2
AN6
P1D
RC3
AN7
P1C
RC4
C2OUT
P1B
RC5
CCP1/P1A
VDD
14
VSS
Note 1:
2:
Input only.
Only when pin is configured for external MCLR.
DS41202F-page 2
PIC16F684
TABLE 2:
RA5/T1CKI/OSC1/CLKIN
RA4/AN3/T1G/OSC2/CLKOUT
VDD
NC
NC
VSS
16
15
14
13
12
RA0/AN0/C1IN+/ICSPDAT/ULPWU
11
RA1/AN1/C1IN-/VREF/ICSPCLK
RA2/AN2/T0CKI/INT/C1OUT
PIC16F684
8
RC1/AN5/C2IN-
RC2/AN6/P1D
4
6
RC5/CCP1/P1A
RC3/AN7/P1C
10
RC4/C2OUT/P1B
RA3/MCLR/VPP
RC0/AN4/C2IN+
I/O
Pin
Analog
Comparators
Timers
CCP
Interrupts
Pull-ups
Basic
RA0
12
AN0
C1IN+
IOC
ICSPDAT/ULPWU
RA1
11
AN1/VREF
C1IN-
IOC
ICSPCLK
RA2
10
AN2
C1OUT
T0CKI
INT/IOC
IOC
Y(2)
MCLR/VPP
RA3
(1)
RA4
AN3
T1G
IOC
OSC2/CLKOUT
RA5
T1CKI
IOC
OSC1/CLKIN
RC0
AN4
C2IN+
RC1
AN5
C2IN-
RC2
AN6
P1D
RC3
AN7
P1C
RC4
C2OUT
P1B
RC5
CCP1/P1A
16
VDD
13
VSS
Note 1:
2:
Input only.
Only when pin is configured for external MCLR.
DS41202F-page 3
PIC16F684
Table of Contents
1.0 Device Overview .......................................................................................................................................................................... 5
2.0 Memory Organization ................................................................................................................................................................... 7
3.0 Oscillator Module (With Fail-Safe Clock Monitor)....................................................................................................................... 19
4.0 I/O Ports ..................................................................................................................................................................................... 31
5.0 Timer0 Module ........................................................................................................................................................................... 43
6.0 Timer1 Module with Gate Control............................................................................................................................................... 47
7.0 Timer2 Module ........................................................................................................................................................................... 53
8.0 Comparator Module.................................................................................................................................................................... 55
9.0 Analog-to-Digital Converter (ADC) Module ................................................................................................................................ 65
10.0 Data EEPROM Memory ............................................................................................................................................................. 75
11.0 Enhanced Capture/Compare/PWM (With Auto-Shutdown and Dead Band) Module ................................................................. 79
12.0 Special Features of the CPU ...................................................................................................................................................... 97
13.0 Instruction Set Summary .......................................................................................................................................................... 115
14.0 Development Support............................................................................................................................................................... 125
15.0 Electrical Specifications............................................................................................................................................................ 129
16.0 DC and AC Characteristics Graphs and Tables ....................................................................................................................... 151
17.0 Packaging Information.............................................................................................................................................................. 173
Appendix A: Data Sheet Revision History.......................................................................................................................................... 179
Appendix B: Migrating from other PIC Devices ............................................................................................................................... 179
Index .................................................................................................................................................................................................. 181
The Microchip Web Site ..................................................................................................................................................................... 187
Customer Change Notification Service .............................................................................................................................................. 187
Customer Support .............................................................................................................................................................................. 187
Reader Response .............................................................................................................................................................................. 188
Product Identification System............................................................................................................................................................. 189
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:
Microchips 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.
DS41202F-page 4
PIC16F684
1.0
DEVICE OVERVIEW
FIGURE 1-1:
Program
Bus
PORTA
RA0
RA1
RA2
RA3
RA4
RA5
RAM
128 Bytes
File
Registers
8-Level Stack
(13-Bit)
14
Data Bus
Program Counter
RAM Addr
Addr MUX
Instruction Reg
7
Direct Addr
PORTC
Indirect
Addr
RC0
RC1
RC2
RC3
RC4
RC5
FSR Reg
STATUS Reg
8
3
Power-up
Timer
Instruction
Decode &
Control
OSC1/CLKIN
Oscillator
Start-up Timer
Power-on
Reset
Timing
Generation
ALU
8
Watchdog
Timer
Brown-out
Reset
OSC2/CLKOUT
MUX
Internal
Oscillator
Block
W Reg
T1G
MCLR VDD
VSS
T1CKI
Timer0
Timer1
Timer2
ECCP
T0CKI
Analog-To-Digital Converter
2 Analog Comparators
and Reference
EEDATA
256
Bytes
8
Data
EEPROM
EEADDR
VREF
AN0 AN1 AN2 AN3 AN4 AN5 AN6 AN7 C1IN- C1IN+ C1OUT C2IN- C2IN+ C2OUT
DS41202F-page 5
PIC16F684
TABLE 1-1:
RA0/AN0/C1IN+/ICSPDAT/ULPWU
RA1/AN1/C1IN-/VREF/ICSPCLK
RA2/AN2/T0CKI/INT/C1OUT
RA3/MCLR/VPP
RA4/AN3/T1G/OSC2/CLKOUT
RA5/T1CKI/OSC1/CLKIN
RC0/AN4/C2IN+
RC1/AN5/C2IN-
RC2/AN6/P1D
RC3/AN7/P1C
RC4/C2OUT/P1B
RC5/CCP1/P1A
VDD
VSS
Legend:
Function
Input
Type
Output
Type
Description
RA0
TTL
CMOS
AN0
AN
C1IN+
AN
ICSPDAT
TTL
CMOS
ULPWU
AN
RA1
TTL
CMOS
AN1
AN
C1IN-
AN
VREF
AN
ICSPCLK
ST
RA2
ST
CMOS
AN2
AN
T0CKI
ST
INT
ST
C1OUT
CMOS
RA3
TTL
External Interrupt
Comparator 1 output
PORTA input with interrupt-on-change
MCLR
ST
VPP
HV
Programming voltage
RA4
TTL
CMOS
AN3
AN
T1G
ST
OSC2
XTAL
Crystal/Resonator
CLKOUT
CMOS
FOSC/4 output
PORTA I/O with prog. pull-up and interrupt-on-change
RA5
TTL
CMOS
T1CKI
ST
OSC1
XTAL
Crystal/Resonator
CLKIN
ST
RC0
TTL
CMOS
AN4
AN
Timer1 clock
PORTC I/O
C2IN+
AN
RC1
TTL
CMOS
AN5
AN
C2IN-
AN
RC2
TTL
CMOS
AN6
AN
P1D
CMOS
RC3
TTL
CMOS
AN7
AN
PORTC I/O
PORTC I/O
A/D Channel 6 input
PWM output
PORTC I/O
A/D Channel 7 input
P1C
CMOS
RC4
TTL
CMOS
PWM output
PORTC I/O
C2OUT
CMOS
Comparator 2 output
P1B
CMOS
PWM output
RC5
TTL
CMOS
PORTC I/O
CCP1
ST
CMOS
P1A
CMOS
VDD
Power
Positive supply
VSS
Power
Ground reference
PWM output
DS41202F-page 6
HV = High Voltage
XTAL = Crystal
PIC16F684
2.0
MEMORY ORGANIZATION
2.1
FIGURE 2-1:
CALL, RETURN
RETFIE, RETLW
2.2
Bank 0 is selected
Bank 1 is selected
13
Note:
Stack Level 1
Stack Level 2
Stack Level 8
Reset Vector
0000h
Interrupt Vector
0004h
0005h
On-chip Program
Memory
07FFh
0800h
Wraps to 0000h-07FFh
1FFFh
DS41202F-page 7
PIC16F684
2.2.1
2.2.2
FIGURE 2-2:
File
Address
Indirect Addr.(1)
00h
Indirect Addr.(1)
80h
TMR0
01h
OPTION_REG
81h
PCL
02h
PCL
82h
STATUS
03h
STATUS
83h
FSR
04h
FSR
84h
PORTA
05h
TRISA
85h
06h
PORTC
86h
TRISC
07h
08h
87h
88h
09h
89h
PCLATH
0Ah
PCLATH
8Ah
INTCON
0Bh
INTCON
8Bh
PIR1
0Ch
PIE1
8Ch
0Dh
8Dh
TMR1L
0Eh
PCON
8Eh
TMR1H
0Fh
OSCCON
8Fh
T1CON
10h
OSCTUNE
90h
TMR2
11h
ANSEL
91h
T2CON
12h
PR2
92h
CCPR1L
13h
CCPR1H
14h
CCP1CON
15h
WPUA
95h
PWM1CON
16h
IOCA
96h
ECCPAS
17h
WDTCON
18h
CMCON0
19h
VRCON
99h
CMCON1
1Ah
EEDAT
9Ah
1Bh
EEADR
9Bh
1Ch
EECON1
9Ch
1Dh
EECON2(1)
9Dh
ADRESH
1Eh
ADRESL
9Eh
ADCON0
1Fh
ADCON1
General
Purpose
Registers
32 Bytes
9Fh
A0h
93h
94h
97h
98h
20h
General
Purpose
Registers
BFh
96 Bytes
6Fh
70
Accesses 70h-7Fh
7Fh
Bank 0
F0h
FFh
Bank 1
DS41202F-page 8
1:
PIC16F684
TABLE 2-1:
Addr
Name
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on
POR, BOR
Page
Bank 0
00h
INDF
Addressing this location uses contents of FSR to address data memory (not a physical register)
xxxx xxxx
19, 104
01h
TMR0
xxxx xxxx
43, 104
02h
PCL
0000 0000
19, 104
03h
STATUS
04h
FSR
05h
PORTA(2)
06h
07h
IRP(1)
RP1(1)
RP0
TO
PD
DC
PORTC(2)
RA5
RA4
RA3
RA2
RA1
RA0
Unimplemented
RC5
RC4
RC3
RC2
RC1
RC0
0001 1xxx
13, 104
xxxx xxxx
19, 104
--x0 x000
31, 104
--xx 0000
40, 104
08h
Unimplemented
09h
Unimplemented
---0 0000
19, 104
0Ah
PCLATH
0Bh
INTCON
GIE
PEIE
T0IE
INTE
RAIE
T0IF
INTF
RAIF
0000 0000
15, 104
0Ch
PIR1
EEIF
ADIF
CCP1IF
C2IF
C1IF
OSFIF
TMR2IF
TMR1IF
0000 0000
17, 104
0Dh
Unimplemented
0Eh
TMR1L
Holding Register for the Least Significant Byte of the 16-bit TMR1 Register
0Fh
TMR1H
Holding Register for the Most Significant Byte of the 16-bit TMR1 Register
10h
T1CON
11h
TMR2
12h
T2CON
13h
CCPR1L
14h
CCPR1H
15h
CCP1CON
P1M1
P1M0
DC1B1
DC1B0
CCP1M3
CCP1M2
CCP1M1
16h
PWM1CON
PRSEN
PDC6
PDC5
PDC4
PDC3
PDC2
17h
ECCPAS
ECCPASE
ECCPAS2
ECCPAS1
ECCPAS0
PSSAC1
18h
WDTCON
WDTPS3
19h
CMCON0
C2OUT
C1OUT
C2INV
1Ah
CMCON1
xxxx xxxx
47, 104
xxxx xxxx
47, 104
0000 0000
50, 104
0000 0000
53, 104
-000 0000
54, 104
XXXX XXXX
80, 104
XXXX XXXX
80, 104
CCP1M0
0000 0000
79, 104
PDC1
PDC0
0000 0000
96, 104
PSSAC0
PSSBD1
PSSBD0
0000 0000
93, 104
WDTPS2
WDTPS1
WDTPS0
SWDTEN
C1INV
CIS
CM2
CM1
CM0
0000 0000
61, 104
T1GSS
C2SYNC
---- --10
62, 104
T1GINV
TMR1GE
T1CKPS1
T1CKPS0
T1OSCEN
T1SYNC
TMR1CS
TMR1ON
TOUTPS2
TOUTPS1
TOUTPS0
TMR2ON
T2CKPS1
T2CKPS0
TOUTPS3
1Bh
Unimplemented
1Ch
Unimplemented
1Dh
Unimplemented
xxxx xxxx
71, 104
00-0 0000
70, 104
1Eh
ADRESH
1Fh
ADCON0
Legend:
Note 1:
2:
Most Significant 8 bits of the left shifted A/D result or 2 bits of right shifted result
ADFM
VCFG
CHS2
CHS1
CHS0
GO/DONE
ADON
= Unimplemented locations read as 0, u = unchanged, x = unknown, q = value depends on condition, shaded = unimplemented
IRP and RP1 bits are reserved, always maintain these bits clear.
Port pins with analog functions controlled by the ANSEL register will read 0 immediately after a Reset even though the data latches are
either undefined (POR) or unchanged (other Resets).
DS41202F-page 9
PIC16F684
TABLE 2-2:
Addr
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on
POR, BOR
Page
Bank 1
80h
INDF
81h
OPTION_REG
Addressing this location uses contents of FSR to address data memory (not a physical register)
82h
PCL
83h
STATUS
FSR
85h
TRISA
86h
INTEDG
T0CS
T0SE
IRP(1)
RP1(1)
RP0
PS2
PS1
PS0
TO
PD
DC
TRISC
TRISA5
TRISA4
TRISA3
TRISA2
TRISA1
TRISA0
TRISC5
TRISC4
TRISC3
TRISC2
TRISC1
TRISC0
Unimplemented
PSA
84h
87h
RAPU
88h
Unimplemented
89h
Unimplemented
8Ah
PCLATH
8Bh
INTCON
GIE
PEIE
T0IE
INTE
RAIE
T0IF
INTF
RAIF
8Ch
PIE1
EEIE
ADIE
CCP1IE
C2IE
C1IE
OSFIE
TMR2IE
TMR1IE
POR
BOR
8Dh
Unimplemented
8Eh
PCON
ULPWUE
SBOREN
8Fh
OSCCON
IRCF2
IRCF1
IRCF0
OSTS(2)
HTS
LTS
SCS
90h
OSCTUNE
TUN4
TUN3
TUN2
TUN1
TUN0
91h
ANSEL
ANS7
ANS6
ANS5
ANS4
ANS3
ANS2
ANS1
ANS0
92h
PR2
93h
Unimplemented
94h
Unimplemented
95h
WPUA(3)
96h
IOCA
WPUA5
WPUA4
WPUA2
WPUA1
WPUA0
IOCA5
IOCA4
IOCA3
IOCA2
IOCA1
IOCA0
97h
Unimplemented
98h
Unimplemented
99h
VRCON
9Ah
EEDAT
EEDAT7
EEDAT6
EEDAT5
EEDAT4
EEDAT3
EEDAT2
9Bh
EEADR
EEADR7
EEADR6
EEADR5
EEADR4
EEADR3
EEADR2
9Ch
EECON1
WRERR
WREN
WR
9Dh
EECON2
9Eh
ADRESL
Least Significant 2 bits of the left shifted result or 8 bits of the right shifted result
9Fh
ADCON1
Legend:
Note 1:
2:
3:
VREN
ADCS2
VRR
ADCS1
ADCS0
VR3
VR2
VR1
VR0
EEDAT1
EEDAT0
EEADR1
EEADR0
RD
= Unimplemented locations read as 0, u = unchanged, x = unknown, q = value depends on condition, shaded = unimplemented
IRP and RP1 bits are reserved, always maintain these bits clear.
OSTS bit of the OSCCON register reset to 0 with Dual Speed Start-up and LP, HS or XT selected as the oscillator.
RA3 pull-up is enabled when MCLRE is 1 in the Configuration Word register.
DS41202F-page 10
PIC16F684
2.2.2.1
STATUS Register
REGISTER 2-1:
Reserved
Reserved
R/W-0
R-1
R-1
R/W-x
R/W-x
R/W-x
IRP
RP1
RP0
TO
PD
DC
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
Z: Zero bit
1 = The result of an arithmetic or logic operation is zero
0 = The result of an arithmetic or logic operation is not zero
bit 1
DC: Digit Carry/Borrow bit (ADDWF, ADDLW,SUBLW,SUBWF instructions), For Borrow, the polarity is
reversed.
1 = A carry-out from the 4th low-order bit of the result occurred
0 = No carry-out from the 4th low-order bit of the result
bit 0
Note 1:
For Borrow, the polarity is reversed. A subtraction is executed by adding the twos complement of the second operand. For rotate (RRF, RLF) instructions, this bit is loaded with either the high-order or low-order bit
of the source register.
DS41202F-page 11
PIC16F684
2.2.2.2
OPTION Register
Note:
Timer0/WDT prescaler
External RA2/INT interrupt
Timer0
Weak pull-ups on PORTA
REGISTER 2-2:
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
RAPU
INTEDG
T0CS
T0SE
PSA
PS2
PS1
PS0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2-0
DS41202F-page 12
x = Bit is unknown
1:1
1:2
1:4
1:8
1 : 16
1 : 32
1 : 64
1 : 128
PIC16F684
2.2.2.3
INTCON Register
Note:
REGISTER 2-3:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
GIE
PEIE
T0IE
INTE
RAIE
T0IF
INTF
RAIF
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
Note 1:
2:
DS41202F-page 13
PIC16F684
2.2.2.4
PIE1 Register
REGISTER 2-4:
Note:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
EEIE
ADIE
CCP1IE
C2IE
C1IE
OSFIE
TMR2IE
TMR1IE
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
DS41202F-page 14
x = Bit is unknown
PIC16F684
2.2.2.5
PIR1 Register
REGISTER 2-5:
Note:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
EEIF
ADIF
CCP1IF
C2IF
C1IF
OSFIF
TMR2IF
TMR1IF
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
DS41202F-page 15
PIC16F684
2.2.2.6
PCON Register
REGISTER 2-6:
U-0
U-0
R/W-0
R/W-1
U-0
U-0
R/W-0
R/W-x
ULPWUE
SBOREN
POR
BOR
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7-6
Unimplemented: Read as 0
bit 5
bit 4
bit 3-2
Unimplemented: Read as 0
bit 1
bit 0
Note 1:
BOREN<1:0> = 01 in the Configuration Word register for this bit to control the BOR.
DS41202F-page 16
PIC16F684
2.3
2.3.2
FIGURE 2-3:
LOADING OF PC IN
DIFFERENT SITUATIONS
PCH
PCL
12
PC
PCLATH<4:0>
Instruction with
PCL as
Destination
ALU Result
PCLATH
PCH
12
11 10
PCL
8
PC
GOTO, CALL
2
PCLATH<4:3>
11
OPCODE <10:0>
PCLATH
2.3.1
STACK
MODIFYING PCL
2.4
EXAMPLE 2-1:
MOVLW
MOVWF
NEXT
CLRF
INCF
BTFSS
GOTO
CONTINUE
INDIRECT ADDRESSING
0x20
FSR
INDF
FSR, f
FSR,4
NEXT
;initialize pointer
;to RAM
;clear INDF register
;inc pointer
;all done?
;no clear next
;yes continue
DS41202F-page 17
PIC16F684
FIGURE 2-4:
Direct Addressing
RP1
(1)
RP0
Bank Select
From Opcode
Indirect Addressing
IRP(1)
Bank Select
Location Select
00
01
10
Location Select
11
00h
180h
Data
Memory
NOT USED
7Fh
1FFh
Bank 0
Bank 1
Bank 2
Bank 3
DS41202F-page 18
PIC16F684
3.0
3.1
Overview
1.
2.
3.
4.
5.
6.
7.
8.
FIGURE 3-1:
External Oscillator
OSC2
Sleep
MUX
OSC1
IRCF<2:0>
(OSCCON Register)
8 MHz
Internal Oscillator
4 MHz
System Clock
(CPU and Peripherals)
INTOSC
111
110
101
1 MHz
100
500 kHz
250 kHz
125 kHz
LFINTOSC
31 kHz
31 kHz
011
MUX
HFINTOSC
8 MHz
Postscaler
2 MHz
010
001
000
DS41202F-page 19
PIC16F684
3.2
Oscillator Control
REGISTER 3-1:
U-0
R/W-1
R/W-1
R/W-0
R-1
R-0
R-0
R/W-0
IRCF2
IRCF1
IRCF0
OSTS(1)
HTS
LTS
SCS
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
Unimplemented: Read as 0
bit 6-4
bit 3
bit 2
bit 1
bit 0
Note 1:
Bit resets to 0 with Two-Speed Start-up and LP, XT or HS selected as the Oscillator mode or Fail-Safe
mode is enabled.
DS41202F-page 20
PIC16F684
3.3
TABLE 3-1:
3.4
3.4.1
Switch From
Switch To
Frequency
Oscillator Delay
Sleep/POR
LFINTOSC
HFINTOSC
31 kHz
125 kHz to 8 MHz
Sleep/POR
EC, RC
DC 20 MHz
2 cycles
EC, RC
DC 20 MHz
1 cycle of each
Sleep/POR
LP, XT, HS
32 kHz to 20 MHz
HFINTOSC
1 s (approx.)
3.4.2
EC MODE
FIGURE 3-2:
Clock from
Ext. System
PIC MCU
I/O
Note 1:
OSC2/CLKOUT(1)
DS41202F-page 21
PIC16F684
3.4.3
FIGURE 3-3:
FIGURE 3-4:
QUARTZ CRYSTAL
OPERATION (LP, XT OR
HS MODE)
PIC MCU
OSC1/CLKIN
C1
PIC MCU
OSC1/CLKIN
C1
To Internal
Logic
RP(3)
RF(2)
Sleep
To Internal
Logic
Quartz
Crystal
C2
CERAMIC RESONATOR
OPERATION
(XT OR HS MODE)
RS(1)
RF(2)
Sleep
OSC2/CLKOUT
Note 1:
2:
DS41202F-page 22
C2 Ceramic
RS(1)
Resonator
Note 1:
OSC2/CLKOUT
PIC16F684
3.4.4
EXTERNAL RC MODES
3.5
FIGURE 3-5:
VDD
EXTERNAL RC MODES
PIC MCU
REXT
OSC1/CLKIN
Internal
Clock
CEXT
2.
3.5.1
VSS
FOSC/4 or
I/O(2)
OSC2/CLKOUT
(1)
3.5.2
HFINTOSC
DS41202F-page 23
PIC16F684
3.5.2.1
OSCTUNE Register
REGISTER 3-2:
U-0
U-0
U-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
TUN4
TUN3
TUN2
TUN1
TUN0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7-5
Unimplemented: Read as 0
bit 4-0
00001 =
00000 = Oscillator module is running at the calibrated frequency.
11111 =
DS41202F-page 24
x = Bit is unknown
PIC16F684
3.5.3
LFINTOSC
3.5.4
8 MHz
4 MHz (Default after Reset)
2 MHz
1 MHz
500 kHz
250 kHz
125 kHz
31 kHz (LFINTOSC)
Note:
3.5.5
6.
DS41202F-page 25
PIC16F684
FIGURE 3-6:
HFINTOSC
HFINTOSC
Start-up Time
2-cycle Sync
Running
LFINTOSC
IRCF <2:0>
=0
System Clock
HFINTOSC
HFINTOSC
2-cycle Sync
Running
LFINTOSC
IRCF <2:0>
=0
System Clock
LFINTOSC
HFINTOSC
LFINTOSC turns off unless WDT or FSCM is enabled
LFINTOSC
Start-up Time 2-cycle Sync
Running
HFINTOSC
IRCF <2:0>
= 0
System Clock
DS41202F-page 26
PIC16F684
3.6
Clock Switching
3.6.1
3.6.2
3.7
3.7.1
3.7.2
1.
2.
3.
4.
5.
6.
7.
TWO-SPEED START-UP
SEQUENCE
DS41202F-page 27
PIC16F684
3.7.3
FIGURE 3-7:
TWO-SPEED START-UP
HFINTOSC
TOST
OSC1
1022 1023
OSC2
Program Counter
PC - N
PC
PC + 1
System Clock
DS41202F-page 28
PIC16F684
3.8
3.8.3
FIGURE 3-8:
External
Clock
LFINTOSC
Oscillator
64
31 kHz
(~32 s)
488 Hz
(~2 ms)
3.8.4
3.8.1
Clock
Failure
Detected
FAIL-SAFE DETECTION
3.8.2
Sample Clock
FAIL-SAFE OPERATION
DS41202F-page 29
PIC16F684
FIGURE 3-9:
Sample Clock
Oscillator
Failure
System
Clock
Output
Clock Monitor Output
(Q)
Failure
Detected
OSCFIF
Test
Note:
Test
The system clock is normally at a much higher frequency than the sample clock. The relative frequencies in
this example have been chosen for clarity.
TABLE 3-2:
Name
Test
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
Value on
all other
Resets(1)
CONFIG(2)
CPD
CP
MCLRE
PWRTE
WDTE
FOSC2
FOSC1
FOSC0
OSCCON
IRCF2
IRCF1
IRCF0
OSTS
HTS
LTS
SCS
-110 x000
-110 x000
---u uuuu
OSCTUNE
TUN4
TUN3
TUN2
TUN1
TUN0
---0 0000
PIE1
EEIE
ADIE
CCP1IE
C2IE
C1IE
OSFIE
TMR2IE
TMR1IE
0000 0000
0000 0000
PIR1
EEIF
ADIF
CCP1IF
C2IF
C1IF
OSFIF
TMR2IF
TMR1IF
0000 0000
0000 0000
Legend:
Note 1:
2:
x = unknown, u = unchanged, = unimplemented locations read as 0. Shaded cells are not used by oscillators.
Other (non Power-up) Resets include MCLR Reset and Watchdog Timer Reset during normal operation.
See Configuration Word register (Register 12-1) for operation of all register bits.
DS41202F-page 30
PIC16F684
4.0
I/O PORTS
4.1
Note:
EXAMPLE 4-1:
REGISTER 4-1:
BCF
CLRF
MOVLW
MOVWF
BSF
CLRF
MOVLW
MOVWF
STATUS,RP0
PORTA
07h
CMCON0
STATUS,RP0
ANSEL
0Ch
TRISA
BCF
STATUS,RP0
INITIALIZING PORTA
;Bank 0
;Init PORTA
;Set RA<2:0> to
;digital I/O
;Bank 1
;digital I/O
;Set RA<3:2> as inputs
;and set RA<5:4,1:0>
;as outputs
;Bank 0
U-0
U-0
R/W-x
R/W-0
R-x
R/W-0
R/W-0
R/W-0
RA5
RA4
RA3
RA2
RA1
RA0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7-6
Unimplemented: Read as 0
bit 5-0
REGISTER 4-2:
x = Bit is unknown
U-0
U-0
R/W-1
R/W-1
R-1
R/W-1
R/W-1
R/W-1
TRISA5
TRISA4
TRISA3
TRISA2
TRISA1
TRISA0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7-6
Unimplemented: Read as 0
bit 5-0
Note 1:
2:
x = Bit is unknown
DS41202F-page 31
PIC16F684
4.2
4.2.3
INTERRUPT-ON-CHANGE
4.2.1
ANSEL REGISTER
4.2.2
WEAK PULL-UPS
REGISTER 4-3:
b)
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
ANS7
ANS6
ANS5
ANS4
ANS3
ANS2
ANS1
ANS0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7-0
Note 1:
x = Bit is unknown
DS41202F-page 32
PIC16F684
REGISTER 4-4:
U-0
U-0
R/W-1
R/W-1
U-0
R/W-1
R/W-1
R/W-1
WPUA5
WPUA4
WPUA2
WPUA1
WPUA0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7-6
Unimplemented: Read as 0
bit 5-4
bit 3
Unimplemented: Read as 0
bit 2-0
Note 1:
2:
3:
4:
x = Bit is unknown
REGISTER 4-5:
U-0
U-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
IOCA5
IOCA4
IOCA3
IOCA2
IOCA1
IOCA0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7-6
Unimplemented: Read as 0
bit 5-0
Note 1:
2:
x = Bit is unknown
Global Interrupt Enable (GIE) must be enabled for individual interrupts to be recognized.
IOCA<5:4> always reads 1 in XT, HS and LP OSC modes.
DS41202F-page 33
PIC16F684
4.2.4
Note:
EXAMPLE 4-2:
BANKSEL
MOVLW
MOVWF
BANKSEL
BCF
BCF
BANKSEL
BSF
CALL
BANKSEL
BSF
BSF
BSF
MOVLW
MOVWF
SLEEP
ULTRA LOW-POWER
WAKE-UP INITIALIZATION
CMCON0
H7
CMCON0
ANSEL
ANSEL,0
TRISA,0
PORTA
PORTA,0
CapDelay
PCON
PCON,ULPWUE
IOCA,0
TRISA,0
B10001000
INTCON
;
;Turn off
;comparators
;
;RA0 to digital I/O
;Output high to
;
;charge capacitor
;
;
;Enable ULP Wake-up
;Select RA0 IOC
;RA0 to input
;Enable interrupt
; and clear flag
;Wait for IOC
DS41202F-page 34
PIC16F684
4.2.5
4.2.5.2
Figure 4-2 shows the diagram for this pin. The RA1 pin
is configurable to function as one of the following:
4.2.5.1
RA1/AN1/C1IN-/VREF/ICSPCLK
RA0/AN0/C1IN+/ICSPDAT/ULPWU
Figure 4-1 shows the diagram for this pin. The RA0 pin
is configurable to function as one of the following:
FIGURE 4-1:
Weak
CK Q
WR
WPUA
RAPU
VDD
RD
WPUA
D
WR
PORTA
Q
I/O Pin
CK Q
VSS
+
D
WR
TRISA
VT
CK Q
IULP
0
RD
TRISA
Analog(1)
Input Mode
VSS
ULPWUE
RD
PORTA
D
WR
IOCA
Q
Q
CK Q
D
EN
RD
IOCA
Q3
D
EN
Interrupt-onChange
RD PORTA
To Comparator
To A/D Converter
Note
1:
DS41202F-page 35
PIC16F684
FIGURE 4-2:
Data Bus
WR
WPUA
VDD
CK Q
Weak
RAPU
D
WR
PORTA
Data Bus
I/O Pin
WR
TRISA
CK Q
VSS
Analog(1)
Input Mode
RD
TRISA
WR
WPUA
CK
Weak
VDD
CK
C1OUT 1
0
Q3
D
EN
Interrupt-onChange
RD PORTA
To Comparator
To A/D Converter
1:
D
EN
RD
IOCA
VDD
RAPU
WR
PORTA
CK Q
WR
IOCA
Analog(1)
Input Mode
RD
WPUA
C1OUT
Enable
RD
PORTA
Note
FIGURE 4-3:
VDD
CK Q
RA2/AN2/T0CKI/INT/C1OUT
Figure 4-3 shows the diagram for this pin. The RA2 pin
is configurable to function as one of the following:
Analog(1)
Input Mode
RD
WPUA
4.2.5.3
WR
TRISA
I/O Pin
CK
VSS
Analog(1)
Input Mode
RD
TRISA
RD
PORTA
Q
D
CK
WR
IOCA
Q
EN
RD
IOCA
Q3
D
EN
Interrupt-onChange
RD PORTA
To Timer0
To INT
To A/D Converter
Note
DS41202F-page 36
1:
PIC16F684
4.2.5.4
RA3/MCLR/VPP
4.2.5.5
RA4/AN3/T1G/OSC2/CLKOUT
Figure 4-4 shows the diagram for this pin. The RA3 pin
is configurable to function as one of the following:
Figure 4-5 shows the diagram for this pin. The RA4 pin
is configurable to function as one of the following:
FIGURE 4-4:
Data Bus
Input
Pin
MCLRE
RD
PORTA
WR
IOCA
CK
MCLRE
VSS
FIGURE 4-5:
Weak
Reset
RD
TRISA
VSS
Q
Q
Data Bus
WR
WPUA
D
CK
VDD
Weak
RAPU
RD
WPUA
Oscillator
Circuit
Q
EN
CLK(1)
Modes
OSC1
Q3
VDD
CLKOUT
Enable
RD
IOCA
D
D
EN
Interrupt-onChange
WR
PORTA
CK
FOSC/4
1
0
I/O Pin
Q
CLKOUT
Enable
RD PORTA
VSS
D
WR
TRISA
CK
Q
Q
INTOSC/
RC/EC(2)
CLKOUT
Enable
RD
TRISA
Analog
Input Mode
RD
PORTA
D
WR
IOCA
CK
Q
Q
Q
EN
RD
IOCA
Interrupt-onChange
Q3
D
EN
RD PORTA
To T1G
To A/D Converter
Note 1: CLK modes are XT, HS, LP, LPTMR1 and CLKOUT
Enable.
2: With CLKOUT option.
3: Analog Input mode comes from ANSEL.
DS41202F-page 37
PIC16F684
4.2.5.6
RA5/T1CKI/OSC1/CLKIN
Figure 4-6 shows the diagram for this pin. The RA5 pin
is configurable to function as one of the following:
FIGURE 4-6:
Data Bus
WR
WPUA
TMR1LPEN(1)
VDD
CK
Weak
Q
RAPU
RD
WPUA
Oscillator
Circuit
OSC2
D
WR
PORTA
VDD
CK
Q
I/O Pin
Q
D
WR
TRISA
CK
VSS
INTOSC
Mode
RD
TRISA
RD
PORTA
Q
D
WR
IOCA
CK
Q
EN
Q3
RD
IOCA
Q
D
EN
Interrupt-onChange
RD PORTA
To Timer1
Note
DS41202F-page 38
PIC16F684
TABLE 4-1:
Name
ANSEL
CMCON0
PCON
INTCON
IOCA
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
Value on
all other
Resets
ANS7
ANS6
ANS5
ANS4
ANS3
ANS2
ANS1
ANS0
1111 1111
1111 1111
C2OUT
C1OUT
C2INV
C1INV
CIS
CM2
CM1
CM0
0000 0000
0000 0000
ULPWUE
SBOREN
POR
BOR
--01 --qq
--0u --uu
GIE
PEIE
T0IE
INTE
RAIE
T0IF
INTF
RAIF
0000 0000
0000 0000
--00 0000
IOCA5
IOCA4
IOCA3
IOCA2
IOCA1
IOCA0
--00 0000
RAPU
INTEDG
T0CS
T0SE
PSA
PS2
PS1
PS0
1111 1111
1111 1111
PORTA
RA5
RA4
RA3
RA2
RA1
RA0
--x0 x000
--uu uu00
TRISA
TRISA5
TRISA4
TRISA3
TRISA2
TRISA1
TRISA0
--11 1111
--11 1111
WPUA
WPUA5
WPUA4
WPUA2
WPUA1
WPUA0
--11 -111
--11 -111
OPTION_REG
Legend:
x = unknown, u = unchanged, = unimplemented locations read as 0. Shaded cells are not used by PORTA.
DS41202F-page 39
PIC16F684
4.3
EXAMPLE 4-3:
PORTC
REGISTER 4-6:
BANKSEL
CLRF
MOVLW
MOVWF
BANKSEL
CLRF
MOVLW
MOVWF
PORTC
PORTC
07h
CMCON0
ANSEL
ANSEL
0Ch
TRISC
BCF
STATUS,RP0
INITIALIZING PORTC
;
;Init PORTC
;Set RC<4,1:0> to
;digital I/O
;
;digital I/O
;Set RC<3:2> as inputs
;and set RC<5:4,1:0>
;as outputs
;Bank 0
U-0
U-0
R/W-x
R/W-x
R/W-0
R/W-0
R/W-0
R/W-0
RC5
RC4
RC3
RC2
RC1
RC0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7-6
Unimplemented: Read as 0
bit 5-0
REGISTER 4-7:
x = Bit is unknown
U-0
U-0
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
TRISC5
TRISC4
TRISC3
TRISC2
TRISC1
TRISC0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7-6
Unimplemented: Read as 0
bit 5-0
DS41202F-page 40
x = Bit is unknown
PIC16F684
4.3.1
RC0/AN4/C2IN+
4.3.3
RC2/AN6/P1D
4.3.2
4.3.4
RC1/AN5/C2IN-
RC3/AN7/P1C
FIGURE 4-7:
FIGURE 4-8:
Data Bus
Data Bus
D
WR
PORTC
CK
CCPOUT
Enable
VDD
D
WR
PORTC
CK
VDD
Q
Q
CCPOUT
I/O Pin
D
WR
TRISC
CK
VSS
Analog Input
Mode(1)
RD
TRISC
WR
TRISC
CK
I/O Pin
Q
Q
VSS
Analog Input
Mode(1)
RD
TRISC
RD
PORTC
RD
PORTC
To Comparators
To A/D Converter
To A/D Converter
Note
Note
1:
1:
DS41202F-page 41
PIC16F684
4.3.5
RC4/C2OUT/P1B
4.3.6
RC5/CCP1/P1A
Note:
FIGURE 4-9:
FIGURE 4-10:
Data bus
D
WR
PORTC
D
VDD
C2OUT EN
C2OUT
VDD
CCP1OUT 1
WR
TRISC
CK
I/O Pin
Q
Q
VSS
CCPOUT EN
CCPOUT
Data Bus
WR
PORTC
CK
CCP1OUT
Enable
C2OUT EN
CCPOUT EN
RD
TRISC
I/O Pin
CK Q
RD
PORTC
VSS
To Enhanced CCP
D
WR
TRISC
CK Q
RD
TRISC
RD
PORTC
Note
1:
TABLE 4-2:
Name
ANSEL
CMCON0
PORTC
TRISC
Legend:
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
Value on
all other
Resets
1111 1111
ANS7
ANS6
ANS5
ANS4
ANS3
ANS2
ANS1
ANS0
1111 1111
C2OUT
C1OUT
C2INV
C1INV
CIS
CM2
CM1
CM0
0000 0000
0000 0000
RC5
RC4
RC3
RC2
RC1
RC0
--xx 0000
--uu uu00
TRISC5
TRISC4
TRISC3
TRISC2
TRISC1
TRISC0
--11 1111
--11 1111
x = unknown, u = unchanged, = unimplemented locations read as 0. Shaded cells are not used by PORTC.
DS41202F-page 42
PIC16F684
5.0
TIMER0 MODULE
5.1
Timer0 Operation
5.1.1
5.1.2
FIGURE 5-1:
FOSC/4
Data Bus
0
8
1
Sync 2
cycles
1
T0CKI
pin
TMR0
0
0
T0CS
T0SE
8-bit
Prescaler
PSA
1
8
PSA
WDTE
SWDTEN
3
PS<2:0>
16-bit
Prescaler
31 kHz
INTOSC
1
WDT
Time-out
0
16
Watchdog
Timer
PSA
WDTPS<3:0>
Note 1:
2:
3:
DS41202F-page 43
PIC16F684
5.1.3
SOFTWARE PROGRAMMABLE
PRESCALER
5.1.3.1
EXAMPLE 5-1:
BANKSEL
CLRWDT
CLRF
CHANGING PRESCALER
(TIMER0 WDT)
TMR0
TMR0
BANKSEL
BSF
CLRWDT
OPTION_REG
OPTION_REG,PSA
MOVLW
ANDWF
IORLW
MOVWF
b11111000
OPTION_REG,W
b00000101
OPTION_REG
DS41202F-page 44
;
;Clear WDT
;Clear TMR0 and
; prescaler
;
;Select WDT
;
;
;Mask prescaler
; bits
;Set WDT prescaler
; to 1:32
EXAMPLE 5-2:
CHANGING PRESCALER
(WDT TIMER0)
CLRWDT
5.1.4
TIMER0 INTERRUPT
5.1.5
PIC16F684
REGISTER 5-1:
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
RAPU
INTEDG
T0CS
T0SE
PSA
PS2
PS1
PS0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2-0
Note 1:
WDT RATE
1:2
1:4
1:8
1 : 16
1 : 32
1 : 64
1 : 128
1 : 256
1:1
1:2
1:4
1:8
1 : 16
1 : 32
1 : 64
1 : 128
A dedicated 16-bit WDT postscaler is available. See Section 12.6 Watchdog Timer (WDT) for more
information.
TABLE 5-1:
Name
TMR0
INTCON
OPTION_REG
TRISA
TMR0 RATE
x = Bit is unknown
Bit 6
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
T0IE
INTE
RAIE
T0IF
INTF
RAIF
T0CS
T0SE
PSA
PS2
PS1
PS0
PEIE
RAPU INTEDG
Value on
all other
Resets
Bit 4
Bit 5
TRISA5 TRISA4 TRISA3 TRISA2 TRISA1 TRISA0 --11 1111 --11 1111
Legend: = Unimplemented locations, read as 0, u = unchanged, x = unknown. Shaded cells are not used by the
Timer0 module.
DS41202F-page 45
PIC16F684
NOTES:
DS41202F-page 46
PIC16F684
6.0
6.1
Timer1 Operation
6.2
Clock Source
TMR1CS
FOSC/4
T1CKI pin
FIGURE 6-1:
T1GINV
TMR1ON
Set flag bit
TMR1IF on
Overflow
TMR1
TMR1H
To C2 Comparator Module
Timer1 Clock
(1)
TMR1L
Synchronized
clock input
EN
1
Oscillator
OSC1/T1CKI
T1SYNC
*
1
FOSC/4
Internal
Clock
OSC2/T1G
Prescaler
1, 2, 4, 8
Synchronize
det(2)
0
2
T1CKPS<1:0>
TMR1CS
1
T1OSCEN
C2OUT
FOSC = 100
FOSC = 000
T1GSS
Sleep
*
Note 1:
2:
ST Buffer is low power type when using LP osc, or high speed type when using T1CKI.
Timer1 register increments on rising edge.
Synchronize does not operate while in Sleep.
DS41202F-page 47
PIC16F684
6.2.1
6.2.2
6.5
Timer1 Operation in
Asynchronous Counter Mode
6.5.1
6.3
Timer1 Prescaler
6.4
Timer1 Oscillator
DS41202F-page 48
PIC16F684
6.6
Timer1 Gate
6.7
Timer1 Interrupt
6.8
6.9
6.10
6.11
Comparator Synchronization
DS41202F-page 49
PIC16F684
FIGURE 6-2:
T1CKI = 1
when TMR1
Enabled
T1CKI = 0
when TMR1
Enabled
Note 1:
2:
6.12
In Counter mode, a falling edge must be registered by the counter prior to the first incrementing rising edge of the clock.
REGISTER 6-1:
R/W-0
(1)
T1GINV
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
TMR1GE(2)
T1CKPS1
T1CKPS0
T1OSCEN
T1SYNC
TMR1CS
TMR1ON
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5-4
bit 3
DS41202F-page 50
x = Bit is unknown
PIC16F684
REGISTER 6-1:
bit 2
bit 1
bit 0
Note 1:
2:
TABLE 6-1:
Name
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
Value on
all other
Resets
CMCON1
T1GSS
C2SYNC
---- --10
---- --10
INTCON
GIE
PEIE
T0IE
INTE
RAIE
T0IF
INTF
RAIF
0000 0000
0000 0000
PIE1
EEIE
ADIE
CCP1IE
C2IE
C1IE
OSFIE
TMR2IE
TMR1IE
0000 0000
0000 0000
PIR1
EEIF
ADIF
CCP1IF
C2IF
C1IF
OSFIF
TMR2IF
TMR1IF
0000 0000
0000 0000
uuuu uuuu
TMR1H
Holding Register for the Most Significant Byte of the 16-bit TMR1 Register
xxxx xxxx
TMR1L
Holding Register for the Least Significant Byte of the 16-bit TMR1 Register
xxxx xxxx
uuuu uuuu
0000 0000
uuuu uuuu
T1CON
Legend:
T1GINV
TMR1GE
T1CKPS1
T1CKPS0
T1OSCEN
T1SYNC
TMR1CS
TMR1ON
x = unknown, u = unchanged, = unimplemented, read as 0. Shaded cells are not used by the Timer1 module.
DS41202F-page 51
PIC16F684
NOTES:
DS41202F-page 52
PIC16F684
7.0
TIMER2 MODULE
7.1
Timer2 Operation
FIGURE 7-1:
FOSC/4
Prescaler
1:1, 1:4, 1:16
2
TMR2
Sets Flag
bit TMR2IF
Reset
Comparator
EQ
Postscaler
1:1 to 1:16
T2CKPS<1:0>
PR2
4
TOUTPS<3:0>
DS41202F-page 53
PIC16F684
REGISTER 7-1:
U-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
TOUTPS3
TOUTPS2
TOUTPS1
TOUTPS0
TMR2ON
T2CKPS1
T2CKPS0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
Unimplemented: Read as 0
bit 6-3
bit 2
bit 1-0
TABLE 7-1:
x = Bit is unknown
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
Value on
all other
Resets
INTCON
GIE
PEIE
T0IE
INTE
RAIE
T0IF
INTF
RAIF
0000 0000
0000 0000
PIE1
EEIE
ADIE
CCP1IE
C2IE
C1IE
OSFIE
TMR2IE
TMR1IE
0000 0000
0000 0000
PIR1
EEIF
ADIF
CCP1IF
C2IF
C1IF
OSFIF
TMR2IF
TMR1IF
0000 0000
0000 0000
PR2
1111 1111
1111 1111
TMR2
0000 0000
0000 0000
-000 0000
-000 0000
T2CON
Legend:
x = unknown, u = unchanged, = unimplemented read as 0. Shaded cells are not used for Timer2 module.
DS41202F-page 54
TOUTPS3
TOUTPS2
TOUTPS1
TOUTPS0
TMR2ON
T2CKPS1
T2CKPS0
PIC16F684
8.0
COMPARATOR MODULE
8.1
Comparator Overview
Dual comparators
Multiple comparator configurations
Comparator outputs are available internally/
externally
Programmable output polarity
Interrupt-on-change
Wake-up from Sleep
Timer1 gate (count enable)
Output synchronization to Timer1 clock input
Programmable voltage reference
FIGURE 8-1:
Note:
SINGLE COMPARATOR
VIN+
VIN-
Output
VINVIN+
Note:
DS41202F-page 55
PIC16F684
FIGURE 8-2:
MULTIPLEX
Port Pins
C1INV
To C1OUT pin
C1
D
Q1
To Data Bus
EN
RD CMCON0
Set C1IF bit
D
Q3*RD CMCON0
EN
CL
Reset
Note 1:
2:
FIGURE 8-3:
Port Pins
MULTIPLEX
To Timer1 Gate
C2INV
0
C2
To C2OUT pin
D
Timer1
clock source(1)
Q1
EN
To Data Bus
RD CMCON0
Set C2IF bit
D
Q3*RD CMCON0
EN
CL
Reset
Note 1:
DS41202F-page 56
2:
3:
PIC16F684
8.1.1
FIGURE 8-4:
Rs < 10K
RIC
To ADC Input
AIN
VA
CPIN
5 pF
VT 0.6V
ILEAKAGE
500 nA
Vss
Legend: CPIN
= Input Capacitance
ILEAKAGE = Leakage Current at the pin due to various junctions
= Interconnect Resistance
RIC
= Source Impedance
RS
VA
= Analog Voltage
= Threshold Voltage
VT
DS41202F-page 57
PIC16F684
8.2
Comparator Configuration
FIGURE 8-5:
VIN+
C1IN+ A
C2IN-
C1
Off(1)
C2
Off(1)
C1IN+
VIN+
C2INC2IN+
C2INC2IN+
CIS = 0
CIS = 1
VINC1
VIN+
VIN-
VIN+
C1OUT
C2
C2OUT
C1IN+
A
A
CIS = 0
CIS = 1
VINVIN+
C1
VIN+
VIN-
VIN+
C1IN+
C2IN+
I/O
VIN+
VIN-
VIN+
C2IN+
C2
C2OUT
C1
Off(1)
C2
C2OUT
VIN+
C1OUT
C1
C1OUT
C2
C2OUT
A
A
CIS = 0
CIS = 1
VINVIN+
C2
C2OUT
C2INC2IN+
I/O
VIN+
VIN-
VIN+
C1
C2OUT(pin)
C1OUT
C2OUT
VIN-
VIN+
C1IN+ I/O
C2IN-
C2
C2INC2IN+
Note 1:
C1OUT
C2IN-
C1
C2IN-
VIN-
C2IN+ A
C1IN+
Note:
C1IN-
C2IN+
VIN+
I/O
VIN-
I/O
VIN+
C1
Off(1)
C2
Off(1)
DS41202F-page 58
PIC16F684
8.3
Comparator Control
8.4
Mode selection
Output state
Output polarity
Input switch
8.3.1
8.3.2
TABLE 8-1:
Input Conditions
CxINV
CxOUT
Note:
8.3.3
8.5
DS41202F-page 59
PIC16F684
A persistent mismatch condition will preclude clearing
the CxIF interrupt flag. Reading CMCON0 will end the
mismatch condition and allow the CxIF bit to be
cleared.
FIGURE 8-6:
COMPARATOR
INTERRUPT TIMING W/O
CMCON0 READ
Q1
Q3
CxIN+
TRT
CxOUT
Set CMIF (level)
CMIF
reset by software
FIGURE 8-7:
COMPARATOR
INTERRUPT TIMING WITH
CMCON0 READ
Q3
TRT
CxOUT
Set CMIF (level)
CMIF
cleared by CMCON0 read
8.7
Effects of a Reset
Q1
CxIN+
8.6
reset by software
DS41202F-page 60
PIC16F684
REGISTER 8-1:
R-0
R-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
C2OUT
C1OUT
C2INV
C1INV
CIS
CM2
CM1
CM0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2-0
x = Bit is unknown
DS41202F-page 61
PIC16F684
8.8
8.9
REGISTER 8-2:
Synchronizing Comparator C2
Output to Timer1
U-0
U-0
U-0
U-0
U-0
U-0
R/W-1
R/W-0
T1GSS
C2SYNC
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7-2
Unimplemented: Read as 0
bit 1
bit 0
Note 1:
2:
DS41202F-page 62
PIC16F684
8.10
EQUATION 8-1:
V RR = 1 (low range):
CVREF = (VR<3:0>/24) V DD
V RR = 0 (high range):
CV REF = (VDD/4) + (VR<3:0> VDD/32)
8.10.1
INDEPENDENT OPERATION
8.10.3
VREN = 0
VRR = 1
VR<3:0> = 0000
8.10.2
8.10.4
U-0
R/W-0
U-0
R/W-0
R/W-0
R/W-0
R/W-0
VREN
VRR
VR3
VR2
VR1
VR0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
Unimplemented: Read as 0
bit 5
bit 4
Unimplemented: Read as 0
bit 3-0
x = Bit is unknown
DS41202F-page 63
PIC16F684
FIGURE 8-8:
VDD
8R
VRR
16-1 Analog
MUX
VREN
15
14
CVREF to
Comparator
Input
2
1
0
VR<3:0>(1)
VREN
VR<3:0> = 0000
VRR
Note 1:
TABLE 8-2:
Name
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
Value on
all other
Resets
ANS7
ANS6
ANS5
ANS4
ANS3
ANS2
ANS1
ANS0
1111 1111
1111 1111
CMCON0
C2OUT
C1OUT
C2INV
C1INV
CIS
CM2
CM1
CM0
0000 0000
0000 0000
CMCON1
T1GSS
C2SYNC
---- --10
---- --10
INTCON
GIE
PEIE
T0IE
INTE
RAIE
T0IF
INTF
RAIF
0000 0000
0000 0000
PIE1
EEIE
ADIE
CCP1IE
C2IE
C1IE
OSFIE
TMR2IE
TMR1IE
0000 0000
0000 0000
PIR1
EEIF
ADIF
CCP1IF
C2IF
C1IF
OSFIF
TMR2IF
TMR1IF
0000 0000
0000 0000
PORTA
RA5
RA4
RA3
RA2
RA1
RA0
--x0 x000
--uu uu00
PORTC
RC5
RC4
RC3
RC2
RC1
RC0
--xx 0000
--uu uu00
TRISA
TRISA1
TRISA0
--11 1111
--11 1111
TRISC
TRISC1
TRISC0
--11 1111
--11 1111
VREN
VR1
VR0
0-0- 0000
0-0- 0000
ANSEL
VRCON
Legend:
VRR
VR3
VR2
x = unknown, u = unchanged, - = unimplemented, read as 0. Shaded cells are not used for comparator.
DS41202F-page 64
PIC16F684
9.0
ANALOG-TO-DIGITAL
CONVERTER (ADC) MODULE
FIGURE 9-1:
VREF
VCFG = 1
RA0/AN0
RA1/AN1/VREF
RA2/AN2
A/D
10
GO/DONE
RA4/AN3
RC0/AN4
ADFM
RC1/AN5
RC2/AN6
0 = Left Justify
1 = Right Justify
ADON
10
RC3/AN7
4
VSS
ADRESH
ADRESL
CHS <3:0>
DS41202F-page 65
PIC16F684
9.1
9.1.4
ADC Configuration
Port configuration
Channel selection
ADC voltage reference selection
ADC conversion clock source
Interrupt control
Results formatting
9.1.1
9.1.2
The source of the conversion clock is software selectable via the ADCS bits of the ADCON1 register. There
are seven possible clock options:
PORT CONFIGURATION
CONVERSION CLOCK
FOSC/2
FOSC/4
FOSC/8
FOSC/16
FOSC/32
FOSC/64
FRC (dedicated internal oscillator)
CHANNEL SELECTION
9.1.3
TABLE 9-1:
ADC CLOCK PERIOD (TAD) VS. DEVICE OPERATING FREQUENCIES (VDD > 3.0V)
ADCS<2:0>
20 MHz
8 MHz
4 MHz
1 MHz
FOSC/2
000
100 ns(2)
250 ns(2)
500 ns(2)
2.0 s
FOSC/4
100
200
ns(2)
ns(2)
1.0 s(2)
4.0 s
FOSC/8
001
400 ns(2)
1.0 s(2)
2.0 s
8.0 s(3)
FOSC/16
101
800 ns(2)
2.0 s
4.0 s
16.0 s(3)
FOSC/32
010
1.6 s
4.0 s
8.0 s(3)
32.0 s(3)
s(3)
64.0 s(3)
2-6 s(1,4)
2-6 s(1,4)
FOSC/64
110
3.2 s
FRC
x11
2-6 s(1,4)
Legend:
Note 1:
2:
3:
4:
500
8.0
s(3)
2-6 s(1,4)
16.0
DS41202F-page 66
PIC16F684
FIGURE 9-2:
TCY to TAD TAD1 TAD2 TAD3 TAD4 TAD5 TAD6 TAD7 TAD8 TAD9 TAD10 TAD11
b9
b8
b7
b6
b5
b4
b3
b2
b1
b0
Conversion Starts
Holding Capacitor is Disconnected from Analog Input (typically 100 ns)
Set GO/DONE bit
9.1.5
INTERRUPTS
9.1.6
RESULT FORMATTING
FIGURE 9-3:
(ADFM = 0)
ADRESL
MSB
LSB
bit 7
bit 0
bit 7
bit 0
Unimplemented: Read as 0
MSB
bit 7
Unimplemented: Read as 0
LSB
bit 0
bit 7
bit 0
10-bit A/D Result
DS41202F-page 67
PIC16F684
9.2
9.2.1
ADC Operation
STARTING A CONVERSION
9.2.2
COMPLETION OF A CONVERSION
9.2.3
TERMINATING A CONVERSION
9.2.4
9.2.5
9.2.6
DS41202F-page 68
2.
3.
4.
5.
6.
7.
8.
Configure Port:
Disable pin output driver (See TRIS register)
Configure pin as analog
Configure the ADC module:
Select ADC conversion clock
Configure voltage reference
Select ADC input channel
Select result format
Turn on ADC module
Configure ADC interrupt (optional):
Clear ADC interrupt flag
Enable ADC interrupt
Enable peripheral interrupt
Enable global interrupt(1)
Wait the required acquisition time(2).
Start conversion by setting the GO/DONE bit.
Wait for ADC conversion to complete by one of
the following:
Polling the GO/DONE bit
Waiting for the ADC interrupt (interrupts
enabled)
Read ADC Result
Clear the ADC interrupt flag (required if interrupt
is enabled).
A/D
Acquisition
PIC16F684
EXAMPLE 9-1:
A/D CONVERSION
DS41202F-page 69
PIC16F684
9.2.7
The following registers are used to control the operation of the ADC.
REGISTER 9-1:
R/W-0
R/W-0
U-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
ADFM
VCFG
CHS2
CHS1
CHS0
GO/DONE
ADON
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
Unimplemented: Read as 0
bit 4-2
bit 1
bit 0
REGISTER 9-2:
U-0
R/W-0
R/W-0
R/W-0
U-0
U-0
U-0
U-0
ADCS2
ADCS1
ADCS0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
Unimplemented: Read as 0
bit 6-4
bit 3-0
Unimplemented: Read as 0
DS41202F-page 70
x = Bit is unknown
PIC16F684
REGISTER 9-3:
R/W-x
R/W-x
R/W-x
R/W-x
R/W-x
R/W-x
R/W-x
R/W-x
ADRES9
ADRES8
ADRES7
ADRES6
ADRES5
ADRES4
ADRES3
ADRES2
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7-0
x = Bit is unknown
REGISTER 9-4:
R/W-x
R/W-x
R/W-x
R/W-x
R/W-x
R/W-x
R/W-x
R/W-x
ADRES1
ADRES0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7-6
bit 5-0
REGISTER 9-5:
x = Bit is unknown
R/W-x
R/W-x
R/W-x
R/W-x
R/W-x
R/W-x
R/W-x
R/W-x
ADRES9
ADRES8
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7-2
bit 1-0
REGISTER 9-6:
x = Bit is unknown
R/W-x
R/W-x
R/W-x
R/W-x
R/W-x
R/W-x
R/W-x
R/W-x
ADRES7
ADRES6
ADRES5
ADRES4
ADRES3
ADRES2
ADRES1
ADRES0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7-0
x = Bit is unknown
DS41202F-page 71
PIC16F684
9.3
EQUATION 9-1:
Assumptions:
T ACQ = Amplifier Settling Time + Hold Capacitor Charging Time + Temperature Coefficient
= T AMP + T C + T COFF
= 5s + T C + [ ( Temperature - 25C ) ( 0.05s/C ) ]
The value for TC can be approximated with the following equations:
1
V AP PLIE D 1 ------------ = V CHOLD
2047
TC
----------
RC
V AP P LI ED 1 e = V CHOLD
Tc
---------
1
RC
V AP P LIED 1 e = V A P PLIE D 1 ------------
2047
T C = C HOLD ( R IC + R SS + R S ) ln(1/2047)
= 10pF ( 1k + 7k + 10k ) ln(0.0004885)
= 1.37 s
Therefore:
T ACQ = 5 S + 1.37 S + [ ( 50C- 25C ) ( 0.05 S /C ) ]
= 7.67 S
Note 1: The reference voltage (VREF) has no effect on the equation, since it cancels itself out.
2: The charge holding capacitor (CHOLD) is not discharged after each conversion.
3: The maximum recommended impedance for analog sources is 10 k. This is required to meet the pin
leakage specification.
DS41202F-page 72
PIC16F684
FIGURE 9-4:
Rs
CPIN
5 pF
VA
VT = 0.6V
VT = 0.6V
RIC 1k
Sampling
Switch
SS Rss
I LEAKAGE
500 nA
CHOLD = 10 pF
VSS/VREF-
Legend: CPIN
= Input Capacitance
= Threshold Voltage
VT
I LEAKAGE = Leakage current at the pin due to
various junctions
RIC
= Interconnect Resistance
SS
= Sampling Switch
CHOLD
= Sample/Hold Capacitance
FIGURE 9-5:
6V
5V
VDD 4V
3V
2V
RSS
5 6 7 8 9 10 11
Sampling Switch
(k)
Full-Scale Range
3FFh
3FEh
ADC Output Code
3FDh
3FCh
1 LSB ideal
3FBh
Full-Scale
Transition
004h
003h
002h
001h
000h
VSS/VREF-
Zero-Scale
Transition
VDD/VREF+
DS41202F-page 73
PIC16F684
TABLE 9-2:
Value on:
POR, BOR
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
ADCON0
ADFM
VCFG
CHS2
CHS1
CHS0
GO/DONE
ADON
0000 0000
0000 0000
ADCS2
ADCS1
ADCS0
-000 ----
-000 ----
ANS7
ANS6
ANS5
ANS4
ANS3
ANS2
ANS1
ANS0
1111 1111
1111 1111
ADCON1
ANSEL
ADRESH
xxxx xxxx
uuuu uuuu
ADRESL
xxxx xxxx
uuuu uuuu
0000 0000
0000 0000
INTCON
GIE
PEIE
T0IE
INTE
RAIE
T0IF
INTF
RAIF
PIE1
EEIE
ADIE
CCPIE
C2IE
C1IE
OSFIE
TMR2IE
TMR1IE
0000 0000
0000 0000
PIR1
EEIF
ADIF
CCPIF
C2IF
C1IF
OSFIF
TMR2IF
TMR1IF
0000 0000
0000 0000
PORTA
RA5
RA4
RA3
RA2
RA1
RA0
--x0 x000
--uu uuuu
--uu uuuu
PORTC
RC5
RC4
RC3
RC2
RC1
RC0
--xx 0000
TRISA
TRISA5
TRISA4
TRISA3
TRISA2
TRISA1
TRISA0
--11 1111
--11 1111
TRISC
TRISC5
TRISC4
TRISC3
TRISC2
TRISC1
TRISC0
--11 1111
--11 1111
Legend:
x = unknown, u = unchanged, = unimplemented read as 0. Shaded cells are not used for ADC module.
DS41202F-page 74
PIC16F684
10.0
EECON1
EECON2 (not a physically implemented register)
EEDAT
EEADR
REGISTER 10-1:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
EEDAT7
EEDAT6
EEDAT5
EEDAT4
EEDAT3
EEDAT2
EEDAT1
EEDAT0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7-0
x = Bit is unknown
REGISTER 10-2:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
EEADR7
EEADR6
EEADR5
EEADR4
EEADR3
EEADR2
EEADR1
EEADR0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7-0
x = Bit is unknown
EEADR: Specifies One of 256 Locations for EEPROM Read/Write Operation bits
DS41202F-page 75
PIC16F684
10.1
REGISTER 10-3:
U-0
U-0
U-0
U-0
R/W-x
R/W-0
R/S-0
R/S-0
WRERR
WREN
WR
RD
bit 7
bit 0
Legend:
S = Bit can only be set
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7-4
Unimplemented: Read as 0
bit 3
bit 2
bit 1
bit 0
DS41202F-page 76
PIC16F684
10.2
EXAMPLE 10-1:
BANKSEL
MOVLW
MOVWF
BSF
MOVF
EEADR
;
CONFIG_ADDR ;
EEADR
;Address to read
EECON1,RD ;EE Read
EEDAT,W
;Move data to W
10.3
Required
Sequence
EXAMPLE 10-2:
BANKSEL
BSF
BCF
BTFSC
GOTO
MOVLW
MOVWF
MOVLW
MOVWF
BSF
BSF
EECON1
EECON1,WREN
INTCON,GIE
INTCON,GIE
$-2
55h
EECON2
AAh
EECON2
EECON1,WR
INTCON,GIE
;
;Enable write
;Disable INTs
;See AN576
;
;Unlock write
;
;
;
;Start the write
;Enable INTS
10.4
Write Verify
EXAMPLE 10-3:
WRITE VERIFY
BANKSELEEDAT
MOVF
EEDAT,W
BSF
EECON1,RD
XORWF
BTFSS
GOTO
:
EEDAT,W
STATUS,Z
WRITE_ERR
10.4.1
;
;EEDAT not changed
;from previous write
;YES, Read the
;value written
;Is data the same
;No, handle error
;Yes, continue
DS41202F-page 77
PIC16F684
10.5
10.6
TABLE 10-1:
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
Value on
all other
Resets
INTCON
GIE
PEIE
T0IE
INTE
RAIE
T0IF
INTF
RAIF
0000 0000
0000 0000
PIR1
EEIF
ADIF
CCP1IF
C2IF
C1IF
OSFIF
TMR2IF
TMR1IF
0000 0000
0000 0000
EEIE
ADIE
CCP1IE
C2IE
C1IE
OSFIE
TMR2IE
TMR1IE
0000 0000
0000 0000
EEDAT
EEDAT7
EEDAT6
EEDAT5
EEDAT4
EEDAT3
EEDAT2
EEDAT1
EEDAT0
0000 0000
0000 0000
EEADR
0000 0000
0000 0000
PIE1
EECON1
WRERR
WREN
WR
RD
---- x000
---- q000
---- ----
---- ----
Legend:
x = unknown, u = unchanged, = unimplemented read as 0, q = value depends upon condition. Shaded cells are not used by the Data
EEPROM module.
Note 1:
DS41202F-page 78
PIC16F684
11.0
ENHANCED
CAPTURE/COMPARE/PWM
(WITH AUTO-SHUTDOWN AND
DEAD BAND) MODULE
TABLE 11-1:
REGISTER 11-1:
ECCP Mode
Timer Resource
Capture
Timer1
Compare
Timer1
PWM
Timer2
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
P1M1
P1M0
DC1B1
DC1B0
CCP1M3
CCP1M2
CCP1M1
CCP1M0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7-6
bit 5-4
bit 3-0
DS41202F-page 79
PIC16F684
11.1
11.1.2
Capture Mode
11.1.1
FIGURE 11-1:
Prescaler
1, 4, 16
CAPTURE MODE
OPERATION BLOCK
DIAGRAM
CCPR1H
and
Edge Detect
11.1.3
SOFTWARE INTERRUPT
11.1.4
CCP PRESCALER
EXAMPLE 11-1:
CLRF
MOVLW
CCPR1L
Capture
Enable
TMR1H
CHANGING BETWEEN
CAPTURE PRESCALERS
BANKSEL CCP1CON
CCP1
pin
MOVWF
TMR1L
CCP1CON<3:0>
System Clock (FOSC)
DS41202F-page 80
PIC16F684
11.2
11.2.2
Compare Mode
FIGURE 11-2:
COMPARE MODE
OPERATION BLOCK
DIAGRAM
CCP1CON<3:0>
Mode Select
S
R
Output
Logic
Match
TRIS
Output Enable
Comparator
TMR1H
TMR1L
11.2.1
11.2.4
CCP1
Pin
11.2.3
DS41202F-page 81
PIC16F684
11.3
PWM Mode
PR2
T2CON
CCPR1L
CCP1CON
FIGURE 11-4:
Period
Pulse Width
TMR2 = PR2
TMR2 = CCPR1L:CCP1CON<5:4>
TMR2 = 0
FIGURE 11-3:
CCPR1H(2) (Slave)
CCP1
R
Comparator
TMR2
(1)
S
TRIS
Comparator
PR2
Note 1:
2:
Clear Timer2,
toggle CCP1 pin and
latch duty cycle
DS41202F-page 82
PIC16F684
11.3.1
PWM PERIOD
EQUATION 11-2:
EQUATION 11-1:
EQUATION 11-3:
CCPR1L:CCP1CON<5:4> -)
Duty Cycle Ratio = (---------------------------------------------------------------------4 ( PR2 + 1 )
11.3.2
PWM PERIOD
Note:
PULSE WIDTH
11.3.3
PWM RESOLUTION
[ 4 ( PR2 + 1 ) ]- bits
Resolution = log
----------------------------------------log ( 2 )
TABLE 11-2:
EQUATION 11-4:
Note:
PWM RESOLUTION
PWM Frequency
Timer Prescale (1, 4, 16)
PR2 Value
Maximum Resolution (bits)
TABLE 11-3:
1.22 kHz
4.88 kHz
19.53 kHz
78.12 kHz
156.3 kHz
208.3 kHz
16
0xFF
0xFF
0xFF
0x3F
0x1F
0x17
10
10
10
6.6
PWM Frequency
Timer Prescale (1, 4, 16)
PR2 Value
Maximum Resolution (bits)
1.22 kHz
4.90 kHz
19.61 kHz
76.92 kHz
153.85 kHz
200.0 kHz
16
0x65
0x65
0x65
0x19
0x0C
0x09
DS41202F-page 83
PIC16F684
11.3.4
11.3.5
11.3.6
11.3.7
4.
5.
EFFECTS OF RESET
Any Reset will force all ports to Input mode and the
CCP registers to their Reset states.
6.
DS41202F-page 84
PIC16F684
11.4
The PWM outputs are multiplexed with I/O pins and are
designated P1A, P1B, P1C and P1D. The polarity of the
PWM pins is configurable and is selected by setting the
CCP1M bits in the CCP1CON register appropriately.
Single PWM
Half-Bridge PWM
Full-Bridge PWM, Forward mode
Full-Bridge PWM, Reverse mode
FIGURE 11-5:
CCP1M<3:0>
4
P1M<1:0>
CCPR1L
CCP1/P1A
CCP1/P1A
TRIS
CCPR1H (Slave)
P1B
R
Comparator
Output
Controller
P1B
TRIS
P1C
P1C
TMR2
(1)
TRIS
S
P1D
Comparator
Clear Timer2,
toggle PWM pin and
latch duty cycle
PR2
Note
1:
P1D
TRIS
PWM1CON
The 8-bit timer TMR2 register is concatenated with the 2-bit internal Q clock, or 2 bits of the prescaler to create the 10-bit
time base.
Note 1: The TRIS register value for each PWM output must be configured appropriately.
2: Clearing the CCP1CON register will relinquish ECCP control of all PWM output pins.
3: Any pin not used by an Enhanced PWM mode is available for alternate pin functions
TABLE 11-4:
ECCP Mode
P1M
CCP1/P1A
P1B
P1C
P1D
Single
00
Half-Bridge
10
Yes
No
No
No
Yes
Yes
No
No
Full-Bridge, Forward
01
Yes
Yes
Yes
Yes
Full-Bridge, Reverse
11
Yes
Yes
Yes
Yes
DS41202F-page 85
PIC16F684
FIGURE 11-6:
P1M<1:0>
Signal
PR2+1
Pulse
Width
Period
00
(Single Output)
P1A Modulated
Delay(1)
Delay(1)
P1A Modulated
10
(Half-Bridge)
P1B Modulated
P1A Active
01
(Full-Bridge,
Forward)
P1B Inactive
P1C Inactive
P1D Modulated
P1A Inactive
11
(Full-Bridge,
Reverse)
P1B Modulated
P1C Active
P1D Inactive
Relationships:
Period = 4 * TOSC * (PR2 + 1) * (TMR2 Prescale Value)
Pulse Width = TOSC * (CCPR1L<7:0>:CCP1CON<5:4>) * (TMR2 Prescale Value)
Delay = 4 * TOSC * (PWM1CON<6:0>)
Note 1: Dead-band delay is programmed using the PWM1CON register (Section 11.4.6 Programmable Dead-Band Delay
mode).
DS41202F-page 86
PIC16F684
FIGURE 11-7:
P1M<1:0>
PR2+1
Pulse
Width
Period
00
(Single Output)
P1A Modulated
P1A Modulated
Delay(1)
10
(Half-Bridge)
Delay(1)
P1B Modulated
P1A Active
01
(Full-Bridge,
Forward)
P1B Inactive
P1C Inactive
P1D Modulated
P1A Inactive
11
(Full-Bridge,
Reverse)
P1B Modulated
P1C Active
P1D Inactive
Relationships:
Period = 4 * TOSC * (PR2 + 1) * (TMR2 Prescale Value)
Pulse Width = TOSC * (CCPR1L<7:0>:CCP1CON<5:4>) * (TMR2 Prescale Value)
Delay = 4 * TOSC * (PWM1CON<6:0>)
Note
1:
Dead-band delay is programmed using the PWM1CON register (Section 11.4.6 Programmable Dead-Band Delay
mode).
DS41202F-page 87
PIC16F684
11.4.1
HALF-BRIDGE MODE
FIGURE 11-8:
Period
Period
Pulse Width
P1A(2)
td
td
P1B(2)
(1)
(1)
(1)
td = Dead-Band Delay
Note 1:
2:
FIGURE 11-9:
EXAMPLE OF
HALF-BRIDGE PWM
OUTPUT
P1A
Load
FET
Driver
P1B
FET
Driver
FET
Driver
P1A
FET
Driver
Load
FET
Driver
P1B
DS41202F-page 88
PIC16F684
11.4.2
FULL-BRIDGE MODE
FIGURE 11-10:
FET
Driver
QC
QA
FET
Driver
P1A
Load
P1B
FET
Driver
P1C
FET
Driver
QD
QB
VP1D
DS41202F-page 89
PIC16F684
FIGURE 11-11:
Forward Mode
Period
P1A
(2)
Pulse Width
P1B(2)
P1C(2)
P1D(2)
(1)
(1)
Reverse Mode
Period
Pulse Width
P1A(2)
P1B(2)
P1C(2)
P1D(2)
(1)
Note 1:
2:
(1)
DS41202F-page 90
PIC16F684
11.4.2.1
FIGURE 11-12:
Signal
Period
P1A (Active-High)
P1B (Active-High)
Pulse Width
P1C (Active-High)
(2)
P1D (Active-High)
Pulse Width
Note 1:
2:
The direction bit P1M1 of the CCP1CON register is written any time during the PWM cycle.
When changing directions, the P1A and P1C signals switch before the end of the current PWM cycle. The
modulated P1B and P1D signals are inactive at this time. The length of this time is four Timer2 counts.
DS41202F-page 91
PIC16F684
FIGURE 11-13:
t1
Reverse Period
P1A
P1B
DC
P1C
P1D
PW
TON
External Switch C
TOFF
External Switch D
Potential
Shoot-Through Current
Note 1:
11.4.3
T = TOFF TON
2:
3:
TOFF is the turn off delay of power switch QD and its driver.
START-UP CONSIDERATIONS
DS41202F-page 92
PIC16F684
11.4.4
ENHANCED PWM
AUTO-SHUTDOWN MODE
REGISTER 11-2:
U-0
U-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
ECCPASE
ECCPAS2
ECCPAS1
ECCPAS0
PSSAC1
PSSAC0
PSSBD1
PSSBD0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6-4
bit 3-2
bit 1-0
DS41202F-page 93
PIC16F684
Note 1: The auto-shutdown condition is a
level-based signal, not an edge-based
signal. As long as the level is present, the
auto-shutdown will persist.
2: Writing to the ECCPASE bit is disabled
while an auto-shutdown condition
persists.
3: Once the auto-shutdown condition has
been removed and the PWM restarted
(either through firmware or auto-restart)
the PWM signal will always restart at the
beginning of the next PWM period.
FIGURE 11-14:
Shutdown Event
ECCPASE bit
PWM Activity
Normal PWM
ECCPASE
Cleared by
Shutdown
Shutdown Firmware PWM
Event Occurs Event Clears
Resumes
Start of
PWM Period
11.4.5
AUTO-RESTART MODE
The Enhanced PWM can be configured to automatically restart the PWM signal once the auto-shutdown
condition has been removed. Auto-restart is enabled by
setting the PRSEN bit in the PWM1CON register.
If auto-restart is enabled, the ECCPASE bit will remain
set as long as the auto-shutdown condition is active.
When the auto-shutdown condition is removed, the
ECCPASE bit will be cleared via hardware and normal
operation will resume.
FIGURE 11-15:
Shutdown Event
ECCPASE bit
PWM Activity
Normal PWM
Start of
PWM Period
DS41202F-page 94
Shutdown
Shutdown
Event Occurs Event Clears
PWM
Resumes
PIC16F684
11.4.6
PROGRAMMABLE DEAD-BAND
DELAY MODE
FIGURE 11-16:
FIGURE 11-17:
EXAMPLE OF
HALF-BRIDGE PWM
OUTPUT
Period
Period
Pulse Width
P1A(2)
td
td
P1B(2)
(1)
(1)
(1)
td = Dead-Band Delay
Note 1:
2:
+
V
-
P1A
Load
FET
Driver
+
V
-
P1B
V-
DS41202F-page 95
PIC16F684
REGISTER 11-3:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
PRSEN
PDC6
PDC5
PDC4
PDC3
PDC2
PDC1
PDC0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6-0
Note 1:
Bit resets to 0 with Two-Speed Start-up and LP, XT or HS selected as the Oscillator mode or Fail-Safe
mode is enabled.
TABLE 11-5:
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
Value on
all other
Resets
CCPR1L
CCPR1H
CCP1CON
P1M1
P1M0
DC1B1
DC1B0
CCP1M3
CMCON0
C2OUT
C1OUT
C2INV
C1INV
CIS
CM2
CM1
CMCON1
T1GSS
PSSAC1
PSSAC0
PSSBD1
ECCPAS
INTCON
GIE
PEIE
T0IE
INTE
RAIE
T0IF
INTF
RAIF
PIE1
EEIE
ADIE
CCP1IE
C2IE
C1IE
OSFIE
TMR2IE
TMR1IE
PIR1
EEIF
ADIF
CCP1IF
C2IF
C1IF
OSFIF
TMR2IF
TMR1IF
PDC4
PDC3
PDC2
PDC1
PDC0
PR2
PWM1CON
PRSEN
T1CON
T1GINV
T2CON
PDC6
PDC5
TOUTPS3 TOUTPS2 TOUTPS1 TOUTPS0 TMR2ON T2CKPS1 T2CKPS0 -000 0000 -000 0000
TMR1L
Holding Register for the Least Significant Byte of the 16-bit TMR1 Register
TMR1H
Holding Register for the Most Significant Byte of the 16-bit TMR1 Register
TMR2
TRISA
TRISA5
TRISA4
TRISA3
TRISA2
TRISA1
TRISA0
TRISC
TRISC5
TRISC4
TRISC3
TRISC2
TRISC1
TRISC0
Legend: - = Unimplemented locations, read as 0, u = unchanged, x = unknown. Shaded cells are not used by the Capture,
Compare and PWM.
DS41202F-page 96
PIC16F684
12.0
12.1
Configuration Bits
DS41202F-page 97
PIC16F684
REGISTER 12-1:
FCMEN
IESO
BOREN1
BOREN0
bit 15
bit 8
CPD
CP
MCLRE
PWRTE
WDTE
FOSC2
FOSC1
FOSC0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
P = Programmable
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 15-12
Unimplemented: Read as 1
bit 11
bit 10
bit 9-8
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2-0
Note 1:
2:
3:
4:
DS41202F-page 98
PIC16F684
12.2
Calibration Bits
12.3
Reset
FIGURE 12-1:
Power-on Reset
MCLR Reset
MCLR Reset during Sleep
WDT Reset
Brown-out Reset (BOR)
MCLR/VPP pin
SLEEP
WDT
Module
WDT
Time-out
Reset
VDD Rise
Detect
Power-on Reset
VDD
Brown-out(1)
Reset
BOREN
SBOREN
OST/PWRT
OST
Chip_Reset
OSC1/
CLKI pin
PWRT
LFINTOSC
Enable PWRT
Enable OST
Note 1:
DS41202F-page 99
PIC16F684
12.3.1
MCLR
DS41202F-page 100
RECOMMENDED MCLR
CIRCUIT
VDD
R1
1 k (or greater)
PIC
MCU
R2
MCLR
SW1
(optional)
100
(needed with capacitor)
C1
0.1 F
(optional, not critical)
12.3.2
FIGURE 12-2:
12.3.3
Note:
(Section 15.0
PIC16F684
12.3.4
12.3.5
Note:
BOR CALIBRATION
Address 2008h is beyond the user program memory space. It belongs to the
special configuration memory space
(2000h-3FFFh), which can be accessed
only
during
programming.
See
PIC12F6XX/16F6XX Memory Programming Specification (DS41204) for more
information.
FIGURE 12-3:
BROWN-OUT SITUATIONS
VDD
Internal
Reset
VBOR
64 ms(1)
VDD
Internal
Reset
VBOR
< 64 ms
64 ms(1)
VDD
Internal
Reset
Note 1:
VBOR
64 ms(1)
DS41202F-page 101
PIC16F684
12.3.6
TIME-OUT SEQUENCE
12.3.7
TABLE 12-1:
Brown-out Reset
PWRTE = 0
PWRTE = 1
PWRTE = 0
PWRTE = 1
Wake-up from
Sleep
TPWRT + 1024
TOSC
1024 TOSC
TPWRT + 1024
TOSC
1024 TOSC
1024 TOSC
TPWRT
TPWRT
Oscillator Configuration
XT, HS, LP
RC, EC, INTOSC
TABLE 12-2:
POR
BOR
TO
PD
Condition
Power-on Reset
Brown-out Reset
WDT Reset
WDT Wake-up
TABLE 12-3:
Name
PCON
STATUS
Bit 7
Value on
all other
Resets(1)
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
SBOREN
POR
BOR
TO
PD
DC
Bit 6
Bit 5
Bit 4
ULPWUE
IRP
RP1
RP0
DS41202F-page 102
PIC16F684
FIGURE 12-4:
VDD
MCLR
Internal POR
TPWRT
PWRT Time-out
TOST
OST Time-out
Internal Reset
FIGURE 12-5:
VDD
MCLR
Internal POR
TPWRT
PWRT Time-out
TOST
OST Time-out
Internal Reset
FIGURE 12-6:
MCLR
Internal POR
TPWRT
PWRT Time-out
TOST
OST Time-out
Internal Reset
DS41202F-page 103
PIC16F684
TABLE 12-4:
Register
Address
Power-on
Reset
W
INDF
TMR0
MCLR Reset
WDT Reset
Brown-out Reset(1)
xxxx xxxx
uuuu uuuu
uuuu uuuu
00h/80h
xxxx xxxx
xxxx xxxx
uuuu uuuu
01h
xxxx xxxx
uuuu uuuu
uuuu uuuu
PCL
02h/82h
0000 0000
0000 0000
PC + 1(3)
STATUS
03h/83h
0001 1xxx
000q quuu(4)
uuuq quuu(4)
FSR
04h/84h
xxxx xxxx
uuuu uuuu
uuuu uuuu
(6)
PORTA
05h
--x0 x000
--u0 u000
--uu uuuu
PORTC(6)
07h
--xx 0000
--uu 0000
--uu uuuu
PCLATH
0Ah/8Ah
---0 0000
---0 0000
---u uuuu
INTCON
0Bh/8Bh
0000 0000
0000 0000
uuuu uuuu(2)
PIR1
0Ch
0000 0000
0000 0000
uuuu uuuu(2)
TMR1L
0Eh
xxxx xxxx
uuuu uuuu
uuuu uuuu
TMR1H
0Fh
xxxx xxxx
uuuu uuuu
uuuu uuuu
T1CON
10h
0000 0000
uuuu uuuu
-uuu uuuu
TMR2
11h
0000 0000
0000 0000
uuuu uuuu
T2CON
12h
-000 0000
-000 0000
-uuu uuuu
CCPR1L
13h
xxxx xxxx
uuuu uuuu
uuuu uuuu
CCPR1H
14h
xxxx xxxx
uuuu uuuu
uuuu uuuu
CCP1CON
15h
0000 0000
0000 0000
uuuu uuuu
PWM1CON
16h
0000 0000
0000 0000
uuuu uuuu
ECCPAS
17h
0000 0000
0000 0000
uuuu uuuu
WDTCON
18h
---0 1000
---0 1000
---u uuuu
CMCON0
19h
0000 0000
0000 0000
uuuu uuuu
CMCON1
1Ah
---- --10
---- --10
---- --uu
ADRESH
1Eh
xxxx xxxx
uuuu uuuu
uuuu uuuu
ADCON0
1Fh
00-0 0000
00-0 0000
uu-u uuuu
OPTION_REG
81h
1111 1111
1111 1111
uuuu uuuu
TRISA
85h
--11 1111
--11 1111
--uu uuuu
TRISC
87h
--11 1111
--11 1111
--uu uuuu
PIE1
8Ch
0000 0000
0000 0000
uuuu uuuu
(1, 5)
PCON
8Eh
--01 --0x
--0u --uq
--uu --uu
OSCCON
8Fh
-110 x000
-110 q000
-uuu uuuu
Legend:
Note 1:
2:
3:
4:
5:
6:
DS41202F-page 104
PIC16F684
TABLE 12-4:
Address
Power-on
Reset
OSCTUNE
90h
---0 0000
---u uuuu
---u uuuu
ANSEL
91h
1111 1111
1111 1111
uuuu uuuu
PR2
92h
1111 1111
1111 1111
1111 1111
WPUA
95h
--11 -111
--11 -111
uuuu uuuu
IOCA
96h
--00 0000
--00 0000
--uu uuuu
VRCON
99h
0-0- 0000
0-0- 0000
u-u- uuuu
EEDAT
9Ah
0000 0000
0000 0000
uuuu uuuu
EEADR
9Bh
0000 0000
0000 0000
uuuu uuuu
EECON1
9Ch
---- x000
---- q000
---- uuuu
EECON2
9Dh
---- ----
---- ----
---- ----
ADRESL
9Eh
xxxx xxxx
uuuu uuuu
uuuu uuuu
ADCON1
9Fh
-000 ----
-000 ----
-uuu ----
Register
Legend:
Note 1:
2:
3:
4:
5:
6:
TABLE 12-5:
Status
Register
PCON
Register
Power-on Reset
000h
0001 1xxx
--01 --0x
000h
000u uuuu
--0u --uu
000h
0001 0uuu
--0u --uu
000h
0000 uuuu
--0u --uu
PC + 1
uuu0 0uuu
--uu --uu
Condition
WDT Reset
WDT Wake-up
Brown-out Reset
Interrupt Wake-up from Sleep
000h
0001 1uuu
--01 --u0
PC + 1(1)
uuu1 0uuu
--uu --uu
DS41202F-page 105
PIC16F684
12.4
Interrupts
12.4.1
RA2/INT INTERRUPT
DS41202F-page 106
PIC16F684
12.4.2
TIMER0 INTERRUPT
12.4.3
FIGURE 12-7:
PORTA INTERRUPT-ON-CHANGE
INTERRUPT LOGIC
IOC-RA0
IOCA0
IOC-RA1
IOCA1
IOC-RA2
IOCA2
IOC-RA3
IOCA3
IOC-RA4
IOCA4
IOC-RA5
IOCA5
T0IF
T0IE
TMR2IF
TMR2IE
INTF
INTE
RAIF
RAIE
TMR1IF
TMR1IE
C1IF
C1IE
Interrupt to CPU
PEIE
GIE
C2IF
C2IE
ADIF
ADIE
EEIF
EEIE
OSFIF
OSFIE
CCP1IF
CCP1IE
Note 1:
DS41202F-page 107
PIC16F684
FIGURE 12-8:
Q3
Q4 Q1 Q2
Q3 Q4
Q1
Q2
Q3
Q4
Q1
Q2
Q3 Q4
Q1
Q2
Q3
Q4
OSC1
CLKOUT (3)
(4)
INT pin
(1)
(1)
INTF flag
(INTCON reg.)
(5)
GIE bit
(INTCON reg.)
INSTRUCTION FLOW
PC
Instruction
Fetched
Inst (PC + 1)
Dummy Cycle
Inst (PC)
Inst (PC 1)
0004h
PC + 1
PC + 1
Inst (PC)
Instruction
Executed
Note 1:
PC
0005h
Inst (0004h)
Inst (0005h)
Dummy Cycle
Inst (0004h)
2:
Asynchronous interrupt latency = 3-4 TCY. Synchronous latency = 3 TCY, where TCY = instruction cycle time. Latency
is the same whether Inst (PC) is a single cycle or a 2-cycle instruction.
3:
4:
For minimum width of INT pulse, refer to AC specifications in Section 15.0 Electrical Specifications.
5:
TABLE 12-6:
Bit 3
Bit 2
Bit 1
Bit 0
Value on
all other
Resets
Bit 7
Bit 6
INTCON
GIE
PEIE
T0IE
INTE
RAIE
T0IF
INTF
RAIF
IOCA5
IOCA4
IOCA3
IOCA2
IOCA1
IOCA0
IOCA
Bit 5
Value on:
POR, BOR
Name
PIR1
EEIF
ADIF
CCP1IF
C2IF
C1IF
OSFIF
TMR2IF
PIE1
EEIE
ADIE
CCP1IE
C2IE
C1IE
OSFIE
TMR2IE
DS41202F-page 108
PIC16F684
12.5
EXAMPLE 12-1:
MOVWF
SWAPF
W_TEMP
STATUS,W
MOVWF
STATUS_TEMP
:
:(ISR)
:
SWAPF
STATUS_TEMP,W
MOVWF
SWAPF
SWAPF
STATUS
W_TEMP,F
W_TEMP,W
;Copy W to TEMP
;Swap status to
;Swaps are used
;Save status to
register
be saved into W
because they do not affect the status bits
bank zero STATUS_TEMP register
DS41202F-page 109
PIC16F684
12.6
12.6.2
12.6.1
WDT OSCILLATOR
WDT CONTROL
FIGURE 12-9:
0
Prescaler(1)
1
8
PSA
31 kHz
LFINTOSC Clock
PS<2:0>
WDTPS<3:0>
To Timer0
0
1
PSA
Note 1:
TABLE 12-7:
This is the shared Timer0/WDT prescaler. See Section 5.0 Timer0 Module for more information.
WDT STATUS
Conditions
WDT
WDTE = 0
CLRWDT Command
Oscillator Fail Detected
Cleared
DS41202F-page 110
PIC16F684
REGISTER 12-2:
U-0
U-0
U-0
R/W-0
R/W-1
R/W-0
R/W-0
R/W-0
WDTPS3
WDTPS2
WDTPS1
WDTPS0
SWDTEN
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7-5
Unimplemented: Read as 0
bit 4-1
bit 0
Note 1:
If WDTE Configuration bit = 1, then WDT is always enabled, irrespective of this control bit. If WDTE
Configuration bit = 0, then it is possible to turn WDT on/off with this control bit.
TABLE 12-8:
Name
WDTCON
Legend:
Note 1:
OPTION_REG
CONFIG
x = Bit is unknown
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
Value on
all other
Resets
---0 1000
---0 1000
RAPU
INTEDG
T0CS
T0SE
PSA
PS2
PS1
PS0
1111 1111
1111 1111
CPD
CP
MCLRE
PWRTE
WDTE
FOSC2
FOSC1
FOSC0
DS41202F-page 111
PIC16F684
12.7
12.7.1
The first event will cause a device Reset. The two latter
events are considered a continuation of program
execution. The TO and PD bits in the STATUS register
can be used to determine the cause of a device Reset.
The PD bit, which is set on power-up, is cleared when
Sleep is invoked. TO bit is cleared if WDT wake-up
occurred.
The following peripheral interrupts can wake the device
from Sleep:
1.
2.
3.
4.
5.
6.
7.
12.7.2
DS41202F-page 112
PIC16F684
FIGURE 12-10:
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
OSC1
TOST(2)
CLKOUT(4)
INT pin
INTF flag
(INTCON reg.)
GIE bit
(INTCON reg.)
Instruction Flow
PC
Instruction
Fetched
Instruction
Executed
Note
12.8
Processor in
Sleep
PC
Inst(PC) = Sleep
Inst(PC 1)
PC + 1
PC + 2
PC + 2
Inst(PC + 1)
Inst(PC + 2)
Sleep
Inst(PC + 1)
PC + 2
Dummy Cycle
0004h
0005h
Inst(0004h)
Inst(0005h)
Dummy Cycle
Inst(0004h)
1:
2:
TOST = 1024 TOSC (drawing not to scale). This delay does not apply to EC, INTOSC and RC Oscillator modes.
3:
GIE = 1 assumed. In this case after wake-up, the processor jumps to 0004h. If GIE = 0, execution will continue in-line.
4:
CLKOUT is not available in XT, HS, LP or EC Oscillator modes, but shown here for timing reference.
Code Protection
12.9
The entire data EEPROM and Flash program memory will be erased when the
code protection is turned off. See the
PIC12F6XX/16F6XX Memory
Programming Specification (DS41204)
for more information.
ID Locations
DS41202F-page 113
PIC16F684
12.10 In-Circuit Serial Programming
clock
data
power
ground
programming voltage
FIGURE 12-11:
TYPICAL IN-CIRCUIT
SERIAL PROGRAMMING
CONNECTION
To Normal
Connections
External
Connector
Signals
VDD
VSS
0V
VPP
MCLR/VPP/RA3
CLK
RA1
Data I/O
RA0
TABLE 12-9:
DEBUGGER RESOURCES
Resource
Description
I/O pins
ICDCLK, ICDDATA
Stack
1 level
Program Memory
FIGURE 12-12:
PIC16F684
+5V
20-Pin PDIP
In-Circuit Debug Device
NC
20
ICDMCLR/VPP
VDD
RA5
RA4
RA3
RC5
RC4
RC3
ICD
19
3
4
5
6
7
8
9
10
PIC16F684-ICD
18
17
16
15
14
13
12
11
ICDCLK
ICDDATA
Vss
RA0
RA1
RA2
RC0
RC1
RC2
NC
To Normal
Connections
* Isolation devices (as required)
DS41202F-page 114
PIC16F684
13.0
TABLE 13-1:
Field
Description
Register file address (0x00 to 0x7F)
f
W
OPCODE FIELD
DESCRIPTIONS
PC
Program Counter
TO
Time-out bit
Carry bit
C
DC
Z
PD
Power-down bit
FIGURE 13-1:
d = 0 for destination W
d = 1 for destination f
f = 7-bit file register address
Bit-oriented file register operations
13
10 9
7 6
OPCODE
b (BIT #)
f (FILE #)
13.1
Read-Modify-Write Operations
13
OPCODE
0
k (literal)
11
OPCODE
10
0
k (literal)
DS41202F-page 115
PIC16F684
TABLE 13-2:
Mnemonic,
Operands
14-Bit Opcode
Description
Cycles
MSb
LSb
Status
Affected
Notes
f, d
f, d
f
f, d
f, d
f, d
f, d
f, d
f, d
f, d
f
f, d
f, d
f, d
f, d
f, d
Add W and f
AND W with f
Clear f
Clear W
Complement f
Decrement f
Decrement f, Skip if 0
Increment f
Increment f, Skip if 0
Inclusive OR W with f
Move f
Move W to f
No Operation
Rotate Left f through Carry
Rotate Right f through Carry
Subtract W from f
Swap nibbles in f
Exclusive OR W with f
BCF
BSF
BTFSC
BTFSS
f, b
f, b
f, b
f, b
Bit Clear f
Bit Set f
Bit Test f, Skip if Clear
Bit Test f, Skip if Set
1
1
1
1
1
1
1(2)
1
1(2)
1
1
1
1
1
1
1
1
1
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
dfff
dfff
lfff
0xxx
dfff
dfff
dfff
dfff
dfff
dfff
dfff
lfff
0xx0
dfff
dfff
dfff
dfff
dfff
ffff
ffff
ffff
xxxx
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
0000
ffff
ffff
ffff
ffff
ffff
00bb
01bb
10bb
11bb
bfff
bfff
bfff
bfff
ffff
ffff
ffff
ffff
111x
1001
0kkk
0000
1kkk
1000
00xx
0000
01xx
0000
0000
110x
1010
kkkk
kkkk
kkkk
0110
kkkk
kkkk
kkkk
0000
kkkk
0000
0110
kkkk
kkkk
kkkk
kkkk
kkkk
0100
kkkk
kkkk
kkkk
1001
kkkk
1000
0011
kkkk
kkkk
0111
0101
0001
0001
1001
0011
1011
1010
1111
0100
1000
0000
0000
1101
1100
0010
1110
0110
C, DC, Z
Z
Z
Z
Z
Z
Z
Z
Z
C
C
C, DC, Z
Z
1, 2
1, 2
2
1, 2
1, 2
1, 2, 3
1, 2
1, 2, 3
1, 2
1, 2
1, 2
1, 2
1, 2
1, 2
1, 2
01
01
01
01
1, 2
1, 2
3
3
2:
3:
k
k
k
k
k
k
k
k
1
1
2
1
2
1
1
2
2
2
1
1
1
11
11
10
00
10
11
11
00
11
00
00
11
11
C, DC, Z
Z
TO, PD
Z
TO, PD
C, DC, Z
Z
When an I/O register is modified as a function of itself (e.g., MOVF GPIO, 1), the value used will be that value present
on the pins themselves. For example, if the data latch is 1 for a pin configured as input and is driven low by an external
device, the data will be written back with a 0.
If this instruction is executed on the TMR0 register (and where applicable, d = 1), the prescaler will be cleared if
assigned to the Timer0 module.
If the Program Counter (PC) is modified, or a conditional test is true, the instruction requires two cycles. The second
cycle is executed as a NOP.
DS41202F-page 116
PIC16F684
13.2
Instruction Descriptions
ADDLW
Syntax:
[ label ] ADDLW
Operands:
0 k 255
Operation:
(W) + k (W)
Status Affected:
C, DC, Z
Description:
BCF
Bit Clear f
Syntax:
[ label ] BCF
Operands:
0 f 127
0b7
Operation:
0 (f<b>)
Status Affected:
None
Description:
BSF
Bit Set f
Syntax:
[ label ] BSF
f,b
ADDWF
Add W and f
Syntax:
[ label ] ADDWF
Operands:
0 f 127
d [0,1]
Operands:
0 f 127
0b7
Operation:
Operation:
1 (f<b>)
Status Affected:
C, DC, Z
Status Affected:
None
Description:
Description:
ANDLW
BTFSC
Syntax:
[ label ] ANDLW
Syntax:
Operands:
0 k 255
Operands:
Operation:
0 f 127
0b7
Status Affected:
Operation:
skip if (f<b>) = 0
Description:
Status Affected:
None
Description:
ANDWF
f,d
AND W with f
Syntax:
[ label ] ANDWF
Operands:
0 f 127
d [0,1]
Operation:
f,d
Status Affected:
Description:
f,b
DS41202F-page 117
PIC16F684
BTFSS
CLRWDT
Syntax:
Syntax:
[ label ] CLRWDT
Operands:
0 f 127
0b<7
Operands:
None
Operation:
00h WDT
0 WDT prescaler,
1 TO
1 PD
Status Affected:
TO, PD
Description:
Operation:
skip if (f<b>) = 1
Status Affected:
None
Description:
CALL
Call Subroutine
COMF
Complement f
Syntax:
[ label ] CALL k
Syntax:
[ label ] COMF
Operands:
0 k 2047
Operands:
Operation:
(PC)+ 1 TOS,
k PC<10:0>,
(PCLATH<4:3>) PC<12:11>
0 f 127
d [0,1]
Operation:
(f) (destination)
Status Affected:
Description:
DECF
Decrement f
Syntax:
f,d
Status Affected:
None
Description:
CLRF
Clear f
Syntax:
[ label ] CLRF
Operands:
0 f 127
Operands:
Operation:
00h (f)
1Z
0 f 127
d [0,1]
Operation:
(f) - 1 (destination)
Status Affected:
Status Affected:
Description:
Description:
Decrement register f. If d is 0,
the result is stored in the W
register. If d is 1, the result is
stored back in register f.
CLRW
Clear W
Syntax:
[ label ] CLRW
Operands:
None
Operation:
00h (W)
1Z
Status Affected:
Description:
DS41202F-page 118
PIC16F684
DECFSZ
Decrement f, Skip if 0
INCFSZ
Increment f, Skip if 0
Syntax:
Syntax:
[ label ]
Operands:
0 f 127
d [0,1]
Operands:
0 f 127
d [0,1]
Operation:
(f) - 1 (destination);
skip if result = 0
Operation:
(f) + 1 (destination),
skip if result = 0
Status Affected:
None
Status Affected:
None
Description:
Description:
GOTO
Unconditional Branch
IORLW
Syntax:
[ label ]
Syntax:
[ label ]
Operands:
0 k 2047
Operands:
0 k 255
Operation:
k PC<10:0>
PCLATH<4:3> PC<12:11>
Operation:
Status Affected:
Status Affected:
None
Description:
Description:
INCF
Increment f
IORWF
Inclusive OR W with f
Syntax:
[ label ]
Syntax:
[ label ]
Operands:
0 f 127
d [0,1]
Operands:
0 f 127
d [0,1]
Operation:
(f) + 1 (destination)
Operation:
Status Affected:
Status Affected:
Description:
Description:
GOTO k
INCF f,d
INCFSZ f,d
IORWF
f,d
DS41202F-page 119
PIC16F684
MOVF
Move f
Syntax:
[ label ]
Operands:
0 f 127
d [0,1]
MOVF f,d
MOVWF
Move W to f
Syntax:
[ label ]
MOVWF
Operands:
0 f 127
Operation:
(W) (f)
Operation:
(f) (dest)
Status Affected:
None
Status Affected:
Description:
Description:
Words:
Cycles:
Words:
Cycles:
Example:
MOVF
Example:
MOVW
F
OPTION
Before Instruction
OPTION =
W
=
After Instruction
OPTION =
W
=
FSR, 0
0xFF
0x4F
0x4F
0x4F
After Instruction
W =
value in FSR
register
Z = 1
MOVLW
Move literal to W
NOP
No Operation
Syntax:
[ label ]
Syntax:
[ label ]
Operands:
0 k 255
Operands:
None
Operation:
k (W)
Operation:
No operation
Status Affected:
None
Status Affected:
None
Description:
Description:
No operation.
Words:
Cycles:
Words:
Cycles:
Example:
MOVLW k
Example:
MOVLW
NOP
0x5A
After Instruction
W =
DS41202F-page 120
NOP
0x5A
PIC16F684
RETFIE
RETLW
Syntax:
[ label ]
Syntax:
[ label ]
Operands:
None
Operands:
0 k 255
Operation:
TOS PC,
1 GIE
Operation:
k (W);
TOS PC
Status Affected:
None
Status Affected:
None
Description:
Description:
Words:
Cycles:
Example:
RETFIE
Words:
Cycles:
Example:
RETFIE
After Interrupt
PC =
GIE =
TABLE
TOS
1
RETLW k
ADDWF PC ;W = offset
RETLW k1 ;Begin table
RETLW k2 ;
Before Instruction
W = 0x07
After Instruction
W = value of k8
RETURN
Syntax:
[ label ]
Operands:
None
Operation:
TOS PC
Status Affected:
None
Description:
RETURN
DS41202F-page 121
PIC16F684
RLF
SLEEP
Syntax:
[ label ]
Syntax:
[ label ] SLEEP
Operands:
0 f 127
d [0,1]
Operands:
None
Operation:
Operation:
Status Affected:
Description:
00h WDT,
0 WDT prescaler,
1 TO,
0 PD
RLF
f,d
Words:
Cycles:
Example:
Status Affected:
TO, PD
Description:
Register f
RLF
REG1,0
Before Instruction
REG1
C
=
=
1110 0110
0
=
=
=
1110 0110
1100 1100
1
After Instruction
REG1
W
C
RRF
SUBLW
Syntax:
[ label ]
Syntax:
[ label ] SUBLW k
Operands:
0 f 127
d [0,1]
Operands:
0 k 255
Operation:
k - (W) (W)
Operation:
Status Affected:
Description:
Description:
RRF f,d
DS41202F-page 122
Register f
W>k
C=1
Wk
DC = 0
DC = 1
W<3:0> k<3:0>
PIC16F684
SUBWF
Subtract W from f
XORLW
Syntax:
Syntax:
[ label ] XORLW k
Operands:
0 f 127
d [0,1]
Operands:
0 k 255
Operation:
Operation:
Status Affected:
Description:
SWAPF
W>f
C=1
Wf
DC = 0
DC = 1
W<3:0> f<3:0>
Swap Nibbles in f
XORWF
Exclusive OR W with f
Syntax:
Syntax:
[ label ] XORWF
Operands:
0 f 127
d [0,1]
Operands:
0 f 127
d [0,1]
Operation:
(f<3:0>) (destination<7:4>),
(f<7:4>) (destination<3:0>)
Operation:
Status Affected:
Status Affected:
None
Description:
Description:
f,d
DS41202F-page 123
PIC16F684
NOTES:
DS41202F-page 124
PIC16F684
14.0
DEVELOPMENT SUPPORT
14.1
DS41202F-page 125
PIC16F684
14.2
MPASM Assembler
14.5
14.6
14.3
14.4
DS41202F-page 126
PIC16F684
14.7
14.8
14.9
DS41202F-page 127
PIC16F684
14.11 PICSTART Plus Development
Programmer
DS41202F-page 128
PIC16F684
15.0
ELECTRICAL SPECIFICATIONS
Power dissipation is calculated as follows: PDIS = VDD x {IDD IOH} + {(VDD VOH) x IOH} + (VOl x IOL).
NOTICE: Stresses above those listed under Absolute Maximum Ratings may cause permanent damage to the
device. This is a stress rating only and functional operation of the device at those or any other conditions above those
indicated in the operation listings of this specification is not implied. Exposure above maximum rating conditions for
extended periods may affect device reliability.
DS41202F-page 129
PIC16F684
FIGURE 15-1:
5.5
5.0
VDD (V)
4.5
4.0
3.5
3.0
2.5
2.0
0
10
20
Frequency (MHz)
Note 1: The shaded region indicates the permissible combinations of voltage and frequency.
FIGURE 15-2:
125
5%
Temperature (C)
85
2%
60
1%
25
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
DS41202F-page 130
PIC16F684
15.1
DC CHARACTERISTICS
Param
No.
Sym
Characteristic
Unit
s
Conditions
VDD
Supply Voltage
2.0
2.0
3.0
4.5
5.5
5.5
5.5
5.5
V
V
V
V
D002*
VDR
1.5
D003
VPOR
VSS
D004*
SVDD
0.05
D001
D001C
D001D
DS41202F-page 131
PIC16F684
15.2
DC CHARACTERISTICS
Param
No.
D010
Conditions
Device Characteristics
Min
Typ
Max
Units
VDD
D011*
D012
D013*
D014
D015
D016*
D017
D018
D019
(1, 2)
11
16
2.0
18
28
3.0
35
54
5.0
140
240
2.0
220
380
3.0
380
550
5.0
260
360
2.0
420
650
3.0
0.8
1.1
mA
5.0
130
220
2.0
215
360
3.0
360
520
5.0
220
340
2.0
375
550
3.0
0.65
1.0
mA
5.0
20
2.0
16
40
3.0
31
65
5.0
340
450
2.0
500
700
3.0
0.8
1.2
mA
5.0
410
650
2.0
700
950
3.0
1.30
1.65
mA
5.0
230
400
2.0
400
680
3.0
0.63
1.1
mA
5.0
2.6
3.25
mA
4.5
2.8
3.35
mA
5.0
Note
FOSC = 32 kHz
LP Oscillator mode
FOSC = 1 MHz
XT Oscillator mode
FOSC = 4 MHz
XT Oscillator mode
FOSC = 1 MHz
EC Oscillator mode
FOSC = 4 MHz
EC Oscillator mode
FOSC = 31 kHz
LFINTOSC mode
FOSC = 4 MHz
HFINTOSC mode
FOSC = 8 MHz
HFINTOSC mode
FOSC = 4 MHz
EXTRC mode(3)
FOSC = 20 MHz
HS Oscillator mode
DS41202F-page 132
PIC16F684
15.3
DC CHARACTERISTICS
Param
No.
D020
Device Characteristics
Power-down Base
Current(IPD)(2)
D021
D022
D023
D024
D025*
D026
D027
Min
Typ
Max
Units
VDD
Note
WDT, BOR, Comparators, VREF and
T1OSC disabled
0.05
1.2
2.0
0.15
1.5
3.0
0.35
1.8
5.0
150
500
nA
3.0
-40C TA +25C
1.0
2.2
2.0
WDT Current(1)
2.0
4.0
3.0
3.0
7.0
5.0
42
60
3.0
85
122
5.0
32
45
2.0
60
78
3.0
120
160
5.0
30
36
2.0
45
55
3.0
75
95
5.0
39
47
2.0
59
72
3.0
98
124
5.0
4.5
7.0
2.0
5.0
8.0
3.0
6.0
12
5.0
0.30
1.6
3.0
0.36
1.9
5.0
BOR Current(1)
Comparator Current(1), both
comparators enabled
CVREF Current(1) (high range)
DS41202F-page 133
PIC16F684
15.4
DC CHARACTERISTICS
Param
No.
D020E
Device Characteristics
Power-down Base
Current (IPD)(2)
D021E
D022E
D023E
D024E
D025E*
D026E
D027E
Min
Typ
0.05
Max
9
Units
A
VDD
Note
2.0
0.15
11
3.0
0.35
15
5.0
17.5
2.0
19
3.0
22
5.0
42
65
3.0
85
127
5.0
32
45
2.0
60
78
3.0
120
160
5.0
30
70
2.0
45
90
3.0
75
120
5.0
39
91
2.0
59
117
3.0
98
156
5.0
4.5
25
2.0
30
3.0
40
5.0
0.30
12
3.0
0.36
16
5.0
WDT Current(1)
BOR Current(1)
Comparator Current(1), both
comparators enabled
CVREF Current(1) (high range)
DS41202F-page 134
PIC16F684
15.5
DC Characteristics:
PIC16F684-I (Industrial)
PIC16F684-E (Extended)
Standard Operating Conditions (unless otherwise stated)
Operating temperature
-40C TA +85C for industrial
-40C TA +125C for extended
DC CHARACTERISTICS
Param
No.
Sym
VIL
Characteristic
Min
Typ
Max
Units
Vss
Vss
Conditions
0.8
0.15 VDD
Vss
0.2 VDD
D030
D030A
D031
D032
VSS
0.2 VDD
D033
VSS
0.3
VSS
0.3 VDD
D033A
VIH
D040
D040A
D041
2.0
VDD
VDD
0.8 VDD
VDD
0.8 VDD
VDD
1.6
VDD
D042
MCLR
D043
D043A
0.7 VDD
VDD
D043B
0.9 VDD
VDD
(Note 1)
(2)
IIL
D060
I/O ports
0.1
D061
MCLR(3)
0.1
D063
OSC1
0.1
IPUR
50
250
400
VOL
0.6
VDD 0.7
D070*
D080
I/O ports
VOH
D090
Note 1:
2:
3:
4:
5:
DS41202F-page 135
PIC16F684
15.5
DC Characteristics:
PIC16F684-I (Industrial)
PIC16F684-E (Extended) (Continued)
DC CHARACTERISTICS
Param
No.
Sym
D100
IULP
Characteristic
Typ
Max
Units
200
nA
OSC2 pin
15
pF
50
pF
Conditions
COSC2
D101A* CIO
D120
ED
Byte Endurance
100K
1M
E/W
D120A
ED
Byte Endurance
10K
100K
E/W
D121
VDRW
VMIN
5.5
D122
TDEW
D123
TRETD
Characteristic Retention
40
D124
TREF
1M
10M
E/W
-40C TA +85C
-40C TA +85C
+85C TA +125C
Using EECON1 to read/write
VMIN = Minimum operating
voltage
ms
EP
Cell Endurance
10K
100K
E/W
D130A
ED
Cell Endurance
1K
10K
E/W
D131
VPR
VMIN
5.5
D132
VPEW
4.5
5.5
D133
TPEW
2.5
ms
D134
TRETD
Characteristic Retention
40
Note 1:
2:
3:
4:
5:
+85C TA +125C
VMIN = Minimum operating
voltage
DS41202F-page 136
PIC16F684
15.6
Thermal Considerations
TH02
TH03
TH04
TH05
TH06
TH07
Note 1:
2:
3:
Sym
JA
Characteristic
Thermal Resistance
Junction to Ambient
Typ
Units
69.8
85.0
100.4
46.3
32.5
31.0
31.7
2.6
150
C/W
C/W
C/W
C/W
C/W
C/W
C/W
C/W
C
W
W
Conditions
W
PI/O = (IOL * VOL) + (IOH * (VDD - VOH))
PDER
Derated Power
W
PDER = (TJ - TA)/JA
(NOTE 2, 3)
IDD is current to run the chip alone without driving any load on the output pins.
TA = Ambient Temperature.
Maximum allowable power dissipation is the lower value of either the absolute maximum total power
dissipation or derated power (PDER).
DS41202F-page 137
PIC16F684
15.7
FIGURE 15-3:
Time
osc
rd
rw
sc
ss
t0
t1
wr
OSC1
RD
RD or WR
SCK
SS
T0CKI
T1CKI
WR
P
R
V
Z
Period
Rise
Valid
High-impedance
LOAD CONDITIONS
Load Condition
Pin
CL
VSS
Legend: CL =
DS41202F-page 138
50 pF
15 pF
PIC16F684
15.8
FIGURE 15-4:
CLOCK TIMING
Q4
Q1
Q2
Q3
Q4
Q1
OSC1/CLKIN
OS02
OS04
OS04
OS03
OSC2/CLKOUT
(LP,XT,HS Modes)
OSC2/CLKOUT
(CLKOUT Mode)
TABLE 15-1:
Sym
FOSC
Characteristic
External CLKIN Frequency(1)
Oscillator Frequency(1)
OS02
TOSC
Oscillator Period(1)
OS03
OS04*
TCY
TosH,
TosL
Min
Typ
Max
Units
DC
DC
DC
DC
0.1
1
DC
27
250
50
50
250
50
250
32.768
30.5
37
4
20
20
4
20
4
10,000
1,000
kHz
MHz
MHz
MHz
kHz
MHz
MHz
MHz
s
ns
ns
ns
s
ns
ns
ns
Conditions
LP Oscillator mode
XT Oscillator mode
HS Oscillator mode
EC Oscillator mode
LP Oscillator mode
XT Oscillator mode
HS Oscillator mode
RC Oscillator mode
LP Oscillator mode
XT Oscillator mode
HS Oscillator mode
EC Oscillator mode
LP Oscillator mode
XT Oscillator mode
HS Oscillator mode
RC Oscillator mode
200
TCY
DC
ns
TCY = 4/FOSC
2
s
LP oscillator
100
ns
XT oscillator
20
ns
HS oscillator
OS05* TosR, External CLKIN Rise,
0
ns
LP oscillator
TosF
External CLKIN Fall
0
ns
XT oscillator
0
ns
HS oscillator
* These parameters are characterized but not tested.
Data in Typ column is at 5V, 25C unless otherwise stated. These parameters are for design guidance only and
are not tested.
Note 1: Instruction cycle period (TCY) equals four times the input oscillator time base period. All specified values are
based on characterization data for that particular oscillator type under standard operating conditions with the
device executing code. Exceeding these specified limits may result in an unstable oscillator operation and/or
higher than expected current consumption. All devices are tested to operate at min values with an external clock
applied to OSC1 pin. When an external clock input is used, the max cycle time limit is DC (no clock) for all
devices.
DS41202F-page 139
PIC16F684
TABLE 15-2:
OSCILLATOR PARAMETERS
Sym
Characteristic
Freq
Tolerance
Min
Typ
Max
Units
Conditions
OS06
TWARM
TOSC
Slowest clock
OS07
TSC
21
ms
LFINTOSC/64
OS08
HFOSC
Internal Calibrated
HFINTOSC Frequency(2)
OS09*
OS10*
LFOSC
Internal Uncalibrated
LFINTOSC Frequency
TIOSC
HFINTOSC Oscillator
Wake-up from Sleep
Start-up Time
ST
1%
7.92
8.0
8.08
MHz
2%
7.84
8.0
8.16
MHz
5%
7.60
8.0
8.40
MHz
15
31
45
kHz
5.5
12
24
3.5
14
11
DS41202F-page 140
PIC16F684
FIGURE 15-5:
Cycle
Write
Fetch
Read
Execute
Q4
Q1
Q2
Q3
Fosc
OS12
OS11
OS20
OS21
CLKOUT
OS19
OS18
OS16
OS13
OS17
I/O pin
(Input)
OS14
OS15
I/O pin
(Output)
New Value
Old Value
OS18, OS19
TABLE 15-3:
Sym
Characteristic
TOSH2CKL
OS12
TOSH2CKH
FOSC to CLKOUT
(1)
OS13
TCKL2IOV
OS14
TIOV2CKH
OS15
TOSH2IOV
OS16
OS11
Min
Typ
Max
Units
Conditions
70
ns
VDD = 5.0V
VDD = 5.0V
72
ns
20
ns
TOSC + 200 ns
ns
50
70*
ns
VDD = 5.0V
TOSH2IOI
50
ns
VDD = 5.0V
OS17
TIOV2OSH
20
ns
OS18
TIOR
15
40
72
32
ns
VDD = 2.0V
VDD = 5.0V
OS19
TIOF
28
15
55
30
ns
VDD = 2.0V
VDD = 5.0V
OS20*
TINP
25
ns
OS21*
TRAP
TCY
ns
Note 1:
2:
DS41202F-page 141
PIC16F684
FIGURE 15-6:
VDD
MCLR
30
Internal
POR
33
PWRT
Time-out
32
OSC
Start-Up Time
Internal Reset(1)
Watchdog Timer
Reset(1)
31
34
34
I/O pins
Note 1:
Asserted low.
FIGURE 15-7:
VDD
VBOR + VHYST
VBOR
37
Reset
(due to BOR)
*
33*
DS41202F-page 142
PIC16F684
TABLE 15-4:
Sym
Characteristic
Min
Typ
Max
Units
Conditions
30
TMCL
2
5
s
s
31
TWDT
10
10
16
16
29
31
ms
ms
32
TOST
1024
33*
TPWRT
40
65
140
ms
34*
TIOZ
2.0
35
VBOR
2.0
2.2
36*
VHYST
50
mV
37*
TBOR
100
TOSC (NOTE 3)
(NOTE 4)
VDD VBOR
DS41202F-page 143
PIC16F684
FIGURE 15-8:
T0CKI
40
41
42
T1CKI
45
46
49
47
TMR0 or
TMR1
TABLE 15-5:
Sym
TT0H
Characteristic
T0CKI High Pulse Width
No Prescaler
With Prescaler
41*
TT0L
No Prescaler
42*
TT0P
T0CKI Period
45*
TT1H
With Prescaler
Asynchronous
46*
TT1L
T1CKI Low
Time
Synchronous, No Prescaler
Synchronous,
with Prescaler
Asynchronous
47*
TT1P
48
FT1
49*
Asynchronous
Min
Typ
Max
Units
0.5 TCY + 20
ns
10
ns
0.5 TCY + 20
ns
10
ns
Greater of:
20 or TCY + 40
N
ns
0.5 TCY + 20
ns
15
ns
30
ns
0.5 TCY + 20
ns
15
ns
30
ns
Greater of:
30 or TCY + 40
N
ns
60
ns
32.768
kHz
2 TOSC
7 TOSC
Conditions
N = prescale value
(2, 4, ..., 256)
N = prescale value
(1, 2, 4, 8)
Timers in Sync
mode
DS41202F-page 144
PIC16F684
FIGURE 15-9:
CCP1
(Capture mode)
CC01
CC02
CC03
Note:
TABLE 15-6:
Sym
TccL
TccH
TccP
Characteristic
CCP1 Input Low Time
CCP1 Input High Time
CCP1 Input Period
Min
Typ
Max
Units
No Prescaler
0.5TCY + 20
ns
With Prescaler
20
ns
No Prescaler
0.5TCY + 20
ns
With Prescaler
20
ns
3TCY + 40
N
ns
Conditions
N = prescale
value (1, 4 or
16)
DS41202F-page 145
PIC16F684
TABLE 15-7:
COMPARATOR SPECIFICATIONS
Sym
Characteristics
CM01
VOS
CM02
VCM
CM03* CMRR
CM04* TRT
Response Time
Min
Typ
Max
Units
5.0
10
mV
VDD 1.5
+55
dB
Falling
150
600
ns
Rising
200
1000
ns
10
Comments
(VDD - 1.5)/2
(NOTE 1)
TABLE 15-8:
Sym
Characteristics
Min
Typ
Max
Units
Comments
CV01*
CLSB
Step Size(2)
VDD/24
VDD/32
V
V
CV02*
CACC
Absolute Accuracy
1/2
1/2
LSb
LSb
CV03*
CR
2k
CV04*
CST
Settling Time(1)
10
DS41202F-page 146
PIC16F684
TABLE 15-9:
Characteristic
Min
Typ
Max
Units
Conditions
AD01
NR
Resolution
10 bits
AD02
EIL
Integral Error
AD03
EDL
Differential Error
AD04
EOFF
Offset Error
AD07
EGN
bit
Gain Error
AD06 VREF
AD06A
Reference Voltage(3)
2.2
2.7
VDD
AD07
VAIN
Full-Scale Range
VSS
VREF
AD08
ZAIN
Recommended
Impedance of Analog
Voltage Source
10
AD09* IREF
10
1000
50
DS41202F-page 147
PIC16F684
TABLE 15-10: PIC16F684 A/D CONVERSION REQUIREMENTS
Standard Operating Conditions (unless otherwise stated)
Operating temperature
-40C TA +125C
Param
No.
Sym
AD130* TAD
Characteristic
A/D Clock Period
A/D Internal RC
Oscillator Period
AD131 TCNV
Conversion Time
(not including
Acquisition Time)(1)
Min
Typ
1.6
9.0
3.0
9.0
3.0
6.0
9.0
1.6
4.0
6.0
At VDD = 5.0V
11
TAD
11.5
TOSC/2
TOSC/2 + TCY
TAMP
AD134 TGO
Max Units
Conditions
DS41202F-page 148
PIC16F684
FIGURE 15-10:
BSF ADCON0, GO
AD134
1 TCY
(TOSC/2(1))
AD131
Q4
AD130
A/D CLK
9
A/D Data
0
NEW_DATA
OLD_DATA
ADRES
1 TCY
ADIF
GO
DONE
Note 1:
Sampling Stopped
AD132
Sample
If the A/D clock source is selected as RC, a time of TCY is added before the A/D clock starts. This allows the
SLEEP instruction to be executed.
FIGURE 15-11:
BSF ADCON0, GO
AD134
(TOSC/2 + TCY(1))
1 TCY
AD131
Q4
AD130
A/D CLK
9
A/D Data
OLD_DATA
ADRES
0
NEW_DATA
ADIF
1 TCY
GO
DONE
Sample
Note 1:
AD132
Sampling Stopped
If the A/D clock source is selected as RC, a time of TCY is added before the A/D clock starts. This allows the
SLEEP instruction to be executed.
DS41202F-page 149
PIC16F684
NOTES:
DS41202F-page 150
PIC16F684
16.0
The graphs and tables provided in this section are for design guidance and are not tested.
In some graphs or tables, the data presented are outside specified operating range (i.e., outside specified VDD
range). This is for information only and devices are ensured to operate properly only within the specified range.
Note:
The graphs and tables provided following this note are a statistical summary based on a limited number of
samples and are provided for informational purposes only. The performance characteristics listed herein are
not tested or guaranteed. In some graphs or tables, the data presented may be outside the specified
operating range (e.g., outside specified power supply range) and therefore, outside the warranted range.
Typical represents the mean of the distribution at 25C. Maximum or minimum represents
(mean + 3) or (mean - 3) respectively, where is a standard deviation, over each temperature range.
FIGURE 16-1:
3.5
3.0
5.5V
5.0V
IDD (mA)
2.5
2.0
4.0V
1.5
3.0V
1.0
2.0V
0.5
0.0
1 MHz
2 MHz
4 MHz
6 MHz
8 MHz
10 MHz
12 MHz
14 MHz
16 MHz
18 MHz
20 MHz
FOSC
DS41202F-page 151
PIC16F684
FIGURE 16-2:
4.0
3.5
5.5V
5.0V
3.0
IDD (mA)
2.5
4.0V
2.0
3.0V
1.5
2.0V
1.0
0.5
0.0
1 MHz
2 MHz
4 MHz
6 MHz
8 MHz
10 MHz
12 MHz
14 MHz
16 MHz
18 MHz
20 MHz
FOSC
FIGURE 16-3:
4.0
3.5
5.5V
3.0
5.0V
IDD (mA)
2.5
4.5V
2.0
1.5
4.0V
3.5V
3.0V
1.0
0.5
0.0
4 MHz
10 MHz
16 MHz
20 MHz
FOSC
DS41202F-page 152
PIC16F684
FIGURE 16-4:
5.0
4.5
4.0
IDD (mA)
3.5
5.0V
3.0
4.5V
2.5
2.0
1.5
4.0V
3.5V
3.0V
1.0
0.5
0.0
4 MHz
10 MHz
16 MHz
20 MHz
FOSC
FIGURE 16-5:
900
800
700
IDD (A)
600
500
4 MHz
400
300
1 MHz
200
100
0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
DS41202F-page 153
PIC16F684
FIGURE 16-6:
1,400
Typical: Statistical Mean @25C
Maximum: Mean (Worst Case Temp) + 3
(-40C to 125C)
1,200
IDD (A)
1,000
800
4 MHz
600
400
1 MHz
200
0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
5.0
5.5
VDD (V)
FIGURE 16-7:
800
700
600
IDD (A)
500
4 MHz
400
300
1 MHz
200
100
0
2.0
2.5
3.0
3.5
4.0
4.5
VDD (V)
DS41202F-page 154
PIC16F684
FIGURE 16-8:
1,400
Typical: Statistical Mean @25C
Maximum: Mean (Worst Case Temp) + 3
(-40C to 125C)
1,200
IDD (A)
1,000
4 MHz
800
600
1 MHz
400
200
0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
5.0
5.5
VDD (V)
FIGURE 16-9:
80
70
60
IDD (A)
50
Maximum
40
30
Typical
20
10
0
2.0
2.5
3.0
3.5
4.0
4.5
VDD (V)
DS41202F-page 155
PIC16F684
FIGURE 16-10:
70
Typical: Statistical Mean @25C
Maximum: Mean (Worst Case Temp) + 3
(-40C to 125C)
60
50
IDD (A)
32 kHz Maximum
40
30
32 kHz Typical
20
10
0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
FIGURE 16-11:
1,600
1,400
5.5V
5.0V
1,200
IDD (A)
1,000
4.0V
800
3.0V
600
2.0V
400
200
0
125 kHz
250 kHz
500 kHz
1 MHz
2 MHz
4 MHz
8 MHz
FOSC
DS41202F-page 156
PIC16F684
FIGURE 16-12:
2,000
1,800
5.5V
5.0V
1,600
1,400
4.0V
IDD (A)
1,200
1,000
3.0V
800
600
2.0V
400
200
0
125 kHz
250 kHz
500 kHz
1 MHz
2 MHz
4 MHz
8 MHz
FOSC
FIGURE 16-13:
0.45
0.40
0.35
IPD (A)
0.30
0.25
0.20
0.15
0.10
0.05
0.0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
DS41202F-page 157
PIC16F684
FIGURE 16-14:
18.0
16.0
14.0
Max. 125C
IPD (A)
12.0
10.0
8.0
6.0
4.0
Max. 85C
2.0
0.0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
FIGURE 16-15:
180
160
140
IPD (A)
120
Maximum
100
Typical
80
60
40
20
0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
DS41202F-page 158
PIC16F684
FIGURE 16-16:
160
140
120
IPD (A)
100
Maximum
80
Typical
60
40
20
0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
FIGURE 16-17:
3.0
2.5
Typical: Statistical
StatisticalMean
Mean @25C
@25C
Typical:
Maximum: Mean (Worst Case Temp) + 3
(-40C to 125C)
IPD (A)
2.0
1.5
1.0
0.5
0.0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
DS41202F-page 159
PIC16F684
FIGURE 16-18:
25.0
20.0
IPD (A)
Max. 125C
15.0
10.0
Max. 85C
5.0
0.0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
FIGURE 16-19:
30
28
26
Max. (85C)
24
Time (ms)
22
20
Typical
18
16
14
Minimum
12
10
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
DS41202F-page 160
PIC16F684
FIGURE 16-20:
30
28
26
Maximum
24
Time (ms)
22
20
Typical
18
16
Minimum
14
12
10
-40C
25C
85C
125C
Temperature (C)
FIGURE 16-21:
140
120
100
IPD (A)
Max. 125C
80
Max. 85C
60
Typical
40
20
0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
DS41202F-page 161
PIC16F684
FIGURE 16-22:
180
Typical: Statistical Mean @25C
Maximum: Mean (Worst Case Temp) + 3
(-40C to 125C)
160
140
120
IPD (A)
Max. 125C
100
Max. 85C
80
Typical
60
40
20
0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
FIGURE 16-23:
0.8
0.7
Max. 125C
0.6
VOL (V)
0.5
Max. 85C
0.4
Typical 25C
0.3
0.2
Min. -40C
0.1
0.0
5.0
5.5
6.0
6.5
7.0
7.5
8.0
8.5
9.0
9.5
10.0
IOL (mA)
DS41202F-page 162
PIC16F684
FIGURE 16-24:
0.45
Typical: Statistical Mean @25C
Typical:
Statistical
@25C+ 3
Maximum:
Mean
(Worst Mean
Case Temp)
Maximum: Meas(-40C
+ 3 to 125C)
(-40C to 125C)
0.40
Max. 125C
0.35
Max. 85C
VOL (V)
0.30
0.25
Typ. 25C
0.20
0.15
Min. -40C
0.10
0.05
0.00
5.0
5.5
6.0
6.5
7.0
7.5
8.0
8.5
9.0
9.5
10.0
IOL (mA)
FIGURE 16-25:
3.5
3.0
Max. -40C
Typ. 25C
2.5
Min. 125C
VOH (V)
2.0
1.5
1.0
0.5
0.0
0.0
-0.5
-1.0
-1.5
-2.0
-2.5
-3.0
-3.5
-4.0
IOH (mA)
DS41202F-page 163
PIC16F684
FIGURE 16-26:
5.5
5.0
Max. -40C
Typ. 25C
VOH (V)
4.5
Min. 125C
4.0
3.5
3.0
0.0
-0.5
-1.0
-1.5
-2.0
-2.5
-3.0
-3.5
-4.0
-4.5
-5.0
IOH (mA)
FIGURE 16-27:
1.7
1.5
VIN (V)
1.3
Typ. 25C
1.1
Min. 125C
0.9
0.7
0.5
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
DS41202F-page 164
PIC16F684
FIGURE 16-28:
4.0
VIH Max. 125C
3.5
VIN (V)
3.0
2.5
2.0
VIL Max. -40C
1.5
1.0
0.5
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
FIGURE 16-29:
45.0
40.0
35.0
Max. 125C
IPD (mA)
30.0
25.0
20.0
15.0
Max. 85C
10.0
5.0
Typ. 25C
0.0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
DS41202F-page 165
PIC16F684
FIGURE 16-30:
806
1000
900
Max. 125C
800
700
600
Note:
500
Max. 85C
400
300
Typ. 25C
200
Min. -40C
100
0
2.0
2.5
4.0
5.5
VDD (V)
FIGURE 16-31:
1000
900
Max. 125C
800
700
600
Note:
500
Max. 85C
400
300
Typ. 25C
200
Min. -40C
100
0
2.0
2.5
4.0
5.5
VDD (V)
DS41202F-page 166
PIC16F684
FIGURE 16-32:
45,000
40,000
Max. -40C
35,000
Typ. 25C
Frequency (Hz)
30,000
25,000
20,000
Min. 85C
Min. 125C
15,000
10,000
5,000
0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
FIGURE 16-33:
8
Typical: Statistical Mean @25C
Maximum: Mean (Worst Case Temp) + 3
(-40C to 125C)
125C
6
Time (s)
85C
25C
-40C
2
0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
DS41202F-page 167
PIC16F684
FIGURE 16-34:
16
Typical: Statistical Mean @25C
Maximum: Mean (Worst Case Temp) + 3
(-40C to 125C)
14
85C
12
25C
Time (s)
10
-40C
8
0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
FIGURE 16-35:
25
Time (s)
20
15
85C
25C
10
-40C
0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
DS41202F-page 168
PIC16F684
FIGURE 16-36:
10
9
Typical: Statistical Mean @25C
Maximum: Mean (Worst Case Temp) + 3
(-40C to 125C)
8
7
Time (s)
85C
6
25C
5
-40C
4
3
2
1
0
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
FIGURE 16-37:
5
4
3
2
1
0
-1
-2
-3
-4
-5
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
DS41202F-page 169
PIC16F684
FIGURE 16-38:
5
4
Change from Calibration (%)
3
2
1
0
-1
-2
-3
-4
-5
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
FIGURE 16-39:
5
4
3
2
1
0
-1
-2
-3
-4
-5
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
DS41202F-page 170
PIC16F684
FIGURE 16-40:
5
4
3
2
1
0
-1
-2
-3
-4
-5
2.0
2.5
3.0
3.5
4.0
4.5
5.0
5.5
VDD (V)
DS41202F-page 171
PIC16F684
NOTES:
DS41202F-page 172
PIC16F684
17.0
PACKAGING INFORMATION
17.1
Example
XXXXXXXXXXXXXX
XXXXXXXXXXXXXX
YYWWNNN
14-Lead SOIC (.150)
XXXXXXXXXXX
XXXXXXXXXXX
YYWWNNN
14-Lead TSSOP
XXXXXXXX
YYWW
NNN
16-Lead QFN
Legend: XX...X
Y
YY
WW
NNN
e3
Example
PIC16F684-E
e3
0510017
Example
XXXX/ST
0510
017
Example
XXXXXX
XXXXXX
YWWNNN
Note:
PIC16F684
-I/P e3
0510017
16F684-I
/ML e3
510017
Customer-specific information
Year code (last digit of calendar year)
Year code (last 2 digits of calendar year)
Week code (week of January 1 is week 01)
Alphanumeric traceability code
Pb-free JEDEC designator for Matte Tin (Sn)
This package is Pb-free. The Pb-free JEDEC designator ( e3 )
can be found on the outer packaging for this package.
In the event the full Microchip part number cannot be marked on one line, it will
be carried over to the next line, thus limiting the number of available
characters for customer-specific information.
Standard PIC device marking consists of Microchip part number, year code, week code, and traceability
code. For PIC device marking beyond this, certain price adders apply. Please check with your Microchip
Sales Office. For QTP devices, any special marking adders are included in QTP price.
DS41202F-page 173
PIC16F684
17.2
Package Details
For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
NOTE 1
E1
D
E
A2
L
A1
b1
b
eB
Units
Dimension Limits
Number of Pins
INCHES
MIN
NOM
MAX
14
Pitch
.210
A2
.115
.130
.195
A1
.015
.290
.310
.325
E1
.240
.250
.280
Overall Length
.735
.750
.775
.115
.130
.150
Lead Thickness
.008
.010
.015
b1
.045
.060
.070
.014
.018
.022
eB
.100 BSC
.430
Notes:
1. Pin 1 visual index feature may vary, but must be located with the hatched area.
2. Significant Characteristic.
3. Dimensions D and E1 do not include mold flash or protrusions. Mold flash or protrusions shall not exceed .010" per side.
4. Dimensioning and tolerancing per ASME Y14.5M.
BSC: Basic Dimension. Theoretically exact value shown without tolerances.
Microchip Technology Drawing C04-005B
DS41202F-page 174
PIC16F684
14-Lead Plastic Small Outline (SL or OD) Narrow, 3.90 mm Body [SOIC]
Note:
For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
D
N
E
E1
NOTE 1
1
e
h
A2
A1
L1
Units
Dimension Limits
Number of Pins
MILLIMETERS
MIN
NOM
MAX
14
Pitch
Overall Height
1.27 BSC
A2
1.25
Standoff
A1
0.10
0.25
Overall Width
E1
3.90 BSC
Overall Length
8.65 BSC
1.75
6.00 BSC
Chamfer (optional)
0.25
0.50
Foot Length
0.40
1.27
Footprint
L1
1.04 REF
Foot Angle
Lead Thickness
0.17
0.25
Lead Width
0.31
0.51
15
15
Notes:
1. Pin 1 visual index feature may vary, but must be located within the hatched area.
2. Significant Characteristic.
3. Dimensions D and E1 do not include mold flash or protrusions. Mold flash or protrusions shall not exceed 0.15 mm per side.
4. Dimensioning and tolerancing per ASME Y14.5M.
BSC: Basic Dimension. Theoretically exact value shown without tolerances.
REF: Reference Dimension, usually without tolerance, for information purposes only.
Microchip Technology Drawing C04-065B
DS41202F-page 175
PIC16F684
14-Lead Plastic Thin Shrink Small Outline (ST) 4.4 mm Body [TSSOP]
Note:
For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
D
N
E
E1
NOTE 1
1
2
e
b
A2
A1
Units
Dimension Limits
Number of Pins
L1
MILLIMETERS
MIN
NOM
MAX
14
Pitch
Overall Height
0.65 BSC
A2
0.80
1.00
1.05
Standoff
A1
0.05
0.15
1.20
Overall Width
E1
4.30
6.40 BSC
4.40
4.90
5.00
5.10
Foot Length
0.45
0.60
0.75
Footprint
L1
4.50
1.00 REF
Foot Angle
Lead Thickness
0.09
0.20
Lead Width
b
0.19
0.30
Notes:
1. Pin 1 visual index feature may vary, but must be located within the hatched area.
2. Dimensions D and E1 do not include mold flash or protrusions. Mold flash or protrusions shall not exceed 0.15 mm per side.
3. Dimensioning and tolerancing per ASME Y14.5M.
BSC: Basic Dimension. Theoretically exact value shown without tolerances.
REF: Reference Dimension, usually without tolerance, for information purposes only.
Microchip Technology Drawing C04-087B
DS41202F-page 176
PIC16F684
16-Lead Plastic Quad Flat, No Lead Package (ML) 4x4x0.9 mm Body [QFN]
Note:
For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
D2
D
EXPOSED
PAD
e
E
E2
TOP VIEW
N
NOTE 1
BOTTOM VIEW
A3
A
A1
Units
Dimension Limits
Number of Pins
MILLIMETERS
MIN
NOM
MAX
16
Pitch
Overall Height
0.80
0.65 BSC
0.90
1.00
Standoff
A1
0.00
0.02
0.05
Contact Thickness
A3
0.20 REF
Overall Width
E2
Overall Length
D2
2.50
2.65
2.80
0.25
0.30
0.35
Contact Length
0.30
0.40
0.50
Contact-to-Exposed Pad
0.20
Contact Width
4.00 BSC
2.50
2.65
2.80
4.00 BSC
Notes:
1. Pin 1 visual index feature may vary, but must be located within the hatched area.
2. Package is saw singulated.
3. Dimensioning and tolerancing per ASME Y14.5M.
BSC: Basic Dimension. Theoretically exact value shown without tolerances.
REF: Reference Dimension, usually without tolerance, for information purposes only.
Microchip Technology Drawing C04-127B
DS41202F-page 177
PIC16F684
NOTES:
DS41202F-page 178
PIC16F684
APPENDIX A:
DATA SHEET
REVISION HISTORY
APPENDIX B:
Revision A
MIGRATING FROM
OTHER PIC
DEVICES
Revision B
B.1
TABLE B-1:
PIC16F676 to PIC16F684
Feature
Revision C
Max Operating
Speed
Revision D
Max Program
Memory (Words)
Revision E
Updated Package Drawings; Replace PICmicro with
PIC.
PIC16F676
PIC16F684
20 MHz
20 MHz
1024
2048
SRAM (bytes)
64
128
A/D Resolution
10-bit
10-bit
Data EEPROM
(Bytes)
128
256
Timers (8/16-bit)
1/1
2/1
Oscillator Modes
Brown-out Reset
Internal Pull-ups
RA0/1/2/4/5
RA0/1/2/4/5,
MCLR
Interrupt-on-change
RA0/1/2/3/4/5 RA0/1/2/3/4/5
Comparator
ECCP
Ultra Low-Power
Wake-Up
Extended WDT
Software Control
Option of WDT/BOR
4 MHz
32 kHz8 MHz
Revision F (03/2007)
INTOSC
Frequencies
Clock Switching
Note:
FEATURE COMPARISON
DS41202F-page 179
PIC16F684
NOTES:
DS41202F-page 180
PIC16F684
INDEX
A
A/D
Specifications.................................................... 147, 148
Absolute Maximum Ratings .............................................. 129
AC Characteristics
Industrial and Extended ............................................ 139
Load Conditions ........................................................ 138
ADC .................................................................................... 65
Acquisition Requirements ........................................... 72
Associated registers.................................................... 74
Block Diagram............................................................. 65
Calculating Acquisition Time....................................... 72
Channel Selection....................................................... 66
Configuration............................................................... 66
Configuring Interrupt ................................................... 68
Conversion Clock........................................................ 66
Conversion Procedure ................................................ 68
Internal Sampling Switch (RSS) Impedance................ 72
Interrupts..................................................................... 67
Operation .................................................................... 68
Operation During Sleep .............................................. 68
Port Configuration ....................................................... 66
Reference Voltage (VREF)........................................... 66
Result Formatting........................................................ 67
Source Impedance...................................................... 72
Special Event Trigger.................................................. 68
Starting an A/D Conversion ........................................ 67
ADCON0 Register............................................................... 70
ADCON1 Register............................................................... 70
ADRESH Register (ADFM = 0) ........................................... 71
ADRESH Register (ADFM = 1) ........................................... 71
ADRESL Register (ADFM = 0)............................................ 71
ADRESL Register (ADFM = 1)............................................ 71
Analog Input Connection Considerations............................ 57
Analog-to-Digital Converter. See ADC
ANSEL Register .................................................................. 32
Assembler
MPASM Assembler................................................... 126
B
Block Diagrams
(CCP) Capture Mode Operation ................................. 80
ADC ............................................................................ 65
ADC Transfer Function ............................................... 73
Analog Input Model ............................................... 57, 73
CCP PWM................................................................... 82
Clock Source............................................................... 19
Comparator 1 .............................................................. 56
Comparator 2 .............................................................. 56
Comparator Modes ..................................................... 58
Compare ..................................................................... 81
Crystal Operation ........................................................ 22
External RC Mode....................................................... 23
Fail-Safe Clock Monitor (FSCM) ................................. 29
In-Circuit Serial Programming Connections.............. 114
Interrupt Logic ........................................................... 107
MCLR Circuit............................................................. 100
On-Chip Reset Circuit ................................................. 99
PIC16F684.................................................................... 5
PWM (Enhanced)........................................................ 85
RA0 Pins ..................................................................... 35
RA1 Pins ..................................................................... 36
RA2 Pin....................................................................... 36
RA3 Pin....................................................................... 37
C
C Compilers
MPLAB C18.............................................................. 126
MPLAB C30.............................................................. 126
Calibration Bits.................................................................... 99
Capture Module. See Enhanced Capture/
Compare/PWM (ECCP)
Capture/Compare/PWM (CCP)
Associated registers w/ Capture/Compare/PWM ....... 96
Capture Mode............................................................. 80
CCP1 Pin Configuration ............................................. 80
Compare Mode........................................................... 81
CCP1 Pin Configuration ..................................... 81
Software Interrupt Mode ............................... 80, 81
Special Event Trigger ......................................... 81
Timer1 Mode Selection................................. 80, 81
Prescaler .................................................................... 80
PWM Mode................................................................. 82
Duty Cycle .......................................................... 83
Effects of Reset .................................................. 84
Example PWM Frequencies and
Resolutions, 20 MHZ .................................. 83
Example PWM Frequencies and
Resolutions, 8 MHz .................................... 83
Operation in Sleep Mode.................................... 84
Setup for Operation ............................................ 84
System Clock Frequency Changes .................... 84
PWM Period ............................................................... 83
Setup for PWM Operation .......................................... 84
CCP1CON (Enhanced) Register ........................................ 79
Clock Sources
External Modes........................................................... 21
EC ...................................................................... 21
HS ...................................................................... 22
LP ....................................................................... 22
OST .................................................................... 21
RC ...................................................................... 23
XT ....................................................................... 22
Internal Modes............................................................ 23
Frequency Selection........................................... 25
HFINTOSC ......................................................... 23
HFINTOSC/LFINTOSC Switch Timing ............... 25
INTOSC .............................................................. 23
INTOSCIO .......................................................... 23
LFINTOSC.......................................................... 25
Clock Switching .................................................................. 27
CMCON0 Register.............................................................. 61
DS41202F-page 181
PIC16F684
CMCON1 Register .............................................................. 62
Code Examples
A/D Conversion ........................................................... 69
Assigning Prescaler to Timer0 .................................... 44
Assigning Prescaler to WDT ....................................... 44
Changing Between Capture Prescalers ...................... 80
Data EEPROM Read .................................................. 77
Data EEPROM Write .................................................. 77
Indirect Addressing ..................................................... 19
Initializing PORTA ....................................................... 31
Initializing PORTC....................................................... 40
Saving Status and W Registers in RAM ................... 109
Ultra Low-Power Wake-Up Initialization...................... 34
Write Verify ................................................................. 77
Code Protection ................................................................ 113
Comparator ......................................................................... 55
C2OUT as T1 Gate ..................................................... 62
Configurations ............................................................. 58
Interrupts ..................................................................... 59
Operation .................................................................... 59
Operation During Sleep .............................................. 60
Overview ..................................................................... 55
Response Time ........................................................... 59
Synchronizing COUT w/Timer1 .................................. 62
Comparator Module
Associated Registers .................................................. 64
Comparator Voltage Reference (CVREF)
Response Time ........................................................... 59
Comparator Voltage Reference (CVREF) ............................ 63
Effects of a Reset........................................................ 60
Specifications ............................................................ 146
Comparators
C2OUT as T1 Gate ..................................................... 49
Effects of a Reset........................................................ 60
Specifications ............................................................ 146
Compare Module. See Enhanced Capture/
Compare/PWM (ECCP)
CONFIG Register................................................................ 98
Configuration Bits................................................................ 97
CPU Features ..................................................................... 97
Customer Change Notification Service ............................. 187
Customer Notification Service........................................... 187
Customer Support ............................................................. 187
D
Data EEPROM Memory
Associated Registers .................................................. 78
Code Protection .................................................... 75, 78
Data Memory......................................................................... 7
DC and AC Characteristics
Graphs and Tables ................................................... 151
DC Characteristics
Extended and Industrial ............................................ 135
Industrial and Extended ............................................ 131
Development Support ....................................................... 125
Device Overview ................................................................... 5
E
ECCP. See Enhanced Capture/Compare/PWM
ECCPAS Register ............................................................... 93
EEADR Register ................................................................. 75
EECON1 Register ............................................................... 76
EECON2 Register ............................................................... 76
EEDAT Register.................................................................. 75
EEPROM Data Memory
Avoiding Spurious Write.............................................. 78
DS41202F-page 182
Reading ...................................................................... 77
Write Verify ................................................................. 77
Writing ........................................................................ 77
Effects of Reset
PWM mode ................................................................. 84
Electrical Specifications .................................................... 129
Enhanced Capture/Compare/PWM .................................... 79
Enhanced Capture/Compare/PWM (ECCP)
Enhanced PWM Mode................................................ 85
Auto-Restart ....................................................... 94
Auto-shutdown.................................................... 93
Direction Change in Full-Bridge Output Mode.... 91
Full-Bridge Application........................................ 89
Full-Bridge Mode ................................................ 89
Half-Bridge Application ....................................... 88
Half-Bridge Application Examples ...................... 95
Half-Bridge Mode................................................ 88
Output Relationships (Active-High and
Active-Low)................................................ 86
Output Relationships Diagram............................ 87
Programmable Dead-Band Delay....................... 95
Shoot-through Current ........................................ 95
Start-up Considerations ...................................... 92
Specifications ........................................................... 145
Timer Resources ........................................................ 79
Errata .................................................................................... 4
F
Fail-Safe Clock Monitor ...................................................... 29
Fail-Safe Condition Clearing....................................... 29
Fail-Safe Detection ..................................................... 29
Fail-Safe Operation..................................................... 29
Reset or Wake-up from Sleep .................................... 29
Firmware Instructions ....................................................... 115
Fuses. See Configuration Bits
G
General Purpose Register File ............................................. 8
I
ID Locations...................................................................... 113
In-Circuit Debugger........................................................... 114
In-Circuit Serial Programming (ICSP)............................... 114
Indirect Addressing, INDF and FSR registers..................... 19
Instruction Format............................................................. 115
Instruction Set................................................................... 115
ADDLW..................................................................... 117
ADDWF..................................................................... 117
ANDLW..................................................................... 117
ANDWF..................................................................... 117
BCF .......................................................................... 117
BSF........................................................................... 117
BTFSC ...................................................................... 117
BTFSS ...................................................................... 118
CALL......................................................................... 118
CLRF ........................................................................ 118
CLRW ....................................................................... 118
CLRWDT .................................................................. 118
COMF ....................................................................... 118
DECF ........................................................................ 118
DECFSZ ................................................................... 119
GOTO ....................................................................... 119
INCF ......................................................................... 119
INCFSZ..................................................................... 119
IORLW ...................................................................... 119
IORWF...................................................................... 119
PIC16F684
MOVF........................................................................ 120
MOVLW .................................................................... 120
MOVWF .................................................................... 120
NOP .......................................................................... 120
RETFIE ..................................................................... 121
RETLW ..................................................................... 121
RETURN ................................................................... 121
RLF ........................................................................... 122
RRF........................................................................... 122
SLEEP ...................................................................... 122
SUBLW ..................................................................... 122
SUBWF ..................................................................... 123
SWAPF ..................................................................... 123
XORLW..................................................................... 123
XORWF..................................................................... 123
Summary Table......................................................... 116
INTCON Register ................................................................ 15
Internal Oscillator Block
INTOSC
Specifications............................................ 140, 141
Internal Sampling Switch (RSS) Impedance ........................ 72
Internet Address................................................................ 187
Interrupts ........................................................................... 106
ADC ............................................................................ 68
Associated Registers ................................................ 108
Comparator ................................................................. 59
Context Saving.......................................................... 109
Data EEPROM Memory Write .................................... 76
Interrupt-on-Change.................................................... 32
PORTA Interrupt-on-Change .................................... 107
RA2/INT .................................................................... 106
Timer0....................................................................... 107
TMR1 .......................................................................... 49
INTOSC Specifications ............................................. 140, 141
IOCA Register ..................................................................... 33
L
Load Conditions ................................................................ 138
M
MCLR ................................................................................ 100
Internal ...................................................................... 100
Memory Organization............................................................ 7
Data .............................................................................. 7
Data EEPROM Memory.............................................. 75
Program ........................................................................ 7
Microchip Internet Web Site .............................................. 187
Migrating from other PICmicro Devices ............................ 179
MPLAB ASM30 Assembler, Linker, Librarian ................... 126
MPLAB ICD 2 In-Circuit Debugger ................................... 127
MPLAB ICE 2000 High-Performance Universal
In-Circuit Emulator .................................................... 127
MPLAB Integrated Development Environment Software .. 125
MPLAB PM3 Device Programmer .................................... 127
MPLAB REAL ICE In-Circuit Emulator System................. 127
MPLINK Object Linker/MPLIB Object Librarian ................ 126
O
OPCODE Field Descriptions ............................................. 115
OPTION Register .......................................................... 14, 45
OSCCON Register .............................................................. 20
Oscillator
Associated registers.............................................. 30, 51
Oscillator Module ................................................................ 19
EC ............................................................................... 19
HFINTOSC.................................................................. 19
HS............................................................................... 19
INTOSC ...................................................................... 19
INTOSCIO .................................................................. 19
LFINTOSC.................................................................. 19
LP ............................................................................... 19
RC .............................................................................. 19
RCIO........................................................................... 19
XT ............................................................................... 19
Oscillator Parameters ....................................................... 140
Oscillator Specifications.................................................... 139
Oscillator Start-up Timer (OST)
Specifications ........................................................... 143
Oscillator Switching
Fail-Safe Clock Monitor .............................................. 29
Two-Speed Clock Start-up ......................................... 27
OSCTUNE Register............................................................ 24
P
P1A/P1B/P1C/P1D.See Enhanced Capture/
Compare/PWM (ECCP).............................................. 85
Packaging ......................................................................... 173
Marking..................................................................... 173
PDIP Details ............................................................. 174
PCL and PCLATH............................................................... 19
Stack........................................................................... 19
PCON Register ........................................................... 18, 102
PICSTART Plus Development Programmer..................... 128
PIE1 Register ..................................................................... 16
Pin Diagram
PDIP, SOIC, TSSOP .................................................... 2
QFN .............................................................................. 3
Pinout Descriptions
PIC16F684 ................................................................... 6
PIR1 Register ..................................................................... 17
PORTA ............................................................................... 31
Additional Pin Functions ............................................. 32
ANSEL Register ................................................. 32
Interrupt-on-Change ........................................... 32
Ultra Low-Power Wake-Up ........................... 32, 34
Weak Pull-up ...................................................... 32
Associated registers ................................................... 39
Pin Descriptions and Diagrams .................................. 35
RA0............................................................................. 35
RA1............................................................................. 35
RA2............................................................................. 36
RA3............................................................................. 37
RA4............................................................................. 37
RA5............................................................................. 38
Specifications ........................................................... 141
PORTA Register ................................................................. 31
PORTC ............................................................................... 40
Associated registers ................................................... 42
P1A/P1B/P1C/P1D.See Enhanced Capture/
Compare/PWM (ECCP)...................................... 40
Specifications ........................................................... 141
PORTC Register................................................................. 40
Power-Down Mode (Sleep)............................................... 112
Power-on Reset (POR)..................................................... 100
Power-up Timer (PWRT) .................................................. 100
Specifications ........................................................... 143
Precision Internal Oscillator Parameters .......................... 141
Prescaler
Shared WDT/Timer0................................................... 44
Switching Prescaler Assignment ................................ 44
Program Memory .................................................................. 7
Map and Stack.............................................................. 7
DS41202F-page 183
PIC16F684
Programming, Device Instructions .................................... 115
PWM Mode. See Enhanced Capture/Compare/PWM ........ 85
PWM1CON Register ........................................................... 96
R
Reader Response ............................................................. 188
Read-Modify-Write Operations.......................................... 115
Registers
ADCON0 (ADC Control 0) .......................................... 70
ADCON1 (ADC Control 1) .......................................... 70
ADRESH (ADC Result High) with ADFM = 0)............. 71
ADRESH (ADC Result High) with ADFM = 1)............. 71
ADRESL (ADC Result Low) with ADFM = 0) .............. 71
ADRESL (ADC Result Low) with ADFM = 1) .............. 71
ANSEL (Analog Select)............................................... 32
CCP1CON (Enhanced CCP1 Control)........................ 79
CMCON0 (Comparator Control 0) .............................. 61
CMCON1 (Comparator Control 1) .............................. 62
CONFIG (Configuration Word).................................... 98
Data Memory Map ........................................................ 8
ECCPAS (Enhanced CCP Auto-shutdown Control) ... 93
EEADR (EEPROM Address) ...................................... 75
EECON1 (EEPROM Control 1)................................... 76
EECON2 (EEPROM Control 2)................................... 76
EEDAT (EEPROM Data) ............................................ 75
INTCON (Interrupt Control) ......................................... 15
IOCA (Interrupt-on-Change PORTA) .......................... 33
OPTION_REG (OPTION) ..................................... 14, 45
OSCCON (Oscillator Control) ..................................... 20
OSCTUNE (Oscillator Tuning) .................................... 24
PCON (Power Control Register) ................................. 18
PCON (Power Control) ............................................. 102
PIE1 (Peripheral Interrupt Enable 1) ........................... 16
PIR1 (Peripheral Interrupt Register 1) ........................ 17
PORTA........................................................................ 31
PORTC ....................................................................... 40
PWM1CON (Enhanced PWM Control) ....................... 96
Reset Values............................................................. 104
Reset Values (Special Registers) ............................. 105
Special Function Registers ........................................... 8
Special Register Summary ......................................... 11
STATUS ...................................................................... 13
T1CON ........................................................................ 50
T2CON ........................................................................ 54
TRISA (Tri-State PORTA) ........................................... 31
TRISC (Tri-State PORTC) .......................................... 40
VRCON (Voltage Reference Control) ......................... 63
WDTCON (Watchdog Timer Control)........................ 111
WPUA (Weak Pull-Up PORTA) .................................. 33
Reset................................................................................... 99
Revision History ................................................................ 179
S
Shoot-through Current ........................................................ 95
Sleep
Power-Down Mode ................................................... 112
Wake-up.................................................................... 112
Wake-up Using Interrupts ......................................... 112
Software Simulator (MPLAB SIM)..................................... 126
Special Event Trigger.......................................................... 68
Special Function Registers ................................................... 8
STATUS Register................................................................ 13
T
T1CON Register.................................................................. 50
T2CON Register.................................................................. 54
DS41202F-page 184
PIC16F684
U
Ultra Low-Power Wake-Up ....................................... 6, 32, 34
V
Voltage Reference. See Comparator Voltage Reference
(CVREF)
Voltage References
Associated Registers .................................................. 64
VREF. SEE ADC Reference Voltage
W
Wake-up Using Interrupts ................................................. 112
Watchdog Timer (WDT) .................................................... 110
Associated Registers ................................................ 111
Clock Source............................................................. 110
Modes ....................................................................... 110
Period........................................................................ 110
Specifications............................................................ 143
WDTCON Register ........................................................... 111
WPUA Register ................................................................... 33
WWW Address.................................................................. 187
WWW, On-Line Support ....................................................... 4
DS41202F-page 185
PIC16F684
NOTES:
DS41202F-page 186
PIC16F684
THE MICROCHIP WEB SITE
CUSTOMER SUPPORT
Distributor or Representative
Local Sales Office
Field Application Engineer (FAE)
Technical Support
Development Systems Information Line
Customers
should
contact
their
distributor,
representative or field application engineer (FAE) for
support. Local sales offices are also available to help
customers. A listing of sales offices and locations is
included in the back of this document.
Technical support is available through the web site
at: http://support.microchip.com
DS41202F-page 187
PIC16F684
READER RESPONSE
It is our intention to provide you with the best documentation possible to ensure successful use of your Microchip product. If you wish to provide your comments on organization, clarity, subject matter, and ways in which our documentation
can better serve you, please FAX your comments to the Technical Publications Manager at (480) 792-4150.
Please list the following information, and use this outline to provide us with your comments about this document.
To:
RE:
Reader Response
From: Name
Company
Address
City / State / ZIP / Country
Telephone: (_______) _________ - _________
Application (optional):
Would you like a reply?
Device: PIC16F684
N
Literature Number: DS41202F
Questions:
1. What are the best features of this document?
2. How does this document meet your hardware and software development needs?
3. Do you find the organization of this document easy to follow? If not, why?
4. What additions to the document do you think would enhance the structure and subject?
5. What deletions from the document could be made without affecting the overall usefulness?
DS41202F-page 188
PIC16F684
PRODUCT IDENTIFICATION SYSTEM
To order or obtain information, e.g., on pricing or delivery, refer to the factory or the listed sales office.
PART NO.
/XX
XXX
Device
Temperature
Range
Package
Pattern
Examples:
a)
b)
Device:
PIC16F684, PIC16F684T(1)
VDD range 2.0V to 5.5V
Temperature
Range:
I
E
Package:
ML
P
SL
ST
Pattern:
= -40C to +85C
= -40C to +125C
=
=
=
=
(Industrial)
(Extended)
DS41202F-page 189
ASIA/PACIFIC
ASIA/PACIFIC
EUROPE
Corporate Office
2355 West Chandler Blvd.
Chandler, AZ 85224-6199
Tel: 480-792-7200
Fax: 480-792-7277
Technical Support:
http://support.microchip.com
Web Address:
www.microchip.com
India - Bangalore
Tel: 91-80-4182-8400
Fax: 91-80-4182-8422
India - New Delhi
Tel: 91-11-4160-8631
Fax: 91-11-4160-8632
Austria - Wels
Tel: 43-7242-2244-39
Fax: 43-7242-2244-393
Denmark - Copenhagen
Tel: 45-4450-2828
Fax: 45-4485-2829
India - Pune
Tel: 91-20-2566-1512
Fax: 91-20-2566-1513
France - Paris
Tel: 33-1-69-53-63-20
Fax: 33-1-69-30-90-79
Japan - Yokohama
Tel: 81-45-471- 6166
Fax: 81-45-471-6122
Germany - Munich
Tel: 49-89-627-144-0
Fax: 49-89-627-144-44
Atlanta
Duluth, GA
Tel: 678-957-9614
Fax: 678-957-1455
Boston
Westborough, MA
Tel: 774-760-0087
Fax: 774-760-0088
Chicago
Itasca, IL
Tel: 630-285-0071
Fax: 630-285-0075
Dallas
Addison, TX
Tel: 972-818-7423
Fax: 972-818-2924
Detroit
Farmington Hills, MI
Tel: 248-538-2250
Fax: 248-538-2260
Kokomo
Kokomo, IN
Tel: 765-864-8360
Fax: 765-864-8387
Los Angeles
Mission Viejo, CA
Tel: 949-462-9523
Fax: 949-462-9608
Santa Clara
Santa Clara, CA
Tel: 408-961-6444
Fax: 408-961-6445
Toronto
Mississauga, Ontario,
Canada
Tel: 905-673-0699
Fax: 905-673-6509
Australia - Sydney
Tel: 61-2-9868-6733
Fax: 61-2-9868-6755
China - Beijing
Tel: 86-10-8528-2100
Fax: 86-10-8528-2104
China - Chengdu
Tel: 86-28-8665-5511
Fax: 86-28-8665-7889
Korea - Gumi
Tel: 82-54-473-4301
Fax: 82-54-473-4302
China - Fuzhou
Tel: 86-591-8750-3506
Fax: 86-591-8750-3521
Korea - Seoul
Tel: 82-2-554-7200
Fax: 82-2-558-5932 or
82-2-558-5934
Malaysia - Penang
Tel: 60-4-646-8870
Fax: 60-4-646-5086
China - Qingdao
Tel: 86-532-8502-7355
Fax: 86-532-8502-7205
Philippines - Manila
Tel: 63-2-634-9065
Fax: 63-2-634-9069
China - Shanghai
Tel: 86-21-5407-5533
Fax: 86-21-5407-5066
Singapore
Tel: 65-6334-8870
Fax: 65-6334-8850
China - Shenyang
Tel: 86-24-2334-2829
Fax: 86-24-2334-2393
China - Shenzhen
Tel: 86-755-8203-2660
Fax: 86-755-8203-1760
Taiwan - Kaohsiung
Tel: 886-7-536-4818
Fax: 886-7-536-4803
China - Shunde
Tel: 86-757-2839-5507
Fax: 86-757-2839-5571
Taiwan - Taipei
Tel: 886-2-2500-6610
Fax: 886-2-2508-0102
China - Wuhan
Tel: 86-27-5980-5300
Fax: 86-27-5980-5118
Thailand - Bangkok
Tel: 66-2-694-1351
Fax: 66-2-694-1350
Italy - Milan
Tel: 39-0331-742611
Fax: 39-0331-466781
Netherlands - Drunen
Tel: 31-416-690399
Fax: 31-416-690340
Spain - Madrid
Tel: 34-91-708-08-90
Fax: 34-91-708-08-91
UK - Wokingham
Tel: 44-118-921-5869
Fax: 44-118-921-5820
China - Xian
Tel: 86-29-8833-7250
Fax: 86-29-8833-7256
12/08/06
DS41202F-page 190