PIC16(L)F1508/9
20-Pin Flash, 8-Bit Microcontrollers
with XLP Technology
High-Performance RISC CPU:
• C Compiler Optimized Architecture
• Only 49 Instructions
• 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 (XLP)
Features(PIC16LF1508/9):
• Sleep 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
- Three 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
• Two Comparators:
- Rail-to-rail inputs
- Power mode control
- Software controllable hysteresis
• Voltage Reference:
- 1.024V Fixed Voltage Reference (FVR) with
1x, 2x and 4x Gain output levels
• 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
• Master Synchronous Serial Port (MSSP) with SPI
and I
2
C with:
- 7-bit address masking
- SMBus/PMBus™ compatibility
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)
Memory:
• Up to 8 Kwords Linear Program Memory
Addressing
• Up to 512 bytes Linear Data Memory Addressing
• High-Endurance Flash Data Memory (HEF)
- 128 bytes if nonvolatile data storage
- 100k erase/write cycles
2011-2015 Microchip Technology Inc.
DS40001609E-page 1
PIC16(L)F1508/9
Peripheral Features (Continued):
• Enhanced Universal Synchronous Asynchronous
Receiver Transmitter (EUSART)
- RS-232, RS-485 and LIN compatible
- Auto-Baud Detect
- Auto-wake-up on Start
• Four 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):
- Eight selectable signal sources
- Selectable falling and rising edge dead-band
control
- Polarity control
- Four auto-shutdown sources
- Multiple input sources: PWM, CLC, NCO
PIC12(L)F1501/PIC16(L)F150X FAMILY TYPES
Program Memory
Flash (words)
Data Sheet Index
10-bit ADC (ch)
MSSP (I
2
C/SPI)
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:
DS40001615
PIC12(L)F1501 Data Sheet, 8-Pin Flash, 8-bit Microcontrollers.
2:
DS40001607
PIC16(L)F1503 Data Sheet, 14-Pin Flash, 8-bit Microcontrollers.
3:
DS40001586
PIC16(L)F1507 Data Sheet, 20-Pin Flash, 8-bit Microcontrollers.
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.
DS40001609E-page 2
2011-2015 Microchip Technology Inc.
XLP
PIC16(L)F1508/9
PIN DIAGRAMS
20-pin PDIP, SOIC, SSOP
V
DD
RA5
RA4
MCLR/V
PP
/RA3
RC5
RC4
RC3
RC6
RC7
RB7
1
2
PIC16(L)F1508
PIC16(L)F1509
3
4
5
6
7
8
9
10
20
19
18
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.
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
PIC16(L)F1508
PIC16(L)F1509
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-2015 Microchip Technology Inc.
RA0/ICSPDAT
20-pin QFN, UQFN
RA4
RA5
V
DD
V
SS
DS40001609E-page 3
PIC16(L)F1508/9
PIN ALLOCATION TABLE
TABLE 1:
20-Pin PDIP/SOIC/SSOP
20-Pin QFN/UQFN
20-PIN ALLOCATION TABLE (PIC16(L)F1508/9)
Comparator
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.
DS40001609E-page 4
2011-2015 Microchip Technology Inc.
Basic
PWM
CWG
NCO
ADC
CLC
I/O
PIC16(L)F1508/9
TABLE OF CONTENTS
1.0 Device Overview .......................................................................................................................................................................... 8
2.0 Enhanced Mid-Range CPU ........................................................................................................................................................ 13
3.0 Memory Organization ................................................................................................................................................................. 15
4.0 Device Configuration .................................................................................................................................................................. 40
5.0 Oscillator Module (With Fail-Safe Clock Monitor)....................................................................................................................... 46
6.0 Resets ........................................................................................................................................................................................ 62
7.0 Interrupts .................................................................................................................................................................................... 70
8.0 Power-Down Mode (Sleep) ........................................................................................................................................................ 83
9.0 Watchdog Timer (WDT) ............................................................................................................................................................. 86
10.0 Flash Program Memory Control ................................................................................................................................................. 90
11.0 I/O Ports ................................................................................................................................................................................... 106
12.0 Interrupt-On-Change ................................................................................................................................................................ 119
13.0 Fixed Voltage Reference (FVR) ............................................................................................................................................... 124
14.0 Temperature Indicator Module ................................................................................................................................................. 126
15.0 Analog-to-Digital Converter (ADC) Module .............................................................................................................................. 128
16.0 5-Bit Digital-to-Analog Converter (DAC) Module...................................................................................................................... 142
17.0 Comparator Module.................................................................................................................................................................. 145
18.0 Timer0 Module ......................................................................................................................................................................... 152
19.0 Timer1 Module with Gate Control............................................................................................................................................. 155
20.0 Timer2 Module ......................................................................................................................................................................... 166
21.0 Master Synchronous Serial Port (MSSP) Module .................................................................................................................... 169
22.0 Enhanced Universal Synchronous Asynchronous Receiver Transmitter (EUSART) ............................................................... 223
23.0 Pulse-Width Modulation (PWM) Module .................................................................................................................................. 251
24.0 Configurable Logic Cell (CLC).................................................................................................................................................. 257
25.0 Numerically Controlled Oscillator (NCO) Module ..................................................................................................................... 273
26.0 Complementary Waveform Generator (CWG) Module ............................................................................................................ 280
27.0 In-Circuit Serial Programming™ (ICSP™) ............................................................................................................................... 292
28.0 Instruction Set Summary .......................................................................................................................................................... 294
29.0 Electrical Specifications............................................................................................................................................................ 309
30.0 DC and AC Characteristics Graphs and Charts ....................................................................................................................... 339
31.0 Development Support............................................................................................................................................................... 380
32.0 Packaging Information.............................................................................................................................................................. 384
Appendix A: Data Sheet Revision History.......................................................................................................................................... 397
The Microchip Website ...................................................................................................................................................................... 398
Customer Change Notification Service .............................................................................................................................................. 398
Customer Support .............................................................................................................................................................................. 398
Product Identification System ............................................................................................................................................................ 399
2011-2015 Microchip Technology Inc.
DS40001609E-page 5