Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Data Sheet
14-Pin Flash-Based, 8-Bit
CMOS Microcontrollers with
nanoWatt Technology
• Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
• Microchip is willing to work with the customer who is concerned about the integrity of their code.
• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
VDD 1 14 VSS
RA5/T1CKI/OSC1/CLKIN 2 13 RA0/AN0/C1IN+/ICSPDAT/ULPWU
PIC16F684
RA4/AN3/T1G/OSC2/CLKOUT 3 12 RA1/AN1/C1IN-/VREF/ICSPCLK
RA3/MCLR/VPP 4 11 RA2/AN2/T0CKI/INT/C1OUT
RC5/CCP1/P1A 5 10 RC0/AN4/C2IN+
RC4/C2OUT/P1B 6 9 RC1/AN5/C2IN-
RC3/AN7/P1C 7 8 RC2/AN6/P1D
VDD
VSS
NC
NC
16
15
14
13
RA5/T1CKI/OSC1/CLKIN 1 12 RA0/AN0/C1IN+/ICSPDAT/ULPWU
RA4/AN3/T1G/OSC2/CLKOUT 2 11 RA1/AN1/C1IN-/VREF/ICSPCLK
PIC16F684
RA3/MCLR/VPP 3 10 RA2/AN2/T0CKI/INT/C1OUT
RC5/CCP1/P1A 4 9 RC0/AN4/C2IN+
8
RC1/AN5/C2IN-
RC3/AN7/P1C
RC2/AN6/P1D
RC4/C2OUT/P1B
Errata
An errata sheet, describing minor operational differences from the data sheet and recommended workarounds, may exist for current
devices. As device/documentation issues become known to us, we will publish an errata sheet. The errata will specify the revision of
silicon and revision of document to which it applies.
To determine if an errata sheet exists for a particular device, please check with one of the following:
• Microchip’s Worldwide Web site; http://www.microchip.com
• Your local Microchip sales office (see last page)
When contacting a sales office, please specify which device, revision of silicon and data sheet (include literature number) you are
using.
T1CKI
Timer0 Timer1 Timer2 ECCP
T0CKI
Stack Level 8
On-chip Program
Memory
07FFh
0800h
Wraps to 0000h-07FFh
1FFFh
96 Bytes
6Fh
70 F0h
Accesses 70h-7Fh
7Fh FFh
Bank 0 Bank 1
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 Timer0 Module’s Register xxxx xxxx 43, 104
02h PCL Program Counter’s (PC) Least Significant Byte 0000 0000 19, 104
03h STATUS IRP(1) RP1(1) RP0 TO PD Z DC C 0001 1xxx 13, 104
04h FSR Indirect Data Memory Address Pointer xxxx xxxx 19, 104
05h PORTA(2) — — RA5 RA4 RA3 RA2 RA1 RA0 --x0 x000 31, 104
06h — Unimplemented — —
07h PORTC(2) — — RC5 RC4 RC3 RC2 RC1 RC0 --xx 0000 40, 104
08h — Unimplemented — —
09h — Unimplemented — —
0Ah PCLATH — — — Write Buffer for upper 5 bits of Program Counter ---0 0000 19, 104
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 xxxx xxxx 47, 104
0Fh TMR1H Holding Register for the Most Significant Byte of the 16-bit TMR1 Register xxxx xxxx 47, 104
10h T1CON T1GINV TMR1GE T1CKPS1 T1CKPS0 T1OSCEN T1SYNC TMR1CS TMR1ON 0000 0000 50, 104
11h TMR2 Timer2 Module Register 0000 0000 53, 104
12h T2CON — TOUTPS3 TOUTPS2 TOUTPS1 TOUTPS0 TMR2ON T2CKPS1 T2CKPS0 -000 0000 54, 104
13h CCPR1L Capture/Compare/PWM Register 1 Low Byte XXXX XXXX 80, 104
14h CCPR1H Capture/Compare/PWM Register 1 High Byte XXXX XXXX 80, 104
15h CCP1CON P1M1 P1M0 DC1B1 DC1B0 CCP1M3 CCP1M2 CCP1M1 CCP1M0 0000 0000 79, 104
16h PWM1CON PRSEN PDC6 PDC5 PDC4 PDC3 PDC2 PDC1 PDC0 0000 0000 96, 104
17h ECCPAS ECCPASE ECCPAS2 ECCPAS1 ECCPAS0 PSSAC1 PSSAC0 PSSBD1 PSSBD0 0000 0000 93, 104
18h WDTCON — — — WDTPS3 WDTPS2 WDTPS1 WDTPS0 SWDTEN ---0 1000 111, 104
19h CMCON0 C2OUT C1OUT C2INV C1INV CIS CM2 CM1 CM0 0000 0000 61, 104
1Ah CMCON1 — — — — — — T1GSS C2SYNC ---- --10 62, 104
1Bh — Unimplemented — —
1Ch — Unimplemented — —
1Dh — Unimplemented — —
1Eh ADRESH Most Significant 8 bits of the left shifted A/D result or 2 bits of right shifted result xxxx xxxx 71, 104
1Fh ADCON0 ADFM VCFG — CHS2 CHS1 CHS0 GO/DONE ADON 00-0 0000 70, 104
Legend: – = Unimplemented locations read as ‘0’, u = unchanged, x = unknown, q = value depends on condition, shaded = unimplemented
Note 1: IRP and RP1 bits are reserved, always maintain these bits clear.
2: 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).
Bank 1
80h INDF Addressing this location uses contents of FSR to address data memory (not a physical register) xxxx xxxx 19, 104
81h OPTION_REG RAPU INTEDG T0CS T0SE PSA PS2 PS1 PS0 1111 1111 14, 104
82h PCL Program Counter’s (PC) Least Significant Byte 0000 0000 19, 104
83h STATUS IRP(1) RP1(1) RP0 TO PD Z DC C 0001 1xxx 13, 104
84h FSR Indirect Data Memory Address Pointer xxxx xxxx 19, 104
85h TRISA — — TRISA5 TRISA4 TRISA3 TRISA2 TRISA1 TRISA0 --11 1111 31, 104
86h — Unimplemented — —
87h TRISC — — TRISC5 TRISC4 TRISC3 TRISC2 TRISC1 TRISC0 --11 1111 40, 104
88h — Unimplemented — —
89h — Unimplemented — —
8Ah PCLATH — — — Write Buffer for upper 5 bits of Program Counter ---0 0000 19, 104
8Bh INTCON GIE PEIE T0IE INTE RAIE T0IF INTF RAIF 0000 0000 15, 104
8Ch PIE1 EEIE ADIE CCP1IE C2IE C1IE OSFIE TMR2IE TMR1IE 0000 0000 16, 104
8Dh — Unimplemented — —
8Eh PCON — — ULPWUE SBOREN — — POR BOR --01 --qq 18, 104
8Fh OSCCON — IRCF2 IRCF1 IRCF0 OSTS(2) HTS LTS SCS -110 x000 20, 104
90h OSCTUNE — — — TUN4 TUN3 TUN2 TUN1 TUN0 ---0 0000 24, 105
91h ANSEL ANS7 ANS6 ANS5 ANS4 ANS3 ANS2 ANS1 ANS0 1111 1111 32, 105
92h PR2 Timer2 Module Period Register 1111 1111 53, 105
93h — Unimplemented — —
94h — Unimplemented — —
95h WPUA(3) — — WPUA5 WPUA4 — WPUA2 WPUA1 WPUA0 --11 -111 33, 105
96h IOCA — — IOCA5 IOCA4 IOCA3 IOCA2 IOCA1 IOCA0 --00 0000 33, 105
97h — Unimplemented — —
98h — Unimplemented — —
99h VRCON VREN — VRR — VR3 VR2 VR1 VR0 0-0- 0000 63, 105
9Ah EEDAT EEDAT7 EEDAT6 EEDAT5 EEDAT4 EEDAT3 EEDAT2 EEDAT1 EEDAT0 0000 0000 75, 105
9Bh EEADR EEADR7 EEADR6 EEADR5 EEADR4 EEADR3 EEADR2 EEADR1 EEADR0 0000 0000 75, 105
9Ch EECON1 — — — — WRERR WREN WR RD ---- x000 76, 105
9Dh EECON2 EEPROM Control Register 2 (not a physical register) ---- ---- 76, 105
9Eh ADRESL Least Significant 2 bits of the left shifted result or 8 bits of the right shifted result xxxx xxxx 71, 105
9Fh ADCON1 — ADCS2 ADCS1 ADCS0 — — — — -000 ---- 70, 105
Legend: – = Unimplemented locations read as ‘0’, u = unchanged, x = unknown, q = value depends on condition, shaded = unimplemented
Note 1: IRP and RP1 bits are reserved, always maintain these bits clear.
2: OSTS bit of the OSCCON register reset to ‘0’ with Dual Speed Start-up and LP, HS or XT selected as the oscillator.
3: RA3 pull-up is enabled when MCLRE is ‘1’ in the Configuration Word register.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: For Borrow, the polarity is reversed. A subtraction is executed by adding the two’s complement of the sec-
ond operand. For rotate (RRF, RLF) instructions, this bit is loaded with either the high-order or low-order bit
of the source register.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: BOREN<1:0> = 01 in the Configuration Word register for this bit to control the BOR.
7Fh 1FFh
Bank 0 Bank 1 Bank 2 Bank 3
FOSC<2:0>
(Configuration Word Register)
External Oscillator SCS<0>
(OSCCON Register)
OSC2
Sleep
LP, XT, HS, RC, RCIO, EC
OSC1
MUX
IRCF<2:0>
(OSCCON Register) System Clock
(CPU and Peripherals)
8 MHz
111 INTOSC
Internal Oscillator 4 MHz
110
2 MHz
101
Postscaler
1 MHz
MUX
HFINTOSC 100
500 kHz
8 MHz 011
250 kHz
010
125 kHz
001
LFINTOSC 31 kHz
000
31 kHz
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
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.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
HFINTOSC
Start-up Time 2-cycle Sync Running
LFINTOSC
IRCF <2:0> ≠0 =0
System Clock
HFINTOSC
2-cycle Sync Running
LFINTOSC
IRCF <2:0> ≠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 ¼0
System Clock
HFINTOSC
TOST
OSC2
Program Counter PC - N PC PC + 1
System Clock
Sample Clock
System Oscillator
Clock Failure
Output
Note: 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.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: Setting a pin to an analog input automatically disables the digital input circuitry, weak pull-ups and
interrupt-on-change, if available. The corresponding TRIS bit must be set to Input mode in order to allow
external control of the voltage on the pin.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: Global Interrupt Enable (GIE) must be enabled for individual interrupts to be recognized.
2: IOCA<5:4> always reads ‘1’ in XT, HS and LP OSC modes.
WR CK Q
WPUA RAPU
RD VDD
WPUA
D Q
WR CK Q I/O Pin
PORTA
VSS
-
+ VT
D Q
WR CK Q
TRISA IULP
0 1
RD
TRISA Analog(1) VSS
Input Mode
ULPWUE
RD
PORTA
D Q
CK Q Q D
WR
IOCA
EN Q3
RD
IOCA Q D
EN
Interrupt-on-
Change
RD PORTA
To Comparator
To A/D Converter
D Q
VDD FIGURE 4-3: BLOCK DIAGRAM OF RA2
WR CK Q Analog(1)
PORTA Data Bus Input Mode
D Q VDD
I/O Pin WR
D Q CK Q Weak
WPUA
WR CK Q
TRISA VSS RD RAPU
Analog(1) WPUA
RD Input Mode
C1OUT
TRISA
Enable
VDD
D Q
RD
PORTA WR CK Q
D Q PORTA C1OUT 1
CK Q Q D 0
WR I/O Pin
IOCA D Q
EN Q3
RD WR CK
TRISA Q VSS
IOCA Q D
Analog(1)
RD Input Mode
EN
Interrupt-on- TRISA
Change
RD
RD PORTA PORTA
To Comparator D Q
To A/D Converter Q D
WR CK Q
IOCA
Note 1: Comparator mode and ANSEL determines Analog EN Q3
Input mode. RD
IOCA Q D
EN
Interrupt-on-
Change
RD PORTA
To Timer0
To INT
To A/D Converter
CK Q D
WR Q
IOCA
EN Q3
RD
IOCA Q D
EN
Interrupt-on-
Change
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.
INTOSC
Mode
TMR1LPEN(1)
Data Bus
D Q VDD
WR CK Weak
WPUA Q
RAPU
RD
WPUA
Oscillator
Circuit
OSC2 VDD
D Q
WR CK
PORTA Q
I/O Pin
D Q
WR CK
TRISA Q VSS
INTOSC
RD Mode
TRISA
RD
PORTA
D Q
CK Q D
WR Q
IOCA
EN Q3
RD
IOCA
Q D
EN
Interrupt-on-
Change
RD PORTA
To Timer1
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
FIGURE 4-7: BLOCK DIAGRAM OF RC0 FIGURE 4-8: BLOCK DIAGRAM OF RC2
AND RC1 AND RC3
Data Bus
Data Bus
CCPOUT
Enable
VDD VDD
D Q D Q
WR CK WR CK
PORTC Q Q
PORTC CCPOUT 1
RD RD
PORTC PORTC
To Comparators
To A/D Converter
To A/D Converter
Note 1: Analog Input mode comes from ANSEL.
1
CCPOUT EN
CCPOUT RD
0 TRISC
Data Bus I/O Pin
D Q
RD
WR PORTC
CK Q VSS
PORTC
To Enhanced CCP
D Q
WR CK Q
TRISC
RD
TRISC
RD
PORTC
FOSC/4
Data Bus
0
8
1
Sync 2
1 cycles TMR0
T0CKI 0
pin 0
T0SE T0CS Set Flag bit T0IF
8-bit
on Overflow
Prescaler PSA
1
8
WDTE PSA
3
SWDTEN
PS<2:0> 1
WDT
16-bit Time-out
Prescaler 0
16
31 kHz Watchdog
INTOSC Timer PSA
WDTPS<3:0>
Note 1: T0SE, T0CS, PSA, PS<2:0> are bits in the OPTION register.
2: SWDTEN and WDTPS<3:0> are bits in the WDTCON register.
3: WDTE bit is in the Configuration Word register.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: A dedicated 16-bit WDT postscaler is available. See Section 12.6 “Watchdog Timer (WDT)” for more
information.
TMR1GE
T1GINV
TMR1ON
Set flag bit
TMR1IF on To C2 Comparator Module
Overflow (1) Timer1 Clock
TMR1
Synchronized
EN 0 clock input
TMR1H TMR1L
1
Oscillator
* T1SYNC
OSC1/T1CKI 1
Synchronize
Prescaler
FOSC/4 1, 2, 4, 8 det(2)
Internal 0
OSC2/T1G Clock 2
T1CKPS<1:0>
TMR1CS
1
T1OSCEN
FOSC = 100 C2OUT 0
FOSC = 000
T1GSS
Sleep
* ST Buffer is low power type when using LP osc, or high speed type when using T1CKI.
Note 1: Timer1 register increments on rising edge.
2: Synchronize does not operate while in Sleep.
T1CKI = 1
when TMR1
Enabled
T1CKI = 0
when TMR1
Enabled
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: T1GINV bit inverts the Timer1 gate logic, regardless of source.
2: TMR1GE bit must be set to use either T1G pin or C2OUT, as selected by the T1GSS bit of the CMCON1
register, as a Timer1 gate source.
Sets Flag
TMR2
bit TMR2IF
Output
Prescaler Reset
FOSC/4 TMR2
1:1, 1:4, 1:16
2 Postscaler
Comparator
EQ 1:1 to 1:16
T2CKPS<1:0>
PR2 4
TOUTPS<3:0>
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
MULTIPLEX
C1INV
Port Pins
To C1OUT pin
C1
To Data Bus
D Q
Q1
EN RD CMCON0
Q3*RD CMCON0
EN
CL
Reset
C2SYNC
To Timer1 Gate
MULTIPLEX
C2INV
Port Pins
0
C2 To C2OUT pin
D Q 1
Timer1
clock source(1)
To Data Bus
D Q
Q1
EN RD CMCON0
Q3*RD CMCON0
EN
CL
Reset
VT ≈ 0.6V RIC
Rs < 10K
To ADC Input
AIN
CPIN ILEAKAGE
VA VT ≈ 0.6V ±500 nA
5 pF
Vss
C2IN-
A VIN- C2IN-
A VIN-
VIN+ C2 Off(1) VIN+ C2 C2OUT
C2IN+ A C2IN+ A
A VIN- C2IN-
A VIN-
C2IN-
A VIN+ C2 C2OUT A VIN+ C2 C2OUT
C2IN+ C2IN+
Four Inputs Multiplexed to Two Comparators Two Common Reference Comparators with Outputs
CM<2:0> = 010 CM<2:0> = 110
C1IN-
A
C1IN-
A VIN-
CIS = 0 VIN-
A CIS = 1 VIN+ C1 C1OUT
C1IN+ C1 C1OUT
VIN+
C1OUT(pin) D
A
C2IN- CIS = 0 VIN-
C2IN-
A VIN-
A CIS = 1
C2IN+ C2 C2OUT
VIN+ A VIN+ C2 C2OUT
C2IN+
C2OUT(pin) D
From CVREF Module
C2IN-
A VIN- C2IN-
I/O VIN-
A VIN+ C2 C2OUT I/O VIN+ C2 Off(1)
C2IN+ C2IN+
Legend: A = Analog Input, ports always reads ‘0’ CIS = Comparator Input Switch (CMCON0<3>)
I/O = Normal port I/O D = Comparator Digital Output
Note 1: Reads as ‘0’, unless CxINV = 1.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
16 Stages
8R R R R R
VDD
8R VRR
16-1 Analog
MUX
VREN
15
CVREF to 14
Comparator 2
Input 1
0
VR<3:0>(1)
VREN
VR<3:0> = 0000
VRR
TABLE 8-2: SUMMARY OF REGISTERS ASSOCIATED WITH THE COMPARATOR AND VOLTAGE
REFERENCE MODULES
Value on
Value on:
Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 all other
POR, BOR
Resets
ANSEL 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 — — TRISA5 TRISA4 TRISA3 TRISA2 TRISA1 TRISA0 --11 1111 --11 1111
TRISC — — TRISC5 TRISC4 TRISC3 TRISC2 TRISC1 TRISC0 --11 1111 --11 1111
VRCON VREN — VRR — VR3 VR2 VR1 VR0 0-0- 0000 0-0- 0000
Legend: x = unknown, u = unchanged, - = unimplemented, read as ‘0’. Shaded cells are not used for comparator.
VDD
VCFG = 0
VREF VCFG = 1
RA0/AN0
RA1/AN1/VREF
A/D
RA2/AN2
GO/DONE 10
RA4/AN3
RC0/AN4
0 = Left Justify
RC1/AN5 ADFM
1 = Right Justify
RC2/AN6 ADON 10
RC3/AN7
VSS ADRESH ADRESL
4
CHS <3:0>
TABLE 9-1: ADC CLOCK PERIOD (TAD) VS. DEVICE OPERATING FREQUENCIES (VDD > 3.0V)
ADC Clock Period (TAD) Device Frequency (FOSC)
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)
ADRESH ADRESL
(ADFM = 0) MSB LSB
bit 7 bit 0 bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
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.
VA CPIN I LEAKAGE
VT = 0.6V CHOLD = 10 pF
5 pF ± 500 nA
VSS/VREF-
6V
5V RSS
Legend: CPIN = Input Capacitance VDD 4V
VT = Threshold Voltage 3V
I LEAKAGE = Leakage current at the pin due to 2V
various junctions
RIC = Interconnect Resistance 5 6 7 8 9 10 11
SS = Sampling Switch Sampling Switch
CHOLD = Sample/Hold Capacitance (kΩ)
Full-Scale Range
3FFh
3FEh
3FDh
3FCh
ADC Output Code
1 LSB ideal
3FBh
Full-Scale
004h Transition
003h
002h
001h
000h Analog Input Voltage
1 LSB ideal
ADCON0 ADFM VCFG — CHS2 CHS1 CHS0 GO/DONE ADON 0000 0000 0000 0000
ADCON1 — ADCS2 ADCS1 ADCS0 — — — — -000 ---- -000 ----
ANSEL ANS7 ANS6 ANS5 ANS4 ANS3 ANS2 ANS1 ANS0 1111 1111 1111 1111
ADRESH A/D Result Register High Byte xxxx xxxx uuuu uuuu
ADRESL A/D Result Register Low Byte xxxx xxxx uuuu uuuu
INTCON GIE PEIE T0IE INTE RAIE T0IF INTF RAIF 0000 0000 0000 0000
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
PORTC — — RC5 RC4 RC3 RC2 RC1 RC0 --xx 0000 --uu uuuu
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.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 7-0 EEDATn: Byte Value to Write To or Read From Data EEPROM bits
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 7-0 EEADR: Specifies One of 256 Locations for EEPROM Read/Write Operation bits
The WREN bit, when set, will allow a write operation. Note: The EECON1, EEDAT and EEADR
On power-up, the WREN bit is clear. The WRERR bit is registers should not be modified during a
set when a write operation is interrupted by a MCLR data EEPROM write (WR bit = 1).
Reset, or a WDT Time-out Reset during normal
Legend:
S = Bit can only be set
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
EXAMPLE 10-2: DATA EEPROM WRITE 10.4.1 USING THE DATA EEPROM
BANKSEL EECON1 ; The data EEPROM is a high-endurance, byte
BSF EECON1,WREN ;Enable write addressable array that has been optimized for the
BCF INTCON,GIE ;Disable INTs
storage of frequently changing information (e.g.,
BTFSC INTCON,GIE ;See AN576
program variables or other data that are updated often).
GOTO $-2 ;
MOVLW 55h ;Unlock write When variables in one section change frequently, while
variables in another section do not change, it is possible
Sequence
Required
MOVWF EECON2 ;
MOVLW AAh ; to exceed the total number of write cycles to the
MOVWF EECON2 ; EEPROM (specification D124) without exceeding the
BSF EECON1,WR ;Start the write total number of write cycles to a single byte
BSF INTCON,GIE ;Enable INTS (specifications D120 and D120A). If this is the case,
then a refresh of the array must be performed. For this
The write will not initiate if the above sequence is not reason, variables that change infrequently (such as
exactly followed (write 55h to EECON2, write AAh to constants, IDs, calibration, etc.) should be stored in
EECON2, then set WR bit) for each byte. We strongly Flash program memory.
recommend that interrupts be disabled during this
code segment. A cycle count is executed during the
required sequence. Any number that is not equal to the
required cycles to execute the required sequence will
prevent the data from being written into the EEPROM.
Additionally, the WREN bit in EECON1 must be set to
enable write. This mechanism prevents accidental
writes to data EEPROM due to errant (unexpected)
code execution (i.e., lost programs). The user should
keep the WREN bit clear at all times, except when
updating EEPROM. The WREN bit is not cleared
by hardware.
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
PIE1 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 EEADR7 EEADR6 EEADR5 EEADR4 EEADR3 EEADR2 EEADR1 EEADR0 0000 0000 0000 0000
EECON1 — — — — WRERR WREN WR RD ---- x000 ---- q000
EECON2(1) EEPROM Control Register 2 ---- ---- ---- ----
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: EECON2 is not a physical register.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
CCPR1L
CCPR1H(2) (Slave)
CCP1
Comparator R Q
(1) S
TMR2
TRIS
Comparator
Clear Timer2,
toggle CCP1 pin and
latch duty cycle
PR2
FIGURE 11-5: EXAMPLE SIMPLIFIED BLOCK DIAGRAM OF THE ENHANCED PWM MODE
CCP1<1:0> P1M<1:0> CCP1M<3:0>
Duty Cycle Registers
2 4
CCPR1L
CCP1/P1A CCP1/P1A
TRIS
CCPR1H (Slave)
P1B P1B
Output TRIS
Comparator R Q
Controller
P1C
P1C
TMR2 (1)
S TRIS
P1D P1D
Comparator
Clear Timer2, TRIS
toggle PWM pin and
latch duty cycle
PR2 PWM1CON
Note 1: 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: EXAMPLE PIN ASSIGNMENTS FOR VARIOUS PWM ENHANCED MODES
ECCP Mode P1M CCP1/P1A P1B P1C P1D
Single 00 Yes No No No
Half-Bridge 10 Yes Yes No No
Full-Bridge, Forward 01 Yes Yes Yes Yes
Full-Bridge, Reverse 11 Yes Yes Yes Yes
P1A Active
P1D Modulated
P1A Inactive
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”).
Pulse PR2+1
P1M<1:0> Signal 0
Width
Period
P1A Modulated
Delay(1) Delay(1)
10 (Half-Bridge) P1B Modulated
P1A Active
P1D Modulated
P1A Inactive
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”).
FET
Driver +
P1A
-
Load
FET
Driver
+
P1B
-
V+
FET FET
Driver Driver
P1A
Load
FET FET
Driver Driver
P1B
FET QA QC FET
Driver Driver
P1A
Load
P1B
FET FET
Driver Driver
P1C
QB QD
V-
P1D
P1B(2)
P1C(2)
P1D(2)
(1) (1)
Reverse Mode
Period
Pulse Width
P1A(2)
P1B(2)
P1C(2)
P1D(2)
(1) (1)
Note 1: At this time, the TMR2 register is equal to the PR2 register.
2: Output signal is shown as active-high.
P1A (Active-High)
P1B (Active-High)
Pulse Width
P1C (Active-High)
(2)
P1D (Active-High)
Pulse Width
Note 1: The direction bit P1M1 of the CCP1CON register is written any time during the PWM cycle.
2: 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.
P1A
P1B
DC
P1C
P1D PW
TON
External Switch C
TOFF
External Switch D
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
PWM Period
Shutdown Event
ECCPASE bit
PWM Activity
Normal PWM
ECCPASE
Cleared by
Start of Shutdown Shutdown Firmware PWM
PWM Period Event Occurs Event Clears Resumes
PWM Period
Shutdown Event
ECCPASE bit
PWM Activity
Normal PWM
FET
Driver +
P1A V
-
Load
FET
Driver
+
P1B V
-
V-
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
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: SUMMARY OF REGISTERS ASSOCIATED WITH CAPTURE, COMPARE AND PWM
Value on
Value on:
Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 all other
POR, BOR
Resets
CCPR1L Capture/Compare/PWM Register 1 Low Byte xxxx xxxx uuuu uuuu
CCPR1H Capture/Compare/PWM Register 1 High Byte xxxx xxxx uuuu uuuu
CCP1CON P1M1 P1M0 DC1B1 DC1B0 CCP1M3 CCP1M2 CCP1M1 CCP1M0 0000 0000 0000 0000
CMCON0 C2OUT C1OUT C2INV C1INV CIS CM2 CM1 CM0 0000 0000 0000 0000
CMCON1 — — — — — — T1GSS C2SYNC ---- --10 ---- --10
ECCPAS ECCPASE ECCPAS2 ECCPAS1 ECCPAS0 PSSAC1 PSSAC0 PSSBD1 PSSBD0 0000 0000 0000 0000
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 Timer2 Module Period Register 1111 1111 1111 1111
PWM1CON PRSEN PDC6 PDC5 PDC4 PDC3 PDC2 PDC1 PDC0 0000 0000 0000 0000
T1CON T1GINV TMR1GE T1CKPS1 T1CKPS0 T1OSCEN T1SYNC TMR1CS TMR1ON 0000 0000 uuuu uuuu
T2CON — 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 xxxx xxxx uuuu uuuu
TMR1H Holding Register for the Most Significant Byte of the 16-bit TMR1 Register xxxx xxxx uuuu uuuu
TMR2 Timer2 Module Register 0000 0000 0000 0000
TRISA — — TRISA5 TRISA4 TRISA3 TRISA2 TRISA1 TRISA0 --11 1111 --11 1111
TRISC — — TRISC5 TRISC4 TRISC3 TRISC2 TRISC1 TRISC0 --11 1111 --11 1111
Legend: - = Unimplemented locations, read as ‘0’, u = unchanged, x = unknown. Shaded cells are not used by the Capture,
Compare and PWM.
Legend:
R = Readable bit W = Writable bit P = Programmable’ U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: Enabling Brown-out Reset does not automatically enable Power-up Timer.
2: The entire data EEPROM will be erased when the code protection is turned off.
3: The entire program memory will be erased when the code protection is turned off.
4: When MCLR is asserted in INTOSC or RC mode, the internal clock oscillator is disabled.
External
Reset
MCLR/VPP pin
SLEEP
WDT WDT
Module Time-out
Reset
VDD Rise
Detect
Power-on Reset
VDD
Brown-out(1)
Reset BOREN
SBOREN S
OST/PWRT
OST
Chip_Reset
10-bit Ripple Counter R Q
OSC1/
CLKI pin
PWRT
LFINTOSC 11-bit Ripple Counter
Enable PWRT
Enable OST
Internal
Reset 64 ms(1)
VDD
VBOR
Internal < 64 ms
Reset 64 ms(1)
VDD
VBOR
Internal
Reset 64 ms(1)
XT, HS, LP TPWRT + 1024 • 1024 • TOSC TPWRT + 1024 • 1024 • TOSC 1024 • TOSC
TOSC TOSC
RC, EC, INTOSC TPWRT — TPWRT — —
VDD
MCLR
Internal POR
TPWRT
OST Time-out
Internal Reset
VDD
MCLR
Internal POR
TPWRT
OST Time-out
Internal Reset
VDD
MCLR
Internal POR
TPWRT
PWRT Time-out
TOST
OST Time-out
Internal Reset
The peripheral interrupt flags are contained in the PIR1 Note: The ANSEL and CMCON0 registers must
register. The corresponding interrupt enable bit is be initialized to configure an analog
contained in the PIE1 register. channel as a digital input. Pins configured
as analog inputs will read ‘0’ and cannot
The following interrupt flags are contained in the PIR1
generate an interrupt.
register:
• EEPROM Data Write Interrupt
• A/D Interrupt
• 2 Comparator Interrupts
• Timer1 Overflow Interrupt
• Timer2 Match Interrupt
• Fail-Safe Clock Monitor Interrupt
• Enhanced CCP Interrupt
IOC-RA0
IOCA0
IOC-RA1
IOCA1
IOC-RA2
IOCA2
IOC-RA3
IOCA3
IOC-RA4
IOCA4
IOC-RA5
IOCA5
C2IF GIE
C2IE
ADIF
ADIE
EEIF
EEIE
OSFIF Note 1: Some peripherals depend upon the system clock for
OSFIE operation. Since the system clock is suspended during Sleep, only
CCP1IF those peripherals which do not depend upon the system clock will wake
CCP1IE the part from Sleep. See Section 12.7.1 “Wake-up from Sleep”.
Q1 Q2 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 (5) Interrupt Latency (2)
(INTCON reg.)
GIE bit
(INTCON reg.)
INSTRUCTION FLOW
PC PC PC + 1 PC + 1 0004h 0005h
Instruction
Fetched Inst (PC) Inst (PC + 1) — Inst (0004h) Inst (0005h)
Prescaler(1)
1
16-bit WDT Prescaler
PSA
PS<2:0>
31 kHz
WDTPS<3:0> To Timer0
LFINTOSC Clock
0 1
PSA
Note 1: This is the shared Timer0/WDT prescaler. See Section 5.0 “Timer0 Module” for more information.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
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
CLKOUT(4) TOST(2)
INT pin
INTF flag
(INTCON reg.) Interrupt Latency (3)
GIE bit
(INTCON reg.) Processor in
Sleep
Instruction Flow
PC PC PC + 1 PC + 2 PC + 2 PC + 2 0004h 0005h
Instruction Inst(PC + 1) Inst(PC + 2) Inst(0004h) Inst(0005h)
Fetched Inst(PC) = Sleep
Instruction Sleep Inst(PC + 1) Dummy Cycle Dummy Cycle
Executed Inst(PC – 1) Inst(0004h)
12.9 ID Locations
Four memory locations (2000h-2003h) are designated
as ID locations where the user can store checksum or
other code identification numbers. These locations are
not accessible during normal execution but are
readable and writable during Program/Verify mode.
Only the Least Significant 7 bits of the ID locations are
used.
FIGURE 12-11: TYPICAL IN-CIRCUIT For more information, see “MPLAB® ICD 2 In-Circuit
Debugger User’s Guide” (DS51331), available on
SERIAL PROGRAMMING
Microchip’s web site (www.microchip.com).
CONNECTION
To Normal FIGURE 12-12: 20-PIN ICD PINOUT
Connections
External 20-Pin PDIP
Connector * In-Circuit Debug Device
Signals PIC16F684
NC 1 20 ICDCLK
+5V VDD
ICDMCLR/VPP 2 19 ICDDATA
0V VSS
PIC16F684-ICD
VDD 3 18 Vss
VPP MCLR/VPP/RA3 RA5 4 17 RA0
RA1 RA4 5 16 RA1
CLK
RA3 6 15 RA2
Data I/O RA0 RC5 7 RC0
14
RC4 8 13 RC1
RC3 9 12 RC2
ICD 10 11 NC
* * *
To Normal
Connections
* Isolation devices (as required)
Before Instruction
W = 0x07
After Instruction
W = value of k8
C=0 W>f
C=1 W≤f
DC = 0 W<3:0> > f<3:0>
DC = 1 W<3:0> ≤ f<3:0>
† 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.
5.5
5.0
4.5
VDD (V)
4.0
3.5
3.0
2.5
2.0
0 8 10 20
Frequency (MHz)
Note 1: The shaded region indicates the permissible combinations of voltage and frequency.
FIGURE 15-2: HFINTOSC FREQUENCY ACCURACY OVER DEVICE VDD AND TEMPERATURE
125
± 5%
85
Temperature (°C)
± 2%
60
25 ± 1%
VDD (V)
Param Conditions
Device Characteristics Min Typ† Max Units
No. VDD Note
(1, 2)
D010 Supply Current (IDD) — 11 16 μA 2.0 FOSC = 32 kHz
— 18 28 μA 3.0 LP Oscillator mode
— 35 54 μA 5.0
D011* — 140 240 μA 2.0 FOSC = 1 MHz
— 220 380 μA 3.0 XT Oscillator mode
— 380 550 μA 5.0
D012 — 260 360 μA 2.0 FOSC = 4 MHz
— 420 650 μA 3.0 XT Oscillator mode
— 0.8 1.1 mA 5.0
D013* — 130 220 μA 2.0 FOSC = 1 MHz
— 215 360 μA 3.0 EC Oscillator mode
— 360 520 μA 5.0
D014 — 220 340 μA 2.0 FOSC = 4 MHz
— 375 550 μA 3.0 EC Oscillator mode
— 0.65 1.0 mA 5.0
D015 — 8 20 μA 2.0 FOSC = 31 kHz
— 16 40 μA 3.0 LFINTOSC mode
— 31 65 μA 5.0
D016* — 340 450 μA 2.0 FOSC = 4 MHz
— 500 700 μA 3.0 HFINTOSC mode
— 0.8 1.2 mA 5.0
D017 — 410 650 μA 2.0 FOSC = 8 MHz
— 700 950 μA 3.0 HFINTOSC mode
— 1.30 1.65 mA 5.0
D018 — 230 400 μA 2.0 FOSC = 4 MHz
— 400 680 μA 3.0 EXTRC mode(3)
— 0.63 1.1 mA 5.0
D019 — 2.6 3.25 mA 4.5 FOSC = 20 MHz
— 2.8 3.35 mA 5.0 HS Oscillator mode
* These parameters are characterized but not tested.
† Data in ‘Typ’ column is at 5.0V, 25°C unless otherwise stated. These parameters are for design guidance
only and are not tested.
Note 1: The test conditions for all IDD measurements in active operation mode are: OSC1 = external square wave,
from rail-to-rail; all I/O pins tri-stated, pulled to VDD; MCLR = VDD; WDT disabled.
2: The supply current is mainly a function of the operating voltage and frequency. Other factors, such as I/O
pin loading and switching rate, oscillator type, internal code execution pattern and temperature, also have
an impact on the current consumption.
3: For RC oscillator configurations, current through REXT is not included. The current through the resistor can
be extended by the formula IR = VDD/2REXT (mA) with REXT in kΩ.
Param Conditions
Device Characteristics Min Typ† Max Units
No. VDD Note
D020 Power-down Base — 0.05 1.2 μA 2.0 WDT, BOR, Comparators, VREF and
Current(IPD)(2) — 0.15 1.5 μA 3.0 T1OSC disabled
— 0.35 1.8 μA 5.0
— 150 500 nA 3.0 -40°C ≤ TA ≤ +25°C
D021 — 1.0 2.2 μA 2.0 WDT Current(1)
— 2.0 4.0 μA 3.0
— 3.0 7.0 μA 5.0
D022 — 42 60 μA 3.0 BOR Current(1)
— 85 122 μA 5.0
D023 — 32 45 μA 2.0 Comparator Current(1), both
— 60 78 μA 3.0 comparators enabled
— 120 160 μA 5.0
D024 — 30 36 μA 2.0 CVREF Current(1) (high range)
— 45 55 μA 3.0
— 75 95 μA 5.0
D025* — 39 47 μA 2.0 CVREF Current(1) (low range)
— 59 72 μA 3.0
— 98 124 μA 5.0
D026 — 4.5 7.0 μA 2.0 T1OSC Current(1), 32.768 kHz
— 5.0 8.0 μA 3.0
— 6.0 12 μA 5.0
D027 — 0.30 1.6 μA 3.0 A/D Current(1), no conversion in
— 0.36 1.9 μA 5.0 progress
* These parameters are characterized but not tested.
† Data in ‘Typ’ column is at 5.0V, 25°C unless otherwise stated. These parameters are for design guidance
only and are not tested.
Note 1: The peripheral current is the sum of the base IDD or IPD and the additional current consumed when this
peripheral is enabled. The peripheral Δ current can be determined by subtracting the base IDD or IPD
current from this limit. Max values should be used when calculating total current consumption.
2: The power-down current in Sleep mode does not depend on the oscillator type. Power-down current is
measured with the part in Sleep mode, with all I/O pins in high-impedance state and tied to VDD.
Param Conditions
Device Characteristics Min Typ† Max Units
No. VDD Note
D020E Power-down Base — 0.05 9 μA 2.0 WDT, BOR, Comparators, VREF and
Current (IPD)(2) — 0.15 11 μA 3.0 T1OSC disabled
— 0.35 15 μA 5.0
D021E — 1 17.5 μA 2.0 WDT Current(1)
— 2 19 μA 3.0
— 3 22 μA 5.0
D022E — 42 65 μA 3.0 BOR Current(1)
— 85 127 μA 5.0
D023E — 32 45 μA 2.0 Comparator Current(1), both
— 60 78 μA 3.0 comparators enabled
— 120 160 μA 5.0
D024E — 30 70 μA 2.0 CVREF Current(1) (high range)
— 45 90 μA 3.0
— 75 120 μA 5.0
D025E* — 39 91 μA 2.0 CVREF Current(1) (low range)
— 59 117 μA 3.0
— 98 156 μA 5.0
D026E — 4.5 25 μA 2.0 T1OSC Current(1), 32.768 kHz
— 5 30 μA 3.0
— 6 40 μA 5.0
D027E — 0.30 12 μA 3.0 A/D Current(1), no conversion in
— 0.36 16 μA 5.0 progress
* These parameters are characterized but not tested.
† Data in ‘Typ’ column is at 5.0V, 25°C unless otherwise stated. These parameters are for design guidance
only and are not tested.
Note 1: The peripheral current is the sum of the base IDD or IPD and the additional current consumed when this
peripheral is enabled. The peripheral Δ current can be determined by subtracting the base IDD or IPD
current from this limit. Max values should be used when calculating total current consumption.
2: The power-down current in Sleep mode does not depend on the oscillator type. Power-down current is
measured with the part in Sleep mode, with all I/O pins in high-impedance state and tied to VDD.
Param
Sym Characteristic Min Typ† Max Units Conditions
No.
D100 IULP Ultra Low-Power Wake-Up — 200 — nA See Application Note AN879,
Current “Using the Microchip Ultra
Low-Power Wake-up Module”
(DS00879)
Capacitive Loading Specs on
Output Pins
D101* COSC2 OSC2 pin — — 15 pF In XT, HS and LP modes when
external clock is used to drive
OSC1
D101A* CIO All I/O pins — — 50 pF
Data EEPROM Memory
D120 ED Byte Endurance 100K 1M — E/W -40°C ≤ TA ≤ +85°C
D120A ED Byte Endurance 10K 100K — E/W +85°C ≤ TA ≤ +125°C
D121 VDRW VDD for Read/Write VMIN — 5.5 V Using EECON1 to read/write
VMIN = Minimum operating
voltage
D122 TDEW Erase/Write Cycle Time — 5 6 ms
D123 TRETD Characteristic Retention 40 — — Year Provided no other specifications
are violated
D124 TREF Number of Total Erase/Write 1M 10M — E/W -40°C ≤ TA ≤ +85°C
Cycles before Refresh(4)
Program Flash Memory
D130 EP Cell Endurance 10K 100K — E/W -40°C ≤ TA ≤ +85°C
D130A ED Cell Endurance 1K 10K — E/W +85°C ≤ TA ≤ +125°C
D131 VPR VDD for Read VMIN — 5.5 V VMIN = Minimum operating
voltage
D132 VPEW VDD for Erase/Write 4.5 — 5.5 V
D133 TPEW Erase/Write cycle time — 2 2.5 ms
D134 TRETD Characteristic Retention 40 — — Year Provided no other specifications
are violated
* These parameters are characterized but not tested.
† Data in ‘Typ’ column is at 5.0V, 25°C unless otherwise stated. These parameters are for design guidance only and are
not tested.
Note 1: In RC oscillator configuration, the OSC1/CLKIN pin is a Schmitt Trigger input. It is not recommended to use an external
clock in RC mode.
2: Negative current is defined as current sourced by the pin.
3: The leakage current on the MCLR pin is strongly dependent on the applied voltage level. The specified levels represent
normal operating conditions. Higher leakage current may be measured at different input voltages.
4: See Section 10.4.1 “Using the Data EEPROM” for additional information.
5: Including OSC2 in CLKOUT mode.
1. TppS2ppS
2. TppS
T
F Frequency T Time
Lowercase letters (pp) and their meanings:
pp
cc CCP1 osc OSC1
ck CLKOUT rd RD
cs CS rw RD or WR
di SDI sc SCK
do SDO ss SS
dt Data in t0 T0CKI
io I/O PORT t1 T1CKI
mc MCLR wr WR
Uppercase letters and their meanings:
S
F Fall P Period
H High R Rise
I Invalid (High-impedance) V Valid
L Low Z High-impedance
Load Condition
Pin CL
VSS
Q4 Q1 Q2 Q3 Q4 Q1
OSC1/CLKIN
OS02
OS04 OS04
OS03
OSC2/CLKOUT
(LP,XT,HS Modes)
OSC2/CLKOUT
(CLKOUT Mode)
Fosc
OS11 OS12
OS20
CLKOUT OS21
OS19 OS16 OS18
OS13 OS17
I/O pin
(Input)
OS15 OS14
I/O pin Old Value New Value
(Output)
OS18, OS19
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
VDD
VBOR + VHYST
VBOR
37
Reset
(due to BOR) 33*
* 64 ms delay only if PWRTE bit in the Configuration Word register is programmed to ‘0’.
T0CKI
40 41
42
T1CKI
45 46
47 49
TMR0 or
TMR1
CCP1
(Capture mode)
CC01 CC02
CC03
Param
Sym Characteristic Min Typ† Max Units Conditions
No.
AD130* TAD A/D Clock Period 1.6 — 9.0 μs TOSC-based, VREF ≥ 3.0V
3.0 — 9.0 μs TOSC-based, VREF full range
A/D Internal RC ADCS<1:0> = 11 (ADRC mode)
Oscillator Period 3.0 6.0 9.0 μs At VDD = 2.5V
1.6 4.0 6.0 μs At VDD = 5.0V
AD131 TCNV Conversion Time — 11 — TAD Set GO/DONE bit to new data in A/D
(not including Result register
Acquisition Time)(1)
AD132* TACQ Acquisition Time 11.5 — μs
AD133* TAMP Amplifier Settling Time — — 5 μs
AD134 TGO Q4 to A/D Clock Start — TOSC/2 — —
BSF ADCON0, GO
1 TCY
AD134 (TOSC/2(1))
AD131
Q4
AD130
A/D CLK
A/D Data 9 8 7 6 3 2 1 0
ADIF 1 TCY
GO DONE
Sampling Stopped
Sample AD132
Note 1: 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.
BSF ADCON0, GO
AD134 (TOSC/2 + TCY(1)) 1 TCY
AD131
Q4
AD130
A/D CLK
A/D Data 9 8 7 6 3 2 1 0
ADIF 1 TCY
GO DONE
Note 1: 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.
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 25°C. “Maximum” or “minimum” represents
(mean + 3σ) or (mean - 3σ) respectively, where σ is a standard deviation, over each temperature range.
FIGURE 16-1: TYPICAL IDD vs. FOSC OVER VDD (EC MODE)
3.5
2.0 4.0V
IDD (mA)
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
4.0
Typical: Statistical Mean @25°C
5.5V
3.5 Maximum: Mean (Worst Case Temp) + 3σ
(-40°C to 125°C)
5.0V
3.0
2.5
4.0V
IDD (mA)
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: TYPICAL IDD vs. FOSC OVER VDD (HS MODE)
Typical IDD vs FOSC Over Vdd
HS Mode
4.0
Typical: Statistical Mean @25°C
3.5 Maximum: Mean (Worst Case Temp) + 3σ
(-40°C to 125°C)
5.5V
3.0
5.0V
2.5
4.5V
IDD (mA)
2.0
1.5
4.0V
1.0 3.5V
3.0V
0.5
0.0
4 MHz 10 MHz 16 MHz 20 MHz
FOSC
3.5 5.5V
5.0V
3.0
IDD (mA)
4.5V
2.5
2.0
1.5
4.0V
3.5V
1.0 3.0V
0.5
0.0
4 MHz 10 MHz 16 MHz 20 MHz
FOSC
FIGURE 16-5: TYPICAL IDD vs. VDD OVER FOSC (XT MODE)
XT Mode
900
Typical: Statistical Mean @25°C
800 Maximum: Mean (Worst Case Temp) + 3σ
(-40°C to 125°C)
700
600
500
IDD (μA)
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)
1,400
1,000
800
IDD (μA)
4 MHz
600
400
1 MHz
200
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
FIGURE 16-7: TYPICAL IDD vs. VDD OVER FOSC (EXTRC MODE)
EXTRC Mode
800
Typical: Statistical Mean @25°C
700 Maximum: Mean (Worst Case Temp) + 3σ
(-40°C to 125°C)
600
500
4 MHz
IDD (μA)
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)
1,400
1,000
4 MHz
800
IDD (μA)
600
400 1 MHz
200
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
FIGURE 16-9: IDD vs. VDD OVER FOSC (LFINTOSC MODE, 31 kHz)
LFINTOSC Mode, 31KHZ
80
Typical: Statistical Mean @25°C
70 Maximum: Mean (Worst Case Temp) + 3σ
(-40°C to 125°C)
60
50
Maximum
IDD (μA)
40
30
Typical
20
10
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
70
50
32 kHz Maximum
40
IDD (μA)
30
20 32 kHz Typical
10
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
FIGURE 16-11: TYPICAL IDD vs. FOSC OVER VDD (HFINTOSC MODE)
HFINTOSC
1,600
1,000 4.0V
IDD (μA)
800
3.0V
600
2.0V
400
200
0
125 kHz 250 kHz 500 kHz 1 MHz 2 MHz 4 MHz 8 MHz
FOSC
2,000
Typical: Statistical Mean @25°C
5.5V
1,800 Maximum: Mean (Worst Case Temp) + 3σ
(-40°C to 125°C)
1,600 5.0V
1,400
1,200 4.0V
IDD (μA)
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: TYPICAL IPD vs. VDD (SLEEP MODE, ALL PERIPHERALS DISABLED)
Typical
(Sleep Mode all Peripherals Disabled)
0.45
0.30
0.25
IPD (μA)
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)
10.0
IPD (μA)
8.0
6.0
4.0
Max. 85°C
2.0
0.0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
180
120
Maximum
100
IPD (μA)
Typical
80
60
40
20
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
160
120
100
Maximum
IPD (μA)
80
Typical
60
40
20
0
2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
3.0
Typical: Statistical
Typical: StatisticalMean
Mean @25°C
@25°C
Maximum: Mean (Worst Case Temp) + 3σ
2.5
(-40°C to 125°C)
2.0
IPD (μA)
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)
25.0
20.0
Max. 125°C
Max. 85°C
5.0
0.0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
30
Typical: Statistical Mean @25°C
28 Maximum: Mean (Worst Case Temp) + 3σ
(-40°C to 125°C)
Max. (125°C)
26
Max. (85°C)
24
22
Time (ms)
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)
30
Typical: Statistical Mean @25°C
28 Maximum: Mean (Worst Case Temp) + 3σ
(-40°C to 125°C)
26
Maximum
24
22
Time (ms)
20
Typical
18
16
Minimum
14
12
10
-40°C 25°C 85°C 125°C
Temperature (°C)
FIGURE 16-21: CVREF IPD vs. VDD OVER TEMPERATURE (HIGH RANGE)
High Range
140
Typical: Statistical Mean @25°C
Maximum: Mean (Worst Case Temp) + 3σ
120
(-40°C to 125°C)
100
Max. 125°C
80
IPD (μA)
Max. 85°C
60
Typical
40
20
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
180
Typical: Statistical Mean @25°C
160 Maximum: Mean (Worst Case Temp) + 3σ
(-40°C to 125°C)
140
120
Max. 125°C
100
IPD (μA)
Max. 85°C
80
Typical
60
40
20
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
0.8
0.4
0.2
Min. -40°C
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)
0.45
0.25
VOL (V)
Typ. 25°C
0.20
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)
3.5
3.0
Max. -40°C
Typ. 25°C
2.5
Min. 125°C
2.0
VOH (V)
1.5
0.5
0.0
0.0 -0.5 -1.0 -1.5 -2.0 -2.5 -3.0 -3.5 -4.0
IOH (mA)
5.5
5.0
Max. -40°C
Typ. 25°C
4.5
VOH (V)
Min. 125°C
4.0
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: TTL INPUT THRESHOLD VIN vs. VDD OVER TEMPERATURE
(TTL Input, -40×C TO 125×C)
1.7
Max. -40°C
1.3
Typ. 25°C
VIN (V)
1.1
Min. 125°C
0.9
0.7
0.5
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
4.0
VIH Max. 125°C
Typical: Statistical Mean @25°C
3.5 Maximum: Mean (Worst Case Temp) + 3σ
(-40°C to 125°C)
VIH Min. -40°C
3.0
2.5
VIN (V)
2.0
VIL Max. -40°C
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: T1OSC IPD vs. VDD OVER TEMPERATURE (32 kHz)
45.0
Typical: Statistical Mean @25°C
40.0 Maximum: Mean
Maximum: Mean (Worst
3 toCase
(-40×C
+ Temp) + 3σ
125×C)
(-40°C to 125°C)
35.0
Max. 125°C
30.0
25.0
IPD (mA)
20.0
15.0
Max. 85°C
10.0
5.0
Typ. 25°C
0.0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
1000
900
700
Response Time (nS)
400
300
0
2.0 2.5 4.0 5.5
VDD (V)
1000
900
700
Response Time (nS)
400
300
0
2.0 2.5 4.0 5.5
VDD (V)
45,000
40,000
Max. -40°C
35,000
Typ. 25°C
30,000
Frequency (Hz)
25,000
Min. 125°C
15,000
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
6
85°C
Time (μs)
25°C
4
-40°C
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
16
12
25°C
10
Time (μs)
-40°C
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
FIGURE 16-35: MAXIMUM HFINTOSC START-UP TIMES vs. VDD OVER TEMPERATURE
-40C to +85C
25
15
Time (μs)
85°C
25°C
10
-40°C
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
10
9
Typical: Statistical Mean @25°C
8 Maximum: Mean (Worst Case Temp) + 3σ
(-40°C to 125°C)
7
85°C
6
Time (μs)
25°C
5
-40°C
4
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
2
Change from Calibration (%)
-1
-2
-3
-4
-5
VDD (V)
3
Change from Calibration (%)
-1
-2
-3
-4
-5
VDD (V)
3
Change from Calibration (%)
-1
-2
-3
-4
-5
VDD (V)
3
Change from Calibration (%)
-1
-2
-3
-4
-5
VDD (V)
XXXXXXXXXXXXXX PIC16F684-I/P
XXXXXXXXXXXXXX 0510017
YYWWNNN
XXXXXXXXXXX PIC16F684-E
XXXXXXXXXXX
YYWWNNN 0510017
XXXXXXXX XXXX/ST
YYWW 0510
NNN 017
XXXXXX 16F684
XXXXXX -I/ML
YWWNNN 510017
Note: 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 PICmicro device marking consists of Microchip part number, year code, week code, and
traceability code. For PICmicro 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.
E1
n 1
α
A A2
c L
A1
β B1
eB
B p
E1
B n 1
α
h
45°
c
A A2
φ
A1
L
β
E1
n 1
B
α
A
c φ
β
L A1 A2
D D2
EXPOSED
METAL
PAD
(NOTE 2)
E E2
2
1 b
K
n
OPTIONAL L
TOP VIEW INDEX BOTTOM VIEW
AREA
(NOTE 1)
A A3
A1
U
Ultra Low-Power Wake-Up ....................................... 6, 32, 34
V
Voltage Reference. See Comparator Voltage Reference
(CVREF)
Voltage References
Associated Registers .................................................. 65
VREF. SEE ADC Reference Voltage
W
Wake-up Using Interrupts ................................................. 114
Watchdog Timer (WDT) .................................................... 112
Associated Registers ................................................ 113
Clock Source............................................................. 112
Modes ....................................................................... 112
Period........................................................................ 112
Specifications............................................................ 145
WDTCON Register ........................................................... 113
WPUA Register ................................................................... 33
WWW Address.................................................................. 189
WWW, On-Line Support ....................................................... 4
From: Name
Company
Address
City / State / ZIP / Country
Telephone: (_______) _________ - _________ FAX: (______) _________ - _________
Application (optional):
Would you like a reply? Y N
Questions:
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?
02/16/06