PIC12(L)F1571/2
8-Pin MCU with High-Precision 16-Bit PWMs
Description:
PIC12(L)F1571/2 microcontrollers combine the capabilities of 16-bit PWMs with Analog to suit a variety of applications.
These devices deliver three 16-bit PWMs with independent timers for applications where high resolution is needed, such
as LED lighting, stepper motors, power supplies and other general purpose applications. The core independent
peripherals (16-bit PWMs, Complementary Waveform Generator), Enhanced Universal Synchronous Asynchronous
Receiver Transceiver (EUSART) and Analog (ADCs, Comparator and DAC) enable closed-loop feedback and
communication for use in multiple market segments. The EUSART peripheral enables the communication for
applications such as LIN.
Core Features:
eXtreme Low-Power (XLP) Features:
• C Compiler Optimized RISC Architecture
• Only 49 Instructions
• Operating Speed:
- DC – 32 MHz clock input
- 125 ns minimum instruction cycle
• Interrupt Capability
• 16-Level Deep Hardware Stack
• Two 8-Bit Timers
• One 16-Bit Timer
• Three Additional 16-Bit Timers available using the
16-Bit PWMs
• Power-on Reset (POR)
• Power-up Timer (PWRT)
• Low-Power Brown-out Reset (LPBOR)
• Programmable Watchdog Timer (WDT) up to 256s
• Programmable Code Protection
• Sleep mode: 20 nA @ 1.8V, Typical
• Watchdog Timer: 260 nA @ 1.8V, Typical
• Operating Current:
- 30 A/MHz @ 1.8V, typical
Memory:
•
•
•
•
Up to 3.5 Kbytes Flash Program Memory
Up to 256 Bytes Data SRAM Memory
Direct, Indirect and Relative Addressing modes
High-Endurance Flash Data Memory (HEF)
- 128 bytes if nonvolatile data storage
- 100k erase/write cycles
Operating Characteristics:
• Operating Voltage Range:
- 1.8V to 3.6V (PIC12LF1571/2)
- 2.3V to 5.5V (PIC12F1571/2)
• Temperature Range:
- Industrial: -40°C to +85°C
- Extended: -40°C to +125°C
• Internal Voltage Reference module
• In-Circuit Serial Programming™ (ICSP™) via
Two Pins
2013-2015 Microchip Technology Inc.
Digital Peripherals:
• 16-Bit PWM:
- Three 16-bit PWMs with independent timers
- Multiple Output modes (Edge-Aligned,
Center-Aligned, Set and Toggle on
Register Match)
- User settings for phase, duty cycle, period,
offset and polarity
- 16-bit timer capability
- Interrupts generated based on timer matches
with Offset, Duty Cycle, Period and Phase
registers
• Complementary Waveform Generator (CWG):
- Rising and falling edge dead-band control
- Multiple signal sources
• Enhanced Universal Synchronous Asynchronous
Receiver Transceiver (EUSART):
- Supports LIN applications
Device I/O Port Features:
• Six I/Os
• Individually Selectable Weak Pull-ups
• Interrupt-On-Change Pins Option with
Edge-Selectable Option
DS40001723D-page 1
PIC12(L)F1571/2
Analog Peripherals:
Clocking Structure:
• 10-Bit Analog-to-Digital Converter (ADC):
- Up to four external channels
- Conversion available during Sleep
• Comparator:
- Low-Power/High-Speed modes
- Fixed Voltage Reference at (non)inverting
input(s)
- Comparator outputs externally accessible
- Synchronization with Timer1 clock source
- Software hysteresis enable
• 5-Bit Digital-to-Analog Converter (DAC):
- 5-bit resolution, rail-to-rail
- Positive reference selection
- Unbuffered I/O pin output
- Internal connections to ADCs and
comparators
• Voltage Reference:
- Fixed voltage reference with 1.024V, 2.048V
and 4.096V output levels
• Precision Internal Oscillator:
- Factory calibrated ±1%, typical
- Software-selectable clock speeds from
31 kHz to 32 MHz
• External Oscillator Block with:
- Resonator modes up to 20 MHz
- Two External Clock modes up to 32 MHz
• Fail-Safe Clock Monitor
• Digital Oscillator Input Available
Data Sheet Index
Program Memory Flash
(K words)
Data SRAM (bytes)
High-Endurance
Flash (bytes)
I/O Pins
8-Bit/16-Bit Timers
Comparators
16-Bit PWM
10-Bit ADC (ch)
5-Bit DAC
CWG
EUSART
Debug(1)
XLP
PIC12(L)F1571/2 FAMILY TYPES
PIC12(L)F1571
A
1
128
128
6
2/4(2)
1
3
4
1
1
0
I
Y
PIC12(L)F1572
A
2
256
128
6
2/4(2)
1
3
4
1
1
1
I
Y
Device
Note 1:
2:
I – Debugging integrated on chip.
Three additional 16-bit timers available when not using the 16-bit PWM outputs.
Data Sheet Index: (Unshaded devices are described in this document.)
A
DS40001723
DS40001723D-page 2
PIC12(L)F1571/2 Data Sheet, 8-Pin Flash, 8-Bit MCU with High-Precision 16-Bit PWM.
2013-2015 Microchip Technology Inc.
PIC12(L)F1571/2
PIN DIAGRAMS
1
RA5
2
RA4
3
RA3/MCLR/VPP
4
PIC12(L)F1572
VDD
PIC12(L)F1571
Pin Diagram – 8-Pin PDIP, SOIC, DFN, MSOP, UDFN
8
VSS
7
RA0/ICSPDAT
6
RA1/ICSPCLK
5
RA2
Note: See Table 1 for location of all peripheral functions.
8-Pin PDIP/SOIC/MSOP/DFN/UDFN
ADC
Reference
Comparator
Timers
PWM
EUSART(2)
CWG
Interrupt
Pull-up
Basic
8-PIN ALLOCATION TABLE (PIC12(L)F1571/2)
I/O
TABLE 1:
RA0
7
AN0
DAC1OUT
C1IN+
—
PWM2
TX(2)
CK(2)
CWG1B
IOC
Y
ICSPDAT
ICDDAT
RA1
6
AN1
VREF+
C1IN0-
—
PWM1
RX(2)
DT(2)
—
IOC
Y
ICSPCLK
ICDCLK
RA2
5
AN2
—
C1OUT
T0CKI
PWM3
—
CWG1FLT
CWG1A
IOC
INT
Y
—
RA3
4
—
—
—
T1G(1)
—
—
—
IOC
Y
MCLR
VPP
RA4
3
AN3
—
C1IN1-
T1G
PWM2(1)
TX(1,2)
CK(1,2)
CWG1B(1)
IOC
Y
CLKOUT
RA5
2
—
—
—
T1CKI
PWM1(1)
RX(1,2)
DT(1,2)
CWG1A(1)
IOC
Y
CLKIN
VDD
1
—
—
—
—
—
—
—
—
—
VDD
Vss
8
—
—
—
—
—
—
—
—
—
VSS
Note 1:
2:
Alternate pin function selected with the APFCON (Register 11-1) register.
PIC12(L)F1572 only.
2013-2015 Microchip Technology Inc.
DS40001723D-page 3
PIC12(L)F1571/2
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........................................................................................................................................................................ 47
6.0 Resets ........................................................................................................................................................................................ 59
7.0 Interrupts .................................................................................................................................................................................... 69
8.0 Power-Down Mode (Sleep) ........................................................................................................................................................ 83
9.0 Watchdog Timer (WDT) ............................................................................................................................................................. 87
10.0 Flash Program Memory Control ................................................................................................................................................. 91
11.0 I/O Ports ................................................................................................................................................................................... 109
12.0 Interrupt-On-Change ................................................................................................................................................................ 119
13.0 Fixed Voltage Reference (FVR) ............................................................................................................................................... 123
14.0 Temperature Indicator Module ................................................................................................................................................. 127
15.0 Analog-to-Digital Converter (ADC) Module .............................................................................................................................. 129
16.0 5-Bit Digital-to-Analog Converter (DAC) Module ...................................................................................................................... 143
17.0 Comparator Module.................................................................................................................................................................. 147
18.0 Timer0 Module ......................................................................................................................................................................... 155
19.0 Timer1 Module with Gate Control............................................................................................................................................. 159
20.0 Timer2 Module ......................................................................................................................................................................... 171
21.0 Enhanced Universal Synchronous Asynchronous Receiver Transmitter (EUSART) ............................................................... 175
22.0 16-Bit Pulse-Width Modulation (PWM) Module ........................................................................................................................ 203
23.0 Complementary Waveform Generator (CWG) Module ............................................................................................................ 231
24.0 In-Circuit Serial Programming™ (ICSP™) ............................................................................................................................... 243
25.0 Instruction Set Summary .......................................................................................................................................................... 245
26.0 Electrical Specifications............................................................................................................................................................ 259
27.0 DC and AC Characteristics Graphs and Charts ....................................................................................................................... 283
28.0 Development Support............................................................................................................................................................... 305
29.0 Packaging Information.............................................................................................................................................................. 309
Appendix A: Data Sheet Revision History.......................................................................................................................................... 327
The Microchip Web Site ..................................................................................................................................................................... 329
Customer Change Notification Service .............................................................................................................................................. 329
Customer Support .............................................................................................................................................................................. 329
Product Identification System............................................................................................................................................................. 331
DS40001723D-page 4
2013-2015 Microchip Technology Inc.
PIC12(L)F1571/2
TO OUR VALUED CUSTOMERS
It is our intention to provide our valued customers with the best documentation possible to ensure successful use of your Microchip
products. To this end, we will continue to improve our publications to better suit your needs. Our publications will be refined and
enhanced as new volumes and updates are introduced.
If you have any questions or comments regarding this publication, please contact the Marketing Communications Department via
E-mail at docerrors@microchip.com. We welcome your feedback.
Most Current Data Sheet
To obtain the most up-to-date version of this data sheet, please register at our Worldwide Web site at:
http://www.microchip.com
You can determine the version of a data sheet by examining its literature number found on the bottom outside corner of any page.
The last character of the literature number is the version number, (e.g., DS30000000A is version A of document DS30000000).
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.
Customer Notification System
Register on our web site at www.microchip.com to receive the most current information on all of our products.
2013-2015 Microchip Technology Inc.
DS40001723D-page 5
PIC12(L)F1571/2
NOTES:
DS40001723D-page 6
2013-2015 Microchip Technology Inc.
PIC12(L)F1571/2
1.0
DEVICE OVERVIEW
1.1
The PIC12(L)F1571/2 devices are described within this
data sheet. The block diagram of these devices is shown
in Figure 1-1, the available peripherals are shown in
Table 1-1 and the pinout descriptions are shown in
Table 1-2.
Peripheral
PIC12(L)F1572
DEVICE PERIPHERAL
SUMMARY
PIC12(L)F1571
TABLE 1-1:
Analog-to-Digital Converter (ADC)
●
●
Complementary Wave Generator
(CWG)
●
●
Digital-to-Analog Converter (DAC)
●
●
Enhanced Universal
Synchronous/Asynchronous
Receiver/Transmitter (EUSART)
REGISTER NAMES
When there are multiple instances of the same
peripheral in a device, the peripheral control registers
will be depicted as the concatenation of a peripheral
identifier, peripheral instance and control identifier. The
control registers section will show just one instance of
all the register names with an ‘x’ in the place of the
peripheral instance number. This naming convention
may also be applied to peripherals when there is only
one instance of that peripheral in the device to maintain
compatibility with other devices in the family that
contain more than one.
1.1.2
BIT NAMES
There are two variants for bit names:
• Short name: Bit function abbreviation
• Long name: Peripheral abbreviation + short name
●
1.1.2.1
Short bit names are an abbreviation for the bit function.
For example, some peripherals are enabled with the
EN bit. The bit names shown in the registers are the
short name variant.
Fixed Voltage Reference (FVR)
●
●
Temperature Indicator
●
●
C1
●
●
PWM1
●
●
PWM2
●
●
PWM3
●
●
Timer0
●
●
Timer1
●
●
Timer2
●
●
Comparators
PWM Modules
Timers
2013-2015 Microchip Technology Inc.
1.1.1
Register and Bit Naming
Conventions
Short Bit Names
Short bit names are useful when accessing bits in C
programs. The general format for accessing bits by the
short name is RegisterNamebits.ShortName. For
example, the enable bit, EN, in the COG1CON0 register can be set in C programs with the instruction,
COG1CON0bits.EN = 1.
Short names are generally not useful in assembly
programs because the same name may be used by
different peripherals in different bit positions. When this
occurs, during the include file generation, all instances
of that short bit name are appended with an
underscore, plus the name of the register in which the
bit resides, to avoid naming contentions.
DS40001723D-page 7
PIC12(L)F1571/2
1.1.2.2
Long Bit Names
Long bit names are constructed by adding a peripheral
abbreviation prefix to the short name. The prefix is
unique to the peripheral, thereby making every long bit
name unique. The long bit name for the COG1 enable bit
is the COG1 prefix, G1, appended with the enable bit
short name, EN, resulting in the unique bit name G1EN.
Long bit names are useful in both C and assembly programs. For example, in C, the COG1CON0 enable bit
can be set with the G1EN = 1 instruction. In assembly,
this bit can be set with the BSF COG1CON0,G1EN
instruction.
1.1.2.3
Bit Fields
Bit fields are two or more adjacent bits in the same
register. Bit fields adhere only to the short bit naming
convention. For example, the three Least Significant
bits of the COG1CON0 register contain the mode
control bits. The short name for this field is MD. There
is no long bit name variant. Bit field access is only
possible in C programs. The following example
demonstrates a C program instruction for setting the
COG1 to the Push-Pull mode:
1.1.3
1.1.3.1
REGISTER AND BIT NAMING
EXCEPTIONS
Status, Interrupt and Mirror Bits
Status, interrupt enables, interrupt flags and mirror bits
are contained in registers that span more than one
peripheral. In these cases, the bit name shown is
unique so there is no prefix or short name variant.
1.1.3.2
Legacy Peripherals
There are some peripherals that do not strictly adhere
to these naming conventions. Peripherals that have
existed for many years and are present in almost every
device are the exceptions. These exceptions were
necessary to limit the adverse impact of the new
conventions on legacy code. Peripherals that do
adhere to the new convention will include a table in the
registers section indicating the long name prefix for
each peripheral instance. Peripherals that fall into the
exception category will not have this table. These
peripherals include, but are not limited to, the following:
• EUSART
• MSSP
COG1CON0bits.MD = 0x5;
Individual bits in a bit field can also be accessed with
long and short bit names. Each bit is the field name
appended with the number of the bit position within the
field. For example, the Most Significant mode bit has
the short bit name, MD2, and the long bit name is
G1MD2. The following two examples demonstrate
assembly program sequences for setting the COG1 to
Push-Pull mode:
Example 1:
MOVLW
ANDWF
MOVLW
IORWF
~(1