PIC16(L)F1508/9
20-Pin Flash, 8-Bit Microcontrollers
with XLP Technology
High-Performance RISC CPU:
• C Compiler Optimized Architecture
• Only 49 Instructions
• Up to 8 Kwords Linear Program Memory
Addressing
• Up to 512 bytes Linear Data Memory Addressing
• Operating Speed:
- DC – 20 MHz clock input
- DC – 200 ns instruction cycle
• Interrupt Capability with Automatic Context
Saving
• 16-Level Deep Hardware Stack with Optional
Overflow/Underflow Reset
• Direct, Indirect and Relative Addressing modes:
- Two full 16-bit File Select Registers (FSRs)
- FSRs can read program and data memory
Extreme Low-Power Management
with XLP (PIC16LF1508/9):
• Standby Current:
- 20 nA @ 1.8V, typical
• Watchdog Timer Current:
- 260 nA @ 1.8V, typical
• Operating Current:
- 30
A/MHz
@ 1.8V, typical
• Secondary Oscillator Current:
- 700 nA @ 32 kHz, 1.8V, typical
Peripheral Features:
• Analog-to-Digital Converter (ADC):
- 10-bit resolution
- 12 external channels
- 3 internal channels:
- Fixed Voltage Reference
- Digital-to-Analog Converter (DAC)
- Temperature Indicator channel
- Auto acquisition capability
- Conversion available during Sleep
• 5-Bit Digital-to-Analog Converter (DAC):
- Output available externally
- Positive reference selection
- Internal connections to comparators and
ADC
• 2 Comparators:
- Rail-to-rail inputs
- Power mode control
- Software controllable hysteresis
• Voltage Reference module:
- Fixed Voltage Reference (FVR) with 1.024V,
2.048V and 4.096V output levels
- 1 rail-to-rail resistive 5-bit DAC with positive
reference selection
• 18 I/O Pins (1 Input-only Pin):
- High current sink/source 25 mA/25 mA
- Individually programmable weak pull-ups
- Individually programmable
Interrupt-On-Change (IOC) pins
• Timer0: 8-Bit Timer/Counter with 8-Bit
Programmable Prescaler
• Enhanced Timer1:
- 16-bit timer/counter with prescaler
- External Gate Input mode
• Timer2: 8-Bit Timer/Counter with 8-Bit Period
Register, Prescaler and Postscaler
• Four 10-bit PWM modules
Flexible Oscillator Structure:
• 16 MHz Internal Oscillator Block:
- Factory calibrated to ±1%, typical
- Software selectable frequency range from
16 MHz to 31 kHz
• 31 kHz Low-Power Internal Oscillator
• Three External Clock modes up to 20 MHz
Special Microcontroller Features:
• Operating Voltage Range:
- 1.8V to 3.6V (PIC16LF1508/9)
- 2.3V to 5.5V (PIC16F1508/9)
• Self-Programmable under Software Control
• Power-On Reset (POR)
• Power-up Timer (PWRT)
• Programmable Low-Power Brown-Out Reset
(LPBOR)
• Extended Watchdog Timer (WDT):
- Programmable period from 1 ms to 256s
• Programmable Code Protection
• In-Circuit Serial Programming™ (ICSP™) via Two
Pins
• Enhanced Low-Voltage Programming (LVP)
• In-Circuit Debug (ICD) via Two Pins
• Power-Saving Sleep mode:
- Low-Power Sleep mode
- Low-Power BOR (LPBOR)
• Integrated Temperature Indicator
• 128 Bytes High-Endurance Flash
- 100,000 write Flash endurance (minimum)
2011-2013 Microchip Technology Inc.
DS40001609B-page 1
PIC16(L)F1508/9
Peripheral Features (Continued):
• Master Synchronous Serial Port (MSSP) with SPI
and I
2
C™ with:
- 7-bit address masking
- SMBus/PMBus™ compatibility
• Enhanced Universal Synchronous Asynchronous
Receiver Transmitter (EUSART)
- RS-232, RS-485 and LIN compatible
- Auto-Baud Detect
- Auto-wake-up on Start
• 4 Configurable Logic Cell (CLC) modules:
- 16 selectable input source signals
- Four inputs per module
- Software control of combinational/sequential
logic/state/clock functions
- AND/OR/XOR/D Flop/D Latch/SR/JK
- Inputs from external and internal sources
- Output available to pins and peripherals
- Operation while in Sleep
• Numerically Controlled Oscillator (NCO):
- 20-bit accumulator
- 16-bit increment
- True linear frequency control
- High-speed clock input
- Selectable Output modes
- Fixed Duty Cycle (FDC) mode
- Pulse Frequency (PF) mode
• Complementary Waveform Generator (CWG):
- 8 selectable signal sources
- Selectable falling and rising edge dead-band
control
- Polarity control
- 4 auto-shutdown sources
- Multiple input sources: PWM, CLC, NCO
PIC12(L)F1501/PIC16(L)F150X FAMILY TYPES
Program Memory
Flash (words)
MSSP (I
2
C™/SPI)
Data Sheet Index
10-bit ADC (ch)
Comparators
Data SRAM
(bytes)
Timers
(8/16-bit)
EUSART
Debug
(1)
I/O’s
(2)
PWM
CWG
NCO
DAC
CLC
Device
PIC12(L)F1501 (1) 1024 64
6 4
1
1
2/1
4
—
—
1
2
1
H
—
PIC16(L)F1503 (2) 2048 128 12 8
2
1
2/1
4
—
1
1
2
1
H
—
PIC16(L)F1507 (3) 2048 128 18 12 — —
2/1
4
—
—
1
2
1
H
—
PIC16(L)F1508 (4) 4096 256 18 12 2
1
2/1
4
1
1
1
4
1 I/H
Y
PIC16(L)F1509 (4) 8192 512 18 12 2
1
2/1
4
1
1
1
4
1 I/H
Y
Note 1:
Debugging Methods: (I) – Integrated on Chip; (H) – using Debug Header; E – using Emulation Header.
2:
One pin is input-only.
Data Sheet Index:
(Unshaded devices are described in this document.)
1:
DS41615
PIC12(L)F1501 Data Sheet, 8-Pin Flash, 8-bit Microcontrollers.
2:
DS41607
PIC16(L)F1503 Data Sheet, 14-Pin Flash, 8-bit Microcontrollers.
PIC16(L)F1507 Data Sheet, 20-Pin Flash, 8-bit Microcontrollers.
3:
DS41586
4:
DS40001609
PIC16(L)F1508/9 Data Sheet, 20-Pin Flash, 8-bit Microcontrollers.
Note:
For other small form-factor package availability and marking information, please visit
http://www.microchip.com/packaging
or contact your local sales office.
DS40001609B-page 2
2011-2013 Microchip Technology Inc.
XLP
PIC16(L)F1508/9
PIN DIAGRAMS
Pin Diagram – 20-Pin PDIP, SOIC, SSOP
V
DD
RA5
RA4
MCLR/V
PP
/RA3
RC5
RC4
RC3
RC6
RC7
RB7
1
2
PIC16LF1508/9
3
4
5
6
7
8
9
10
20
19
18
PIC16F1508/9
17
16
15
14
13
12
11
V
SS
RA0/ICSPDAT
RA1/ICSPCLK
RA2
RC0
RC1
RC2
RB4
RB5
RB6
Note:
See
Table 1
for location of all peripheral functions.
Pin Diagram – 20-Pin QFN
RA0/ICSPDAT
RA4
RA5
V
DD
20 19 18 17 16
MCLR/V
PP
/RA3
RC5
RC4
RC3
RC6
1
2
3
4
5
6
RC7
7
RB7
8
RB6
9 10
RB5
RB4
PIC16F1508/9
PIC16LF1508/9
15
14
13
12
11
RA1/ICSPCLK
RA2
RC0
RC1
RC2
Note 1:
See
Table 1
for location of all peripheral functions.
2:
It is recommended that the exposed bottom pad be connected to V
SS
.
2011-2013 Microchip Technology Inc.
V
SS
DS40001609B-page 3
PIC16(L)F1508/9
PIN ALLOCATION TABLE
TABLE 1:
20-Pin PDIP/SOIC/SSOP
20-PIN ALLOCATION TABLE (PIC16(L)F1508/9)
Comparator
20-Pin QFN
Reference
EUSART
Interrupt
Pull-up
Timers
MSSP
RA0
RA1
RA2
RA3
RA4
RA5
RB4
RB5
RB6
RB7
RC0
RC1
RC2
RC3
RC4
RC5
RC6
RC7
V
DD
V
SS
19
18
17
4
3
2
13
12
11
10
16
15
14
7
6
5
8
9
1
20
16
15
14
1
20
19
10
9
8
7
13
12
11
4
3
2
5
6
18
17
AN0
AN1
AN2
—
AN3
—
AN10
AN11
—
—
AN4
AN5
AN6
AN7
—
—
AN8
AN9
—
—
DAC1OUT1
V
REF
+
DAC1OUT2
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
C1IN+
C1IN0-
C2IN0-
C1OUT
—
—
—
—
—
—
—
C2IN+
C1IN1-
C2IN1-
C1IN2-
C2IN2-
C1IN3-
C2IN3-
C2OUT
—
—
—
—
—
—
—
T0CKI
T1G
(1)
SOSCO
T1G
SOSCI
T1CKI
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
—
RX/DT
—
TX/CK
—
—
—
—
—
—
—
—
—
—
—
—
—
SS
(1)
—
—
SDA/SDI
—
SCL/SCK
—
—
—
—
—
—
—
SS
SDO
—
—
—
—
CWG1FLT
—
—
—
—
—
—
—
—
—
—
—
CWG1B
CWG1A
—
—
—
—
—
—
—
—
—
NCO1CLK
—
—
—
—
—
NCO1
—
—
—
—
NCO1
—
—
—
(1)
—
CLC4IN1
CLC1
CLC1IN0
—
—
CLC3IN0
CLC4IN0
—
CLC3
CLC2
—
—
CLC2IN0
CLC4
CLC2IN1
CLC1
(1)
CLC3IN1
CLC1IN1
—
—
—
—
PWM3
—
—
—
—
—
—
—
—
PWM4
—
PWM2
—
PWM1
—
—
—
—
IOC
IOC
INT/
IOC
IOC
IOC
IOC
IOC
IOC
IOC
IOC
—
—
—
—
—
—
—
—
—
—
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
—
—
—
—
—
—
—
—
—
—
ICSPDAT
ICDDAT
ICSPCLK
ICDCLK
—
MCLR
V
PP
CLKOUT
OSC2
CLKIN
OSC1
—
—
—
—
—
—
—
—
—
—
—
—
V
DD
V
SS
Note 1:
Alternate pin function selected with the APFCON (Register
11-1)
register.
DS40001609B-page 4
2011-2013 Microchip Technology Inc.
Basic
PWM
CWG
NCO
ADC
CLC
I/O
PIC16(L)F1508/9
TABLE OF CONTENTS
1.0 Device Overview .......................................................................................................................................................................... 7
2.0 Enhanced Mid-Range CPU ........................................................................................................................................................ 13
3.0 Memory Organization ................................................................................................................................................................. 15
4.0 Device Configuration .................................................................................................................................................................. 41
5.0 Oscillator Module (With Fail-Safe Clock Monitor)....................................................................................................................... 47
6.0 Resets ........................................................................................................................................................................................ 63
7.0 Interrupts .................................................................................................................................................................................... 71
8.0 Power-Down Mode (Sleep) ........................................................................................................................................................ 85
9.0 Watchdog Timer (WDT) ............................................................................................................................................................. 89
10.0 Flash Program Memory Control ................................................................................................................................................. 93
11.0 I/O Ports ................................................................................................................................................................................... 109
12.0 Interrupt-On-Change ................................................................................................................................................................ 123
13.0 Fixed Voltage Reference (FVR) ............................................................................................................................................... 129
14.0 Temperature Indicator Module ................................................................................................................................................. 131
15.0 Analog-to-Digital Converter (ADC) Module .............................................................................................................................. 133
16.0 5-Bit Digital-to-Analog Converter (DAC) Module...................................................................................................................... 147
17.0 Comparator Module.................................................................................................................................................................. 151
18.0 Timer0 Module ......................................................................................................................................................................... 159
19.0 Timer1 Module with Gate Control............................................................................................................................................. 163
20.0 Timer2 Module ......................................................................................................................................................................... 175
21.0 Master Synchronous Serial Port (MSSP) Module .................................................................................................................... 179
22.0 Enhanced Universal Synchronous Asynchronous Receiver Transmitter (EUSART) ............................................................... 235
23.0 Pulse Width Modulation (PWM) Module................................................................................................................................... 263
24.0 Configurable Logic Cell (CLC).................................................................................................................................................. 269
25.0 Numerically Controlled Oscillator (NCO) Module ..................................................................................................................... 285
26.0 Complementary Waveform Generator (CWG) Module ............................................................................................................ 295
27.0 In-Circuit Serial Programming™ (ICSP™) ............................................................................................................................... 307
28.0 Instruction Set Summary .......................................................................................................................................................... 309
29.0 Electrical Specifications............................................................................................................................................................ 323
30.0 DC and AC Characteristics Graphs and Charts ....................................................................................................................... 353
31.0 Development Support............................................................................................................................................................... 395
32.0 Packaging Information.............................................................................................................................................................. 399
Appendix A: Data Sheet Revision History.......................................................................................................................................... 409
Index .................................................................................................................................................................................................. 411
The Microchip Web Site ..................................................................................................................................................................... 417
Customer Change Notification Service .............................................................................................................................................. 417
Customer Support .............................................................................................................................................................................. 418
Reader Response .............................................................................................................................................................................. 418
Product Identification System ............................................................................................................................................................ 419
2011-2013 Microchip Technology Inc.
DS40001609B-page 5