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:
• 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
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
eXtreme Low-Power (XLP) Features:
• Sleep mode: 20 nA @ 1.8V, Typical
• Watchdog Timer: 260 nA @ 1.8V, Typical
• Operating Current:
-30 A/MHz @ 1.8V, typical
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
2.0Enhanced Mid-Range CPU ........................................................................................................................................................ 13
10.0 Flash Program Memory Control ................................................................................................................................................. 91
27.0 DC and AC Characteristics Graphs and Charts ....................................................................................................................... 283
28.0 Development Support............................................................................................................................................................... 305
Appendix A: Data Sheet Revision History .......................................................................................................................................... 327
The Microchip Web Site..................................................................................................................................................................... 329
Customer Change Notification Service .............................................................................................................................................. 329
Customer Support .............................................................................................................................................................................. 329
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.
DS40001723D-page 6 2013-2015 Microchip Technology Inc.
PIC12(L)F1571/2
1.0DEVICE OVERVIEW
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.
Fixed Voltage Reference (FVR)●●
Temperature Indicator●●
Comparators
PWM Modules
PWM1●●
PWM2●●
PWM3●●
Timers
Timer0●●
Timer1●●
Timer2●●
●●
●
C1●●
1.1Register and Bit Naming
Conventions
1.1.1REGISTER 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.2BIT NAMES
There are two variants for bit names:
• Short name: Bit function abbreviation
• Long name: Peripheral abbreviation + short name
1.1.2.1Short Bit Names
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.
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.
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.3Bit 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:
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:
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.2Legacy 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
DS40001723D-page 8 2013-2015 Microchip Technology Inc.
FIGURE 1-1:PIC12(L)F1571/2 BLOCK DIAGRAM
Note1:See applicable chapters for more information on peripherals.
2:See Table 1-1 for peripherals available on specific devices.
3:See Figure 2-1.
4:PIC12(L)F1572 only.
DS40001723D-page 12 2013-2015 Microchip Technology Inc.
PIC12(L)F1571/2
15
15
15
15
8
8
8
12
14
7
5
3
Program Counter
MUX
Addr MUX
16-Level Stack
(15-bit)
Program Memory
Read (PMR)
Instruction Reg
Configuration
FSR0 Reg
FSR1 Reg
BSR Reg
STATUS Reg
RAM
WReg
Power-up
Timer
Power-on
Reset
Watchdog
Timer
Brown-out
Reset
Instruction
Decode and
Control
Timing
Generation
Internal
Oscillator
Block
ALU
Flash
Program
Memory
MUX
Data Bus
Program
Bus
Direct Addr
Indirect
Addr
RAM Addr
CLKIN
CLKOUT
V
DDVSS
Rev. 10-000055A
7/30/2013
12
12
2.0ENHANCED MID-RANGE CPU
This family of devices contains an enhanced mid-range
8-bit CPU core. The CPU has 49 instructions. Interrupt
capability includes automatic context saving. The
hardware stack is 16 levels deep and has Overflow and
Underflow Reset capability. Direct, Indirect and
Relative Addressing modes are available. Two File
Select Registers (FSRs) provide the ability to read
program and data memory.
During interrupts, certain registers are automatically
saved in shadow registers and restored when returning
from the interrupt. This saves stack space and user
code. See Section 7.5 “Automatic Context Saving”,
for more information.
2.216-Level Stack with Overflow and
Underflow
These devices have a hardware stack memory, 15 bits
wide and 16 words deep. A Stack Overflow or Underflow
will set the appropriate bit (STKOVF or STKUNF) in the
PCON register, and if enabled, will cause a Software
Reset. See Section 3.5 “Stack” for more details.
2.3File Select Registers
There are two 16-bit File Select Registers (FSR). FSRs
can access all file registers and program memory,
which allows one Data Pointer for all memory. When an
FSR points to program memory, there is one additional
instruction cycle in instructions using INDF to allow the
data to be fetched. General purpose memory can now
also be addressed linearly, providing the ability to
access contiguous data larger than 80 bytes. There
are also new instructions to support the FSRs. See
Section 3.6 “Indirect Addressing” for more details.
2.4Instruction Set
There are 49 instructions for the enhanced midrange CPU to support the features of the CPU. See
Section 25.0 “Instruction Set Summary” for more
details.
DS40001723D-page 14 2013-2015 Microchip Technology Inc.
PIC12(L)F1571/2
3.0MEMORY ORGANIZATION
These devices contain the following types of memory:
• Program Memory:
- Configuration Words
- Device ID
-User ID
- Flash Program Memory
• Data Memory:
- Core Registers
- Special Function Registers
- General Purpose RAM
- Common RAM
The following features are associated with access and
control of program memory and data memory:
• PCL and PCLATH
•Stack
• Indirect Addressing
3.1Program Memory Organization
The enhanced mid-range core has a 15-bit Program
Counter (PC) capable of addressing a 32K x 14 program
memory space. Table 3-1 shows the memory sizes
implemented. Accessing a location above these boundaries will cause a wraparound within the implemented
memory space. The Reset vector is at 0000h and the
interrupt vector is at 0004h (see Figure 3-1).
3.2High-Endurance Flash
This device has a 128-byte section of high-endurance
Program Flash Memory (PFM) in lieu of data
EEPROM. This area is especially well-suited for nonvolatile data storage that is expected to be updated
frequently over the life of the end product. See
Section 10.2 “Flash Program Memory Overview”
for more information on writing data to PFM. See
Section 3.2.1.2 “Indirect Read with FSR” for more
information about using the FSR registers to read byte
data stored in PFM.
;… LOTS OF CODE…
MOVLWDATA_INDEX
ADDLWLOW constants
MOVWFFSR1L
MOVLW
HIGH constants
;MSb is set
automatically
MOVWFFSR1H
BTFSCSTATUS,C ;carry from ADDLW?
INCFFSR1H,f ;yes
MOVIW0[FSR1]
;THE PROGRAM MEMORY IS IN W
3.2.1READING PROGRAM MEMORY AS
DATA
There are two methods of accessing constants in program memory. The first method is to use tables of
RETLW instructions. The second method is to set an
FSR to point to the program memory.
3.2.1.1RETLW Instruction
The RETLW instruction can be used to provide access
to tables of constants. The recommended way to create
such a table is shown in Example 3-1.
EXAMPLE 3-1:RETLW INSTRUCTION
3.2.1.2Indirect Read with FSR
The program memory can be accessed as data by
setting bit 7 of the FSRnH register and reading the
matching INDFn register. The MOVIW instruction will
place the lower eight bits of the addressed word in the
W register. Writes to the program memory cannot be
performed via the INDFn registers. Instructions that
access the program memory via the FSR require one
extra instruction cycle to complete. Example 3-2
demonstrates accessing the program memory via an
FSR.
The HIGH operator will set bit<7> if a label points to a
location in program memory.
EXAMPLE 3-2:ACCESSING PROGRAM
MEMORY VIA FSR
The BRW instruction makes this type of table very
simple to implement. If your code must remain portable
with previous generations of microcontrollers, then the
BRW instruction is not available, so the older table read
method must be used.
x00h or x80hINDF0
x01h or x81hINDF1
x02h or x82hPCL
x03h or x83hSTATUS
x04h or x84hFSR0L
x05h or x85hFSR0H
x06h or x86hFSR1L
x07h or x87hFSR1H
x08h or x88hBSR
x09h or x89hWREG
x0Ah or x8AhPCLATH
x0Bh or x8BhINTCON
3.3Data Memory Organization
The data memory is partitioned in 32 memory banks
with 128 bytes in a bank. Each bank consists of
(Figure 3-3):
• 12 Core Registers
• 20 Special Function Registers (SFR)
• Up to 80 bytes of General Purpose RAM (GPR)
• 16 bytes of Common RAM
The active bank is selected by writing the bank number
into the Bank Select Register (BSR). Unimplemented
memory will read as ‘0’. All data memory can be
accessed either directly (via instructions that use the file
registers) or indirectly via the two File Select Registers
(FSR). See Section 3.6 “Indirect Addressing” for
more information.
Data memory uses a 12-bit address. The upper five bits
of the address define the bank address and the lower
seven bits select the registers/RAM in that bank.
3.3.1CORE REGISTERS
The core registers contain the registers that directly
affect the basic operation. The core registers occupy
the first 12 addresses of every data memory bank
(addresses: x00h/x08h through x0Bh/x8Bh). These
registers are listed below in Ta b le 3 - 2 . For detailed
information, see Tab le 3 -9 .
TABLE 3-2:CORE REGISTERS
DS40001723D-page 18 2013-2015 Microchip Technology Inc.
PIC12(L)F1571/2
3.3.1.1STATUS Register
The STATUS register, shown in Register 3-1, contains:
• The arithmetic status of the ALU
• The Reset status
The STATUS register can be the destination for any
instruction, like any other register. If the STATUS
register is the destination for an instruction that affects
the Z, DC or C bits, then the write to these three bits is
disabled. These bits are set or cleared according to the
device logic. Furthermore, the TO
writable. Therefore, the result of an instruction with the
STATUS register as destination may be different than
intended.
and PD bits are not
For example, CLRF STATUS will clear the upper three
bits and set the Z bit. This leaves the STATUS register
as ‘000u u1uu’ (where u = unchanged).
It is recommended, therefore, that only BCF, BSF,SWAPF and MOVWF instructions are used to alter the
STATUS register, because these instructions do not
affect any Status bits. For other instructions not affecting
any Status bits, refer to Section 25.0 “Instruction Set
Summary”).
Note 1: The C and DC bits operate as Borrow
and Digit Borrow out bits, respectively, in
subtraction.
REGISTER 3-1:STATUS: STATUS REGISTER
U-0U-0U-0R-1/qR-1/qR/W-0/uR/W-0/uR/W-0/u
———TOPDZDC
bit 7bit 0
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
u = Bit is unchangedx = Bit is unknown-n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set‘0’ = Bit is clearedq = Value depends on condition
(1)
(1)
C
bit 7-5Unimplemented: Read as ‘0’
bit 4TO
bit 3PD
bit 2Z: Zero bit
bit 1DC: Digit Carry/Digit Borrow
bit 0C: Carry/Borrow
Note 1:For Borrow
second operand. For rotate (RRF, RLF) instructions, this bit is loaded with either the high-order or low-order
bit of the source register.
: Time-out bit
1 = After power-up, CLRWDT instruction or SLEEP instruction
0 = A WDT time-out occurred
: Power-Down bit
1 = After power-down or by the CLRWDT instruction
0 = By execution of the SLEEP instruction
1 = The result of an arithmetic or logic operation is zero
0 = The result of an arithmetic or logic operation is not zero
1 = A carry-out from the 4th low-order bit of the result occurred
0 = No carry-out from the 4th low-order bit of the result
(1)
bit
(ADDWF, ADDLW, SUBLW, SUBWF instructions)
1 = A carry-out from the Most Significant bit of the result occurred
0 = No carry-out from the Most Significant bit of the result occurred
, the polarity is reversed. A subtraction is executed by adding the two’s complement of the
The Special Function Registers are registers used by
the application to control the desired operation of
peripheral functions in the device. The Special Function
Registers occupy the 20 bytes after the core registers of
every data memory bank (addresses: x0Ch/x8Ch
through x1Fh/x9Fh). The registers associated with the
operation of the peripherals are described in the
appropriate peripheral chapter of this data sheet.
3.3.3GENERAL PURPOSE RAM
There are up to 80 bytes of GPR in each data memory
bank. The Special Function Registers occupy the
20 bytes after the core registers of every data memory
bank (addresses: x0Ch/x8Ch through x1Fh/x9Fh).
3.3.3.1Linear Access to GPR
The general purpose RAM can be accessed in
a non-banked method via the FSRs. This can
simplify access to large memory structures. See
Section 3.6.2 “Linear Data Memory” for more
information.
3.3.4COMMON RAM
There are 16 bytes of common RAM accessible from all
banks.
FIGURE 3-3:BANKED MEMORY
PARTITIONING
3.3.5DEVICE MEMORY MAPS
The memory maps for PIC12(L)F1571/2 are as shown
in Table 3-3 through Tab l e 3 - 8 .
DS40001723D-page 20 2013-2015 Microchip Technology Inc.
Legend:x = unknown; u = unchanged; q = value depends on condition; — = unimplemented; r = reserved. Shaded locations are unimplemented, read as ‘0’.
Note 1: