Professional Documents
Culture Documents
PIC12 (L) F1822/PIC16 (L) F1823 Data Sheet: 8/14-Pin Flash Microcontrollers With XLP Technology
PIC12 (L) F1822/PIC16 (L) F1823 Data Sheet: 8/14-Pin Flash Microcontrollers With XLP Technology
PIC12 (L) F1822/PIC16 (L) F1823 Data Sheet: 8/14-Pin Flash Microcontrollers With XLP Technology
Data Sheet
8/14-Pin Flash Microcontrollers
with XLP Technology
• 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 Microchip’s 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 Microchip’s 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.
ISBN: 9781620762950
QUALITY MANAGEMENT SYSTEM Microchip received ISO/TS-16949:2009 certification for its worldwide
CERTIFIED BY DNV headquarters, design and wafer fabrication facilities in Chandler and
Tempe, Arizona; Gresham, Oregon and design centers in California
and India. The Company’s quality system processes and procedures
== ISO/TS 16949 == are for its PIC® MCUs and dsPIC® DSCs, KEELOQ® code hopping
devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchip’s quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.
ECCP (Half-Bridge)
ECCP (Full-Bridge)
Program Memory
MSSP (I2C™/SPI)
Data Sheet Index
CapSense (ch)
Data EEPROM
Flash (words)
Comparators
Data SRAM
SR Latch
(8/16-bit)
EUSART
Debug(1)
(bytes)
(bytes)
Timers
I/O’s(2)
CCP
XLP
Device
Note: For other small form-factor package availability and marking information, please visit
www.microchip.com/packaging or contact your local sales office.
VDD 1 8 VSS
PIC12(L)F1822
RA5 2 7 RA0/ICSPDAT
RA4 3 6 RA1/ICSPCLK
MCLR/VPP/RA3 4 5 RA2
Comparator
Cap Sense
Modulator
Reference
SR Latch
Interrupt
EUSART
Pull-up
Timers
MSSP
ECCP
Basic
A/D
I/O
RA0 7 AN0 DACOUT CPS0 C1IN+ — — P1B(1) TX(1) SDO(1) IOC MDOUT Y ICSPDAT
CK(1) SS(1) ICDDAT
RA1 6 AN1 VREF+ CPS1 C1IN0- SRI — — RX(1) SCL IOC MDMIN Y ICSPCLK
DT(1) SCK ICPCLK
RA2 5 AN2 — CPS2 C1OUT SRQ T0CKI CCP1(1) — SDA INT/ MDCIN1 Y —
P1A(1) SDI IOC
FLT0
RA3 4 — — — — — T1G(1) — — SS(1) IOC — Y MCLR
VPP
RA4 3 AN3 — CPS3 C1IN1- — T1G(1) P1B(1) TX(1) SDO(1) IOC MDCIN2 Y OSC2
T1OSO CK(1) CLKOUT
CLKR
RA5 2 — — — — SRNQ T1CKI CCP1(1) RX(1) — IOC — Y OSC1
T1OSI P1A(1) DT(1) CLKIN
VDD 1 — — — — — — — — — — — — VDD
VSS 8 — — — — — — — — — — — — VSS
Note 1: Pin function is selectable via the APFCON register.
VDD 1 14 VSS
RA5 2 13 RA0/ICSPDAT
PIC16(L)F1823
RA4 3 12 RA1/ICSPCLK
MCLR/VPP/RA3 4 11 RA2
RC5 5 10 RC0
RC4 6 9 RC1
RC3 7 8 RC2
QFN
VDD
VSS
NC
NC
16
15
14
13
RA5 1 12 RA0/ICSPDAT
RA4 2 11 RA1/ICSPCLK
PIC16(L)F1823
MCLR/VPP/RA3 3 10 RA2
RC5 4 9 RC0
5
RC3 6
RC2 7
RC1 8
RC4
14-Pin PDIP/SOIC/TSSOP
Comparator
16-Pin QFN
Cap Sense
Modulator
Reference
SR Latch
EUSART
Interrupt
Pull-up
Timers
MSSP
ECCP
Basic
A/D
I/O
Errata
An errata sheet, describing minor operational differences from the data sheet and recommended workarounds, may exist for current
devices. As device/documentation issues become known to us, we will publish an errata sheet. The errata will specify the revision
of silicon and revision of document to which it applies.
To determine if an errata sheet exists for a particular device, please check with one of the following:
• Microchip’s Worldwide Web site; http://www.microchip.com
• Your local Microchip sales office (see last page)
When contacting a sales office, please specify which device, revision of silicon and data sheet (include literature number) you are
using.
PIC12(L)F1822
PIC16(L)F1823
Peripheral
ADC ● ●
Capacitive Sensing (CPS) Module ● ●
Data EEPROM ● ●
Digital-to-Analog Converter (DAC) ● ●
Digital Signal Modulator (DSM) ● ●
EUSART ● ●
Fixed Voltage Reference (FVR) ● ●
SR Latch ● ●
Capture/Compare/PWM Modules
ECCP1 ● ●
Comparators
C1 ● ●
C2 ●
Master Synchronous Serial Ports
MSSP ● ●
Timers
Timer0 ● ●
Timer1 ● ●
Timer2 ● ●
Program
Flash Memory
RAM EEPROM
CLKR
Clock
Reference
OSC2/CLKOUT Timing
Generation
PORTA
OSC1/CLKIN INTRC
CPU
Oscillator
(Figure 2-1)
PORTC(3)
MCLR
SR ADC
Timer0 Timer1 10-Bit DAC Comparators
Latch
15 Configuration
15 Data Bus 8
Program Counter
Flash
MUX
Program
Memory 16-Level
8 Level Stack
Stack
RAM
(13-bit)
(15-bit)
Program
14 Program Memory 12 RAM Addr
Bus
Read (PMR)
Addr MUX
Instruction
Instruction Reg
reg Indirect
Direct Addr 7 Addr
5 12 12
15 BSR
FSR Reg
reg
FSR0reg
FSR Reg
FSR1 Reg
FSR reg
15 STATUS Reg
STATUS reg
8
3 MUX
Power-up
Timer
Instruction Oscillator
Decodeand
Decode & Start-up Timer
ALU
Control
OSC1/CLKIN Power-on
Reset 8
Timing Watchdog
OSC2/CLKOUT Generation Timer W Reg
Brown-out
Reset
Internal
Oscillator
Block
VDD VSS
0800h
Rollover to Page 0
Wraps to Page 0 my_function
;… LOTS OF CODE…
MOVLW DATA_INDEX
CALL constants
Wraps to Page 0
;… THE CONSTANT IS IN W
Rollover to Page 0
7FFFh
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared q = Value depends on condition
Note 1: For Borrow, the polarity is reversed. A subtraction is executed by adding the two’s complement of the
second operand.
00h
Core Registers
(12 bytes)
0Bh
0Ch
Special Function Registers
(20 bytes maximum)
1Fh
20h
6Fh
70h
Common RAM
(16 bytes)
7Fh
PIC12(L)F1822/PIC16(L)F1823
BANK 0 BANK 1 BANK 2 BANK 3 BANK 4 BANK 5 BANK 6 BANK 7
000h INDF0 080h INDF0 100h INDF0 180h INDF0 200h INDF0 280h INDF0 300h INDF0 380h INDF0
001h INDF1 081h INDF1 101h INDF1 181h INDF1 201h INDF1 281h INDF1 301h INDF1 381h INDF1
002h PCL 082h PCL 102h PCL 182h PCL 202h PCL 282h PCL 302h PCL 382h PCL
003h STATUS 083h STATUS 103h STATUS 183h STATUS 203h STATUS 283h STATUS 303h STATUS 383h STATUS
004h FSR0L 084h FSR0L 104h FSR0L 184h FSR0L 204h FSR0L 284h FSR0L 304h FSR0L 384h FSR0L
005h FSR0H 085h FSR0H 105h FSR0H 185h FSR0H 205h FSR0H 285h FSR0H 305h FSR0H 385h FSR0H
006h FSR1L 086h FSR1L 106h FSR1L 186h FSR1L 206h FSR1L 286h FSR1L 306h FSR1L 386h FSR1L
007h FSR1H 087h FSR1H 107h FSR1H 187h FSR1H 207h FSR1H 287h FSR1H 307h FSR1H 387h FSR1H
008h BSR 088h BSR 108h BSR 188h BSR 208h BSR 288h BSR 308h BSR 388h BSR
009h WREG 089h WREG 109h WREG 189h WREG 209h WREG 289h WREG 309h WREG 389h WREG
00Ah PCLATH 08Ah PCLATH 10Ah PCLATH 18Ah PCLATH 20Ah PCLATH 28Ah PCLATH 30Ah PCLATH 38Ah PCLATH
00Bh INTCON 08Bh INTCON 10Bh INTCON 18Bh INTCON 20Bh INTCON 28Bh INTCON 30Bh INTCON 38Bh INTCON
00Ch PORTA 08Ch TRISA 10Ch LATA 18Ch ANSELA 20Ch WPUA 28Ch — 30Ch — 38Ch —
00Dh — 08Dh — 10Dh — 18Dh — 20Dh — 28Dh — 30Dh — 38Dh —
00Eh PORTC(1) 08Eh TRISC(1) 10Eh LATC(1) 18Eh ANSELC(1) 20Eh WPUC(1) 28Eh — 30Eh — 38Eh —
00Fh — 08Fh — 10Fh — 18Fh — 20Fh — 28Fh — 30Fh — 38Fh —
010h — 090h — 110h — 190h — 210h — 290h — 310h — 390h —
011h PIR1 091h PIE1 111h CM1CON0 191h EEADRL 211h SSP1BUF 291h CCPR1L 311h — 391h IOCAP
012h PIR2 092h PIE2 112h CM1CON1 192h EEADRH 212h SSP1ADD 292h CCPR1H 312h — 392h IOCAN
013h — 093h — 113h CM2CON0(1) 193h EEDATL 213h SSP1MASK 293h CCP1CON 313h — 393h IOCAF
014h — 094h — 114h CM2CON1(1) 194h EEDATH 214h SSP1STAT 294h PWM1CON 314h — 394h —
015h TMR0 095h OPTION 115h CMOUT 195h EECON1 215h SSP1CON 295h CCP1AS 315h — 395h —
016h TMR1L 096h PCON 116h BORCON 196h EECON2 216h SSP1CON2 296h PSTR1CON 316h — 396h —
017h TMR1H 097h WDTCON 117h FVRCON 197h — 217h SSP1CON3 297h — 317h — 397h —
018h T1CON 098h OSCTUNE 118h DACCON0 198h — 218h — 298h — 318h — 398h —
019h T1GCON 099h OSCCON 119h DACCON1 199h RCREG 219h — 299h — 319h — 399h —
01Ah TMR2 09Ah OSCSTAT 11Ah SRCON0 19Ah TXREG 21Ah — 29Ah — 31Ah — 39Ah CLKRCON
01Bh PR2 09Bh ADRESL 11Bh SRCON1 19Bh SPBRGL 21Bh — 29Bh — 31Bh — 39Bh —
01Ch T2CON 09Ch ADRESH 11Ch — 19Ch SPBRGH 21Ch — 29Ch — 31Ch — 39Ch MDCON
01Dh — 09Dh ADCON0 11Dh APFCON 19Dh RCSTA 21Dh — 29Dh — 31Dh — 39Dh MDSRC
01Eh CPSCON0 09Eh ADCON1 11Eh — 19Eh TXSTA 21Eh — 29Eh — 31Eh — 39Eh MDCARL
01Fh CPSCON1 09Fh — 11Fh — 19Fh BAUDCON 21Fh — 29Fh — 31Fh — 39Fh MDCARH
020h 0A0h General 120h 1A0h 220h 2A0h 320h 3A0h
Purpose
General Register
Purpose 0BFh Unimplemented Unimplemented Unimplemented Unimplemented Unimplemented Unimplemented
2010-2012 Microchip Technology Inc.
32 Bytes
Register 0CFh Read as ‘0’ Read as ‘0’ Read as ‘0’ Read as ‘0’ Read as ‘0’ Read as ‘0’
80 Bytes Unimplemented
Read as ‘0’
06Fh 0EFh 16Fh 1EFh 26Fh 2EFh 36Fh 3EFh
070h 0F0h 170h 1F0h 270h 2F0h 370h 3F0h
Accesses Accesses Accesses Accesses Accesses Accesses Accesses
Common RAM
70h – 7Fh 70h – 7Fh 70h – 7Fh 70h – 7Fh 70h – 7Fh 70h – 7Fh 70h – 7Fh
07Fh 0FFh 17Fh 1FFh 27Fh 2FFh 37Fh 3FFh
PIC12(L)F1822/PIC16(L)F1823
40Eh — 48Eh — 50Eh — 58Eh — 60Eh — 68Eh — 70Eh — 78Eh —
40Fh — 48Fh — 50Fh — 58Fh — 60Fh — 68Fh — 70Fh — 78Fh —
410h — 490h — 510h — 590h — 610h — 690h — 710h — 790h —
411h — 491h — 511h — 591h — 611h — 691h — 711h — 791h —
412h — 492h — 512h — 592h — 612h — 692h — 712h — 792h —
413h — 493h — 513h — 593h — 613h — 693h — 713h — 793h —
414h — 494h — 514h — 594h — 614h — 694h — 714h — 794h —
415h — 495h — 515h — 595h — 615h — 695h — 715h — 795h —
416h — 496h — 516h — 596h — 616h — 696h — 716h — 796h —
417h — 497h — 517h — 597h — 617h — 697h — 717h — 797h —
418h — 498h — 518h — 598h — 618h — 698h — 718h — 798h —
419h — 499h — 519h — 599h — 619h — 699h — 719h — 799h —
41Ah — 49Ah — 51Ah — 59Ah — 61Ah — 69Ah — 71Ah — 79Ah —
41Bh — 49Bh — 51Bh — 59Bh — 61Bh — 69Bh — 71Bh — 79Bh —
41Ch — 49Ch — 51Ch — 59Ch — 61Ch — 69Ch — 71Ch — 79Ch —
41Dh — 49Dh — 51Dh — 59Dh — 61Dh — 69Dh — 71Dh — 79Dh —
41Eh — 49Eh — 51Eh — 59Eh — 61Eh — 69Eh — 71Eh — 79Eh —
41Fh — 49Fh — 51Fh — 59Fh — 61Fh — 69Fh — 71Fh — 79Fh —
420h 4A0h 520h 5A0h 620h 6A0h 720h 7A0h
PIC12(L)F1822/PIC16(L)F1823
BANK 16 BANK 17 BANK 18 BANK 19 BANK 20 BANK 21 BANK 22 BANK 23
800h INDF0 880h INDF0 900h INDF0 980h INDF0 A00h INDF0 A80h INDF0 B00h INDF0 B80h INDF0
801h INDF1 881h INDF1 901h INDF1 981h INDF1 A01h INDF1 A81h INDF1 B01h INDF1 B81h INDF1
802h PCL 882h PCL 902h PCL 982h PCL A02h PCL A82h PCL B02h PCL B82h PCL
803h STATUS 883h STATUS 903h STATUS 983h STATUS A03h STATUS A83h STATUS B03h STATUS B83h STATUS
804h FSR0L 884h FSR0L 904h FSR0L 984h FSR0L A04h FSR0L A84h FSR0L B04h FSR0L B84h FSR0L
805h FSR0H 885h FSR0H 905h FSR0H 985h FSR0H A05h FSR0H A85h FSR0H B05h FSR0H B85h FSR0H
806h FSR1L 886h FSR1L 906h FSR1L 986h FSR1L A06h FSR1L A86h FSR1L B06h FSR1L B86h FSR1L
807h FSR1H 887h FSR1H 907h FSR1H 987h FSR1H A07h FSR1H A87h FSR1H B07h FSR1H B87h FSR1H
808h BSR 888h BSR 908h BSR 988h BSR A08h BSR A88h BSR B08h BSR B88h BSR
809h WREG 889h WREG 909h WREG 989h WREG A09h WREG A89h WREG B09h WREG B89h WREG
80Ah PCLATH 88Ah PCLATH 90Ah PCLATH 98Ah PCLATH A0Ah PCLATH A8Ah PCLATH B0Ah PCLATH B8Ah PCLATH
80Bh INTCON 88Bh INTCON 90Bh INTCON 98Bh INTCON A0Bh INTCON A8Bh INTCON B0Bh INTCON B8Bh INTCON
80Ch — 88Ch — 90Ch — 98Ch — A0Ch — A8Ch — B0Ch — B8Ch —
80Dh — 88Dh — 90Dh — 98Dh — A0Dh — A8Dh — B0Dh — B8Dh —
80Eh — 88Eh — 90Eh — 98Eh — A0Eh — A8Eh — B0Eh — B8Eh —
80Fh — 88Fh — 90Fh — 98Fh — A0Fh — A8Fh — B0Fh — B8Fh —
810h — 890h — 910h — 990h — A10h — A90h — B10h — B90h —
811h — 891h — 911h — 991h — A11h — A91h — B11h — B91h —
812h — 892h — 912h — 992h — A12h — A92h — B12h — B92h —
813h — 893h — 913h — 993h — A13h — A93h — B13h — B93h —
814h — 894h — 914h — 994h — A14h — A94h — B14h — B94h —
815h — 895h — 915h — 995h — A15h — A95h — B15h — B95h —
816h — 896h — 916h — 996h — A16h — A96h — B16h — B96h —
817h — 897h — 917h — 997h — A17h — A97h — B17h — B97h —
818h — 898h — 918h — 998h — A18h — A98h — B18h — B98h —
819h — 899h — 919h — 999h — A19h — A99h — B19h — B99h —
81Ah — 89Ah — 91Ah — 99Ah — A1Ah — A9Ah — B1Ah — B9Ah —
81Bh — 89Bh — 91Bh — 99Bh — A1Bh — A9Bh — B1Bh — B9Bh —
81Ch — 89Ch — 91Ch — 99Ch — A1Ch — A9Ch — B1Ch — B9Ch —
81Dh — 89Dh — 91Dh — 99Dh — A1Dh — A9Dh — B1Dh — B9Dh —
81Eh — 89Eh — 91Eh — 99Eh — A1Eh — A9Eh — B1Eh — B9Eh —
2010-2012 Microchip Technology Inc.
PIC12(L)F1822/PIC16(L)F1823
C0Eh — C8Eh — D0Eh — D8Eh — E0Eh — E8Eh — F0Eh — F8Eh
C0Fh — C8Fh — D0Fh — D8Fh — E0Fh — E8Fh — F0Fh — F8Fh
C10h — C90h — D10h — D90h — E10h — E90h — F10h — F90h
C11h — C91h — D11h — D91h — E11h — E91h — F11h — F91h
C12h — C92h — D12h — D92h — E12h — E92h — F12h — F92h
C13h — C93h — D13h — D93h — E13h — E93h — F13h — F93h
C14h — C94h — D14h — D94h — E14h — E94h — F14h — F94h
C15h — C95h — D15h — D95h — E15h — E95h — F15h — F95h
C16h — C96h — D16h — D96h — E16h — E96h — F16h — F96h
C17h — C97h — D17h — D97h — E17h — E97h — F17h — F97h
See Table 3-7 for
C18h — C98h — D18h — D98h — E18h — E98h — F18h — F98h register mapping
C19h — C99h — D19h — D99h — E19h — E99h — F19h — F99h details
C1Ah — C9Ah — D1Ah — D9Ah — E1Ah — E9Ah — F1Ah — F9Ah
C1Bh — C9Bh — D1Bh — D9Bh — E1Bh — E9Bh — F1Bh — F9Bh
C1Ch — C9Ch — D1Ch — D9Ch — E1Ch — E9Ch — F1Ch — F9Ch
C1Dh — C9Dh — D1Dh — D9Dh — E1Dh — E9Dh — F1Dh — F9Dh
C1Eh — C9Eh — D1Eh — D9Eh — E1Eh — E9Eh — F1Eh — F9Eh
C1Fh — C9Fh — D1Fh — D9Fh — E1Fh — E9Fh — F1Fh — F9Fh
C20h CA0h D20h DA0h E20h EA0h F20h FA0h
Bank 1
080h(1) INDF0 Addressing this location uses contents of FSR0H/FSR0L to address data memory xxxx xxxx xxxx xxxx
(not a physical register)
081h(1) INDF1 Addressing this location uses contents of FSR1H/FSR1L to address data memory xxxx xxxx xxxx xxxx
(not a physical register)
082h(1) PCL Program Counter (PC) Least Significant Byte 0000 0000 0000 0000
083h(1) STATUS — — — TO PD Z DC C ---1 1000 ---q quuu
084h(1) FSR0L Indirect Data Memory Address 0 Low Pointer 0000 0000 uuuu uuuu
085h(1) FSR0H Indirect Data Memory Address 0 High Pointer 0000 0000 0000 0000
086h(1) FSR1L Indirect Data Memory Address 1 Low Pointer 0000 0000 uuuu uuuu
087h(1) FSR1H Indirect Data Memory Address 1 High Pointer 0000 0000 0000 0000
088h(1) BSR — — — BSR<4:0> ---0 0000 ---0 0000
089h(1) WREG Working Register 0000 0000 uuuu uuuu
08Ah(1) PCLATH — Write Buffer for the upper 7 bits of the Program Counter -000 0000 -000 0000
08Bh(1) INTCON GIE PEIE TMR0IE INTE IOCIE TMR0IF INTF IOCIF 0000 000x 0000 000u
08Ch TRISA — — TRISA5 TRISA4 TRISA3 TRISA2 TRISA1 TRISA0 --11 1111 --11 1111
08Dh — Unimplemented — —
08Eh TRISC(2) — — TRISC5 TRISC4 TRISC3 TRISC2 TRISC1 TRISC0 --11 1111 --11 1111
08Fh — Unimplemented — —
090h — Unimplemented — —
091h PIE1 TMR1GIE ADIE RCIE TXIE SSP1IE CCP1IE TMR2IE TMR1IE 0000 0000 0000 0000
092h PIE2 OSFIE C2IE(2) C1IE EEIE BCL1IE — — — 0000 0--- 0000 0---
093h — Unimplemented — —
094h — Unimplemented — —
095h OPTION_REG WPUEN INTEDG TMR0CS TMR0SE PSA PS<2:0> 1111 1111 1111 1111
096h PCON STKOVF STKUNF — — RMCLR RI POR BOR 00-- 11qq qq-- qquu
097h WDTCON — — WDTPS<4:0> SWDTEN --01 0110 --01 0110
098h OSCTUNE — — TUN<5:0> --00 0000 --00 0000
099h OSCCON SPLLEN IRCF<3:0> — SCS<1:0> 0011 1-00 0011 1-00
09Ah OSCSTAT T1OSCR PLLR OSTS HFIOFR HFIOFL MFIOFR LFIOFR HFIOFS 10q0 0q00 qqqq qq0q
09Bh ADRESL A/D Result Register Low xxxx xxxx uuuu uuuu
09Ch ADRESH A/D Result Register High xxxx xxxx uuuu uuuu
09Dh ADCON0 — CHS<4:0> GO/DONE ADON -000 0000 -000 0000
09Eh ADCON1 ADFM ADCS<2:0> — — ADPREF<1:0> 0000 --00 0000 --00
09Fh — Unimplemented — —
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented, r = reserved.
Shaded locations are unimplemented, read as ‘0’.
Note 1: These registers can be addressed from any bank.
2: PIC16(L)F1823 only.
3: Unimplemented. Read as ‘1’.
Bank 2
100h(1) INDF0 Addressing this location uses contents of FSR0H/FSR0L to address data memory xxxx xxxx xxxx xxxx
(not a physical register)
101h(1) INDF1 Addressing this location uses contents of FSR1H/FSR1L to address data memory xxxx xxxx xxxx xxxx
(not a physical register)
102h(1) PCL Program Counter (PC) Least Significant Byte 0000 0000 0000 0000
103h(1) STATUS — — — TO PD Z DC C ---1 1000 ---q quuu
104h(1) FSR0L Indirect Data Memory Address 0 Low Pointer 0000 0000 uuuu uuuu
105h(1) FSR0H Indirect Data Memory Address 0 High Pointer 0000 0000 0000 0000
106h(1) FSR1L Indirect Data Memory Address 1 Low Pointer 0000 0000 uuuu uuuu
107h(1) FSR1H Indirect Data Memory Address 1 High Pointer 0000 0000 0000 0000
108h(1) BSR — — — BSR<4:0> ---0 0000 ---0 0000
109h(1) WREG Working Register 0000 0000 uuuu uuuu
10Ah(1) PCLATH — Write Buffer for the upper 7 bits of the Program Counter -000 0000 -000 0000
10Bh(1) INTCON GIE PEIE TMR0IE INTE IOCIE TMR0IF INTF IOCIF 0000 000x 0000 000u
10Ch LATA — — LATA5 LATA4 — LATA2 LATA1 LATA0 --xx -xxx --uu -uuu
10Dh — Unimplemented — —
10Eh LATC(2) — — LATC5 LATC4 LATC3 LATC2 LATC1 LATC0 --xx xxxx --uu uuuu
10Fh — Unimplemented — —
110h — Unimplemented — —
111h CM1CON0 C1ON C1OUT C1OE C1POL — C1SP C1HYS C1SYNC 0000 -100 0000 -100
112h CM1CON1 C1INTP C1INTN C1PCH<1:0> — — C1NCH1(2) C1NCH0 0000 ---0 0000 ---0
(2)
113h CM2CON0 C2ON C2OUT C2OE C2POL — C2SP C2HYS C2SYNC 0000 -100 0000 -100
114h CM2CON1(2) C2INTP C2INTN C2PCH<1:0> — — C2NCH<1:0> 0000 --00 0000 --00
115h CMOUT — — — — — — MC2OUT(2) MC1OUT ---- --00 ---- --00
116h BORCON SBOREN — — — — — — BORRDY 1--- ---q u--- ---u
117h FVRCON FVREN FVRRDY TSEN TSRNG CDAFVR<1:0> ADFVR<1:0> 0q00 0000 0q00 0000
118h DACCON0 DACEN DACLPS DACOE — DACPSS<1:0> — — 000- 00-- 000- 00--
119h DACCON1 — — — DACR<4:0> ---0 0000 ---0 0000
11Ah SRCON0 SRLEN SRCLK<2:0> SRQEN SRNQEN SRPS SRPR 0000 0000 0000 0000
11Bh SRCON1 SRSPE SRSCKE SRSC2E(2) SRSC1E SRRPE SRRCKE SRRC2E SRRC1E 0000 0000 0000 0000
(2)
11Ch — Unimplemented — —
11Dh APFCON RXDTSEL SDOSEL SSSEL --- T1GSEL TXCKSEL P1BSEL CCP1SEL 000- 0000 000- 0000
11Eh — Unimplemented — —
11Fh — Unimplemented — —
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented, r = reserved.
Shaded locations are unimplemented, read as ‘0’.
Note 1: These registers can be addressed from any bank.
2: PIC16(L)F1823 only.
3: Unimplemented. Read as ‘1’.
Bank 3
180h(1) INDF0 Addressing this location uses contents of FSR0H/FSR0L to address data memory xxxx xxxx xxxx xxxx
(not a physical register)
181h(1) INDF1 Addressing this location uses contents of FSR1H/FSR1L to address data memory xxxx xxxx xxxx xxxx
(not a physical register)
182h(1) PCL Program Counter (PC) Least Significant Byte 0000 0000 0000 0000
183h(1) STATUS — — — TO PD Z DC C ---1 1000 ---q quuu
184h(1) FSR0L Indirect Data Memory Address 0 Low Pointer 0000 0000 uuuu uuuu
185h(1) FSR0H Indirect Data Memory Address 0 High Pointer 0000 0000 0000 0000
186h(1) FSR1L Indirect Data Memory Address 1 Low Pointer 0000 0000 uuuu uuuu
187h(1) FSR1H Indirect Data Memory Address 1 High Pointer 0000 0000 0000 0000
188h(1) BSR — — — BSR<4:0> ---0 0000 ---0 0000
189h(1) WREG Working Register 0000 0000 uuuu uuuu
18Ah(1) PCLATH — Write Buffer for the upper 7 bits of the Program Counter -000 0000 -000 0000
18Bh(1) INTCON GIE PEIE TMR0IE INTE IOCIE TMR0IF INTF IOCIF 0000 000x 0000 000u
18Ch ANSELA — — — ANSA4 — ANSA2 ANSA1 ANSA0 ---1 -111 ---1 -111
18Dh — Unimplemented — —
18Eh ANSELC(2) — — — — ANSC3 ANSC2 ANSC1 ANSC0 ---- 1111 ---- 1111
18Fh — Unimplemented — —
190h — Unimplemented — —
191h EEADRL EEPROM / Program Memory Address Register Low Byte 0000 0000 0000 0000
192h EEADRH —(3) EEPROM / Program Memory Address Register High Byte 1000 0000 1000 0000
193h EEDATL EEPROM / Program Memory Read Data Register Low Byte xxxx xxxx uuuu uuuu
194h EEDATH — — EEPROM / Program Memory Read Data Register High Byte --xx xxxx --uu uuuu
195h EECON1 EEPGD CFGS LWLO FREE WRERR WREN WR RD 0000 x000 0000 q000
196h EECON2 EEPROM control register 2 0000 0000 0000 0000
197h — Unimplemented — —
198h — Unimplemented — —
199h RCREG USART Receive Data Register 0000 0000 0000 0000
19Ah TXREG USART Transmit Data Register 0000 0000 0000 0000
19Bh SPBRGL Baud Rate Generator Data Register Low 0000 0000 0000 0000
19Ch SPBRGH Baud Rate Generator Data Register High 0000 0000 0000 0000
19Dh RCSTA SPEN RX9 SREN CREN ADDEN FERR OERR RX9D 0000 000x 0000 000x
19Eh TXSTA CSRC TX9 TXEN SYNC SENDB BRGH TRMT TX9D 0000 0010 0000 0010
19Fh BAUDCON ABDOVF RCIDL — SCKP BRG16 — WUE ABDEN 01-0 0-00 01-0 0-00
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented, r = reserved.
Shaded locations are unimplemented, read as ‘0’.
Note 1: These registers can be addressed from any bank.
2: PIC16(L)F1823 only.
3: Unimplemented. Read as ‘1’.
Bank 4
200h(1) INDF0 Addressing this location uses contents of FSR0H/FSR0L to address data memory xxxx xxxx xxxx xxxx
(not a physical register)
201h(1) INDF1 Addressing this location uses contents of FSR1H/FSR1L to address data memory xxxx xxxx xxxx xxxx
(not a physical register)
202h(1) PCL Program Counter (PC) Least Significant Byte 0000 0000 0000 0000
203h(1) STATUS — — — TO PD Z DC C ---1 1000 ---q quuu
204h(1) FSR0L Indirect Data Memory Address 0 Low Pointer 0000 0000 uuuu uuuu
205h(1) FSR0H Indirect Data Memory Address 0 High Pointer 0000 0000 0000 0000
206h(1) FSR1L Indirect Data Memory Address 1 Low Pointer 0000 0000 uuuu uuuu
207h(1) FSR1H Indirect Data Memory Address 1 High Pointer 0000 0000 0000 0000
208h(1) BSR — — — BSR<4:0> ---0 0000 ---0 0000
209h(1) WREG Working Register 0000 0000 uuuu uuuu
20Ah(1) PCLATH — Write Buffer for the upper 7 bits of the Program Counter -000 0000 -000 0000
20Bh(1) INTCON GIE PEIE TMR0IE INTE IOCIE TMR0IF INTF IOCIF 0000 000x 0000 000u
20Ch WPUA — — WPUA5 WPUA4 WPUA3 WPUA2 WPUA1 WPUA0 --11 1111 --11 1111
20Dh — Unimplemented — —
20Eh WPUC(2) — — WPUC5 WPUC4 WPUC3 WPUC2 WPUC1 WPUC0 --11 1111 --11 1111
20Fh — Unimplemented — —
210h — Unimplemented — —
211h SSP1BUF Synchronous Serial Port Receive Buffer/Transmit Register xxxx xxxx uuuu uuuu
212h SSP1ADD ADD<7:0> 0000 0000 0000 0000
213h SSP1MSK MSK<7:0> 1111 1111 1111 1111
214h SSP1STAT SMP CKE D/A P S R/W UA BF 0000 0000 0000 0000
215h SSP1CON1 WCOL SSPOV SSPEN CKP SSPM<3:0> 0000 0000 0000 0000
216h SSP1CON2 GCEN ACKSTAT ACKDT ACKEN RCEN PEN RSEN SEN 0000 0000 0000 0000
217h SSP1CON3 ACKTIM PCIE SCIE BOEN SDAHT SBCDE AHEN DHEN 0000 0000 0000 0000
218h — Unimplemented — —
219h — Unimplemented — —
21Ah — Unimplemented — —
21Bh — Unimplemented — —
21Ch — Unimplemented — —
21Dh — Unimplemented — —
21Eh — Unimplemented — —
21Fh — Unimplemented — —
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented, r = reserved.
Shaded locations are unimplemented, read as ‘0’.
Note 1: These registers can be addressed from any bank.
2: PIC16(L)F1823 only.
3: Unimplemented. Read as ‘1’.
Bank 5
280h(1) INDF0 Addressing this location uses contents of FSR0H/FSR0L to address data memory xxxx xxxx xxxx xxxx
(not a physical register)
281h(1) INDF1 Addressing this location uses contents of FSR1H/FSR1L to address data memory xxxx xxxx xxxx xxxx
(not a physical register)
282h(1) PCL Program Counter (PC) Least Significant Byte 0000 0000 0000 0000
283h(1) STATUS — — — TO PD Z DC C ---1 1000 ---q quuu
284h(1) FSR0L Indirect Data Memory Address 0 Low Pointer 0000 0000 uuuu uuuu
285h(1) FSR0H Indirect Data Memory Address 0 High Pointer 0000 0000 0000 0000
286h(1) FSR1L Indirect Data Memory Address 1 Low Pointer 0000 0000 uuuu uuuu
287h(1) FSR1H Indirect Data Memory Address 1 High Pointer 0000 0000 0000 0000
288h(1) BSR — — — BSR<4:0> ---0 0000 ---0 0000
289h(1) WREG Working Register 0000 0000 uuuu uuuu
28Ah(1) PCLATH — Write Buffer for the upper 7 bits of the Program Counter -000 0000 -000 0000
28Bh(1) INTCON GIE PEIE TMR0IE INTE IOCIE TMR0IF INTF IOCIF 0000 000x 0000 000u
28Ch — Unimplemented — —
28Dh — Unimplemented — —
28Eh — Unimplemented — —
28Fh — Unimplemented — —
290h — Unimplemented — —
291h CCPR1L Capture/Compare/PWM Register 1 (LSB) xxxx xxxx uuuu uuuu
292h CCPR1H Capture/Compare/PWM Register 1 (MSB) xxxx xxxx uuuu uuuu
293h CCP1CON P1M<1:0> DC1B<1:0> CCP1M<3:0> 0000 0000 0000 0000
294h PWM1CON P1RSEN P1DC<6:0> 0000 0000 0000 0000
295h CCP1AS CCP1ASE CCP1AS<2:0> PSS1AC<1:0> PSS1BD<1:0> 0000 0000 0000 0000
296h PSTR1CON — — — STR1SYNC STR1D STR1C STR1B STR1A ---0 0001 ---0 0001
297h — Unimplemented — —
298h — Unimplemented — —
299h — Unimplemented — —
29Ah — Unimplemented — —
29Bh — Unimplemented — —
29Ch — Unimplemented — —
29Dh — Unimplemented — —
29Eh — Unimplemented — —
29Fh — Unimplemented — —
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented, r = reserved.
Shaded locations are unimplemented, read as ‘0’.
Note 1: These registers can be addressed from any bank.
2: PIC16(L)F1823 only.
3: Unimplemented. Read as ‘1’.
Bank 6
300h(1) INDF0 Addressing this location uses contents of FSR0H/FSR0L to address data memory xxxx xxxx xxxx xxxx
(not a physical register)
301h(1) INDF1 Addressing this location uses contents of FSR1H/FSR1L to address data memory xxxx xxxx xxxx xxxx
(not a physical register)
302h(1) PCL Program Counter (PC) Least Significant Byte 0000 0000 0000 0000
303h(1) STATUS — — — TO PD Z DC C ---1 1000 ---q quuu
304h(1) FSR0L Indirect Data Memory Address 0 Low Pointer 0000 0000 uuuu uuuu
305h(1) FSR0H Indirect Data Memory Address 0 High Pointer 0000 0000 0000 0000
306h(1) FSR1L Indirect Data Memory Address 1 Low Pointer 0000 0000 uuuu uuuu
307h(1) FSR1H Indirect Data Memory Address 1 High Pointer 0000 0000 0000 0000
308h(1) BSR — — — BSR<4:0> ---0 0000 ---0 0000
309h(1) WREG Working Register 0000 0000 uuuu uuuu
30Ah(1) PCLATH — Write Buffer for the upper 7 bits of the Program Counter -000 0000 -000 0000
30Bh(1) INTCON GIE PEIE TMR0IE INTE IOCIE TMR0IF INTF IOCIF 0000 000x 0000 000u
30Ch — Unimplemented — —
30Dh — Unimplemented — —
30Eh — Unimplemented — —
30Fh — Unimplemented — —
310h — Unimplemented — —
311h — Unimplemented — —
312h — Unimplemented — —
313h — Unimplemented — —
314h — Unimplemented — —
315h — Unimplemented — —
316h — Unimplemented — —
317h — Unimplemented — —
318h — Unimplemented — —
319h — Unimplemented — —
31Ah — Unimplemented — —
31Bh — Unimplemented — —
31Ch — Unimplemented — —
31Dh — Unimplemented — —
31Eh — Unimplemented — —
31Fh — Unimplemented — —
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented, r = reserved.
Shaded locations are unimplemented, read as ‘0’.
Note 1: These registers can be addressed from any bank.
2: PIC16(L)F1823 only.
3: Unimplemented. Read as ‘1’.
Bank 7
380h(1) INDF0 Addressing this location uses contents of FSR0H/FSR0L to address data memory xxxx xxxx xxxx xxxx
(not a physical register)
381h(1) INDF1 Addressing this location uses contents of FSR1H/FSR1L to address data memory xxxx xxxx xxxx xxxx
(not a physical register)
382h(1) PCL Program Counter (PC) Least Significant Byte 0000 0000 0000 0000
383h(1) STATUS — — — TO PD Z DC C ---1 1000 ---q quuu
384h(1) FSR0L Indirect Data Memory Address 0 Low Pointer 0000 0000 uuuu uuuu
385h(1) FSR0H Indirect Data Memory Address 0 High Pointer 0000 0000 0000 0000
386h(1) FSR1L Indirect Data Memory Address 1 Low Pointer 0000 0000 uuuu uuuu
387h(1) FSR1H Indirect Data Memory Address 1 High Pointer 0000 0000 0000 0000
388h(1) BSR — — — BSR<4:0> ---0 0000 ---0 0000
389h(1) WREG Working Register 0000 0000 uuuu uuuu
38Ah(1) PCLATH — Write Buffer for the upper 7 bits of the Program Counter -000 0000 -000 0000
38Bh(1) INTCON GIE PEIE TMR0IE INTE IOCIE TMR0IF INTF IOCIF 0000 000x 0000 000u
38Ch — Unimplemented — —
38Dh — Unimplemented — —
38Eh — Unimplemented — —
38Fh — Unimplemented — —
390h — Unimplemented — —
391h IOCAP — — IOCAP5 IOCAP4 IOCAP3 IOCAP2 IOCAP1 IOCAP0 --00 0000 --00 0000
392h IOCAN — — IOCAN5 IOCAN4 IOCAN3 IOCAN2 IOCAN1 IOCAN0 --00 0000 --00 0000
393h IOCAF — — IOCAF5 IOCAF4 IOCAF3 IOCAF2 IOCAF1 IOCAF0 --00 0000 --00 0000
394h — Unimplemented — —
395h — Unimplemented — —
396h — Unimplemented — —
397h — Unimplemented — —
398h — Unimplemented — —
399h — Unimplemented — —
39Ah CLKRCON CLKREN CLKROE CLKRSLR CLKRDC<1:0> CLKRDIV<2:0> 0011 0000 0011 0000
39Bh — Unimplemented — —
39Ch MDCON MDEN MDOE MDSLR MDOPOL MDOUT — — MDBIT 0010 ---0 0010 ---0
39Dh MDSRC MDMSODIS — — — MDMS<3:0> x--- xxxx u--- uuuu
39Eh MDCARL MDCLODIS MDCLPOL MDCLSYNC — MDCL<3:0> xxx- xxxx uuu- uuuu
39Fh MDCARH MDCHODIS MDCHPOL MDCHSYNC — MDCH<3:0> xxx- xxxx uuu- uuuu
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented, r = reserved.
Shaded locations are unimplemented, read as ‘0’.
Note 1: These registers can be addressed from any bank.
2: PIC16(L)F1823 only.
3: Unimplemented. Read as ‘1’.
Bank 8
400h(1) INDF0 Addressing this location uses contents of FSR0H/FSR0L to address data memory xxxx xxxx xxxx xxxx
(not a physical register)
401h(1) INDF1 Addressing this location uses contents of FSR1H/FSR1L to address data memory xxxx xxxx xxxx xxxx
(not a physical register)
402h(1) PCL Program Counter (PC) Least Significant Byte 0000 0000 0000 0000
403h(1) STATUS — — — TO PD Z DC C ---1 1000 ---q quuu
404h(1) FSR0L Indirect Data Memory Address 0 Low Pointer 0000 0000 uuuu uuuu
405h(1) FSR0H Indirect Data Memory Address 0 High Pointer 0000 0000 0000 0000
406h(1) FSR1L Indirect Data Memory Address 1 Low Pointer 0000 0000 uuuu uuuu
407h(1) FSR1H Indirect Data Memory Address 1 High Pointer 0000 0000 0000 0000
408h(1) BSR — — — BSR<4:0> ---0 0000 ---0 0000
409h(1) WREG Working Register 0000 0000 uuuu uuuu
40Ah(1) PCLATH — Write Buffer for the upper 7 bits of the Program Counter -000 0000 -000 0000
40Bh(1) INTCON GIE PEIE TMR0IE INTE IOCIE TMR0IF INTF IOCIF 0000 000x 0000 000u
40Ch — Unimplemented — —
40Dh — Unimplemented — —
40Eh — Unimplemented — —
40Fh — Unimplemented — —
410h — Unimplemented — —
411h — Unimplemented — —
412h — Unimplemented — —
413h — Unimplemented — —
414h — Unimplemented — —
415h — Unimplemented — —
416h — Unimplemented — —
417h — Unimplemented — —
418h — Unimplemented — —
419h — Unimplemented — —
41Ah — Unimplemented — —
41Bh — Unimplemented — —
41Ch — Unimplemented — —
41Dh — Unimplemented — —
41Eh — Unimplemented — —
41Fh — Unimplemented — —
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented, r = reserved.
Shaded locations are unimplemented, read as ‘0’.
Note 1: These registers can be addressed from any bank.
2: PIC16(L)F1823 only.
3: Unimplemented. Read as ‘1’.
Banks 9-30
x00h/ INDF0 Addressing this location uses contents of FSR0H/FSR0L to address data memory xxxx xxxx xxxx xxxx
x80h(1) (not a physical register)
x00h/ INDF1 Addressing this location uses contents of FSR1H/FSR1L to address data memory xxxx xxxx xxxx xxxx
x81h(1) (not a physical register)
x02h/ PCL Program Counter (PC) Least Significant Byte 0000 0000 0000 0000
x82h(1)
x03h/ STATUS — — — TO PD Z DC C ---1 1000 ---q quuu
x83h(1)
x04h/ FSR0L Indirect Data Memory Address 0 Low Pointer 0000 0000 uuuu uuuu
x84h(1)
x05h/ FSR0H Indirect Data Memory Address 0 High Pointer 0000 0000 0000 0000
x85h(1)
x06h/ FSR1L Indirect Data Memory Address 1 Low Pointer 0000 0000 uuuu uuuu
x86h(1)
x07h/ FSR1H Indirect Data Memory Address 1 High Pointer 0000 0000 0000 0000
x87h(1)
x08h/ BSR — — — BSR<4:0> ---0 0000 ---0 0000
x88h(1)
x09h/ WREG Working Register 0000 0000 uuuu uuuu
x89h(1)
x0Ah/ PCLATH — Write Buffer for the upper 7 bits of the Program Counter -000 0000 -000 0000
x8Ah(1)
x0Bh/ INTCON GIE PEIE TMR0IE INTE IOCIE TMR0IF INTF IOCIF 0000 000x 0000 000u
x8Bh(1)
x0Ch/ — Unimplemented — —
x8Ch
—
x1Fh/
x9Fh
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented, r = reserved.
Shaded locations are unimplemented, read as ‘0’.
Note 1: These registers can be addressed from any bank.
2: PIC16(L)F1823 only.
3: Unimplemented. Read as ‘1’.
Bank 31
F80h(1) INDF0 Addressing this location uses contents of FSR0H/FSR0L to address data memory xxxx xxxx xxxx xxxx
(not a physical register)
F81h(1) INDF1 Addressing this location uses contents of FSR1H/FSR1L to address data memory xxxx xxxx xxxx xxxx
(not a physical register)
F82h(1) PCL Program Counter (PC) Least Significant Byte 0000 0000 0000 0000
F83h(1) STATUS — — — TO PD Z DC C ---1 1000 ---q quuu
F84h(1) FSR0L Indirect Data Memory Address 0 Low Pointer 0000 0000 uuuu uuuu
F85h(1) FSR0H Indirect Data Memory Address 0 High Pointer 0000 0000 0000 0000
F86h(1) FSR1L Indirect Data Memory Address 1 Low Pointer 0000 0000 uuuu uuuu
F87h(1) FSR1H Indirect Data Memory Address 1 High Pointer 0000 0000 0000 0000
F88h(1) BSR — — — BSR<4:0> ---0 0000 ---0 0000
F89h(1) WREG Working Register 0000 0000 uuuu uuuu
F8Ah(1) PCLATH — Write Buffer for the upper 7 bits of the Program Counter -000 0000 -000 0000
F8Bh(1) INTCON GIE PEIE TMR0IE INTE IOCIE TMR0IF INTF IOCIF 0000 000x 0000 000u
F8Ch — Unimplemented — —
—
FE3h
FE4h STATUS_ — — — — — Z_SHAD DC_SHAD C_SHAD ---- -xxx ---- -uuu
SHAD
FE5h WREG_ Working Register Shadow 0000 0000 uuuu uuuu
SHAD
FE6h BSR_ — — — Bank Select Register Shadow ---x xxxx ---u uuuu
SHAD
FE7h PCLATH_ — Program Counter Latch High Register Shadow -xxx xxxx uuuu uuuu
SHAD
FE8h FSR0L_ Indirect Data Memory Address 0 Low Pointer Shadow xxxx xxxx uuuu uuuu
SHAD
FE9h FSR0H_ Indirect Data Memory Address 0 High Pointer Shadow xxxx xxxx uuuu uuuu
SHAD
FEAh FSR1L_ Indirect Data Memory Address 1 Low Pointer Shadow xxxx xxxx uuuu uuuu
SHAD
FEBh FSR1H_ Indirect Data Memory Address 1 High Pointer Shadow xxxx xxxx uuuu uuuu
SHAD
FECh — Unimplemented — —
FEDh STKPTR — — — Current Stack pointer ---1 1111 ---1 1111
FEEh TOSL Top-of-Stack Low byte xxxx xxxx uuuu uuuu
FEFh TOSH — Top-of-Stack High byte -xxx xxxx -uuu uuuu
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented, r = reserved.
Shaded locations are unimplemented, read as ‘0’.
Note 1: These registers can be addressed from any bank.
2: PIC16(L)F1823 only.
3: Unimplemented. Read as ‘1’.
14 PCH PCL 0
PC BRA
15
PC + OPCODE <8:0>
0x0C
0x0B
0x0A
Initial Stack Configuration:
0x09
After Reset, the stack is empty. The
0x08 empty stack is initialized so the Stack
Pointer is pointing at 0x1F. If the Stack
0x07
Overflow/Underflow Reset is enabled, the
0x06 TOSH/TOSL registers will return ‘0’. If
the Stack Overflow/Underflow Reset is
0x05 disabled, the TOSH/TOSL registers will
return the contents of stack address 0x0F.
0x04
0x03
0x02
0x01
0x00
Stack Reset Enabled
TOSH:TOSL 0x1F 0x0000 STKPTR = 0x1F
(STVREN = 1)
0x0F
0x0E
0x0D
0x0C
0x0B
0x0A
0x09 This figure shows the stack configuration
after the first CALL or a single interrupt.
0x08 If a RETURN instruction is executed, the
0x07 return address will be placed in the
Program Counter and the Stack Pointer
0x06 decremented to the empty state (0x1F).
0x05
0x04
0x03
0x02
0x01
TOSH:TOSL 0x00 Return Address STKPTR = 0x00
0x0F
0x0E
0x0D
0x0C
After seven CALLs or six CALLs and an
0x0B interrupt, the stack looks like the figure
on the left. A series of RETURN instructions
0x0A will repeatedly place the return addresses
into the Program Counter and pop the stack.
0x09
0x08
0x07
TOSH:TOSL 0x06 Return Address STKPTR = 0x06
0x0000 0x0000
Traditional
Data Memory
0x0FFF 0x0FFF
0x1000
Reserved
0x1FFF
0x2000
Linear
Data Memory
0x29AF
0x29B0
FSR Reserved
0x7FFF
Address
Range 0x8000 0x0000
Program
Flash Memory
0xFFFF 0x7FFF
Note: Not all memory regions are completely implemented. Consult device memory tables for memory limits.
0x7F
Bank 0 Bank 1 Bank 2 Bank 31
0xF20
Bank 30 0x7FFF
0xFFFF
0x29AF 0xF6F
Legend:
R = Readable bit P = Programmable bit U = Unimplemented bit, read as ‘1’
‘0’ = Bit is cleared ‘1’ = Bit is set -n = Value when blank or after Bulk Erase
Note 1: Enabling Brown-out Reset does not automatically enable Power-up Timer.
2: The entire data EEPROM will be erased when the code protection is turned off during an erase.
3: The entire program memory will be erased when the code protection is turned off.
Note 1: Enabling Brown-out Reset does not automatically enable Power-up Timer.
2: The entire data EEPROM will be erased when the code protection is turned off during an erase.
3: The entire program memory will be erased when the code protection is turned off.
Legend:
R = Readable bit P = Programmable bit U = Unimplemented bit, read as ‘1’
‘0’ = Bit is cleared ‘1’ = Bit is set -n = Value when blank or after Bulk Erase
Note 1: The LVP bit cannot be programmed to ‘0’ when Programming mode is entered via LVP.
2: The DEBUG bit in Configuration Word is managed automatically by device development tools including debuggers and
programmers. For normal device operation, this bit should be maintained as a '1'.
3: See Vbor parameter for specific trip point voltages.
4.4 User ID
Four memory locations (8000h-8003h) are designated as
ID locations where the user can store checksum or other
code identification numbers. These locations are
readable and writable during normal execution. See
Section 11.5 “User ID, Device ID and Configuration
Word Access” for more information on accessing these
memory locations. For more information on checksum
calculation, see the “PIC16F/LF1826/27/PIC12F/LF1822
Memory Programming Specification” (DS41390).
R R R R R R R R
DEV2 DEV1 DEV0 REV4 REV3 REV2 REV1 REV0
bit 7 bit 0
Legend:
R = Readable bit ‘0’ = Bit is cleared ‘1’ = Bit is set
External
Oscillator LP, XT, HS, RC, EC
OSC2
Sleep
4 x PLL Sleep
OSC1
Oscillator Timer1 FOSC<2:0> = 100 T1OSC CPU and
MUX
T1OSO Peripherals
T1OSCEN
Enable
T1OSI Oscillator IRCF<3:0>
Internal Oscillator
16 MHz
8 MHz
Internal
Oscillator 4 MHz
Block 2 MHz
Postscaler 1 MHz Clock
HFPLL Control
MUX
16 MHz 500 kHz
(HFINTOSC) 250 kHz
125 kHz FOSC<2:0> SCS<1:0>
500 kHz
Source 500 kHz 62.5 kHz
(MFINTOSC) 31.25 kHz Clock Source Option
31 kHz for other modules
31 kHz
Source
OSC1/CLKIN OSC1/CLKIN
C1 To Internal C1 To Internal
Logic Logic
Quartz
RF(2) Sleep RP(3)
Crystal RF(2) Sleep
C2 OSC2/CLKOUT
RS(1) OSC2/CLKOUT
C2 Ceramic RS(1)
Resonator
Note 1: A series resistor (RS) may be required for
quartz crystals with low drive level. Note 1: A series resistor (RS) may be required for
ceramic resonators with low drive level.
2: The value of RF varies with the Oscillator mode
selected (typically between 2 M to 10 M. 2: The value of RF varies with the Oscillator mode
selected (typically between 2 M to 10 M.
3: An additional parallel feedback resistor (RP)
Note 1: Quartz crystal characteristics vary may be required for proper ceramic resonator
according to type, package and operation.
manufacturer. The user should consult the
manufacturer data sheets for specifications
and recommended application. 5.2.1.3 Oscillator Start-up Timer (OST)
2: Always verify oscillator performance over If the oscillator module is configured for LP, XT or HS
the VDD and temperature range that is modes, the Oscillator Start-up Timer (OST) counts
expected for the application. 1024 oscillations from OSC1. This occurs following a
3: For oscillator design assistance, reference Power-on Reset (POR) and when the Power-up Timer
the following Microchip Applications Notes: (PWRT) has expired (if configured), or a wake-up from
Sleep. During this time, the program counter does not
• AN826, “Crystal Oscillator Basics and increment and program execution is suspended. The
Crystal Selection for rfPIC® and PIC® OST ensures that the oscillator circuit, using a quartz
Devices” (DS00826) crystal resonator or ceramic resonator, has started and
• AN849, “Basic PIC® Oscillator Design” is providing a stable system clock to the oscillator
(DS00849) module.
• AN943, “Practical PIC® Oscillator In order to minimize latency between external oscillator
Analysis and Design” (DS00943) start-up and code execution, the Two-Speed Clock
• AN949, “Making Your Oscillator Work” Start-up mode can be selected (see Section 5.4
(DS00949) “Two-Speed Clock Start-up Mode”).
5.2.1.4 4X PLL
The oscillator module contains a 4X PLL that can be
used with both external and internal clock sources to
provide a system clock source. The input frequency for
the 4X PLL must fall within specifications. See the PLL
Clock Timing Specifications in Section 30.0
“Electrical Specifications”.
The 4X PLL may be enabled for use by one of two
methods:
1. Program the PLLEN bit in Configuration Word 2
to a ‘1’.
2. Write the SPLLEN bit in the OSCCON register to
a ‘1’. If the PLLEN bit in Configuration Word 2 is
programmed to a ‘1’, then the value of SPLLEN
is ignored.
LFINTOSC
System Clock
LFINTOSC
System Clock
LFINTOSC HFINTOSC/MFINTOSC
LFINTOSC turns off unless WDT or FSCM is enabled
LFINTOSC
Start-up Time 2-cycle Sync Running
HFINTOSC/
MFINTOSC
IRCF <3:0> =0 0
System Clock
• Default system oscillator determined by FOSC The Timer1 oscillator is enabled using the T1OSCEN
bits in Configuration Word 1 control bit in the T1CON register. See Section 21.0
“Timer1 Module with Gate Control” for more
• Timer1 32 kHz crystal oscillator
information about the Timer1 peripheral.
• Internal Oscillator Block (INTOSC)
5.3.4 TIMER1 OSCILLATOR READY
5.3.1 SYSTEM CLOCK SELECT (SCS)
(T1OSCR) BIT
BITS
The user must ensure that the Timer1 Oscillator is
The System Clock Select (SCS) bits of the OSCCON
ready to be used before it is selected as a system clock
register selects the system clock source that is used for
source. The Timer1 Oscillator Ready (T1OSCR) bit of
the CPU and peripherals.
the OSCSTAT register indicates whether the Timer1
• When the SCS bits of the OSCCON register = 00, oscillator is ready to be used. After the T1OSCR bit is
the system clock source is determined by value of set, the SCS bits can be configured to select the Timer1
the FOSC<2:0> bits in the Configuration Word 1. oscillator.
• When the SCS bits of the OSCCON register = 01,
the system clock source is the Timer1 oscillator.
• When the SCS bits of the OSCCON register = 1x,
the system clock source is chosen by the internal
oscillator frequency selected by the IRCF<3:0>
bits of the OSCCON register. After a Reset, the
SCS bits of the OSCCON register are always
cleared.
Note: Any automatic clock switch, which may
occur from Two-Speed Start-up or
Fail-Safe Clock Monitor, does not update
the SCS bits of the OSCCON register. The
user can monitor the OSTS bit of the
OSCSTAT register to determine the current
system clock source.
When switching between clock sources, a delay is
required to allow the new clock to stabilize. These oscil-
lator delays are shown in Table 5-1.
INTOSC
TOST
OSC2
Program Counter PC - N PC PC + 1
System Clock
Sample Clock
System Oscillator
Clock Failure
Output
Note: 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.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared q = Conditional
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Note 1: If the base clock rate is selected without 6.4 Operation During Sleep
a divider, the output clock will always
have a duty cycle equal to that of the As the reference clock module relies on the system
source clock, unless a 0% duty cycle is clock as its source, and the system clock is disabled in
selected. If the clock divider is set to base Sleep, the module does not function in Sleep, even if
clock/2, then 25% and 75% duty cycle an external clock source or the Timer1 clock source is
accuracy will be dependent upon the configured as the system clock. The module outputs
source clock. will remain in their current state until the device exits
Sleep.
For information on using the reference clock output
with the modulator module, see Section 23.0 “Data
Signal Modulator”.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Note 1: In this mode, the 25% and 75% duty cycle accuracy will be dependent on the source clock duty cycle.
2: In this mode, the duty cycle will always be equal to the source clock duty cycle, unless a duty cycle of 0%
is selected.
3: To route CLKR to pin, CLKOUTEN of Configuration Word 1 = 1 is required. CLKOUTEN of Configuration
Word 1 = 0 will result in FOSC/4. See Section 6.3 “Conflicts with the CLKR pin” for details.
External Reset
MCLRE
MCLR
Sleep
WDT
Time-out
Device
Power-on Reset
Reset
VDD
Brown-out
Reset
BOR
Enable
PWRT
Zero
64 ms
LFINTOSC
PWRTEN
SBOREN
TBORRDY
BORRDY BOR Protection Active
VDD
VBOR
Internal
Reset TPWRT(1)
VDD
VBOR
VDD
VBOR
Internal
Reset TPWRT(1)
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared q = Value depends on condition
VDD
Internal POR
TPWRT
Power-Up Timer
MCLR
TMCLR
Internal RESET
Oscillator Modes
External Crystal
TOST
Oscillator Start-Up Timer
Oscillator
FOSC
Internal Oscillator
Oscillator
FOSC
CLKIN
FOSC
Legend:
HC = Bit is cleared by hardware HS = Bit is set by hardware
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -m/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared q = Value depends on condition
INTF
Interrupt to CPU
INTE
IOCIF
IOCIE
From Peripheral Interrupt
Logic (Figure 8-2)
PEIE
GIE
TMR1GIF
TMR1GIE
ADIF
ADIE
RCIF
RCIE
TXIF
TXIE
SSPIF
SSPIE
CCP1IF
CCP1IE
TMR2IF
TMR2IE
EEIF
EEIE
OSFIF
OSFIE
C1IF
C1IE
C2IF(1)
C2IE(1)
BCLIF
BCLIE
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
Interrupt
GIE
Interrupt
GIE
Interrupt
GIE
Interrupt
GIE
Q1 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) Interrupt Latency (2)
GIE
INSTRUCTION FLOW
PC PC PC + 1 PC + 1 0004h 0005h
Instruction
Fetched Inst (PC) Inst (PC + 1) — Inst (0004h) Inst (0005h)
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Note 1: The IOCIF Flag bit is read-only and cleared when all the Interrupt-on-Change flags in the IOCAF register
have been cleared by software.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
GIE bit
(INTCON reg.) Processor in
Sleep
Instruction Flow
PC PC PC + 1 PC + 2 PC + 2 PC + 2 0004h 0005h
Instruction Inst(PC + 1) Inst(PC + 2) Inst(0004h) Inst(0005h)
Fetched Inst(PC) = Sleep
Instruction Sleep Inst(PC + 1) Dummy Cycle Dummy Cycle
Executed Inst(PC - 1) Inst(0004h)
WDTE<1:0> = 01
SWDTEN
WDTE Device WDT When a WDT time-out occurs while the device is in
Config bits
SWDTEN
Mode Mode Sleep, no Reset is generated. Instead, the device
wakes up and resumes operation. The TO and PD bits
WDT_ON (11) X X Active in the STATUS register are changed to indicate the
event. See Section 3.0 “Memory Organization” and
WDT_NSLEEP (10) X Awake Active The STATUS register (Register 3-1) for more
WDT_NSLEEP (10) X Sleep Disabled information.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -m/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
MOVLW 0AAh ;
MOVWF EECON2 ;Write AAh
BSF EECON1, WR ;Set WR bit to begin write
BSF INTCON, GIE ;Enable Interrupts
BCF EECON1, WREN ;Disable writes
BTFSC EECON1, WR ;Wait for write to complete
GOTO $-2 ;Done
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
Flash Data INSTR (PC) INSTR (PC + 1) EEDATH,EEDATL INSTR (PC + 3) INSTR (PC + 4)
RD bit
EEDATH
EEDATL
Register
EERHLT
FIGURE 11-2: BLOCK WRITES TO FLASH PROGRAM MEMORY WITH 16 WRITE LATCHES
7 5 0 7 0
EEDATH EEDATA
6 8
14 14 14 14
Program Memory
MOVLW 0AAh ;
Required
START_WRITE
BCF EECON1,LWLO ; No more loading latches - Actually start Flash program
; memory write
MOVLW 0AAh ;
Required
TABLE 11-2: USER ID, DEVICE ID AND CONFIGURATION WORD ACCESS (CFGS = 1)
Address Function Read Access Write Access
8000h-8003h User IDs Yes Yes
8006h Device ID/Revision ID Yes No
8007h-8008h Configuration Words 1 and 2 Yes No
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
bit 7-0 EEDAT<7:0>: Read/write value for EEPROM data byte or Least Significant bits of program memory
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
bit 7-0 EEADR<7:0>: Specifies the Least Significant bits for program memory address or EEPROM address
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
S = Bit can only be set x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared HC = Bit is cleared by hardware
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
S = Bit can only be set x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
PORTC
Device
PIC12(L)F1822 ●
PIC16(L)F1823 ● ●
The Data Latch (LATx registers) is useful for
read-modify-write operations on the value that the I/O
pins are driving.
A write operation to the LATx register has the same
affect as a write to the corresponding PORTx register.
A read of the LATx register reads of the values held in
the I/O PORT latches, while a read of the PORTx
register reads the actual I/O pin value.
Ports with analog functions also have an ANSELx
register which can disable the digital input and save
power. A simplified model of a generic I/O port, without
the interfaces to other peripherals, is shown in
Figure 12-1.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Note 1: Writes to PORTA are actually written to corresponding LATA register. Reads from PORTA register is return
of actual I/O pin values.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Note 1: Writes to PORTA are actually written to corresponding LATA register. Reads from PORTA register is return
of actual I/O pin values.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
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.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Note 1: Global WPUEN bit of the OPTION register must be cleared for individual pull-ups to be enabled.
2: The weak pull-up device is automatically disabled if the pin is in configured as an output.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Note 1: Writes to PORTC are actually written to corresponding LATC register. Reads from PORTC register is
return of actual I/O pin values.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
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.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Note 1: Global WPUEN bit of the OPTION register must be cleared for individual pull-ups to be enabled.
2: The weak pull-up device is automatically disabled if the pin is in configured as an output.
IOCBNx D Q4Q1
Q
CK edge
detect
R
RBx
CK write IOCBFx CK
IOCIE
R
Q2
from all other
IOCBFx individual IOC interrupt
pin detectors to CPU core
Q1 Q1 Q1
Q2 Q2 Q2
Q3 Q3 Q3
Q4 Q4 Q4 Q4
Q4Q1 Q4Q1 Q4Q1 Q4Q1
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared HS - Bit is set in hardware
• ADC input channel The ADFVR<1:0> bits of the FVRCON register are
used to enable and configure the gain amplifier settings
• ADC positive reference
for the reference supplied to the ADC module. Refer-
• Comparator positive input ence Section 16.0 “Analog-to-Digital Converter
• Digital-to-Analog Converter (DAC) (ADC) Module” for additional information.
• Capacitive Sensing (CPS) module The CDAFVR<1:0> bits of the FVRCON register are
The FVR can be enabled by setting the FVREN bit of used to enable and configure the gain amplifier settings
the FVRCON register. for the reference supplied to Comparators, DAC and
CPS module. Reference Section 17.0 “Digital-to-
Analog Converter (DAC) Module”, Section 19.0
“Comparator Module” and Section 27.0 “Capacitive
Sensing (CPS) Module” for additional information.
ADFVR<1:0>
2
X1
X2 FVR BUFFER1
X4 (To ADC Module)
CDAFVR<1:0>
2
X1
X2 FVR BUFFER2
X4 (To Comparators, DAC, CPS)
FVREN +
1.024V Fixed
FVRRDY _ Reference
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared q = Value depends on condition
TABLE 14-1: SUMMARY OF REGISTERS ASSOCIATED WITH THE FIXED VOLTAGE REFERENCE
Register
Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
on page
FVRCON FVREN FVRRDY TSEN TSRNG CDAFVR1 CDAFVR0 ADFVR1 ADFVR0 138
Legend: Shaded cells are unused by the Fixed Voltage Reference module.
VDD
ADPREF = 00
ADPREF = 11
VREF+ ADPREF = 10
AN0 00000
AN1 00001
AN2 00010
AN3 00011
AN4(2) 00100
AN5(2) 00101
AN6(2) 00110
AN7(2) 00111
ADC
GO/DONE 10
Temp Indicator 11101
0 = Left Justify
DAC_output 11110 ADFM
1 = Right Justify
FVR Buffer1 11111
ADON(1) 16
ADC
ADCS<2:0> 32 MHz 20 MHz 16 MHz 8 MHz 4 MHz 1 MHz
Clock Source
Fosc/2 000 62.5ns(2) 100 ns(2) 125 ns(2) 250 ns(2) 500 ns(2) 2.0 s
Fosc/4 100 125 ns (2)
200 ns (2)
250 ns (2)
500 ns (2)
1.0 s 4.0 s
Fosc/8 001 0.5 s(2) 400 ns(2) 0.5 s(2) 1.0 s 2.0 s 8.0 s(3)
Fosc/16 101 800 ns 800 ns 1.0 s 2.0 s 4.0 s 16.0 s(3)
Fosc/32 010 1.0 s 1.6 s 2.0 s 4.0 s 8.0 s (3)
32.0 s(3)
Fosc/64 110 2.0 s 3.2 s 4.0 s 8.0 s (3)
16.0 s (3)
64.0 s(3)
FRC x11 1.0-6.0 s(1,4) 1.0-6.0 s(1,4) 1.0-6.0 s(1,4) 1.0-6.0 s(1,4) 1.0-6.0 s(1,4) 1.0-6.0 s(1,4)
Legend: Shaded cells are outside of recommended range.
Note 1: The FRC source has a typical TAD time of 1.6 s for VDD.
2: These values violate the minimum required TAD time.
3: For faster conversion times, the selection of another clock source is recommended.
4: The ADC clock period (TAD) and total ADC conversion time can be minimized when the ADC clock is derived from the
system clock FOSC. However, the FRC clock source must be used when conversions are to be performed with the
device in Sleep mode.
TCY - TAD TAD1 TAD2 TAD3 TAD4 TAD5 TAD6 TAD7 TAD8 TAD9 TAD10 TAD11
b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
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.
ADRESH ADRESL
(ADFM = 0) MSB LSB
bit 7 bit 0 bit 7 bit 0
Note: A device Reset forces all registers to their Using the Special Event Trigger does not assure proper
Reset state. Thus, the ADC module is ADC timing. It is the user’s responsibility to ensure that
turned off and any pending conversion is the ADC timing requirements are met.
terminated. Refer to Section 24.0 “Capture/Compare/PWM Mod-
ules” for more information.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
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 30.0 “Electrical Specifications” for details.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
T ACQ = Amplifier Settling Time + Hold Capacitor Charging Time + Temperature Coefficient
= T AMP + T C + T COFF
= 2µs + T C + Temperature - 25°C 0.05µs/°C
V AP P LI ED 1 – -------------------------- = V CHOLD
1
;[1] VCHOLD charged to within 1/2 lsb
n+1
2 –1
–TC
----------
RC
V AP P LI ED 1 – e = V CHOLD ;[2] VCHOLD charge response to VAPPLIED
– Tc
---------
V AP P LI ED 1 – e = V A PP LIE D 1 – -------------------------- ;combining [1] and [2]
RC 1
n+1
2 –1
T C = – C HOLD R IC + R SS + R S ln(1/2047)
= – 13.5pF 1k + 7k + 10k ln(0.0004885)
= 1.20 µs
Therefore:
T A CQ = 5µs + 1.20µs + 50°C- 25°C 0.05 µs/°C
= 7.45µs
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.
VDD
Analog Sampling
Input Switch
VT 0.6V
Rs pin RIC 1k SS Rss
VA CPIN I LEAKAGE(1)
VT 0.6V CHOLD = 10 pF
5 pF
VSS/VREF-
6V
5V RSS
Legend: CHOLD = Sample/Hold Capacitance VDD 4V
3V
CPIN = Input Capacitance 2V
I LEAKAGE = Leakage current at the pin due to
various junctions
5 6 7 8 9 10 11
RIC = Interconnect Resistance
Sampling Switch
RSS = Resistance of Sampling Switch (k)
SS = Sampling Switch
VT = Threshold Voltage
Full-Scale Range
3FFh
3FEh
3FDh
3FCh
ADC Output Code
3FBh
03h
02h
01h
00h
Analog Input Voltage
0.5 LSB 1.5 LSB
Zero-Scale
VSS/VREF- Full-Scale
Transition
Transition VREF+
IF DACEN = 1
DACR 4:0
VOUT = VSOURCE+ – VSOURCE- ----------------------------- + VSOURCE-
5
2
V OUT = V SOURCE +
V OUT = V SOURCE –
FVR BUFFER2
VDD
VSOURCE+
DACR<4:0>
5
VREF+
R
R
DACPSS<1:0>
2
R
DACEN
DACLPS R
32-to-1 MUX
32
Steps DAC
(To Comparator, CPS and
ADC Modules)
R
R
DACOUT
R
DACOE
VSOURCE-
PIC® MCU
DAC
R
Module
+
Voltage DACOUT Buffered DAC Output
–
Reference
Output
Impedance
Output Clamped to Positive Voltage Source Output Clamped to Negative Voltage Source
VSOURCE+ VSOURCE+
R R
DACR<4:0> = 11111
R R
DACEN = 0 DACEN = 0
DACLPS = 1 DAC Voltage Ladder DACLPS = 0 DAC Voltage Ladder
(see Figure 17-1) (see Figure 17-1)
R R
DACR<4:0> = 00000
VSOURCE- VSOURCE-
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
SRLEN
SRPS Pulse SRQEN
Gen(2)
SRI
SRSPE S Q
SRCLK
SRQ
SRSCKE
SYNCC2OUT(3, 4)
SRSC2E(4)
SYNCC1OUT(3)
SR
SRSC1E
Latch(1)
SRPR Pulse
Gen(2)
SRI
SRRPE R Q
SRCLK SRNQ
SRRCKE SRLEN
SYNCC2OUT(3, 4) SRNQEN
SRRC2E(4)
SYNCC1OUT(3)
SRRC1E
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared S = Bit is set only
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
det
Set C1IF
C1IN0- 0
3
C1SYNC
VSS C1ON C1OE
TRIS bit
C1OUT
C1PCH<1:0> 0
2
D Q 1
(from Timer1)
T1CLK To Timer1 or SR Latch
SYNCC1OUT
Note 1: When C1ON = 0, the Comparator will produce a ‘0’ at the output.
2: When C1ON = 0, all multiplexer inputs are disconnected.
3: Output of comparator can be frozen during debugging.
det
C12IN0- 0 Set CxIF
C12IN1- 1
MUX Interrupt CxINTN
C12IN2- 2 (2) det
CXPOL
C12IN3- 3 CxVN
-
CXOUT To Data Bus
D Q
Cx(3) MCXOUT
+
CxVP
Q1 EN
CXIN+ 0
MUX CxHYS
DAC 1 (2) CxSP
To ECCP PWM Logic
FVR Buffer2 2
3
CXSYNC
VSS CxON CXOE
TRIS bit
CXOUT
CXPCH<1:0> 0
2
D Q 1
(from Timer1)
T1CLK To Timer1 or SR Latch
SYNCCXOUT
Note 1: When CxON = 0, the Comparator will produce a ‘0’ at the output.
2: When CxON = 0, all multiplexer inputs are disconnected.
3: Output of comparator can be frozen during debugging.
CPIN ILEAKAGE(1)
VA VT 0.6V
5 pF
Vss
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
FOSC/4
Data Bus
0
8
T0CKI 1
0 Sync
1 2 TCY TMR0
0
From CPSCLK
1 TMR0SE Set Flag bit TMR0IF
TMR0CS 8-bit on Overflow
Prescaler PSA
T0XCS
Overflow to Timer1
PS<2:0>
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
000 1:2
001 1:4
010 1:8
011 1 : 16
100 1 : 32
101 1 : 64
110 1 : 128
111 1 : 256
T1GSS<1:0>
T1G 00 T1GSPM
T1CKI = 1
when TMR1
Enabled
T1CKI = 0
when TMR1
Enabled
TMR1GE
T1GPOL
T1G_IN
T1CKI
T1GVAL
TMR1GE
T1GPOL
T1GTM
T1G_IN
T1CKI
T1GVAL
TMR1GE
T1GPOL
T1GSPM
Cleared by hardware on
T1GGO/ Set by software falling edge of T1GVAL
DONE
Counting enabled on
rising edge of T1G
T1G_IN
T1CKI
T1GVAL
Cleared by
TMR1GIF Cleared by software Set by hardware on software
falling edge of T1GVAL
TMR1GE
T1GPOL
T1GSPM
T1GTM
Cleared by hardware on
T1GGO/ Set by software falling edge of T1GVAL
DONE Counting enabled on
rising edge of T1G
T1G_IN
T1CKI
T1GVAL
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
TMR1CS<1:0> = 0X
This bit is ignored.
bit 1 Unimplemented: Read as ‘0’
bit 0 TMR1ON: Timer1 On bit
1 = Enables Timer1
0 = Stops Timer1
Clears Timer1 Gate flip-flop
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared HC = Bit is cleared by hardware
Sets Flag
TMR2
bit TMR2IF
Output
Prescaler Reset
FOSC/4 TMR2
1:1, 1:4, 1:16, 1:64
2 Postscaler
Comparator
EQ 1:1 to 1:16
T2CKPS<1:0>
PR2 4
T2OUTPS<3:0>
A 4-bit counter/prescaler on the clock input allows direct Timer2 can be optionally used as the shift clock source
input, divide-by-4 and divide-by-16 prescale options. for the MSSP1 module operating in SPI mode.
These options are selected by the prescaler control bits, Additional information is provided in Section 25.1
T2CKPS<1:0> of the T2CON register. The value of “Master SSP (MSSP1) Module Overview”
TMR2 is compared to that of the Period register, PR2, on
each clock cycle. When the two values match, the 22.4 Timer2 Operation During Sleep
comparator generates a match signal as the timer
The Timer2 timers cannot be operated while the
output. This signal also resets the value of TMR2 to 00h
processor is in Sleep mode. The contents of the TMR2
on the next cycle and drives the output
and PR2 registers will remain unchanged while the
counter/postscaler (see Section 22.2 “Timer2
processor is in Sleep mode.
Interrupt”).
The TMR2 and PR2 registers are both directly readable
and writable. The TMR2 register is cleared on any
device Reset, whereas the PR2 register initializes to
FFh. Both the prescaler and postscaler counters are
cleared on the following events:
• a write to the TMR2 register
• a write to the T2CON register
• Power-on Reset (POR)
• Brown-out Reset (BOR)
• MCLR Reset
• Watchdog Timer (WDT) Reset
• Stack Overflow Reset
• Stack Underflow Reset
• RESET Instruction
Note: TMR2 is not cleared when T2CON is
written.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
MDCH<3:0>
MDEN
VSS 0000
MDCIN1 0001 EN
MDCIN2 0010 Data Signal
CLKR 0011 Modulator
CCP1 0100
CCP2 0101 CARH
CCP3 0110
CCP4 0111
1000 MDCHPOL
Reserved
No Channel *
Selected *
1111 D
SYNC
MDMS<3:0> Q 1
MDBIT 0000
MDMIN 0001
CCP1 0010
CCP2 0011 0
CCP3 0100
CCP4 0101
Comparator C1 0110 MOD MDCHSYNC
Comparator C2 0111
MSSP1 SDO1 1000 MDOUT
MSSP2 SDO2 1001
EUSART 1010 MDOE
MDOPOL
Reserved 0011
No Channel *
*
Selected 1111
D
MDCL<3:0> SYNC
Q 1
VSS 0000
MDCIN1 0001
MDCIN2 0010
CLKR 0011 0
CCP1 0100
CCP2 0101 CARL MDCLSYNC
CCP3 0110
CCP4 0111
1000
Reserved
* MDCLPOL
No Channel
Selected *
1111
Modulator (MOD)
MDCHSYNC = 1
MDCLSYNC = 0
MDCHSYNC = 1
MDCLSYNC = 1
MDCHSYNC = 0
MDCLSYNC = 0
MDCHSYNC = 0
MDCLSYNC = 1
Modulator (MOD)
MDCHSYNC = 0
MDCLSYNC = 0
Modulator (MOD)
MDCHSYNC = 1
MDCLSYNC = 0
Modulator (MOD)
MDCHSYNC = 0
MDCLSYNC = 1
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Note 1: The modulated output frequency can be greater and asynchronous from the clock that updates this
register bit, the bit value may not be valid for higher speed modulator or carrier signals.
2: MDBIT must be selected as the modulation source in the MDSRC register for this operation.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Note 1: Narrowed carrier pulse widths or spurs may occur in the signal stream if the carrier is not synchronized.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Note 1: Narrowed carrier pulse widths or spurs may occur in the signal stream if the carrier is not synchronized.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Note 1: Narrowed carrier pulse widths or spurs may occur in the signal stream if the carrier is not synchronized.
is considered the off state. The high portion, also known TMR2 = CCPR1H:CCP1CON<5:4>
as the pulse width, can vary in time and is defined in
TMR2 = 0
steps. A larger number of steps applied, which
lengthens the pulse width, also supplies more power to
the load. Lowering the number of steps applied, which
shortens the pulse width, supplies less power. The FIGURE 24-4: SIMPLIFIED PWM BLOCK
PWM period is defined as the duration of one complete DIAGRAM
cycle or the total amount of on and off time combined.
CCP1CON<5:4>
Duty Cycle Registers
PWM resolution defines the maximum number of steps
that can be present in a single PWM period. A higher CCPR1L
resolution allows for more precise control of the pulse
width time and in turn the power that is applied to the
load.
The term duty cycle describes the proportion of the on CCPR1H(2) (Slave)
CCP1
time to the off time and is expressed in percentages,
where 0% is fully off and 100% is fully on. A lower duty Comparator R Q
cycle corresponds to less power applied and a higher
duty cycle corresponds to more power applied. (1) S
TMR2
Figure 24-3 shows a typical waveform of the PWM TRIS
signal.
Comparator
Clear Timer,
24.3.1 STANDARD PWM OPERATION toggle CCP1 pin and
latch duty cycle
The standard PWM mode generates a Pulse-Width PR2
modulation (PWM) signal on the CCP1 pin with up to 10
Note 1: The 8-bit timer TMR2 register is concatenated
bits of resolution. The period, duty cycle, and resolution
with the 2-bit internal system clock (FOSC), or
are controlled by the following registers:
two bits of the prescaler, to create the 10-bit
• PR2 registers time base.
• T2CON registers 2: In PWM mode, CCPR1H is a read-only register.
• CCPR1L registers
• CCP1CON registers
Figure 24-4 shows a simplified block diagram of PWM
operation.
PWM Period = PR2 + 1 4 T OSC The CCPR1H register and a 2-bit internal latch are
(TMR2 Prescale Value) used to double buffer the PWM duty cycle. This double
buffering is essential for glitchless PWM operation.
Note 1: TOSC = 1/FOSC The 8-bit timer TMR2 register is concatenated with
either the 2-bit internal system clock (FOSC), or two bits
of the prescaler, to create the 10-bit time base. The
system clock is used if the Timer2 prescaler is set to 1:1.
When the 10-bit time base matches the CCPR1H and
2-bit latch, then the CCP1 pin is cleared (see
Figure 24-4).
log 4 PR2 + 1
Resolution = ------------------------------------------ bits
log 2
FIGURE 24-5: EXAMPLE SIMPLIFIED BLOCK DIAGRAM OF THE ENHANCED PWM MODE
DC1B<1:0> P1M<1:0> CCP1M<3:0>
Duty Cycle Registers
2 4
CCPR1L
CCP1/P1A CCP1/P1A
TRISx
CCPR1H (Slave)
P1B P1B
Output TRISx
Comparator R Q
Controller
P1C(2) P1C(2)
TMR2 (1)
S TRISx
P1D(2) P1D(2)
Comparator
Clear Timer, TRISx
toggle PWM pin and
latch duty cycle
PR2 PWM1CON
Note 1: The 8-bit timer TMR1 register is concatenated with the 2-bit internal Q clock, or two bits of the prescaler to create the 10-bit time
base.
2: PIC16(L)F1823 only.
PxA Active
PxD Modulated
PxA Inactive
PxD Inactive
Relationships:
• Period = 4 * TOSC * (PRx + 1) * (TMRx Prescale Value)
• Pulse Width = TOSC * (CCPRxL<7:0>:CCPxCON<5:4>) * (TMRx Prescale Value)
• Delay = 4 * TOSC * (PWMxCON<6:0>)
Pulse PRx+1
PxM<1:0> Signal 0
Width
Period
PxA Modulated
Delay Delay
10 (Half-Bridge) PxB Modulated
PxA Active
PxD Modulated
PxA Inactive
PxD Inactive
Relationships:
• Period = 4 * TOSC * (PRx + 1) * (TMRx Prescale Value)
• Pulse Width = TOSC * (CCPRxL<7:0>:CCPxCON<5:4>) * (TMRx Prescale Value)
• Delay = 4 * TOSC * (PWMxCON<6:0>)
FET
Driver +
P1A
-
Load
FET
Driver
+
P1B
-
V+
FET FET
Driver Driver
P1A
Load
FET FET
Driver Driver
P1B
FET QA QC FET
Driver Driver
P1A
Load
P1B
FET FET
Driver Driver
P1C
QB QD
V-
P1D
P1B(2)
P1C(2)
P1D(2)
(1) (1)
Reverse Mode
Period
Pulse Width
P1A(2)
P1B(2)
P1C(2)
P1D(2)
(1) (1)
Note 1: At this time, the TMR2 register is equal to the PR2 register.
2: Output signal is shown as active-high.
P1A (Active-High)
P1B (Active-High)
Pulse Width
P1C (Active-High)
(2)
P1D (Active-High)
Pulse Width
Note 1: The direction bit P1M1 of the CCP1CON register is written any time during the PWM cycle.
2: When changing directions, the P1A and P1C signals switch before the end of the current PWM cycle. The
modulated P1B and P1D signals are inactive at this time. The length of this time is four Timer counts.
P1A
P1B
PW
P1C
P1D PW
TON
External Switch C
TOFF
External Switch D
PWM Period
PWM Activity
Start of
PWM Period
Shutdown Event
CCP1ASE bit
PWM
Shutdown Shutdown Resumes
Event Occurs Event Clears CCP1ASE
Cleared by
Firmware
PWM Period
PWM Activity
Start of
PWM Period
Shutdown Event
CCP1ASE bit
PWM
Shutdown Resumes
Event Occurs
Shutdown CCP1ASE
Event Clears Cleared by
Hardware
FET
Driver +
P1A V
-
Load
FET
Driver
+
P1B V
-
V-
PWM Period
PWM
STR1
P1n = PWM
PWM
STR1
P1n = PWM
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Reset
‘1’ = Bit is set ‘0’ = Bit is cleared
1000 = Compare mode: initialize ECCP1 pin low; set output on compare match (set CCP1IF)
1001 = Compare mode: initialize ECCP1 pin high; clear output on compare match (set CCP1IF)
1010 = Compare mode: generate software interrupt only; ECCP1 pin reverts to I/O state
1011 = Compare mode: Special Event Trigger (CCP1 resets Timer, sets CCP1IF bit, and starts A/D conversion
if A/D module is enabled)
PWM mode:
1100 = PWM mode: P1A, P1C active-high; P1B, P1D active-high
1101 = PWM mode: P1A, P1C active-high; P1B, P1D active-low
1110 = PWM mode: P1A, P1C active-low; P1B, P1D active-high
1111 = PWM mode: P1A, P1C active-low; P1B, P1D active-low
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Note 1: Bit resets to ‘0’ with Two-Speed Start-up and LP, XT or HS selected as the Oscillator mode or Fail-Safe
mode is enabled.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Note 1: The PWM Steering mode is available only when the CCP1CON register bits CCP1M<3:2> = 11 and
P1M<1:0> = 00.
2: PIC16(L)F1823 only.
Data Bus
Read Write
SSP1BUF Reg
SDI
SSP1SR Reg
SDO bit 0 Shift
Clock
Edge
Select
SSP1M<3:0>
4
( TMR22Output )
SCK
Edge Prescaler TOSC
Select 4, 16, 64
Baud rate
generator
TRIS bit (SSP1ADD)
Internal
data bus [SSP1M 3:0]
Read Write
Internal
Data Bus
Read Write
Shift
Clock
SSP1SR Reg
SDA MSb LSb
SSP1MSK Reg
SSP1ADD Reg
• Serial Clock (SCK) Whether the data is meaningful or not (dummy data),
depends on the application software. This leads to
• Serial Data Out (SDO)
three scenarios for data transmission:
• Serial Data In (SDI)
• Master sends useful data and slave sends dummy
• Slave Select (SS)
data.
Figure 25-1 shows the block diagram of the MSSP1 • Master sends useful data and slave sends useful
module when operating in SPI mode. data.
The SPI bus operates with a single master device and • Master sends dummy data and slave sends useful
one or more slave devices. When multiple slave data.
devices are used, an independent Slave Select con-
Transmissions may involve any number of clock
nection is required from the master device to each
cycles. When there is no more data to be transmitted,
slave device.
the master stops sending the clock signal and it dese-
Figure 25-4 shows a typical connection between a lects the slave.
master device and multiple slave devices.
Every slave device connected to the bus that has not
The master selects only one slave at a time. Most slave been selected through its slave select line must disre-
devices have tri-state outputs so their output signal gard the clock and transmission signals and must not
appears disconnected from the bus when they are not transmit out any data of its own.
selected.
Transmissions involve two shift registers, eight bits in
size, one in the master and one in the slave. With either
the master or the slave device, data is always shifted
out one bit at a time, with the Most Significant bit (MSb)
shifted out first. At the same time, a new Least
Significant bit (LSb) is shifted into the same register.
Figure 25-5 shows a typical connection between two
processors configured as master and slave devices.
Data is shifted out of both shift registers on the pro-
grammed clock edge and latched on the opposite edge
of the clock.
The master device transmits information out on its SDO
output pin which is connected to, and received by, the
slave’s SDI input pin. The slave device transmits infor-
mation out on its SDO output pin, which is connected
to, and received by, the master’s SDI input pin.
To begin communication, the master device first sends
out the clock signal. Both the master and the slave
devices should be configured for the same clock polar-
ity.
The master device starts a transmission by sending out
the MSb from its shift register. The slave device reads
this bit from that same line and saves it into the LSb
position of its shift register.
During each SPI clock cycle, a full duplex data
transmission occurs. This means that while the master
device is sending out the MSb from its shift register (on
its SDO pin) and the slave device is reading this bit and
SCK SCK
SPI Master
SDO SDI SPI Slave
SDI SDO #1
General I/O SS
General I/O
General I/O SCK
SDI SPI Slave
SDO #2
SS
SCK
SDI SPI Slave
SDO #3
SS
Slave Select
General I/O SS
Processor 1 (optional) Processor 2
Write to
SSP1BUF
SCK
(CKP = 0
CKE = 0)
SCK
(CKP = 1
CKE = 0)
4 Clock
SCK Modes
(CKP = 0
CKE = 1)
SCK
(CKP = 1
CKE = 1)
Input
Sample
(SMP = 1)
SSP1IF
SSP1SR to
SSP1BUF
SCK SCK
SPI Master
SDO SDI SPI Slave
SDI SDO #1
General I/O SS
SCK
SDI SPI Slave
SDO #2
SS
SCK
SDI SPI Slave
SDO #3
SS
SS
SCK
(CKP = 0
CKE = 0)
SCK
(CKP = 1
CKE = 0)
Write to
SSP1BUF
Shift register SSP1SR
and bit count are reset
SSP1BUF to
SSP1SR
SDI bit 0
bit 7 bit 7
Input
Sample
SSP1IF
Interrupt
Flag
SSP1SR to
SSP1BUF
SS
Optional
SCK
(CKP = 0
CKE = 0)
SCK
(CKP = 1
CKE = 0)
Write to
SSP1BUF
Valid
SDO bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0
SDI
bit 7 bit 0
Input
Sample
SSP1IF
Interrupt
Flag
SSP1SR to
SSP1BUF
Write Collision
detection active
SS
Not Optional
SCK
(CKP = 0
CKE = 1)
SCK
(CKP = 1
CKE = 1)
Write to
SSP1BUF
Valid
SDO bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0
SDI
bit 7 bit 0
Input
Sample
SSP1IF
Interrupt
Flag
SSP1SR to
SSP1BUF
Write Collision
detection active
SDA
SCL
S P
Change of Change of
Data Allowed Data Allowed
Start Stop
Condition Condition
Sr
Change of Change of
Data Allowed Data Allowed
Restart
Condition
25.4.9 ACKNOWLEDGE SEQUENCE the acknowledge time of the active bus. The ACKTIM
Status bit is only active when the AHEN bit or DHEN
The 9th SCL pulse for any transferred byte in I2C is
bit is enabled.
dedicated as an Acknowledge. It allows receiving
devices to respond back to the transmitter by pulling
the SDA line low. The transmitter must release control
of the line during this time to shift in the response. The
Acknowledge (ACK) is an active-low signal, pulling the
SDA line low indicated to the transmitter that the
device has received the transmitted data and is ready
to receive more.
The result of an ACK is placed in the ACKSTAT bit of
the SSP1CON2 register.
Slave software, when the AHEN and DHEN bits are
set, allow the user to set the ACK value sent back to
the transmitter. The ACKDT bit of the SSP1CON2 reg-
ister is set/cleared to determine the response.
Slave hardware will generate an ACK response if the
AHEN and DHEN bits of the SSP1CON3 register are
clear.
There are certain conditions where an ACK will not be
sent by the slave. If the BF bit of the SSP1STAT regis-
ter or the SSP1OV bit of the SSP1CON1 register are
set when a byte is received.
When the module is addressed, after the 8th falling
edge of SCL on the bus, the ACKTIM bit of the
SSP1CON3 register is set. The ACKTIM bit indicates
DS41413C-page 250
Bus Master sends
Stop condition
From Slave to Master
SCL
1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S P
SSP1IF
SSP1IF set on 9th
Cleared by software Cleared by software falling edge of
SCL
BF
First byte
SSP1BUF is read of data is
PIC12(L)F1822/PIC16(L)F1823
available
in SSP1BUF
SSP1OV
SSP1IF
BF
First byte
of data is
SSP1BUF is read available
in SSP1BUF
SSP1OV
DS41413C-page 251
Master Releases SDA Master sends
to slave for ACK sequence Stop condition
FIGURE 25-16:
DS41413C-page 252
A7 A6 A5 A4 A3 A2 A1 ACK D7 D6 D5 D4 D3 D2 D1 D0 D7 D6 D5 D4 D3 D2 D1 D0
SCL
S 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 P
SSP1IF
If AHEN = 1: SSP1IF is set on
SSP1IF is set 9th falling edge of Cleared by software No interrupt
SCL, after ACK after not ACK
BF from Slave
Address is
read from Data is read from SSP1BUF
ACKDT SSBUF
Slave software
clears ACKDT to Slave software
ACK the received sets ACKDT to
CKP byte not ACK
When AHEN = 1:
When DHEN = 1: CKP set by software,
CKP is cleared by hardware
CKP is cleared by SCL is released
and SCL is stretched hardware on 8th falling
edge of SCL
PIC12(L)F1822/PIC16(L)F1823
ACKTIM
P
I2C SLAVE, 7-BIT ADDRESS, RECEPTION (SEN = 0, AHEN = 1, DHEN = 1)
Stop condition
Master releases
R/W = 0 SDA to slave for ACK sequence
Receiving Address Receive Data Receive Data ACK
SDA ACK
A7 A6 A5 A4 A3 A2 A1 D7 D6 D5 D4 D3 D2 D1 D0 ACK D7 D6 D5 D4 D3 D2 D1 D0
SCL
1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 P
SSP1IF
Cleared by software No interrupt after
if not ACK
from Slave
BF
Received
address is loaded into Received data is SSP1BUF can be
SSP1BUF available on SSP1BUF read any time before
next byte is loaded
ACKDT
ACKTIM
P
I2C SLAVE, 7-BIT ADDRESS, RECEPTION (SEN = 1, AHEN = 1, DHEN = 1)
PIC12(L)F1822/PIC16(L)F1823
DS41413C-page 253
PIC12(L)F1822/PIC16(L)F1823
25.5.3 SLAVE TRANSMISSION 25.5.3.2 7-bit Transmission
When the R/W bit of the incoming address byte is set A master device can transmit a read request to a
and an address match occurs, the R/W bit of the slave, and then clock data out of the slave. The list
SSP1STAT register is set. The received address is below outlines what software for a slave will need to
loaded into the SSP1BUF register, and an ACK pulse do to accomplish a standard transmission.
is sent by the slave on the ninth bit. Figure 25-18 can be used as a reference to this list.
Following the ACK, slave hardware clears the CKP bit 1. Master sends a Start condition on SDA and
and the SCL pin is held low (see Section 25.5.6 SCL.
“Clock Stretching” for more detail). By stretching the 2. S bit of SSP1STAT is set; SSP1IF is set if inter-
clock, the master will be unable to assert another clock rupt-on-Start detect is enabled.
pulse until the slave is done preparing the transmit 3. Matching address with R/W bit set is received by
data. the Slave setting SSP1IF bit.
The transmit data must be loaded into the SSP1BUF 4. Slave hardware generates an ACK and sets
register which also loads the SSP1SR register. Then SSP1IF.
the SCL pin should be released by setting the CKP bit 5. SSP1IF bit is cleared by user.
of the SSP1CON1 register. The eight data bits are
6. Software reads the received address from
shifted out on the falling edge of the SCL input. This
SSP1BUF, clearing BF.
ensures that the SDA signal is valid during the SCL
high time. 7. R/W is set so CKP was automatically cleared
after the ACK.
The ACK pulse from the master-receiver is latched on
8. The slave software loads the transmit data into
the rising edge of the ninth SCL input pulse. This ACK
SSP1BUF.
value is copied to the ACKSTAT bit of the SSP1CON2
register. If ACKSTAT is set (not ACK), then the data 9. CKP bit is set releasing SCL, allowing the mas-
transfer is complete. In this case, when the not ACK is ter to clock the data out of the slave.
latched by the slave, the slave goes Idle and waits for 10. SSP1IF is set after the ACK response from the
another occurrence of the Start bit. If the SDA line was master is loaded into the ACKSTAT register.
low (ACK), the next transmit data must be loaded into 11. SSP1IF bit is cleared.
the SSP1BUF register. Again, the SCL pin must be 12. The slave software checks the ACKSTAT bit to
released by setting bit CKP. see if the master wants to clock out more data.
An MSSP1 interrupt is generated for each data transfer Note 1: If the master ACKs the clock will be
byte. The SSP1IF bit must be cleared by software and stretched.
the SSP1STAT register is used to determine the status
of the byte. The SSP1IF bit is set on the falling edge of 2: ACKSTAT is the only bit updated on the
the ninth clock pulse. rising edge of SCL (9th) rather than the
falling.
25.5.3.1 Slave Mode Bus Collision 13. Steps 9-13 are repeated for each transmitted
A slave receives a Read request and begins shifting byte.
data out on the SDA line. If a bus collision is detected 14. If the master sends a not ACK; the clock is not
and the SBCDE bit of the SSP1CON3 register is set, held, but SSP1IF is still set.
the BCL1IF bit of the PIRx register is set. Once a bus 15. The master sends a Restart condition or a Stop.
collision is detected, the slave goes Idle and waits to be 16. The slave is no longer addressed.
addressed again. User software can use the BCL1IF bit
to handle a slave bus collision.
SCL
1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S P
SSP1IF
BF
BF is automatically
Received address Data to transmit is cleared after 8th falling
is read from SSP1BUF loaded into SSP1BUF edge of SCL
CKP
When R/W is set CKP is not
SCL is always held for not
held low after 9th SCL Set by software ACK
falling edge
ACKSTAT
Indicates an address
has been received
P
PIC12(L)F1822/PIC16(L)F1823
DS41413C-page 255
PIC12(L)F1822/PIC16(L)F1823
25.5.3.3 7-bit Transmission with Address
Hold Enabled
Setting the AHEN bit of the SSP1CON3 register
enables additional clock stretching and interrupt gen-
eration after the 8th falling edge of a received match-
ing address. Once a matching address has been
clocked in, CKP is cleared and the SSP1IF interrupt is
set.
Figure 25-19 displays a standard waveform of a 7-bit
Address Slave Transmission with AHEN enabled.
1. Bus starts Idle.
2. Master sends Start condition; the S bit of
SSP1STAT is set; SSP1IF is set if inter-
rupt-on-Start detect is enabled.
3. Master sends matching address with R/W bit
set. After the 8th falling edge of the SCL line the
CKP bit is cleared and SSP1IF interrupt is gen-
erated.
4. Slave software clears SSP1IF.
5. Slave software reads ACKTIM bit of SSP1CON3
register, and R/W and D/A of the SSP1STAT
register to determine the source of the interrupt.
6. Slave reads the address value from the
SSP1BUF register clearing the BF bit.
7. Slave software decides from this information if it
wishes to ACK or not ACK and sets ACKDT bit
of the SSP1CON2 register accordingly.
8. Slave sets the CKP bit releasing SCL.
9. Master clocks in the ACK value from the slave.
10. Slave hardware automatically clears the CKP bit
and sets SSP1IF after the ACK if the R/W bit is
set.
11. Slave software clears SSP1IF.
12. Slave loads value to transmit to the master into
SSP1BUF setting the BF bit.
Note: SSP1BUF cannot be loaded until after the
ACK.
13. Slave sets CKP bit releasing the clock.
14. Master clocks out the data from the slave and
sends an ACK value on the 9th SCL pulse.
15. Slave hardware copies the ACK value into the
ACKSTAT bit of the SSP1CON2 register.
16. Steps 10-15 are repeated for each byte transmit-
ted to the master from the slave.
17. If the master sends a not ACK the slave
releases the bus, allowing the master to send a
Stop and end the communication.
Note: Master must send a not ACK on the last byte
to ensure that the slave releases the SCL
line to receive a Stop.
SCL
S 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
P
BF BF is automatically
Received address Data to transmit is cleared after 8th falling
is read from SSP1BUF loaded into SSP1BUF edge of SCL
ACKDT
Slave clears
ACKDT to ACK
address
ACKSTAT
Master’s ACK
response is copied
to SSP1STAT
CKP
When AHEN = 1; CKP not cleared
CKP is cleared by hardware When R/W = 1; Set by software, after not ACK
after receiving matching CKP is always releases SCL
address. cleared after ACK
ACKTIM
I2C SLAVE, 7-BIT ADDRESS, TRANSMISSION (AHEN = 1)
R/W
D/A
PIC12(L)F1822/PIC16(L)F1823
DS41413C-page 257
PIC12(L)F1822/PIC16(L)F1823
25.5.4 SLAVE MODE 10-BIT ADDRESS 25.5.5 10-BIT ADDRESSING WITH
RECEPTION ADDRESS OR DATA HOLD
This section describes a standard sequence of events Reception using 10-bit addressing with AHEN or
for the MSSP1 module configured as an I2C Slave in DHEN set is the same as with 7-bit modes. The only
10-bit Addressing mode. difference is the need to update the SSP1ADD register
Figure 25-20 is used as a visual reference for this using the UA bit. All functionality, specifically when the
description. CKP bit is cleared and SCL line is held low are the
same. Figure 25-21 can be used as a reference of a
This is a step by step process of what must be done by slave in 10-bit addressing with AHEN set.
slave software to accomplish I2C communication.
Figure 25-22 shows a standard waveform for a slave
1. Bus starts Idle. transmitter in 10-bit Addressing mode.
2. Master sends Start condition; S bit of
SSP1STAT is set; SSP1IF is set if inter-
rupt-on-Start detect is enabled.
3. Master sends matching high address with R/W
bit clear; UA bit of the SSP1STAT register is set.
4. Slave sends ACK and SSP1IF is set.
5. Software clears the SSP1IF bit.
6. Software reads received address from
SSP1BUF clearing the BF flag.
7. Slave loads low address into SSP1ADD,
releasing SCL.
8. Master sends matching low address byte to the
Slave; UA bit is set.
Note: Updates to the SSP1ADD register are not
allowed until after the ACK sequence.
Master sends
Stop condition
Receive First Address Byte Receive Second Address Byte Receive Data Receive Data
SDA
1 1 1 1
0 A9 A8 ACK A7 A6 A5 A4 A3 A2 A1 A0 ACK D7 D6 D5 D4 D3 D2 D1 D0 ACK D7 D6 D5 D4 D3 D2 D1 D0 ACK
SSP1IF
Set by hardware Cleared by software
on 9th falling edge
BF
If address matches Receive address is Data is read
SSP1ADD it is loaded into read from SSP1BUF from SSP1BUF
SSP1BUF
UA
When UA = 1; Software updates SSP1ADD
SCL is held low and releases SCL
CKP
DS41413C-page 259
Receive First Address Byte R/W = 0 Receive Second Address Byte Receive Data Receive Data
FIGURE 25-21:
DS41413C-page 260
SCL S 1 2 3 4 5 6 7 8 9 UA 1 2 3 4 5 6 7 8 9 UA 1 2 3 4 5 6 7 8 9 1 2
SSP1IF
Set by hardware Cleared by software Cleared by software
on 9th falling edge
BF
UA
PIC12(L)F1822/PIC16(L)F1823
Master sends
Master sends Stop condition
Restart event Master sends
not ACK
Receiving Address R/W = 0 Receiving Second Address Byte Receive First Address Byte Transmitting Data Byte ACK = 1
SDA 1 1 1 1 0 A9 A8 ACK A7 A6 A5 A4 A3 A2 A1 A0 ACK 1 1 1 1 0 A9 A8 ACK D7 D6 D5 D4 D3 D2 D1 D0
SSP1IF
BF
Indicates an address
has been received
I2C SLAVE, 10-BIT ADDRESS, TRANSMISSION (SEN = 0, AHEN = 0, DHEN = 0)
PIC12(L)F1822/PIC16(L)F1823
DS41413C-page 261
PIC12(L)F1822/PIC16(L)F1823
25.5.6 CLOCK STRETCHING 25.5.6.2 10-bit Addressing Mode
Clock stretching occurs when a device on the bus In 10-bit Addressing mode, when the UA bit is set, the
holds the SCL line low effectively pausing communica- clock is always stretched. This is the only time the SCL
tion. The slave may stretch the clock to allow more is stretched without CKP being cleared. SCL is
time to handle data or prepare a response for the mas- released immediately after a write to SSP1ADD.
ter device. A master device is not concerned with
Note: Previous versions of the module did not
stretching as anytime it is active on the bus and not
stretch the clock if the second address byte
transferring data it is stretching. Any stretching done
did not match.
by a slave is invisible to the master software and han-
dled by the hardware that generates SCL.
25.5.6.3 Byte NACKing
The CKP bit of the SSP1CON1 register is used to con-
trol stretching in software. Any time the CKP bit is When AHEN bit of SSP1CON3 is set; CKP is cleared
cleared, the module will wait for the SCL line to go low by hardware after the 8th falling edge of SCL for a
and then hold it. Setting CKP will release SCL and received matching address byte. When DHEN bit of
allow more communication. SSP1CON3 is set; CKP is cleared after the 8th falling
edge of SCL for received data.
25.5.6.1 Normal Clock Stretching Stretching after the 8th falling edge of SCL allows the
Following an ACK if the R/W bit of SSP1STAT is set, a slave to look at the received address or data and
read request, the slave hardware will clear CKP. This decide if it wants to ACK the received data.
allows the slave time to update SSP1BUF with data to
transfer to the master. If the SEN bit of SSP1CON2 is 25.5.7 CLOCK SYNCHRONIZATION AND
set, the slave hardware will always stretch the clock THE CKP BIT
after the ACK sequence. Once the slave is ready; CKP Any time the CKP bit is cleared, the module will wait
is set by software and communication resumes. for the SCL line to go low and then hold it. However,
clearing the CKP bit will not assert the SCL output low
Note 1: The BF bit has no effect on if the clock will
until the SCL output is already sampled low. There-
be stretched or not. This is different than
fore, the CKP bit will not assert the SCL line until an
previous versions of the module that
external I2C master device has already asserted the
would not stretch the clock, clear CKP, if
SCL line. The SCL output will remain low until the CKP
SSP1BUF was read before the 9th falling
bit is set and all other devices on the I2C bus have
edge of SCL.
released SCL. This ensures that a write to the CKP bit
2: Previous versions of the module did not will not violate the minimum high time requirement for
stretch the clock for a transmission if SCL (see Figure 25-23).
SSP1BUF was loaded before the 9th fall-
ing edge of SCL. It is now always cleared
for read requests.
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
SDA DX DX ‚ – 1
SCL
Master device
CKP asserts clock
Master device
releases clock
WR
SSP1CON1
SCL
1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S
SSP1IF
BF (SSP1STAT<0>)
Cleared by software
SSP1BUF is read
GCEN (SSP1CON2<7>)
’1’
SDA DX DX ‚ – 1
BRG decrements on
Q2 and Q4 cycles
BRG
03h 02h 01h 00h (hold off) 03h 02h
Value
25.6.3 WCOL STATUS FLAG the Start condition and causes the S bit of the
SSP1STAT1 register to be set. Following this, the
If the user writes the SSP1BUF when a Start, Restart,
Baud Rate Generator is reloaded with the contents of
Stop, Receive or Transmit sequence is in progress, the
SSP1ADD<7:0> and resumes its count. When the
WCOL is set and the contents of the buffer are
Baud Rate Generator times out (TBRG), the SEN bit of
unchanged (the write does not occur). Any time the
the SSP1CON2 register will be automatically cleared
WCOL bit is set it indicates that an action on SSP1BUF
by hardware; the Baud Rate Generator is suspended,
was attempted while the module was not Idle.
leaving the SDA line held low and the Start condition is
Note: Because queueing of events is not complete.
allowed, writing to the lower five bits of
Note 1: If at the beginning of the Start condition,
SSP1CON2 is disabled until the Start
the SDA and SCL pins are already sam-
condition is complete.
pled low, or if during the Start condition,
the SCL line is sampled low before the
25.6.4 I2C MASTER MODE START
SDA line is driven low, a bus collision
CONDITION TIMING occurs, the Bus Collision Interrupt Flag,
To initiate a Start condition (Figure 25-26), the user BCL1IF, is set, the Start condition is
sets the Start Enable bit, SEN bit of the SSP1CON2 aborted and the I2C module is reset into
register. If the SDA and SCL pins are sampled high, its Idle state.
the Baud Rate Generator is reloaded with the contents 2: The Philips I2C™ Specification states that
of SSP1ADD<7:0> and starts its count. If SCL and a bus collision cannot occur on a Start.
SDA are both sampled high when the Baud Rate Gen-
erator times out (TBRG), the SDA pin is driven low. The
action of the SDA being driven low while SCL is high is
TBRG
SCL
S
TBRG
TBRG
SCL
Sr TBRG
Repeated Start
25.6.6 I2C MASTER MODE erly. The status of ACK is written into the ACKSTAT bit
TRANSMISSION on the rising edge of the ninth clock. If the master
receives an Acknowledge, the Acknowledge Status bit,
Transmission of a data byte, a 7-bit address or the
ACKSTAT, is cleared. If not, the bit is set. After the ninth
other half of a 10-bit address is accomplished by simply
clock, the SSP1IF bit is set and the master clock (Baud
writing a value to the SSP1BUF register. This action will
Rate Generator) is suspended until the next data byte
set the Buffer Full flag bit, BF, and allow the Baud Rate
is loaded into the SSP1BUF, leaving SCL low and SDA
Generator to begin counting and start the next trans-
unchanged (Figure 25-28).
mission. Each bit of address/data will be shifted out
onto the SDA pin after the falling edge of SCL is After the write to the SSP1BUF, each bit of the address
asserted. SCL is held low for one Baud Rate Generator will be shifted out on the falling edge of SCL until all
rollover count (TBRG). Data should be valid before SCL seven address bits and the R/W bit are completed. On
is released high. When the SCL pin is released high, it the falling edge of the eighth clock, the master will
is held that way for TBRG. The data on the SDA pin release the SDA pin, allowing the slave to respond with
must remain stable for that duration and some hold an Acknowledge. On the falling edge of the ninth clock,
time after the next falling edge of SCL. After the eighth the master will sample the SDA pin to see if the address
bit is shifted out (the falling edge of the eighth clock), was recognized by a slave. The status of the ACK bit is
the BF flag is cleared and the master releases SDA. loaded into the ACKSTAT Status bit of the SSP1CON2
This allows the slave device being addressed to register. Following the falling edge of the ninth clock
respond with an ACK bit during the ninth bit time if an transmission of the address, the SSP1IF is set, the BF
address match occurred, or if data was received prop-
DS41413C-page 268
Write SSP1CON2<0> SEN = 1 ACKSTAT in
Start condition begins SSP1CON2 = 1
From slave, clear ACKSTAT bit SSP1CON2<6>
SEN = 0
Transmitting Data or Second Half
Transmit Address to Slave R/W = 0 ACK
of 10-bit Address
SDA A7 A6 A5 A4 A3 A2 A1 ACK = 0 D7 D6 D5 D4 D3 D2 D1 D0
BF (SSP1STAT<0>)
PEN
R/W
I2C MASTER MODE WAVEFORM (TRANSMISSION, 7 OR 10-BIT ADDRESS)
DS41413C-page 270
ACK from Master
Master configured as a receiver SDA = ACKDT = 0 SDA = ACKDT = 1
SEN = 0 by programming SSP1CON2<3> (RCEN = 1)
PEN bit = 1
Write to SSP1BUF occurs here, RCEN cleared RCEN = 1, start RCEN cleared
ACK from Slave next receive automatically written here
start XMIT automatically
Transmit Address to Slave Receiving Data from Slave Receiving Data from Slave
SDA A7 A6 A5 A4 A3 A2 A1 R/W ACK D7 D6 D5 D4 D3 D2 D1 D0 ACK D7 D6 D5 D4 D3 D2 D1 D0 ACK
Bus master
ACK is not sent terminates
transfer
1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
SCL S P
Data shifted in on falling edge of CLK Set SSP1IF at end
of receive Set SSP1IF interrupt
Set SSP1IF interrupt at end of Acknow-
Set SSP1IF interrupt ledge sequence
at end of receive at end of Acknowledge
SSP1IF sequence
Set P bit
Cleared by software Cleared by software Cleared by software Cleared by software (SSP1STAT<4>)
SDA = 0, SCL = 1 Cleared in
while CPU software and SSP1IF
responds to SSP1IF
BF
(SSP1STAT<0>) Last bit is shifted into SSP1SR and
contents are unloaded into SSP1BUF
PIC12(L)F1822/PIC16(L)F1823
SSP1OV
ACKEN
I2C MASTER MODE WAVEFORM (RECEPTION, 7-BIT ADDRESS)
RCEN
Master configured as a receiver RCEN cleared ACK from Master RCEN cleared
by programming SSP1CON2<3> (RCEN = 1) automatically SDA\ = ACKDT = 0 automatically
SCL 8 9
SSP1IF
Cleared in
SSP1IF set at software
the end of receive Cleared in
software SSP1IF set at the end
of Acknowledge sequence
Note: TBRG = one Baud Rate Generator period.
SDA ACK
P
TBRG TBRG TBRG
SCL brought high after TBRG
SDA asserted low before rising edge of clock
to setup Stop condition
SDA
BCL1IF
SDA
SCL
Set SEN, enable Start SEN cleared automatically because of bus collision.
condition if SDA = 1, SCL = 1 SSP1 module reset into Idle state.
SEN
SDA sampled low before
Start condition. Set BCL1IF.
S bit and SSP1IF set because
BCL1IF SDA = 0, SCL = 1.
SSP1IF and BCL1IF are
cleared by software
SSP1IF
TBRG TBRG
SDA
FIGURE 25-35: BRG RESET DUE TO SDA ARBITRATION DURING START CONDITION
SDA = 0, SCL = 1
Set S Set SSP1IF
Less than TBRG
TBRG
SCL S
SCL pulled low after BRG
time-out
SEN
Set SEN, enable Start
sequence if SDA = 1, SCL = 1
BCL1IF ’0’
SSP1IF
SDA = 0, SCL = 1, Interrupts cleared
set SSP1IF by software
SDA
SCL
RSEN
BCL1IF
Cleared by software
S ’0’
SSP1IF ’0’
TBRG TBRG
SDA
SCL
S ’0’
SSP1IF
PEN
BCL1IF
P ’0’
SSP1IF ’0’
SDA
PEN
BCL1IF
P ’0’
SSP1IF ’0’
SSP1M<3:0> SSP1ADD<7:0>
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared HS = Bit is set by hardware C = User cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘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 SSP1SR
0 = General call address disabled
bit 6 ACKSTAT: Acknowledge Status bit (in I2C mode only)
1 = Acknowledge was not received
0 = Acknowledge was received
bit 5 ACKDT: Acknowledge Data bit (in I2C mode only)
In Receive mode:
Value transmitted when the user initiates an Acknowledge sequence at the end of a receive
1 = Not Acknowledge
0 = Acknowledge
bit 4 ACKEN: Acknowledge Sequence Enable bit (in I2C Master mode only)
In Master Receive mode:
1 = Initiate Acknowledge sequence on SDA and SCL pins, and transmit ACKDT data bit.
Automatically cleared by hardware.
0 = Acknowledge sequence Idle
bit 3 RCEN: Receive Enable bit (in I2C Master mode only)
1 = Enables Receive mode for I2C
0 = Receive Idle
bit 2 PEN: Stop Condition Enable bit (in I2C Master mode only)
SCK Release Control:
1 = Initiate Stop condition on SDA and SCL 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 SDA and SCL 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 SDA and SCL 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 SSP1BUF may not be written (or writes to the SSP1BUF are disabled).
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Note 1: For daisy-chained SPI operation; allows the user to ignore all but the last received byte. SSP1OV is still set
when a new byte is received and BF = 1, but hardware continues to write the most recent byte to
SSP1BUF.
2: This bit has no effect in Slave modes that Start and Stop condition detection is explicitly listed as enabled.
3: The ACKTIM Status bit is only active when the AHEN bit or DHEN bit is set.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
REGISTER 25-6: SSP1ADD: MSSP1 ADDRESS AND BAUD RATE REGISTER (I2C MODE)
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 = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Master mode:
bit 7-3 Not used: Unused for Most Significant Address byte. Bit state of this register is a “don’t care”. Bit pat-
tern 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 ADD<2:1>: Two Most Significant bits of 10-bit address
bit 0 Not used: Unused in this mode. Bit state is a “don’t care”.
10-Bit Slave mode — Least Significant Address byte:
TXEN
TRMT SPEN
Baud Rate Generator FOSC
÷n
TX9
BRG16 n
+1 Multiplier x4 x16 x64
TX9D
SYNC 1 X 0 0 0
SPBRGH SPBRGL BRGH X 1 1 0 0
BRG16 X 1 0 1 0
BRG16
+1 n
Multiplier x4 x16 x64
SYNC 1 X 0 0 0
SPBRGH SPBRGL BRGH FIFO
X 1 1 0 0 FERR RX9D RCREG Register
BRG16 X 1 0 1 0
8
Data Bus
RCIF Interrupt
RCIE
The EUSART transmitter block diagram is shown in The TXIF interrupt can be enabled by setting the TXIE
Figure 26-1. The heart of the transmitter is the serial interrupt enable bit of the PIE1 register. However, the
Transmit Shift Register (TSR), which is not directly TXIF flag bit will be set whenever the TXREG is empty,
accessible by software. The TSR obtains its data from regardless of the state of TXIE enable bit.
the transmit buffer, which is the TXREG register. To use interrupts when transmitting data, set the TXIE
bit only when there is more data to send. Clear the
26.1.1.1 Enabling the Transmitter TXIE interrupt enable bit upon writing the last character
The EUSART transmitter is enabled for asynchronous of the transmission to the TXREG.
operations by configuring the following three control
bits:
• TXEN = 1
• SYNC = 0
• SPEN = 1
All other EUSART control bits are assumed to be in
their default state.
Setting the TXEN bit of the TXSTA register enables the
transmitter circuitry of the EUSART. Clearing the SYNC
bit of the TXSTA register configures the EUSART for
asynchronous operation. Setting the SPEN bit of the
RCSTA register enables the EUSART and
automatically configures the TX/CK I/O pin as an output.
If the TX/CK pin is shared with an analog peripheral, the
analog I/O function must be disabled by clearing the
corresponding ANSEL bit.
Note 1: The TXIF Transmitter Interrupt flag is set
when the TXEN enable bit is set.
Write to TXREG
Word 1
BRG Output
(Shift Clock)
TX/CK
pin Start bit bit 0 bit 1 bit 7/8 Stop bit
Word 1
TXIF bit
(Transmit Buffer 1 TCY
Reg. Empty Flag)
Word 1
TRMT bit Transmit Shift Reg.
(Transmit Shift
Reg. Empty Flag)
Write to TXREG
Word 1 Word 2
BRG Output
(Shift Clock)
TX/CK
pin Start bit bit 0 bit 1 bit 7/8 Stop bit Start bit bit 0
TXIF bit 1 TCY Word 1 Word 2
(Transmit Buffer
Reg. Empty Flag) 1 TCY
• CREN = 1 Immediately after all data bits and the Stop bit have
been received, the character in the RSR is transferred
• SYNC = 0
to the EUSART receive FIFO and the RCIF interrupt
• SPEN = 1 flag bit of the PIR1 register is set. The top character in
All other EUSART control bits are assumed to be in the FIFO is transferred out of the FIFO by reading the
their default state. RCREG register.
Setting the CREN bit of the RCSTA register enables the Note: If the receive FIFO is overrun, no additional
receiver circuitry of the EUSART. Clearing the SYNC bit characters will be received until the overrun
of the TXSTA register configures the EUSART for condition is cleared. See Section 26.1.2.5
asynchronous operation. Setting the SPEN bit of the “Receive Overrun Error” for more
RCSTA register enables the EUSART. The programmer information on overrun errors.
must set the corresponding TRIS bit to configure the
RX/DT I/O pin as an input. 26.1.2.3 Receive Interrupts
Note 1: If the RX/DT function is on an analog pin, The RCIF interrupt flag bit of the PIR1 register is set
the corresponding ANSEL bit must be whenever the EUSART receiver is enabled and there is
cleared for the receiver to function. an unread character in the receive FIFO. The RCIF
interrupt flag bit is read-only, it cannot be set or cleared
by software.
RCIF interrupts are enabled by setting all of the
following bits:
• RCIE interrupt enable bit of the PIE1 register
• PEIE peripheral interrupt enable bit of the
INTCON register
• GIE global interrupt enable bit of the INTCON
register
The RCIF interrupt flag bit will be set when there is an
unread character in the FIFO, regardless of the state of
interrupt enable bits.
Read Rcv
Buffer Reg.
RCREG
RCIF
(Interrupt Flag)
OERR bit
CREN
Note: This timing diagram shows three words appearing on the RX input. The RCREG (receive buffer) is read after the third word,
causing the OERR (overrun) bit to be set.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
TABLE 26-4: SUMMARY OF REGISTERS ASSOCIATED WITH THE BAUD RATE GENERATOR
Register
Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
on Page
BAUDCON ABDOVF RCIDL — SCKP BRG16 — WUE ABDEN 296
RCSTA SPEN RX9 SREN CREN ADDEN FERR OERR RX9D 295
SPBRGL BRG<7:0> 297*
SPBRGH BRG<15:8> 297*
TXSTA CSRC TX9 TXEN SYNC SENDB BRGH TRMT TX9D 294
Legend: — = unimplemented location, read as ‘0’. Shaded cells are not used for the Baud Rate Generator.
* Page provides register information.
BAUD FOSC = 32.000 MHz FOSC = 20.000 MHz FOSC = 18.432 MHz FOSC = 11.0592 MHz
RATE SPBRG SPBRG SPBRG SPBRG
Actual % Actual % Actual % Actual %
value value value value
Rate Error Rate Error Rate Error Rate Error
(decimal) (decimal) (decimal) (decimal)
300 — — — — — — — — — — — —
1200 — — — — — — — — — — — —
2400 — — — — — — — — — — — —
9600 9615 0.16 207 9615 0.16 129 9600 0.00 119 9600 0.00 71
10417 10417 0.00 191 10417 0.00 119 10378 -0.37 110 10473 0.53 65
19.2k 19.23k 0.16 103 19.23k 0.16 64 19.20k 0.00 59 19.20k 0.00 35
57.6k 57.14k -0.79 34 56.82k -1.36 21 57.60k 0.00 19 57.60k 0.00 11
115.2k 117.64k 2.12 16 113.64k -1.36 10 115.2k 0.00 9 115.2k 0.00 5
BAUD FOSC = 8.000 MHz FOSC = 4.000 MHz FOSC = 3.6864 MHz FOSC = 1.000 MHz
RATE SPBRG SPBRG SPBRG SPBRG
Actual % Actual % Actual % Actual %
value value value value
Rate Error Rate Error Rate Error Rate Error
(decimal) (decimal) (decimal) (decimal)
300 — — — — — — — — — 300 0.16 207
1200 — — — 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 5
19.2k 19231 0.16 25 19.23k 0.16 12 19.2k 0.00 11 — — —
57.6k 55556 -3.55 8 — — — 57.60k 0.00 3 — — —
115.2k — — — — — — 115.2k 0.00 1 — — —
BAUD FOSC = 32.000 MHz FOSC = 20.000 MHz FOSC = 18.432 MHz FOSC = 11.0592 MHz
RATE SPBRG SPBRG SPBRG SPBRG
Actual % Actual % Actual % Actual %
value value value value
Rate Error Rate Error Rate Error Rate Error
(decimal) (decimal) (decimal) (decimal)
300 300.0 0.00 6666 300.0 -0.01 4166 300.0 0.00 3839 300.0 0.00 2303
1200 1200 -0.02 3332 1200 -0.03 1041 1200 0.00 959 1200 0.00 575
2400 2401 -0.04 832 2399 -0.03 520 2400 0.00 479 2400 0.00 287
9600 9615 0.16 207 9615 0.16 129 9600 0.00 119 9600 0.00 71
10417 10417 0.00 191 10417 0.00 119 10378 -0.37 110 10473 0.53 65
19.2k 19.23k 0.16 103 19.23k 0.16 64 19.20k 0.00 59 19.20k 0.00 35
57.6k 57.14k -0.79 34 56.818 -1.36 21 57.60k 0.00 19 57.60k 0.00 11
115.2k 117.6k 2.12 16 113.636 -1.36 10 115.2k 0.00 9 115.2k 0.00 5
BAUD FOSC = 8.000 MHz FOSC = 4.000 MHz FOSC = 3.6864 MHz FOSC = 1.000 MHz
RATE SPBRG SPBRG SPBRG SPBRG
Actual % Actual % Actual % Actual %
value value value value
Rate Error Rate Error Rate Error Rate Error
(decimal) (decimal) (decimal) (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 5
19.2k 19.23k 0.16 25 19.23k 0.16 12 19.20k 0.00 11 — — —
57.6k 55556 -3.55 8 — — — 57.60k 0.00 3 — — —
115.2k — — — — — — 115.2k 0.00 1 — — —
BAUD FOSC = 32.000 MHz FOSC = 20.000 MHz FOSC = 18.432 MHz FOSC = 11.0592 MHz
RATE SPBRG SPBRG SPBRG SPBRG
Actual % Actual % Actual % Actual %
value value value value
Rate Error Rate Error Rate Error Rate Error
(decimal) (decimal) (decimal) (decimal)
300 300.0 0.00 26666 300.0 0.00 16665 300.0 0.00 15359 300.0 0.00 9215
1200 1200 0.00 6666 1200 -0.01 4166 1200 0.00 3839 1200 0.00 2303
2400 2400 0.01 3332 2400 0.02 2082 2400 0.00 1919 2400 0.00 1151
9600 9604 0.04 832 9597 -0.03 520 9600 0.00 479 9600 0.00 287
10417 10417 0.00 767 10417 0.00 479 10425 0.08 441 10433 0.16 264
19.2k 19.18k -0.08 416 19.23k 0.16 259 19.20k 0.00 239 19.20k 0.00 143
57.6k 57.55k -0.08 138 57.47k -0.22 86 57.60k 0.00 79 57.60k 0.00 47
115.2k 115.9k 0.64 68 116.3k 0.94 42 115.2k 0.00 39 115.2k 0.00 23
BAUD FOSC = 8.000 MHz FOSC = 4.000 MHz FOSC = 3.6864 MHz FOSC = 1.000 MHz
RATE SPBRG SPBRG SPBRG SPBRG
Actual % Actual % Actual % Actual %
value value value value
Rate Error Rate Error Rate Error Rate Error
(decimal) (decimal) (decimal) (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 0 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 8 115.2k 0.00 7 — — —
BRG Clock
RCIDL
RCIF bit
(Interrupt)
Read
RCREG
Note 1: The ABD sequence requires the EUSART module to be configured in Asynchronous mode.
RCIF
Cleared due to User Read of RCREG
Note 1: The EUSART remains in Idle while the WUE bit is set.
Note 1: 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.
2: The EUSART remains in Idle while the WUE bit is set.
Write to TXREG
Dummy Write
BRG Output
(Shift Clock)
TX/CK pin
(SCKP = 1)
Write to
TXREG Reg Write Word 1 Write Word 2
TXIF bit
(Interrupt Flag)
TRMT bit
‘1’ ‘1’
TXEN bit
Note: Sync Master mode, SPBRGL = 0, continuous transmission of two 8-bit words.
TX/CK pin
Write to
TXREG reg
TXIF bit
TRMT bit
TXEN bit
RX/DT
pin bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7
TX/CK pin
(SCKP = 0)
TX/CK pin
(SCKP = 1)
Write to
bit SREN
SREN bit
RCIF bit
(Interrupt)
Read
RCREG
Note: Timing diagram demonstrates Sync Master mode with bit SREN = 1 and bit BRGH = 0.
Upon waking from Sleep, the instruction following the 26.5.3 ALTERNATE PIN LOCATIONS
SLEEP instruction will be executed. If the GIE global
This module incorporates I/O pins that can be moved to
interrupt enable bit of the INTCON register is also set,
other locations with the use of the alternate pin function
then the Interrupt Service Routine at address 004h will
register APFCON. To determine which pins can be
be called.
moved and what their default locations are upon a
reset, see Section 12.1 “Alternate Pin Function”for
more information.
Timer0 Module
Set
TMR0CS TMR0IF
T0XCS
FOSC/4 0
Overflow
T0CKI 0 TMR0
1
CPSCH<3:0> 1
CPSON(2) CPSRNG<1:0>
CPSON
Capacitive
Sensing Timer1 Module
CPS0 Oscillator
T1CS<1:0>
CPS1 CPSOSC
CPS2 FOSC
FOSC/4
CPS3 CPSCLK
0 Int.
CPS4(1) Ref- Ref. T1OSC/ TMR1H:TMR1L
EN
(1) CPSOUT T1CKI
CPS5 1 DAC
CPS6(1) 0 T1GSEL<1:0>
Ref+
CPS7(1) T1G
1 FVR
Timer1 Gate
SYNCC1OUT Control Logic
SYNCC2OUT
CPSRM
Note 1: Reference CPSCON1 register (Register 27-2) for channels implemented on each device.
2: If CPSON = 0, disabling capacitive sensing, no channel is selected.
Oscillator Module
VDD
(1)
(2)
+
-
S Q CPSCLK
CPSx
Internal
References
0 0
Ref- Ref+
1 DAC 1 FVR
CPSRM
Note 1: Module Enable and Power mode selections are not shown.
2: Comparators remain active in Noise Detection mode.
When Timer0 is chosen as the timer resource, the The value of the timer resource is the number of
capacitive sensing oscillator will be the clock source for oscillations of the capacitive sensing oscillator for the
Timer0. Refer to Section 20.0 “Timer0 Module” for given time base. The frequency of the capacitive
additional information. sensing oscillator is equal to the number of counts on
in the timer divided by the period of the fixed time base.
27.6.2 TIMER1
27.7.2 REDUCED FREQUENCY
To select Timer1 as the timer resource for the CPS (ADDITIONAL CAPACITIVE LOAD)
module, set the TMR1CS<1:0> of the T1CON register
to ‘11’. When Timer1 is chosen as the timer resource, The extra capacitive load will cause the frequency of the
the capacitive sensing oscillator will be the clock capacitive sensing oscillator to decrease. To determine
source for Timer1. Because the Timer1 module has a the reduced frequency of the capacitive sensing
gate control, developing a time base for the frequency oscillator:
measurement can be simplified by using the Timer0 • Add a typical capacitive load on the selected
overflow flag. CPSx pin.
It is recommend that the Timer0 overflow flag, in con- • Use the same fixed time base as the nominal
junction with the Toggle mode of the Timer1 Gate, be frequency measurement.
used to develop the fixed time base required by the • At the start of the fixed time base, clear the timer
software portion of the CPS module. Refer to resource.
Section 21.12 “Timer1 Gate Control Register” for • At the end of the fixed time base save the value in
additional information. the timer resource.
The value of the timer resource is the number of oscil-
TABLE 27-2: TIMER1 ENABLE FUNCTION
lations of the capacitive sensing oscillator with an addi-
TMR1ON TMR1GE Timer1 Operation tional capacitive load. The frequency of the capacitive
0 0 Off sensing oscillator is equal to the number of counts on
in the timer divided by the period of the fixed time base.
0 1 Off This frequency should be less than the value obtained
1 0 On during the nominal frequency measurement.
1 1 Count Enabled by input
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
RJ11-6PIN
® R1
To MPLAB ICD 2 To Target Board
270 Ohm
LM431BCMX
2 A 1
K
3 A U1
6 A NC 4
7 A NC 5
VREF
8
R2 R3
10k 1% 24k 1%
Pin 1 Indicator
Pin Description*
1 1 = VPP/MCLR
2
2 = VDD Target
3
4 3 = VSS (ground)
5
6 4 = ICSPDAT
5 = ICSPCLK
6 = No Connect
External
Programming VDD Device to be
Signals Programmed
VDD VDD
VPP MCLR/VPP
VSS VSS
Data ICSPDAT
Clock ICSPCLK
* * *
To Normal Connections
OPCODE only
13 0
OPCODE
CONTROL OPERATIONS
BRA k Relative Branch 2 11 001k kkkk kkkk
BRW – Relative Branch with W 2 00 0000 0000 1011
CALL k Call Subroutine 2 10 0kkk kkkk kkkk
CALLW – Call Subroutine with W 2 00 0000 0000 1010
GOTO k Go to address 2 10 1kkk kkkk kkkk
RETFIE k Return from interrupt 2 00 0000 0000 1001
RETLW k Return with literal in W 2 11 0100 kkkk kkkk
RETURN – Return from Subroutine 2 00 0000 0000 1000
INHERENT OPERATIONS
CLRWDT – Clear Watchdog Timer 1 00 0000 0110 0100 TO, PD
NOP – No Operation 1 00 0000 0000 0000
OPTION – Load OPTION_REG register with W 1 00 0000 0110 0010
RESET – Software device Reset 1 00 0000 0000 0001
SLEEP – Go into Standby mode 1 00 0000 0110 0011 TO, PD
TRIS f Load TRIS register with W 1 00 0000 0110 0fff
C-COMPILER OPTIMIZED
ADDFSR n, k Add Literal k to FSRn 1 11 0001 0nkk kkkk
MOVIW n mm Move Indirect FSRn to W with pre/post inc/dec 1 00 0000 0001 0nmm Z 2, 3
modifier, mm
k[n] Move INDFn to W, Indexed Indirect. 1 11 1111 0nkk kkkk Z 2
MOVWI n mm Move W to Indirect FSRn with pre/post inc/dec 1 00 0000 0001 1nmm 2, 3
modifier, mm
k[n] Move W to INDFn, Indexed Indirect. 1 11 1111 1nkk kkkk 2
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.
Description: Bit ‘b’ in register ‘f’ is cleared. Description: If bit ‘b’ in register ‘f’ is ‘1’, the next
instruction is executed.
If bit ‘b’, in register ‘f’, is ‘0’, the next
instruction is discarded, and a NOP is
executed instead, making this a
2-cycle instruction.
C register f 0 Words: 1
Cycles: 1
Example: MOVF FSR, 0
After Instruction
LSRF Logical Right Shift
W = value in FSR register
Syntax: [ label ] LSRF f {,d} Z = 1
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: The contents of register ‘f’ are shifted
one bit to the right through the Carry
flag. A ‘0’ is shifted into the MSb. If ‘d’ is
‘0’, the result is placed in W. If ‘d’ is ‘1’,
the result is stored back in register ‘f’.
0 register f C
Description: The W register is loaded with the eight Description: The contents of register ‘f’ are rotated
bit literal ‘k’. The program counter is one bit to the left through the Carry
loaded from the top of the stack (the flag. If ‘d’ is ‘0’, the result is placed in
return address). This is a two-cycle the W register. If ‘d’ is ‘1’, the result is
instruction. stored back in register ‘f’.
Words: 1 C Register f
Cycles: 2
Words: 1
Example: CALL TABLE;W contains table
;offset value Cycles: 1
• ;W now has table value Example: RLF REG1,0
TABLE •
Before Instruction
•
REG1 = 1110 0110
ADDWF PC ;W = offset
C = 0
RETLW k1 ;Begin table
After Instruction
RETLW k2 ;
REG1 = 1110 0110
•
W = 1100 1100
•
C = 1
•
RETLW kn ; End of table
Before Instruction
W = 0x07
After Instruction
W = value of k8
2.5
1.8
0 4 10 16 32
Frequency (MHz)
Note 1: The shaded region indicates the permissible combinations of voltage and frequency.
2: Refer to Table 30-1 for each Oscillator mode’s supported frequencies.
3.6
2.5
1.8
0 4 10 16 32
Frequency (MHz)
Note 1: The shaded region indicates the permissible combinations of voltage and frequency.
2: Refer to Table 30-1 for each oscillator mode’s supported frequencies.
125
± 5%
85
± 3%
Temperature (°C)
60
25 ± 2%
0
-20 ± 5%
-40
1.8 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
VDD
VPOR
VPORR
VSS
NPOR
POR REARM
VSS
TVLOW(2) TPOR(3)
— 24 50 60 A 5.0
D023 — 0.3 1.8 10.5 A 1.8 LPWDT Current (Note 1)
— 0.5 2.0 16 A 3.0
D023 — 20 41 56 A 1.8 LPWDT Current (Note 1)
— 22 46 61 A 3.0
— 24 51 71 A 5.0
D023A — 12 25 35 A 1.8 FVR current (Note 1)
— 13 27 37 A 3.0
D023A — 32 65 70 A 1.8 FVR current (Note 1)
— 38 75 80 A 3.0
— 68 115 120 A 5.0
D024 — 8.0 15 20 A 3.0 BOR Current (Note 1)
D024 — 30 55 65 A 3.0 BOR Current (Note 1)
— 33 75 85 A 5.0
D025 — 0.65 4.0 7.0 A 1.8 T1OSC Current (Note 1)
— 2.3 4.5 7.5 A 3.0
D025 — 20 42 55 A 1.8 T1OSC Current (Note 1)
— 23 45 60 A 3.0
— 25 48 70 A 5.0
D026 — 0.1 1.8 4.0 A 1.8 A/D Current (Note 1, Note 3), no
— 0.1 2.0 5.0 A 3.0 conversion in progress
— 24 50 70 A 5.0
* These parameters are characterized but not tested.
† Data in “Typ” column is at 3.0V, 25°C unless otherwise stated. These parameters are for design guidance only and are
not tested.
Note 1: The peripheral current is the sum of the base IDD or IPD and the additional current consumed when this peripheral is
enabled. The peripheral current can be determined by subtracting the base IDD or IPD current from this limit. Max
values should be used when calculating total current consumption.
2: The power-down current in Sleep mode does not depend on the oscillator type. Power-down current is measured with
the part in Sleep mode, with all I/O pins in high-impedance state and tied to VDD.
3: A/D oscillator source is FRC.
— 280 — — A 5.0
D027 — 2.2 7.0 10 A 1.8 Cap Sense Low Power
— 4.2 9.0 12 A 3.0 Oscillator mode (Note 1)
— 24 53 68 A 5.0
D027A — 6.3 9 16 A 1.8 Cap Sense Medium Power
— 7.9 12 21 A 3.0 Oscillator mode (Note 1)
— 25 60 75 A 5.0
D027B — 16 25 35 A 1.8 Cap Sense High Power
— 41 45 45 A 3.0 Oscillator mode (Note 1)
TH01 JA Thermal Resistance Junction to Ambient 89.3 C/W 8-pin PDIP package
149.5 C/W 8-pin SOIC package
56.7 C/W 8-pin DFN 3X3mm package
70.0 C/W 14-pin PDIP package
95.3 C/W 14-pin SOIC package
100 C/W 14-pin TSSOP 4x4mm package
45.7 C/W 16-pin QFN 4X4mm package
TH02 JC Thermal Resistance Junction to Case 43.1 C/W 8-pin PDIP package
39.9 C/W 8-pin SOIC package
9.0 C/W 8-pin DFN 3X3mm package
32.0 C/W 14-pin PDIP package
31.0 C/W 14-pin SOIC package
24.4 C/W 14-pin TSSOP 4x4mm package
6.3 C/W 16-pin QFN 4X4mm package
TH03 TJMAX Maximum Junction Temperature 150 C
TH04 PD Power Dissipation — W PD = PINTERNAL + PI/O
TH05 PINTERNAL Internal Power Dissipation — W PINTERNAL = IDD x VDD(1)
TH06 PI/O I/O Power Dissipation — W PI/O = (IOL * VOL) + (IOH * (VDD - VOH))
TH07 PDER Derated Power — W PDER = PDMAX (TJ - TA)/JA(2)
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.
1. TppS2ppS
2. TppS
T
F Frequency T Time
Lowercase letters (pp) and their meanings:
pp
cc CCP1 osc OSC1
ck CLKOUT rd RD
cs CS rw RD or WR
di SDIx sc SCKx
do SDO ss SS
dt Data in t0 T0CKI
io I/O PORT t1 T1CKI
mc MCLR wr WR
Uppercase letters and their meanings:
S
F Fall P Period
H High R Rise
I Invalid (High-impedance) V Valid
L Low Z High-impedance
Pin CL
VSS
Q4 Q1 Q2 Q3 Q4 Q1
OSC1/CLKIN
OS02
OS04 OS04
OS03
OSC2/CLKOUT
(LP,XT,HS Modes)
OSC2/CLKOUT
(CLKOUT Mode)
OS01 FOSC External CLKIN Frequency(1) DC — 0.5 MHz EC Oscillator mode (low)
DC — 4 MHz EC Oscillator mode (medium)
DC — 32 MHz EC Oscillator mode (high)
Oscillator Frequency(1) — 32.768 — kHz LP Oscillator mode
0.1 — 4 MHz XT Oscillator mode
1 — 4 MHz HS Oscillator mode, VDD 2.7V
1 — 20 MHz HS Oscillator mode, VDD > 2.7V
DC — 4 MHz RC Oscillator mode
OS02 TOSC External CLKIN Period(1) 27 — s LP Oscillator mode
250 — ns XT Oscillator mode
50 — ns HS Oscillator mode
31.25 — ns EC Oscillator mode
Oscillator Period(1) — 30.5 — s LP Oscillator mode
250 — 10,000 ns XT Oscillator mode
50 — 1,000 ns HS Oscillator mode
250 — — ns RC Oscillator mode
OS03 TCY Instruction Cycle Time(1) 200 — DC ns TCY = FOSC/4
OS04* TosH, External CLKIN High, 2 — — s LP oscillator
TosL External CLKIN Low 100 — — ns XT oscillator
20 — — ns HS oscillator
OS05* TosR, External CLKIN Rise, 0 — ns LP oscillator
TosF External CLKIN Fall 0 — ns XT oscillator
0 — ns HS oscillator
* These parameters are characterized but not tested.
†Data in “Typ” column is at 3.0V, 25°C unless otherwise stated. These parameters are for design guidance only and are not
tested.
Note 1: Instruction cycle period (TCY) equals four times the input oscillator time base period. All specified values are based on
characterization data for that particular oscillator type under standard operating conditions with the device executing code.
Exceeding these specified limits may result in an unstable oscillator operation and/or higher than expected current con-
sumption. All devices are tested to operate at “min” values with an external clock applied to OSC1 pin. When an external
clock input is used, the “max” cycle time limit is “DC” (no clock) for all devices.
MFINTOSC
Wake-up from Sleep Start-up Time — — 24 35 s
*These parameters are characterized but not tested.
†Data in “Typ” column is at 3.0V, 25°C unless otherwise stated. These parameters are for design guidance only and are not
tested.
Note 1: Instruction cycle period (TCY) equals four times the input oscillator time base period. All specified values are based on
characterization data for that particular oscillator type under standard operating conditions with the device executing code.
Exceeding these specified limits may result in an unstable oscillator operation and/or higher than expected current con-
sumption. All devices are tested to operate at “min” values with an external clock applied to the OSC1 pin. When an exter-
nal clock input is used, the “max” cycle time limit is “DC” (no clock) for all devices.
2: To ensure these oscillator frequency tolerances, VDD and VSS must be capacitively decoupled as close to the device as
possible. 0.1 F and 0.01 F values in parallel are recommended.
3: By design.
FOSC
OS11 OS12
OS20
CLKOUT OS21
OS19 OS16 OS18
OS13 OS17
I/O pin
(Input)
OS15 OS14
I/O pin Old Value New Value
(Output)
OS18, OS19
FIGURE 30-8: RESET, WATCHDOG TIMER, OSCILLATOR START-UP TIMER AND POWER-UP
TIMER TIMING
VDD
MCLR
30
Internal
POR
33
PWRT
Time-out 32
OSC
Start-Up Time
Internal Reset(1)
Watchdog Timer
Reset(1)
31
34
34
I/O pins
VDD
VBOR and VHYST
VBOR
37
Reset
33(1)
(due to BOR)
Note 1: 64 ms delay only if PWRTE bit in the Configuration Word 1 is programmed to ‘0’.
2 ms delay if PWRTE = 0 and VREGEN = 1.
T0CKI
40 41
42
T1CKI
45 46
47 49
TMR0 or
TMR1
CC01 CC02
CC03
BSF ADCON0, GO
1 TCY
AD134 (TOSC/2(1))
AD131
Q4
AD130
A/D CLK
A/D Data 7 6 5 4 3 2 1 0
ADIF 1 TCY
GO DONE
Sampling Stopped
Sample AD132
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.
BSF ADCON0, GO
AD134 (TOSC/2 + TCY(1)) 1 TCY
AD131
Q4
AD130
A/D CLK
A/D Data 7 6 5 4 3 2 1 0
ADIF 1 TCY
GO DONE
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.
Param
Sym. Characteristics Min. Typ. Max. Units Comments
No.
CM01 VIOFF Input Offset Voltage — ±7.5 ±60 mV VICM = VDD/2,
High-Power mode
CM02 VICM Input Common Mode Voltage 0 — VDD V
CM03 CMRR Common Mode Rejection Ratio — 50 — dB
CM04A Response Time Rising Edge — 400 800 ns High-Power Mode
CM04B Response Time Falling Edge — 200 400 ns High-Power Mode
TRESP(1)
CM04C Response Time Rising Edge — 1200 — ns Low-Power Mode
CM04D Response Time Falling Edge — 550 — ns Low-Power Mode
CM05 TMC2OV Comparator Mode Change to — — 10 s
Output Valid*
CM06 CHYSTER Comparator Hysteresis(2) — 45 — mV Hysteresis on
* These parameters are characterized but not tested.
Note 1: Response time measured with one comparator input at VDD/2, while the other input transitions
from VSS to VDD.
2: Comparator Hysteresis is available when the CxHYS bit of the CMxCON0 register is enabled.
Param
Sym. Characteristics Min. Typ. Max. Units Comments
No.
DAC01* CLSB Step Size — VDD/32 — V
DAC02* CACC Absolute Accuracy — — 1/2 LSb
DAC03* CR Unit Resistor Value (R) — 5K —
DAC04* CST Settling Time(1) — — 10 s
* These parameters are characterized but not tested.
Note 1: Settling time measured while DACR<4:0> transitions from ‘0000’ to ‘1111’.
CK
US121 US121
DT
US120 US122
CK
US125
DT
US126
SSx
SP70
SCKx
(CKP = 0)
SP71 SP72
SP78 SP79
SCKx
(CKP = 1)
SP79 SP78
SP80
SP75, SP76
SP74
SP73
SSx
SP81
SCKx
(CKP = 0)
SP71 SP72
SP79
SP73
SCKx
(CKP = 1)
SP80
SP78
SP75, SP76
SP74
SSx
SP70
SCKx SP83
(CKP = 0)
SP71 SP72
SP78 SP79
SCKx
(CKP = 1)
SP79 SP78
SP80
SP74
SP73
SP82
SSx
SP70
SCKx SP83
(CKP = 0)
SP71 SP72
SCKx
(CKP = 1)
SP80
SP77
SP75, SP76
SDIx
MSb In bit 6 - - - -1 LSb In
SP74
SCLx
SP91 SP93
SP90 SP92
SDAx
Start Stop
Condition Condition
SCLx
SP90
SP106
SP107
SP91 SP92
SDAx
In
SP110
SP109
SP109
SDAx
Out
VCTH
VCTL
ISRC ISNK
Enabled Enabled
Note: The graphs and tables provided following this note are a statistical summary based on a limited number of
samples and are provided for informational purposes only. The performance characteristics listed herein
are not tested or guaranteed. In some graphs or tables, the data presented may be outside the specified
operating range (e.g., outside specified power supply range) and therefore, outside the warranted range.
“Typical” represents the mean of the distribution at 25C. “MAXIMUM”, “Max.”, “MINIMUM” or “Min.” represents
(mean + 3) or (mean - 3) respectively, where is a standard deviation, over each temperature range.
25
Max.
Max: 85°C + 3
Typical: 25°C
20
15
IDD (μA)
10
Typical
0
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8
VDD (V)
80
Max: 85°C + 3
70 Typical: 25°C Max.
60
50
IDD (μA)
40
Typical
30
20
10
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
600
Typical: 25°C
500 4 MHz EXTRC
400
4 MHz XT
IDD (μA)
300
1 MHz EXTRC
200
100 1 MHz XT
0
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8
VDD (V)
1000
Max: 85°C + 3
900
800
4 MHz EXTRC
700
600
IDD (μA)
4 MHz XT
500
300
200 1 MHz XT
100
0
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8
VDD (V)
800
Typical: 25°C
700
4 MHz EXTRC
600
500
IDD (μA)
400
4 MHz XT
300
1 MHz EXTRC
200
100 1 MHz XT
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
900
500
IDD (μA)
1 MHz EXTRC
400
300
1 MHz XT
200
100
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
18
Max: 85°C + 3
16 Max.
Typical: 25°C
14
12
10
IDD (μA)
6
Typical
4
0
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8
VDD (V)
45
Max: 85°C + 3
40 Typical: 25°C Max.
35
30 Typical
IDD (μA)
25
20
15
10
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
80
Max: 85°C + 3
70 Typical: 25°C Max.
60
50
IDD (μA)
40
Typical
30
20
10
0
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8
VDD (V)
50
Max: 85°C + 3
45 Max.
Typical: 25°C
40
35
30
IDD (μA)
Typical
25
20
15
10
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
400
300
250
IDD (μA)
200
150
100 1 MHz
50
0
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8
VDD (V)
450
350
300
IDD (μA)
250
200
150
1 MHz
100
50
0
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8
VDD (V)
450
350 4 MHz
300
IDD (μA)
250
200
150 1 MHz
100
50
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
450
Max: 85°C + 3
400 4 MHz
350
300
IDD (μA)
250
1 MHz
200
150
100
50
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
3.0
2.0
IDD (mA)
1.5
16 MHz
1.0
8 MHz
0.5
0.0
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8
VDD (V)
3.5
2.5
IDD (mA)
2.0
16 MHz
1.5
1.0
8 MHz
0.5
0.0
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8
VDD (V)
2.5
Typical: 25°C
32 MHz (PLL)
2.0
1.5 16 MHz
IDD (mA)
1.0
8 MHz
0.5
0.0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
3.0
32 MHz (PLL)
2.5 Max: 85°C + 3
2.0
IDD (mA)
16 MHz
1.5
1.0 8 MHz
0.5
0.0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
25
Max.
20
15
IDD (μA)
10
Max: 85°C + 3
Typical: 25°C Typical
5
0
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8
VDD (V)
FIGURE 31-20: IDD, LFINTOSC MODE (FOSC = 32 kHz), PIC12F1822 AND PIC16F1823 ONLY
50
45
Max.
40
35
IDD (μA)
30 Typical
25
20
15
10 Max: 85°C + 3
Typical: 25°C
5
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
200
Max: 85°C + 3
180
Typical: 25°C Max.
160
140
120
IDD (μA)
Typical
100
80
60
40
20
0
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8
VDD (V)
FIGURE 31-22: IDD, MFINTOSC MODE (FOSC = 500 kHz), PIC12F1822 AND PIC16F1823 ONLY
350
Max: 85°C + 3
300 Typical: 25°C Max.
250
200 Typical
IDD (μA)
150
100
50
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
2500
Typical: 25°C 32 MHz (PLL)
2000
1500 16 MHz
IDD (μA)
1000
8 MHz
500
4 MHz
0
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8
VDD (V)
FIGURE 31-24: IDD MAXIMUM, HFINTOSC MODE, PIC12LF1822 AND PIC16LF1823 ONLY
3500
32 MHz (PLL)
3000 Max: 85°C + 3
2500
IDD (μA)
2000 16 MHz
1500
8 MHz
1000
4 MHz
500
0
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8
VDD (V)
3000
Typical: 25°C
2500 32 MHz (PLL)
2000
IDD (μA)
16 MHz
1500
8 MHz
1000
4 MHz
500
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
FIGURE 31-26: IDD MAXIMUM, HFINTOSC MODE, PIC12F1822 AND PIC16F1823 ONLY
4000
32 MHz (PLL)
3500 Max: 85°C + 3
3000
2500
IDD (μA)
16 MHz
2000
8 MHz
1500
4 MHz
1000
500
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
2.5
Typical: 25°C
2.0
20 MHz
1.5
IDD (mA)
1.0
8 MHz
0.5
4 MHz
0.0
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8
VDD (V)
3.0
Max: 85°C + 3
2.5
20 MHz
2.0
IDD (mA)
1.5
8 MHz
1.0
0.5
4 MHz
0.0
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8
VDD (V)
2500
Typical: 25°C
2000
20 MHz
1500
IDD (μA)
8 MHz
1000
500
4 MHz
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
3000
Max: 85°C + 3
2500
20 MHz
2000
IDD (μA)
1500
8 MHz
1000
500 4 MHz
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
1.4
Max: 85°C + 3
1.2 Typical: 25°C Max.
1.0
IPD (μA)
0.8
0.6
0.4
0.2
Typical
0.0
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8
VDD (V)
FIGURE 31-32: IPD BASE, LOW-POWER SLEEP MODE, PIC12F1822 AND PIC16F1823 ONLY
50
45 Max: 85°C + 3
M 3
Typical: 25°C Max.
40
35
30
IPD (μA)
25 Typical
20
15
10
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
1.2
0.8
(μA)
Typical
IPD (μA
0.6
0.4
0.2
0.0
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8
VDD (V)
FIGURE 31-34: IPD, WATCHDOG TIMER (WDT), PIC12F1822 AND PIC16F1823 ONLY
50
45 Max: 85°C + 3
M 3 Max.
Typical: 25°C
40
35
30
A)
IPD (μA
25 Typical
20
15
10
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
30
Max.
25
20
A)
IPD (μA
15 Typical
10
Max: 85°C + 3
5 Typical: 25°C
0
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8
VDD (V)
FIGURE 31-36: IPD, FIXED VOLTAGE REFERENCE (FVR), PIC12F1822 AND PIC16F1823 ONLY
120
80
Typical
IPD (μA)
60
40
20
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
60
Max: 85°C + 3
50 Typical: 25°C Max.
40
IPD (μA)
30 Typical
20
10
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
6.0
Max: 85°C + 3
5.0 Typical: 25°C
Max.
4.0
A)
IPD (μA
3.0
Typical
2.0
1.0
0.0
16
1.6 1 8
1.8 2 0
2.0 2 2
2.2 2 4
2.4 2 6
2.6 2 8
2.8 3 0
3.0 3 2
3.2 3 4
3.4 3 6
3.6 3 8
3.8
VDD (V)
FIGURE 31-39: IPD, TIMER1 OSCILLATOR (FOSC = 32 kHz), PIC12F1822 AND PIC16F1823 ONLY
50
45 Max: 85°C + 3
Typical: 25°C Max.
40
35
30
IPD (μA)
25 Typical
20
15
10
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
14
12 Max.
10
IPD (μA)
8
Typical
Max: 85°C + 3
2 Typical: 25°C
0
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8
VDD (V)
60
Max: 85°C + 3
50 Typical: 25°C Max.
40
IPD (μA)
Typical
30
20
10
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
60
Max: 85°C + 3
50 Typical: 25°C
40
Max.
A)
IPD (μA
30
Typical
20
10
0
16
1.6 1 8
1.8 2 0
2.0 2 2
2.2 2 4
2.4 2 6
2.6 2 8
2.8 3 0
3.0 3 2
3.2 3 4
3.4 3 6
3.6 3 8
3.8
VDD (V)
70
Max.
60
50
Typical
40
A)
IPD (μA
30
20
Max: 85°C + 3
10
Typical: 25°C
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
1.70
1.68
Max.
1.66
1.64 Typical
1.62
Voltage (V)
Min.
1.60
1.58
1.56
1.50
-40 -20 0 20 40 60 80 100 120
Temperature (°C)
1.54
1.46
Voltage (V)
1.44
Typical
1.42
1.40
1.38 Min.
1.36
1.34
-40 -20 0 20 40 60 80 100 120
Temperature (°C)
24
22
Max.
20
Time (mS)
18 Typical
16
14 Min.
Voltage (V)
110
100
Max.
90
Time (mS)
80 Typical
70
Min.
60
40
1.5 2 2.5 3 3.5 4 4.5 5 5.5 6
Voltage (V)
80
70
Max.
60
Typical
Hysteresis (mV)
50
40
Min.
30
20 Max: Typical + 3
Typical: 25°C
10 Min: Typical - 3
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
16
14 Max.
12
Typical
Hysteresis (mV)
10
8
Min.
6
4 Max: Typical + 3
Typical: 25°C
2 Min: Typical - 3
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
350
300
250
Max.
Time (nS)
200
Typical
150
100
Max: Typical + 3
50 Typical: 25°C
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
400
250
Time (nS)
125°C
200
150
Typical
100
-40°C
50
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
50
40
30
Max.
20
Offset Voltage (mV)
10
Typical
0
Min.
-10
-20
-50
0.0 1.0 2.0 3.0 4.0 5.0
Common Mode Voltage (V)
XXXXXXXX 12LF1822
XXXXXNNN E/P e3 017
YYWW 1010
12LF1822
E/SN1010
NNN 017
Note: 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.
* Standard PICmicro® device marking consists of Microchip part number, year code, week code and
traceability code. For PICmicro device marking beyond this, certain price adders apply. Please check
with your Microchip Sales Office. For QTP devices, any special marking adders are included in QTP
price.
XXXX MFLO
YYWW 1010
NNN 017
PIN 1 PIN 1
Note: 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.
* Standard PICmicro® device marking consists of Microchip part number, year code, week code and
traceability code. For PICmicro device marking beyond this, certain price adders apply. Please check
with your Microchip Sales Office. For QTP devices, any special marking adders are included in QTP
price.
PIC16F1823
-E/P e3
0910017
PIC16F1823
-E/SL e3
0910017
Note: 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.
* Standard PICmicro® device marking consists of Microchip part number, year code, week code and
traceability code. For PICmicro device marking beyond this, certain price adders apply. Please check
with your Microchip Sales Office. For QTP devices, any special marking adders are included in QTP
price.
XXXXXXXX F1823EST
YYWW 0910
NNN 017
PIN 1 PIN 1
PIC16
F1823
E/ML e 3
910017
Note: 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.
* Standard PICmicro® device marking consists of Microchip part number, year code, week code and
traceability code. For PICmicro device marking beyond this, certain price adders apply. Please check
with your Microchip Sales Office. For QTP devices, any special marking adders are included in QTP
price.
3
&'
!&" &4# *!(!!&
4%&
&#&
&&255***'
'54
NOTE 1
E1
1 2 3
D
E
A A2
A1 L
c
e
b1 eB
b
6&! 7,8.
'!
9'&! 7 7: ;
7"')
%! 7 <
& 1,
&
& = =
##4
4!! -
1!&
& = =
"# &
"# >#& . - -
##4>#& . <
: 9& -< -?
&
& 9 -
9#
4!! <
6 9#>#& ) ?
9
* 9#>#& ) <
:
*+ 1 = = -
!"#$%&" ' ()"&'"!&)
&#*&&&#
+%&, & !&
- '!
!#.#
&"#'
#%!
& "!
!
#%!
& "!
!!
&$#/ !#
'!
#&
.0
1,21!'!
&$& "!
**&
"&&
!
* ,<1
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
!
""#$%& !'
3
&'
!&" &4# *!(!!&
4%&
&#&
&&255***'
'54
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
()
3
&'
!&" &4# *!(!!&
4%&
&#&
&&255***'
'54
NOTE 1
E1
1 2 3
A A2
L c
A1
b1
b e eB
6&! 7,8.
'!
9'&! 7 7: ;
7"')
%! 7
& 1,
&
& = =
##4
4!! -
1!&
& = =
"# &
"# >#& . - -
##4>#& . <
: 9& -
&
& 9 -
9#
4!! <
6 9#>#& ) ?
9
* 9#>#& ) <
:
*+ 1 = = -
!"#$%&" ' ()"&'"!&)
&#*&&&#
+%&, & !&
- '!
!#.#
&"#'
#%!
& "!
!
#%!
& "!
!!
&$#/ !#
'!
#&
.0
1,21!'!
&$& "!
**&
"&&
!
* ,1
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
3
&'
!&" &4# *!(!!&
4%&
&#&
&&255***'
'54
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
(*
+,
$ -./)0)0%&+,
3
&'
!&" &4# *!(!!&
4%&
&#&
&&255***'
'54
D D2
EXPOSED
PAD
E E2
2 2 b
1 1
K
N N
NOTE 1 L
TOP VIEW BOTTOM VIEW
A A3
A1
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
Questions:
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?
Package:(2) MF = DFN
ML = QFN Note 1: Tape and Reel identifier only appears in the
P = Plastic DIP catalog part number description. This
SL = SOIC identifier is used for ordering purposes and
SN = SOIC is not printed on the device package. Check
ST = TSSOP with your Microchip Sales Office for package
availability with the Tape and Reel option.
2: Small-form factor packaging options may be
Pattern: QTP, SQTP, Code or Special Requirements available. Please check
(blank otherwise) www.microchip.com/packaging for small
form-factor package availability, or contact
your local Sales Office.