Professional Documents
Culture Documents
Data Sheet
64-Pin Flash Microcontrollers
with nanoWatt XLP Technology
Preliminary
DS41458A
Note the following details of the code protection feature on Microchip devices:
Microchip products meet the specification contained in their particular Microchip Data Sheet.
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 Microchips 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 Microchips 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.
Trademarks
The Microchip name and logo, the Microchip logo, dsPIC,
KEELOQ, KEELOQ logo, MPLAB, PIC, PICmicro, PICSTART,
PIC32 logo, rfPIC and UNI/O are registered trademarks of
Microchip Technology Incorporated in the U.S.A. and other
countries.
FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor,
MXDEV, MXLAB, SEEVAL and The Embedded Control
Solutions Company are registered trademarks of Microchip
Technology Incorporated in the U.S.A.
Analog-for-the-Digital Age, Application Maestro, CodeGuard,
dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN,
ECONOMONITOR, FanSense, HI-TIDE, In-Circuit Serial
Programming, ICSP, Mindi, MiWi, MPASM, MPLAB Certified
logo, MPLIB, MPLINK, mTouch, Omniscient Code
Generation, PICC, PICC-18, PICDEM, PICDEM.net, PICkit,
PICtail, REAL ICE, rfLAB, Select Mode, Total Endurance,
TSHARC, UniWinDriver, WiperLock and ZENA are
trademarks of Microchip Technology Incorporated in the
U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated
in the U.S.A.
All other trademarks mentioned herein are property of their
respective companies.
2011, Microchip Technology Incorporated, Printed in the
U.S.A., All Rights Reserved.
Printed on recycled paper.
ISBN: 978-1-60932-845-0
Microchip received ISO/TS-16949:2002 certification for its worldwide
headquarters, design and wafer fabrication facilities in Chandler and
Tempe, Arizona; Gresham, Oregon and design centers in California
and India. The Companys quality system processes and procedures
are for its PIC MCUs and dsPIC DSCs, KEELOQ code hopping
devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchips quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.
DS41458A-page 2
Preliminary
PIC16(L)F1526/27
64-Pin Flash Microcontrollers with nanoWatt Technology
High-Performance RISC CPU:
Analog Features:
Analog-to-Digital Converter (ADC):
- 10-bit resolution
- 30 external channels
- Two internal channels
- Fixed Voltage Reference (FVR) channel
- Temperature Indicator channel
- Auto acquisition capability
- Conversion available during Sleep
- Dedicated ADC RC oscillator
- Fixed Voltage Reference (FVR) as ADC
positive reference
Voltage Reference module:
- Fixed Voltage Reference (FVR) with 1.024V,
2.048V and 4.096V output levels
- Low-Power Sleep mode
- Low-Power BOR (LPBOR)
Peripheral Features:
Preliminary
DS41458A-page 3
PIC16(L)F1526/27
TABLE 1:
Device
PIC16F1526
PIC16LF1526
PIC16F1527
PIC16LF1527
FIGURE 1:
Program
Memory Flash
(words)
SRAM
(bytes)
I/Os
10-bit A/D
(ch)
Timers
8/16-bit
EUSART
MSSP
(I2C/SPI)
CCP
8192
768
54
30
6/3
10
16384
1536
54
30
6/3
10
RD0
VDD
VSS
RD1
RD2
RD3
RD4
RD5
RD6
RD7
RE2
RE3
RE4
RE5
RE6
RE7
TQFP
64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49
RE1
RE0
RG0
RG1
RG2
RG3
VPP/MCLR/RG5
RG4
VSS
VDD
RF7
RF6
RF5
RF4
RF3
RF2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
PIC16(L)F1526
PIC16(L)F1527
48
47
46
45
44
43
42
41
40
39
38
37
36
35
34
33
RB0
RB1
RB2
RB3
RB4
RB5
RB6
VSS
RA6
RA7
VDD
RB7
RC5
RC4
RC3
RC2
RF1
RF0
AVDD
AVSS
RA3
RA2
RA1
RA0
VSS
VDD
RA5
RA4
RC1
RC0
RC6
RC7
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
Note 1:
DS41458A-page 4
See TABLE 1-2: PIC16(L)F1526 Pinout Description for list of pin peripheral
function.
Preliminary
PIC16(L)F1526/27
FIGURE 2:
RD0
VDD
VSS
RD1
RD2
RD3
RD4
RD5
RD6
RD7
RE2
RE3
RE4
RE5
RE6
RE7
QFN
64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49
RE1
RE0
RG0
RG1
RG2
RG3
VPP/MCLR/RG5
RG4
VSS
VDD
RF7
RF6
RF5
RF4
RF3
RF2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
PIC16(L)F1526
PIC16(L)F1527
48
47
46
45
44
43
42
41
40
39
38
37
36
35
34
33
RB0
RB1
RB2
RB3
RB4
RB5
RB6
VSS
RA6
RA7
VDD
RB7
RC5
RC4
RC3
RC2
RF1
RF0
AVDD
AVSS
RA3
RA2
RA1
RA0
VSS
VDD
RA5
RA4
RC1
RC0
RC6
RC7
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
Note 1:
See TABLE 1-2: PIC16(L)F1526 Pinout Description for list of pin peripheral
function.
Preliminary
DS41458A-page 5
PIC16(L)F1526/27
47
46
45
44
43
42
37
30
29
33
34
35
36
31
32
58
55
54
53
52
51
50
AN18
AN19
AN20
AN21
AN22
AN23
AN24
AN25
AN26
TX1/CK1
RX1/DT1
SCK1/SCL1
SDI1/SDA1
SDO1
SDO2
SDI2, SDA2
SCK2, SCL2
T3CKI(2)
T1G/T3CKI(1)
SOSCO/T1CKI
SOSCI
CCP2(1)
CCP1
T5CKI
Basic
RB1
RB2
RB3
RB4
RB5
RB6
RB7
RC0
RC1
RC2
RC3
RC4
RC5
RC6
RC7
RD0
RD1
RD2
RD3
RD4
RD5
RD6
Pull-up
T0CKI
T3G
Interrupt
AN0
AN1
AN2
AN3
AN4
AN17
SSP
Timers
24
23
22
21
28
27
40
39
48
USART
A/D
RA0
RA1
RA2
RA3
RA4
RA5
RA6
RA7
RB0
CCP
I/O
TABLE 1:
INT/
IOC
IOC
IOC
IOC
IOC
IOC
IOC
IOC
VREF+
OSC2/CLKOUT
OSC1/CLKIN
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
ICSPCLK/ICDCLK
ICSPDAT/ICDDAT
RD7
49
SS2
RE0
2
AN27
RE1
1
AN28
RE2
64
AN29
CCP10
RE3
63
CCP9
RE4
62
CCP8
RE5
61
CCP7
RE6
60
CCP6
Note 1: Peripheral pin location selected using APFCON register. Default Location.
2: Peripheral pin location selected using APFCON register. Alternate Location.
3: Weak pull-up is always enabled when MCLR is enabled, otherwise the pull-up is under user control.
DS41458A-page 6
Preliminary
PIC16(L)F1526/27
64-Pin TQFP, QFN
A/D
Timers
CCP
USART
SSP
Interrupt
Pull-up
Basic
I/O
TABLE 1:
RE7
RF0
RF1
RF2
RF3
RF4
RF5
RF6
59
18
17
16
15
14
13
12
AN16
AN6
AN7
AN8
AN9
AN10
AN11
CCP2(2)
VCAP
RF7
RG0
RG1
RG2
RG3
RG4
11
3
4
5
6
8
AN5
AN15
AN14
AN13
AN12
T5G
CCP3
CCP4
CCP5
TX2/CK2
RX2/DT2
SS1
RG5
VDD
VSS
AVDD
AVSS
Note 1:
2:
3:
Y(3)
MCLR/VPP
10, 26,
VDD
38, 57
9, 25,
VSS
41, 56
19
AVDD
20
AVSS
Peripheral pin location selected using APFCON register. Default Location.
Peripheral pin location selected using APFCON register. Alternate Location.
Weak pull-up is always enabled when MCLR is enabled, otherwise the pull-up is under user control.
Preliminary
DS41458A-page 7
PIC16(L)F1526/27
Table of Contents
1.0 Device Overview ........................................................................................................................................................................ 11
2.0 Enhanced Mid-Range CPU ........................................................................................................................................................ 17
3.0 Memory Organization ................................................................................................................................................................. 19
4.0 Device Configuration .................................................................................................................................................................. 45
5.0 Oscillator Module (With Fail-Safe Clock Monitor)....................................................................................................................... 51
6.0 Resets ........................................................................................................................................................................................ 67
7.0 Interrupts .................................................................................................................................................................................... 75
8.0 Power-Down Mode (Sleep) ........................................................................................................................................................ 91
9.0 Low Dropout (LDO) Voltage Regulator ...................................................................................................................................... 95
10.0 Watchdog Timer (WDT) ............................................................................................................................................................. 97
11.0 Flash Program Memory Control ............................................................................................................................................... 101
12.0 I/O Ports ................................................................................................................................................................................... 113
13.0 Interrupt-on-Change ................................................................................................................................................................. 139
14.0 Fixed Voltage Reference (FVR) ............................................................................................................................................... 143
15.0 Temperature Indicator .............................................................................................................................................................. 145
16.0 Analog-to-Digital Converter (ADC) Module .............................................................................................................................. 147
17.0 Timer0 Module ......................................................................................................................................................................... 161
18.0 Timer1/3/5 Modules.................................................................................................................................................................. 165
19.0 Timer2/4/6/8/10 Modules.......................................................................................................................................................... 177
20.0 Capture/Compare/PWM Module .............................................................................................................................................. 181
21.0 Master Synchronous Serial Port (MSSP) Module .................................................................................................................... 199
22.0 Enhanced Universal Synchronous Asynchronous Receiver Transmitter (EUSART) ............................................................... 253
23.0 In-Circuit Serial Programming (ICSP) ................................................................................................................................ 283
24.0 Instruction Set Summary .......................................................................................................................................................... 287
25.0 Electrical Specifications............................................................................................................................................................ 301
26.0 DC and AC Characteristics Graphs and Tables ....................................................................................................................... 331
27.0 Development Support............................................................................................................................................................... 333
28.0 Packaging Information.............................................................................................................................................................. 335
Appendix A: Revision History............................................................................................................................................................. 343
Index .................................................................................................................................................................................................. 345
The Microchip Web Site ..................................................................................................................................................................... 351
Customer Change Notification Service .............................................................................................................................................. 351
Customer Support .............................................................................................................................................................................. 351
Reader Response .............................................................................................................................................................................. 352
Product Identification System............................................................................................................................................................. 353
DS41458A-page 8
Preliminary
PIC16(L)F1526/27
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 or fax the Reader Response Form in the back of this data sheet to (480) 792-4150. We
welcome your feedback.
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:
Microchips 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.
Preliminary
DS41458A-page 9
PIC16(L)F1526/27
NOTES:
DS41458A-page 10
Preliminary
PIC16(L)F1526/27
1.0
DEVICE OVERVIEW
PIC16F1527
PIC16LF1527
DEVICE PERIPHERAL
SUMMARY
PIC16F1526
PIC16LF1526
TABLE 1-1:
ADC
EUSART
Temperature Indicator
CCP1
CCP2
CCP3
CCP4
CCP5
CCP6
CCP7
CCP8
CCP9
CCP10
EUSART1
EUSART2
MSSP1
MSSP2
Peripheral
Capture/Compare/PWM Modules
EUSARTs
Timers
Timer0
Timer1/3/5
Timer2/4/6
/8/10
Preliminary
DS41458A-page 11
PIC16(L)F1526/27
FIGURE 1-1:
PORTA
Program
Flash Memory
RAM
PORTB
OSC2/CLKOUT
Timing
Generation
OSC1/CLKIN
PORTC
CPU
INTRC
Oscillator
PORTD
(Figure 2-1)
MCLR
PORTE
PORTF
Timer0
Timer1/3/5
Timer2/4/6/8/10
EUSARTs
PORTG
CCP1-10
Note
1:
2:
DS41458A-page 12
MSSPs
Temp.
Indicator
ADC
10-Bit
FVR
Preliminary
PIC16(L)F1526/27
TABLE 1-2:
Name
RA0/AN0
RA1/AN1
RA2/AN2
RA3/AN3/VREF+
RA4/T0CKI
RA5/AN4/T3G
RA6/OSC2/CLKOUT
RA7/OSC1/CLKIN
RB0/AN17/INT
RB1/AN18
RB2/AN19
RB3/AN20
RB4/AN21/T3CKI(2)
RB5/AN22/T1G/T3CKI(1)/
RB6/ICSPCLK/ICDCLK
Function
Input
Type
Output
Type
RA0
TTL
AN0
AN
RA1
TTL
AN1
AN
RA2
TTL
AN2
AN
RA3
TTL
AN3
AN
VREF+
AN
RA4
TTL
Description
T0CKI
ST
RA5
TTL
AN4
AN
T3G
ST
RA6
TTL
OSC2
CLKOUT
RA7
TTL
OSC1
XTAL
CLKIN
ST
RB0
TTL
AN17
AN
INT
ST
RB1
TTL
AN18
AN
RB2
TTL
AN19
AN
RB3
TTL
AN20
AN
RB4
TTL
External interrupt.
AN21
AN
T3CKI
ST
RB5
TTL
AN22
AN
T1G
ST
T3CKI
ST
RB6
TTL
ICSPCLK
ST
ICDCLK
ST
Preliminary
DS41458A-page 13
PIC16(L)F1526/27
TABLE 1-2:
Name
RB7/ICSPDAT/ICDDAT
RC0/SOSCO/T1CKI
RC1/SOSCI/CCP2(1)
RC2/CCP1
RC3/SCK1/SCL1(3)
RC4/SDI1/SDA1
(3)
RC5/SDO1
RC6/TX1/CK1
RC7/RX1/DT1
RDO/AN23
RD1/AN24/T5CKI
RD2/AN25
RD3/AN26
RD4/SDO2
RD5/SDI2/SDA2(3)
Function
Input
Type
RB7
TTL
Output
Type
Description
ICSPDAT
ST
ICDDAT
ST
RC0
ST
SOSCO
XTAL
XTAL
T1CKI
ST
RC1
ST
SOSCI
XTAL
CCP2
ST
CMOS Capture/Compare/PWM2.
RC2
ST
CCP1
ST
CMOS Capture/Compare/PWM1.
RC3
ST
SCK1
ST
SCL1
I C
OD
I2C clock.
RC4
ST
SDI1
ST
SDA1
I2C
OD
RC5
ST
SDO1
RC6
ST
TX1
CK1
ST
RC7
ST
RX1
ST
DT1
ST
RD0
ST
AN23
AN
RD1
ST
AN24
AN
T5CKI
ST
RD2
ST
AN25
AN
RD3
ST
AN26
AN
RD4
ST
SDO2
RD5
ST
SDI2
ST
SDA2
I2C
OD
DS41458A-page 14
Preliminary
PIC16(L)F1526/27
TABLE 1-2:
Name
RD6/SCK2/SCL2(3)
RD7/SS2
RE0/AN27
RE1/AN28
RE2/AN29/CCP10
RE3/CCP9
RE4/CCP8
RE5/CCP7
RE6/CCP6
RE7/CCP2(2)
RF0/AN16/VCAP
RF1/AN6
RF2/AN7
RF3/AN8
RF4/AN9
RF5/AN10
RF6/AN11
RF7/AN5/SS1
Function
Input
Type
RD6
ST
SCK2
ST
SCL2
I2C
RD7
ST
SS2
ST
RE0
ST
AN27
AN
RE1
ST
AN28
AN
Output
Type
OD
Description
I2C clock.
RE2
ST
AN29
AN
CCP10
ST
CMOS Capture/Compare/PWM10.
RE3
ST
CCP9
ST
CMOS Capture/Compare/PWM9.
RE4
ST
CCP8
ST
CMOS Capture/Compare/PWM8.
RE5
ST
CCP7
ST
CMOS Capture/Compare/PWM7.
RE6
ST
CCP6
ST
CMOS Capture/Compare/PWM6.
RE7
ST
CCP2
ST
CMOS Capture/Compare/PWM2.
RF0
ST
AN16
AN
VCAP
Power
Power
RF1
ST
AN6
AN
RF2
ST
AN7
AN
RF3
ST
AN8
AN
RF4
ST
AN9
AN
RF5
ST
AN10
AN
RF6
ST
AN11
AN
RF7
ST
AN5
AN
SS1
ST
Preliminary
DS41458A-page 15
PIC16(L)F1526/27
TABLE 1-2:
Name
RG0/CCP3
RG1/AN15/TX2/CK2
RG2/AN14/RX2/DT2
RG3/AN13/CCP4
RG4/AN12/T5G/CCP5
Function
Input
Type
Output
Type
RG0
ST
CCP3
ST
CMOS Capture/Compare/PWM3.
RG1
ST
AN15
AN
TX2
Description
CK2
ST
RG2
ST
AN14
AN
RX2
ST
DT2
ST
RG3
ST
AN13
AN
CCP4
ST
CMOS Capture/Compare/PWM4.
RG4
ST
AN12
AN
T5G
ST
CCP5
ST
CMOS Capture/Compare/PWM5.
RG5
ST
MCLR
ST
VPP
HV
Programming voltage.
AVDD
AVDD
Power
AVSS
AVSS
Power
VDD
VDD
Power
Positive supply.
VSS
VSS
Power
Ground reference.
RG5/MCLR/VPP
DS41458A-page 16
Preliminary
PIC16(L)F1526/27
2.0
2.1
2.2
2.3
2.4
Instruction Set
Preliminary
DS41458A-page 17
PIC16(L)F1526/27
FIGURE 2-1:
15
Configuration
15
MUX
Flash
Program
Memory
Program
Bus
16-Level
8 Level Stack
Stack
(13-bit)
(15-bit)
14
Instruction
Instruction Reg
reg
Data Bus
Program Counter
RAM
Program Memory
Read (PMR)
12
RAM Addr
Addr MUX
Indirect
Addr
12
12
Direct Addr 7
5
BSR
FSR Reg
reg
15
FSR0reg
Reg
FSR
FSR1
Reg
FSR reg
15
STATUS Reg
reg
STATUS
8
3
Power-up
Timer
CLKIN
CLKOUT
Instruction
Decodeand
&
Decode
Control
Timing
Generation
Oscillator
Start-up Timer
Power-on
Reset
Watchdog
Timer
Brown-out
Reset
MUX
ALU
8
W Reg
Internal
Oscillator
Block
VDD
DS41458A-page 18
VSS
Preliminary
PIC16(L)F1526/27
3.0
MEMORY ORGANIZATION
3.1
TABLE 3-1:
PIC16F1526
PIC16LF1526
8,192
1FFFh
PIC16F1527
PIC16LF1527
16,384
3FFFh
Preliminary
DS41458A-page 19
PIC16(L)F1526/27
FIGURE 3-1:
FIGURE 3-2:
PC<14:0>
CALL, CALLW
RETURN, RETLW
Interrupt, RETFIE
PC<14:0>
15
Stack Level 0
Stack Level 1
CALL, CALLW
15
RETURN, RETLW
Interrupt, RETFIE
Stack Level 0
Stack Level 1
Stack Level 15
Stack Level 15
Reset Vector
0000h
Reset Vector
0000h
Interrupt Vector
0004h
0005h
Interrupt Vector
0004h
0005h
Page 0
Page 0
07FFh
0800h
On-chip
Program
Memory
07FFh
0800h
Page 1
Page 1
0FFFh
1000h
Page 2
Page 3
Rollover to Page 0
17FFh
1800h
0FFFh
1000h
On-chip
Program
Memory
Page 2
Page 3
1FFFh
2000h
Page 4
Page 7
Rollover to Page 0
Rollover to Page 3
DS41458A-page 20
7FFFh
Preliminary
Rollover to Page 7
17FFh
1800h
1FFFh
2000h
3FFFh
4000h
7FFFh
PIC16(L)F1526/27
3.1.1
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.1.1.1
RETLW Instruction
EXAMPLE 3-1:
constants
BRW
RETLW
RETLW
RETLW
RETLW
DATA0
DATA1
DATA2
DATA3
RETLW INSTRUCTION
EXAMPLE 3-2:
ACCESSING PROGRAM
MEMORY VIA FSR
constants
RETLW DATA0
;Index0 data
RETLW DATA1
;Index1 data
RETLW DATA2
RETLW DATA3
my_function
; LOTS OF CODE
MOVLW
LOW constants
MOVWF
FSR1L
MOVLW
HIGH constants
MOVWF
FSR1H
MOVIW 0[FSR1]
;THE PROGRAM MEMORY IS IN W
;Add Index in W to
;program counter to
;select data
;Index0 data
;Index1 data
my_function
; LOTS OF CODE
MOVLW
DATA_INDEX
CALL constants
; THE CONSTANT IS IN W
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.
3.1.1.2
The program memory can be accessed as data by setting bit 7 of the FSRxH register and reading the matching INDFx register. The MOVIW instruction will place the
lower 8 bits of the addressed word in the W register.
Writes to the program memory cannot be performed via
the INDF 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 directive will set bit<7> if a label points to a
location in program memory.
Preliminary
DS41458A-page 21
PIC16(L)F1526/27
3.2
3.2.1
12 core registers
20 Special Function Registers (SFR)
Up to 80 bytes of General Purpose RAM (GPR)
16 bytes of common RAM
TABLE 3-2:
DS41458A-page 22
CORE REGISTERS
Preliminary
CORE REGISTERS
Addresses
BANKx
x00h or x80h
x01h or x81h
x02h or x82h
x03h or x83h
x04h or x84h
x05h or x85h
x06h or x86h
x07h or x87h
x08h or x88h
x09h or x89h
x0Ah or x8Ah
x0Bh or x8Bh
INDF0
INDF1
PCL
STATUS
FSR0L
FSR0H
FSR1L
FSR1H
BSR
WREG
PCLATH
INTCON
PIC16(L)F1526/27
3.2.1.1
STATUS Register
REGISTER 3-1:
U-0
U-0
R-1/q
TO
R-1/q
R/W-0/u
R/W-0/u
R/W-0/u
DC(1)
C(1)
PD
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-5
Unimplemented: Read as 0
bit 4
bit 3
bit 2
Z: Zero bit
1 = The result of an arithmetic or logic operation is zero
0 = The result of an arithmetic or logic operation is not zero
bit 1
bit 0
C: Carry/Borrow bit(1)
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
Note 1:
For Borrow, the polarity is reversed. A subtraction is executed by adding the twos complement of the
second operand.
Preliminary
DS41458A-page 23
PIC16(L)F1526/27
3.2.2
FIGURE 3-3:
3.2.3
0Bh
0Ch
Core Registers
(12 bytes)
3.2.4
Memory Region
00h
3.2.3.1
BANKED MEMORY
PARTITIONING
COMMON RAM
6Fh
70h
Common RAM
(16 bytes)
7Fh
3.2.5
DS41458A-page 24
Preliminary
TABLE 3-3:
BANK 0
000h
BANK 1
080h
Core Registers
(Table 3-2)
Preliminary
00Bh
00Ch
00Dh
00Eh
00Fh
010h
011h
012h
013h
014h
015h
016h
017h
018h
019h
01Ah
01Bh
01Ch
01Dh
01Eh
01Fh
020h
PORTA
PORTB
PORTC
PORTD
PORTE
PIR1
PIR2
PIR3
PIR4
TMR0
TMR1L
TMR1H
T1CON
T1GCON
TMR2
PR2
T2CON
Core Registers
(Table 3-2)
08Bh
08Ch
08Dh
08Eh
08Fh
090h
091h
092h
093h
094h
095h
096h
097h
098h
099h
09Ah
09Bh
09Ch
09Dh
09Eh
09Fh
0A0h
Legend:
Note 1:
Core Registers
(Table 3-2)
10Bh
10Ch
10Dh
10Eh
10Fh
110h
111h
112h
113h
114h
115h
116h
117h
118h
119h
11Ah
11Bh
11Ch
11Dh
11Eh
11Fh
120h
0EFh
0F0h
0FFh
Common RAM
(Accesses
70h 7Fh)
LATA
LATB
LATC
LATD
LATE
BORCON
FVRCON
APFCON
16Fh
170h
17Fh
Common RAM
(Accesses
70h 7Fh)
BANK 4
200h
Core Registers
(Table 3-2)
18Bh
18Ch
18Dh
18Eh
18Fh
190h
191h
192h
193h
194h
195h
196h
197h
198h
199h
19Ah
19Bh
19Ch
19Dh
19Eh
19Fh
1A0h
General
Purpose
Register
80 Bytes
General
Purpose
Register
80 Bytes
Common RAM
07Fh
TRISA
TRISB
TRISC
TRISD
TRISE
PIE1
PIE2
PIE3
PIE4
OPTION_REG
PCON
WDTCON
OSCCON
OSCSTAT
ADRESL
ADRESH
ADCON0
ADCON1
BANK 3
180h
ANSELA
ANSELB
ANSELD
ANSELE
PMADRL
PMADRH
PMDATL
PMDATH
PMCON1
PMCON2
VREGCON(1)
RC1REG
TX1REG
SP1BRG
SP1BRGH
RC1STA
TX1STA
BAUD1CON
Core Registers
(Table 3-2)
20Bh
20Ch
20Dh
20Eh
20Fh
210h
211h
212h
213h
214h
215h
216h
217h
218h
219h
21Ah
21Bh
21Ch
21Dh
21Eh
21Fh
220h
General
Purpose
Register
80 Bytes
1EFh
1F0h
1FFh
Common RAM
(Accesses
70h 7Fh)
BANK 5
280h
WPUB
WPUD
WPUE
SSP1BUF
SSP1ADD
SSP1MSK
SSP1STAT
SSP1CON1
SSP1CON2
SSP1CON3
SSP2BUF
SSP2ADD
SSP2MSK
SSP2STAT
SSP2CON1
SSP2CON2
SSP2CON3
Core Registers
(Table 3-2)
28Bh
28Ch
28Dh
28Eh
28Fh
290h
291h
292h
293h
294h
295h
296h
297h
298h
299h
29Ah
29Bh
29Ch
29Dh
29Eh
29Fh
2A0h
General
Purpose
Register
80 Bytes
26Fh
270h
27Fh
Common RAM
(Accesses
70h 7Fh)
BANK 6
300h
PORTF
PORTG
CCPR1L
CCPR1H
CCP1CON
CCPR2L
CCPR2H
CCP2CON
CCPTMRS0
CCPTMRS1
CCPTMRS2
Core Registers
(Table 3-2)
30Bh
30Ch
30Dh
30Eh
30Fh
310h
311h
312h
313h
314h
315h
316h
317h
318h
319h
31Ah
31Bh
31Ch
31Dh
31Eh
31Fh
320h
General
Purpose
Register
80 Bytes
2EFh
2F0h
2FFh
Common RAM
(Accesses
70h 7Fh)
BANK 7
380h
TRISF
TRISG
CCPR3L
CCPR3H
CCP3CON
CCPR4L
CCPR4H
CCP4CON
CCPR5L
CCPR5H
CCP5CON
Core Registers
(Table 3-2)
38Bh
38Ch
38Dh
38Eh
38Fh
390h
391h
392h
393h
394h
395h
396h
397h
398h
399h
39Ah
39Bh
39Ch
39Dh
39Eh
39Fh
3A0h
General
Purpose
Register
80 Bytes
36Fh
370h
37Fh
Common RAM
(Accesses
70h 7Fh)
LATF
LATG
IOCBP
IOCBN
IOCBF
General
Purpose
Register
80 Bytes
3EFh
3F0h
3FFh
Common RAM
(Accesses
70h 7Fh)
DS41458A-page 25
PIC16(L)F1526/27
General
Purpose
Register
80 Bytes
06Fh
070h
BANK 2
100h
BANK 8
400h
BANK 9
480h
Core Registers
(Table 3-2)
40Bh
Preliminary
ANSELF
ANSELG
TMR3L
TMR3H
T3CON
T3GCON
TMR4
PR4
T4CON
TMR5L
TMR5H
T5CON
T5GCON
TMR6
PR6
T6CON
40Ch
40Dh
40Eh
40Fh
410h
411h
412h
413h
414h
415h
416h
417h
418h
419h
41Ah
41Bh
41Ch
41Dh
41Eh
41Fh
420h
General
Purpose
Register
80 Bytes
46Fh
470h
Common RAM
(Accesses
70h 7Fh)
47Fh
Legend:
Note 1:
BANK 10
500h
Core Registers
(Table 3-2)
48Bh
48Ch
WPUG
48Dh
48Eh
48Fh
490h
RC2REG
491h
TX2REG
492h
SP2BRG
493h
SP2BRGH
494h
RC2STA
495h
TX2STA
496h
BAUD2CON
497h
498h
499h
49Ah
49Bh
49Ch
49Dh
49Eh
49Fh
4A0h General Purpose
Register
32 Bytes
4BFh
Core Registers
(Table 3-2)
50Bh
58Bh
58Ch
58Dh
58Eh
58Fh
590h
591h
592h
593h
594h
595h
596h
597h
598h
599h
59Ah
59Bh
59Ch
59Dh
59Eh
59Fh
5A0h
Unimplemented
Read as 0
51Fh
520h
General
Purpose
Register
80 Bytes(1)
Common RAM
(Accesses
70h 7Fh)
BANK 12
600h
Core Registers
(Table 3-2)
50Ch
PIC16(L)F1527 only.
BANK 11
580h
Core Registers
(Table 3-2)
60Bh
TMR8
PR8
T8CON
TMR10
PR10
T10CON
60Ch
60Dh
60Eh
60Fh
610h
611h
612h
613h
614h
615h
616h
617h
618h
619h
61Ah
61Bh
61Ch
61Dh
61Eh
61Fh
620h
General
Purpose
Register
80 Bytes(1)
5EFh
5F0h
5FFh
Common RAM
(Accesses
70h 7Fh)
BANK 13
680h
CCPR6L
CCPR6H
CCP6CON
CCPR7L
CCPR7H
CCP7CON
CCPR8L
CCPR8H
CCP8CON
CCPR9L
CCPR9H
CCP9CON
CCPR10L
CCPR10H
CCP10CON
Core Registers
(Table 3-2)
67Fh
Common RAM
(Accesses
70h 7Fh)
BANK 15
780h
Core Registers
(Table 3-2)
Core Registers
(Table 3-2)
68Bh
70Bh
78Bh
68Ch
70Ch
78Ch
Unimplemented
Unimplemented
Unimplemented
Read as 0
Read as 0
Read as 0
69Fh
6A0h
General
Purpose
Register
80 Bytes(1)
66Fh
670h
BANK 14
700h
71Fh
720h
General
Purpose
Register
80 Bytes(1)
6EFh
6F0h
6FFh
Common RAM
(Accesses
70h 7Fh)
79Fh
7A0h
General
Purpose
Register
80 Bytes(1)
76Fh
770h
77Fh
Common RAM
(Accesses
70h 7Fh)
General
Purpose
Register
80 Bytes(1)
7EFh
7F0h
7FFh
Common RAM
(Accesses
70h 7Fh)
PIC16(L)F1526/27
DS41458A-page 26
TABLE 3-3:
TABLE 3-3:
BANK 16
800h
BANK 17
880h
Core Registers
(Table 3-2)
80Bh
80Ch
Core Registers
(Table 3-2)
88Bh
88Ch
Unimplemented
Read as 0
81Fh
820h
86Fh
870h
87Fh
General
Purpose
Register
80 Bytes(1)
Common RAM
(Accesses
70h 7Fh)
89Fh
8A0h
8EFh
8F0h
8FFh
Preliminary
C0Bh
C0Ch
Legend:
Note 1:
96Fh
970h
97Fh
Core Registers
(Table 3-2)
A0Bh
A0Ch
Common RAM
(Accesses
70h 7Fh)
Unimplemented
Read as 0
9EFh
9F0h
9FFh
BANK 26
BANK 22
B00h
Core Registers
(Table 3-2)
A8Bh
A8Ch
D7Fh
A6Fh
A70h
A7Fh
BANK 23
B80h
Core Registers
(Table 3-2)
B0Bh
B0Ch
AFFh
Core Registers
(Table 3-2)
B8Bh
B8Ch
E7Fh
B7Fh
EFFh
BEFh
BF0h
BFFh
Common RAM
(Accesses
70h 7Fh)
BANK 30
Core Registers
(Table 3-2)
F0Bh
F0Ch
Unimplemented
Read as 0
EEFh
EF0h
Common RAM
(Accesses
70h 7Fh)
Unimplemented
Read as 0
F00h
E8Bh
E8Ch
Common RAM
(Accesses
70h 7Fh)
B6Fh
B70h
Core Registers
(Table 3-2)
Unimplemented
Read as 0
E6Fh
E70h
Common RAM
(Accesses
70h 7Fh)
Unimplemented
Read as 0
BANK 29
Core Registers
(Table 3-2)
Unimplemented
Read as 0
DFFh
AEFh
AF0h
E80h
E0Bh
E0Ch
Common RAM
(Accesses
70h 7Fh)
Unimplemented
Read as 0
BANK 28
Core Registers
(Table 3-2)
DEFh
DF0h
Common RAM
(Accesses
70h 7Fh)
E00h
D8Bh
D8Ch
Common RAM
(Accesses
70h 7Fh)
Unimplemented
Read as 0
BANK 27
Unimplemented
Read as 0
D6Fh
D70h
Common RAM
(Accesses
70h 7Fh)
D80h
Core Registers
(Table 3-2)
Unimplemented
Read as 0
CFFh
General
Purpose
Register
80 Bytes(1)
D0Bh
D0Ch
Common RAM
(Accesses
70h 7Fh)
BANK 21
A80h
Common RAM
(Accesses
70h 7Fh)
Unimplemented
Read as 0
F6Fh
F70h
F7Fh
Common RAM
(Accesses
70h 7Fh)
DS41458A-page 27
PIC16(L)F1526/27
Common RAM
(Accesses
70h 7Fh)
91Fh
920h
Core Registers
(Table 3-2)
CEFh
CF0h
Core Registers
(Table 3-2)
98Bh
98Ch
D00h
C8Bh
C8Ch
BANK 20
A00h
Unimplemented
Read as 0
BANK 25
Unimplemented
Read as 0
C7Fh
Common RAM
(Accesses
70h 7Fh)
C80h
Core Registers
(Table 3-2)
C6Fh
C70h
90Bh
90Ch
General
Purpose
Register
80 Bytes(1)
BANK 19
980h
Core Registers
(Table 3-2)
Unimplemented
Read as 0
BANK 24
C00h
BANK 18
900h
F80h
Core Registers
(Table 3-2)
F8Bh
F8Ch
Unimplemented
Read as 0
Preliminary
FE3h
FE4h
FE5h
FE6h
FE7h
FE8h
FE9h
FEAh
FEBh
FECh
FEDh
FEEh
FEFh
FF0h
FFFh
Legend:
STATUS_SHAD
WREG_SHAD
BSR_SHAD
PCLATH_SHAD
FSR0L_SHAD
FSR0H_SHAD
FSR1L_SHAD
FSR1H_SHAD
STKPTR
TOSL
TOSH
Common RAM
(Accesses
70h 7Fh)
PIC16(L)F1526/27
DS41458A-page 28
TABLE 3-3:
PIC16(L)F1526/27
3.2.6
TABLE 3-4:
Addr
Name
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on
POR, BOR
Value on all
other Resets
Bank 0-31
x00h or
INDF0
x80h
xxxx xxxx
uuuu uuuu
x01h or
INDF1
x81h
xxxx xxxx
uuuu uuuu
x02h or
PCL
x82h
0000 0000
0000 0000
---1 1000
---q quuu
x03h or
STATUS
x83h
TO
PD
DC
x04h or
FSR0L
x84h
0000 0000
uuuu uuuu
x05h or
FSR0H
x85h
0000 0000
0000 0000
x06h or
FSR1L
x86h
0000 0000
uuuu uuuu
x07h or
FSR1H
x87h
0000 0000
0000 0000
---0 0000
---0 0000
0000 0000
uuuu uuuu
-000 0000
-000 0000
0000 0000
0000 0000
x08h or
BSR
x88h
x09h or
WREG
x89h
BSR4
BSR3
BSR2
BSR1
BSR0
Working Register
x0Ah or
PCLATH
x8Ah
x0Bh or
INTCON
x8Bh
GIE
Legend:
TMR0IE
INTE
IOCIE
TMR0IF
INTF
IOCIF
Preliminary
DS41458A-page 29
PIC16(L)F1526/27
TABLE 3-2:
Addr
Name
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on
POR, BOR
Value on all
other
Resets
Bank 0
00Ch PORTA
00Dh PORTB
00Eh PORTC
00Fh PORTD
010h PORTE
011h
TMR1GIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
OSFIF
TMR5GIF
TMR3GIF
BCL1IF
TMR10IF
TMR8IF
CCP2IF
013h PIR3
CCP6IF
CCP5IF
CCP4IF
CCP3IF
TMR6IF
TMR5IF
TMR4IF
TMR3IF
014h PIR4
CCP10IF
CCP9IF
RC2IF
TX2IF
CCP8IF
CCP7IF
BCL2IF
SSP2IF
PIR1
012h PIR2
015h TMR0
016h TMR1L
Holding Register for the Least Significant Byte of the 16-bit TMR1 Register
017h TMR1H
Holding Register for the Most Significant Byte of the 16-bit TMR1 Register
018h T1CON
019h T1GCON
TMR1CS<1:0>
TMR1GE
T1CKPS<1:0>
T1GPOL
T1GTM
01Ah TMR2
01Bh PR2
01Ch T2CON
T1GSPM
SOSCEN
T1SYNC
T1GGO/
DONE
T1GVAL
T1GSS<1:0>
T2OUTPS<3:0>
TMR2ON
T2CKPS<1:0>
01Dh
Unimplemented
01Eh
Unimplemented
01Fh
Unimplemented
Bank 1
08Ch TRISA
08Dh TRISB
08Eh TRISC
08Fh TRISD
090h TRISE
091h PIE1
TMR1GIE
092h PIE2
OSFIE
ADIE
RC1IE
TMR5GIE TMR3GIE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
BCL1IE
TMR10IE
TMR8IE
CCP2IE
093h PIE3
CCP6IE
CCP5IE
CCP4IE
CCP3IE
TMR6IE
TMR5IE
TMR4IE
TMR3IE
094h PIE4
CCP10IE
CCP9IE
RC2IE
TX2IE
CCP8IE
CCP7IE
BCL2IE
SSP2IE
095h OPTION_REG
WPUEN
INTEDG
TMR0CS
TMR0SE
PSA
096h PCON
STKOVF
STKUNF
RWDT
097h WDTCON
098h
09Ah OSCSTAT
SOSCR
IRCF<3:0>
OSTS
09Ch ADRESH
09Dh ADCON0
09Eh ADCON1
ADFM
09Fh
1:
2:
POR
BOR
09Bh ADRESL
Note
RI
WDTPS<4:0>
Unimplemented
099h OSCCON
Legend:
RMCLR
PS<2:0>
HFIOFR
LFIOFR
HFIOFS
CHS<4:0>
ADCS<2:0>
SCS<1:0>
GO/DONE
ADON
ADPREF<1:0>
Unimplemented
DS41458A-page 30
Preliminary
PIC16(L)F1526/27
TABLE 3-2:
Addr
Name
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on
POR, BOR
Value on all
other
Resets
Bank 2
10Ch LATA
10Dh LATB
10Eh LATC
10Fh LATD
110h
LATE
111h
to
115h
Unimplemented
116h
BORCON
SBOREN
BORFS
117h
FVRCON
FVREN
FVRRDY
TSEN
TSRNG
ADFVR<1:0>
118h
to
11Ch
Unimplemented
11Dh APFCON
11Eh
Unimplemented
11Fh
Unimplemented
Bank 3
18Ch ANSELA
ANSA5
ANSA3
ANSA2
ANSA1
ANSA0
18Dh ANSELB
ANSB5
ANSB4
ANSB3
ANSB2
ANSB1
ANSB0
ANSD3
ANSD2
ANSD1
ANSD0
ANSE2
ANSE1
ANSE0
18Eh ANSELC
18Fh ANSELD
190h ANSELE
191h PMADRL
192h PMADRH
193h PMDATL
Unimplemented
195h PMCON1
CFGS
197h VREGCON(1)
196h PMCON2
194h PMDATH
FREE
WRERR
WREN
WR
VREGPM
RD
198h
Unimplemented
199h RC1REG
19Ah TX1REG
19Bh SP1BRG
BRG<7:0>
19Ch SP1BRGH
BRG<15:8>
19Dh RC1STA
SPEN
RX9
SREN
CREN
ADDEN
FERR
OERR
RX9D
19Eh TX1STA
CSRC
TX9
TXEN
SYNC
SENDB
BRGH
TRMT
TX9D
ABDOVF
RCIDL
SCKP
BRG16
WUE
ABDEN
19Fh BAUD1CON
Legend:
Note
1:
2:
Preliminary
DS41458A-page 31
PIC16(L)F1526/27
TABLE 3-2:
Addr
Name
Bit 6
Value on
POR, BOR
Value on all
other
Resets
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
WPUB5
WPUB4
WPUB3
WPUB2
WPUB1
WPUB0
Bank 4
20Ch
Unimplemented
20Dh WPUB
20Eh
WPUB6
Unimplemented
20Fh WPUD
210h WPUE
211h
WPUB7
SSP1BUF
WPUD7
WPUD6
WPUD5
WPUD4
WPUD3
WPUD2
WPUD1
WPUD0
WPUE7
WPUE6
WPUE5
WPUE4
WPUE3
WPUE2
WPUE1
WPUE0
212h SSP1ADD
213h SSP1MSK
214h SSP1STAT
SMP
CKE
D/A
215h SSP1CON1
WCOL
SSPOV
SSPEN
CKP
216h SSP1CON2
GCEN
ACKSTAT
ACKDT
ACKEN
RCEN
PEN
RSEN
SEN
217h SSP1CON3
ACKTIM
PCIE
SCIE
BOEN
SDAHT
SBCDE
AHEN
DHEN
R/W
UA
BF
SSPM<3:0>
218h
Unimplemented
219h SSP2BUF
21Ah SSP2ADD
21Bh SSP2MSK
21Ch SSP2STAT
SMP
CKE
D/A
21Dh SSP2CON1
WCOL
SSPOV
SSPEN
CKP
21Eh SSP2CON2
GCEN
ACKSTAT
ACKDT
ACKEN
RCEN
PEN
RSEN
SEN
21Fh SSP2CON3
ACKTIM
PCIE
SCIE
BOEN
SDAHT
SBCDE
AHEN
DHEN
28Ch PORTF
RF7
RF6
RF5
RF4
RF3
RF2
RF1
RF0
28Dh PORTG
RG5
RG4
RG3
RG2
RG1
RG0
R/W
UA
BF
SSPM<3:0>
Bank 5
28Eh
Unimplemented
28Fh
Unimplemented
290h
Unimplemented
291h CCPR1L
292h CCPR1H
293h CCP1CON
DC1B<1:0>
CCP1M<3:0>
294h
Unimplemented
295h
Unimplemented
296h
Unimplemented
297h
Unimplemented
298h CCPR2L
299h CCPR2H
29Ah CCP2CON
DC2B<1:0>
CCP2M<3:0>
29Bh
Unimplemented
29Ch
Unimplemented
29Dh CCPTMRS0
C4TSEL<1:0>
C3TSEL<1:0>
C2TSEL<1:0>
C1TSEL<1:0>
29Eh CCPTMRS1
C8TSEL<1:0>
C7TSEL<1:0>
C6TSEL<1:0>
C5TSEL<1:0>
29Fh CCPTMRS2
C10TSEL<1:0>
C9TSEL<1:0>
Legend:
Note
1:
2:
DS41458A-page 32
Preliminary
PIC16(L)F1526/27
TABLE 3-2:
Addr
Name
Bit 3
Bit 2
Bit 1
Bit 0
Value on
POR, BOR
Value on all
other
Resets
Bit 7
Bit 6
Bit 5
30Ch TRISF
TRISF7
TRISF6
TRISF5
TRISF4
TRISF3
TRISF2
TRISF1
TRISF0
30Dh TRISG
(2)
TRISG4
TRISG3
TRISG2
TRISG1
TRISG0
Bank 6
30Eh
Unimplemented
30Fh
Unimplemented
310h
Unimplemented
311h
CCPR3L
312h CCPR3H
313h CCP3CON
DC3B<1:0>
CCP3M<3:0>
314h
Unimplemented
315h
Unimplemented
316h
Unimplemented
317h
Unimplemented
318h CCPR4L
319h CCPR4H
31Ah CCP4CON
Unimplemented
31Ch CCPR5L
31Dh CCPR5H
31Fh
DC4B<1:0>
31Bh
31Eh CCP5CON
DC5B<1:0>
CCP5M<3:0>
Unimplemented
Bank 7
38Ch LATF
LATF7
LATF6
LATF5
LATF4
LATF3
LATF2
LATF1
LATF0
38Dh LATG
LATG4
LATG3
LATG2
LATG1
LATG0
38Eh
to
393h
Unimplemented
394h IOCBP
IOCBP7
IOCBP6
IOCBP5
IOCBP4
IOCBP3
IOCBP2
IOCBP1
IOCBP0
395h IOCBN
IOCBN7
IOCBN6
IOCBN5
IOCBN4
IOCBN3
IOCBN2
IOCBN1
IOCBN0
396h IOCBF
IOCBF7
IOCBF6
IOCBF5
IOCBF4
IOCBF3
IOCBF2
IOCBF1
IOCBF0
397h
to
39Fh
Legend:
Note
1:
2:
Unimplemented
Preliminary
DS41458A-page 33
PIC16(L)F1526/27
TABLE 3-2:
Addr
Name
Bit 6
Bit 5
Bit 4
Bit 3
40Ch ANSELF
ANSF7
ANSF6
ANSF5
ANSF4
ANSF3
40Dh ANSELG
ANSG4
ANSG3
Bit 2
Value on
POR, BOR
Value on all
other
Resets
Bit 1
Bit 0
ANSF2
ANSF1
ANSF0
ANSG2
ANSG1
Bank 8
40Eh
Unimplemented
40Fh
Unimplemented
410h
Unimplemented
411h
TMR3L
Holding Register for the Least Significant Byte of the 16-bit TMR3 Register
412h TMR3H
Holding Register for the Most Significant Byte of the 16-bit TMR3 Register
413h T3CON
414h T3GCON
TMR3CS<1:0>
TMR3GE
T3GPOL
415h TMR4
416h PR4
417h T4CON
T3CKPS<1:0>
T3GTM
T3GSPM
T3SYNC
T3GGO/
DONE
T3GVAL
T3GSS<1:0>
419h TMR5H
Holding Register for the Most Significant Byte of the 16-bit TMR5 Register
TMR5GE
T5GPOL
41Ch TMR6
41Dh PR6
41Eh T6CON
41Fh
Holding Register for the Least Significant Byte of the 16-bit TMR5 Register
41Bh T5GCON
TMR5CS<1:0>
SOSCEN
418h TMR5L
41Ah T5CON
T5CKPS<1:0>
T5GTM
T5GSPM
T4CKPS<1:0>
SOSCEN
T5SYNC
T5GGO/
DONE
T5GVAL
T5GSS<1:0>
T6OUTPS<3:0>
TMR6ON
T6CKPS<1:0>
Unimplemented
Bank 9
48Ch
Unimplemented
48Dh WPUG
WPUG5
48Dh
to
490h
Unimplemented
491h RC2REG
492h TX2REG
493h SP2BRG
BRG<7:0>
494h SP2BRGH
BRG<15:8>
495h RC2STA
SPEN
RX9
SREN
CREN
ADDEN
FERR
OERR
RX9D
496h TX2STA
CSRC
TX9
TXEN
SYNC
SENDB
BRGH
TRMT
TX9D
ABDOVF
RCIDL
SCKP
BRG16
WUE
ABDEN
497h BAUD2CON
498h
to
49Fh
Legend:
Note
1:
2:
Unimplemented
DS41458A-page 34
Preliminary
PIC16(L)F1526/27
TABLE 3-2:
Addr
Name
Value on all
other
Resets
Unimplemented
Unimplemented
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Bank 10
50Ch
51Fh
Bank 11
58Ch
594h
595h TMR8
596h PR8
597h T8CON
Unimplemented
59Ch TMR10
59Dh PR10
59Fh
598h
59Bh
59Eh T10CON
T8CKPS<1:0>
TMR10ON
T10CKPS<1:0>
Unimplemented
60Ch
610h
Unimplemented
611h
CCPR6L
612h CCPR6H
Bank 12
613h CCP6CON
DC6B<1:0>
614h CCPR7L
615h CCPR7H
616h CCP7CON
DC7B<1:0>
617h CCPR8L
618h CCPR8H
619h CCP8CON
DC8B<1:0>
61Ah CCPR9L
61Bh CCPR9H
61Ch CCP9CON
DC9B<1:0>
61Dh CCPR10L
61Eh CCPR10H
61Fh CCP10CON
DC10B<1:0>
CCP7M<3:0>
CCP8M<3:0>
CCP9M<3:0>
CCP10M<3:0>
Bank 13-30
x0Ch
or
x8Ch
to
x1Fh
or
x9Fh
Legend:
Note
1:
2:
Unimplemented
Preliminary
DS41458A-page 35
PIC16(L)F1526/27
TABLE 3-2:
Addr
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on
POR, BOR
Value on all
other
Resets
Bank 31
F8Ch
FE3h
Unimplemented
FE4h STATUS_SHAD
FE5h WREG_SHAD
Z_SHAD
DC_SHAD
C_SHAD
FE6h BSR_SHAD
FE7h PCLATH_SHAD
FE8h FSR0L_SHAD
FE9h FSR0H_SHAD
FEAh FSR1L_SHAD
FEBh FSR1H_SHAD
FECh
Unimplemented
FEDh STKPTR
FEEh TOSL
Note
1:
2:
FEFh TOSH
Legend:
DS41458A-page 36
Preliminary
PIC16(L)F1526/27
3.3
3.3.3
FIGURE 3-4:
PC
LOADING OF PC IN
DIFFERENT SITUATIONS
14
PCH
14
PCH
PCL
PCLATH
PC
ALU Result
PCL
14
11
PCL
0
CALLW
PCLATH
PCH
14
PCH
W
PCL
BRW
PCH
BRANCHING
15
14
3.3.4
PC + W
PC
The CALLW instruction enables computed calls by combining PCLATH and W to form the destination address.
A computed CALLW is accomplished by loading the W
register with the desired address and executing CALLW.
The PCL register is loaded with the value of W and
PCH is loaded with PCLATH.
OPCODE <10:0>
PC
PC
Instruction with
PCL as
Destination
GOTO, CALL
PCLATH
PCL
0
BRA
15
PC + OPCODE <8:0>
3.3.1
MODIFYING PCL
3.3.2
COMPUTED GOTO
Preliminary
DS41458A-page 37
PIC16(L)F1526/27
3.4
3.4.1
Stack
Note:
FIGURE 3-5:
TOSH:TOSL
0x0F
STKPTR = 0x1F
0x0E
0x0D
0x0C
0x0B
0x0A
0x09
0x08
0x07
0x06
0x05
0x04
0x03
0x02
0x01
0x00
TOSH:TOSL
DS41458A-page 38
0x1F
0x0000
Preliminary
STKPTR = 0x1F
PIC16(L)F1526/27
FIGURE 3-6:
0x08
0x07
0x06
0x05
0x04
0x03
0x02
0x01
TOSH:TOSL
FIGURE 3-7:
0x00
Return Address
STKPTR = 0x00
0x0F
0x0E
0x0D
0x0C
0x0B
0x0A
0x09
0x08
0x07
TOSH:TOSL
0x06
Return Address
0x05
Return Address
0x04
Return Address
0x03
Return Address
0x02
Return Address
0x01
Return Address
0x00
Return Address
Preliminary
STKPTR = 0x06
DS41458A-page 39
PIC16(L)F1526/27
FIGURE 3-8:
TOSH:TOSL
3.4.2
0x0F
Return Address
0x0E
Return Address
0x0D
Return Address
0x0C
Return Address
0x0B
Return Address
0x0A
Return Address
0x09
Return Address
0x08
Return Address
0x07
Return Address
0x06
Return Address
0x05
Return Address
0x04
Return Address
0x03
Return Address
0x02
Return Address
0x01
Return Address
0x00
Return Address
STKPTR = 0x10
OVERFLOW/UNDERFLOW RESET
3.5
Indirect Addressing
DS41458A-page 40
Preliminary
PIC16(L)F1526/27
FIGURE 3-9:
INDIRECT ADDRESSING
0x0000
0x0000
Traditional
Data Memory
0x0FFF
0x0FFF
0x1000
Reserved
0x1FFF
0x2000
Linear
Data Memory
0x29AF
0x29B0
FSR
Address
Range
Reserved
0x7FFF
0x8000
0x0000
Program
Flash Memory
0xFFFF
Note:
0x7FFF
Not all memory regions are completely implemented. Consult device memory tables for memory limits.
Preliminary
DS41458A-page 41
PIC16(L)F1526/27
3.5.1
FIGURE 3-10:
Direct Addressing
4
BSR
Indirect Addressing
From Opcode
7
0
Bank Select
Location Select
FSRxH
0
FSRxL
0
Bank Select
11111
Bank 31
Location Select
0x00
0x7F
DS41458A-page 42
Preliminary
PIC16(L)F1526/27
3.5.2
3.5.3
FIGURE 3-11:
7
FSRnH
0 0 1
FSRnL
FIGURE 3-12:
7
1
FSRnH
PROGRAM FLASH
MEMORY MAP
0
Location Select
Location Select
0x2000
FSRnL
0x8000
0x0000
0x020
Bank 0
0x06F
0x0A0
Bank 1
0x0EF
0x120
Program
Flash
Memory
(low 8
bits)
Bank 2
0x16F
0xF20
Bank 30
0x29AF
0xF6F
Preliminary
0xFFFF
0x7FFF
DS41458A-page 43
PIC16(L)F1526/27
NOTES:
DS41458A-page 44
Preliminary
PIC16(L)F1526/27
4.0
DEVICE CONFIGURATION
4.1
Configuration Words
Preliminary
DS41458A-page 45
PIC16(L)F1526/27
REGISTER 4-1:
CONFIGURATION WORD 1
R/P-1
R/P-1
R/P-1
FCMEN
IESO
CLKOUTEN
R/P-1
R/P-1
U-1
BOREN<1:0>
bit 13
R/P-1
R/P-1
R/P-1
CP
MCLRE
PWRTE
bit 8
R/P-1
R/P-1
R/P-1
WDTE<1:0>
R/P-1
R/P-1
FOSC<2:0>
bit 7
bit 0
Legend:
R = Readable bit
P = Programmable bit
0 = Bit is cleared
1 = Bit is set
bit 13
bit 12
bit 11
bit 10-9
bit 8
Unimplemented: Read as 1
bit 7
bit 6
bit 5
bit 4-3
DS41458A-page 46
Preliminary
PIC16(L)F1526/27
REGISTER 4-1:
bit 2-0
Preliminary
DS41458A-page 47
PIC16(L)F1526/27
REGISTER 4-2:
CONFIGURATION WORD 2
R/P-1
R/P-1
R/P-1
R/P-1
R/P-1
U-1
LVP
DEBUG
LPBOR
BORV
STVREN
bit 13
U-1
U-1
bit 8
U-1
R/P-1
(1)
VCAPEN
U-1
U-1
R/P-1
R/P-1
WRT<1:0>
bit 7
bit 0
Legend:
R = Readable bit
P = Programmable bit
0 = Bit is cleared
1 = Bit is set
bit 13
bit 12
bit 11
bit 10
bit 9
bit 8-5
Unimplemented: Read as 1
bit 4
bit 3-2
Unimplemented: Read as 1
bit 1-0
Note 1:
PIC16F1526/27 only.
DS41458A-page 48
Preliminary
PIC16(L)F1526/27
4.2
Code Protection
4.2.1
4.3
Write Protection
4.4
User ID
Preliminary
DS41458A-page 49
PIC16(L)F1526/27
4.5
REGISTER 4-3:
DEV<8:3>
bit 13
R
bit 8
R
DEV<2:0>
REV<4:0>
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
P = Programmable bit
bit 13-5
DEVICEID<13:0> Values
Device
bit 4-0
DEV<8:0>
REV<4:0>
PIC16F1526
01 0101 100
x xxxx
PIC16F1527
01 0101 101
x xxxx
PIC16LF1526
01 0101 110
x xxxx
PIC16LF1527
01 0101 111
x xxxx
DS41458A-page 50
Preliminary
PIC16(L)F1526/27
5.0
5.1
Overview
Preliminary
DS41458A-page 51
PIC16(L)F1526/27
SIMPLIFIED PIC MCU CLOCK SOURCE BLOCK DIAGRAM
FIGURE 5-1:
Primary Oscillator
OSC2
Primary
Oscillator
(OSC)
OSC1
Primary Clock
00
SOSCO/
T1CKI
SOSCI
Secondary
Oscillator
(SOSC)
Secondary Clock
INTOSC
01
1x
Secondary Oscillator
Internal Oscillator
IRCF<3:0>
4
Start-Up Osc
LF-INTOSC
(31.25 kHz)
DS41458A-page 52
INTOSC
Divide Circuit
16 MHz
Primary Osc
/1
/2
/4
/8
/16
HF-16 MHz
/32
HF-500 kHz
/64
HF-250 kHz
HF-8 MHz
HF-4 MHz
HF-2 MHz
HF-1 MHz
/128
HF-125 kHz
/256
HF-62.5 kHz
/512
HF-31.25 kHz
LF-31 kHz
1111
1110
1101
1100
1011
1010/
0111
1001/
0110
1000/
0101
0100
0011
0010
0001
0000
Start-up
Control
Logic
Preliminary
PIC16(L)F1526/27
5.2
FIGURE 5-2:
5.2.1
5.2.1.1
EC Mode
PIC MCU
FOSC/4 or I/O(1)
Note 1:
OSC1/CLKIN
Clock from
Ext. System
5.2.1.2
OSC2/CLKOUT
Preliminary
DS41458A-page 53
PIC16(L)F1526/27
FIGURE 5-3:
QUARTZ CRYSTAL
OPERATION (LP, XT OR
HS MODE)
FIGURE 5-4:
CERAMIC RESONATOR
OPERATION
(XT OR HS MODE)
PIC MCU
PIC MCU
OSC1/CLKIN
C1
Note 1:
2:
C1
To Internal
Logic
Quartz
Crystal
C2
OSC1/CLKIN
RS(1)
RF(2)
Sleep
RP(3)
OSC2/CLKOUT
Note 1:
Note 1: Quartz
crystal
characteristics
vary
according to type, package and
manufacturer. The user should consult the
manufacturer data sheets for specifications
and recommended application.
2: Always verify oscillator performance over
the VDD and temperature range that is
expected for the application.
3: For oscillator design assistance, reference
the following Microchip Applications Notes:
DS41458A-page 54
RF(2)
C2 Ceramic
RS(1)
Resonator
To Internal
Logic
Sleep
OSC2/CLKOUT
5.2.1.3
Preliminary
PIC16(L)F1526/27
5.2.1.4
5.2.1.5
Secondary Oscillator
External RC Mode
FIGURE 5-5:
QUARTZ CRYSTAL
OPERATION
(SECONDARY
OSCILLATOR)
FIGURE 5-6:
VDD
OSC1/CLKIN
SOSCI
VSS
FOSC/4 or I/O(1)
SOSCO
OSC2/CLKOUT
Note 1: Quartz
crystal
characteristics
vary
according to type, package and
manufacturer. The user should consult the
manufacturer data sheets for specifications
and recommended application.
2: Always verify oscillator performance over
the VDD and temperature range that is
expected for the application.
3: For oscillator design assistance, reference
the following Microchip Applications Notes:
AN826, Crystal Oscillator Basics and
Crystal Selection for rfPIC and PIC
Devices (DS00826)
AN849, Basic PIC Oscillator Design
(DS00849)
AN943, Practical PIC Oscillator
Analysis and Design (DS00943)
AN949, Making Your Oscillator Work
(DS00949)
TB097, Interfacing a Micro Crystal
MS1V-T1K 32.768 kHz Tuning Fork
Crystal to a PIC16F690/SS (DS91097)
AN1288, Design Practices for
Low-Power External Oscillators
(DS01288)
Internal
Clock
CEXT
To Internal
Logic
32.768 kHz
Quartz
Crystal
C2
PIC MCU
REXT
PIC MCU
C1
EXTERNAL RC MODES
Note 1:
Preliminary
DS41458A-page 55
PIC16(L)F1526/27
5.2.2
5.2.2.2
The device may be configured to use the internal oscillator block as the system clock by performing one of the
following actions:
Program the FOSC<2:0> bits in Configuration
Word 1 to select the INTOSC clock source, which
will be used as the default system clock upon a
device Reset.
Write the SCS<1:0> bits in the OSCCON register
to switch the system clock source to the internal
oscillator during run-time. See Section 5.3
Clock Switchingfor more information.
In INTOSC mode, OSC1/CLKIN is available for general
purpose I/O. OSC2/CLKOUT is available for general
purpose I/O or CLKOUT.
The function of the OSC2/CLKOUT pin is determined
by the state of the CLKOUTEN bit in Configuration
Word 1.
LFINTOSC
1.
2.
5.2.2.1
HFINTOSC
DS41458A-page 56
Preliminary
PIC16(L)F1526/27
5.2.2.3
5.2.2.4
Note:
2.
3.
4.
5.
6.
7.
16 MHz
8 MHz
4 MHz
2 MHz
1 MHz
500 kHz (Default after Reset)
250 kHz
125 kHz
62.5 kHz
31.25 kHz
31 kHz (LFINTOSC)
Preliminary
DS41458A-page 57
PIC16(L)F1526/27
FIGURE 5-7:
HFINTOSC
HFINTOSC
Start-up Time
2-cycle Sync
Running
LFINTOSC
IRCF <3:0>
System Clock
HFINTOSC
HFINTOSC
2-cycle Sync
Running
LFINTOSC
IRCF <3:0>
System Clock
LFINTOSC
HFINTOSC
LFINTOSC
Start-up Time
2-cycle Sync
Running
HFINTOSC
IRCF <3:0>
=0
System Clock
DS41458A-page 58
Preliminary
PIC16(L)F1526/27
5.3
5.3.3
Clock Switching
SECONDARY OSCILLATOR
5.3.1
5.3.4
5.3.2
Preliminary
DS41458A-page 59
PIC16(L)F1526/27
5.4
5.4.1
TABLE 5-1:
Switch From
Switch To
Frequency
Oscillator Delay
Sleep/POR
LFINTOSC
HFINTOSC
31 kHz
31.25 kHz-16 MHz
Sleep/POR
EC, RC
DC 20 MHz
2 cycles
LFINTOSC
EC, RC
DC 20 MHz
1 cycle of each
Sleep/POR
Secondary Oscillator,
32 kHz-20 MHz
LP, XT, HS
HFINTOSC
2 s (approx.)
LFINTOSC
31 kHz
1 cycle of each
DS41458A-page 60
Preliminary
PIC16(L)F1526/27
5.4.2
1.
2.
3.
4.
5.
6.
7.
TWO-SPEED START-UP
SEQUENCE
5.4.3
FIGURE 5-8:
TWO-SPEED START-UP
INTOSC
TOST
OSC1
1022 1023
OSC2
Program Counter
PC - N
PC + 1
PC
System Clock
Preliminary
DS41458A-page 61
PIC16(L)F1526/27
5.5
5.5.3
FIGURE 5-9:
External
Clock
LFINTOSC
Oscillator
64
31 kHz
(~32 s)
488 Hz
(~2 ms)
Sample Clock
5.5.1
5.5.4
Clock Monitor
Latch
Note:
FAIL-SAFE DETECTION
5.5.2
FAIL-SAFE OPERATION
DS41458A-page 62
Preliminary
PIC16(L)F1526/27
FIGURE 5-10:
Sample Clock
Oscillator
Failure
System
Clock
Output
Clock Monitor Output
(Q)
Failure
Detected
OSCFIF
Test
Note:
Test
Test
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.
Preliminary
DS41458A-page 63
PIC16(L)F1526/27
5.6
REGISTER 5-1:
U-0
R/W-1/1
R/W-1/1
R/W-1/1
IRCF<3:0>
U-0
R/W-0/0
R/W-0/0
SCS<1:0>
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7
Unimplemented: Read as 0
bit 6-3
bit 2
Unimplemented: Read as 0
bit 1-0
Note 1:
DS41458A-page 64
Preliminary
PIC16(L)F1526/27
REGISTER 5-2:
R-1/q
U-0
R-q/q
R-0/q
U-0
U-0
R-0/0
R-0/q
SOSCR
OSTS
HFIOFR
LFIOFR
HFIOFS
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
q = Conditional
bit 7
bit 6
Unimplemented: Read as 0
bit 5
bit 4
bit 3-2
Unimplemented: Read as 0
bit 1
bit 0
TABLE 5-2:
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Register
on Page
OSCCON
OSCSTAT
SOSCR
OSTS
HFIOFR
LFIOFR
HFIOFS
65
PIE2
OSFIE
TMR5GIE
TMR3GIE
BCL1IE
TMR10IE
TMR8IE
CCP2IE
83
PIR2
OSFIF
TMR5GIF
TMR3GIF
BCL1IF
TMR10IF
TMR8IF
CCP2IF
85
SOSCEN
T1SYNC
TMR1ON
165
TMR1CS<1:0>
T1CON
Legend:
CONFIG1
Legend:
T1CKPS<1:0>
SCS<1:0>
64
= unimplemented location, read as 0. Shaded cells are not used by clock sources.
TABLE 5-3:
Name
IRCF<3:0>
Bits
Bit 13/5
Bit 12/4
Bit 11/3
FCMEN
IESO
CLKOUTEN
MCLRE
PWRTE
13:8
7:0
Bit -/6
CP
Bit 10/2
Bit 9/1
BOREN<1:0>
WDTE<1:0>
FOSC<2:0>
Bit 8/0
Register
on Page
46
= unimplemented location, read as 0. Shaded cells are not used by clock sources.
Preliminary
DS41458A-page 65
PIC16(L)F1526/27
NOTES:
DS41458A-page 66
Preliminary
PIC16(L)F1526/27
6.0
RESETS
FIGURE 6-1:
MCLR
Sleep
WDT
Time-out
Device
Reset
Power-on
Reset
VDD
Brown-out
Reset
LPBOR
Reset
BOR
Enable
PWRT
Zero
LFINTOSC
64 ms
PWRTEN
Preliminary
DS41458A-page 67
PIC16(L)F1526/27
6.1
6.2
The POR circuit holds the device in Reset until VDD has
reached an acceptable level for minimum operation.
Slow rising VDD, fast operating speeds or analog
performance may require greater than minimum VDD.
The PWRT, BOR or MCLR features can be used to
extend the start-up period until all device operation
conditions have been met.
6.1.1
TABLE 6-1:
BOREN<1:0>
SBOREN
Device Mode
BOR Mode
Device Operation
Device Operation
upon wake- up from
upon release of POR
Sleep
11
Active
Awake
Active
10
Sleep
Disabled
1
01
0
00
Active
Begins immediately
Disabled
Begins immediately
Disabled
Begins immediately
Note 1: Even though this case specifically waits for the BOR, the BOR is already operating, so there is no delay in
start-up.
6.2.1
BOR IS ALWAYS ON
6.2.3
6.2.2
DS41458A-page 68
Preliminary
PIC16(L)F1526/27
FIGURE 6-2:
BROWN-OUT SITUATIONS
VDD
VBOR
Internal
Reset
TPWRT(1)
VDD
VBOR
Internal
Reset
< TPWRT
TPWRT(1)
VDD
VBOR
Internal
Reset
Note 1:
TPWRT(1)
REGISTER 6-1:
R/W-1/u
R/W-0/u
U-0
U-0
U-0
U-0
U-0
R-q/u
SBOREN
BORFS
BORRDY
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5-1
Unimplemented: Read as 0
bit 0
Note 1:
Preliminary
DS41458A-page 69
PIC16(L)F1526/27
6.3
6.5
6.3.1
ENABLING LPBOR
6.3.1.1
6.4
MCLR
6.6
RESET Instruction
6.7
6.8
6.9
TABLE 6-2:
MCLR CONFIGURATION
MCLRE
LVP
MCLR
Disabled
Enabled
Enabled
6.4.1
MCLR ENABLED
MCLR DISABLED
DS41458A-page 70
Start-up Sequence
6.4.2
6.10
Note:
Power-Up Timer
1.
2.
3.
The total time-out will vary based on oscillator configuration and Power-up Timer configuration. See
Section 5.0 Oscillator Module (With Fail-Safe
Clock Monitor) for more information.
The Power-up Timer and oscillator start-up timer run
independently of MCLR Reset. If MCLR is kept low long
enough, the Power-up Timer and oscillator start-up
timer will expire. Upon bringing MCLR high, the device
will begin execution immediately (see Figure 6-3). This
is useful for testing purposes or to synchronize more
than one device operating in parallel.
Preliminary
PIC16(L)F1526/27
FIGURE 6-3:
VDD
Internal POR
TPWRT
Power-Up Timer
MCLR
TMCLR
Internal RESET
Oscillator Modes
External Crystal
TOST
Internal Oscillator
Oscillator
FOSC
FOSC
Preliminary
DS41458A-page 71
PIC16(L)F1526/27
6.11
TABLE 6-3:
RMCLR
RI
POR
BOR
TO
PD
Condition
Power-on Reset
Brown-out Reset
WDT Reset
TABLE 6-4:
STATUS
Register
PCON
Register
Power-on Reset
0000h
---1 1000
00-1 110x
0000h
---u uuuu
uu-u 0uuu
0000h
---1 0uuu
uu-u 0uuu
WDT Reset
0000h
---0 uuuu
uu-0 uuuu
PC + 1
---0 0uuu
uu-u uuuu
Brown-out Reset
0000h
---1 1uuu
00-1 11u0
---1 0uuu
uu-u uuuu
---u uuuu
uu-u u0uu
Condition
PC + 1
(1)
0000h
0000h
---u uuuu
1u-u uuuu
0000h
---u uuuu
u1-u uuuu
DS41458A-page 72
Preliminary
PIC16(L)F1526/27
6.12
REGISTER 6-2:
R/W/HS-0/q
R/W/HS-0/q
U-0
STKOVF
STKUNF
R/W/HC-1/q R/W/HC-1/q
RWDT
RMCLR
R/W/HC-1/q
R/W/HC-q/u
R/W/HC-q/u
RI
POR
BOR
bit 7
bit 0
Legend:
HC = Bit is cleared by hardware
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
Unimplemented: Read as 0
bit 4
bit 3
bit 2
bit 1
bit 0
Preliminary
DS41458A-page 73
PIC16(L)F1526/27
TABLE 6-5:
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Register
on Page
BORCON
SBOREN
BORFS
BORRDY
69
PCON
STKOVF
STKUNF
RWDT
RMCLR
RI
POR
BOR
73
STATUS
TO
PD
DC
23
WDTCON
SWDTEN
99
WDTPS<4:0>
Legend: = unimplemented bit, reads as 0. Shaded cells are not used by Resets.
DS41458A-page 74
Preliminary
PIC16(L)F1526/27
7.0
INTERRUPTS
Operation
Interrupt Latency
Interrupts During Sleep
INT Pin
Automatic Context Saving
FIGURE 7-1:
INTERRUPT LOGIC
TMR0IF
TMR0IE
Peripheral Interrupts
(TMR1IF) PIR1<0>
(TMR1IF) PIR1<0>
Wake-up
(If in Sleep mode)
INTF
INTE
IOCIF
IOCIE
Interrupt
to CPU
PEIE
PIRn<7>
PIEn<7>
GIE
Preliminary
DS41458A-page 75
PIC16(L)F1526/27
7.1
Operation
7.2
Interrupt Latency
DS41458A-page 76
Preliminary
PIC16(L)F1526/27
FIGURE 7-2:
INTERRUPT LATENCY
OSC1
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
CLKOUT
Interrupt Sampled
during Q1
Interrupt
GIE
PC
Execute
PC-1
PC
1 Cycle Instruction at PC
PC+1
0004h
0005h
Inst(PC)
NOP
NOP
Inst(0004h)
PC+1/FSR
ADDR
New PC/
PC+1
0004h
0005h
Inst(PC)
NOP
NOP
Inst(0004h)
FSR ADDR
PC+1
PC+2
0004h
0005h
INST(PC)
NOP
NOP
NOP
Inst(0004h)
Inst(0005h)
FSR ADDR
PC+1
0004h
0005h
INST(PC)
NOP
NOP
Inst(0004h)
Interrupt
GIE
PC
Execute
PC-1
PC
2 Cycle Instruction at PC
Interrupt
GIE
PC
Execute
PC-1
PC
3 Cycle Instruction at PC
Interrupt
GIE
PC
Execute
PC-1
PC
3 Cycle Instruction at PC
Preliminary
PC+2
NOP
NOP
DS41458A-page 77
PIC16(L)F1526/27
FIGURE 7-3:
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
(5)
GIE
INSTRUCTION FLOW
PC
Instruction
Fetched
Instruction
Executed
Note 1:
PC
Inst (PC)
Inst (PC 1)
PC + 1
Inst (PC + 1)
PC + 1
Dummy Cycle
Inst (PC)
0004h
0005h
Inst (0004h)
Inst (0005h)
Dummy Cycle
Inst (0004h)
2:
Asynchronous interrupt latency = 3-5 TCY. Synchronous latency = 3-4 TCY, where TCY = instruction cycle time.
Latency is the same whether Inst (PC) is a single cycle or a 2-cycle instruction.
3:
4:
For minimum width of INT pulse, refer to AC specifications in Section 25.0 Electrical Specifications.
5:
DS41458A-page 78
Preliminary
PIC16(L)F1526/27
7.3
7.4
INT Pin
7.5
W register
STATUS register (except for TO and PD)
BSR register
FSR registers
PCLATH register
Upon exiting the Interrupt Service Routine, these registers are automatically restored. Any modifications to
these registers during the ISR will be lost. If modifications to any of these registers are desired, the corresponding Shadow register should be modified and the
value will be restored when exiting the ISR. The
Shadow registers are available in Bank 31 and are
readable and writable. Depending on the users application, other registers may also need to be saved.
Preliminary
DS41458A-page 79
PIC16(L)F1526/27
7.6
7.6.1
INTCON REGISTER
REGISTER 7-1:
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R-0/0
GIE
PEIE
TMR0IE
INTE
IOCIE
TMR0IF
INTF
IOCIF
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
Note 1:
The IOCIF flag bit is read-only and cleared when all the Interrupt-on-Change flags in the IOCBF register
have been cleared by software.
DS41458A-page 80
Preliminary
PIC16(L)F1526/27
7.6.2
PIE1 REGISTER
REGISTER 7-2:
Note:
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
TMR1GIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
Preliminary
DS41458A-page 81
PIC16(L)F1526/27
7.6.3
PIE2 REGISTER
REGISTER 7-3:
Note:
R/W-0/0
R/W-0/0
R/W-0/0
U-0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
OSFIE
TMR5GIE
TMR3GIE
BCL1IE
TMR10IE
TMR8IE
CCP2IE
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
Unimplemented: Read as 0
bit 3
bit 2
bit 1
bit 0
DS41458A-page 82
Preliminary
PIC16(L)F1526/27
7.6.4
PIE3 REGISTER
REGISTER 7-4:
Note:
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
CCP6IE
CCP5IE
CCP4IE
CCP3IE
TMR6IE
TMR5IE
TMR4IE
TMR3IE
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
Preliminary
DS41458A-page 83
PIC16(L)F1526/27
7.6.5
PIE4 REGISTER
REGISTER 7-5:
Note:
R/W-0/0
R/W-0/0
R-0/0
R-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
CCP10IE
CCP9IE
RC2IE
TX2IE
CCP8IE
CCP7IE
BCL2IE
SSP2IE
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
DS41458A-page 84
Preliminary
PIC16(L)F1526/27
7.6.6
PIR1 REGISTER
REGISTER 7-6:
Note:
R/W-0/0
R/W-0/0
R-0/0
R-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
TMR1GIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
Preliminary
DS41458A-page 85
PIC16(L)F1526/27
7.6.7
PIR2 REGISTER
REGISTER 7-7:
Note:
R/W-0/0
R/W-0/0
R/W-0/0
U-0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
OSFIF
TMR5GIF
TMR3GIF
BCL1IF
TMR10IF
TMR8IF
CCP2IF
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
Unimplemented: Read as 0
bit 3
bit 2
bit 1
bit 0
DS41458A-page 86
Preliminary
PIC16(L)F1526/27
7.6.8
PIR3 REGISTER
REGISTER 7-8:
Note:
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
CCP6IF
CCP5IF
CCP4IF
CCP3IF
TMR6IF
TMR5IF
TMR4IF
TMR3IF
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
Preliminary
DS41458A-page 87
PIC16(L)F1526/27
7.6.9
PIR4 REGISTER
REGISTER 7-9:
Note:
R/W-0/0
R/W-0/0
R-0/0
R-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
CCP10IF
CCP9IF
RC2IF
TX2IF
CCP8IF
CCP7IF
BCL2IF
SSP2IF
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
DS41458A-page 88
Preliminary
PIC16(L)F1526/27
TABLE 7-1:
Name
INTCON
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Register
on Page
GIE
PEIE
TMR0IE
INTE
IOCIE
TMR0IF
INTF
IOCIF
80
IOCBF
IOCBF7
IOCBF6
IOCBF5
IOCBF4
IOCBF3
IOCBF2
IOCBF1
IOCBF0
142
IOCBN
IOCBN7
IOCBN6
IOCBN5
IOCBN4
IOCBN3
IOCBN2
IOCBN1
IOCBN0
142
IOCBP
IOCBP7
IOCBP6
IOCBP5
IOCBP4
IOCBP3
IOCBP2
IOCBP1
IOCBP0
142
WPUEN
INTEDG
TMR0CS
TMR0SE
PSA
PIE1
TMR1GIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
81
PIE2
OSFIE
TMR5GIE
TMR3GIE
BCLIE
TMR10IE
TMR8IE
CCP2IE
82
PIE3
CCP6IE
CCP5IE
CCP4IE
CCP3IE
TMR6IE
TMR5IE
TMR4IE
TMR3IE
83
PIE4
CCP10IE
CCP9IE
RC2IE
TX2IE
CCP8IE
CCP7IE
BCL2IE
SSP2IE
84
PIR1
TMR1GIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
85
PIR2
OSFIF
TMR5GIF
TMR3GIF
BCL1IF
TMR10IF
TMR8IF
CCP2IF
86
PIR3
CCP6IF
CCP5IF
CCP4IF
CCP3IF
TMR6IF
TMR5IF
TMR4IF
TMR3IF
87
PIR4
CCP10IF
CCP9IF
RC2IF
TX2IF
CCP8IF
CCP7IF
BCL2IF
SSP2IF
88
OPTION_REG
Legend:
PS<2:0>
165
Preliminary
DS41458A-page 89
PIC16(L)F1526/27
NOTES:
DS41458A-page 90
Preliminary
PIC16(L)F1526/27
8.0
8.1
1.
2.
3.
4.
5.
6.
1.
Preliminary
DS41458A-page 91
PIC16(L)F1526/27
8.1.1
FIGURE 8-1:
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(1)
TOST(3)
CLKOUT(2)
Interrupt flag
GIE bit
(INTCON reg.)
Processor in
Sleep
Instruction Flow
PC
Instruction
Fetched
Instruction
Executed
Note 1:
2:
3:
PC
Inst(PC) = Sleep
Inst(PC - 1)
PC + 1
PC + 2
PC + 2
Inst(PC + 1)
Inst(PC + 2)
Sleep
Inst(PC + 1)
PC + 2
Dummy Cycle
0004h
0005h
Inst(0004h)
Inst(0005h)
Dummy Cycle
Inst(0004h)
DS41458A-page 92
Preliminary
PIC16(L)F1526/27
8.2
8.2.2
8.2.1
Note:
The Low-Power Sleep mode is beneficial for applications that stay in Sleep mode for long periods of time.
The normal mode is beneficial for applications that
need to wake from Sleep quickly and frequently.
Preliminary
DS41458A-page 93
PIC16(L)F1526/27
8.3
REGISTER 8-1:
U-0
U-0
U-0
U-0
U-0
U-0
R/W-0/0
R/W-1/1
VREGPM
Reserved
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-2
Unimplemented: Read as 0
bit 1
bit 0
Note 1:
2:
PIC16F1526/27 only.
See Section 25.0 Electrical Specifications.
TABLE 8-1:
Name
INTCON
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Register on
Page
GIE
PEIE
TMR0IE
INTE
IOCIE
TMR0IF
INTF
IOCIF
80
IOCBF
IOCBF7
IOCBF6
IOCBF5
IOCBF4
IOCBF3
IOCBF2
IOCBF1
IOCBF0
142
IOCBN
IOCBN7
IOCBN6
IOCBN5
IOCBN4
IOCBN3
IOCBN2
IOCBN1
IOCBN0
142
IOCBP
IOCBP7
IOCBP6
IOCBP5
IOCBP4
IOCBP3
IOCBP2
IOCBP1
IOCBP0
142
TMR1GIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
81
PIE2
OSFIE
TMR5GIE
TMR3GIE
BCLIE
TMR10IE
TMR8IE
CCP2IE
82
PIE3
CCP6IE
CCP5IE
CCP4IE
CCP3IE
TMR6IE
TMR5IE
TMR4IE
TMR3IE
83
PIE4
CCP10IE
CCP9IE
RC2IE
TX2IE
CCP8IE
CCP7IE
BCL2IE
SSP2IE
84
PIR1
TMR1GIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
85
PIE1
PIR2
OSFIF
TMR5GIF
TMR3GIF
BCL1IF
TMR10IF
TMR8IF
CCP2IF
86
PIR3
CCP6IF
CCP5IF
CCP4IF
CCP3IF
TMR6IF
TMR5IF
TMR4IF
TMR3IF
87
PIR4
CCP10IF
CCP9IF
RC2IF
TX2IF
CCP8IF
CCP7IF
BCL2IF
SSP2IF
88
STATUS
TO
PD
DC
23
VREGCON(1)
VREGPM
Reserved
94
WDTCON
SWDTEN
99
Legend:
Note 1:
WDTPS<4:0>
DS41458A-page 94
Preliminary
PIC16(L)F1526/27
9.0
TABLE 9-1:
VCAPEN
0
RF0
No Vcap
TABLE 9-2:
Name
CONFIG2
Legend:
Note 1:
Bit -/7
13:8
7:0
Bit -/6
Bit 13/5
Bit 12/4
Bit 11/3
Bit 10/2
Bit 9/1
Bit 8/0
LVP
DEBUG
LPBOR
BORV
STVREN
VCAPEN(1)
WRT<1:0>
Register
on Page
48
Preliminary
DS41458A-page 95
PIC16(L)F1526/27
NOTES:
DS41458A-page 96
Preliminary
PIC16(L)F1526/27
10.0
WATCHDOG TIMER
FIGURE 10-1:
WDTE<1:0> = 01
SWDTEN
WDTE<1:0> = 11
LFINTOSC
23-bit Programmable
Prescaler WDT
WDT Time-out
WDTE<1:0> = 10
Sleep
WDTPS<4:0>
Preliminary
DS41458A-page 97
PIC16(L)F1526/27
10.1
10.3
10.2
WDT IS ALWAYS ON
10.2.2
TABLE 10-1:
by
Sleep.
See
WDTE<1:0>
SWDTEN
Device
Mode
WDT
Mode
11
Active
Awake
Active
10
Sleep
Disabled
01
0
00
TABLE 10-2:
10.4
Any Reset
CLRWDT instruction is executed
Device enters Sleep
Device wakes up from Sleep
Oscillator fail event
WDT is disabled
OST is running
10.2.3
10.2.1
Time-Out Period
10.5
Active
Disabled
Disabled
WDT
WDTE<1:0> = 00
WDTE<1:0> = 01 and SWDTEN = 0
WDTE<1:0> = 10 and enter Sleep
Cleared
CLRWDT Command
Oscillator Fail Detected
Exit Sleep + System Clock = SOSC, EXTRC, INTOSC, EXTCLK
Exit Sleep + System Clock = XT, HS, LP
DS41458A-page 98
Unaffected
Preliminary
PIC16(L)F1526/27
10.6
REGISTER 10-1:
U-0
U-0
R/W-0/0
R/W-1/1
R/W-0/0
R/W-1/1
R/W-1/1
WDTPS<4:0>
bit 7
R/W-0/0
SWDTEN
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-6
Unimplemented: Read as 0
bit 5-1
bit 0
Note 1:
Preliminary
DS41458A-page 99
PIC16(L)F1526/27
TABLE 10-3:
Name
Bit 6
Bit 5
OSCCON
STATUS
WDTCON
Legend:
CONFIG1
Legend:
Bit 3
IRCF<3:0>
Bit 2
TO
PD
Bit 1
Bit 0
SCS<1:0>
DC
WDTPS<4:0>
Register
on Page
64
23
SWDTEN
99
x = unknown, u = unchanged, = unimplemented locations read as 0. Shaded cells are not used by Watchdog Timer.
TABLE 10-4:
Name
Bit 4
Bits
Bit -/7
13:8
7:0
Bit -/6
Bit 13/5
Bit 12/4
Bit 11/3
FCMEN
IESO
CLKOUTEN
MCLRE
PWRTE
CP
Bit 10/2
Bit 9/1
BOREN<1:0>
WDTE<1:0>
FOSC<2:0>
Bit 8/0
Register
on Page
46
= unimplemented location, read as 0. Shaded cells are not used by Watchdog Timer.
DS41458A-page 100
Preliminary
PIC16(L)F1526/27
11.0
11.1.1
PMCON1
PMCON2
PMDATL
PMDATH
PMADRL
PMADRH
11.2
11.1
See Table 11-1 for Erase Row size and the number of
write latches for Flash program memory.
Preliminary
DS41458A-page 101
PIC16(L)F1526/27
TABLE 11-1:
FLASH MEMORY
ORGANIZATION BY DEVICE
Device
PIC16(L)F1526
PIC16(L)F1527
11.2.1
Row Erase
(words)
Write
Latches
(words)
32
32
FIGURE 11-1:
Write
the
desired
address
to
the
PMADRH:PMADRL register pair.
Clear the CFGS bit of the PMCON1 register.
Then, set control bit RD of the PMCON1 register.
FLASH PROGRAM
MEMORY READ
FLOWCHART
Start
Read Operation
Select
Program or Configuration Memory
(CFGS)
Select
Word Address
(PMADRH:PMADRL)
End
Read Operation
DS41458A-page 102
Preliminary
PIC16(L)F1526/27
FIGURE 11-2:
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
PC
Flash ADDR
Flash Data
PC + 1
INSTR (PC)
INSTR(PC - 1)
executed here
PC
+3
PC+3
PMADRH,PMADRL
INSTR (PC + 1)
BSF PMCON1,RD
executed here
PMDATH,PMDATL
INSTR(PC + 1)
instruction ignored
Forced NOP
executed here
PC + 4
INSTR (PC + 3)
INSTR(PC + 2)
instruction ignored
Forced NOP
executed here
PC + 5
INSTR (PC + 4)
INSTR(PC + 3)
executed here
INSTR(PC + 4)
executed here
RD bit
PMDATH
PMDATL
Register
EXAMPLE 11-1:
PMADRL
PROG_ADDR_LO
PMADRL
PROG_ADDR_HI
PMADRH
BCF
BSF
NOP
NOP
PMCON1,CFGS
PMCON1,RD
;
;
;
;
MOVF
MOVWF
MOVF
MOVWF
PMDATL,W
PROG_DATA_LO
PMDATH,W
PROG_DATA_HI
;
;
;
;
Preliminary
DS41458A-page 103
PIC16(L)F1526/27
11.2.2
FIGURE 11-3:
FLASH PROGRAM
MEMORY UNLOCK
SEQUENCE FLOWCHART
Start
Unlock Sequence
Write 055h to
PMCON2
Write 0AAh to
PMCON2
End
Unlock Sequence
DS41458A-page 104
Preliminary
PIC16(L)F1526/27
11.2.3
FIGURE 11-4:
FLASH PROGRAM
MEMORY ERASE
FLOWCHART
Start
Erase Operation
Disable Interrupts
(GIE = 0)
Select
Program or Configuration Memory
(CFGS)
Unlock Sequence
Figure 11-3
(FIGURE
x-x)
Re-enable Interrupts
(GIE = 1)
End
Erase Operation
Preliminary
DS41458A-page 105
Preliminary
Required
Sequence
BCF
BANKSEL
MOVF
MOVWF
MOVF
MOVWF
BCF
BSF
BSF
INTCON,GIE
PMADRL
ADDRL,W
PMADRL
ADDRH,W
PMADRH
PMCON1,CFGS
PMCON1,FREE
PMCON1,WREN
MOVLW
MOVWF
MOVLW
MOVWF
BSF
NOP
NOP
55h
PMCON2
0AAh
PMCON2
PMCON1,WR
BCF
BSF
PMCON1,WREN
INTCON,GIE
; Disable writes
; Enable interrupts
PIC16(L)F1526/27
DS41458A-page 106
EXAMPLE 11-2:
PIC16(L)F1526/27
11.2.4
1.
2.
3.
Preliminary
DS41458A-page 107
PIC16(L)F1526/27
FIGURE 11-5:
7 6
0 7
PMADRH
54
0
PMADRL
5
-
0 7
PMDATH
6
r9 r8 r7 r6 r5 r4 r3 r2 r1 r0 c4 c3 c2 c1 c0
0
PMDATL
8
14
10
14
PMADRL<4:0>
Write Latch #0
00h
14
Write Latch #1
01h
14
CFGS = 0
PMADRH<6:0>
:PMADRL<7:5>
Row
Address
Decode
14
14
14
14
14
Row
Addr
Addr
Addr
Addr
000h
0000h
0001h
001Eh
001Fh
001h
0020h
0021h
003Eh
003Fh
002h
0040h
0041h
005Eh
005Fh
3FEh
7FC0h
7FC1h
7FDEh
7FDFh
3FFh
7FE0h
7FE1h
7FFEh
7FFFh
8000h - 8003h
USER ID 0 - 3
8004h - 8005h
8006h
8007h - 8008h
8009h - 801Fh
reserved
DEVICEID
REVID
Configuration
Words
reserved
Configuration Memory
DS41458A-page 108
Preliminary
PIC16(L)F1526/27
FIGURE 11-6:
Start
Write Operation
Disable Interrupts
(GIE = 0)
Select
Program or Config. Memory
(CFGS)
Enable Write/Erase
Operation (WREN = 1)
Last word to
write ?
Yes
No
Unlock Sequence
(Figure11-3
x-x)
Figure
Increment Address
(PMADRH:PMADRL++)
Unlock Sequence
(Figure11-3
x-x)
Figure
Disable
Write/Erase Operation
(WREN = 0)
Re-enable Interrupts
(GIE = 1)
End
Erase Operation
Preliminary
DS41458A-page 109
PIC16(L)F1526/27
EXAMPLE 11-3:
;
;
;
;
;
;
;
INTCON,GIE
PMADRH
ADDRH,W
PMADRH
ADDRL,W
PMADRL
LOW DATA_ADDR
FSR0L
HIGH DATA_ADDR
FSR0H
PMCON1,CFGS
PMCON1,WREN
PMCON1,LWLO
;
;
;
;
;
;
;
;
;
;
;
;
;
MOVIW
MOVWF
MOVIW
MOVWF
FSR0++
PMDATL
FSR0++
PMDATH
MOVF
XORLW
ANDLW
BTFSC
GOTO
PMADRL,W
0x1F
0x1F
STATUS,Z
START_WRITE
MOVLW
MOVWF
MOVLW
MOVWF
BSF
NOP
55h
PMCON2
0AAh
PMCON2
PMCON1,WR
;
;
;
;
;
;
;
;
PMADRL,F
LOOP
PMCON1,LWLO
55h
PMCON2
0AAh
PMCON2
PMCON1,WR
;
;
;
;
;
;
;
;
;
;
;
;
;
Required
Sequence
LOOP
NOP
INCF
GOTO
Required
Sequence
START_WRITE
BCF
MOVLW
MOVWF
MOVLW
MOVWF
BSF
NOP
NOP
BCF
BSF
DS41458A-page 110
PMCON1,WREN
INTCON,GIE
Preliminary
PIC16(L)F1526/27
11.3
FIGURE 11-7:
FLASH PROGRAM
MEMORY MODIFY
FLOWCHART
Start
Modify Operation
Read Operation
(Figure11-2
x.x)
Figure
Modify Image
The words to be modified are
changed in the RAM image
Erase Operation
(Figure11-4
x.x)
Figure
Write Operation
use RAM image
(Figure11-5
x.x)
Figure
End
Modify Operation
Preliminary
DS41458A-page 111
PIC16(L)F1526/27
11.4
TABLE 11-2:
Address
Function
Read Access
Write Access
8000h-8003h
8006h
8007h-8008h
User IDs
Device ID/Revision ID
Configuration Words 1 and 2
Yes
Yes
Yes
Yes
No
No
EXAMPLE 11-4:
* This code block will read 1 word of program memory at the memory address:
*
PROG_ADDR_LO (must be 00h-08h) data will be returned in the variables;
*
PROG_DATA_HI, PROG_DATA_LO
BANKSEL
MOVLW
MOVWF
CLRF
PMADRL
PROG_ADDR_LO
PMADRL
PMADRH
BSF
BCF
BSF
NOP
NOP
BSF
PMCON1,CFGS
INTCON,GIE
PMCON1,RD
INTCON,GIE
;
;
;
;
;
;
MOVF
MOVWF
MOVF
MOVWF
PMDATL,W
PROG_DATA_LO
PMDATH,W
PROG_DATA_HI
;
;
;
;
DS41458A-page 112
Preliminary
PIC16(L)F1526/27
11.5
Write Verify
FIGURE 11-8:
FLASH PROGRAM
MEMORY VERIFY
FLOWCHART
Start
Verify Operation
Read Operation
(Figure
x.x)
Figure
11-2
PMDAT =
RAM image
?
Yes
No
No
Fail
Verify Operation
Last
Word ?
Yes
End
Verify Operation
Preliminary
DS41458A-page 113
PIC16(L)F1526/27
11.6
REGISTER 11-1:
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
PMDAT<7:0>
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-0
REGISTER 11-2:
U-0
U-0
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
PMDAT<13:8>
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-6
Unimplemented: Read as 0
bit 5-0
REGISTER 11-3:
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
PMADR<7:0>
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-0
PMADR<7:0>: Specifies the Least Significant bits for program memory address
REGISTER 11-4:
U-1
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
PMADR<14:8>
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7
Unimplemented: Read as 1
bit 6-0
PMADR<14:8>: Specifies the Most Significant bits for program memory address
DS41458A-page 114
Preliminary
PIC16(L)F1526/27
REGISTER 11-5:
U-1(1)
R/W-0/0
R/W-0/0
R/W/HC-0/0
R/W/HC-x/q(2)
R/W-0/0
R/S/HC-0/0
R/S/HC-0/0
CFGS
LWLO
FREE
WRERR
WREN
WR
RD
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7
Unimplemented: Read as 1
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
Note 1:
2:
3:
Preliminary
DS41458A-page 115
PIC16(L)F1526/27
REGISTER 11-6:
W-0/0
W-0/0
W-0/0
W-0/0
W-0/0
W-0/0
W-0/0
bit 0
Legend:
R = Readable bit
W = Writable bit
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-0
TABLE 11-3:
Name
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Register on
Page
CFGS
LWLO
FREE
WRERR
WREN
WR
RD
110
PMCON1
PMCON2
111
PMADRL
PMADRL<7:0>
109
PMADRH
PMADRH<6:0>
PMDATL
PMDATH
INTCON
GIE
PEIE
Legend:
CONFIG1
CONFIG2
Legend:
109
PMDATH<5:0>
TMR0IE
INTE
IOCIE
109
TMR0IF
INTF
IOCIF
80
= unimplemented location, read as 0. Shaded cells are not used by Flash program memory module.
TABLE 11-4:
Name
109
PMDATL<7:0>
Bits
Bit -/7
Bit -/6
Bit 13/5
Bit 12/4
Bit 11/3
IESO
CLKOUTEN
13:8
FCMEN
7:0
CP
MCLRE
PWRTE
Bit 10/2
Bit 9/1
Bit 8/0
BOREN<1:0>
WDTE<1:0>
FOSC<2:0>
13:8
LVP
DEBUG
LPBOR
BORV
7:0
VCAPEN(1)
STVREN
WRT<1:0>
Register
on Page
46
48
= unimplemented location, read as 0. Shaded cells are not used by Flash program memory.
DS41458A-page 116
Preliminary
PIC16(L)F1526/27
12.0
I/O PORTS
FIGURE 12-1:
D
Write LATx
Write PORTx
TRISx
CK
VDD
Data Register
Data Bus
I/O pin
Read PORTx
To peripherals
ANSELx
Device
PORTB
PORTC
PORTD
PORTE
PORTF
PORTG
TABLE 12-1:
Read LATx
PIC16(L)F1526
PIC16(L)F1527
EXAMPLE 12-1:
;
;
;
;
VSS
INITIALIZING PORTA
BANKSEL
CLRF
BANKSEL
CLRF
BANKSEL
CLRF
BANKSEL
MOVLW
MOVWF
PORTA
PORTA
LATA
LATA
ANSELA
ANSELA
TRISA
B'00111000'
TRISA
;
;Init PORTA
;Data Latch
;
;
;digital I/O
;
;Set RA<5:3> as inputs
;and set RA<2:0> as
;outputs
Preliminary
DS41458A-page 117
PIC16(L)F1526/27
12.1
REGISTER 12-1:
U-0
U-0
U-0
U-0
U-0
U-0
R/W-0/0
R/W-0/0
T3CKISEL
CCP2SEL
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-2
Unimplemented: Read as 0
bit 1
bit 0
DS41458A-page 118
Preliminary
PIC16(L)F1526/27
12.2
12.2.2
PORTA Registers
TABLE 12-2:
Pin Name
RA0
RA0
RA1
RA1
RA2
RA2
RA3
RA3
RA4
RA4
12.2.1
RA5
RA5
RA6
CLKOUT
OSC2
RA6
RA7
RA7
ANSELA REGISTER
Note 1:
Preliminary
DS41458A-page 119
PIC16(L)F1526/27
REGISTER 12-2:
R/W-x/x
R/W-x/x
R/W-x/x
R/W-x/x
R/W-x/x
R/W-x/x
R/W-x/x
R/W-x/x
RA7
RA6
RA5
RA4
RA3
RA2
RA1
RA0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
RA<7:0>: PORTA I/O Value bits(1)
1 = Port pin is > VIH
0 = Port pin is < VIL
bit 7-0
Note 1:
Writes to PORTA are actually written to corresponding LATA register. Reads from PORTA register is return of actual I/O
pin values.
REGISTER 12-3:
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
TRISA7
TRISA6
TRISA5
TRISA4
TRISA3
TRISA2
TRISA1
TRISA0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
TRISA<7:0>: PORTA Tri-State Control bits
1 = PORTA pin configured as an input (tri-stated)
0 = PORTA pin configured as an output
bit 7-0
REGISTER 12-4:
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
LATA7
LATA6
LATA5
LATA4
LATA3
LATA2
LATA1
LATA0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-0
Note 1:
Writes to PORTA are actually written to corresponding LATA register. Reads from PORTA register is return of actual I/O
pin values.
DS41458A-page 120
Preliminary
PIC16(L)F1526/27
REGISTER 12-5:
U-0
U-0
R/W-1/1
U-0
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
ANSA5
ANSA3
ANSA2
ANSA1
ANSA0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-6
Unimplemented: Read as 0
bit 5
ANSA5: Analog Select between Analog or Digital Function on pins RA5, respectively
0 = Digital I/O. Pin is assigned to port or digital special function.
1 = Analog input. Pin is assigned as analog input(1). Digital input buffer disabled.
bit 4
Unimplemented: Read as 0
bit 3-0
ANSA<3:0>: Analog Select between Analog or Digital Function on pins RA<3:0>, respectively
0 = Digital I/O. Pin is assigned to port or digital special function.
1 = Analog input. Pin is assigned as analog input(1). Digital input buffer disabled.
Note 1:
When setting a pin to an analog input, the corresponding TRIS bit must be set to Input mode in order to
allow external control of the voltage on the pin.
TABLE 12-3:
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Register
on Page
ANSELA
ANSA5
ANSA3
ANSA2
ANSA1
ANSA0
121
APFCON
LATA7
LATA6
LATA5
LATA4
LATA3
LATA2
WPUEN
INTEDG
TMR0CS
TMR0SE
PSA
PORTA
RA7
RA6
RA5
RA4
RA3
RA2
RA1
RA0
120
TRISA
TRISA7
TRISA6
TRISA5
TRISA4
TRISA3
TRISA2
TRISA1
TRISA0
120
Name
LATA
OPTION_REG
Legend:
CONFIG1
Legend:
LATA1
118
LATA0
120
PS<2:0>
165
x = unknown, u = unchanged, = unimplemented locations read as 0. Shaded cells are not used by PORTA.
TABLE 12-4:
Name
T3CKISEL CCP2SEL
Bits
13:8
7:0
Bit -/6
Bit 13/5
Bit 12/4
Bit 11/3
FCMEN
IESO
CLKOUTEN
MCLRE
PWRTE
CP
Bit 10/2
WDTE<1:0>
Bit 9/1
BOREN<1:0>
FOSC<2:0>
Bit 8/0
Register
on Page
48
Preliminary
DS41458A-page 121
PIC16(L)F1526/27
12.3
12.3.2
PORTB Registers
TABLE 12-5:
Pin Name
12.3.1
ANSELB REGISTER
Note 1:
RB0
RB0
RB1
RB1
RB2
RB2
RB3
CCP2
RB3
RB4
RB4
RB5
RB5
RB6
ICDCLK
RB6
RB7
ICDDAT
RB7
DS41458A-page 122
Preliminary
PIC16(L)F1526/27
REGISTER 12-6:
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
RB7
RB6
RB5
RB4
RB3
RB2
RB1
RB0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
RB<7:0>: PORTB General Purpose I/O Pin bits(1)
1 = Port pin is > VIH
0 = Port pin is < VIL
bit 7-0
Note 1:
Writes to PORTB are actually written to corresponding LATB register. Reads from PORTB register is
return of actual I/O pin values.
REGISTER 12-7:
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
TRISB7
TRISB6
TRISB5
TRISB4
TRISB3
TRISB2
TRISB1
TRISB0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-0
REGISTER 12-8:
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
LATB7
LATB6
LATB5
LATB4
LATB3
LATB2
LATB1
LATB0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-0
Note 1:
Writes to PORTB are actually written to corresponding LATB register. Reads from PORTB register is
return of actual I/O pin values.
Preliminary
DS41458A-page 123
PIC16(L)F1526/27
REGISTER 12-9:
U-0
U-0
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
ANSB5
ANSB4
ANSB3
ANSB2
ANSB1
ANSB0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-6
Unimplemented: Read as 0
bit 5-0
ANSB<5:0>: Analog Select between Analog or Digital Function on pins RB<5:0>, respectively
0 = Digital I/O. Pin is assigned to port or digital special function.
1 = Analog input. Pin is assigned as analog input(1). Digital input buffer disabled.
Note 1:
When setting a pin to an analog input, the corresponding TRIS bit must be set to Input mode in order to
allow external control of the voltage on the pin.
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
WPUB7
WPUB6
WPUB5
WPUB4
WPUB3
WPUB2
WPUB1
WPUB0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-0
Note 1:
2:
Global WPUEN bit of the OPTION_REG register must be cleared for individual pull-ups to be enabled.
The weak pull-up device is automatically disabled if the pin is in configured as an output.
TABLE 12-6:
Name
Bit 5
Bit 4
Bit 3
Bit 2
APFCON
ANSELB
ANSB5
ANSB4
ANSB3
ANSB2
ANSB1
ANSB0
124
LATB7
LATB6
LATB5
LATB4
LATB3
LATB2
LATB1
LATB0
123
LATB
Bit 1
Bit 0
Register
on Page
Bit 7
T3CKISEL CCP2SEL
124
PORTB
RB7
RB6
RB5
RB4
RB3
RB2
RB1
RB0
123
TRISB
TRISB7
TRISB6
TRISB5
TRISB4
TRISB3
TRISB2
TRISB1
TRISB0
123
WPUB
WPUB7
WPUB6
WPUB5
WPUB4
WPUB3
WPUB2
WPUB1
WPUB0
124
Legend:
x = unknown, u = unchanged, - = unimplemented locations read as 0. Shaded cells are not used by
PORTB.
DS41458A-page 124
Preliminary
PIC16(L)F1526/27
12.4
12.4.1
PORTC Registers
TABLE 12-7:
Pin Name
Preliminary
Function Priority(1)
RC0
SOSCO
RC0
RC1
SOSCI
CCP2
RC1
RC2
CCP1
RC2
RC3
SCL1
SCK1
RC3(2)
RC4
SDA1
RC4(2)
RC5
SDO1
RC5
RC6
CK1
TX1
RC6
RC7
DT1
RC7
Note 1:
2:
DS41458A-page 125
PIC16(L)F1526/27
REGISTER 12-11: PORTC: PORTC REGISTER
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
RC7
RC6
RC5
RC4
RC3
RC2
RC1
RC0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
RC<7:0>: PORTC General Purpose I/O Pin bits(1)
1 = Port pin is > VIH
0 = Port pin is < VIL
bit 7-0
Note 1:
Writes to PORTC are actually written to corresponding LATC register. Reads from PORTC register is
return of actual I/O pin values.
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
TRISC7
TRISC6
TRISC5
TRISC4
TRISC3
TRISC2
TRISC1
TRISC0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
TRISC<7:0>: PORTC Tri-State Control bits(1)
1 = PORTC pin configured as an input (tri-stated)
0 = PORTC pin configured as an output
bit 7-0
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
LATC7
LATC6
LATC5
LATC4
LATC3
LATC2
LATC1
LATC0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-0
Note 1:
Writes to PORTC are actually written to corresponding LATC register. Reads from PORTC register is
return of actual I/O pin values.
DS41458A-page 126
Preliminary
PIC16(L)F1526/27
TABLE 12-8:
Name
APFCON
LATC
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
LATC7
LATC6
LATC5
LATC4
LATC3
LATC2
Bit 1
Bit 0
T3CKISEL CCP2SEL
LATC1
Register
on Page
124
LATC0
123
PORTC
RC7
RC6
RC5
RC4
RC3
RC2
RC1
RC0
123
TRISC
TRISC7
TRISC6
TRISC5
TRISC4
TRISC3
TRISC2
TRISC1
TRISC0
123
Legend:
x = unknown, u = unchanged, - = unimplemented locations read as 0. Shaded cells are not used by PORTC.
Preliminary
DS41458A-page 127
PIC16(L)F1526/27
12.5
12.5.2
PORTD Registers
TABLE 12-9:
Pin Name
12.5.1
ANSELD REGISTER
RD0
RD0
RD1
RD1
RD2
RD2
RD3
RD3
RD4
SDO2
RD4
RD5
SDA2
RD5(2)
RD6
SCL2
SCK2
RD6(2)
RD7
RD7
Note 1:
2:
DS41458A-page 128
Preliminary
PIC16(L)F1526/27
REGISTER 12-14: PORTD: PORTD REGISTER
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
RD7
RD6
RD5
RD4
RD3
RD2
RD1
RD0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
RD<7:0>: PORTD General Purpose I/O Pin bits(1)
1 = Port pin is > VIH
0 = Port pin is < VIL
bit 7-0
Note 1:
Writes to PORTD are actually written to corresponding LATD register. Reads from PORTD register is
return of actual I/O pin values.
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
TRISD7
TRISD6
TRISD5
TRISD4
TRISD3
TRISD2
TRISD1
TRISD0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-0
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
LATD7
LATD6
LATD5
LATD4
LATD3
LATD2
LATD1
LATD0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-0
Note 1:
Writes to PORTD are actually written to corresponding LATD register. Reads from PORTD register is
return of actual I/O pin values.
Preliminary
DS41458A-page 129
PIC16(L)F1526/27
REGISTER 12-17: ANSELD: PORTD ANALOG SELECT REGISTER
U-0
U-0
U-0
U-0
R/W-1
R/W-1
R/W-1
R/W-1
ANSD3
ANSD2
ANSD1
ANSD0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-4
Unimplemented: Read as 0
bit 3-0
ANSD<3:0>: Analog Select between Analog or Digital Function on pins RD<3:0>, respectively
0 = Digital I/O. Pin is assigned to port or digital special function.
1 = Analog input. Pin is assigned as analog input(1). Digital input buffer disabled.
Note 1:
When setting a pin to an analog input, the corresponding TRIS bit must be set to Input mode in order to
allow external control of the voltage on the pin.
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
WPUD7
WPUD6
WPUD5
WPUD4
WPUD3
WPUD2
WPUD1
WPUD0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-0
Note 1:
2:
Global WPUEN bit of the OPTION_REG register must be cleared for individual pull-ups to be enabled.
The weak pull-up device is automatically disabled if the pin is in configured as an output.
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Register
on Page
ANSD3
ANSD2
ANSD1
ANSD0
124
LATD7
LATD6
LATD5
LATD4
LATD3
LATD2
LATD1
LATD0
123
Name
ANSELD
LATD
PORTD
RD7
RD6
RD5
RD4
RD3
RD2
RD1
RD0
123
TRISD
TRISD7
TRISD6
TRISD5
TRISD4
TRISD3
TRISD2
TRISD1
TRISD0
123
WPUD7
WPUD6
WPUD5
WPUD4
WPUD3
WPUD2
WPUD1
WPUD0
130
WPUD
Legend:
x = unknown, u = unchanged, - = unimplemented locations read as 0. Shaded cells are not used by PORTD.
DS41458A-page 130
Preliminary
PIC16(L)F1526/27
12.6
12.6.2
PORTE Registers
Function Priority(1)
RE0
RE0
RE1
RE1
RE2
CCP10
RE2
RE3
CCP9
RE3
12.6.1
RE4
CCP8
RE4
RE5
CCP7
RE5
RE6
CCP6
RE6
RE7
CCP2
RE7
ANSELE REGISTER
Note 1:
Preliminary
DS41458A-page 131
PIC16(L)F1526/27
REGISTER 12-19: PORTE: PORTE REGISTER
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
RE7
RE6
RE5
RE4
RE3
RE2
RE1
RE0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
RE<7:0>: PORTE General Purpose I/O Pin bits(1)
1 = Port pin is > VIH
0 = Port pin is < VIL
bit 7-0
Note 1:
Writes to PORTE are actually written to corresponding LATE register. Reads from PORTE register is
return of actual I/O pin values.
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
TRISE7
TRISE6
TRISE5
TRISE4
TRISE3
TRISE2
TRISE1
TRISE0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-0
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
LATE7
LATE6
LATE5
LATE4
LATE3
LATE2
LATE1
LATE0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-0
Note 1:
Writes to PORTE are actually written to corresponding LATE register. Reads from PORTE register is
return of actual I/O pin values.
DS41458A-page 132
Preliminary
PIC16(L)F1526/27
REGISTER 12-22: ANSELE: PORTE ANALOG SELECT REGISTER
U-0
U-0
U-0
U-0
U-0
R/W-1
R/W-1
R/W-1
ANSE2
ANSE1
ANSE0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-3
Unimplemented: Read as 0
bit 2-0
ANSE<2:0>: Analog Select between Analog or Digital Function on pins RE<2:0>, respectively
0 = Digital I/O. Pin is assigned to port or digital special function.
1 = Analog input. Pin is assigned as analog input(1). Digital input buffer disabled.
Note 1:
When setting a pin to an analog input, the corresponding TRIS bit must be set to Input mode in order to
allow external control of the voltage on the pin.
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
WPUE7
WPUE6
WPUE5
WPUE4
WPUE3
WPUE2
WPUE1
WPUE0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-0
Note 1:
2:
Global WPUEN bit of the OPTION_REG register must be cleared for individual pull-ups to be enabled.
The weak pull-up device is automatically disabled if the pin is in configured as an output.
Bit 6
Bit 5
Bit 4
Bit 3
APFCON
ANSELE
ANSE2
ANSE1
ANSE0
133
LATE7
LATE6
LATE5
LATE4
LATE3
LATE2
LATE1
LATE0
132
RE7
RE6
RE5
RE4
RE3
RE2
RE1
RE0
132
LATE
PORTE
Bit 2
Bit 1
Bit 0
Register
on Page
Bit 7
T3CKISEL CCP2SEL
124
TRISE
TRISE7
TRISE6
TRISE5
TRISE4
TRISE3
TRISE2
TRISE1
TRISE0
132
WPUE
WPUE7
WPUE6
WPUE5
WPUE4
WPUE3
WPUE2
WPUE1
WPUE0
133
Legend:
x = unknown, u = unchanged, - = unimplemented locations read as 0. Shaded cells are not used by PORTE.
Preliminary
DS41458A-page 133
PIC16(L)F1526/27
12.7
12.7.2
PORTF Registers
12.7.1
ANSELF REGISTER
Note 1:
2:
Function Priority(1)
RF0
VCAP(2)
RF0
RF1
RF1
RF2
RF2
RF3
RF3
RF4
RF4
RF5
RF5
RF6
RF6
RF7
RF7
The state of the ANSELF bits has no effect on digital output functions. A pin with TRIS clear and ANSELF set will
still operate as a digital output, but the Input mode will be
analog. This can cause unexpected behavior when executing read-modify-write instructions on the affected
port.
Note:
DS41458A-page 134
Preliminary
PIC16(L)F1526/27
REGISTER 12-24: PORTF: PORTF REGISTER
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
RF7
RF6
RF5
RF4
RF3
RF2
RF1
RF0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
RF<7:0>: PORTF General Purpose I/O Pin bits(1)
1 = Port pin is > VIH
0 = Port pin is < VIL
bit 7-0
Note 1:
Writes to PORTF are actually written to corresponding LATF register. Reads from PORTF register is return
of actual I/O pin values.
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
TRISF7
TRISF6
TRISF5
TRISF4
TRISF3
TRISF2
TRISF1
TRISF0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-0
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
LATF7
LATF6
LATF5
LATF4
LATF3
LATF2
LATF1
LATF0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-0
Note 1:
Writes to PORTF are actually written to corresponding LATF register. Reads from PORTF register is return
of actual I/O pin values.
Preliminary
DS41458A-page 135
PIC16(L)F1526/27
REGISTER 12-27: ANSELF: PORTF ANALOG SELECT REGISTER
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
ANSF7
ANSF6
ANSF5
ANSF4
ANSF3
ANSF2
ANSF1
ANSF0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-0
Note 1:
ANSF<7:0>: Analog Select between Analog or Digital Function on pins RF<7:0>, respectively
0 = Digital I/O. Pin is assigned to port or digital special function.
1 = Analog input. Pin is assigned as analog input(1). Digital input buffer disabled.
When setting a pin to an analog input, the corresponding TRIS bit must be set to Input mode in order to
allow external control of the voltage on the pin.
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Register
on Page
ANSELF
ANSF7
ANSF6
ANSF5
ANSF4
ANSF3
ANSF2
ANSF1
ANSF0
136
LATF
LATF7
LATF6
LATF5
LATF4
LATF3
LATF2
LATF1
LATF0
135
RF7
RF6
RF5
RF4
RF3
RF2
RF1
RF0
135
TRISF7
TRISF6
TRISF5
TRISF4
TRISF3
TRISF2
TRISF1
TRISF0
135
Name
PORTF
TRISF
Legend:
x = unknown, u = unchanged, - = unimplemented locations read as 0. Shaded cells are not used by PORTF.
CONFIG2
Legend:
Note 1:
Bits
Bit -/7
13:8
7:0
Bit -/6
Bit 13/5
Bit 12/4
Bit 11/3
Bit 10/2
Bit 9/1
Bit 8/0
LVP
DEBUG
LPBOR
BORV
STVREN
VCAPEN(1)
WRT<1:0>
Register
on Page
48
DS41458A-page 136
Preliminary
PIC16(L)F1526/27
12.8
12.8.2
PORTG Registers
12.8.1
ANSELG REGISTER
Function Priority(1)
RG0
CCP3
RG0
RG1
CK2
TX2
RG1
RG2
DT2
RG2
RG3
CCP4
RG3
RG4
CCP5
RG4
RG5
Note 1:
Preliminary
DS41458A-page 137
PIC16(L)F1526/27
REGISTER 12-28: PORTG: PORTG REGISTER
U-0
U-0
R-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
RG5
RG4
RG3
RG2
RG1
RG0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-6
Unimplemented: Read as 0
bit 5-0
Note 1:
Writes to PORTG are actually written to corresponding LATG register. Reads from PORTG register is
return of actual I/O pin values.
U-0
U-1(1)
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
TRISG4
TRISG3
TRISG2
TRISG1
TRISG0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-6
Unimplemented: Read as 0
bit 5
Unimplemented: Read as 1
bit 4-0
Note 1:
Unimplemented, read as 1.
DS41458A-page 138
Preliminary
PIC16(L)F1526/27
REGISTER 12-30: LATG: PORTG DATA LATCH REGISTER
U-0
U-0
U-0
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
LATG4
LATG3
LATG2
LATG1
LATG0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-5
Unimplemented: Read as 0
bit 4-0
Note 1:
Writes to PORTG are actually written to corresponding LATG register. Reads from PORTG register is
return of actual I/O pin values.
U-0
U-0
R/W-1
R/W-1
R/W-1
R/W-1
U-0
ANSG4
ANSG3
ANSG2
ANSG1
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-5
Unimplemented: Read as 0
bit 4-1
ANSG<4:1>: Analog Select between Analog or Digital Function on Pins RG<4:1>, respectively
0 = Digital I/O. Pin is assigned to port or digital special function.
1 = Analog input. Pin is assigned as analog input(1). Digital input buffer disabled.
bit 0
Unimplemented: Read as 0
Note 1:
When setting a pin to an analog input, the corresponding TRIS bit must be set to Input mode in order to
allow external control of the voltage on the pin.
Preliminary
DS41458A-page 139
PIC16(L)F1526/27
REGISTER 12-32: WPUG: WEAK PULL-UP PORTG REGISTER
U-0
U-0
R/W-1/1
U-0
U-0
U-0
U-0
U-0
WPUG5
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-6
Unimplemented: Read as 0
bit 5
bit 4-0
Note 1:
2:
Unimplemented: Read as 0
Global WPUEN bit of the OPTION_REG register must be cleared for individual pull-ups to be enabled.
The weak pull-up device is automatically disabled if the pin is in configured as an output.
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Register
on Page
ANSELG
ANSG4
ANSG3
ANSG2
ANSG1
139
LATG
LATG4
LATG3
LATG2
LATG1
LATG0
139
PORTG
RG5
RG4
RG3
RG2
RG1
RG0
138
TRISG
TRISG5
TRISG4
TRISG3
TRISG2
TRISG1
TRISG0
138
WPUG
WPUG5
140
Name
Legend: x = unknown, u = unchanged, = unimplemented locations read as 0. Shaded cells are not used by
PORTG.
CONFIG1
Legend:
Bits
Bit -/7
Bit 13/5
Bit 12/4
Bit 11/3
FCMEN
IESO
CLKOUTEN
MCLRE
PWRTE
13:8
7:0
Bit -/6
CP
Bit 10/2
WDTE<1:0>
Bit 9/1
BOREN<1:0>
FOSC<2:0>
Bit 8/0
Register
on Page
48
DS41458A-page 140
Preliminary
PIC16(L)F1526/27
13.0
INTERRUPT-ON-CHANGE
13.3
13.4
13.1
Interrupt Flags
EXAMPLE 13-1:
13.2
MOVLW
XORWF
ANDWF
13.5
0xff
IOCBF, W
IOCBF, F
Operation in Sleep
Preliminary
DS41458A-page 141
PIC16(L)F1526/27
FIGURE 13-1:
IOCBNx
Q4Q1
CK
edge
detect
IOCBPx
data bus =
0 or 1
write IOCBFx
CK
to data bus
IOCBFx
CK
IOCIE
R
Q2
from all other
IOCBFx individual
pin detectors
Q1
Q2
Q3
Q4
Q2
Q2
Q3
Q4
Q4Q1
13.6
Q1
Q1
Q3
Q4
Q4Q1
Q4
Q4Q1
Q4Q1
Interrupt-On-Change Registers
REGISTER 13-1:
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
IOCBP7
IOCBP6
IOCBP5
IOCBP4
IOCBP3
IOCBP2
IOCBP1
IOCBP0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-0
DS41458A-page 142
Preliminary
PIC16(L)F1526/27
REGISTER 13-2:
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
IOCBN7
IOCBN6
IOCBN5
IOCBN4
IOCBN3
IOCBN2
IOCBN1
IOCBN0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-0
REGISTER 13-3:
R/W/HS-0/0
R/W/HS-0/0
R/W/HS-0/0
R/W/HS-0/0
R/W/HS-0/0
R/W/HS-0/0
R/W/HS-0/0
R/W/HS-0/0
IOCBF7
IOCBF6
IOCBF5
IOCBF4
IOCBF3
IOCBF2
IOCBF1
IOCBF0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-0
TABLE 13-1:
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Register
on Page
ANSELB
ANSB5
ANSB4
ANSB3
ANSB2
ANSB1
ANSB0
124
INTCON
GIE
PEIE
TMR0IE
INTE
IOCIE
TMR0IF
INTF
IOCIF
80
Name
IOCBP
IOCBP7
IOCBP6
IOCBP5
IOCBP4
IOCBP3
IOCBP2
IOCBP1
IOCBP0
142
IOCBN
IOCBN7
IOCBN6
IOCBN5
IOCBN4
IOCBN3
IOCBN2
IOCBN1
IOCBN0
142
IOCBF
IOCBF7
IOCBF6
IOCBF5
IOCBF4
IOCBF3
IOCBF2
IOCBF1
IOCBF0
142
TRISB
TRISB7
TRISB6
TRISB5
TRISB4
TRISB3
TRISB2
TRISB1
TRISB0
123
Legend: = unimplemented location, read as 0. Shaded cells are not used by Interrupt-on-Change.
Preliminary
DS41458A-page 143
PIC16(L)F1526/27
NOTES:
DS41458A-page 144
Preliminary
PIC16(L)F1526/27
14.0
14.1
14.2
FIGURE 14-1:
2
x1
x2
x4
FVR BUFFER1
(To ADC Module)
1.024V Fixed
Reference
+
FVREN
FVRRDY
TABLE 14-1:
Peripheral
HFINTOSC
BOR
LDO
Description
BOREN<1:0> = 11
Preliminary
DS41458A-page 145
PIC16(L)F1526/27
14.3
REGISTER 14-1:
R/W-0/0
R-q/q
R/W-0/0
R/W-0/0
U-0
U-0
FVREN
FVRRDY(1)
TSEN
TSRNG
R/W-0/0
R/W-0/0
ADFVR<1:0>
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
bit 3-2
Unimplemented: Read as 0
bit 1-0
Note 1:
2:
TABLE 14-2:
Name
FVRCON
Legend:
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
FVREN
FVRRDY
TSEN
TSRNG
Bit 1
Bit 0
ADFVR<1:0>
Register
on page
146
DS41458A-page 146
Preliminary
PIC16(L)F1526/27
15.0
TEMPERATURE INDICATOR
MODULE
FIGURE 15-1:
VDD
TSEN
TSRNG
15.1
TEMPERATURE CIRCUIT
DIAGRAM
VOUT
ADC
MUX
ADC
n
CHS bits
(ADCON0 register)
Circuit Operation
EQUATION 15-1:
VOUT RANGES
15.2
TABLE 15-1:
The temperature sense circuit is integrated with the
Fixed Voltage Reference (FVR) module. See
Section 14.0 Fixed Voltage Reference (FVR) for
more information.
The circuit is enabled by setting the TSEN bit of the
FVRCON register. When disabled, the circuit draws no
current.
The circuit operates in either high or low range. The high
range, selected by setting the TSRNG bit of the
FVRCON register, provides a wider output voltage. This
provides more resolution over the temperature range,
but may be less consistent from part to part. This range
requires a higher bias voltage to operate and thus, a
higher VDD is needed.
The low range is selected by clearing the TSRNG bit of
the FVRCON register. The low range generates a lower
voltage drop and thus, a lower bias voltage is needed to
operate the circuit. The low range is provided for low
voltage operation.
3.6V
1.8V
15.3
Temperature Output
15.4
Preliminary
DS41458A-page 147
PIC16(L)F1526/27
NOTES:
DS41458A-page 148
Preliminary
PIC16(L)F1526/27
16.0
ANALOG-TO-DIGITAL
CONVERTER (ADC) MODULE
FIGURE 16-1:
VDD
ADPREF = 00
ADPREF = 11
VREF
AN0
00000
AN1
00001
AN2
00010
VREF+/AN3
00011
AN4
00100
AN5
00101
AN6
00110
ADPREF = 10
ADC
10
GO/DONE
ADFM
AN29
11101
Temp Indicator
11110
FVR Buffer1
11111
0 = Left Justify
1 = Right Justify
ADON(1)
16
VSS
ADRESH
ADRESL
CHS<4:0>(2)
Note 1:
2:
Preliminary
DS41458A-page 149
PIC16(L)F1526/27
16.1
16.1.4
ADC Configuration
Port configuration
Channel selection
ADC voltage reference selection
ADC conversion clock source
Interrupt control
Result formatting
16.1.1
16.1.2
The source of the conversion clock is software selectable via the ADCS bits of the ADCON1 register. There
are seven possible clock options:
PORT CONFIGURATION
FOSC/2
FOSC/4
FOSC/8
FOSC/16
FOSC/32
FOSC/64
FRC (dedicated internal oscillator)
CHANNEL SELECTION
CONVERSION CLOCK
16.1.3
VREF+ pin
VDD
FVR 2.048V
FVR 4.096V (Not available on LF devices)
DS41458A-page 150
Preliminary
PIC16(L)F1526/27
TABLE 16-1:
ADC
Clock Source
ADCS<2:0>
20 MHz
16 MHz
8 MHz
4 MHz
1 MHz
FOSC/2
000
100 ns(2)
125 ns(2)
250 ns(2)
500 ns(2)
2.0 s
FOSC/4
100
(2)
200 ns
(2)
250 ns
(2)
FOSC/8
001
400 ns(2)
0.5 s(2)
FOSC/16
101
800 ns
010
FOSC/64
FRC
FOSC/32
Legend:
Note 1:
2:
3:
4:
1.0 s
4.0 s
1.0 s
2.0 s
8.0 s(3)
1.0 s
2.0 s
4.0 s
16.0 s(3)
1.6 s
2.0 s
4.0 s
110
3.2 s
4.0 s
x11
1.0-6.0 s(1,4)
1.0-6.0 s(1,4)
500 ns
8.0 s
(3)
1.0-6.0 s(1,4)
8.0 s
(3)
16.0 s
(3)
1.0-6.0 s(1,4)
32.0 s(3)
64.0 s(3)
1.0-6.0 s(1,4)
FIGURE 16-2:
TCY - TAD TAD1 TAD2 TAD3 TAD4 TAD5 TAD6 TAD7 TAD8 TAD9 TAD10 TAD11
b4
b1
b0
b6
b7
b2
b8
b3
b9
b5
Conversion starts
Holding capacitor is disconnected from analog input (typically 100 ns)
Set GO bit
On the following cycle:
ADRESH:ADRESL is loaded, GO bit is cleared,
ADIF bit is set, holding capacitor is connected to analog input.
Preliminary
DS41458A-page 151
PIC16(L)F1526/27
16.1.5
INTERRUPTS
16.1.6
RESULT FORMATTING
FIGURE 16-3:
(ADFM = 0)
ADRESL
MSB
LSB
bit 7
bit 0
bit 7
Unimplemented: Read as 0
MSB
bit 7
LSB
bit 0
Unimplemented: Read as 0
DS41458A-page 152
bit 0
bit 7
bit 0
10-bit A/D Result
Preliminary
PIC16(L)F1526/27
16.2
16.2.1
16.2.4
ADC Operation
STARTING A CONVERSION
16.2.2
COMPLETION OF A CONVERSION
16.2.3
TERMINATING A CONVERSION
16.2.5
TABLE 16-2:
Device
CCP
PIC16(L)F1526/27
CCP10
Preliminary
DS41458A-page 153
PIC16(L)F1526/27
16.2.6
EXAMPLE 16-1:
2.
3.
4.
5.
6.
7.
8.
Configure Port:
Disable pin output driver (Refer to the TRIS
register)
Configure pin as analog (Refer to the ANSEL
register)
Configure the ADC module:
Select ADC conversion clock
Configure voltage reference
Select ADC input channel
Turn on ADC module
Configure ADC interrupt (optional):
Clear ADC interrupt flag
Enable ADC interrupt
Enable peripheral interrupt
Enable global interrupt(1)
Wait the required acquisition time(2).
Start conversion by setting the GO/DONE bit.
Wait for ADC conversion to complete by one of
the following:
Polling the GO/DONE bit
Waiting for the ADC interrupt (interrupts
enabled)
Read ADC Result.
Clear the ADC interrupt flag (required if interrupt
is enabled).
A/D CONVERSION
DS41458A-page 154
Preliminary
PIC16(L)F1526/27
16.3
REGISTER 16-1:
U-0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
CHS<4:0>
R/W-0/0
R/W-0/0
GO/DONE
ADON
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7
Unimplemented: Read as 0
bit 6-2
11101 = AN29
11110 = Temperature Indicator(2).
11111 = FVR (Fixed Voltage Reference) Buffer 1 Output(1)
bit 1
bit 0
Note 1:
2:
See Section 14.0 Fixed Voltage Reference (FVR) for more information.
See Section 15.0 Temperature Indicator Module for more information.
Preliminary
DS41458A-page 155
PIC16(L)F1526/27
REGISTER 16-2:
R/W-0/0
R/W-0/0
ADFM
R/W-0/0
R/W-0/0
ADCS<2:0>
U-0
U-0
R/W-0/0
R/W-0/0
ADPREF<1:0>
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6-4
bit 3-2
Unimplemented: Read as 0
bit 1-0
Note 1:
When selecting the FVR or the VREF+ pin as the source of the positive reference, be aware that a
minimum voltage specification exists. See Section 25.0 Electrical Specifications for details.
DS41458A-page 156
Preliminary
PIC16(L)F1526/27
REGISTER 16-3:
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
ADRES<9:2>
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-0
REGISTER 16-4:
R/W-x/u
R/W-x/u
ADRES<1:0>
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-6
bit 5-0
Preliminary
DS41458A-page 157
PIC16(L)F1526/27
REGISTER 16-5:
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
ADRES<9:8>
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-2
bit 1-0
REGISTER 16-6:
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
R/W-x/u
ADRES<7:0>
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-0
DS41458A-page 158
Preliminary
PIC16(L)F1526/27
16.4
EQUATION 16-1:
Assumptions:
T ACQ = Amplifier Settling Time + Hold Capacitor Charging Time + Temperature Coefficient
= T AMP + T C + T COFF
= 2s + T C + Temperature - 25C 0.05s/C
The value for TC can be approximated with the following equations:
1
= V CHOLD
V AP P LI ED 1 -------------------------n+1
2
1
TC
----------
RC
V AP P LI ED 1 e = V CHOLD
Tc
---------
1
RC
;combining [1] and [2]
V AP P LI ED 1 e = V A PP LIE D 1 -------------------------n+1
2
1
T C = C HOLD R IC + R SS + R S ln(1/511)
= 10pF 1k + 7k + 10k ln(0.001957)
= 1.12 s
Therefore:
T A CQ = 2s + 1.12s + 50C- 25C 0.05 s/C
= 4.42s
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.
Preliminary
DS41458A-page 159
PIC16(L)F1526/27
FIGURE 16-4:
Analog
Input
pin
Rs
VT 0.6V
CPIN
5 pF
VA
RIC 1k
Sampling
Switch
SS Rss
I LEAKAGE(1)
VT 0.6V
CHOLD = 10 pF
VSS/VREF-
Legend: CHOLD
CPIN
6V
5V
VDD 4V
3V
2V
= Sample/Hold Capacitance
= Input Capacitance
RSS
= Sampling Switch
VT
= Threshold Voltage
5 6 7 8 9 10 11
Sampling Switch
(k)
FIGURE 16-5:
Full-Scale Range
3FFh
3FEh
3FDh
3FCh
3FBh
03h
02h
01h
00h
VREF-
DS41458A-page 160
1.5 LSB
Zero-Scale
Transition
Full-Scale
Transition
Preliminary
VREF+
PIC16(L)F1526/27
TABLE 16-3:
Name
ADCON0
ADCON1
ADFM
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
CHS<4:0>
ADCS<2:0>
Bit 1
Bit 0
GO/DONE
ADON
ADPREF<1:0>
Register
on Page
155
156
ADRESH
157, 158
ADRESL
157, 158
ANSELA
ANSA4
ANSA2
ANSA1
ANSA0
121
ANSELB
ANSB5
ANSB4
ANSB3
ANSB2
ANSB1
ANSB0
124
ANSELD
ANSD3
ANSD2
ANSD1
ANSD0
130
ANSELE
ANSE2
ANSE1
ANSE0
133
ANSELF
ANSF7
ANSF6
ANSF5
ANSF4
ANSF3
ANSF2
ANSF1
ANSF0
136
ANSELG
ANSG4
ANSG3
ANSG2
ANSG1
139
CCP1CON
DC1B<1:0>
CCP1M<3:0>
197
CCP2CON
DC2B<1:0>
CCP2M<3:0>
197
CCP3CON
DC3B<1:0>
CCP3M<3:0>
197
CCP4CON
DC4B<1:0>
CCP4M<3:0>
197
CCP5CON
DC5B<1:0>
CCP5M<3:0>
197
CCP6CON
DC6B<1:0>
CCP6M<3:0>
197
CCP7CON
DC7B<1:0>
CCP7M<3:0>
197
CCP8CON
DC8B<1:0>
CCP8M<3:0>
197
CCP9CON
DC9B<1:0>
CCP9M<3:0>
197
CCP10CON
DC10B<1:0>
CCP10M<3:0>
197
FVRCON
FVREN
FVRRDY
TSEN
TSRNG
INTCON
GIE
PEIE
TMR0IE
INTE
IOCIE
TMR0IF
INTF
IOCIF
PIE1
TMR1GIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
81
PIR1
TMR1GIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
85
TRISA
TRISA7
TRISA6
TRISA5
TRISA4
TRISA3
TRISA2
TRISA1
TRISA0
120
TRISB
TRISB7
TRISB6
TRISB5
TRISB4
TRISB3
TRISB2
TRISB1
TRISB0
123
CDAFVR<1:0>
ADFVR<1:0>
146
80
TRISD
TRISD7
TRISD6
TRISD5
TRISD4
TRISD3
TRISD2
TRISD1
TRISD0
129
TRISE
TRISE7
TRISE6
TRISE5
TRISE4
TRISE3
TRISE2
TRISE1
TRISE0
132
TRISF
TRISF7
TRISF6
TRISF5
TRISF4
TRISF3
TRISF2
TRISF1
TRISF0
135
TRISG
TRISG4
TRISG3
TRISG2
TRISG1
TRISG0
138
Legend:
= unimplemented read as 0. Shaded cells are not used for ADC module.
Preliminary
DS41458A-page 161
PIC16(L)F1526/27
NOTES:
DS41458A-page 162
Preliminary
PIC16(L)F1526/27
17.0
17.1.2
TIMER0 MODULE
17.1
Timer0 Operation
17.1.1
FIGURE 17-1:
FOSC/4
Data Bus
T0CKI
1
Sync
2 TCY
TMR0
0
TMR0SE TMR0CS
8-bit
Prescaler
PSA
PS<2:0>
Preliminary
DS41458A-page 163
PIC16(L)F1526/27
17.1.3
SOFTWARE PROGRAMMABLE
PRESCALER
17.1.4
TIMER0 INTERRUPT
17.1.5
17.1.6
DS41458A-page 164
Preliminary
PIC16(L)F1526/27
17.2
REGISTER 17-1:
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
WPUEN
INTEDG
TMR0CS
TMR0SE
PSA
R/W-1/1
R/W-1/1
R/W-1/1
PS<2:0>
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2-0
TABLE 17-1:
Name
INTCON
TRISA
Timer0 Rate
000
001
010
011
100
101
110
111
1:2
1:4
1:8
1 : 16
1 : 32
1 : 64
1 : 128
1 : 256
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Register
on Page
GIE
PEIE
TMR0IE
INTE
IOCIE
TMR0IF
INTF
IOCIF
80
OPTION_REG WPUEN
TMR0
Bit Value
PSA
PS<2:0>
165
TRISA6
TRISA5
163*
TRISA4
TRISA3
TRISA2
TRISA1
TRISA0
120
Legend: = Unimplemented locations, read as 0. Shaded cells are not used by the Timer0 module.
* Page provides register information.
Preliminary
DS41458A-page 165
PIC16(L)F1526/27
NOTES:
DS41458A-page 166
Preliminary
PIC16(L)F1526/27
18.0
FIGURE 18-1:
.
The x variable used in this section is
used to designate Timer1, Timer3 or
Timer5. For example, TxCON references
T1CON, T3CON or T5CON. PRx references PR1, PR3 or PR5.
Note:
TxGSS<1:0>
TxG
TxGSPM
00
From Timer0
Overflow
01
Timer2/4/6
Overflow(4)
10
Timer10
Overflow
11
TxG_IN
TxGVAL
0
Single Pulse
TMRxON
TxGTM
TxGPOL
CK
R
Acq. Control
Q1
Data Bus
D
Q
RD
T1GCON
EN
Interrupt
TxGGO/DONE
Set
TMRxGIF
det
TMRxGE
TMRxON
To Comparator Module
TMRx(2)
TMRxH
EN
TMRxL
TxCLK
Synchronized
clock input
1
TMRxCS<1:0>
LFINTOSC
Secondary Oscillator
SOSC/TxCKI
TxSYNC
11
det
10
Note 1:
2:
3:
4:
Synchronize(3)
Prescaler
1, 2, 4, 8
FOSC
Internal
Clock
01
FOSC/4
Internal
Clock
00
2
TxCKPS<1:0>
FOSC/2
Internal
Clock
Sleep input
Preliminary
DS41458A-page 167
PIC16(L)F1526/27
FIGURE 18-2:
TMR1CS<1:0>
0
10
SOSCO/T1CKI
OUT
Secondary
Oscillator
SOSCI
Timer 1
EN
LFINTOSC
11
FOSC/4
00
FOSC
01
Timer1
T1CON[SOSCEN]
T3CON[SOSCEN]
T5CON[SOSCEN]
TMR3CS<1:0>
1
10
(1)
T3CKI
Timer 3
LFINTOSC
11
FOSC/4
00
FOSC
01
Timer3
TMR5CS<1:0>
1
10
(1)
T5CKI
LFINTOSC
11
FOSC/4
00
FOSC
01
Timer5
Timer 5
Note 1: ST Buffer is high-speed type when using TxCKI.
DS41458A-page 168
Preliminary
PIC16(L)F1526/27
18.1
Timer1/3/5 Operation
18.2
18.2.1
TABLE 18-1:
TIMER1/3/5 ENABLE
SELECTIONS
Timer1/3/5
Operation
TMRxON
TMRxGE
Off
Off
Always On
Count Enabled
18.2.2
TABLE 18-2:
TMRxCS1
TMRxCS0
SOSCEN
Clock Source
Preliminary
DS41458A-page 169
PIC16(L)F1526/27
18.3
18.5.1
Timer1/3/5 Prescaler
18.4
Timer1/3/5 Oscillator
18.5
Timer1/3/5 Operation in
Asynchronous Counter Mode
Note:
DS41458A-page 170
18.6
Timer1/3/5 Gate
18.6.1
The Timer1/3/5 Gate Enable mode is enabled by setting the TMRxGE bit of the TxGCON register. The
polarity of the Timer1/3/5 Gate Enable mode is configured using the TxGPOL bit of the TxGCON register.
When Timer1/3/5 Gate Enable mode is enabled,
Timer1/3/5 will increment on the rising edge of the
Timer1/3/5 clock source. When Timer1/3/5 Gate
Enable mode is disabled, no incrementing will occur
and Timer1/3/5 will hold the current count. See
Figure 18-4 for timing details.
TABLE 18-3:
TxCLK
TxGPOL
TxG
Counts
Holds Count
Holds Count
Counts
Preliminary
PIC16(L)F1526/27
18.6.2
TABLE 18-4:
T1GSS
00
T1G Pin
T3G Pin
18.6.4
18.6.3
18.6.2.2
T5G Pin
11
18.6.2.1
Overflow of Timer0
(TMR0 increments from FFh to 00h)
01
10
18.6.5
When Timer1/3/5 Gate Value Status is utilized, it is possible to read the most current level of the gate control
value. The value is stored in the TxGVAL bit in the
TxGCON register. The TxGVAL bit is valid even when
the Timer1/3/5 gate is not enabled (TMRxGE bit is
cleared).
Preliminary
DS41458A-page 171
PIC16(L)F1526/27
18.6.6
18.9
18.7
Timer1/3/5 Interrupt
The Timer1/3/5 register pair (TMRxH:TMRxL) increments to FFFFh and rolls over to 0000h. When
Timer1/3/5 rolls over, the Timer1/3/5 interrupt flag bit of
the PIR1 register is set. To enable the interrupt on rollover, you must set these bits:
18.8
Section 20.0
DS41458A-page 172
Preliminary
PIC16(L)F1526/27
FIGURE 18-3:
TXCKI = 1
when TMR1
Enabled
TXCKI = 0
when TMR1
Enabled
Note 1:
2:
FIGURE 18-4:
TMRxGE
TxGPOL
TxG_IN
TxCKI
TxGVAL
Timer1/3/5
N+1
Preliminary
N+2
N+3
N+4
DS41458A-page 173
PIC16(L)F1526/27
FIGURE 18-5:
TMR1GE
TxGPOL
TxGTM
TxG_IN
TxCKI
TxGVAL
Timer1/3/5
FIGURE 18-6:
N+4
N+8
TMR1GE
TxGPOL
TxGSPM
TxGGO/
Cleared by hardware on
falling edge of TxGVAL
Set by software
DONE
Counting enabled on
rising edge of TxG
TxG_IN
TxCKI
TxGVAL
Timer1/3/5
TMR1GIF
DS41458A-page 174
N+1
N+2
Set by hardware on
falling edge of TxGVAL
Cleared by software
Preliminary
Cleared by
software
PIC16(L)F1526/27
FIGURE 18-7:
TMR1GE
TxGPOL
TxGSPM
TxGTM
TxGGO/
Cleared by hardware on
falling edge of TxGVAL
Set by software
DONE
Counting enabled on
rising edge of TxG
TxG_IN
TxCKI
TxGVAL
Timer1/3/5
TMR1GIF
Cleared by software
N+1
N+2
N+3
Set by hardware on
falling edge of TxGVAL
Preliminary
N+4
Cleared by
software
DS41458A-page 175
PIC16(L)F1526/27
18.11 Timer1/3/5 Control Register
The Timer1/3/5 Control register (TxCON), shown in
Register 18-1, is used to control Timer1/3/5 and select
the various features of the Timer1/3/5 module.
REGISTER 18-1:
R/W-0/u
R/W-0/u
TMRxCS<1:0>
R/W-0/u
R/W-0/u
TxCKPS<1:0>
R/W-0/u
R/W-0/u
U-0
R/W-0/u
SOSCEN
TxSYNC
TMRxON
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-6
bit 5-4
bit 3
bit 2
TMRxCS<1:0> = 0X
This bit is ignored. Timer1/3/5 uses the internal clock when TMRxCS<1:0> = 1X.
bit 1
Unimplemented: Read as 0
bit 0
DS41458A-page 176
Preliminary
PIC16(L)F1526/27
18.12 Timer1/3/5 Gate Control Register
The Timer1/3/5 Gate Control register (TxGCON),
shown in Register 18-2, is used to control Timer1/3/5
Gate.
REGISTER 18-2:
R/W-0/u
R/W-0/u
R/W-0/u
R/W-0/u
R/W/HC-0/u
R-x/x
TMRxGE
TxGPOL
TxGTM
TxGSPM
TxGGO/
DONE
TxGVAL
R/W-0/u
R/W-0/u
TxGSS<1:0>
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1-0
Note 1:
Preliminary
DS41458A-page 177
PIC16(L)F1526/27
18.12.1
TABLE 18-5:
Name
ANSELA
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
ANSA5
ANSA3
ANSA2
Bit 1
Bit 0
Register
on Page
ANSA1
ANSA0
121
T3CKISEL CCP2SEL
APFCON
CCP1CON
DC1B<1:0>
CCP1M<3:0>
197
CCP2CON
DC2B<1:0>
CCP2M<3:0>
197
CCP3CON
DC3B<1:0>
CCP3M<3:0>
197
CCP4CON
DC4B<1:0>
CCP4M<3:0>
197
CCP5CON
DC5B<1:0>
CCP5M<3:0>
197
CCP6CON
DC6B<1:0>
CCP6M<3:0>
197
CCP7CON
DC7B<1:0>
CCP7M<3:0>
197
CCP8CON
DC8B<1:0>
CCP8M<3:0>
197
CCP9CON
DC9B<1:0>
CCP9M<3:0>
197
CCP10CON
INTCON
GIE
PEIE
DC10B<1:0>
CCP10M<3:0>
TMR0IE
INTE
IOCIE
118
197
TMR0IF
INTF
IOCIF
80
PIE1
TMR1GIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
81
PIE2
OSFIE
TMR5GIE
TMR3GIE
BCL1IE
TMR10IE
TMR8IE
CCP2IE
82
PIE3
CCP6IE
CCP5IE
CCP4IE
CCP3IE
TMR6IE
TMR5IE
TMR4IE
TMR3IE
83
PIR1
TMR1GIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
85
PIR2
OSFIF
TMR5GIF
TMR3GIF
BCL1IF
TMR10IF
TMR8IF
CCP2IF
86
PIR3
CCP6IF
CCP5IF
CCP4IF
CCP3IF
TMR6IF
TMR5IF
TMR4IF
TMR3IF
87
TMR1H
Holding Register for the Most Significant Byte of the 16-bit TMR1 Register
172*
TMR3H
Holding Register for the Most Significant Byte of the 16-bit TMR3 Register
172*
TMR5H
Holding Register for the Most Significant Byte of the 16-bit TMR5 Register
172*
TMR1L
Holding Register for the Least Significant Byte of the 16-bit TMR1 Register
172*
TMR3L
Holding Register for the Least Significant Byte of the 16-bit TMR3 Register
172*
TMR5L
Holding Register for the Least Significant Byte of the 16-bit TMR5 Register
172*
TRISA3
TRISA2
TRISA1
TRISA0
120
T1CON
TMR1CS<1:0>
T1CKPS<1:0>
SOSCEN
T1SYNC
TMR1ON
176
T3CON
TMR3CS<1:0>
T3CKPS<1:0>
SOSCEN
T3SYNC
TMR3ON
176
T5CON
TMR5CS<1:0>
T5CKPS<1:0>
SOSCEN
T5SYNC
TMR5ON
176
TRISA
TRISA7
TRISA6
TRISA5
TRISA4
T1GCON
TMR1GE
T1GPOL
T1GTM
T1GSPM
T1GGO/
DONE
T1GVAL
T1GSS<1:0>
177
T3GCON
TMR3GE
T3GPOL
T3GTM
T3GSPM
T3GGO/
DONE
T3GVAL
T3GSS<1:0>
177
T5GCON
TMR5GE
T5GPOL
T5GTM
T5GSPM
T5GGO/
DONE
T5GVAL
T5GSS<1:0>
177
Legend:
*
= unimplemented, read as 0. Shaded cells are not used by the Timer1/3/5 module.
Page provides register information.
DS41458A-page 178
Preliminary
PIC16(L)F1526/27
19.0
TIMER2/4/6/8/10 MODULES
for
FIGURE 19-1:
FOSC/4
block
Prescaler
1:1, 1:4, 1:16, 1:64
2
diagram
of
TMRx
Comparator
Reset
EQ
TMRx Output
Postscaler
1:1 to 1:16
TxCKPS<1:0>
4
PRx
TxOUTPS<3:0>
Preliminary
DS41458A-page 179
PIC16(L)F1526/27
19.1
Timer2/4/6/8/10 Operation
19.3
Timer2/4/6/8/10 Output
The unscaled output of TMR2/4/6/8/10 is available primarily to the CCP modules, where it is used as a time
base for operations in PWM mode.
Timer2 can be optionally used as the shift clock source
for the MSSPx modules operating in SPI mode.
Additional information is provided in Section X.X SSP
Module Overview
19.4
19.2
Timer2/4/6/8/10 Interrupt
DS41458A-page 180
Preliminary
PIC16(L)F1526/27
19.5
REGISTER 19-1:
U-0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
TxOUTPS<3:0>
R/W-0/0
R/W-0/0
TMRxON
bit 7
R/W-0/0
TxCKPS<1:0>
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7
Unimplemented: Read as 0
bit 6-3
bit 2
bit 1-0
Preliminary
DS41458A-page 181
PIC16(L)F1526/27
TABLE 19-1:
Name
CCP1CON
DC1B<1:0>
CCP1M<3:0>
197
CCP2CON
DC2B<1:0>
CCP2M<3:0>
197
CCP3CON
DC3B<1:0>
CCP3M<3:0>
197
CCP4CON
DC4B<1:0>
CCP4M<3:0>
197
CCP5CON
DC5B<1:0>
CCP5M<3:0>
197
CCP6CON
DC6B<1:0>
CCP6M<3:0>
197
CCP7CON
DC7B<1:0>
CCP7M<3:0>
197
CCP8CON
DC8B<1:0>
CCP8M<3:0>
197
CCP9CON
DC9B<1:0>
CCP9M<3:0>
197
CCP10CON
DC10B<1:0>
CCP10M<3:0>
GIE
PEIE
TMR0IE
INTE
IOCIE
TMR0IF
INTF
IOCIF
80
PIE1
TMR1GIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
81
PIE2
OSFIE
TMR5GIE
TMR3GIE
BCL1IE
TMR10IE
TMR8IE
CCP2IE
82
PIE3
CCP6IE
CCP5IE
CCP4IE
CCP3IE
TMR6IE
TMR5IE
TMR4IE
TMR3IE
83
PIR1
TMR1GIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
85
PIR2
OSFIF
TMR5GIF
TMR3GIF
BCL1IF
TMR10IF
TMR8IF
CCP2IF
86
PIR3
CCP6IF
CCP5IF
CCP4IF
CCP3IF
TMR6IF
TMR5IF
TMR4IF
TMR3IF
INTCON
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Register
on Page
Bit 7
197
87
PR2
213*
PR4
213*
PR6
213*
PR8
213*
PR10
213*
T2CON
T2OUTPS<3:0>
TMR2ON
T2CKPS1
T2CKPS0
215
T4CON
T4OUTPS<3:0>
TMR4ON
T4CKPS1
T4CKPS0
215
T6CON
T6OUTPS<3:0>
TMR6ON
T6CKPS1
T6CKPS0
215
T8CON
T8OUTPS<3:0>
TMR8ON
T8CKPS1
T8CKPS0
215
T10CON
T10OUTPS<3:0>
215
TMR2
213*
TMR4
213*
TMR6
213*
TMR8
213*
TMR10
213*
Legend:
*
= unimplemented location, read as 0. Shaded cells are not used for Timer2/4/6/8/10 module.
Page provides register information.
DS41458A-page 182
Preliminary
PIC16(L)F1526/27
20.0
CAPTURE/COMPARE/PWM
MODULES
Preliminary
DS41458A-page 183
PIC16(L)F1526/27
20.1
20.1.2
Capture Mode
TABLE 20-1:
20.1.1
FIGURE 20-1:
Prescaler
1, 4, 16
and
Edge Detect
TMR1
TMR3
TMR5
CCP1
CCP2
CCP3
CCP4
CCP5
CCP6
CCP7
CCP8
CCP9
CCP10
CCPRxH
CCP
20.1.3
CAPTURE MODE
OPERATION BLOCK
DIAGRAM
CCPx
Pin
CCPRxL
Capture
Enable
TMRxH
TMRxL
CCPxM<3:0>
System Clock (FOSC)
DS41458A-page 184
Preliminary
PIC16(L)F1526/27
20.1.4
CCP PRESCALER
20.1.6
EXAMPLE 20-1:
CHANGING BETWEEN
CAPTURE PRESCALERS
BANKSEL CCPxCON
CLRF
MOVLW
MOVWF
20.1.5
Preliminary
DS41458A-page 185
PIC16(L)F1526/27
TABLE 20-2:
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
APFCON
T3CKISEL
CCP2SEL
CCP1CON
DC1B<1:0>
CCP1M<3:0>
197
CCP2CON
DC2B<1:0>
CCP2M<3:0>
197
CCP3CON
DC3B<1:0>
CCP3M<3:0>
197
CCP4CON
DC4B<1:0>
CCP4M<3:0>
197
CCP5CON
DC5B<1:0>
CCP5M<3:0>
197
CCP6CON
DC6B<1:0>
CCP6M<3:0>
197
CCP7CON
DC7B<1:0>
CCP7M<3:0>
197
CCP8CON
DC8B<1:0>
CCP8M<3:0>
197
CCP9CON
DC9B<1:0>
CCP9M<3:0>
197
CCP10CON
DC10B<1:0>
CCP10M<3:0>
197
118
CCPR1L
184*
CCPR2L
184*
CCPR3L
184*
CCPR4L
184*
CCPR5L
184*
CCPR6L
184*
CCPR7L
184*
CCPR8L
184*
CCPR9L
184*
CCPR10L
184*
CCPR1H
184*
CCPR2H
184*
CCPR3H
184*
CCPR4H
184*
CCPR5H
184*
CCPR6H
184*
CCPR7H
184*
CCPR8H
184*
CCPR9H
184*
CCPR10H
INTCON
184*
GIE
PEIE
TMR0IE
INTE
IOCIE
TMR0IF
INTF
IOCIF
80
PIE1
TMR1GIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
81
PIE2
OSFIE
TMR5GIE
TMR3GIE
BCL1IE
TMR10IE
TMR8IE
CCP2IE
82
PIE3
CCP6IE
CCP5IE
CCP4IE
CCP3IE
TMR6IE
TMR5IE
TMR4IE
TMR3IE
83
PIE4
CCP10IE
CCP9IE
RC2IE
TX2IE
CCP8IE
CCP7IE
BCL2IE
SSP2IE
84
PIR1
TMR1GIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
85
PIR2
OSFIF
TMR5GIF
TMR3GIF
BCL1IF
TMR10IF
TMR8IF
CCP2IF
86
PIR3
CCP6IF
CCP5IF
CCP4IF
CCP3IF
TMR6IF
TMR5IF
TMR4IF
TMR3IF
87
PIR4
CCP10IF
CCP9IF
RC2IF
TX2IF
CCP8IF
CCP7IF
BCL2IF
SSP2IF
88
T1CON
TMR1CS<1:0>
T1CKPS<1:0>
SOSCEN
T1SYNC
TMR1ON
176
T3CON
TMR3CS<1:0>
T3CKPS<1:0>
SOSCEN
T3SYNC
TMR3ON
176
T5CON
TMR5CS<1:0>
T5CKPS<1:0>
SOSCEN
T5SYNC
TMR5ON
176
T1GCON
TMR1GE
T1GPOL
T1GTM
T1GSPM
T1GGO/DONE
T1GVAL
T1GSS<1:0>
177
T3GCON
TMR3GE
T3GPOL
T3GTM
T3GSPM
T3GGO/DONE
T3GVAL
T3GSS<1:0>
177
Legend:
= Unimplemented location, read as 0. Shaded cells are not used by Capture mode.
* Page provides register information.
DS41458A-page 186
Preliminary
PIC16(L)F1526/27
TABLE 20-2:
Name
T5GCON
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
TMR5GE
T5GPOL
T5GTM
T5GSPM
T5GGO/DONE
T5GVAL
Bit 1
Bit 0
T5GSS<1:0>
Register on
Page
177
TMR1L
Holding Register for the Least Significant Byte of the 16-bit TMR1 Register
172*
TMR3L
Holding Register for the Least Significant Byte of the 16-bit TMR3 Register
172*
TMR6L
Holding Register for the Least Significant Byte of the 16-bit TMR6 Register
172*
TMR1H
Holding Register for the Most Significant Byte of the 16-bit TMR1 Register
172*
TMR3H
Holding Register for the Most Significant Byte of the 16-bit TMR3 Register
172*
TMR6H
Holding Register for the Most Significant Byte of the 16-bit TMR6 Register
TRISA
Legend:
TRISA7
TRISA6
TRISA5
TRISA4
TRISA3
172*
TRISA2
TRISA1
TRISA0
120
= Unimplemented location, read as 0. Shaded cells are not used by Capture mode.
* Page provides register information.
Preliminary
DS41458A-page 187
PIC16(L)F1526/27
20.2
20.2.1
Compare Mode
Note:
20.2.2
FIGURE 20-2:
TABLE 20-3:
COMPARE MODE
OPERATION BLOCK
DIAGRAM
CCPxM<3:0>
Mode Select
Set CCPxIF Interrupt Flag
(PIRx)
4
CCPRxH CCPRxL
CCPx
Pin
S
R
Output
Logic
Match
TRIS
Output Enable
Special Event Trigger
Comparator
TMRxH
TMRxL
CCP
TMR1
TMR3
CCP1
CCP2
CCP3
CCP4
CCP5
CCP6
CCP7
CCP8
CCP9
CCP10
TMR5
DS41458A-page 188
Preliminary
PIC16(L)F1526/27
20.2.3
20.2.5
20.2.4
20.2.6
TABLE 20-4:
Device
CCPx
PIC16(L)F1526/27
CCP10
Preliminary
DS41458A-page 189
PIC16(L)F1526/27
TABLE 20-5:
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
APFCON
T3CKISEL
CCP2SEL
CCP1CON
DC1B<1:0>
CCP1M<3:0>
197
CCP2CON
DC2B<1:0>
CCP2M<3:0>
197
CCP3CON
DC3B<1:0>
CCP3M<3:0>
197
CCP4CON
DC4B<1:0>
CCP4M<3:0>
197
CCP5CON
DC5B<1:0>
CCP5M<3:0>
197
CCP6CON
DC6B<1:0>
CCP6M<3:0>
197
CCP7CON
DC7B<1:0>
CCP7M<3:0>
197
CCP8CON
DC8B<1:0>
CCP8M<3:0>
197
CCP9CON
DC9B<1:0>
CCP9M<3:0>
197
CCP10CON
DC10B<1:0>
CCP10M<3:0>
197
118
CCPR1L
184*
CCPR2L
184*
CCPR3L
184*
CCPR4L
184*
CCPR5L
184*
CCPR6L
184*
CCPR7L
184*
CCPR8L
184*
CCPR9L
184*
CCPR10L
184*
CCPR1H
184*
CCPR2H
184*
CCPR3H
184*
CCPR4H
184*
CCPR5H
184*
CCPR6H
184*
CCPR7H
184*
CCPR8H
184*
CCPR9H
184*
CCPR10H
INTCON
184*
GIE
PEIE
TMR0IE
INTE
IOCIE
TMR0IF
INTF
IOCIF
80
PIE1
TMR1GIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
81
PIE2
OSFIE
TMR5GIE
TMR3GIE
BCL1IE
TMR10IE
TMR8IE
CCP2IE
82
PIE3
CCP6IE
CCP5IE
CCP4IE
CCP3IE
TMR6IE
TMR5IE
TMR4IE
TMR3IE
83
PIE4
CCP10IE
CCP9IE
RC2IE
TX2IE
CCP8IE
CCP7IE
BCL2IE
SSP2IE
84
PIR1
TMR1GIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
85
PIR2
OSFIF
TMR5GIF
TMR3GIF
BCL1IF
TMR10IF
TMR8IF
CCP2IF
86
PIR3
CCP6IF
CCP5IF
CCP4IF
CCP3IF
TMR6IF
TMR5IF
TMR4IF
TMR3IF
87
PIR4
CCP10IF
CCP9IF
RC2IF
TX2IF
CCP8IF
CCP7IF
BCL2IF
SSP2IF
88
T1CON
TMR1CS<1:0>
T1CKPS<1:0>
SOSCEN
T1SYNC
TMR1ON
176
T3CON
TMR3CS<1:0>
T3CKPS<1:0>
SOSCEN
T3SYNC
TMR3ON
176
T5CON
TMR5CS<1:0>
T5CKPS<1:0>
SOSCEN
T5SYNC
TMR5ON
176
T1GCON
TMR1GE
T1GPOL
T1GTM
T1GSPM
T1GGO/DONE
T1GVAL
T1GSS<1:0>
177
T3GCON
TMR3GE
T3GPOL
T3GTM
T3GSPM
T3GGO/DONE
T3GVAL
T3GSS<1:0>
177
Legend:
= Unimplemented location, read as 0. Shaded cells are not used by Compare mode.
* Page provides register information.
DS41458A-page 190
Preliminary
PIC16(L)F1526/27
TABLE 20-5:
Name
T5GCON
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
TMR5GE
T5GPOL
T5GTM
T5GSPM
T5GGO/DONE
T5GVAL
Bit 1
Bit 0
T5GSS<1:0>
Register on
Page
177
TMR1L
Holding Register for the Least Significant Byte of the 16-bit TMR1 Register
172*
TMR3L
Holding Register for the Least Significant Byte of the 16-bit TMR3 Register
172*
TMR6L
Holding Register for the Least Significant Byte of the 16-bit TMR6 Register
172*
TMR1H
Holding Register for the Most Significant Byte of the 16-bit TMR1 Register
172*
TMR3H
Holding Register for the Most Significant Byte of the 16-bit TMR3 Register
172*
TMR6H
Holding Register for the Most Significant Byte of the 16-bit TMR6 Register
TRISA
Legend:
TRISA7
TRISA6
TRISA5
TRISA4
TRISA3
172*
TRISA2
TRISA1
TRISA0
120
= Unimplemented location, read as 0. Shaded cells are not used by Compare mode.
* Page provides register information.
Preliminary
DS41458A-page 191
PIC16(L)F1526/27
20.3
FIGURE 20-3:
PWM Overview
Period
Pulse Width
TMRx = 0
FIGURE 20-4:
CCPRxH(2) (Slave)
CCPx
TMRx
Comparator
Note 1:
DS41458A-page 192
(1)
2:
Clear Timer,
toggle CCPx pin and
latch duty cycle
TABLE 20-6:
TRIS
PRx
Comparator
PRx registers
TxCON registers
CCPRxL registers
CCPxCON registers
CCPxCON<5:4>
CCPRxL
TMRx = PRx
TMRx = CCPRxH:CCPxCON<5:4>
20.3.1
CCP
TMR2
TMR4
TMR6
CCP1
CCP2
CCP3
CCP4
CCP5
CCP6
CCP7
CCP8
CCP9
CCP10
Preliminary
TMR8
TMR10
PIC16(L)F1526/27
20.3.2
20.3.4
4.
5.
6.
20.3.3
PWM PERIOD
EQUATION 20-1:
PWM PERIOD
TOSC = 1/FOSC
Preliminary
DS41458A-page 193
PIC16(L)F1526/27
20.3.5
EQUATION 20-2:
20.3.6
PWM RESOLUTION
PWM RESOLUTION
log 4 PRx + 1
Resolution = ------------------------------------------ bits
log 2
Note:
PWM Frequency
TABLE 20-8:
EQUATION 20-4:
CCPRxL:CCPxCON<5:4>
Duty Cycle Ratio = ----------------------------------------------------------------------4 PRx + 1
TABLE 20-7:
PULSE WIDTH
EQUATION 20-3:
1.22 kHz
4.88 kHz
19.53 kHz
78.12 kHz
156.3 kHz
208.3 kHz
16
0xFF
0xFF
0xFF
0x3F
0x1F
0x17
10
10
10
6.6
PWM Frequency
DS41458A-page 194
1.22 kHz
4.90 kHz
19.61 kHz
76.92 kHz
153.85 kHz
200.0 kHz
16
0x65
0x65
0x65
0x19
0x0C
0x09
Preliminary
PIC16(L)F1526/27
20.3.7
20.3.9
20.3.8
TABLE 20-9:
EFFECTS OF RESET
Any Reset will force all ports to Input mode and the
CCP registers to their Reset states.
20.3.10
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Register
on Page
APFCON
T3CKISEL
CCP2SEL
118
CCP1CON
DC1B<1:0>
CCP1M<3:0>
197
CCP2CON
DC2B<1:0>
CCP2M<3:0>
197
CCP3CON
DC3B<1:0>
CCP3M<3:0>
197
CCP4CON
DC4B<1:0>
CCP4M<3:0>
197
CCP5CON
DC5B<1:0>
CCP5M<3:0>
197
CCP6CON
DC6B<1:0>
CCP6M<3:0>
197
CCP7CON
DC7B<1:0>
CCP7M<3:0>
197
CCP8CON
DC8B<1:0>
CCP8M<3:0>
197
CCP9CON
DC9B<1:0>
CCP9M<3:0>
197
CCP10CON
DC10B<1:0>
CCP10M<3:0>
197
Name
GIE
PEIE
TMR0IE
INTE
IOCIE
TMR0IF
INTF
IOCIF
80
PIE1
TMR1GIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
81
PIE2
OSFIE
TMR5GIE
TMR3GIE
BCL1IE
TMR10IE
TMR8IE
CCP2IE
82
PIE3
CCP6IE
CCP5IE
CCP4IE
CCP3IE
TMR6IE
TMR5IE
TMR4IE
TMR3IE
83
PIE4
CCP10IE
CCP9IE
RC2IE
TX2IE
CCP8IE
CCP7IE
BCL2IE
SSP2IE
84
PIR1
TMR1GIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
85
PIR2
OSFIF
TMR5GIF
TMR3GIF
BCL1IF
TMR10IF
TMR8IF
CCP2IF
86
PIR3
CCP6IF
CCP5IF
CCP4IF
CCP3IF
TMR6IF
TMR5IF
TMR4IF
TMR3IF
87
PIR4
CCP10IF
CCP9IF
RC2IF
TX2IF
CCP8IF
CCP7IF
BCL2IF
SSP2IF
88
INTCON
PR2
179*
PR4
179*
PR6
179*
PR8
179*
PR10
179*
T2CON
T2OUTPS<3:0>
TMR2ON
T2CKPS<:0>1
176
T4CON
T4OUTPS<3:0>
TMR4ON
T4CKPS<:0>1
176
T6CON
T6OUTPS<3:0>
TMR6ON
T6CKPS<:0>1
176
Legend: = Unimplemented location, read as 0. Shaded cells are not used by the PWM.
* Page provides register information.
Preliminary
DS41458A-page 195
PIC16(L)F1526/27
TABLE 20-10: SUMMARY OF REGISTERS ASSOCIATED WITH STANDARD PWM (CONTINUED)
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
T8CON
T8OUTPS<3:0>
TMR8ON
T8CKPS<:0>1
T10CON
T10OUTPS<3:0>
TMR10ON
T10CKPS<:0>1
Register
on Page
176
176
TMR2
179*
TMR4
179*
TMR6
179*
TMR8
179*
TMR10
TRISA
TRISA7
TRISA6
179*
TRISA5
TRISA4
TRISA3
TRISA2
TRISA1
TRISA0
120
Legend: = Unimplemented location, read as 0. Shaded cells are not used by the PWM.
* Page provides register information.
DS41458A-page 196
Preliminary
PIC16(L)F1526/27
20.4
REGISTER 20-1:
U-0
U-0
R/W-0/0
R/W-0/0
R/W-0/0
DCxB<1:0>
R/W-0/0
R/W-0/0
R/W-0/0
CCPxM<3:0>
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-6
bit 5-4
Unimplemented: Read as 0
DCxB<1:0>: PWM Duty Cycle Least Significant bits
Capture mode:
Unused
Compare mode:
Unused
PWM mode:
These bits are the two LSbs of the PWM duty cycle. The eight MSbs are found in CCPRxL.
bit 3-0
0000 =
0001 =
0010 =
0011 =
0100 =
0101 =
0110 =
0111 =
1000 =
1001 =
1010 =
1011 =
Preliminary
DS41458A-page 197
PIC16(L)F1526/27
REGISTER 20-2:
R/W-0/0
R/W-0/0
C4TSEL<1:0>
R/W-0/0
R/W-0/0
R/W-0/0
C3TSEL<1:0>
R/W-0/0
R/W-0/0
C2TSEL<1:0>
R/W-0/0
C1TSEL<1:0>
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-6
bit 5-4
bit 3-2
bit 1-0
DS41458A-page 198
Preliminary
PIC16(L)F1526/27
REGISTER 20-3:
R/W-0/0
R/W-0/0
C8TSEL<1:0>
R/W-0/0
R/W-0/0
R/W-0/0
C7TSEL<1:0>
R/W-0/0
R/W-0/0
C6TSEL<1:0>
bit 7
R/W-0/0
C5TSEL<1:0>
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-6
bit 5-4
bit 3-2
bit 1-0
Preliminary
DS41458A-page 199
PIC16(L)F1526/27
REGISTER 20-4:
U-0
U-0
U-0
U-0
R/W-0/0
R/W-0/0
R/W-0/0
C10TSEL<1:0>
R/W-0/0
C9TSEL<1:0>
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-4
Unimplemented: Read as 0
bit 3-2
bit 1-0
DS41458A-page 200
Preliminary
PIC16(L)F1526/27
21.0
MASTER SYNCHRONOUS
SERIAL PORT (MSSP1 AND
MSSP2) MODULE
21.1
Master mode
Slave mode
Clock Parity
Slave Select Synchronization (Slave mode only)
Daisy-chain connection of slave devices
FIGURE 21-1:
Write
SSPxBUF Reg
SDIx
SSPxSR Reg
SDOx
bit 0
SSx
SSx Control
Enable
Shift
Clock
2 (CKP, CKE)
Clock Select
Edge
Select
SSPxM<3:0>
4
SCKx
Edge
Select
TRIS bit
Preliminary
( TMR22Output )
Prescaler TOSC
4, 16, 64
Baud Rate
Generator
(SSPxADD)
DS41458A-page 201
PIC16(L)F1526/27
The I2C interface supports the following modes and
features:
Master mode
Slave mode
Byte NACKing (Slave mode)
Limited Multi-master support
7-bit and 10-bit addressing
Start and Stop interrupts
Interrupt masking
Clock stretching
Bus collision detection
General call address matching
Address masking
Address Hold and Data Hold modes
Selectable SDAx hold times
[SSPxM 3:0]
Write
SSPxBUF
SDAx
Baud rate
generator
(SSPxADD)
Shift
Clock
SDAx in
SCLx
SCLx in
Bus Collision
DS41458A-page 202
LSb
Preliminary
Clock Cntl
SSPxSR
MSb
FIGURE 21-2:
PIC16(L)F1526/27
FIGURE 21-3:
Write
SSPxBUF Reg
SCLx
Shift
Clock
SSPxSR Reg
SDAx
MSb
LSb
SSPxMSK Reg
Match Detect
Addr Match
SSPxADD Reg
Start and
Stop bit Detect
Preliminary
Set, Reset
S, P bits
(SSPxSTAT Reg)
DS41458A-page 203
PIC16(L)F1526/27
21.2
DS41458A-page 204
Preliminary
PIC16(L)F1526/27
FIGURE 21-4:
SPI Master
SCKx
SCKx
SDOx
SDIx
General I/O
General I/O
SDIx
General I/O
SCKx
SDOx
SPI Slave
#1
SSx
SDIx
SDOx
SPI Slave
#2
SSx
SCKx
SDIx
SDOx
SPI Slave
#3
SSx
21.2.1
Preliminary
DS41458A-page 205
PIC16(L)F1526/27
21.2.2
FIGURE 21-5:
SDIx
Shift Register
(SSPxSR)
MSb
LSb
SCKx
General I/O
Processor 1
DS41458A-page 206
SDOx
Serial Clock
Slave Select
(optional)
Preliminary
Shift Register
(SSPxSR)
MSb
LSb
SCKx
SSx
Processor 2
PIC16(L)F1526/27
21.2.3
FIGURE 21-6:
Write to
SSPxBUF
SCKx
(CKP = 0
CKE = 0)
SCKx
(CKP = 1
CKE = 0)
4 Clock
Modes
SCKx
(CKP = 0
CKE = 1)
SCKx
(CKP = 1
CKE = 1)
SDOx
(CKE = 0)
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
SDOx
(CKE = 1)
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
SDIx
(SMP = 0)
bit 0
bit 7
Input
Sample
(SMP = 0)
SDIx
(SMP = 1)
bit 0
bit 7
Input
Sample
(SMP = 1)
SSPxIF
SSPxSR to
SSPxBUF
Preliminary
DS41458A-page 207
PIC16(L)F1526/27
21.2.4
21.2.5
Daisy-Chain Configuration
SLAVE SELECT
SYNCHRONIZATION
The Slave Select can also be used to synchronize communication. The Slave Select line is held high until the
master device is ready to communicate. When the
Slave Select line is pulled low, the slave knows that a
new transmission is starting.
If the slave fails to receive the communication properly,
it will be reset at the end of the transmission, when the
Slave Select line returns to a high state. The slave is
then ready to receive a new transmission when the
Slave Select line is pulled low again. If the Slave Select
line is not used, there is a risk that the slave will eventually become out of sync with the master. If the slave
misses a bit, it will always be one bit off in future transmissions. Use of the Slave Select line allows the slave
and master to align themselves at the beginning of
each transmission.
The SSx pin allows a Synchronous Slave mode. The
SPI must be in Slave mode with SSx pin control
enabled (SSPxCON1<3:0> = 0100).
When the SSx pin is low, transmission and reception
are enabled and the SDOx pin is driven.
When the SSx pin goes high, the SDOx pin is no longer
driven, even if in the middle of a transmitted byte and
becomes a floating output. External pull-up/pull-down
resistors may be desirable depending on the application.
Note 1: When the SPI is in Slave mode with SSx
pin control enabled (SSPxCON1<3:0> =
0100), the SPI module will reset if the SSx
pin is set to VDD.
2: When the SPI is used in Slave mode with
CKE set; the user must enable SSx pin
control.
3: While operated in SPI Slave mode the
SMP bit of the SSPxSTAT register must
remain clear.
DS41458A-page 208
Preliminary
PIC16(L)F1526/27
FIGURE 21-7:
SPI Master
SCK
SCK
SDOx
SDIx
General I/O
SDIx
SDOx
SPI Slave
#1
SSx
SCK
SDIx
SDOx
SPI Slave
#2
SSx
SCK
SDIx
SDOx
SPI Slave
#3
SSx
FIGURE 21-8:
SSx
SCKx
(CKP = 0
CKE = 0)
SCKx
(CKP = 1
CKE = 0)
Write to
SSPxBUF
SSPxBUF to
SSPxSR
SDOx
bit 7
bit 6
bit 7
SDIx
bit 6
bit 0
bit 0
bit 7
bit 7
Input
Sample
SSPxIF
Interrupt
Flag
SSPxSR to
SSPxBUF
Preliminary
DS41458A-page 209
PIC16(L)F1526/27
FIGURE 21-9:
SSx
Optional
SCKx
(CKP = 0
CKE = 0)
SCKx
(CKP = 1
CKE = 0)
Write to
SSPxBUF
Valid
SDOx
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
SDIx
bit 0
bit 7
Input
Sample
SSPxIF
Interrupt
Flag
SSPxSR to
SSPxBUF
Write Collision
detection active
FIGURE 21-10:
SSx
Not Optional
SCKx
(CKP = 0
CKE = 1)
SCKx
(CKP = 1
CKE = 1)
Write to
SSPxBUF
Valid
SDOx
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
SDIx
bit 0
bit 7
Input
Sample
SSPxIF
Interrupt
Flag
SSPxSR to
SSPxBUF
Write Collision
detection active
DS41458A-page 210
Preliminary
PIC16(L)F1526/27
21.2.6
TABLE 21-1:
Name
ANSELF
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Register
on Page
ANSF7
ANSF6
ANSF5
ANSF4
ANSF3
ANSF2
ANSF1
ANSF0
136
80
GIE
PEIE
TMR0IE
INTE
IOCIE
TMR0IF
INTF
IOCIF
PIE1
TMR1GIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
81
PIE4
CCP10IE
CCP9IE
RC2IE
TX2IE
CCP8IE
CCP7IE
BCL2IE
SSP2IE
84
PIR1
TMR1GIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
85
PIR4
CCP10IF
CCP9IF
RC2IF
TX2IF
CCP8IF
CCP7IF
BCL2IF
SSP2IF
88
INTCON
SSP1BUF
SSP2BUF
205*
205*
SSP1CON1
WCOL
SSPOV
SSPEN
CKP
SSPM<3:0>
SSP2CON1
WCOL
SSPOV
SSPEN
CKP
SSPM<3:0>
SSP1CON3
ACKTIM
PCIE
SCIE
BOEN
SDAHT
SBCDE
AHEN
DHEN
253
SSP2CON3
ACKTIM
PCIE
SCIE
BOEN
SDAHT
SBCDE
AHEN
DHEN
253
SSP1STAT
SMP
CKE
D/A
R/W
UA
BF
249
SSP2STAT
251
251
SMP
CKE
D/A
R/W
UA
BF
249
TRISC
TRISC7
TRISC6
TRISC5
TRISC4
TRISC3
TRISC2
TRISC1
TRISC0
126
TRISD
TRISD7
TRISD6
TRISD5
TRISD4
TRISD3
TRISD2
TRISD1
TRISD0
129
TRISF
TRISF7
TRISF6
TRISF5
TRISF4
TRISF3
TRISF2
TRISF1
TRISF0
135
Legend:
*
= Unimplemented location, read as 0. Shaded cells are not used by the MSSPx in SPI mode.
Page provides register information.
Preliminary
DS41458A-page 211
PIC16(L)F1526/27
21.3
FIGURE 21-11:
VDD
SCLx
SDAx
DS41458A-page 212
Slave
SDAx
SCLx
VDD
Master
I2C MASTER/
SLAVE CONNECTION
Preliminary
PIC16(L)F1526/27
When one device is transmitting a logical one, or letting
the line float, and a second device is transmitting a logical zero, or holding the line low, the first device can
detect that the line is not a logical one. This detection,
when used on the SCLx line, is called clock stretching.
Clock stretching gives slave devices a mechanism to
control the flow of data. When this detection is used on
the SDAx line, it is called arbitration. Arbitration
ensures that there is only one master device communicating at any single time.
21.3.1
CLOCK STRETCHING
21.3.2
ARBITRATION
Each master device must monitor the bus for Start and
Stop bits. If the device detects that the bus is busy, it
cannot begin a new message until the bus returns to an
Idle state.
However, two master devices may try to initiate a transmission on or about the same time. When this occurs,
the process of arbitration begins. Each transmitter
checks the level of the SDAx data line and compares it
to the level that it expects to find. The first transmitter to
observe that the two levels do not match, loses arbitration, and must stop transmitting on the SDAx line.
For example, if one transmitter holds the SDAx line to
a logical one (lets it float) and a second transmitter
holds it to a logical zero (pulls it low), the result is that
the SDAx line will be low. The first transmitter then
observes that the level of the line is different than
expected and concludes that another transmitter is
communicating.
The first transmitter to notice this difference is the one
that loses arbitration and must stop driving the SDAx
line. If this transmitter is also a master device, it also
must stop driving the SCLx line. It then can monitor the
lines for a Stop condition before trying to reissue its
transmission. In the meantime, the other device that
has not noticed any difference between the expected
and actual levels on the SDAx line continues with its
original transmission. It can do so without any complications, because so far, the transmission appears
exactly as expected with no other transmitter disturbing
the message.
Slave Transmit mode can also be arbitrated, when a
master addresses multiple slaves, but this is less common.
If two master devices are sending a message to two different slave devices at the address stage, the master
sending the lower slave address always wins arbitration. When two master devices send messages to the
same slave address, and addresses can sometimes
refer to multiple slaves, the arbitration process must
continue into the data stage.
Arbitration usually occurs very rarely, but it is a necessary process for proper multi-master support.
Preliminary
DS41458A-page 213
PIC16(L)F1526/27
21.4
TABLE 21-2:
BYTE FORMAT
21.4.4
DS41458A-page 214
TERM
Transmitter
Preliminary
PIC16(L)F1526/27
21.4.5
START CONDITION
21.4.7
RESTART CONDITION
STOP CONDITION
21.4.8
FIGURE 21-12:
SDAx
SCLx
S
Start
P
Change of
Change of
Data Allowed
Data Allowed
Condition
FIGURE 21-13:
Stop
Condition
Sr
Change of
Change of
Data Allowed
Restart
Data Allowed
Condition
Preliminary
DS41458A-page 215
PIC16(L)F1526/27
21.4.9
ACKNOWLEDGE SEQUENCE
21.5
DS41458A-page 216
Preliminary
PIC16(L)F1526/27
21.5.2
SLAVE RECEPTION
21.5.2.2
Preliminary
DS41458A-page 217
DS41458A-page 218
Preliminary
SSPxOV
BF
SSPxIF
A7
A6
A5
A4
A3
A2
A1
ACK
D7
D6
D4
D3
D2
D1
SSPxBUF is read
Cleared by software
D5
Receiving Data
D6
First byte
of data is
available
in SSPxBUF
D0 ACK D7
D4
D3
D2
D1
D0
Cleared by software
D5
Receiving Data
ACK = 1
FIGURE 21-14:
SCLx
SDAx
Receiving Address
PIC16(L)F1526/27
I2C SLAVE, 7-BIT ADDRESS, RECEPTION (SEN = 0, AHEN = 0, DHEN = 0)
Preliminary
CKP
SSPxOV
BF
SSPxIF
SCLx
A7
A6
A5
A4
A3
A2
A1
R/W=0 ACK
SEN
2
D6
D5
D4
D3
D2
D1
D0
SSPxBUF is read
Cleared by software
D7
Receive Data
ACK
SEN
3
D5
D4
D3
First byte
of data is
available
in SSPxBUF
D2
D1
Cleared by software
D6
D7
Receive Data
D0
ACK
FIGURE 21-15:
SDAx
Receive Address
PIC16(L)F1526/27
DS41458A-page 219
DS41458A-page 220
Preliminary
ACKTIM
CKP
ACKDT
BF
SSPxIF
Receiving Address
Slave software
clears ACKDT to
Address is
read from
SSBUF
If AHEN = 1:
SSPxIF is set
When AHEN=1:
CKP is cleared by hardware
and SCLx is stretched
A7 A6 A5 A4 A3 A2 A1
Receiving Data
9
2
ACKTIM cleared by
hardware in 9th
rising edge of SCLx
When DHEN=1:
CKP is cleared by
hardware on 8th falling
edge of SCLx
SSPxIF is set on
9th falling edge of
SCLx, after ACK
ACK D7 D6 D5 D4 D3 D2 D1 D0
Received Data
Slave software
sets ACKDT to
not ACK
Cleared by software
D7 D6 D5 D4 D3 D2 D1 D0
ACK
No interrupt
after not ACK
from Slave
ACK=1
Master sends
Stop condition
FIGURE 21-16:
SCLx
SDAx
PIC16(L)F1526/27
I2C SLAVE, 7-BIT ADDRESS, RECEPTION (SEN = 0, AHEN = 1, DHEN = 1)
Preliminary
ACKTIM
CKP
ACKDT
BF
SSPxIF
Receiving Address
4
5
6 7
When AHEN = 1;
on the 8th falling edge
of SCLx of an address
byte, CKP is cleared
Received
address is loaded into
SSPxBUF
2 3
A7 A6 A5 A4 A3 A2 A1
ACK
Receive Data
2 3
6 7
When DHEN = 1;
on the 8th falling edge
of SCLx of a received
data byte, CKP is cleared
Received data is
available on SSPxBUF
Cleared by software
D7 D6 D5 D4 D3 D2 D1 D0
ACK
Receive Data
1
3 4
6 7
Set by software,
release SCLx
Slave sends
not ACK
SSPxBUF can be
read any time before
next byte is loaded
D7 D6 D5 D4 D3 D2 D1 D0
ACK
No interrupt after
if not ACK
from Slave
Master sends
Stop condition
FIGURE 21-17:
SCLx
SDAx
R/W = 0
Master releases
SDAx to slave for ACK sequence
PIC16(L)F1526/27
DS41458A-page 221
PIC16(L)F1526/27
21.5.3
SLAVE TRANSMISSION
21.5.3.2
7-bit Transmission
1.
21.5.3.1
DS41458A-page 222
Preliminary
Preliminary
D/A
R/W
ACKSTAT
CKP
BF
SSPxIF
Receiving Address
Indicates an address
has been received
R/W = 1 Automatic
ACK
Received address
is read from SSPxBUF
A7 A6 A5 A4 A3 A2 A1
Transmitting Data
Automatic
Set by software
Data to transmit is
loaded into SSPxBUF
Cleared by software
D7 D6 D5 D4 D3 D2 D1 D0 ACK
Transmitting Data
CKP is not
held for not
ACK
BF is automatically
cleared after 8th falling
edge of SCLx
D7 D6 D5 D4 D3 D2 D1 D0
9
ACK
FIGURE 21-18:
SCLx
SDAx
Master sends
Stop condition
PIC16(L)F1526/27
DS41458A-page 223
PIC16(L)F1526/27
21.5.3.3
DS41458A-page 224
Preliminary
Preliminary
D/A
R/W
ACKTIM
CKP
ACKSTAT
ACKDT
BF
SSPxIF
Receiving Address
Slave clears
ACKDT to ACK
address
ACK
When R/W = 1;
CKP is always
cleared after ACK
R/W = 1
Received address
is read from SSPxBUF
When AHEN = 1;
CKP is cleared by hardware
after receiving matching
address.
A7 A6 A5 A4 A3 A2 A1
3
Cleared by software
Set by software,
releases SCLx
Data to transmit is
loaded into SSPxBUF
Transmitting Data
Automatic
D7 D6 D5 D4 D3 D2 D1 D0 ACK
ACKTIM is cleared
on 9th rising edge of SCLx
Automatic
Transmitting Data
Masters ACK
response is copied
to SSPxSTAT
BF is automatically
cleared after 8th falling
edge of SCLx
D7 D6 D5 D4 D3 D2 D1 D0
9
ACK
Master sends
Stop condition
FIGURE 21-19:
SCLx
SDAx
PIC16(L)F1526/27
DS41458A-page 225
PIC16(L)F1526/27
21.5.4
21.5.5
3.
4.
5.
6.
7.
8.
9.
DS41458A-page 226
Preliminary
Preliminary
CKP
UA
BF
SSPxIF
0 A9 A8
Set by hardware
on 9th falling edge
When UA = 1;
SCLx is held low
ACK
If address matches
SSPxADD it is loaded into
SSPxBUF
A7 A6 A5 A4 A3 A2 A1 A0 ACK
9
1
Data is read
from SSPxBUF
D7 D6 D5 D4 D3 D2 D1 D0 ACK
Receive Data
Set by software,
When SEN = 1;
releasing SCLx
CKP is cleared after
9th falling edge of received byte
Receive address is
read from SSPxBUF
Cleared by software
D7 D6 D5 D4 D3 D2 D1 D0 ACK
Receive Data
FIGURE 21-20:
SCLx
SDAx
Master sends
Stop condition
PIC16(L)F1526/27
DS41458A-page 227
DS41458A-page 228
Preliminary
ACKTIM
CKP
UA
ACKDT
BF
A9
A8
Set by hardware
on 9th falling edge
If when AHEN = 1;
on the 8th falling edge
of SCLx of an address
byte, CKP is cleared
R/W = 0
ACK
UA
A6
A5
A4
A3
A2
A1
Update to SSPxADD is
not allowed until 9th
falling edge of SCLx
SSPxBUF can be
read anytime before
the next received byte
Cleared by software
A7
A0
ACK
UA
D6
D5
D4
D2
D1
Update of SSPxADD,
clears UA and releases
SCLx
D3
Receive Data
Cleared by software
D7
Received data
is read from
SSPxBUF
D6 D5
Receive Data
D0 ACK D7
FIGURE 21-21:
SSPxIF
SCLx
SDAx
PIC16(L)F1526/27
I2C SLAVE, 10-BIT ADDRESS, RECEPTION (SEN = 0, AHEN = 1, DHEN = 0)
Preliminary
D/A
R/W
ACKSTAT
CKP
UA
BF
SSPxIF
Set by hardware
Indicates an address
has been received
UA indicates SSPxADD
must be updated
SSPxBUF loaded
with received address
SCLx
1
3
7 8
After SSPxADD is
updated, UA is cleared
and SCLx is released
Cleared by software
A7 A6 A5 A4 A3 A2 A1 A0 ACK
1
4
7 8
Set by hardware
2 3
When R/W = 1;
CKP is cleared on
9th falling edge of SCLx
Received address is
read from SSPxBUF
Sr
1 1 1 1 0 A9 A8
ACK
Set by software
releases SCLx
Data to transmit is
loaded into SSPxBUF
D7 D6 D5 D4 D3 D2 D1 D0
Master sends
Stop condition
ACK = 1
Master sends
not ACK
FIGURE 21-22:
SDAx
Master sends
Restart event
PIC16(L)F1526/27
DS41458A-page 229
PIC16(L)F1526/27
21.5.6
CLOCK STRETCHING
21.5.6.2
FIGURE 21-23:
21.5.6.3
Byte NACKing
Any time the CKP bit is cleared, the module will wait
for the SCLx line to go low and then hold it. However,
clearing the CKP bit will not assert the SCLx output
low until the SCLx output is already sampled low.
Therefore, the CKP bit will not assert the SCLx line
until an external I2C master device has already
asserted the SCLx line. The SCLx output will remain
low until the CKP bit is set and all other devices on the
I2C bus have released SCLx. This ensures that a write
to the CKP bit will not violate the minimum high time
requirement for SCLx (see Figure 21-22).
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
SDAx
DX 1
DX
SCLx
CKP
Master device
asserts clock
Master device
releases clock
WR
SSPxCON1
DS41458A-page 230
Preliminary
PIC16(L)F1526/27
21.5.8
FIGURE 21-24:
SDAx
SCLx
S
Receiving Data
ACK
D6
D5
D4
D3
D2
D1
D0
SSPxIF
BF (SSPxSTAT<0>)
Cleared by software
SSPxBUF is read
GCEN (SSPxCON2<7>)
21.5.9
Preliminary
DS41458A-page 231
PIC16(L)F1526/27
21.6
21.6.1
In Master Receive mode, the first byte transmitted contains the slave address of the transmitting device
(7 bits) and the R/W bit. In this case, the R/W bit will be
logic 1. Thus, the first byte transmitted is a 7-bit slave
address followed by a 1 to indicate the receive bit.
Serial data is received via SDAx, while SCLx outputs
the serial clock. Serial data is received 8 bits at a time.
After each byte is received, an Acknowledge bit is
transmitted. Start and Stop conditions indicate the
beginning and end of transmission.
A Baud Rate Generator is used to set the clock frequency output on SCLx. See Section 21.7 Baud
Rate Generator for more detail.
2: When in Master mode, Start/Stop detection is masked and an interrupt is generated when the SEN/PEN bit is cleared and
the generation is complete.
DS41458A-page 232
Preliminary
PIC16(L)F1526/27
21.6.2
CLOCK ARBITRATION
FIGURE 21-25:
SDAx
DX 1
DX
SCLx deasserted but slave holds
SCLx low (clock arbitration)
SCLx
BRG decrements on
Q2 and Q4 cycles
BRG
Value
03h
02h
01h
03h
02h
21.6.3
Preliminary
DS41458A-page 233
PIC16(L)F1526/27
21.6.4
CONDITION TIMING
FIGURE 21-26:
SDAx = 1,
SCLx = 1
TBRG
TBRG
SDAx
1st bit
2nd bit
TBRG
SCLx
S
DS41458A-page 234
Preliminary
TBRG
PIC16(L)F1526/27
21.6.5
FIGURE 21-27:
Write to SSPxCON2
occurs here
SDAx = 1,
SCLx (no change)
SDAx = 1,
SCLx = 1
TBRG
TBRG
TBRG
1st bit
SDAx
Sr
TBRG
Repeated Start
Preliminary
DS41458A-page 235
PIC16(L)F1526/27
21.6.6
21.6.6.3
21.6.6.1
7.
8.
9.
10.
11.
12.
13.
BF Status Flag
21.6.6.2
DS41458A-page 236
Preliminary
Preliminary
R/W
PEN
SEN
BF (SSPxSTAT<0>)
SSPxIF
SCLx
SDAx
A6
A5
A4
A3
A2
A1
Cleared by software
SSPxBUF written
D7
1
SCLx held low
while CPU
responds to SSPxIF
ACK = 0
R/W = 0
A7
D5
D4
D3
D2
D1
D0
D6
ACKSTAT in
SSPxCON2 = 1
Cleared by software
ACK
FIGURE 21-28:
SEN = 0
PIC16(L)F1526/27
DS41458A-page 237
PIC16(L)F1526/27
21.6.7
21.6.7.4
21.6.7.1
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
BF Status Flag
11.
21.6.7.2
12.
13.
14.
21.6.7.3
15.
DS41458A-page 238
Preliminary
Preliminary
RCEN
ACKEN
SSPxOV
BF
(SSPxSTAT<0>)
SDAx = 0, SCLx = 1
while CPU
responds to SSPxIF
SSPxIF
SCLx
SDAx
A7
4
5
Cleared by software
A6 A5 A4 A3 A2
7
8
ACK
D0
ACK
RCEN cleared
automatically
5
6
Cleared by software
Cleared in
software
ACK
RCEN cleared
automatically
P
Set SSPxIF interrupt
at end of Acknowledge sequence
Bus master
terminates
transfer
Set P bit
(SSPxSTAT<4>)
and SSPxIF
PEN bit = 1
written here
D0
RCEN cleared
automatically
D7 D6 D5 D4 D3 D2 D1
Cleared by software
Cleared by software
D7 D6 D5 D4 D3 D2 D1
A1 R/W
RCEN = 1, start
next receive
FIGURE 21-29:
RCEN cleared
automatically
SEN = 0
Write to SSPxBUF occurs here,
ACK from Slave
start XMIT
Write to SSPxCON2<4>
to start Acknowledge sequence
SDAx = ACKDT (SSPxCON2<5>) = 0
PIC16(L)F1526/27
DS41458A-page 239
PIC16(L)F1526/27
21.6.8
ACKNOWLEDGE SEQUENCE
TIMING
21.6.9
21.6.8.1
21.6.9.1
FIGURE 21-30:
TBRG
SDAx
SCLx
ACK
D0
8
SSPxIF
SSPxIF set at
the end of receive
Cleared in
software
Cleared in
software
SSPxIF set at the end
of Acknowledge sequence
DS41458A-page 240
Preliminary
PIC16(L)F1526/27
FIGURE 21-31:
Write to SSPxCON2,
set PEN
Falling edge of
9th clock
TBRG
SCLx
SDAx
ACK
P
TBRG
TBRG
TBRG
21.6.10
SLEEP OPERATION
21.6.13
21.6.11
EFFECTS OF A RESET
21.6.12
MULTI-MASTER MODE
Address Transfer
Data Transfer
A Start Condition
A Repeated Start Condition
An Acknowledge Condition
Multi-Master mode support is achieved by bus arbitration. When the master outputs address/data bits onto
the SDAx pin, arbitration takes place when the master
outputs a 1 on SDAx, by letting SDAx float high and
another master asserts a 0. When the SCLx pin floats
high, data should be stable. If the expected data on
SDAx is a 1 and the data sampled on the SDAx pin is
0, then a bus collision has taken place. The master will
set the Bus Collision Interrupt Flag, BCLxIF and reset
the I2C port to its Idle state (Figure 21-31).
If a transmit was in progress when the bus collision
occurred, the transmission is halted, the BF flag is
cleared, the SDAx and SCLx lines are deasserted and
the SSPxBUF can be written to. When the user services the bus collision Interrupt Service Routine and if
the I2C bus is free, the user can resume communication by asserting a Start condition.
If a Start, Repeated Start, Stop or Acknowledge condition was in progress when the bus collision occurred, the
condition is aborted, the SDAx and SCLx lines are deasserted and the respective control bits in the SSPxCON2
register are cleared. When the user services the bus collision Interrupt Service Routine and if the I2C bus is free,
the user can resume communication by asserting a Start
condition.
The master will continue to monitor the SDAx and SCLx
pins. If a Stop condition occurs, the SSPxIF bit will be set.
A write to the SSPxBUF will start the transmission of
data at the first data bit, regardless of where the
transmitter left off when the bus collision occurred.
In Multi-Master mode, the interrupt generation on the
detection of Start and Stop conditions allows the determination of when the bus is free. Control of the I2C bus
can be taken when the P bit is set in the SSPxSTAT
register, or the bus is Idle and the S and P bits are
cleared.
Preliminary
DS41458A-page 241
PIC16(L)F1526/27
FIGURE 21-32:
SDAx
SCLx
BCLxIF
DS41458A-page 242
Preliminary
PIC16(L)F1526/27
21.6.13.1
FIGURE 21-33:
The reason that bus collision is not a factor during a Start condition is that no two
bus masters can assert a Start condition
at the exact same time. Therefore, one
master will always assert SDAx before the
other. This condition does not cause a bus
collision because the two masters must be
allowed to arbitrate the first address following the Start condition. If the address is
the same, arbitration must be allowed to
continue into the data portion, Repeated
Start or Stop conditions.
SDAx
SCLx
Set SEN, enable Start
condition if SDAx = 1, SCLx = 1
SEN
BCLxIF
SSPxIF
SSPxIF and BCLxIF are
cleared by software
Preliminary
DS41458A-page 243
PIC16(L)F1526/27
FIGURE 21-34:
TBRG
SDAx
Set SEN, enable Start
sequence if SDAx = 1, SCLx = 1
SCLx
SEN
SCLx = 0 before BRG time-out,
bus collision occurs. Set BCLxIF.
BCLxIF
Interrupt cleared
by software
S
SSPxIF
FIGURE 21-35:
SDAx
SCLx
TBRG
SEN
BCLxIF
Set SSPxIF
SSPxIF
SDAx = 0, SCLx = 1,
set SSPxIF
DS41458A-page 244
Preliminary
Interrupts cleared
by software
PIC16(L)F1526/27
21.6.13.2
FIGURE 21-36:
If, at the end of the BRG time-out, both SCLx and SDAx
are still high, the SDAx pin is driven low and the BRG
is reloaded and begins counting. At the end of the
count, regardless of the status of the SCLx pin, the
SCLx pin is driven low and the Repeated Start
condition is complete.
SDAx
SCLx
Sample SDAx when SCLx goes high.
If SDAx = 0, set BCLxIF and release SDAx and SCLx.
RSEN
BCLxIF
Cleared by software
S
SSPxIF
FIGURE 21-37:
TBRG
SDAx
SCLx
BCLxIF
RSEN
S
SSPxIF
Preliminary
DS41458A-page 245
PIC16(L)F1526/27
21.6.13.3
b)
FIGURE 21-38:
TBRG
SDAx sampled
low after TBRG,
set BCLxIF
TBRG
SDAx
SDAx asserted low
SCLx
PEN
BCLxIF
P
SSPxIF
FIGURE 21-39:
TBRG
TBRG
SDAx
SCLx goes low before SDAx goes high,
set BCLxIF
Assert SDAx
SCLx
PEN
BCLxIF
P
SSPxIF
DS41458A-page 246
Preliminary
PIC16(L)F1526/27
TABLE 21-3:
Name
INTCON
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values on
Page:
80
GIE
PEIE
TMR0IE
INTE
IOCIE
TMR0IF
INTF
IOCIF
PIE1
TMR1GIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
81
PIE2
OSFIE
TMR5GIE
TMR3GIE
BCL1IE
TMR10IE
TMR8IE
CCP2IE
82
PIE4
CCP10IE
CCP9IE
RC2IE
TX2IE
CCP8IE
CCP7IE
BCL2IE
SSP2IE
84
PIR1
TMR1GIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
85
PIR2
OSFIF
TMR5GIF
TMR3GIF
BCL1IF
TMR10IF
TMR8IF
CCP2IF
86
PIR4
CCP10IF
CCP9IF
RC2IF
TX2IF
CCP8IF
CCP7IF
BCL2IF
SSP2IF
88
SSP1ADD
ADD<7:0>
SSP2ADD
254
ADD<7:0>
SSP1BUF
SSP2BUF
SSPEN
254
205*
205*
SSP1CON1
WCOL
CKP
SSPM<3:0>
SSP2CON1
WCOL
SSPOV
SSPEN
CKP
SSP1CON2
GCEN
ACKSTAT
ACKDT
ACKEN
SSP2CON2
GCEN
ACKSTAT
ACKDT
ACKEN
SSP1CON3
ACKTIM
PCIE
SCIE
BOEN
SSP2CON3
ACKTIM
PCIE
SCIE
BOEN
SDAHT
251
SSPM<3:0>
RCEN
251
PEN
RSEN
SEN
252
RCEN
PEN
SDAHT
SBCDE
RSEN
SEN
252
AHEN
DHEN
253
SBCDE
AHEN
DHEN
253
SSP1MSK
MSK<7:0>
254
SSP2MSK
MSK<7:0>
254
SSP1STAT
SMP
CKE
D/A
R/W
UA
BF
249
SSP2STAT
SMP
CKE
D/A
R/W
UA
BF
249
TRISC
TRISC7
TRISC6
TRISC5
TRISC4
TRISC3
TRISC2
TRISC1
TRISC0
126
TRISD
TRISD7
TRISD6
TRISD5
TRISD4
TRISD3
TRISD2
TRISD1
TRISD0
129
Legend:
*
Note 1:
= unimplemented location, read as 0. Shaded cells are not used by the MSSP module in I2C mode.
Page provides register information.
PIC16(L)F1527 only.
Preliminary
DS41458A-page 247
PIC16(L)F1526/27
21.7
The MSSPx module has a Baud Rate Generator available for clock generation in both I2C and SPI Master
modes. The Baud Rate Generator (BRG) reload value
is placed in the SSPxADD register (Register 21-6).
When a write occurs to SSPxBUF, the Baud Rate Generator will automatically begin counting down.
Once the given operation is complete, the internal clock
will automatically stop counting and the clock pin will
remain in its last state.
EQUATION 21-1:
FOSC
FCLOCK = ------------------------------------------------ SSPxADD + 1 4
FIGURE 21-40:
SSPxM<3:0>
Reload
SSPxADD<7:0>
Reload
Control
SCLx
SSPxCLK
FOSC/2
TABLE 21-4:
Note 1:
FOSC
FCY
BRG Value
FCLOCK
(2 Rollovers of BRG)
16 MHz
4 MHz
09h
400 kHz(1)
16 MHz
4 MHz
0Ch
308 kHz
16 MHz
4 MHz
27h
100 kHz
4 MHz
1 MHz
09h
100 kHz
The I2C interface does not conform to the 400 kHz I2C specification (which applies to rates greater than
100 kHz) in all details, but may be used with care where higher rates are required by the application.
DS41458A-page 248
Preliminary
PIC16(L)F1526/27
21.8
REGISTER 21-1:
R/W-0/0
R/W-0/0
R-0/0
R-0/0
R-0/0
R-0/0
R-0/0
R-0/0
SMP
CKE
D/A
R/W
UA
BF
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7
bit 4
(I2C mode only. This bit is cleared when the MSSPx module is disabled, SSPxEN is cleared.)
1 = Indicates that a Stop bit has been detected last (this bit is 0 on Reset)
0 = Stop bit was not detected last
bit 3
S: Start bit
(I2C mode only. This bit is cleared when the MSSPx module is disabled, SSPxEN is cleared.)
1 = Indicates that a Start bit has been detected last (this bit is 0 on Reset)
0 = Start bit was not detected last
bit 2
In I2 C Master mode:
1 = Transmit is in progress
0 = Transmit is not in progress
OR-ing this bit with SEN, RSEN, PEN, RCEN or ACKEN will indicate if the MSSPx is in Idle mode.
bit 1
Preliminary
DS41458A-page 249
PIC16(L)F1526/27
REGISTER 21-1:
bit 0
DS41458A-page 250
Preliminary
PIC16(L)F1526/27
REGISTER 21-2:
R/C/HS-0/0
R/C/HS-0/0
R/W-0/0
R/W-0/0
WCOL
SSPxOV
SSPxEN
CKP
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
SSPxM<3:0>
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
C = User cleared
bit 7
bit 6
bit 5
bit 4
bit 3-0
Note
1:
2:
3:
4:
5:
In Master mode, the overflow bit is not set since each new reception (and transmission) is initiated by writing to the SSPxBUF register.
When enabled, these pins must be properly configured as input or output.
When enabled, the SDAx and SCLx pins must be configured as inputs.
SSPxADD values of 0, 1 or 2 are not supported for I2C mode.
SSPxADD value of 0 is not supported. Use SSPxM = 0000 instead.
Preliminary
DS41458A-page 251
PIC16(L)F1526/27
REGISTER 21-3:
R/W-0/0
R-0/0
R/W-0/0
R/S/HS-0/0
R/S/HS-0/0
R/S/HS-0/0
R/S/HS-0/0
R/W/HS-0/0
GCEN
ACKSTAT
ACKDT
ACKEN
RCEN
PEN
RSEN
SEN
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
HC = Cleared by hardware
S = User set
bit 7
GCEN: General Call Enable bit (in I2C Slave mode only)
1 = Enable interrupt when a general call address (0x00 or 00h) is received in the SSPxSR
0 = General call address disabled
bit 6
bit 5
bit 4
ACKEN: Acknowledge Sequence Enable bit (in I2C Master mode only)
In Master Receive mode:
1 = Initiate Acknowledge sequence on SDAx and SCLx pins, and transmit ACKDT data bit.
Automatically cleared by hardware.
0 = Acknowledge sequence Idle
bit 3
bit 2
PEN: Stop Condition Enable bit (in I2C Master mode only)
SCKx Release Control:
1 = Initiate Stop condition on SDAx and SCLx pins. Automatically cleared by hardware.
0 = Stop condition Idle
bit 1
RSEN: Repeated Start Condition Enabled bit (in I2C Master mode only)
1 = Initiate Repeated Start condition on SDAx and SCLx pins. Automatically cleared by hardware.
0 = Repeated Start condition Idle
bit 0
SEN: Start Condition Enabled bit (in I2C Master mode only)
In Master mode:
1 = Initiate Start condition on SDAx and SCLx pins. Automatically cleared by hardware.
0 = Start condition Idle
In Slave mode:
1 = Clock stretching is enabled for both slave transmit and slave receive (stretch enabled)
0 = Clock stretching is disabled
Note 1:
For bits ACKEN, RCEN, PEN, RSEN, SEN: If the I2C module is not in the Idle mode, this bit may not be
set (no spooling) and the SSPxBUF may not be written (or writes to the SSPxBUF are disabled).
DS41458A-page 252
Preliminary
PIC16(L)F1526/27
REGISTER 21-4:
R-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
ACKTIM
PCIE
SCIE
BOEN
SDAHT
SBCDE
AHEN
DHEN
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
SBCDE: Slave Mode Bus Collision Detect Enable bit (I2C Slave mode only)
If on the rising edge of SCLx, SDAx is sampled low when the module is outputting a high state, the
BCLxIF bit of the PIR2 register is set, and bus goes Idle
1 = Enable slave bus collision interrupts
0 = Slave bus collision interrupts are disabled
bit 1
bit 0
Note 1:
2:
3:
For daisy-chained SPI operation; allows the user to ignore all but the last received byte. SSPxOV is still set
when a new byte is received and BF = 1, but hardware continues to write the most recent byte to SSPxBUF.
This bit has no effect in Slave modes that Start and Stop condition detection is explicitly listed as enabled.
The ACKTIM Status bit is only active when the AHEN bit or DHEN bit is set.
Preliminary
DS41458A-page 253
PIC16(L)F1526/27
REGISTER 21-5:
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
R/W-1/1
MSK<7:0>
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7-1
bit 0
REGISTER 21-6:
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
R/W-0/0
ADD<7:0>
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
Master mode:
bit 7-0
bit 7-3
Not used: Unused for Most Significant Address byte. Bit state of this register is a dont care. Bit pattern sent by master is fixed by I2C specification and must be equal to 11110. However, those bits are
compared by hardware and are not affected by the value in this register.
bit 2-1
bit 0
bit 7-0
bit 7-1
bit 0
DS41458A-page 254
Preliminary
PIC16(L)F1526/27
22.0
Note:
ENHANCED UNIVERSAL
SYNCHRONOUS
ASYNCHRONOUS RECEIVER
TRANSMITTER (EUSART)
FIGURE 22-1:
TXxIE
Interrupt
TXxIF
TXxREG Register
8
MSb
LSb
(8)
TXx/CKx pin
Pin Buffer
and Control
TXEN
TRMT
FOSC
n
TX9
BRG16
+1
SPxBRGH SPxBRGL
Multiplier
x4
x16 x64
SYNC
1 X 0 0
BRGH
X 1 1 0
BRG16
X 1 0 1
TX9D
Preliminary
DS41458A-page 255
PIC16(L)F1526/27
FIGURE 22-2:
RXx/DTx pin
Data
Recovery
FOSC
SPxBRGH SPxBRGL
x4
x16 x64
SYNC
1 X 0 0
BRGH
X 1 1 0
BRG16
X 1 0 1
(8)
LSb
0 START
RX9
BRG16
Multiplier
Stop
RCIDL
RSR Register
MSb
Pin Buffer
and Control
+1
OERR
FERR
RX9D
RCxREG Register
8
FIFO
Data Bus
RCxIF
RCxIE
Interrupt
DS41458A-page 256
Preliminary
PIC16(L)F1526/27
22.1
22.1.1.2
Transmitting Data
22.1.1.3
22.1.1
22.1.1.4
EUSART ASYNCHRONOUS
TRANSMITTER
22.1.1.1
Preliminary
DS41458A-page 257
PIC16(L)F1526/27
22.1.1.5
TSR Status
22.1.1.7
22.1.1.6
1.
2.
3.
4.
5.
8.
FIGURE 22-3:
Write to TXxREG
BRG Output
(Shift Clock)
TXx/CKx pin
TXxIF bit
(Transmit Buffer
Reg. Empty Flag)
TRMT bit
(Transmit Shift
Reg. Empty Flag)
DS41458A-page 258
6.
7.
9.
ASYNCHRONOUS TRANSMISSION
Word 1
Start bit
bit 0
bit 1
bit 7/8
Stop bit
Word 1
1 TCY
Word 1
Transmit Shift Reg
Preliminary
PIC16(L)F1526/27
FIGURE 22-4:
Write to TXxREG
Word 1
BRG Output
(Shift Clock)
TXx/CKx pin
Word 2
Start bit
bit 0
bit 1
Word 1
1 TCY
TXxIF bit
(Interrupt Reg. Flag)
bit 7/8
Stop bit
Start bit
Word 2
bit 0
1 TCY
TRMT bit
(Transmit Shift
Reg. Empty Flag)
Word 1
Transmit Shift Reg
Word 2
Transmit Shift Reg
Note:
TABLE 22-1:
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Register
on page
BAUD1CON
ABDOVF
RCIDL
SCKP
BRG16
WUE
ABDEN
266
BAUD2CON
ABDOVF
RCIDL
SCKP
BRG16
WUE
ABDEN
266
GIE
PEIE
TMR0IE
INTE
IOCIE
TMR0IF
INTF
IOCIF
93
94
INTCON
PIE1
TMR1GIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
PIE4
CCP10IE
CCP9IE
RC2IE
TX2IE
CCP8IE
CCP7IE
BCL2IE
SSP2IE
97
PIR1
TMR1GIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
98
PIR4
CCP10IF
CCP9IF
RC2IF
TX2IF
CCP8IF
CCP7IF
BCL2IF
SSP2IF
97
RC1STA
SPEN
RX9
SREN
CREN
ADDEN
FERR
OERR
RX9D
265
RC2STA
SPEN
RX9
SREN
CREN
ADDEN
FERR
OERR
RX9D
265
SP1BRGL
267*
SP1BRGH
267*
SP2BRGL
267*
SP2BRGH
267*
257*
TX1REG
TX1STA
CSRC
TX9
TXEN
TX2REG
TX2STA
Legend:
*
SYNC
SENDB
BRGH
TRMT
TX9D
TX9
TXEN
SYNC
SENDB
264
257*
BRGH
TRMT
TX9D
264
= unimplemented locations, read as 0. Shaded bits are not used for asynchronous transmission.
Page provides register information.
Preliminary
DS41458A-page 259
PIC16(L)F1526/27
22.1.2
EUSART ASYNCHRONOUS
RECEIVER
22.1.2.2
22.1.2.1
DS41458A-page 260
Receiving Data
22.1.2.3
Preliminary
PIC16(L)F1526/27
22.1.2.4
Receive Interrupts
22.1.2.7
22.1.2.5
22.1.2.8
Address Detection
22.1.2.6
Preliminary
DS41458A-page 261
PIC16(L)F1526/27
22.1.2.9
1.
22.1.2.10
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
DS41458A-page 262
Preliminary
PIC16(L)F1526/27
FIGURE 22-5:
ASYNCHRONOUS RECEPTION
Start
bit
bit 0
RXx/DTx pin
bit 1
Rcv Shift
Reg
Rcv Buffer Reg
Start
bit
bit 0
Word 2
RCxREG
Word 1
RCxREG
RCIDL
Start
bit
Read Rcv
Buffer Reg
RCxREG
RCxIF
(Interrupt Flag)
OERR bit
CREN
This timing diagram shows three words appearing on the RXx/DTx input. The RCxREG (receive buffer) is read after the third
word, causing the OERR (overrun) bit to be set.
Note:
TABLE 22-2:
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Register
on Page
BAUD1CON
ABDOVF
RCIDL
SCKP
BRG16
WUE
ABDEN
266
BAUD2CON
ABDOVF
RCIDL
SCKP
BRG16
WUE
ABDEN
266
GIE
PEIE
TMR0IE
INTE
IOCIE
TMR0IF
INTF
IOCIF
93
TMR1GIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
94
PIE4
CCP10IE
CCP9IE
RC2IE
TX2IE
CCP8IE
CCP7IE
BCL2IE
SSP2IE
97
PIR1
TMR1GIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
98
PIR4
CCP10IF
CCP9IF
RC2IF
TX2IF
CCP8IF
CCP7IF
BCL2IF
SSP2IF
97
SPEN
RX9
SREN
FERR
OERR
RX9D
SPEN
RX9
SREN
FERR
OERR
RX9D
INTCON
PIE1
RC1REG
RC1STA
RC2REG
RC2STA
CREN
ADDEN
260*
ADDEN
265
260*
265
SP1BRGL
SP1BRGH
267*
SP2BRGL
267*
SP2BRGH
267*
TRISC
TX1STA
TX2STA
Legend:
*
267*
TRISC7
TRISC6
TRISC5
TRISC4
TRISC3
TRISC2
TRISC1
TRISC0
134
CSRC
TX9
TXEN
SYNC
SENDB
BRGH
TRMT
TX9D
264
CSRC
TX9
TXEN
SYNC
SENDB
BRGH
TRMT
TX9D
264
= unimplemented locations, read as 0. Shaded bits are not used for asynchronous reception.
Page provides register information.
Preliminary
DS41458A-page 263
PIC16(L)F1526/27
22.2
22.3
REGISTER 22-1:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R-1
R/W-0
CSRC
TX9
TXEN(1)
SYNC
SENDB
BRGH
TRMT
TX9D
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
Note 1:
DS41458A-page 264
Preliminary
PIC16(L)F1526/27
REGISTER 22-2:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R-0
R-0
R-x
SPEN
RX9
SREN
CREN
ADDEN
FERR
OERR
RX9D
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
Preliminary
DS41458A-page 265
PIC16(L)F1526/27
REGISTER 22-3:
R-0/0
R-1/1
U-0
R/W-0/0
R/W-0/0
U-0
R/W-0/0
R/W-0/0
ABDOVF
RCIDL
SCKP
BRG16
WUE
ABDEN
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
u = Bit is unchanged
x = Bit is unknown
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
Unimplemented: Read as 0
bit 4
bit 3
bit 2
Unimplemented: Read as 0
bit 1
bit 0
DS41458A-page 266
Preliminary
PIC16(L)F1526/27
22.4
EXAMPLE 22-1:
Example 22-1 provides a sample calculation for determining the desired baud rate, actual baud rate, and
baud rate % error.
Typical baud rates and error values for various
Asynchronous modes have been computed for your
convenience and are shown in Table 22-5. It may be
advantageous to use the high baud rate (BRGH = 1),
or the 16-bit BRG (BRG16 = 1) to reduce the baud rate
error. The 16-bit BRG mode is used to achieve slow
baud rates for fast oscillator frequencies.
Writing a new value to the SPxBRGH, SPxBRGL
register pair causes the BRG timer to be reset (or
cleared). This ensures that the BRG does not wait for a
timer overflow before outputting the new baud rate.
TABLE 22-3:
CALCULATING BAUD
RATE ERROR
16000000
-----------------------9600
= ------------------------ 1
64
= 25.042 = 25
16000000
64 25 + 1
Configuration Bits
BRG/EUSART Mode
8-bit/Asynchronous
FOSC/[64 (n+1)]
8-bit/Asynchronous
16-bit/Asynchronous
16-bit/Asynchronous
8-bit/Synchronous
16-bit/Synchronous
SYNC
BRG16
BRGH
1
Legend:
FOSC/[16 (n+1)]
FOSC/[4 (n+1)]
Preliminary
DS41458A-page 267
PIC16(L)F1526/27
TABLE 22-4:
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values on
page
BAUD1CON
ABDOVF
RCIDL
SCKP
BRG16
WUE
ABDEN
266
BAUD2CON
ABDOVF
RCIDL
SCKP
BRG16
WUE
ABDEN
266
RC1STA
SPEN
RX9
SREN
CREN
ADDEN
FERR
OERR
RX9D
265
RC2STA
SPEN
RX9
SREN
CREN
ADDEN
FERR
OERR
RX9D
265
SP1BRGL
267*
SP1BRGH
267*
SP2BRGL
267*
SP2BRGH
267*
TX1STA
CSRC
TX9
TXEN
SYNC
SENDB
BRGH
TRMT
TX9D
264
TX2STA
CSRC
TX9
TXEN
SYNC
SENDB
BRGH
TRMT
TX9D
264
Legend:
*
DS41458A-page 268
Preliminary
PIC16(L)F1526/27
TABLE 22-5:
BAUD
RATE
%
Error
SPBRG
value
(decimal)
%
Error
SPBRG
value
(decimal)
%
Error
SPBRG
value
(decimal)
%
Error
SPBRG
value
(decimal)
300
1200
1221
1.73
255
1200
0.00
239
1202
0.16
207
1200
0.00
143
2400
2404
0.16
129
2400
0.00
119
2404
0.16
103
2400
0.00
71
9600
9470
-1.36
32
9600
0.00
29
9615
0.16
25
9600
0.00
17
10417
10417
0.00
29
10286
-1.26
27
10417
0.00
23
10165
-2.42
16
19.2k
19.53k
1.73
15
19.20k
0.00
14
19.23k
0.16
12
19.20k
0.00
57.6k
57.60k
0.00
57.60k
0.00
115.2k
%
Error
SPBRG
value
(decimal)
%
Error
SPBRG
value
(decimal)
%
Error
SPBRG
value
(decimal)
%
Error
SPBRG
value
(decimal)
300
300
0.16
207
300
0.00
191
300
0.16
51
1200
1202
0.16
103
1202
0.16
51
1200
0.00
47
1202
0.16
12
2400
2404
0.16
51
2404
0.16
25
2400
0.00
23
9600
9615
0.16
12
9600
0.00
10417
10417
0.00
11
10417
0.00
19.2k
19.20k
0.00
57.6k
57.60k
0.00
115.2k
%
Error
SPBRG
value
(decimal)
%
Error
SPBRG
value
(decimal)
%
Error
SPBRG
value
(decimal)
%
Error
SPBRG
value
(decimal)
300
1200
2400
9600
9615
0.16
129
9600
0.00
119
9615
0.16
103
9600
0.00
71
10417
10417
0.00
119
10378
-0.37
110
10417
0.00
95
10473
0.53
65
19.2k
19.23k
0.16
64
19.20k
0.00
59
19.23k
0.16
51
19.20k
0.00
35
57.6k
56.82k
-1.36
21
57.60k
0.00
19
58.82k
2.12
16
57.60k
0.00
11
115.2k
113.64k
-1.36
10
115.2k
0.00
111.1k
-3.55
115.2k
0.00
Preliminary
DS41458A-page 269
PIC16(L)F1526/27
TABLE 22-5:
BAUD
RATE
%
Error
SPBRG
value
(decimal)
%
Error
SPBRG
value
(decimal)
%
Error
SPBRG
value
(decimal)
Actual
Rate
%
Error
SPBRG
value
(decimal)
300
1200
1202
0.16
207
1200
0.00
191
300
1202
0.16
0.16
207
51
2400
2404
0.16
207
2404
0.16
103
2400
0.00
95
2404
0.16
25
9600
9615
0.16
51
9615
0.16
25
9600
0.00
23
10417
10417
0.00
47
10417
0.00
23
10473
0.53
21
10417
0.00
19.2k
19231
0.16
25
19.23k
0.16
12
19.2k
0.00
11
57.6k
55556
-3.55
57.60k
0.00
115.2k
115.2k
0.00
%
Error
SPBRG
value
(decimal)
Actual
Rate
%
Error
SPBRG
value
(decimal)
Actual
Rate
%
Error
SPBRG
value
(decimal)
Actual
Rate
%
Error
SPBRG
value
(decimal)
300
300.0
-0.01
4166
300.0
0.00
3839
300.03
0.01
3332
300.0
0.00
2303
1200
1200
-0.03
1041
1200
0.00
959
1200.5
0.04
832
1200
0.00
575
2400
2399
-0.03
520
2400
0.00
479
2398
-0.08
416
2400
0.00
287
9600
9615
0.16
129
9600
0.00
119
9615
0.16
103
9600
0.00
71
10417
10417
0.00
119
10378
-0.37
110
10417
0.00
95
10473
0.53
65
19.2k
19.23k
0.16
64
19.20k
0.00
59
19.23k
0.16
51
19.20k
0.00
35
57.6k
56.818
-1.36
21
57.60k
0.00
19
58.82k
2.12
16
57.60k
0.00
11
115.2k
113.636
-1.36
10
115.2k
0.00
111.11k
-3.55
115.2k
0.00
%
Error
SPBRG
value
(decimal)
Actual
Rate
%
Error
SPBRG
value
(decimal)
Actual
Rate
%
Error
SPBRG
value
(decimal)
Actual
Rate
%
Error
SPBRG
value
(decimal)
300
299.9
-0.02
1666
300.1
0.04
832
300.0
0.00
767
300.5
0.16
207
1200
1199
-0.08
416
1202
0.16
207
1200
0.00
191
1202
0.16
51
2400
2404
0.16
207
2404
0.16
103
2400
0.00
95
2404
0.16
25
9600
9615
0.16
51
9615
0.16
25
9600
0.00
23
10417
10417
0.00
47
10417
0.00
23
10473
0.53
21
10417
0.00
19.2k
19.23k
0.16
25
19.23k
0.16
12
19.20k
0.00
11
57.6k
55556
-3.55
57.60k
0.00
115.2k
115.2k
0.00
DS41458A-page 270
Preliminary
PIC16(L)F1526/27
TABLE 22-5:
BAUD
RATE
Actual
Rate
%
Error
SPBRG
value
(decimal)
300
1200
300.0
1200
0.00
-0.01
16665
4166
300.0
1200
0.00
0.00
15359
3839
300.0
1200.1
0.00
0.01
13332
3332
300.0
1200
0.00
0.00
9215
2303
2400
2400
0.02
2082
2400
0.00
1919
2399.5
-0.02
1666
2400
0.00
1151
9600
9597
-0.03
520
9600
0.00
479
9592
-0.08
416
9600
0.00
287
10417
10417
0.00
479
10425
0.08
441
10417
0.00
383
10433
0.16
264
Actual
Rate
%
Error
SPBRG
value
(decimal)
Actual
Rate
%
Error
SPBRG
value
(decimal)
Actual
Rate
%
Error
SPBRG
value
(decimal)
19.2k
19.23k
0.16
259
19.20k
0.00
239
19.23k
0.16
207
19.20k
0.00
143
57.6k
57.47k
-0.22
86
57.60k
0.00
79
57.97k
0.64
68
57.60k
0.00
47
115.2k
116.3k
0.94
42
115.2k
0.00
39
114.29k
-0.79
34
115.2k
0.00
23
%
Error
SPBRG
value
(decimal)
Actual
Rate
%
Error
SPBRG
value
(decimal)
Actual
Rate
%
Error
SPBRG
value
(decimal)
Actual
Rate
%
Error
SPBRG
value
(decimal)
300
300.0
0.00
6666
300.0
0.01
3332
300.0
0.00
3071
300.1
0.04
832
1200
1200
-0.02
1666
1200
0.04
832
1200
0.00
767
1202
0.16
207
2400
2401
0.04
832
2398
0.08
416
2400
0.00
383
2404
0.16
103
9600
9615
0.16
207
9615
0.16
103
9600
0.00
95
9615
0.16
25
10417
10417
191
10417
0.00
95
10473
0.53
87
10417
0.00
23
19.2k
19.23k
0.16
103
19.23k
0.16
51
19.20k
0.00
47
19.23k
0.16
12
57.6k
57.14k
-0.79
34
58.82k
2.12
16
57.60k
0.00
15
115.2k
117.6k
2.12
16
111.1k
-3.55
115.2k
0.00
Preliminary
DS41458A-page 271
PIC16(L)F1526/27
22.4.1
AUTO-BAUD DETECT
FIGURE 22-6:
TABLE 22-6:
BRG16
BRGH
BRG Base
Clock
BRG ABD
Clock
FOSC/64
FOSC/512
FOSC/16
FOSC/128
FOSC/16
FOSC/128
FOSC/4
FOSC/32
Note:
BRG Value
1/8th the BRG base clock rate. The resulting byte measurement is the average bit time when clocked at full
speed.
RXx/DTx pin
0000h
001Ch
Start
Edge #1
bit 1
bit 0
Edge #2
bit 3
bit 2
Edge #3
bit 5
bit 4
Edge #4
bit 7
bit 6
Edge #5
Stop bit
BRG Clock
Auto Cleared
Set by User
ABDEN bit
RCIDL
RCxIF bit
(Interrupt)
Read
RCxREG
SPxBRGL
XXh
1Ch
SPxBRGH
XXh
00h
Note 1:
The ABD sequence requires the EUSART module to be configured in Asynchronous mode.
DS41458A-page 272
Preliminary
PIC16(L)F1526/27
22.4.2
AUTO-BAUD OVERFLOW
22.4.3.1
22.4.3
AUTO-WAKE-UP ON BREAK
Special Considerations
Break Character
To avoid character errors or character fragments during
a wake-up event, the wake-up character must be all
zeros.
When the wake-up is enabled the function works
independent of the low time on the data stream. If the
WUE bit is set and a valid non-zero character is
received, the low time from the Start bit to the first rising
edge will be interpreted as the wake-up event. The
remaining bits in the character will be received as a
fragmented character and subsequent characters can
result in framing or overrun errors.
Therefore, the initial character in the transmission must
be all 0s. This must be 10 or more bit times, 13-bit
times recommended for LIN bus, or any number of bit
times for standard RS-232 devices.
Oscillator Startup Time
Oscillator start-up time must be considered, especially
in applications using oscillators with longer start-up
intervals (i.e., LP, XT or HS mode). The Sync Break (or
wake-up signal) character must be of sufficient length,
and be followed by a sufficient interval, to allow enough
time for the selected oscillator to start and provide
proper initialization of the EUSART.
WUE Bit
The wake-up event causes a receive interrupt by
setting the RCxIF bit. The WUE bit is cleared by
hardware by a rising edge on RXx/DTx. The interrupt
condition is then cleared by software by reading the
RCxREG register and discarding its contents.
To ensure that no actual data is lost, check the RCIDL
bit to verify that a receive operation is not in process
before setting the WUE bit. If a receive operation is not
occurring, the WUE bit may then be set just prior to
entering the Sleep mode.
Preliminary
DS41458A-page 273
PIC16(L)F1526/27
FIGURE 22-7:
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
OSC1
Auto Cleared
WUE bit
RXx/DTx Line
RCxIF
Note 1:
FIGURE 22-8:
Q1
Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1Q2 Q3 Q4
OSC1
Auto Cleared
Note 1
RCxIF
Sleep Command Executed
Note 1:
2:
Sleep Ends
If the wake-up event requires long oscillator warm-up time, the automatic clearing of the WUE bit can occur while the stposc signal is
still active. This sequence should not depend on the presence of Q clocks.
The EUSART remains in Idle while the WUE bit is set.
DS41458A-page 274
Preliminary
PIC16(L)F1526/27
22.4.4
22.4.4.1
FIGURE 22-9:
Write to TXxREG
22.4.5
BRG Output
(Shift Clock)
TXx/CKx (pin)
Start bit
bit 0
bit 1
bit 11
Stop bit
Break
TXxIF bit
(Transmit
interrupt Flag)
TRMT bit
(Transmit Shift
Reg. Empty Flag)
SENDB
(send Break
control bit)
Preliminary
Auto Cleared
DS41458A-page 275
PIC16(L)F1526/27
22.5
22.5.1.2
22.5.1
SYNC = 1
CSRC = 1
SREN = 0 (for transmit); SREN = 1 (for receive)
CREN = 0 (for transmit); CREN = 1 (for receive)
SPEN = 1
Clock Polarity
22.5.1.3
Note:
22.5.1.4
Data Polarity
22.5.1.1
Master Clock
DS41458A-page 276
Preliminary
PIC16(L)F1526/27
22.5.1.5
1.
2.
3.
4.
5.
6.
7.
FIGURE 22-10:
8.
9.
SYNCHRONOUS TRANSMISSION
RXx/DTx
pin
bit 0
bit 1
Word 1
bit 2
bit 7
bit 0
bit 1
Word 2
bit 7
TXx/CKx pin
(SCKP = 0)
TXx/CKx pin
(SCKP = 1)
Write to
TXxREG Reg
Write Word 1
Write Word 2
TXxIF bit
(Interrupt Flag)
TRMT bit
TXEN bit
Note:
1
Sync Master mode, SPxBRGL = 0, continuous transmission of two 8-bit words.
FIGURE 22-11:
RXx/DTx pin
bit 0
bit 1
bit 2
bit 6
bit 7
TXx/CKx pin
Write to
TXxREG reg
TXxIF bit
TRMT bit
TXEN bit
Preliminary
DS41458A-page 277
PIC16(L)F1526/27
TABLE 22-7:
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Register
on Page
BAUD1CON
ABDOVF
RCIDL
SCKP
BRG16
WUE
ABDEN
266
BAUD2CON
ABDOVF
RCIDL
SCKP
BRG16
WUE
ABDEN
266
GIE
PEIE
TMR0IE
INTE
IOCIE
TMR0IF
INTF
IOCIF
93
94
INTCON
PIE1
TMR1GIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
PIE4
CCP10IE
CCP9IE
RC2IE
TX2IE
CCP8IE
CCP7IE
BCL2IE
SSP2IE
97
PIR1
TMR1GIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
98
PIR4
CCP10IF
CCP9IF
RC2IF
TX2IF
CCP8IF
CCP7IF
BCL2IF
SSP2IF
97
RC1STA
SPEN
RX9
SREN
CREN
ADDEN
FERR
OERR
RX9D
265
RC2STA
SPEN
RX9
SREN
CREN
ADDEN
FERR
OERR
RX9D
265
SP1BRGL
267*
SP1BRGH
267*
SP2BRGL
267*
SP2BRGH
267*
TRISC
TRISC7
TRISC6
TRISC5
TRISC4
TRISC3
TRISC2
TRISC1
TRISC0
TRISG
TRISG4
TRISG3
TRISG2
TRISG1
TRISG0
TX1REG
TX1STA
TX9
TXEN
CSRC
TX9
TXEN
TX2REG
TX2STA
Legend:
*
SYNC
SENDB
SENDB
134
257*
BRGH
TRMT
TX9D
BRGH
TRMT
TX9D
134
264
257*
264
= unimplemented locations, read as 0. Shaded bits are not used for synchronous master transmission.
Page provides register information.
DS41458A-page 278
Preliminary
PIC16(L)F1526/27
22.5.1.6
22.5.1.7
Slave Clock
22.5.1.8
22.5.1.9
22.5.1.10
1.
Preliminary
DS41458A-page 279
PIC16(L)F1526/27
FIGURE 22-12:
RXx/DTx
pin
bit 0
bit 1
bit 2
bit 3
bit 4
bit 5
bit 6
bit 7
TXx/CKx pin
(SCKP = 0)
TXx/CKx pin
(SCKP = 1)
Write to
bit SREN
SREN bit
CREN bit 0
RCxIF bit
(Interrupt)
Read
RCxREG
Note:
Timing diagram demonstrates Sync Master mode with bit SREN = 1 and bit BRGH = 0.
TABLE 22-8:
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Register
on Page
BAUD1CON
ABDOVF
RCIDL
SCKP
BRG16
WUE
ABDEN
266
BAUD2CON
ABDOVF
RCIDL
SCKP
BRG16
WUE
ABDEN
266
GIE
PEIE
TMR0IE
INTE
IOCIE
TMR0IF
INTF
IOCIF
93
PIE1
TMR1GIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
94
PIE4
CCP10IE
CCP9IE
RC2IE
TX2IE
CCP8IE
CCP7IE
BCL2IE
SSP2IE
97
PIR1
TMR1GIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
98
PIR4
CCP10IF
CCP9IF
RC2IF
TX2IF
CCP8IF
CCP7IF
BCL2IF
SSP2IF
INTCON
RC1REG
RC1STA
RX9
SREN
RC2REG
RC2STA
CREN
ADDEN
FERR
OERR
RX9D
RX9
SREN
CREN
ADDEN
97
260*
265
260*
FERR
OERR
RX9D
265
SP1BRGL
267*
SP1BRGH
267*
SP2BRGL
267*
SP2BRGH
TX1STA
TX2STA
Legend:
*
267*
CSRC
TX9
TXEN
SYNC
SENDB
BRGH
TRMT
TX9D
264
CSRC
TX9
TXEN
SYNC
SENDB
BRGH
TRMT
TX9D
264
= unimplemented locations, read as 0. Shaded bits are not used for synchronous master reception.
Page provides register information.
DS41458A-page 280
Preliminary
PIC16(L)F1526/27
22.5.2
SYNC = 1
CSRC = 0
SREN = 0 (for transmit); SREN = 1 (for receive)
CREN = 0 (for transmit); CREN = 1 (for receive)
SPEN = 1
5.
22.5.2.2
1.
2.
22.5.2.1
3.
4.
5.
6.
7.
8.
Preliminary
DS41458A-page 281
PIC16(L)F1526/27
TABLE 22-9:
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Register
on Page
BAUD1CON
ABDOVF
RCIDL
SCKP
BRG16
WUE
ABDEN
266
BAUD2CON
ABDOVF
RCIDL
SCKP
BRG16
WUE
ABDEN
266
GIE
PEIE
TMR0IE
INTE
IOCIE
TMR0IF
INTF
IOCIF
93
94
INTCON
PIE1
TMR1GIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
PIE4
CCP10IE
CCP9IE
RC2IE
TX2IE
CCP8IE
CCP7IE
BCL2IE
SSP2IE
97
PIR1
TMR1GIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
98
PIR4
CCP10IF
CCP9IF
RC2IF
TX2IF
CCP8IF
CCP7IF
BCL2IF
SSP2IF
97
RC1STA
SPEN
RX9
SREN
CREN
ADDEN
FERR
OERR
RX9D
265
RC2STA
SPEN
RX9
SREN
CREN
ADDEN
FERR
OERR
RX9D
265
SP1BRGL
267*
SP1BRGH
267*
SP2BRGL
267*
SP2BRGH
TRISC
TRISC7
TRISC6
TRISC5
CSRC
TX9
TXEN
TX1REG
TX1STA
Legend:
*
TRISC3
TRISC2
267*
TRISC1
TRISC0
TRMT
TX9D
TX2REG
TX2STA
TRISC4
SYNC
SENDB
257*
BRGH
TX9
TXEN
SYNC
SENDB
134
264
257*
BRGH
TRMT
TX9D
264
= unimplemented locations, read as 0. Shaded bits are not used for synchronous slave transmission.
Page provides register information.
DS41458A-page 282
Preliminary
PIC16(L)F1526/27
22.5.2.3
22.5.2.4
1.
2.
3.
4.
5.
6.
7.
8.
9.
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Register
on Page
BAUD1CON
ABDOVF
RCIDL
SCKP
BRG16
WUE
ABDEN
266
BAUD2CON
ABDOVF
RCIDL
SCKP
BRG16
WUE
ABDEN
266
GIE
PEIE
TMR0IE
INTE
IOCIE
TMR0IF
INTF
IOCIF
93
TMR1GIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
94
PIE4
CCP10IE
CCP9IE
RC2IE
TX2IE
CCP8IE
CCP7IE
BCL2IE
SSP2IE
97
PIR1
TMR1GIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
98
PIR4
CCP10IF
CCP9IF
RC2IF
TX2IF
CCP8IF
CCP7IF
BCL2IF
SSP2IF
97
SPEN
RX9
SREN
FERR
OERR
RX9D
SPEN
RX9
SREN
FERR
OERR
RX9D
INTCON
PIE1
RC1REG
RC1STA
RC2REG
RC2STA
CREN
ADDEN
260*
ADDEN
265
260*
265
SP1BRGL
267*
SP1BRGH
267*
SP2BRGL
267*
SP2BRGH
267*
TX1STA
CSRC
TX9
TXEN
SYNC
SENDB
BRGH
TRMT
TX9D
264
TX2STA
CSRC
TX9
TXEN
SYNC
SENDB
BRGH
TRMT
TX9D
264
Legend:
*
= unimplemented locations, read as 0. Shaded bits are not used for synchronous slave reception.
Page provides register information.
Preliminary
DS41458A-page 283
PIC16(L)F1526/27
NOTES:
DS41458A-page 284
Preliminary
PIC16(L)F1526/27
23.0
IN-CIRCUIT SERIAL
PROGRAMMING (ICSP)
23.1
FIGURE 23-1:
1
VPP
2
VDD
3
VSS
4
ICSP_DATA
5
ICSP_CLOCK
6
NC
RJ11-6PIN
To MPLAB ICD 2
R1
To Target Board
270 Ohm
LM431BCMX
1
2 A
K
3 A U1
6 A
NC 4
7 A
NC 5
R2
VREF
8
10k 1%
Note:
R3
24k 1%
The MPLAB ICD 2 produces a VPP voltage greater than the maximum VPP specification of the PIC16(L)F1526/27.
Preliminary
DS41458A-page 285
PIC16(L)F1526/27
23.2
FIGURE 23-2:
VDD
ICSPDAT
NC
2 4 6
ICSPCLK
1 3 5
VPP/MCLR
VSS
Pin Description*
1 = VPP/MCLR
4 = ICSPDAT
2 = VDD Target
3 = VSS (ground)
5 = ICSPCLK
6 = No Connect
23.3
Target
PC Board
Bottom Side
FIGURE 23-3:
1 = VPP/MCLR
2 = VDD Target
3 = VSS (ground)
4 = ICSPDAT
5 = ICSPCLK
6 = No Connect
DS41458A-page 286
Preliminary
PIC16(L)F1526/27
For additional interface recommendations, refer to your
specific device programmer manual prior to PCB
design.
It is recommended that isolation devices be used to
separate the programming pins from other circuitry.
The type of isolation is highly dependent on the specific
application and may include devices such as resistors,
diodes, or even jumpers. See Figure 23-4 for more
information.
FIGURE 23-4:
Device to be
Programmed
VDD
VDD
VDD
VPP
MCLR/VPP
VSS
VSS
Data
ICSPDAT
Clock
ICSPCLK
To Normal Connections
Preliminary
DS41458A-page 287
PIC16(L)F1526/27
NOTES:
DS41458A-page 288
Preliminary
PIC16(L)F1526/27
24.0
24.1
Read-Modify-Write Operations
Byte Oriented
Bit Oriented
Literal and Control
The literal and control category contains the most varied instruction word format.
TABLE 24-1:
OPCODE FIELD
DESCRIPTIONS
Field
f
Description
mm
TABLE 24-2:
ABBREVIATION
DESCRIPTIONS
Field
PC
Program Counter
TO
Time-out bit
C
DC
Z
PD
Description
Preliminary
Carry bit
Digit carry bit
Zero bit
Power-down bit
DS41458A-page 289
PIC16(L)F1526/27
FIGURE 24-1:
d = 0 for destination W
d = 1 for destination f
f = 7-bit file register address
Bit-oriented file register operations
13
10 9
7 6
OPCODE
b (BIT #)
f (FILE #)
General
13
OPCODE
0
k (literal)
k (literal)
0
k (literal)
5 4
0
k (literal)
0
k (literal)
6
n
0
k (literal)
n = appropriate FSR
k = 6-bit immediate value
2 1
0
n m (mode)
n = appropriate FSR
m = 2-bit mode value
OPCODE only
13
0
OPCODE
DS41458A-page 290
Preliminary
PIC16(L)F1526/27
TABLE 24-3:
INSTRUCTION SET
14-Bit Opcode
Mnemonic,
Operands
Description
Cycles
MSb
LSb
Status
Affected
Notes
ADDWF
ADDWFC
ANDWF
ASRF
LSLF
LSRF
CLRF
CLRW
COMF
DECF
INCF
IORWF
MOVF
MOVWF
RLF
RRF
SUBWF
SUBWFB
SWAPF
XORWF
f, d
f, d
f, d
f, d
f, d
f, d
f
f, d
f, d
f, d
f, d
f, d
f
f, d
f, d
f, d
f, d
f, d
f, d
Add W and f
Add with Carry W and f
AND W with f
Arithmetic Right Shift
Logical Left Shift
Logical Right Shift
Clear f
Clear W
Complement f
Decrement f
Increment f
Inclusive OR W with f
Move f
Move W to f
Rotate Left f through Carry
Rotate Right f through Carry
Subtract W from f
Subtract with Borrow W from f
Swap nibbles in f
Exclusive OR W with f
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
00
11
00
11
11
11
00
00
00
00
00
00
00
00
00
00
00
11
00
00
0111
1101
0101
0111
0101
0110
0001
0001
1001
0011
1010
0100
1000
0000
1101
1100
0010
1011
1110
0110
dfff
dfff
dfff
dfff
dfff
dfff
lfff
0000
dfff
dfff
dfff
dfff
dfff
1fff
dfff
dfff
dfff
dfff
dfff
dfff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
00xx
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
C, DC, Z
C, DC, Z
Z
C, Z
C, Z
C, Z
Z
Z
Z
Z
Z
Z
Z
C
C
C, DC, Z
C, DC, Z
Z
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
DECFSZ
INCFSZ
f, d
f, d
Decrement f, Skip if 0
Increment f, Skip if 0
BCF
BSF
f, b
f, b
Bit Clear f
Bit Set f
1(2)
1(2)
00
00
1, 2
1, 2
1
1
01
01
2
2
1, 2
1, 2
BTFSC
BTFSS
f, b
f, b
1 (2)
1 (2)
01
01
1
1
1
1
1
1
1
1
11
11
11
00
11
11
11
11
1110
1001
1000
0000
0001
0000
1100
1010
LITERAL OPERATIONS
ADDLW
ANDLW
IORLW
MOVLB
MOVLP
MOVLW
SUBLW
XORLW
k
k
k
k
k
k
k
k
kkkk
kkkk
kkkk
001k
1kkk
kkkk
kkkk
kkkk
kkkk
kkkk
kkkk
kkkk
kkkk
kkkk
kkkk
kkkk
C, DC, Z
Z
Z
C, DC, Z
Z
Note 1: If the Program Counter (PC) is modified, or a conditional test is true, the instruction requires two cycles. The second cycle
is executed as a NOP.
2: If this instruction addresses an INDF register and the MSb of the corresponding FSR is set, this instruction will require one
additional instruction cycle.
Preliminary
DS41458A-page 291
PIC16(L)F1526/27
TABLE 24-3:
Mnemonic,
Operands
14-Bit Opcode
Description
Cycles
MSb
LSb
Status
Affected
Notes
CONTROL OPERATIONS
2
2
2
2
2
2
2
2
BRA
BRW
CALL
CALLW
GOTO
RETFIE
RETLW
RETURN
k
k
k
Relative Branch
Relative Branch with W
Call Subroutine
Call Subroutine with W
Go to address
Return from interrupt
Return with literal in W
Return from Subroutine
CLRWDT
NOP
OPTION
RESET
SLEEP
TRIS
ADDFSR
MOVIW
n, k
n mm
MOVWI
k[n]
n mm
11
00
10
00
10
00
11
00
001k
0000
0kkk
0000
1kkk
0000
0100
0000
kkkk
0000
kkkk
0000
kkkk
0000
kkkk
0000
kkkk
1011
kkkk
1010
kkkk
1001
kkkk
1000
00
00
00
00
00
00
0000
0000
0000
0000
0000
0000
0110
0000
0110
0000
0110
0110
0100 TO, PD
0000
0010
0001
0011 TO, PD
0fff
INHERENT OPERATIONS
1
1
1
1
1
1
C-COMPILER OPTIMIZED
k[n]
1
1
11
00
2, 3
1
1
11
00
2
2, 3
11
Note 1:If the Program Counter (PC) is modified, or a conditional test is true, the instruction requires two cycles. The second cycle is
executed as a NOP.
2: If this instruction addresses an INDF register and the MSb of the corresponding FSR is set, this instruction will require
one additional instruction cycle.
3: See Table in the MOVIW and MOVWI instruction descriptions.
DS41458A-page 292
Preliminary
PIC16(L)F1526/27
24.2
Instruction Descriptions
ADDFSR
ANDLW
Syntax:
Syntax:
[ label ] ANDLW
Operands:
-32 k 31
n [ 0, 1]
Operands:
0 k 255
Operation:
FSR(n) + k FSR(n)
Status Affected:
None
Description:
Operation:
Status Affected:
Description:
FSRn is limited to the range 0000h FFFFh. Moving beyond these bounds
will cause the FSR to wrap-around.
ADDLW
ANDWF
AND W with f
Syntax:
[ label ] ADDLW
Syntax:
[ label ] ANDWF
Operands:
0 f 127
d 0,1
Operation:
Status Affected:
Description:
ASRF
Operands:
0 k 255
Operation:
(W) + k (W)
Status Affected:
C, DC, Z
Description:
f,d
ADDWF
Add W and f
Syntax:
[ label ] ADDWF
Syntax:
[ label ] ASRF
Operands:
0 f 127
d 0,1
Operands:
0 f 127
d [0,1]
Operation:
Operation:
(f<7>) dest<7>
(f<7:1>) dest<6:0>,
(f<0>) C,
f,d
Status Affected:
C, DC, Z
Description:
ADDWFC
Syntax:
[ label ] ADDWFC
Operands:
0 f 127
d [0,1]
Status Affected:
C, Z
Description:
f {,d}
Operation:
Status Affected:
C, DC, Z
Description:
Add W, the Carry flag and data memory location f. If d is 0, the result is
placed in W. If d is 1, the result is
placed in data memory location f.
f {,d}
Preliminary
DS41458A-page 293
PIC16(L)F1526/27
BCF
Bit Clear f
Syntax:
[ label ] BCF
f,b
BTFSC
Syntax:
Operands:
0 f 127
0b7
Operands:
Operation:
0 (f<b>)
Operation:
skip if (f<b>) = 0
Status Affected:
None
Status Affected:
None
Description:
Description:
BRA
Relative Branch
BTFSS
Syntax:
Syntax:
Operands:
Operands:
0 f 127
0b<7
Operation:
skip if (f<b>) = 1
Operation:
(PC) + 1 + k PC
Status Affected:
None
Status Affected:
None
Description:
Description:
BRW
Syntax:
[ label ] BRW
Operands:
None
Operation:
(PC) + (W) PC
Status Affected:
None
Description:
BSF
Bit Set f
Syntax:
[ label ] BSF
Operands:
0 f 127
0b7
Operation:
1 (f<b>)
Status Affected:
None
Description:
DS41458A-page 294
f,b
Preliminary
PIC16(L)F1526/27
CALL
Call Subroutine
CLRWDT
Syntax:
[ label ] CALL k
Syntax:
[ label ] CLRWDT
Operands:
0 k 2047
Operands:
None
Operation:
(PC)+ 1 TOS,
k PC<10:0>,
(PCLATH<6:3>) PC<14:11>
Operation:
Status Affected:
None
00h WDT
0 WDT prescaler,
1 TO
1 PD
Description:
Status Affected:
TO, PD
Description:
CLRWDT instruction resets the Watchdog Timer. It also resets the prescaler
of the WDT.
Status bits TO and PD are set.
CALLW
COMF
Complement f
Syntax:
[ label ] CALLW
Syntax:
[ label ] COMF
Operands:
None
Operands:
Operation:
(PC) +1 TOS,
(W) PC<7:0>,
(PCLATH<6:0>) PC<14:8>
0 f 127
d [0,1]
Operation:
(f) (destination)
Status Affected:
Description:
DECF
Decrement f
Syntax:
Status Affected:
None
Description:
CLRF
Clear f
Syntax:
[ label ] CLRF
f,d
Operands:
0 f 127
Operands:
Operation:
00h (f)
1Z
0 f 127
d [0,1]
Operation:
(f) - 1 (destination)
Status Affected:
Status Affected:
Description:
Description:
CLRW
Clear W
Syntax:
[ label ] CLRW
Operands:
None
Operation:
00h (W)
1Z
Status Affected:
Description:
Preliminary
DS41458A-page 295
PIC16(L)F1526/27
DECFSZ
Decrement f, Skip if 0
INCFSZ
Increment f, Skip if 0
Syntax:
Syntax:
[ label ]
Operands:
0 f 127
d [0,1]
Operands:
0 f 127
d [0,1]
Operation:
(f) - 1 (destination);
skip if result = 0
Operation:
(f) + 1 (destination),
skip if result = 0
Status Affected:
None
Status Affected:
None
Description:
Description:
GOTO
Unconditional Branch
IORLW
Syntax:
[ label ]
Syntax:
[ label ]
GOTO k
INCFSZ f,d
IORLW k
Operands:
0 k 2047
Operands:
0 k 255
Operation:
k PC<10:0>
PCLATH<6:3> PC<14:11>
Operation:
Status Affected:
Status Affected:
None
Description:
Description:
INCF
Increment f
IORWF
Inclusive OR W with f
Syntax:
[ label ]
Syntax:
[ label ]
Operands:
0 f 127
d [0,1]
Operands:
0 f 127
d [0,1]
Operation:
(f) + 1 (destination)
Operation:
Status Affected:
Status Affected:
Description:
Description:
DS41458A-page 296
INCF f,d
Preliminary
IORWF
f,d
PIC16(L)F1526/27
LSLF
MOVF
Move f
Syntax:
[ label ] LSLF
Syntax:
[ label ]
Operands:
0 f 127
d [0,1]
Operands:
0 f 127
d [0,1]
Operation:
(f<7>) C
(f<6:0>) dest<7:1>
0 dest<0>
Operation:
(f) (dest)
Status Affected:
C, Z
Description:
register f
Status Affected:
Description:
Words:
Cycles:
Example:
Syntax:
[ label ] LSLF
Operands:
0 f 127
d [0,1]
Operation:
0 dest<7>
(f<7:1>) dest<6:0>,
(f<0>) C,
Status Affected:
C, Z
Description:
f {,d}
register f
MOVF
FSR, 0
After Instruction
W = value in FSR register
Z = 1
LSRF
MOVF f,d
Preliminary
DS41458A-page 297
PIC16(L)F1526/27
MOVIW
Move INDFn to W
Syntax:
Operands:
n [0,1]
mm [00,01, 10, 11]
-32 k 31
Operation:
INDFn W
Effective address is determined by
FSR + 1 (preincrement)
FSR - 1 (predecrement)
FSR + k (relative offset)
After the Move, the FSR value will be
either:
FSR + 1 (all increments)
FSR - 1 (all decrements)
Unchanged
Status Affected:
MOVLP
Syntax:
[ label ] MOVLP k
Operands:
0 k 127
Operation:
k PCLATH
Status Affected:
None
Description:
MOVLW
Move literal to W
Syntax:
[ label ]
Operands:
0 k 255
Operation:
k (W)
Status Affected:
None
Description:
Words:
1
1
Mode
Syntax
mm
Cycles:
Preincrement
++FSRn
00
Example:
Predecrement
--FSRn
01
Postincrement
FSRn++
10
Postdecrement
FSRn--
11
Description:
Syntax:
[ label ] MOVLB k
Operands:
0 k 15
Operation:
k BSR
Status Affected:
None
Description:
DS41458A-page 298
0x5A
MOVWF
Move W to f
Syntax:
[ label ]
MOVWF
Operands:
0 f 127
Operation:
(W) (f)
0x5A
Status Affected:
None
Description:
Words:
Cycles:
Example:
MOVLW
After Instruction
W =
MOVLB
MOVLW k
Preliminary
MOVWF
OPTION_REG
Before Instruction
OPTION_REG = 0xFF
W = 0x4F
After Instruction
OPTION_REG = 0x4F
W = 0x4F
PIC16(L)F1526/27
MOVWI
Move W to INDFn
Syntax:
Operands:
Operation:
Status Affected:
n [0,1]
mm [00,01, 10, 11]
-32 k 31
W INDFn
Effective address is determined by
FSR + 1 (preincrement)
FSR - 1 (predecrement)
FSR + k (relative offset)
After the Move, the FSR value will be
either:
FSR + 1 (all increments)
FSR - 1 (all decrements)
Unchanged
None
No Operation
Syntax:
[ label ]
Operands:
None
Operation:
No operation
Status Affected:
None
Description:
No operation.
Words:
Cycles:
Example:
OPTION
Syntax:
[ label ] OPTION
Operands:
None
Operation:
(W) OPTION_REG
Status Affected:
None
Description:
Syntax
Preincrement
++FSRn
00
Predecrement
--FSRn
01
Postincrement
FSRn++
10
Words:
Postdecrement
FSRn--
11
Cycles:
Example:
OPTION
Before Instruction
OPTION_REG = 0xFF
W = 0x4F
After Instruction
OPTION_REG = 0x4F
W = 0x4F
NOP
NOP
Mode
Description:
mm
NOP
RESET
Software Reset
Syntax:
[ label ] RESET
Operands:
None
Operation:
Status Affected:
None
Description:
Preliminary
DS41458A-page 299
PIC16(L)F1526/27
RETFIE
Syntax:
[ label ]
RETURN
RETFIE
Syntax:
[ label ]
None
RETURN
Operands:
None
Operands:
Operation:
TOS PC,
1 GIE
Operation:
TOS PC
Status Affected:
None
Status Affected:
None
Description:
Description:
Words:
Cycles:
Example:
RETFIE
After Interrupt
PC =
GIE =
TOS
1
RLF
Syntax:
[ label ]
Syntax:
[ label ]
Operands:
0 k 255
Operands:
Operation:
k (W);
TOS PC
0 f 127
d [ 0, 1]
Operation:
Status Affected:
None
Status Affected:
Description:
Description:
Words:
Cycles:
RETLW
Example:
TABLE
RETLW k
ADDWF PC ;W = offset
RETLW k1 ;Begin table
RETLW k2 ;
DS41458A-page 300
RLF
Words:
Cycles:
Example:
RLF
f,d
Register f
REG1,0
Before Instruction
REG1
C
After Instruction
REG1
W
C
=
=
1110 0110
0
=
=
=
1110 0110
1100 1100
1
0x07
value of k8
Preliminary
PIC16(L)F1526/27
SUBLW
Syntax:
[ label ]
RRF
Syntax:
[ label ]
Operands:
0 f 127
d [0,1]
Operation:
Status Affected:
C, DC, Z
Status Affected:
Description:
Description:
RRF f,d
SUBLW k
Operands:
0 k 255
Operation:
k - (W) W)
Register f
C=0
Wk
C=1
Wk
DC = 0
W<3:0> k<3:0>
DC = 1
W<3:0> k<3:0>
SLEEP
SUBWF
Subtract W from f
Syntax:
[ label ]
Syntax:
[ label ]
Operands:
0 f 127
d [0,1]
Operation:
Status Affected:
C, DC, Z
Description:
SLEEP
Operands:
None
Operation:
00h WDT,
0 WDT prescaler,
1 TO,
0 PD
Status Affected:
TO, PD
Description:
SUBWF f,d
C=0
Wf
C=1
Wf
DC = 0
W<3:0> f<3:0>
DC = 1
W<3:0> f<3:0>
SUBWFB
Syntax:
SUBWFB
Operands:
0 f 127
d [0,1]
Operation:
f {,d}
Status Affected:
C, DC, Z
Description:
Preliminary
DS41458A-page 301
PIC16(L)F1526/27
SWAPF
Swap Nibbles in f
XORLW
Syntax:
[ label ]
Syntax:
[ label ]
Operands:
0 f 127
d [0,1]
Operation:
SWAPF f,d
(f<3:0>) (destination<7:4>),
(f<7:4>) (destination<3:0>)
XORLW k
Operands:
0 k 255
Operation:
(W) .XOR. k W)
Status Affected:
Description:
Status Affected:
None
Description:
TRIS
XORWF
Exclusive OR W with f
Syntax:
[ label ] TRIS f
Syntax:
[ label ]
Operands:
5f7
Operands:
Operation:
0 f 127
d [0,1]
Status Affected:
None
Operation:
Status Affected:
Description:
Description:
DS41458A-page 302
Preliminary
XORWF
f,d
PIC16(L)F1526/27
25.0
ELECTRICAL SPECIFICATIONS
Power dissipation is calculated as follows: PDIS = VDD x {IDD IOH} + {(VDD VOH) x IOH} + (VOl x IOL).
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.
Preliminary
DS41458A-page 303
PIC16(L)F1526/27
PIC16F1526/7 VOLTAGE FREQUENCY GRAPH, -40C TA +125C
FIGURE 25-1:
VDD (V)
5.5
2.5
2.3
10
16
20
Frequency (MHz)
Note 1: The shaded region indicates the permissible combinations of voltage and frequency.
2: Refer to Table 25-1 for each Oscillator modes supported frequencies.
VDD (V)
FIGURE 25-2:
3.6
2.5
1.8
0
10
16
20
Frequency (MHz)
Note 1: The shaded region indicates the permissible combinations of voltage and frequency.
2: Refer to Table 25-1 for each Oscillator modes supported frequencies.
DS41458A-page 304
Preliminary
PIC16(L)F1526/27
25.1
PIC16LF1526/7
PIC16F1526/7
Param.
No.
D001
Sym.
VDD
Characteristic
VDR
Typ
Max.
Units
Conditions
PIC16LF1526/7
1.8
2.5
3.6
3.6
V
V
FOSC 16 MHz:
FOSC 20 MHz
PIC16F1526/7
2.3
2.5
5.5
5.5
V
V
FOSC 16 MHz:
FOSC 20 MHz
Supply Voltage
D001
D002*
Min.
D002*
PIC16LF1526/7
1.5
PIC16F1526/7
1.7
1.6
VPOR*
VPORR*
0.8
PIC16F1526/7
1.7
D003
VADFVR
-7
-8
-7
-8
-7
-8
6
6
6
6
6
6
D003A
VCDAFVR
-11
-11
-11
-11
-11
-11
7
7
7
7
7
7
D004*
SVDD
0.05
V/ms
Note
Preliminary
DS41458A-page 305
PIC16(L)F1526/27
FIGURE 25-3:
VDD
VPOR
VPORR
VSS
NPOR
POR REARM
VSS
TVLOW(2)
Note 1:
2:
3:
DS41458A-page 306
TPOR(3)
Preliminary
PIC16(L)F1526/27
25.2
PIC16LF1526/7
PIC16F1526/7
Param
No.
Device
Characteristics
Conditions
Min.
Typ
Max.
Units
Note
VDD
D010
D010
D011
D011
D012
D012
D014
D014
D015
D015
8.0
1.8
12.0
3.0
11
2.3
13
3.0
14
5.0
60
1.8
110
3.0
92
2.3
135
3.0
170
5.0
145
1.8
260
3.0
190
2.3
305
3.0
365
5.0
118
1.8
210
3.0
156
2.3
260
3.0
330
5.0
2.0
1.8
4.0
3.0
18
2.3
24
3.0
25
5.0
FOSC = 32 kHz
LP Oscillator mode
FOSC = 32 kHz
LP Oscillator mode
FOSC = 1 MHz
XT Oscillator mode
FOSC = 1 MHz
XT Oscillator mode
FOSC = 4 MHz
XT Oscillator mode
FOSC = 4 MHz
XT Oscillator mode
FOSC = 4 MHz
EC Oscillator mode,
Medium-power mode
FOSC = 4 MHz
EC Oscillator mode
Medium-power mode
FOSC = 31 kHz
LFINTOSC mode
FOSC = 31 kHz
LFINTOSC mode
Preliminary
DS41458A-page 307
PIC16(L)F1526/27
25.2
PIC16LF1526/7
PIC16F1526/7
Param
No.
Device
Characteristics
Conditions
Min.
Typ
Max.
Units
VDD
Note
D016
D016
D017*
D017*
D018
D018
110
1.8
150
3.0
150
2.3
210
3.0
335
5.0
0.25
mA
1.8
0.45
mA
3.0
0.35
mA
2.3
0.69
mA
3.0
0.75
mA
5.0
0.47
mA
1.8
0.84
mA
3.0
0.70
mA
2.3
1.00
mA
3.0
FOSC = 8 MHz
HFINTOSC mode
FOSC = 8 MHz
HFINTOSC mode
FOSC = 16 MHz
HFINTOSC mode
FOSC = 16 MHz
HFINTOSC mode
1.17
mA
5.0
D019A
1.15
mA
3.0
FOSC = 20 MHz
ECH mode
D019A
1.15
mA
3.0
1.3
mA
5.0
FOSC = 20 MHz
ECH mode
1.8
10
3.0
10
3.0
11
5.0
25
1.8
35
3.0
35
3.0
40
5.0
D019B
D019B
D019C
D019C
FOSC = 32 kHz
ECL mode
FOSC = 32 kHz
ECL mode
FOSC = 500 kHz
ECL mode
FOSC = 500 kHz
ECL mode
DS41458A-page 308
Preliminary
PIC16(L)F1526/27
25.2
PIC16LF1526/7
PIC16F1526/7
Param
No.
Device
Characteristics
Conditions
Min.
Typ
Max.
Units
VDD
Note
D020
D020
D021
D021
1.0
mA
3.0
1.2
mA
3.6
1.4
mA
3.0
1.7
mA
5.0
300
1.8
500
3.0
165
2.3
280
3.0
350
5.0
FOSC = 20 MHz
HS Oscillator mode
FOSC = 20 MHz
HS Oscillator mode
FOSC = 4 MHz
EXTRC mode (Note 3)
FOSC = 4 MHz
EXTRC mode (Note 3)
Preliminary
DS41458A-page 309
PIC16(L)F1526/27
25.3
PIC16LF1526/7
PIC16F1526/7
Param
No.
Device Characteristics
Power-down Base Current
Min.
Conditions
Max.
+85C
Max.
+125C
Units
20
nA
1.8
Typ
VDD
Note
(IPD)(2)
D022
30
nA
3.0
D022
300
nA
3.0
470
nA
5.0
300
nA
1.8
750
nA
3.0
500
nA
2.3
770
nA
3.0
D023
D023
D023A
D023A
850
nA
5.0
8.5
1.8
8.5
3.0
18
2.3
18.5
3.0
5.0
19
D024
8.0
3.0
D024
3.0
5.0
D024A
300
nA
3.0
LPBOR Current
D024A
300
nA
3.0
LPBOR Current
450
nA
5.0
D025
0.6
1.8
1.8
3.0
0.7
2.3
3.0
5.0
0.1
1.8
0.1
3.0
160
nA
2.3
400
nA
3.0
500
nA
5.0
D025
D026
D026
Note 1:
2:
3:
DS41458A-page 310
Preliminary
PIC16(L)F1526/27
25.3
PIC16LF1526/7
PIC16F1526/7
Param
No.
Device Characteristics
Min.
D026A*
D026A*
Note 1:
2:
3:
Typ
Conditions
Max.
+85C
Max.
+125C
Units
VDD
Note
(2)
250
1.8
250
3.0
280
2.3
280
3.0
280
5.0
Preliminary
DS41458A-page 311
PIC16(L)F1526/27
25.4
DC Characteristics: PIC16(L)F1526/27-I/E
DC CHARACTERISTICS
Param
No.
Sym.
VIL
Characteristic
Typ
Max.
Units
Conditions
I/O PORT:
D030
0.8
0.15 VDD
0.2 VDD
0.3 VDD
D030A
D031
D032
D033
VIH
0.8
0.2 VDD
0.3 VDD
I/O ports:
D040
2.0
0.25 VDD +
0.8
0.8 VDD
0.7 VDD
D040A
D041
MCLR
2.1
0.8 VDD
D043A
0.7 VDD
D043B
0.9 VDD
(Note 1)
nA
IIL
D060
I/O ports
125
1000
nA
D061
MCLR(3)
50
200
nA
25
25
100
140
200
300
0.6
VDD - 0.7
15
pF
50
pF
IPUR
D070*
VOL
D080
I/O ports
VOH
D090
I/O ports
D101*
D101A* CIO
*
Note 1:
2:
3:
4:
DS41458A-page 312
Preliminary
PIC16(L)F1526/27
25.5
DC CHARACTERISTICS
Param
No.
Sym.
Characteristic
Min.
Typ
Max.
Units
Conditions
Program Memory
Programming Specifications
D110
VIHH
8.0
9.0
D111
IDDP
10
mA
2.7
VDD
max.
D112
D113
VPEW
VDD
min.
VDD
max.
D114
1.0
mA
D115
5.0
mA
D121
EP
Cell Endurance
10K
E/W
D122
VPR
VDD
min.
VDD
max.
D123
TIW
2.5
ms
D124
40
Year
(Note 2, Note 3)
Provided no other
specifications are violated
Data in Typ column is at 3.0V, 25C unless otherwise stated. These parameters are for design guidance
only and are not tested.
Note 1: Self-write and Block Erase.
2: Required only if single-supply programming is disabled.
3: The MPLAB ICD 2 does not support variable VPP output. Circuitry to limit the ICD 2 VPP voltage must be
placed between the ICD 2 and target system when programming or debugging with the ICD 2.
Preliminary
DS41458A-page 313
PIC16(L)F1526/27
25.6
Thermal Considerations
TH01
TH02
TH03
TH04
TH05
Sym.
Characteristic
JA
JC
TJMAX
PD
Typ.
Units
Conditions
TBD
C/W
TBD
C/W
TBD
C/W
TBD
C/W
150
PD = PINTERNAL + PI/O
TH06
PI/O
TH07
PDER
Derated Power
Legend:
TBD = To Be Determined
Note 1: IDD is current to run the chip alone without driving any load on the output pins.
2: TA = Ambient Temperature.
3: TJ = Junction Temperature.
DS41458A-page 314
Preliminary
PIC16(L)F1526/27
25.7
FIGURE 25-4:
Time
osc
rd
rw
sc
ss
t0
t1
wr
OSC1
RD
RD or WR
SCKx
SS
T0CKI
T1CKI
WR
P
R
V
Z
Period
Rise
Valid
High-impedance
LOAD CONDITIONS
Load Condition
Pin
CL
VSS
Preliminary
DS41458A-page 315
PIC16(L)F1526/27
25.8
AC Characteristics: PIC16(L)F1526/27-I/E
FIGURE 25-5:
CLOCK TIMING
Q4
Q1
Q2
Q3
Q4
Q1
OSC1/CLKIN
OS02
OS04
OS04
OS03
OSC2/CLKOUT
(LP,XT,HS Modes)
OSC2/CLKOUT
(CLKOUT Mode)
TABLE 25-1:
OS01
Sym.
FOSC
Characteristic
Oscillator Frequency(1)
OS02
TOSC
Oscillator Period(1)
OS03
TCY
OS04*
TosH,
TosL
TosR,
TosF
OS05*
Min.
Typ
Max.
Units
Conditions
DC
0.5
MHz
DC
MHz
DC
20
MHz
32.768
kHz
LP Oscillator mode
0.1
MHz
XT Oscillator mode
MHz
20
MHz
DC
MHz
RC Oscillator mode
27
LP Oscillator mode
250
ns
XT Oscillator mode
50
ns
HS Oscillator mode
50
ns
EC Oscillator mode
30.5
LP Oscillator mode
250
10,000
ns
XT Oscillator mode
50
1,000
ns
HS Oscillator mode
250
ns
RC Oscillator mode
125
DC
ns
TCY = FOSC/4
LP oscillator
100
ns
XT oscillator
20
ns
HS oscillator
ns
LP oscillator
ns
XT oscillator
ns
HS oscillator
DS41458A-page 316
Preliminary
PIC16(L)F1526/27
TABLE 25-2:
OSCILLATOR PARAMETERS
Sym.
Characteristic
Freq.
Tolerance
Min.
Typ
Max.
Units
Conditions
OS08
HFOSC
10%
16.0
MHz
-40C TA +125C
OS09
LFOSC
31
kHz
-40C TA +125C
OS10*
TIOSC ST HFINTOSC
Wake-up from Sleep Start-up Time
FIGURE 25-6:
Cycle
Fetch
Read
Execute
Q4
Q1
Q2
Q3
FOSC
OS12
OS11
OS20
OS21
CLKOUT
OS19
OS16
OS13
OS18
OS17
I/O pin
(Input)
OS14
OS15
I/O pin
(Output)
New Value
Old Value
OS18, OS19
Preliminary
DS41458A-page 317
PIC16(L)F1526/27
TABLE 25-3:
Sym.
Characteristic
Min.
Typ
Max.
Units
Conditions
70
ns
VDD = 3.3-5.0V
72
ns
VDD = 3.3-5.0V
OS11
TosH2ckL
OS12
(1)
OS13
TckL2ioV
OS14
OS15
OS16
TioV2ckH
TosH2ioV
TosH2ioI
OS17
TioV2osH
OS18
TioR
OS19
TioF
(1)
20
ns
TOSC + 200 ns
50
50
70*
ns
ns
ns
20
ns
25
25
40
15
28
15
72
32
55
30
ns
OS20* Tinp
OS21* Tioc
FIGURE 25-7:
ns
VDD = 3.3-5.0V
VDD = 3.3-5.0V
VDD = 1.8V
VDD = 3.3-5.0V
VDD = 1.8V
VDD = 3.3-5.0V
ns
ns
VDD
MCLR
30
Internal
POR
PWRT
Time-out
33
32
OSC
Start-Up Time
Internal Reset(1)
Watchdog Timer
Reset(1)
34
31
34
I/O pins
Note 1: Asserted low.
DS41458A-page 318
Preliminary
PIC16(L)F1526/27
FIGURE 25-8:
VDD
VBOR and VHYST
VBOR
37
Reset
33(1)
(due to BOR)
Preliminary
DS41458A-page 319
PIC16(L)F1526/27
TABLE 25-4:
Sym.
Characteristic
Typ
Max.
Units
Conditions
2
5
s
s
10
16
27
ms
VDD = 3.3V-5V,
1:16 Prescaler used
30
TMCL
31
32
TOST
1024
33*
TPWRT
40
65
140
ms
34*
TIOZ
2.0
35
VBOR
2.38
1.80
2.5
1.9
2.65
2.05
36*
VHYST
25
50
mV
-40C to +85C
37*
VDD VBOR
38
TBD
TBD
TBD
LPBOR = 1
Note 1:
2:
3:
4:
Min.
Tosc (Note 3)
BORV=2.5V
BORV=1.9V
DS41458A-page 320
Preliminary
PIC16(L)F1526/27
FIGURE 25-9:
T0CKI
40
41
42
T1CKI
45
46
49
47
TMR0 or
TMR1
TABLE 25-5:
40*
Sym.
TT0H
Characteristic
Min.
No Prescaler
TT0L
No Prescaler
TT0P
T0CKI Period
45*
TT1H
ns
ns
0.5 TCY + 20
ns
10
ns
Greater of:
20 or TCY + 40
N
ns
0.5 TCY + 20
ns
15
ns
Asynchronous
46*
TT1L
T1CKI Low
Time
30
ns
Synchronous, No Prescaler
0.5 TCY + 20
ns
15
ns
Asynchronous
30
ns
Greater of:
30 or TCY + 40
N
ns
47*
TT1P
48
FT1
49*
Asynchronous
Units
10
With Prescaler
42*
Max.
0.5 TCY + 20
With Prescaler
41*
Typ
60
ns
32.4
32.768
33.1
kHz
2 TOSC
7 TOSC
Conditions
N = prescale value
(2, 4, ..., 256)
N = prescale value
(1, 2, 4, 8)
Timers in Sync
mode
Preliminary
DS41458A-page 321
PIC16(L)F1526/27
FIGURE 25-10:
CCP
(Capture mode)
CC01
CC02
CC03
Note:
TABLE 25-6:
Characteristic
CC01* TccL
CC02* TccH
CC03* TccP
*
Min.
Typ
Max.
Units
0.5TCY + 20
ns
With Prescaler
20
ns
No Prescaler
0.5TCY + 20
ns
With Prescaler
20
ns
3TCY + 40
N
ns
No Prescaler
Conditions
TABLE 25-7:
Characteristic
Min.
Typ
Max.
Units
Conditions
AD01
NR
Resolution
10
AD02
EIL
Integral Error
1.7
AD03
EDL
Differential Error
AD04
AD05
EGN
AD06
AD07
VAIN
Full-Scale Range
AD08
ZAIN
Recommended Impedance of
Analog Voltage Source
Note 1:
2:
3:
4:
5:
Gain Error
bit
LSb VREF = 3.0V
1.5
1.8
VDD
VSS
VREF
10
DS41458A-page 322
Preliminary
PIC16(L)F1526/27
TABLE 25-8:
Sym.
Characteristic
AD130* TAD
AD131
TCNV
AD132* TACQ
Min.
Typ
Max.
Units
Conditions
1.0
9.0
TOSC-based
1.0
1.6
6.0
11
TAD
Acquisition Time
5.0
FIGURE 25-11:
BSF ADCON0, GO
AD134
1 TCY
(TOSC/2(1))
AD131
Q4
AD130
A/D CLK
7
A/D Data
OLD_DATA
ADRES
0
NEW_DATA
1 TCY
ADIF
GO
Sample
DONE
AD132
Sampling Stopped
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.
Preliminary
DS41458A-page 323
PIC16(L)F1526/27
FIGURE 25-12:
BSF ADCON0, GO
(TOSC/2 + TCY(1))
AD134
1 TCY
AD131
Q4
AD130
A/D CLK
7
A/D Data
0
NEW_DATA
OLD_DATA
ADRES
ADIF
1 TCY
GO
DONE
Sampling Stopped
AD132
Sample
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.
TABLE 25-9:
LD001
LD002
*
Characteristic
Min.
Typ
Max.
Units
3.2
0.1
Conditions
FIGURE 25-13:
CK
US121
US121
DT
US120
Note:
US122
DS41458A-page 324
Preliminary
PIC16(L)F1526/27
TABLE 25-10: USART SYNCHRONOUS TRANSMISSION REQUIREMENTS
Standard Operating Conditions (unless otherwise stated)
Operating Temperature
-40C TA +125C
Param.
No.
Symbol
Characteristic
Min.
Max.
Units
3.0-5.5V
80
ns
1.8-5.5V
100
ns
US121 TCKRF
3.0-5.5V
45
ns
1.8-5.5V
50
ns
US122 TDTRF
3.0-5.5V
45
ns
1.8-5.5V
50
ns
FIGURE 25-14:
Conditions
US125
DT
US126
Note: Refer to Figure 25-4 for load conditions.
Symbol
Characteristic
Preliminary
Min.
Max.
Units
10
ns
15
ns
Conditions
DS41458A-page 325
PIC16(L)F1526/27
FIGURE 25-15:
SSx
SP70
SCKx
(CKP = 0)
SP71
SP72
SP78
SP79
SP79
SP78
SCKx
(CKP = 1)
SP80
bit 6 - - - - - -1
MSb
SDOx
LSb
SP75, SP76
SDIx
MSb In
bit 6 - - - -1
LSb In
SP74
SP73
Note: Refer to Figure 25-4 for load conditions.
FIGURE 25-16:
SSx
SP81
SCKx
(CKP = 0)
SP71
SP72
SP79
SP73
SCKx
(CKP = 1)
SP80
SDOx
MSb
SP78
bit 6 - - - - - -1
LSb
SP75, SP76
SDIx
MSb In
bit 6 - - - -1
LSb In
SP74
Note: Refer to Figure 25-4 for load conditions.
DS41458A-page 326
Preliminary
PIC16(L)F1526/27
FIGURE 25-17:
SSx
SP70
SCKx
(CKP = 0)
SP83
SP71
SP72
SP78
SP79
SP79
SP78
SCKx
(CKP = 1)
SP80
MSb
SDOx
LSb
bit 6 - - - - - -1
SP77
SP75, SP76
SDIx
MSb In
bit 6 - - - -1
LSb In
SP74
SP73
Note: Refer to Figure 25-4 for load conditions.
FIGURE 25-18:
SSx
SCKx
(CKP = 0)
SP71
SP72
SCKx
(CKP = 1)
SP80
MSb
SDOx
bit 6 - - - - - -1
LSb
SP77
SP75, SP76
SDIx
MSb In
bit 6 - - - -1
LSb In
SP74
Note: Refer to Figure 25-4 for load conditions.
Preliminary
DS41458A-page 327
PIC16(L)F1526/27
TABLE 25-12: SPI MODE REQUIREMENTS
Param
No.
Symbol
Characteristic
Min.
Typ
TCY
ns
SP71* TSCH
TCY + 20
ns
SP72* TSCL
TCY + 20
ns
100
ns
SP74* TSCH2DIL,
TSCL2DIL
100
ns
SP75* TDOR
3.0-5.5V
10
25
ns
1.8-5.5V
25
50
ns
10
25
ns
SP76* TDOF
SP77* TSSH2DOZ
10
50
ns
SP78* TSCR
10
25
ns
SP79* TSCF
3.0-5.5V
25
50
ns
10
25
ns
3.0-5.5V
50
ns
1.8-5.5V
145
ns
Tcy
ns
50
ns
1.5TCY + 40
ns
SP82* TSSL2DOV
1.8-5.5V
FIGURE 25-19:
SCLx
SP93
SP91
SP90
SP92
SDAx
Stop
Condition
Start
Condition
Note: Refer to Figure 25-4 for load conditions.
DS41458A-page 328
Preliminary
PIC16(L)F1526/27
FIGURE 25-20:
SCLx
SP100
SP90
SP102
SP101
SP106
SP107
SP91
SDAx
In
SP92
SP110
SP109
SP109
SDAx
Out
Note: Refer to Figure 25-4 for load conditions.
Preliminary
DS41458A-page 329
PIC16(L)F1526/27
TABLE 25-13: I2C BUS DATA REQUIREMENTS
Param.
No.
Symbol
SP100* THIGH
Characteristic
Min.
Max.
Units
4.0
0.6
SSP module
SP101* TLOW
1.5TCY
4.7
1.3
SSP module
SP102* TR
SP103* TF
SP106* THD:DAT
SP107* TSU:DAT
SP109* TAA
SP110* TBUF
SP111
*
Note 1:
2:
CB
1.5TCY
1000
ns
20 + 0.1CB
300
ns
250
ns
20 + 0.1CB
250
ns
ns
0.9
250
ns
100
ns
3500
ns
ns
Conditions
4.7
1.3
400
pF
CB is specified to be from
10-400 pF
CB is specified to be from
10-400 pF
(Note 2)
(Note 1)
DS41458A-page 330
Preliminary
PIC16(L)F1526/27
26.0
DC AND AC
CHARACTERISTICS GRAPHS
AND CHARTS
Preliminary
DS41458A-page 331
PIC16(L)F1526/27
NOTES:
DS41458A-page 332
Preliminary
PIC16(L)F1526/27
27.0
DEVELOPMENT SUPPORT
27.1
Preliminary
DS41458A-page 333
PIC16(L)F1526/27
27.2
27.3
MPASM Assembler
27.4
27.5
27.6
DS41458A-page 334
Preliminary
PIC16(L)F1526/27
27.7
27.9
27.8
MPLAB ICD 3 In-Circuit Debugger System is Microchip's most cost effective high-speed hardware
debugger/programmer for Microchip Flash Digital Signal Controller (DSC) and microcontroller (MCU)
devices. It debugs and programs PIC Flash microcontrollers and dsPIC DSCs with the powerful, yet easyto-use graphical user interface of MPLAB Integrated
Development Environment (IDE).
The MPLAB ICD 3 In-Circuit Debugger probe is connected to the design engineer's PC using a high-speed
USB 2.0 interface and is connected to the target with a
connector compatible with the MPLAB ICD 2 or MPLAB
REAL ICE systems (RJ-11). MPLAB ICD 3 supports all
MPLAB ICD 2 headers.
Preliminary
DS41458A-page 335
PIC16(L)F1526/27
27.11 PICkit 2 Development
Programmer/Debugger and
PICkit 2 Debug Express
27.13 Demonstration/Development
Boards, Evaluation Kits, and
Starter Kits
DS41458A-page 336
Preliminary
PIC16(L)F1526/27
28.0
PACKAGING INFORMATION
28.1
Example
XXXXXXXXXXX
XXXXXXXXXXX
XXXXXXXXXXX
YYWWNNN
PIC16LF1527
-E/PT e3
1045253
Example
PIC16LF1527
-E/MR e3
1045253
XXXXXXXXXXX
XXXXXXXXXXX
XXXXXXXXXXX
YYWWNNN
Legend: XX...X
Y
YY
WW
NNN
e3
*
Note:
Customer-specific information
Year code (last digit of calendar year)
Year code (last 2 digits of calendar year)
Week code (week of January 1 is week 01)
Alphanumeric traceability code
Pb-free JEDEC designator for Matte Tin (Sn)
This package is Pb-free. The Pb-free JEDEC designator ( e3 )
can be found on the outer packaging for this package.
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.
Preliminary
DS41458A-page 337
PIC16(L)F1526/27
28.2
Package Details
/HDG3ODVWLF7KLQ4XDG)ODWSDFN37[[PP%RG\PP>74)3@
1RWH
)RUWKHPRVWFXUUHQWSDFNDJHGUDZLQJVSOHDVHVHHWKH0LFURFKLS3DFNDJLQJ6SHFLILFDWLRQORFDWHGDW
KWWSZZZPLFURFKLSFRPSDFNDJLQJ
D
D1
E
e
E1
N
b
NOTE 1
123
NOTE 2
A2
A1
L
L1
8QLWV
'LPHQVLRQ/LPLWV
1XPEHURI/HDGV
0,//,0(7(56
0,1
120
0$;
/HDG3LWFK
2YHUDOO+HLJKW
%6&
0ROGHG3DFNDJH7KLFNQHVV
$
6WDQGRII
$
)RRW/HQJWK
)RRWSULQW
/
5()
)RRW$QJOH
2YHUDOO:LGWK
%6&
2YHUDOO/HQJWK
'
%6&
0ROGHG3DFNDJH:LGWK
(
%6&
0ROGHG3DFNDJH/HQJWK
'
%6&
/HDG7KLFNQHVV
/HDG:LGWK
0ROG'UDIW$QJOH7RS
0ROG'UDIW$QJOH%RWWRP
1RWHV
3LQYLVXDOLQGH[IHDWXUHPD\YDU\EXWPXVWEHORFDWHGZLWKLQWKHKDWFKHGDUHD
&KDPIHUVDWFRUQHUVDUHRSWLRQDOVL]HPD\YDU\
'LPHQVLRQV'DQG(GRQRWLQFOXGHPROGIODVKRUSURWUXVLRQV0ROGIODVKRUSURWUXVLRQVVKDOOQRWH[FHHGPPSHUVLGH
'LPHQVLRQLQJDQGWROHUDQFLQJSHU$60(<0
%6& %DVLF'LPHQVLRQ7KHRUHWLFDOO\H[DFWYDOXHVKRZQZLWKRXWWROHUDQFHV
5() 5HIHUHQFH'LPHQVLRQXVXDOO\ZLWKRXWWROHUDQFHIRULQIRUPDWLRQSXUSRVHVRQO\
0LFURFKLS 7HFKQRORJ\ 'UDZLQJ &%
DS41458A-page 338
Preliminary
PIC16(L)F1526/27
/HDG3ODVWLF7KLQ4XDG)ODWSDFN37[[PP%RG\PP>74)3@
1RWH
)RUWKHPRVWFXUUHQWSDFNDJHGUDZLQJVSOHDVHVHHWKH0LFURFKLS3DFNDJLQJ6SHFLILFDWLRQORFDWHGDW
KWWSZZZPLFURFKLSFRPSDFNDJLQJ
Preliminary
DS41458A-page 339
PIC16(L)F1526/27
Note:
For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
DS41458A-page 340
Preliminary
PIC16(L)F1526/27
Note:
For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
Preliminary
DS41458A-page 341
PIC16(L)F1526/27
NOTES:
DS41458A-page 342
Preliminary
PIC16(L)F1526/27
APPENDIX A:
DATA SHEET
REVISION HISTORY
Revision A
Original release (01/2011)
Preliminary
DS41458A-page 343
PIC16(L)F1526/27
NOTES:
DS41458A-page 344
Preliminary
PIC16(L)F1526/27
INDEX
A
A/D
Specifications............................................................ 322
Absolute Maximum Ratings .............................................. 303
AC Characteristics
Industrial and Extended ............................................ 316
Load Conditions ........................................................ 315
ACKSTAT ......................................................................... 236
ACKSTAT Status Flag ...................................................... 236
ADC .................................................................................. 149
Acquisition Requirements ......................................... 159
Associated registers.................................................. 161
Block Diagram........................................................... 149
Calculating Acquisition Time..................................... 159
Channel Selection..................................................... 150
Configuration............................................................. 150
Configuring Interrupt ................................................. 154
Conversion Clock...................................................... 150
Conversion Procedure .............................................. 154
Internal Sampling Switch (RSS) Impedance.............. 159
Interrupts................................................................... 152
Operation .................................................................. 153
Operation During Sleep ............................................ 153
Port Configuration ..................................................... 150
Reference Voltage (VREF)......................................... 150
Source Impedance.................................................... 159
Special Event Trigger................................................ 153
Starting an A/D Conversion ...................................... 152
ADCON0 Register....................................................... 30, 155
ADCON1 Register....................................................... 30, 156
ADDFSR ........................................................................... 293
ADDWFC .......................................................................... 293
ADRESH Register............................................................... 30
ADRESH Register (ADFM = 0) ......................................... 157
ADRESH Register (ADFM = 1) ......................................... 158
ADRESL Register (ADFM = 0).......................................... 157
ADRESL Register (ADFM = 1).......................................... 158
Alternate Pin Function....................................................... 118
Analog-to-Digital Converter. See ADC
ANSELA Register ............................................................. 121
ANSELB Register ............................................................. 124
ANSELD Register ............................................................. 130
ANSELE Register ............................................................. 133
ANSELF Register.............................................................. 136
ANSELG Register ............................................................. 139
APFCON0Register............................................................ 118
Assembler
MPASM Assembler................................................... 334
B
BAUDCON Register.......................................................... 266
BF ............................................................................. 236, 238
BF Status Flag .......................................................... 236, 238
Block Diagrams
.......................................................................... 5, 12, 18
(CCP) Capture Mode Operation ............................... 184
ADC .......................................................................... 149
ADC Transfer Function ............................................. 160
Analog Input Model ................................................... 160
CCP PWM................................................................. 192
Clock Source............................................................... 52
Compare ................................................................... 188
Crystal Operation .................................................. 54, 55
C
C Compilers
MPLAB C18.............................................................. 334
CALL................................................................................. 295
CALLW ............................................................................. 295
Capture Module. See Enhanced Capture/Compare/
PWM (ECCP)
Capture/Compare/PWM ................................................... 183
Capture/Compare/PWM (CCP)
Associated Registers w/ Capture ..................... 186, 187
Associated Registers w/ Compare ................... 190, 191
Associated Registers w/ PWM ......................... 195, 196
Capture Mode........................................................... 184
CCPx Pin Configuration............................................ 184
Compare Mode......................................................... 188
CCPx Pin Configuration.................................... 188
Software Interrupt Mode ........................... 184, 189
Special Event Trigger ....................................... 189
Timer1 Mode Resource ............................ 184, 188
Prescaler .................................................................. 185
PWM Mode
Duty Cycle ........................................................ 194
Effects of Reset ................................................ 195
Example PWM Frequencies and
Resolutions, 20 MHZ................................ 194
Example PWM Frequencies and
Resolutions, 8 MHz .................................. 194
Operation in Sleep Mode.................................. 195
Resolution ........................................................ 194
System Clock Frequency Changes .................. 195
PWM Operation ........................................................ 192
PWM Overview......................................................... 192
PWM Period ............................................................. 193
PWM Setup .............................................................. 193
Specifications ........................................................... 321
CCP1CON Register................................................ 32, 33, 35
CCPR1H Register................................................... 32, 33, 35
CCPR1L Register ................................................... 32, 33, 35
CCPTMRS0 Register........................................................ 198
CCPTMRS1 Register........................................................ 199
CCPTMRS2 Register........................................................ 200
CCPxCON (CCPx) Register ............................................. 197
Preliminary
DS41458A-page 345
PIC16(L)F1526/27
Clock Accuracy with Asynchronous Operation ................. 264
Clock Sources
External Modes ........................................................... 53
EC ....................................................................... 53
HS ....................................................................... 53
LP........................................................................ 53
OST..................................................................... 54
RC....................................................................... 55
XT ....................................................................... 53
Internal Modes ............................................................ 56
HFINTOSC.......................................................... 56
Internal Oscillator Clock Switch Timing............... 57
LFINTOSC .......................................................... 56
Clock Switching................................................................... 59
Code Examples
A/D Conversion ......................................................... 154
Changing Between Capture Prescalers .................... 185
Initializing PORTA ..................................................... 117
Initializing PORTG .................................................... 138
Writing to Flash Program Memory ............................ 110
Compare Module. See Enhanced Capture/Compare/
PWM (ECCP)
CONFIG1 Register.............................................................. 46
CONFIG2 Register.............................................................. 48
Core Function Register ....................................................... 29
Customer Change Notification Service ............................. 351
Customer Notification Service........................................... 351
Customer Support ............................................................. 351
D
Data Memory....................................................................... 22
DC and AC Characteristics ............................................... 331
DC Characteristics
Extended and Industrial ............................................ 312
Industrial and Extended ............................................ 305
Development Support ....................................................... 333
Device Configuration........................................................... 45
Code Protection .......................................................... 49
Configuration Word ..................................................... 45
User ID .................................................................. 49, 50
Device ID Register .............................................................. 50
Device Overview ........................................................... 11, 97
E
ECCP/CCP. See Enhanced Capture/Compare/PWM
Effects of Reset
PWM mode ............................................................... 195
Electrical Specifications .................................................... 303
Enhanced Capture/Compare/PWM (ECCP) ..................... 184
Enhanced Mid-Range CPU................................................. 17
Enhanced Universal Synchronous Asynchronous
Receiver Transmitter (EUSART)............................... 255
Errata .................................................................................... 9
EUSART............................................................................ 255
Asynchronous Mode ................................................. 257
12-bit Break Transmit and Receive................... 275
Associated Registers, Receive ......................... 263
Associated Registers, Transmit ........................ 259
Auto-Wake-up on Break.................................... 273
Baud Rate Generator (BRG)............................. 267
Clock Accuracy ................................................. 264
Receiver............................................................ 260
Setting up 9-bit Mode with Address Detect....... 262
Transmitter........................................................ 257
Baud Rate Generator (BRG)
Associated Registers ........................................ 268
DS41458A-page 346
F
Fail-Safe Clock Monitor ...................................................... 62
Fail-Safe Condition Clearing....................................... 62
Fail-Safe Detection ..................................................... 62
Fail-Safe Operation..................................................... 62
Reset or Wake-up from Sleep .................................... 62
Firmware Instructions ....................................................... 289
Fixed Voltage Reference (FVR)........................................ 145
Associated Registers ................................................ 146
Flash Program Memory .................................................... 101
Associated Registers ................................................ 116
Configuration Word w/ Flash Program Memory........ 116
Erasing ..................................................................... 105
Modifying .................................................................. 111
Write Verify ............................................................... 113
Writing ...................................................................... 107
FSR Register ...................................................................... 29
FVRCON (Fixed Voltage Reference Control) Register..... 146
I
I2C Mode (MSSPx)
Acknowledge Sequence Timing ............................... 240
Bus Collision
During a Repeated Start Condition................... 245
During a Stop Condition ................................... 246
Effects of a Reset ..................................................... 241
I2C Clock Rate w/BRG.............................................. 248
Master Mode
Operation.......................................................... 232
Reception ......................................................... 238
Start Condition Timing .............................. 234, 235
Transmission .................................................... 236
Multi-Master Communication, Bus Collision and
Arbitration ........................................................ 241
Multi-Master Mode .................................................... 241
Read/Write Bit Information (R/W Bit) ........................ 217
Slave Mode
Transmission .................................................... 222
Sleep Operation........................................................ 241
Preliminary
PIC16(L)F1526/27
Stop Condition Timing............................................... 240
INDF Register ..................................................................... 29
Indirect Addressing ............................................................. 40
Instruction Format ............................................................. 290
Instruction Set ................................................................... 289
ADDLW ..................................................................... 293
ADDWF..................................................................... 293
ADDWFC .................................................................. 293
ANDLW ..................................................................... 293
ANDWF..................................................................... 293
BRA........................................................................... 294
CALL ......................................................................... 295
CALLW...................................................................... 295
LSLF ......................................................................... 297
LSRF......................................................................... 297
MOVF........................................................................ 297
MOVIW ..................................................................... 298
MOVLB ..................................................................... 298
MOVWI ..................................................................... 299
OPTION .................................................................... 299
RESET ...................................................................... 299
SUBWFB................................................................... 301
TRIS.......................................................................... 302
BCF........................................................................... 294
BSF ........................................................................... 294
BTFSC ...................................................................... 294
BTFSS ...................................................................... 294
CALL ......................................................................... 295
CLRF......................................................................... 295
CLRW ....................................................................... 295
CLRWDT................................................................... 295
COMF ....................................................................... 295
DECF ........................................................................ 295
DECFSZ.................................................................... 296
GOTO ....................................................................... 296
INCF.......................................................................... 296
INCFSZ ..................................................................... 296
IORLW ...................................................................... 296
IORWF ...................................................................... 296
MOVLW .................................................................... 298
MOVWF .................................................................... 298
NOP .......................................................................... 299
RETFIE ..................................................................... 300
RETLW ..................................................................... 300
RETURN ................................................................... 300
RLF ........................................................................... 300
RRF........................................................................... 301
SLEEP ...................................................................... 301
SUBLW ..................................................................... 301
SUBWF ..................................................................... 301
SWAPF ..................................................................... 302
XORLW..................................................................... 302
XORWF..................................................................... 302
INTCON Register ................................................................ 80
Internal Oscillator Block
INTOSC
Specifications.................................................... 317
Internal Sampling Switch (RSS) Impedance ...................... 159
Internet Address................................................................ 351
Interrupt-On-Change ......................................................... 141
Associated Registers ................................................ 143
Interrupts ............................................................................. 75
ADC .......................................................................... 154
Associated registers w/ Interrupts............................... 89
Configuration Word w/ Clock Sources ........................ 65
L
LATA Register .......................................................... 120, 126
LATB Register .................................................................. 123
LATD Register .................................................................. 129
LATE Register .................................................................. 132
LATF Register................................................................... 135
LATG Register .................................................................. 139
LDO
Configuration Word w/ LDO........................................ 95
Load Conditions................................................................ 315
LSLF ................................................................................. 297
LSRF ................................................................................ 297
M
Master Synchronous Serial Port. See MSSPx
MCLR ................................................................................. 70
Internal........................................................................ 70
Memory Organization ......................................................... 19
Data ............................................................................ 22
Program...................................................................... 19
Microchip Internet Web Site.............................................. 351
MOVIW ............................................................................. 298
MOVLB ............................................................................. 298
MOVWI ............................................................................. 299
MPLAB ASM30 Assembler, Linker, Librarian ................... 334
MPLAB Integrated Development Environment Software.. 333
MPLAB PM3 Device Programmer .................................... 336
MPLAB REAL ICE In-Circuit Emulator System ................ 335
MPLINK Object Linker/MPLIB Object Librarian ................ 334
MSSPx.............................................................................. 201
I2C Mode .................................................................. 212
I2C Mode Operation.................................................. 214
SPI Mode.................................................................. 204
SSPxBUF Register ................................................... 207
SSPxSR Register ..................................................... 207
O
OPCODE Field Descriptions............................................. 289
OPTION ............................................................................ 299
OPTION_REG Register.................................................... 165
OSCCON Register.............................................................. 64
Oscillator
Associated Registers.................................................. 65
Oscillator Module ................................................................ 51
ECH ............................................................................ 51
ECL............................................................................. 51
ECM............................................................................ 51
HS............................................................................... 51
INTOSC ...................................................................... 51
LP ............................................................................... 51
RC .............................................................................. 51
XT ............................................................................... 51
Oscillator Parameters ....................................................... 317
Oscillator Specifications.................................................... 316
Oscillator Start-up Timer (OST)
Specifications ........................................................... 320
Oscillator Switching
Fail-Safe Clock Monitor .............................................. 62
Two-Speed Clock Start-up ......................................... 60
OSCSTAT Register ............................................................ 65
Preliminary
DS41458A-page 347
PIC16(L)F1526/27
P
Packaging ......................................................................... 337
Marking ..................................................................... 337
PDIP Details.............................................................. 338
PCL and PCLATH ............................................................... 18
PCL Register....................................................................... 29
PCLATH Register................................................................ 29
PCON Register ............................................................. 30, 73
PIE1 Register ................................................................ 30, 81
PIE2 Register ................................................................ 30, 82
PIE3 Register ...................................................................... 83
PIE4 Register ...................................................................... 84
PIR1 Register................................................................ 30, 85
PIR2 Register................................................................ 30, 86
PIR3 Register...................................................................... 87
PIR4 Register...................................................................... 88
PMADR Registers ............................................................. 101
PMADRH Registers .......................................................... 101
PMADRL Register............................................................. 114
PMADRL Registers ........................................................... 101
PMCON1 Register .................................................... 101, 115
PMCON2 Register .................................................... 101, 116
PMDATH Register............................................................. 114
PMDATL Register ............................................................. 114
PORTA.............................................................................. 119
ANSELA Register ..................................................... 119
Associated Registers ................................................ 121
Configuration Word w/ PORTA ................................. 121
PORTA Register ................................................... 30, 31
Specifications ............................................................ 318
PORTA Register ............................................................... 120
PORTB.............................................................................. 122
ANSELB Register ..................................................... 122
Associated Registers ................................................ 124
PORTB Register ................................................... 30, 31
PORTB Register ............................................................... 123
PORTC.............................................................................. 125
Associated Registers ................................................ 127
PORTC Register ................................................... 30, 31
PORTC Register ............................................................... 126
PORTD.............................................................................. 128
ANSELD Register ..................................................... 128
Associated Registers ................................................ 130
PORTD Register ................................................... 30, 31
PORTD Register ............................................................... 129
PORTE.............................................................................. 131
ANSELE Register ..................................................... 131
Associated Registers ................................................ 133
PORTE Register ................................................... 30, 31
PORTE Register ............................................................... 132
PORTF .............................................................................. 134
ANSELF Register...................................................... 134
Associated Registers ................................................ 136
Configuration Word w/ PORTF ................................. 136
PORTF Register................................................................ 135
PORTG ............................................................................. 137
ANSELG Register ..................................................... 137
Associated Registers ................................................ 140
Configuration Word w/ PORTG................................. 140
PORTG Register ............................................................... 138
Power-Down Mode (Sleep) ................................................. 91
Associated Registers .................................................. 94
Power-on Reset .................................................................. 68
Power-up Time-out Sequence ............................................ 70
Power-up Timer (PWRT)..................................................... 68
DS41458A-page 348
R
RCREG............................................................................. 262
RCREG Register ................................................................ 31
RCSTA Register ......................................................... 31, 265
Reader Response............................................................. 352
Read-Modify-Write Operations ......................................... 289
Register
RCREG Register ...................................................... 272
Registers
ADCON0 (ADC Control 0) ........................................ 155
ADCON1 (ADC Control 1) ........................................ 156
ADRESH (ADC Result High) with ADFM = 0) .......... 157
ADRESH (ADC Result High) with ADFM = 1) .......... 158
ADRESL (ADC Result Low) with ADFM = 0)............ 157
ADRESL (ADC Result Low) with ADFM = 1)............ 158
ANSELA (PORTA Analog Select)............................. 121
ANSELB (PORTB Analog Select)............................. 124
ANSELD (PORTD Analog Select) ............................ 130
ANSELE (PORTE Analog Select)............................. 133
ANSELF (PORTF Analog Select) ............................. 136
ANSELG (PORTG Analog Select)............................ 139
APFCON (Alternate Pin Function Control) ............... 118
BAUDCON (Baud Rate Control)............................... 266
BORCON Brown-out Reset Control) .......................... 69
CCPTMRS0 (CCP Timer Selection Control 0) ......... 198
CCPTMRS1 (CCP Timer Selection Control 1) ......... 199
CCPTMRS2 (CCP Timer Selection Control 2) ......... 200
CCPxCON (CCPx Control) ....................................... 197
Configuration Word 1.................................................. 46
Configuration Word 2.................................................. 48
Core Function, Summary............................................ 29
Device ID .................................................................... 50
FVRCON................................................................... 146
INTCON (Interrupt Control)......................................... 80
IOCBF (Interrupt-on-Change PORTB Flag).............. 142
IOCBN (Interrupt-on-Change PORTB
Negative Edge)................................................. 142
IOCBP (Interrupt-on-Change PORTB
Positive Edge) .................................................. 142
LATA (Data Latch PORTA)....................................... 120
LATB (Data Latch PORTB)....................................... 123
LATC (Data Latch PORTC) ...................................... 126
LATD (Data Latch PORTD) ...................................... 129
LATE (Data Latch PORTE)....................................... 132
LATF (Data Latch PORTF) ....................................... 135
LATG (Data Latch PORTG)...................................... 139
OPTION_REG (OPTION) ......................................... 165
OSCCON (Oscillator Control) ..................................... 64
OSCSTAT (Oscillator Status) ..................................... 65
PCON (Power Control) ............................................... 73
PIE1 (Peripheral Interrupt Enable 1)........................... 81
PIE2 (Peripheral Interrupt Enable 2)........................... 82
PIE3 (Peripheral Interrupt Enable 3)........................... 83
PIE4 (Peripheral Interrupt Enable 4)........................... 84
PIR1 (Peripheral Interrupt Register 1) ........................ 85
PIR2 (Peripheral Interrupt Request 2) ........................ 86
PIR3 (Peripheral Interrupt Request 3) ........................ 87
PIR4 (Peripheral Interrupt Request 4) ........................ 88
Preliminary
PIC16(L)F1526/27
PMADRL (Program Memory Address)...................... 114
PMCON1 (Program Memory Control 1).................... 115
PMCON2 (Program Memory Control 2).................... 116
PMDATH (Program Memory Data) ........................... 114
PMDATL (EEPROM Data)........................................ 114
PORTA...................................................................... 120
PORTB...................................................................... 123
PORTC ..................................................................... 126
PORTD ..................................................................... 129
PORTE...................................................................... 132
PORTF...................................................................... 135
PORTG ..................................................................... 138
RCxSTA (Receive Status and Control)..................... 265
Special Function, Summary ........................................ 30
SSPxADD (MSSPx Address and Baud Rate,
I2C Mode) ......................................................... 254
SSPxCON1 (MSSPx Control 1) ................................ 251
SSPxCON2 (SSPx Control 2) ................................... 252
SSPxCON3 (SSPx Control 3) ................................... 253
SSPxMSK (SSPx Mask) ........................................... 254
SSPxSTAT (SSPx Status) ........................................ 249
STATUS...................................................................... 23
TRISA (Tri-State PORTA)......................................... 120
TRISB (Tri-State PORTB)......................................... 123
TRISC (Tri-State PORTC) ........................................ 126
TRISD (Tri-State PORTD) ........................................ 129
TRISE (Tri-State PORTE)......................................... 132
TRISF (Tri-State PORTF) ......................................... 135
TRISG (Tri-State PORTG) ........................................ 138
TXCON ..................................................................... 181
TxCON (Timer1/3/5 Control)..................................... 176
TxGCON (Timer1/3/5 Gate Control) ......................... 177
TXxSTA (Transmit Status and Control) .................... 264
VREGCON (Voltage Regulator Control) ..................... 94
WDTCON (Watchdog Timer Control) ......................... 99
WPUB (Weak Pull-up PORTB) ................................. 124
WPUD (Weak Pull-up PORTD)................................. 130
WPUE (Weak Pull-up PORTE) ................................. 133
RESET .............................................................................. 299
Reset................................................................................... 67
Reset Instruction ................................................................. 70
Resets ................................................................................. 67
Associated Registers .................................................. 74
Revision History ................................................................ 343
S
Software Simulator (MPLAB SIM)..................................... 335
SPBRG ............................................................................. 267
SPBRG Register ................................................................. 31
SPBRGH ........................................................................... 267
Special Event Trigger........................................................ 153
Special Function Registers (SFRs) ..................................... 30
SPI Mode (MSSPx)
Associated Registers ................................................ 211
SPI Clock .................................................................. 207
SSP1CON Register ............................................................ 32
SSP2CON Register ............................................................ 32
SSPADD Register ............................................................... 32
SSPBUF Register ............................................................... 32
SSPSTAT Register ............................................................. 32
SSPxADD Register ........................................................... 254
SSPxCON1 Register......................................................... 251
SSPxCON2 Register......................................................... 252
SSPxCON3 Register......................................................... 253
SSPxMSK Register ........................................................... 254
SSPxOV ............................................................................ 238
T
T1CON Register ................................................................. 30
T2CON Register ........................................................... 30, 35
Temperature Indicator Module.......................................... 147
Thermal Considerations.................................................... 314
Timer0 .............................................................................. 163
Associated Registers................................................ 165
Operation.................................................................. 163
Specifications ........................................................... 321
Timer1 .............................................................................. 167
Specifications ........................................................... 321
Timer1/3/5
Associated registers ................................................. 178
Asynchronous Counter Mode ................................... 170
Reading and Writing ......................................... 170
Clock Source Selection ............................................ 169
Interrupt .................................................................... 172
Operation.................................................................. 169
Operation During Sleep ............................................ 172
Oscillator................................................................... 170
Prescaler .................................................................. 170
Timer1/3/5 Gate
Selecting Source .............................................. 170
TMRxH Register ....................................................... 167
TMRxL Register........................................................ 167
Timer2/4/6/8/10 ................................................................ 179
Associated registers ................................................. 182
Timers
Timer1/3/5
TxCON.............................................................. 176
TxGCON........................................................... 177
Timer2/4/6/8/10
TXCON ............................................................. 181
Timing Diagrams
A/D Conversion ........................................................ 323
A/D Conversion (Sleep Mode).................................. 323
Acknowledge Sequence ........................................... 240
Asynchronous Reception.......................................... 263
Asynchronous Transmission .................................... 258
Asynchronous Transmission (Back to Back) ............ 259
Auto Wake-up Bit (WUE) During Normal Operation. 274
Auto Wake-up Bit (WUE) During Sleep .................... 274
Automatic Baud Rate Calculator .............................. 273
Baud Rate Generator with Clock Arbitration............. 233
BRG Reset Due to SDA Arbitration During Start
Condition .......................................................... 244
Brown-out Reset (BOR)............................................ 319
Brown-out Reset Situations ........................................ 69
Bus Collision During a Repeated Start Condition
(Case 1)............................................................ 245
Bus Collision During a Repeated Start Condition
(Case 2)............................................................ 245
Bus Collision During a Start Condition (SCL = 0) ..... 244
Bus Collision During a Stop Condition (Case 1)....... 246
Bus Collision During a Stop Condition (Case 2)....... 246
Bus Collision During Start Condition (SDA only) ...... 243
Preliminary
DS41458A-page 349
PIC16(L)F1526/27
Bus Collision for Transmit and Acknowledge............ 242
Capture/Compare/PWM (CCP)................................. 321
CLKOUT and I/O....................................................... 317
Clock Synchronization .............................................. 230
Clock Timing ............................................................. 316
Fail-Safe Clock Monitor (FSCM) ................................. 63
First Start Bit Timing ................................................. 234
I2C Bus Data ............................................................. 329
I2C Bus Start/Stop Bits.............................................. 328
I2C Master Mode (7 or 10-Bit Transmission) ............ 237
I2C Master Mode (7-Bit Reception) ........................... 239
I2C Stop Condition Receive or Transmit Mode ......... 241
INT Pin Interrupt.......................................................... 78
Internal Oscillator Switch Timing................................. 58
Repeat Start Condition.............................................. 235
Reset Start-up Sequence............................................ 71
Reset, WDT, OST and Power-up Timer ................... 318
Send Break Character Sequence ............................. 275
SPI Master Mode (CKE = 1, SMP = 1) ..................... 326
SPI Mode (Master Mode) .......................................... 207
SPI Slave Mode (CKE = 0) ....................................... 327
SPI Slave Mode (CKE = 1) ....................................... 327
Synchronous Reception (Master Mode, SREN) ....... 280
Synchronous Transmission....................................... 277
Synchronous Transmission (Through TXEN) ........... 277
Timer0 and Timer1 External Clock ........................... 320
Timer1/3/5 Incrementing Edge.................................. 173
Two Speed Start-up .................................................... 61
USART Synchronous Receive (Master/Slave) ......... 324
USART Synchronous Transmission (Master/Slave) . 324
Wake-up from Interrupt ............................................... 92
Timing Parameter Symbology........................................... 315
Timing Requirements
I2C Bus Data ............................................................. 330
SPI Mode .................................................................. 328
TMR0 Register .................................................................... 30
TMR1H Register ................................................................. 30
TMR1L Register .................................................................. 30
TMR2 Register .............................................................. 30, 35
TRIS .................................................................................. 302
TRISA................................................................................ 119
TRISA Register ........................................................... 30, 120
TRISB................................................................................ 122
TRISB Register ........................................................... 30, 123
TRISC ............................................................................... 125
TRISC Register ........................................................... 30, 126
TRISD ............................................................................... 128
TRISD Register ........................................................... 30, 129
TRISE................................................................................ 131
TRISE Register ........................................................... 30, 132
TRISF................................................................................ 134
TRISF Register ................................................................. 135
TRISG ............................................................................... 137
TRISG Register................................................................. 138
Two-Speed Clock Start-up Mode ........................................ 60
TXCON (Timer2/4/6/8/10) Register................................... 181
TxCON Register................................................................ 176
TxGCON Register ............................................................. 177
TXREG.............................................................................. 257
TXREG Register ................................................................. 31
TXSTA Register .......................................................... 31, 264
BRGH Bit .................................................................. 267
DS41458A-page 350
U
USART
Synchronous Master Mode
Requirements, Synchronous Receive .............. 324
Requirements, Synchronous Transmission...... 324
Timing Diagram, Synchronous Receive ........... 324
Timing Diagram, Synchronous Transmission... 324
V
VREF. SEE ADC Reference Voltage
VREGCON Register ........................................................... 94
W
Wake-up on Break ............................................................ 273
Wake-up Using Interrupts ................................................... 92
Watchdog Timer (WDT)...................................................... 70
Associated Registers ................................................ 100
Configuration Word w/ Watchdog Timer................... 100
Modes ......................................................................... 98
Specifications ........................................................... 320
WCOL ....................................................... 233, 236, 238, 240
WCOL Status Flag.................................... 233, 236, 238, 240
WDTCON Register ............................................................. 99
WPUB Register................................................................. 124
WPUD Register ................................................................ 130
WPUE Register................................................................. 133
Write Protection .................................................................. 49
WWW Address ................................................................. 351
WWW, On-Line Support ....................................................... 9
Preliminary
PIC16(L)F1526/27
THE MICROCHIP WEB SITE
CUSTOMER SUPPORT
Distributor or Representative
Local Sales Office
Field Application Engineer (FAE)
Technical Support
Development Systems Information Line
Customers
should
contact
their
distributor,
representative or field application engineer (FAE) for
support. Local sales offices are also available to help
customers. A listing of sales offices and locations is
included in the back of this document.
Technical support is available through the web site
at: http://support.microchip.com
Preliminary
DS41458A-page 351
PIC16(L)F1526/27
READER RESPONSE
It is our intention to provide you with the best documentation possible to ensure successful use of your Microchip
product. If you wish to provide your comments on organization, clarity, subject matter, and ways in which our
documentation can better serve you, please FAX your comments to the Technical Publications Manager at
(480) 792-4150.
Please list the following information, and use this outline to provide us with your comments about this document.
TO:
RE:
Reader Response
From: Name
Company
Address
City / State / ZIP / Country
Telephone: (_______) _________ - _________
Application (optional):
Would you like a reply?
Device: PIC16(L)F1526/27
Questions:
1. What are the best features of this document?
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?
DS41458A-page 352
Preliminary
PIC16(L)F1526/27
PRODUCT IDENTIFICATION SYSTEM
To order or obtain information, e.g., on pricing or delivery, refer to the factory or the listed sales office.
[X](1)
PART NO.
Device
Device:
/XX
XXX
Package
Pattern
Examples:
a)
b)
PIC16F1526, PIC16LF1526
PIC16F1527, PIC16LF1527
c)
Tape and Reel
Option:
Blank
T
Temperature
Range:
I
E
= -40C to +85C
= -40C to +125C
Package:
MR
PT
Pattern:
=
=
(Industrial)
(Extended)
Preliminary
Note 1:
DS41458A-page 353
ASIA/PACIFIC
ASIA/PACIFIC
EUROPE
Corporate Office
2355 West Chandler Blvd.
Chandler, AZ 85224-6199
Tel: 480-792-7200
Fax: 480-792-7277
Technical Support:
http://support.microchip.com
Web Address:
www.microchip.com
India - Bangalore
Tel: 91-80-3090-4444
Fax: 91-80-3090-4123
India - New Delhi
Tel: 91-11-4160-8631
Fax: 91-11-4160-8632
Austria - Wels
Tel: 43-7242-2244-39
Fax: 43-7242-2244-393
Denmark - Copenhagen
Tel: 45-4450-2828
Fax: 45-4485-2829
India - Pune
Tel: 91-20-2566-1512
Fax: 91-20-2566-1513
France - Paris
Tel: 33-1-69-53-63-20
Fax: 33-1-69-30-90-79
Japan - Yokohama
Tel: 81-45-471- 6166
Fax: 81-45-471-6122
Germany - Munich
Tel: 49-89-627-144-0
Fax: 49-89-627-144-44
Atlanta
Duluth, GA
Tel: 678-957-9614
Fax: 678-957-1455
Boston
Westborough, MA
Tel: 774-760-0087
Fax: 774-760-0088
Chicago
Itasca, IL
Tel: 630-285-0071
Fax: 630-285-0075
Cleveland
Independence, OH
Tel: 216-447-0464
Fax: 216-447-0643
Dallas
Addison, TX
Tel: 972-818-7423
Fax: 972-818-2924
Detroit
Farmington Hills, MI
Tel: 248-538-2250
Fax: 248-538-2260
Kokomo
Kokomo, IN
Tel: 765-864-8360
Fax: 765-864-8387
Los Angeles
Mission Viejo, CA
Tel: 949-462-9523
Fax: 949-462-9608
Santa Clara
Santa Clara, CA
Tel: 408-961-6444
Fax: 408-961-6445
Toronto
Mississauga, Ontario,
Canada
Tel: 905-673-0699
Fax: 905-673-6509
Australia - Sydney
Tel: 61-2-9868-6733
Fax: 61-2-9868-6755
China - Beijing
Tel: 86-10-8528-2100
Fax: 86-10-8528-2104
Korea - Daegu
Tel: 82-53-744-4301
Fax: 82-53-744-4302
China - Chengdu
Tel: 86-28-8665-5511
Fax: 86-28-8665-7889
China - Chongqing
Tel: 86-23-8980-9588
Fax: 86-23-8980-9500
Korea - Seoul
Tel: 82-2-554-7200
Fax: 82-2-558-5932 or
82-2-558-5934
China - Nanjing
Tel: 86-25-8473-2460
Fax: 86-25-8473-2470
Malaysia - Penang
Tel: 60-4-227-8870
Fax: 60-4-227-4068
China - Qingdao
Tel: 86-532-8502-7355
Fax: 86-532-8502-7205
Philippines - Manila
Tel: 63-2-634-9065
Fax: 63-2-634-9069
China - Shanghai
Tel: 86-21-5407-5533
Fax: 86-21-5407-5066
Singapore
Tel: 65-6334-8870
Fax: 65-6334-8850
China - Shenyang
Tel: 86-24-2334-2829
Fax: 86-24-2334-2393
China - Shenzhen
Tel: 86-755-8203-2660
Fax: 86-755-8203-1760
Taiwan - Kaohsiung
Tel: 886-7-213-7830
Fax: 886-7-330-9305
China - Wuhan
Tel: 86-27-5980-5300
Fax: 86-27-5980-5118
Taiwan - Taipei
Tel: 886-2-2500-6610
Fax: 886-2-2508-0102
China - Xian
Tel: 86-29-8833-7252
Fax: 86-29-8833-7256
Thailand - Bangkok
Tel: 66-2-694-1351
Fax: 66-2-694-1350
Italy - Milan
Tel: 39-0331-742611
Fax: 39-0331-466781
Netherlands - Drunen
Tel: 31-416-690399
Fax: 31-416-690340
Spain - Madrid
Tel: 34-91-708-08-90
Fax: 34-91-708-08-91
UK - Wokingham
Tel: 44-118-921-5869
Fax: 44-118-921-5820
China - Xiamen
Tel: 86-592-2388138
Fax: 86-592-2388130
China - Zhuhai
Tel: 86-756-3210040
Fax: 86-756-3210049
08/04/10
DS41458A-page 354
Preliminary