Pic16 (L) F15089 PDF
Pic16 (L) F15089 PDF
MSSP (I2C™/SPI)
Data Sheet Index
Comparators
Data SRAM
(8/16-bit)
EUSART
Debug(1)
(bytes)
Timers
I/O’s(2)
PWM
CWG
NCO
DAC
CLC
XLP
Device
Note: For other small form-factor package availability and marking information, please visit
http://www.microchip.com/packaging or contact your local sales office.
VDD 1 20 VSS
RA5 2 19 RA0/ICSPDAT
RA4 3 18 RA1/ICSPCLK
MCLR/VPP/RA3 4 17 RA2
PIC16(L)F1509
PIC16(L)F1508
RC5 5 16 RC0
RC4 6 15 RC1
RC3 7 14 RC2
RC6 8 13 RB4
RC7 9 12 RB5
RB7 10 11 RB6
20 19 18 17 16
MCLR/VPP/RA3 1 15 RA1/ICSPCLK
RC5 2 14 RA2
PIC16(L)F1509
RC4 3 13 RC0
PIC16(L)F1508
RC3 4 12 RC1
RC6 5 11 RC2
6 7 8 9 10
RC7
RB7
RB6
RB5
RB4
TABLE 1:
20-Pin PDIP/SOIC/SSOP 20-PIN ALLOCATION TABLE (PIC16(L)F1508/9)
Comparator
20-Pin QFN
Reference
EUSART
Interrupt
Pull-up
Timers
MSSP
Basic
PWM
CWG
NCO
ADC
CLC
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)F1501
PIC16(L)F1503
PIC16(L)F1507
PIC16(L)F1508
PIC16(L)F1509
Peripheral
Rev. 10-000039A
8/1/2013
Program
Flash Memory
RAM
PORTA
OSC2/CLKOUT
Timing
Generation
CPU PORTB
OSC1/CLKIN INTRC
Oscillator
(Note 3)
PORTC
MCLR
Temp ADC
MSSP1 TMR2 TMR1 TMR0 C2 C1 DAC FVR
Indicator 10-bit
CWG1 NCO1 CLC4 CLC3 CLC2 CLC1 PWM4 PWM3 PWM2 PWM1 EUSART
Rev. 10-000055A
7/30/2013
15 Configuration
15 Data Bus 8
Program Counter
Flash
MUX
Program
Memory
16-Level Stack
RAM
(15-bit)
14
Program 12
Program Memory RAM Addr
Bus
Read (PMR)
Addr MUX
Instruction Reg
Indirect
Direct Addr 7 Addr
12
5 12
BSR Reg
15
FSR0 Reg
15 FSR1 Reg
STATUS Reg
8
3 MUX
Power-up
Instruction
Timer
Decode and
Power-on
Control
Reset ALU
8
Watchdog
CLKIN Timer
Timing
Generation Brown-out
CLKOUT Reset W Reg
Internal
Oscillator VDD VSS
Block
PC<14:0> PC<14:0>
CALL, CALLW CALL, CALLW
15 RETURN, RETLW
15
RETURN, RETLW
Interrupt, RETFIE Interrupt, RETFIE
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. For rotate (RRF, RLF) instructions, this bit is loaded with either the high-order or low-order
bit of the source register.
PIC16(L)F1508/9
80 Bytes 80 Bytes 80 Bytes
PIC16(L)F1508/9
BANK 0 BANK 1 BANK 2 BANK 3 BANK 4 BANK 5 BANK 6 BANK 7
000h 080h 100h 180h 200h 280h 300h 380h
Core Registers Core Registers Core Registers Core Registers Core Registers Core Registers Core Registers Core Registers
(Table 3-2) (Table 3-2) (Table 3-2) (Table 3-2) (Table 3-2) (Table 3-2) (Table 3-2) (Table 3-2)
00Bh 08Bh 10Bh 18Bh 20Bh 28Bh 30Bh 38Bh
00Ch PORTA 08Ch TRISA 10Ch LATA 18Ch ANSELA 20Ch WPUA 28Ch — 30Ch — 38Ch —
00Dh PORTB 08Dh TRISB 10Dh LATB 18Dh ANSELB 20Dh WPUB 28Dh — 30Dh — 38Dh —
00Eh PORTC 08Eh TRISC 10Eh LATC 18Eh ANSELC 20Eh — 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 PMADRL 211h SSP1BUF 291h — 311h — 391h IOCAP
012h PIR2 092h PIE2 112h CM1CON1 192h PMADRH 212h SSP1ADD 292h — 312h — 392h IOCAN
013h PIR3 093h PIE3 113h CM2CON0 193h PMDATL 213h SSP1MSK 293h — 313h — 393h IOCAF
014h — 094h — 114h CM2CON1 194h PMDATH 214h SSP1STAT 294h — 314h — 394h IOCBP
015h TMR0 095h OPTION_REG 115h CMOUT 195h PMCON1 215h SSP1CON1 295h — 315h — 395h IOCBN
016h TMR1L 096h PCON 116h BORCON 196h PMCON2 216h SSP1CON2 296h — 316h — 396h IOCBF
017h TMR1H 097h WDTCON 117h FVRCON 197h VREGCON 217h SSP1CON3 297h — 317h — 397h —
018h T1CON 098h — 118h DAC1CON0 198h — 218h — 298h — 318h — 398h —
019h T1GCON 099h OSCCON 119h DAC1CON1 199h RCREG 219h — 299h — 319h — 399h —
01Ah TMR2 09Ah OSCSTAT 11Ah — 19Ah TXREG 21Ah — 29Ah — 31Ah — 39Ah —
01Bh PR2 09Bh ADRESL 11Bh — 19Bh SPBRG 21Bh — 29Bh — 31Bh — 39Bh —
01Ch T2CON 09Ch ADRESH 11Ch — 19Ch SPBRGH 21Ch — 29Ch — 31Ch — 39Ch —
01Dh — 09Dh ADCON0 11Dh APFCON 19Dh RCSTA 21Dh — 29Dh — 31Dh — 39Dh —
01Eh — 09Eh ADCON1 11Eh — 19Eh TXSTA 21Eh — 29Eh — 31Eh — 39Eh —
01Fh — 09Fh ADCON2 11Fh — 19Fh BAUDCON 21Fh — 29Fh — 31Fh — 39Fh —
0A0h 320h General Purpose
Register
020h 120h 1A0h 220h 2A0h 16Bytes 3A0h
General General General General General General
Purpose Purpose Purpose Purpose Purpose Purpose Unimplemented
Register Register Register Register Register Register Read as ‘0’
80 Bytes 80 Bytes 80 Bytes 80 Bytes 80 Bytes 80 Bytes Unimplemented
Read as ‘0’
PIC16(L)F1508/9
70h – 7Fh 70h – 7Fh 70h – 7Fh 70h – 7Fh 70h – 7Fh 70h – 7Fh 70h – 7Fh 70h – 7Fh
47Fh 4FFh 57Fh 5FFh 67Fh 6FFh 77Fh 7FFh
PIC16(L)F1508/9
BANK 24 BANK 25 BANK 26 BANK 27 BANK 28 BANK 29 BANK 30 BANK 31
C00h C80h D00h D80h E00h E80h F00h F80h
Core Registers Core Registers Core Registers Core Registers Core Registers Core Registers Core Registers Core Registers
(Table 3-2) (Table 3-2) (Table 3-2) (Table 3-2) (Table 3-2) (Table 3-2) (Table 3-2) (Table 3-2)
C0Bh C8Bh D0Bh D8Bh E0Bh E8Bh F0Bh F8Bh
C0Ch — C8Ch — D0Ch — D8Ch — E0Ch — E8Ch — F0Ch F8Ch
C0Dh — C8Dh — D0Dh — D8Dh — E0Dh — E8Dh — F0Dh F8Dh
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 See Table 3-7 for
C18h — C98h — D18h — D98h — E18h — E98h — F18h register mapping F98h register mapping
C19h — C99h — D19h — D99h — E19h — E99h — F19h details 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 0-31
x00h or Addressing this location uses contents of FSR0H/FSR0L to address data memory
INDF0 xxxx xxxx uuuu uuuu
x80h (not a physical register)
x01h or Addressing this location uses contents of FSR1H/FSR1L to address data memory
INDF1 xxxx xxxx uuuu uuuu
x81h (not a physical register)
x02h or
PCL Program Counter (PC) Least Significant Byte 0000 0000 0000 0000
x82h
x03h or
STATUS — — — TO PD Z DC C ---1 1000 ---q quuu
x83h
x04h or
FSR0L Indirect Data Memory Address 0 Low Pointer 0000 0000 uuuu uuuu
x84h
x05h or
FSR0H Indirect Data Memory Address 0 High Pointer 0000 0000 0000 0000
x85h
x06h or
FSR1L Indirect Data Memory Address 1 Low Pointer 0000 0000 uuuu uuuu
x86h
x07h or
FSR1H Indirect Data Memory Address 1 High Pointer 0000 0000 0000 0000
x87h
x08h or
BSR — — — BSR<4:0> ---0 0000 ---0 0000
x88h
x09h or
WREG Working Register 0000 0000 uuuu uuuu
x89h
x0Ah or
PCLATH — Write Buffer for the upper 7 bits of the Program Counter -000 0000 -000 0000
x8Ah
x0Bh or
INTCON GIE PEIE TMR0IE INTE IOCIE TMR0IF INTF IOCIF 0000 0000 0000 0000
x8Bh
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented, read as ‘0’, r = reserved.
Shaded locations are unimplemented, read as ‘0’.
Bank 0
00Ch PORTA — — RA5 RA4 RA3 RA2 RA1 RA0 --xx xxxx --xx xxxx
00Dh PORTB RB7 RB6 RB5 RB4 — — — — xxxx ---- xxxx ----
00Eh PORTC RC7 RC6 RC5 RC4 RC3 RC2 RC1 RC0 xxxx xxxx xxxx xxxx
00Fh — Unimplemented — —
010h — Unimplemented — —
011h PIR1 TMR1GIF ADIF RCIF TXIF SSP1IF — TMR2IF TMR1IF 0000 0-00 0000 0-00
012h PIR2 OSFIF C2IF C1IF — BCL1IF NCO1IF — — 000- -0-- 000- -0--
013h PIR3 — — — — CLC4IF CLC3IF CLC2IF CLC1IF ---- 0000 ---- 0000
014h — Unimplemented — —
015h TMR0 Holding Register for the 8-bit Timer0 Count xxxx xxxx uuuu uuuu
016h TMR1L Holding Register for the Least Significant Byte of the 16-bit TMR1 Count xxxx xxxx uuuu uuuu
017h TMR1H Holding Register for the Most Significant Byte of the 16-bit TMR1 Count xxxx xxxx uuuu uuuu
018h T1CON TMR1CS<1:0> T1CKPS<1:0> T1OSCEN T1SYNC — TMR1ON 0000 00-0 uuuu uu-u
019h T1GCON TMR1GE T1GPOL T1GTM T1GSPM T1GGO/ T1GVAL T1GSS<1:0> 0000 0x00 uuuu uxuu
DONE
01Ah TMR2 Timer2 Module Register 0000 0000 0000 0000
01Bh PR2 Timer2 Period Register 1111 1111 1111 1111
01Ch T2CON — T2OUTPS<3:0> TMR2ON T2CKPS<1:0> -000 0000 -000 0000
01Dh — Unimplemented — —
01Eh — Unimplemented — —
01Fh — Unimplemented — —
Bank 1
08Ch TRISA — — TRISA5 TRISA4 —(2) TRISA2 TRISA1 TRISA0 --11 1111 --11 1111
08Dh TRISB TRISB7 TRISB6 TRISB5 TRISB4 — — — — 1111 ---- 1111 ----
08Eh TRISC TRISC7 TRISC6 TRISC5 TRISC4 TRISC3 TRISC2 TRISC1 TRISC0 1111 1111 1111 1111
08Fh — Unimplemented — —
090h — Unimplemented — —
091h PIE1 TMR1GIE ADIE RCIE TXIE SSP1IE — TMR2IE TMR1IE 0000 0-00 0000 0-00
092h PIE2 OSFIE C2IE C1IE — BCL1IE NCO1IE — — 000- 00-- 000- 00--
093h PIE3 — — — — CLC4IE CLC3IE CLC2IE CLC1IE ---- 0000 ---- 0000
094h — Unimplemented — —
095h OPTION_REG WPUEN INTEDG TMR0CS TMR0SE PSA PS<2:0> 1111 1111 1111 1111
096h PCON STKOVF STKUNF — RWDT RMCLR RI POR BOR 00-1 11qq qq-q qquu
097h WDTCON — — WDTPS<4:0> SWDTEN --01 0110 --01 0110
098h — Unimplemented — —
099h OSCCON — IRCF<3:0> — SCS<1:0> -011 1-00 -011 1-00
09Ah OSCSTAT SOSCR — OSTS HFIOFR — — LFIOFR HFIOFS 0-q0 --00 q-qq --qq
09Bh ADRESL ADC Result Register Low xxxx xxxx uuuu uuuu
09Ch ADRESH ADC 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 ADCON2 TRIGSEL<3:0> — — — — 0000 ---- 0000 ----
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented, r = reserved. Shaded locations are unimplemented, read as ‘0’.
Note 1: PIC16F1508/9 only.
2: Unimplemented, read as ‘1’.
Bank 2
10Ch LATA — — LATA5 LATA4 — LATA2 LATA1 LATA0 --xx -xxx --uu -uuu
10Dh LATB LATB7 LATB6 LATB5 LATB4 — — — — xxxx ---- uuuu ----
10Eh LATC LATC7 LATC6 LATC5 LATC4 LATC3 LATC2 LATC1 LATC0 xxxx xxxx uuuu 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> — C1NCH<2:0> 0000 -000 0000 -000
113h CM2CON0 C2ON C2OUT C2OE C2POL — C2SP C2HYS C2SYNC 0000 -100 0000 -100
114h CM2CON1 C2INTP C2INTN C2PCH<1:0> — C2NCH<2:0> 0000 -000 0000 -000
115h CMOUT — — — — — — MC2OUT MC1OUT ---- --00 ---- --00
116h BORCON SBOREN BORFS — — — — — BORRDY 10-- ---q uu-- ---u
117h FVRCON FVREN FVRRDY TSEN TSRNG CDAFVR<1:0> ADFVR<1:0> 0q00 0000 0q00 0000
118h DAC1CON0 DACEN — DACOE1 DACOE2 — DACPSS — — 0-00 -0-- 0-00 -0--
119h DAC1CON1 — — — DACR<4:0> ---0 0000 ---0 0000
11Ah
to — Unimplemented — —
11Ch
11Dh APFCON — — — SSSEL T1GSEL — CLC1SEL NCO1SEL ---0 0-00 ---0 0-00
11Eh — Unimplemented — —
11Fh — Unimplemented — —
Bank 3
18Ch ANSELA — — — ANSA4 — ANSA2 ANSA1 ANSA0 ---1 -111 ---1 -111
18Dh ANSELB — — ANSB5 ANSB4 — — — — --11 ---- --11 ----
18Eh ANSELC ANSC7 ANSC6 — — ANSC3 ANSC2 ANSC1 ANSC0 11-- 1111 11-- 1111
18Fh — Unimplemented — —
190h — Unimplemented — —
191h PMADRL Flash Program Memory Address Register Low Byte 0000 0000 0000 0000
192h PMADRH —(2) Flash Program Memory Address Register High Byte 1000 0000 1000 0000
193h PMDATL Flash Program Memory Read Data Register Low Byte xxxx xxxx uuuu uuuu
194h PMDATH — — Flash Program Memory Read Data Register High Byte --xx xxxx --uu uuuu
195h PMCON1 —(2) CFGS LWLO FREE WRERR WREN WR RD 1000 x000 1000 q000
196h PMCON2 Flash Program Memory Control Register 2 0000 0000 0000 0000
197h VREGCON(1) — — — — — — VREGPM Reserved ---- --01 ---- --01
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: PIC16F1508/9 only.
2: Unimplemented, read as ‘1’.
Bank 4
20Ch WPUA — — WPUA5 WPUA4 WPUA3 WPUA2 WPUA1 WPUA0 --11 1111 --11 1111
20Dh WPUB WPUB7 WPUB6 WPUB5 WPUB4 — — — — 1111 ---- 1111 ----
20Eh
to — Unimplemented — —
210h
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
to — Unimplemented — —
21Fh
Bank 5
28Ch
to — Unimplemented — —
29Fh
Bank 6
30Ch
to — Unimplemented — —
31Fh
Bank 7
38Ch
to — Unimplemented — —
390h
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 IOCBP IOCBP7 IOCBP6 IOCBP5 IOCBP4 — — — — 0000 ---- 0000 ----
395h IOCBN IOCBN7 IOCBN6 IOCBN5 IOCBN4 — — — — 0000 ---- 0000 ----
396h IOCBF IOCBF7 IOCBF6 IOCBF5 IOCBF4 — — — — 0000 ---- 0000 ----
397h
to — Unimplemented — —
39Fh
Bank 8
40Ch
to — Unimplemented — —
41Fh
Bank 9
48Ch
to — Unimplemented — —
497h
498h NCO1ACCL NCO1ACC<7:0> 0000 0000 0000 0000
499h NCO1ACCH NCO1ACC<15:8> 0000 0000 0000 0000
49Ah NCO1ACCU NCO1ACC<19:16> 0000 0000 0000 0000
49Bh NCO1INCL NCO1INC<7:0> 0000 0000 0000 0000
49Ch NCO1INCH NCO1INC<15:8> 0000 0000 0000 0000
49Dh — Unimplemented — —
49Eh NCO1CON N1EN N1OE N1OUT N1POL — — — N1PFM 0000 ---0 0000 ---0
49Fh NCO1CLK N1PWS<2:0> — — — N1CKS<1:0> 0000 --00 0000 --00
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented, r = reserved. Shaded locations are unimplemented, read as ‘0’.
Note 1: PIC16F1508/9 only.
2: Unimplemented, read as ‘1’.
Bank 10
50Ch
to — Unimplemented — —
51Fh
Bank 11
58Ch
to — Unimplemented — —
59Fh
Bank 12
60Ch
to — Unimplemented — —
610h
611h PWM1DCL PWM1DCL<7:6> — — — — — — 00-- ---- 00-- ----
612h PWM1DCH PWM1DCH<7:0> xxxx xxxx uuuu uuuu
613h PWM1CON0 PWM1EN PWM1OE PWM1OUT PWM1POL — — — — 0000 ---- 0000 ----
614h PWM2DCL PWM2DCL<7:6> — — — — — — 00-- ---- 00-- ----
615h PWM2DCH PWM2DCH<7:0> xxxx xxxx uuuu uuuu
616h PWM2CON0 PWM2EN PWM2OE PWM2OUT PWM2POL — — — — 0000 ---- 0000 ----
617h PWM3DCL PWM3DCL<7:6> — — — — — — 00-- ---- 00-- ----
618h PWM3DCH PWM3DCH<7:0> xxxx xxxx uuuu uuuu
619h PWM3CON0 PWM3EN PWM3OE PWM3OUT PWM3POL — — — — 0000 ---- 0000 ----
61Ah PWM4DCL PWM4DCL<7:6> — — — — — — 00-- ---- 00-- ----
61Bh PWM4DCH PWM4DCH<7:0> xxxx xxxx uuuu uuuu
61Ch PWM4CON0 PWM4EN PWM4OE PWM4OUT PWM4POL — — — — 0000 ---- 0000 ----
61Dh
to — Unimplemented — —
61Fh
Bank 13
68Ch
to — Unimplemented — —
690h
691h CWG1DBR — — CWG1DBR<5:0> --00 0000 --00 0000
692h CWG1DBF — — CWG1DBF<5:0> --xx xxxx --xx xxxx
693h CWG1CON0 G1EN G1OEB G1OEA G1POLB G1POLA — — G1CS0 0000 0--0 0000 0--0
694h CWG1CON1 G1ASDLB<1:0> G1ASDLA<1:0> — G1IS<2:0> 0000 -000 0000 -000
695h CWG1CON2 G1ASE G1ARSEN — — G1ASDC2 G1ASDC1 G1ASDSFLT G1ASDSCLC2 00-- --00 00-- --00
696h
to — Unimplemented — —
69Fh
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented, r = reserved. Shaded locations are unimplemented, read as ‘0’.
Note 1: PIC16F1508/9 only.
2: Unimplemented, read as ‘1’.
Banks 14-29
x0Ch/ — Unimplemented — —
x8Ch
—
x1Fh/
x9Fh
Bank 30
F0Ch
to — Unimplemented — —
F0Eh
F0Fh CLCDATA — — — — MLC4OUT MLC3OUT MLC2OUT MLC1OUT ---- 0000 ---- 0000
F10h CLC1CON LC1EN LC1OE LC1OUT LC1INTP LC1INTN LC1MODE<2:0> 0000 0000 0000 0000
F11h CLC1POL LC1POL — — — LC1G4POL LC1G3POL LC1G2POL LC1G1POL 0--- xxxx 0--- uuuu
F12h CLC1SEL0 — LC1D2S<2:0> — LC1D1S<2:0> -xxx -xxx -uuu -uuu
F13h CLC1SEL1 — LC1D4S<2:0> — LC1D3S<2:0> -xxx -xxx -uuu -uuu
F14h CLC1GLS0 LC1G1D4T LC1G1D4N LC1G1D3T LC1G1D3N LC1G1D2T LC1G1D2N LC1G1D1T LC1G1D1N xxxx xxxx uuuu uuuu
F15h CLC1GLS1 LC1G2D4T LC1G2D4N LC1G2D3T LC1G2D3N LC1G2D2T LC1G2D2N LC1G2D1T LC1G2D1N xxxx xxxx uuuu uuuu
F16h CLC1GLS2 LC1G3D4T LC1G3D4N LC1G3D3T LC1G3D3N LC1G3D2T LC1G3D2N LC1G3D1T LC1G3D1N xxxx xxxx uuuu uuuu
F17h CLC1GLS3 LC1G4D4T LC1G4D4N LC1G4D3T LC1G4D3N LC1G4D2T LC1G4D2N LC1G4D1T LC1G4D1N xxxx xxxx uuuu uuuu
F18h CLC2CON LC2EN LC2OE LC2OUT LC2INTP LC2INTN LC2MODE<2:0> 0000 0000 0000 0000
F19h CLC2POL LC2POL — — — LC2G4POL LC2G3POL LC2G2POL LC2G1POL 0--- xxxx 0--- uuuu
F1Ah CLC2SEL0 — LC2D2S<2:0> — LC2D1S<2:0> -xxx -xxx -uuu -uuu
F1Bh CLC2SEL1 — LC2D4S<2:0> — LC2D3S<2:0> -xxx -xxx -uuu -uuu
F1Ch CLC2GLS0 LC2G1D4T LC2G1D4N LC2G1D3T LC2G1D3N LC2G1D2T LC2G1D2N LC2G1D1T LC2G1D1N xxxx xxxx uuuu uuuu
F1Dh CLC2GLS1 LC2G2D4T LC2G2D4N LC2G2D3T LC2G2D3N LC2G2D2T LC2G2D2N LC2G2D1T LC2G2D1N xxxx xxxx uuuu uuuu
F1Eh CLC2GLS2 LC2G3D4T LC2G3D4N LC2G3D3T LC2G3D3N LC2G3D2T LC2G3D2N LC2G3D1T LC2G3D1N xxxx xxxx uuuu uuuu
F1Fh CLC2GLS3 LC2G4D4T LC2G4D4N LC2G4D3T LC2G4D3N LC2G4D2T LC2G4D2N LC2G4D1T LC2G4D1N xxxx xxxx uuuu uuuu
F20h CLC3CON LC3EN LC3OE LC3OUT LC3INTP LC3INTN LC3MODE<2:0> 0000 0000 0000 0000
F21h CLC3POL LC3POL — — — LC3G4POL LC3G3POL LC3G2POL LC3G1POL 0--- xxxx 0--- uuuu
F22h CLC3SEL0 — LC3D2S<2:0> — LC3D1S<2:0> -xxx -xxx -uuu -uuu
F23h CLC3SEL1 — LC3D4S<2:0> — LC3D3S<2:0> -xxx -xxx -uuu -uuu
F24h CLC3GLS0 LC3G1D4T LC3G1D4N LC3G1D3T LC3G1D3N LC3G1D2T LC3G1D2N LC3G1D1T LC3G1D1N xxxx xxxx uuuu uuuu
F25h CLC3GLS1 LC3G2D4T LC3G2D4N LC3G2D3T LC3G2D3N LC3G2D2T LC3G2D2N LC3G2D1T LC3G2D1N xxxx xxxx uuuu uuuu
F26h CLC3GLS2 LC3G3D4T LC3G3D4N LC3G3D3T LC3G3D3N LC3G3D2T LC3G3D2N LC3G3D1T LC3G3D1N xxxx xxxx uuuu uuuu
F27h CLC3GLS3 LC3G4D4T LC3G4D4N LC3G4D3T LC3G4D3N LC3G4D2T LC3G4D2N LC3G4D1T LC3G4D1N xxxx xxxx uuuu uuuu
F28h CLC4CON LC4EN LC4OE LC4OUT LC4INTP LC4INTN LC4MODE<2:0> 0000 0000 0000 0000
F29h CLC4POL LC4POL — — — LC4G4POL LC4G3POL LC4G2POL LC4G1POL 0--- xxxx 0--- uuuu
F2Ah CLC4SEL0 — LC4D2S<2:0> — LC4D1S<2:0> -xxx -xxx -uuu -uuu
F2Bh CLC4SEL1 — LC4D4S<2:0> — LC4D3S<2:0> -xxx -xxx -uuu -uuu
F2Ch CLC4GLS0 LC4G1D4T LC4G1D4N LC4G1D3T LC4G1D3N LC4G1D2T LC4G1D2N LC4G1D1T LC4G1D1N xxxx xxxx uuuu uuuu
F2Dh CLC4GLS1 LC4G2D4T LC4G2D4N LC4G2D3T LC4G2D3N LC4G2D2T LC4G2D2N LC4G2D1T LC4G2D1N xxxx xxxx uuuu uuuu
F2Eh CLC4GLS2 LC4G3D4T LC4G3D4N LC4G3D3T LC4G3D3N LC4G3D2T LC4G3D2N LC4G3D1T LC4G3D1N xxxx xxxx uuuu uuuu
F2Fh CLC4GLS3 LC4G4D4T LC4G4D4N LC4G4D3T LC4G4D3N LC4G4D2T LC4G4D2N LC4G4D1T LC4G4D1N xxxx xxxx uuuu uuuu
F30h
to — Unimplemented — —
F6Fh
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented, r = reserved. Shaded locations are unimplemented, read as ‘0’.
Note 1: PIC16F1508/9 only.
2: Unimplemented, read as ‘1’.
Bank 31
F8Ch — Unimplemented — —
—
FE3h
FE4h STATUS_ — — — — — Z_SHAD DC_SHAD C_SHAD ---- -xxx ---- -uuu
SHAD
FE5h WREG_ Working Register Shadow xxxx xxxx 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: PIC16F1508/9 only.
2: Unimplemented, read as ‘1’.
Rev. 10-000043A
7/30/2013
Rev. 10-000043B
7/30/2013
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
Rev. 10-000043C
7/30/2013
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 will
0x0A
repeatedly place the return addresses into
0x09 the Program Counter and pop the stack.
0x08
0x07
TOSH:TOSL 0x06 Return Address STKPTR = 0x06
Rev. 10-000043D
7/30/2013
Rev. 10-000044A
7/30/2013
0x0000 0x0000
Traditional
Data Memory
0x0FFF 0x0FFF
0x1000
Reserved
0x1FFF
0x2000
Linear
Data Memory
0x29AF
0x29B0
Reserved
0x7FFF
FSR
0x8000 0x0000
Address
Range
Program
Flash Memory
0xFFFF 0x7FFF
Note: Not all memory regions are completely implemented. Consult device memory tables for memory limits.
Rev. 10-000056A
7/31/2013
From Opcode
4 BSR 0 6 0 7 FSRxH 0 7 FSRxL 0
0 0 0 0
0x7F
Bank 0 Bank 1 Bank 2 Bank 31
7 FSRnH 0 7 FSRnL 0
7 FSRnH 0 7 FSRnL 0 1
0 0 1
Location Select
Location Select 0x8000
0x2000 0x0000
0x020
Bank 0
0x06F
0x0A0
Bank 1
Program
0x0EF
Flash
0x120 Memory
Bank 2 (low 8 bits)
0x16F
0xF20
Bank 30 0x7FFF
0xF6F 0xFFFF
0x29AF
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: When FSCM is enabled, Two-Speed Start-up will be automatically enabled, regardless of the IESO bit value.
2: Enabling Brown-out Reset does not automatically enable Power-up Timer.
3: Once enabled, code-protect can only be disabled by bulk erasing the device.
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: See VBOR parameter for specific trip point voltages.
3: The DEBUG bit in Configuration Words is managed automatically by device development tools including
debuggers and programmers. For normal device operation, this bit should be maintained as a ‘1’.
4.5 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 10.4 “User ID, Device ID and Configuration
Word Access” for more information on accessing these
memory locations. For more information on checksum
calculation, see the “PIC12(L)F1501/PIC16(L)F150X
Memory Programming Specification” (DS41573).
R R R R R R R R
DEV<2:0> REV<4:0>
bit 7 bit 0
Legend:
R = Readable bit
‘1’ = Bit is set ‘0’ = Bit is cleared
DEVID<13:0> Values
Device
DEV<8:0> REV<4:0>
PIC16LF1508 10 1101 111 x xxxx
PIC16F1508 10 1101 001 x xxxx
PIC16LF1509 10 1110 000 x xxxx
PIC16F1509 10 1101 010 x xxxx
Rev. 10-000030A
7/30/2013
CLKIN/ OSC1/
SOSCI/ T1CKI
Sleep
Primary
Oscillator Primary Clock
(OSC)
(1)
FOSC(1)
CLKOUT/ OSC2/ Secondary Clock
SOSCO/ T1G Secondary to CPU and
Oscillator Peripherals
INTOSC
(SOSC)
IRCF<3:0>
HFINTOSC
16 MHz 4
Start-up 8 MHz
Control Logic 4 MHz Clock
2 MHz Control
16 MHz 1 MHz
Prescaler
Oscillator (1)
HFINTOSC *500 kHz 3 2
Fast Start-up *250 kHz FOSC<2:0> SCS<1:0>
Oscillator *125 kHz
62.5 kHz
*31.25 kHz
*31 kHz
LFINTOSC
31 kHz LFINTOSC(1)
to WDT, PWRT, and
Oscillator other Peripherals
FRC
600 kHz FRC(1) to ADC and
Oscillator other Peripherals
OSC2/CLKOUT
C2 RS(1)
OSC2/CLKOUT
C2 RS(1)
OSCILLATOR) 7/31/2013
Rev. 10-000061A
7/30/2013
VDD
PIC® MCU
PIC® MCU REXT
The HFINTOSC is enabled by: The FRC clock continues to run during Sleep.
LFINTOSC
bits IRCF<3:0> of the OSCCON register (Register 5-1)
SOSC
FOSC
TMR0
TMR1
TMR2
FRC
HFINTOSC
Oscillator Delay(1) 2-cycle Sync Running
LFINTOSC
System Clock
HFINTOSC
2-cycle Sync Running
LFINTOSC
System Clock
LFINTOSC HFINTOSC
LFINTOSC turns off unless WDT or FSCM is enabled(2)
LFINTOSC
Oscillator Delay(1) 2-cycle Sync Running
HFINTOSC
IRCF <3:0> =0 0
System Clock
Note 1: See Table 5-3, “Oscillator Switching Delays” for more information.
2: LFINTOSC will continue to run if a peripheral has selected it as the clock source. See
Section 5.2.2.4 “Peripheral Clock Sources”.
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
Rev. 10-000006A
8/14/2013
Stack Underflow
Stack Overlfow
MCLRE
VPP/MCLR
Sleep
WDT
Time-out Device
Reset
Power-on
Reset
VDD
BOR
Active(1)
Brown-out R
Power-up
Reset
Timer
LFINTOSC
LPBOR PWRTE
Reset
6.2.1 BOR IS ALWAYS ON BOR protection is not active during Sleep. The device
wake-up will be delayed until the BOR is ready.
When the BOREN bits of Configuration Words are pro-
grammed to ‘11’, the BOR is always on. The device
6.2.3 BOR CONTROLLED BY SOFTWARE
start-up will be delayed until the BOR is ready and VDD
is higher than the BOR threshold. When the BOREN bits of Configuration Words are
programmed to ‘01’, the BOR is controlled by the
BOR protection is active during Sleep. The BOR does
SBOREN bit of the BORCON register. The device
not delay wake-up from Sleep.
start-up is not delayed by the BOR ready condition or
the VDD level.
6.2.2 BOR IS OFF IN SLEEP
BOR protection begins as soon as the BOR circuit is
When the BOREN bits of Configuration Words are pro-
ready. The status of the BOR circuit is reflected in the
grammed to ‘10’, the BOR is on, except in Sleep. The
BORRDY bit of the BORCON register.
device start-up will be delayed until the BOR is ready
and VDD is higher than the BOR threshold. BOR protection is unchanged by Sleep.
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
Internal RESET
Int. Oscillator
FOSC
Begin Execution
code execution (1) code execution (1)
Internal Oscillator, PWRTEN = 0 Internal Oscillator, PWRTEN = 1
VDD
Internal POR
TPWRT
Power-up Timer
MCLR
Internal RESET
Ext. Clock (EC)
FOSC
Begin Execution
code execution (1) code execution (1)
External Clock (EC modes), PWRTEN = 0 External Clock (EC modes), PWRTEN = 1
VDD
Internal POR
TPWRT
Power-up Timer
MCLR
Internal RESET
TOST TOST
Osc Start-Up Timer
Ext. Oscillator
FOSC
Begin Execution
code code
execution (1) execution (1)
VDD
Internal POR
TPWRT
Power-up Timer
MCLR
Internal RESET
TOST TOST
Osc Start-Up Timer
Ext. Oscillator
Int. Oscillator
FOSC
Begin Execution code execution (1) code execution (1)
Note 1: Code execution begins 10 FOSC cycles after the FOSC clock is released.
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 -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
TMR0IF Wake-up
TMR0IE (If in Sleep mode)
INTF
Peripheral Interrupts INTE
(TMR1IF) PIR1<0>
IOCIF
(TMR1IE) PIE1<0> Interrupt
IOCIE to CPU
PEIE
PIRn<7>
GIE
PIEn<7>
Fosc
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
FOSC
CLKOUT
(3)
INT pin
(1)
(1)
INTF (4) 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: Interrupt flag bits are set when an interrupt condition occurs, regardless of the state of its corresponding
enable bit or the Global Interrupt Enable bit, GIE of the INTCON register. User software should ensure the
appropriate interrupt flag bits are clear prior to enabling an interrupt.
2: Bit PEIE of the INTCON register must be set to enable any peripheral interrupt.
3: The IOCIF Flag bit is read-only and cleared when all the interrupt-on-change flags in the IOCxF registers
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
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) Forced NOP Forced NOP
Executed Inst(PC - 1) Inst(0004h)
Low-Power Sleep mode allows the user to optimize the • Brown-Out Reset (BOR)
operating current in Sleep. Low-Power Sleep mode can • Watchdog Timer (WDT)
be selected by setting the VREGPM bit of the • External interrupt pin/Interrupt-on-change pins
VREGCON register, putting the LDO and reference • Timer1 (with external clock source)
circuitry in a low-power state whenever the device is in
Sleep. The Complementary Waveform Generator (CWG), the
Numerically Controlled Oscillator (NCO) and the Con-
8.2.1 SLEEP CURRENT VS. WAKE-UP figurable Logic Cell (CLC) modules can utilize the
TIME HFINTOSC oscillator as either a clock source or as an
input source. Under certain conditions, when the
In the Default Operating mode, the LDO and reference HFINTOSC is selected for use with the CWG, NCO or
circuitry remain in the normal configuration while in CLC modules, the HFINTOSC will remain active
Sleep. The device is able to exit Sleep mode quickly during Sleep. This will have a direct effect on the
since all circuits remain active. In Low-Power Sleep Sleep mode current.
mode, when waking up from Sleep, an extra delay time
is required for these circuits to return to the normal con- Please refer to sections Section 24.5 “Operation
figuration and stabilize. During Sleep”, Section 25.7 “Operation In Sleep”
and Section 26.10 “Operation During Sleep” for
The Low-Power Sleep mode is beneficial for applica- more information.
tions that stay in Sleep mode for long periods of time.
The Normal mode is beneficial for applications that
need to wake from Sleep quickly and frequently. Note: The PIC16LF1508/9 does not have a con-
figurable Low-Power Sleep mode.
PIC16LF1508/9 is an unregulated device
and is always in the lowest power state
when in Sleep, with no wake-up time pen-
alty. This device has a lower maximum
VDD and I/O voltage than the
PIC16F1508/9. See Section 29.0 “Elec-
trical Specifications” for more informa-
tion.
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
WDTE<1:0> = 01
SWDTEN
WDTE<1:0> = 10
Sleep WDTPS<4:0>
TABLE 9-1: WDT OPERATING MODES When a WDT time-out occurs while the device is in
Sleep, no Reset is generated. Instead, the device
Device WDT wakes up and resumes operation. The TO and PD bits
WDTE<1:0> SWDTEN
Mode Mode in the STATUS register are changed to indicate the
event. The RWDT bit in the PCON register can also be
11 X X Active used. See Section 3.0 “Memory Organization” for
Awake Active more information.
10 X
Sleep Disabled
1 X Active
01
0 X Disabled
00 X X 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
Device Latches
(words)
(words)
Start
PIC16(L)F1509 Read Operation
32 32
PIC16(L)F1508
Select
10.2.1 READING THE FLASH PROGRAM Program or Configuration Memory
MEMORY (CFGS)
End
Read Operation
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) PMDATH,PMDATL INSTR (PC + 3) INSTR (PC + 4)
INSTR(PC + 1) INSTR(PC + 2)
INSTR(PC - 1) BSF PMCON1,RD instruction ignored instruction ignored INSTR(PC + 3) INSTR(PC + 4)
executed here executed here Forced NOP Forced NOP executed here executed here
executed here executed here
RD bit
PMDATH
PMDATL
Register
Unlock Sequence
(See Note 1)
Re-enable Interrupts
(GIE = 1)
End
Erase Operation
MOVLW 0AAh ;
MOVWF PMCON2 ; Write AAh
BSF PMCON1,WR ; Set WR bit to begin erase
NOP ; NOP instructions are forced as processor starts
NOP ; row erase of program memory.
;
; The processor stalls until the erase process is complete
; after erase processor continues with 3rd instruction
PIC16(L)F1508/9
Rev. 10-000004A
7 6 0 7 5 4 0 7 5 0 7 0 7/30/2013
14
Write Latch #0 Write Latch #1 Write Latch #30 Write Latch #31
PMADRL<4:0> 00h 01h 1Eh 1Fh
14 14 14 14
400h 8000h - 8003h 8004h – 8005h 8006h 8007h – 8008h 8009h - 801Fh
DEVICE ID Configuration
USER ID 0 - 3 reserved reserved
CFGS = 1 Dev / Rev Words
Configuration Memory
PIC16(L)F1508/9
FIGURE 10-6: FLASH PROGRAM MEMORY WRITE FLOWCHART
Rev. 10-000049A
7/30/2013
Start
Write Operation
Determine number of
words to be written into Enable Write/Erase
Program or Configuration Operation (WREN = 1)
Memory. The number of
words cannot exceed the
number of words per row
(word_cnt)
Load the value to write
(PMDATH:PMDATL)
Disable Interrupts
(GIE = 0)
Update the word counter Write Latches to Flash
(word_cnt--) (LWLO = 0)
Select
Program or Config.
Memory (CFGS)
Unlock Sequence
Last word to Yes (See Note 1)
write ?
Select Row Address
(PMADRH:PMADRL)
No
CPU stalls while Write
operation completes
Unlock Sequence (2 ms typical)
Select Write Operation (See Note 1)
(FREE = 0)
Re-enable Interrupts
(GIE = 1)
Increment Address
(PMADRH:PMADRL++)
End
Write Operation
START_WRITE
BCF PMCON1,LWLO ; No more loading latches - Actually start Flash program
; memory write
Modify Image
The words to be modified are
changed in the RAM image
Erase Operation
(See Note 2)
Write Operation
Use RAM image
(See Note 3)
End
Modify Operation
TABLE 10-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
Start
Verify Operation
Read Operation
(See Note 1)
PMDAT = No
RAM image ?
Yes
Fail
Verify Operation
No
Last word ?
Yes
End
Verify 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
bit 7-0 PMDAT<7:0>: Read/write value for 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 PMADR<7:0>: Specifies the Least Significant bits for program memory 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
To digital peripherals
TABLE 11-1: PORT AVAILABILITY PER ANSELx
DEVICE
To analog peripherals
PORTB
PORTA
PORTC
VSS
Device
PIC16(L)F1509 ● ● ●
PIC16(L)F1508 ● ● ●
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
effect 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 that support analog inputs have an associated
ANSELx register. When an ANSEL bit is set, the digital
input buffer associated with that bit is disabled.
Disabling the input buffer prevents analog signal levels
on the pin between a logic high and low from causing
excessive current in the logic input circuitry. A
simplified model of a generic I/O port, without the
interfaces to other peripherals, is shown in Figure 11-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_REG register must be cleared for individual pull-ups to be enabled.
2: The weak pull-up device is automatically disabled if the pin is configured as an output.
3: For the WPUA3 bit, when MCLRE = 1, weak pull-up is internally enabled, but not reported here.
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 PORTB are actually written to corresponding LATB register. Reads from PORTB 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 PORTB are actually written to corresponding LATB register. Reads from PORTB 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_REG register must be cleared for individual pull-ups to be enabled.
2: The weak pull-up device is automatically disabled if the pin is 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
bit 7-6 ANSC<7:6>: Analog Select between Analog or Digital Function on pins RC<7:6>, respectively
1 = Analog input. Pin is assigned as analog input(1). Digital input buffer disabled.
0 = Digital I/O. Pin is assigned to port or digital special function.
bit 5-4 Unimplemented: Read as ‘0’
bit 3-0 ANSC<3:0>: Analog Select between Analog or Digital Function on pins RC<3:0>, respectively
1 = Analog input. Pin is assigned as analog input(1). Digital input buffer disabled.
0 = Digital I/O. Pin is assigned to port or digital special function.
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.
IOCANx D Q
R Q4Q1
edge
detect
RAx
to data bus
data bus = S
IOCAPx D Q D Q IOCAFx
0 or 1
R
write IOCAFx R
IOCIE
Q2
IOC interrupt
to CPU core
from all other
IOCnFx individual
pin detectors
FOSC
Q1 Q1 Q1
Q2 Q2 Q2
Q3 Q3 Q3
Q4 Q4 Q4
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
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
Rev. 10-000053A
8/6/2013
2
ADFVR<1:0>
1x
FVR_buffer1
2x
4x (To ADC Module)
2
CDAFVR<1:0>
1x
FVR_buffer2
2x
4x (To Comparators)
FVREN
+
_ FVRRDY
Note 1
Note 1: Any peripheral requiring the Fixed Reference (See Table 13-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
Note 1: To minimize current consumption when the FVR is disabled, the FVR buffers should be turned off by
clearing the Buffer Gain Selection bits.
2: FVRRDY is always ‘1’ for the PIC16F1508/9 devices.
3: See Section 14.0 “Temperature Indicator Module” for additional information.
4: Fixed Voltage Reference output cannot exceed VDD.
TABLE 13-2: 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 CDAFVR>1:0> ADFVR<1:0> 131
Legend: Shaded cells are unused by the Fixed Voltage Reference module.
Positive
VDD Reference
Select
VREF+ pin
VSS ADCS<2:0>
AN0
ANa VRNEG VRPOS
External .
Channel FOSC/n Fosc
. Divider FOSC
Inputs ADC
ADC_clk
. sampled Clock
ANz input Select FRC
FRC
Temp Indicator
Internal
Channel DACx_output ADC CLOCK SOURCE
Inputs
FVR_buffer1 ADC
Sample Circuit
CHS<4:0>
ADFM
set bit ADIF
10
complete 10-bit Result
Write to bit
GO/DONE
GO/DONE Q1 16
start
Q4
ADRESH ADRESL
Q2 Enable
Trigger Select
TRIGSEL<3:0> ADON
. . . VSS
Trigger Sources
AUTO CONVERSION
TRIGGER
ADC
ADCS<2:0
Clock 20 MHz 16 MHz 8 MHz 4 MHz 1 MHz
>
Source
Fosc/2 000 100 ns 125 ns 250 ns 500 ns 2.0 s
Fosc/4 100 200 ns 250 ns 500 ns 1.0 s 4.0 s
Fosc/8 001 400 ns 500 ns 1.0 s 2.0 s 8.0 s
Fosc/16 101 800 ns 1.0 s 2.0 s 4.0 s 16.0 s
Fosc/32 010 1.6 s 2.0 s 4.0 s 8.0 s 32.0 s
Fosc/64 110 3.2 s 4.0 s 8.0 s 16.0 s 64.0 s
FRC x11 1.0-6.0 s 1.0-6.0 s 1.0-6.0 s 1.0-6.0 s 1.0-6.0 s
Legend: Shaded cells are outside of recommended range.
Note: The TAD period when using the FRC clock source can fall within a specified range, (see TAD parameter).
The TAD period when using the FOSC-based clock source can be configured for a more precise TAD period.
However, the FRC clock source must be used when conversions are to be performed with the device in
Sleep mode.
Rev. 10-000035A
7/30/2013
TAD1 TAD2 TAD3 TAD4 TAD5 TAD6 TAD7 TAD8 TAD9 TAD10 TAD11
b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
THCD
Conversion Starts
TACQ On the following cycle:
Holding capacitor disconnected
from analog input (THCD).
ADRESH:ADRESL is loaded,
GO bit is cleared,
Set GO bit ADIF bit is set,
holding capacitor is reconnected to analog input.
Enable ADC (ADON bit)
and
Select channel (ACS bits)
Rev. 10-000054A
7/30/2013
ADRESH ADRESL
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 VREF+ pin as the source of the positive reference, be aware that a minimum voltage
specification exists. See Section 29.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
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
1
V AP P LI ED 1 – -------------------------- = V CHOLD ;[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
---------
1
V AP P LI ED 1 – e = V A PP LIE D 1 – -------------------------- ;combining [1] and [2]
RC
n+1
2 –1
T C = – C HOLD R IC + R SS + R S ln(1/2047)
= – 12.5pF 1k + 7k + 10k ln(0.0004885)
= 1.12 µs
Therefore:
T A CQ = 2µs + 1.12 µs + 50°C- 25°C 0.05 µs/°C
= 4.37µs
Note 1: The reference voltage (VRPOS) 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
Sampling
Analog switch
VT § 0.6V SS
RS Input pin RIC 1K RSS
ILEAKAGE(1) CHOLD = 10 pF
VA CPIN VT § 0.6V
5pF
Ref-
6V
Legend: CHOLD = Sample/Hold Capacitance 5V
CPIN = Input Capacitance VDD 4V RSS
3V
ILEAKAGE = Leakage Current at the pin due to varies injunctions 2V
RIC = Interconnect Resistance
RSS = Resistance of Sampling switch
SS = Sampling Switch 5 6 7 8 9 10 11
VT = Threshold Voltage Sampling Switch
(k )
Full-Scale Range
3FFh
3FEh
3FDh
3FCh
ADC Output Code
3FBh
03h
02h
01h
00h
Analog Input Voltage
0.5 LSB 1.5 LSB
Ref- Zero-Scale
Transition Full-Scale
Transition Ref+
VDD 0 VSOURCE+
VREF+ 1 DACR<4:0>
5
R
DACPSS R
DACEN R
R
32-to-1 MUX
32 DACx_output
To Peripherals
Steps
R DACxOUT1 (1)
DACOE1
R
DACxOUT2 (1)
VSOURCE- DACOE2
VSS
DACR 4:0
DACx_output = VSOURCE+ – VSOURCE- ----------------------------- + VSOURCE-
5
2
Note: See the DACxCON0 register for the available VSOURCE+ and VSOURCE- selections.
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
Rev. 10-000027A
8/5/2013
CxINTP
CxNCH<2:0> 3 CxON(1) Interrupt
Rising
CxIN0- 000 Edge set bit
CxIF
CxIN1- 001 Interrupt CxINTN
Note 1: When CxON = 0, all multiplexer inputs are disconnected and the Comparator will produce a ‘0’ at the output.
Rev. 10-000071A
8/2/2013
VDD
Analog
VT § 0.6V
RS < 10K Input pin RIC
To Comparator
ILEAKAGE(1)
VA CPIN VT § 0.6V
5pF
VSS
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
Rev. 10-000017A
TMR0CS 8/5/2013
Fosc/4 PSA
T0CKI(1) 0 T0_overflow
1 T0CKI
TMR0
1 Prescaler 0 FOSC/2 Sync Circuit Q1
write R
to
TMR0
TMR0SE set bit
PS<2:0>
TMR0IF
Note 1: The T0CKI prescale output frequency should not exceed FOSC/8.
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
T1GSPM
T1G 00
T0_overflow 01
1
C1OUT_sync 10 0 Single Pulse D Q T1GVAL
0
C2OUT_sync 11 1 Acq. Control
Q1
D Q
T1GPOL T1GGO/DONE
CK Q
TMR1ON Interrupt
set bit
R
T1GTM det TMR1GIF
TMR1GE
set flag bit
TMR1IF
TMR1ON
EN
(2)
TMR1
T1_overflow Synchronized Clock Input
TMR1H TMR1L Q D 0
1
T1CLK
T1SYNC
TMR1CS<1:0>
OUT
SOSCI/T1CKI
Secondary LFINTOSC 11
Oscillator 1
SOSCO 10 Prescaler
0 Fosc Synchronize(3)
01 1,2,4,8
Internal Clock det
EN
00
2
Fosc/4 Fosc/2
T1OSCEN Internal Clock T1CKPS<1:0> Internal Sleep
Clock Input
(1)
Secondary Clock To Clock Switching
Module
The Timer1 gate source is routed through a flip-flop The TMR1GIF flag bit operates even when the Timer1
that changes state on every incrementing edge of the gate is not enabled (TMR1GE bit is cleared).
signal. See Figure 19-4 for timing details.
Timer1 Gate Toggle mode is enabled by setting the
T1GTM bit of the T1GCON register. When the T1GTM
bit is cleared, the flip-flop is cleared and held clear. This
is necessary in order to control which edge is
measured.
Note: Enabling Toggle mode at the same time
as changing the gate polarity may result in
indeterminate operation.
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
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
Rev. 10-000019A
7/30/2013
T2_match
Prescaler To Peripherals
TMR2 R
Fosc/4 1:1, 1:4, 1:16, 1:64
2
Postscaler set bit
T2CKPS<1:0> Comparator
1:1 to 1:16 TMR2IF
PR2 T2OUTPS<3:0>
Rev. 10-000020A
7/30/2013
FOSC/4
1:4
Prescale
0x03
PR2
Note 1: The Pulse Width of T2_match is equal to the scaled input of TMR2.
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
Rev. 10-000076A
7/30/2013
Data bus
Read Write
8 8
SSPxBUF
2 (CKP, CKE)
clock select
SSx
SSPM<3:0>
Control 4
Enable Edge
enable
(T2_match)
2
SCK_out
Edge Prescaler
enable
TOSC
4, 16, 64
Baud Rate
TRIS bit Generator
(SSPxADD)
Rev. 10-000077A
7/30/2013
Internal data
bus
[SSPM <3:0>]
Read Write
8 8 4
Baud Rate
SSPxBUF Generator
(SSPxADD)
SDAx 8
SDAx in Shift clock
SSPxSR
Clock arbitrate/BCOL detect
MSb LSb
Clock Cntl
Receive Enable (RCEN)
Read Write
8 8
SSPxBUF
8
8
SCLx
Shift clock
SDAx SSPxSR
MSb LSb
8
SSPxMSK
8
SSPxADD
Rev. 10-000079A
8/1/2013
SCKx SCKx
SPI Master SDOx SDIx SPI Slave
SDIx SDOx #1
General I/O SSx
General I/O
General I/O SCKx
SDIx SPI Slave
SDOx #2
SSx
SCKx
SDIx SPI Slave
SDOx #3
SSx
21.2.1 SPI MODE REGISTERS During transmission, the SSPxBUF is not buffered. A
write to SSPxBUF will write to both SSPxBUF and
The MSSP module has five registers for SPI mode SSPxSR.
operation. These are:
• MSSP STATUS register (SSPxSTAT)
• MSSP Control Register 1 (SSPxCON1)
• MSSP Control Register 3 (SSPxCON3)
• MSSP Data Buffer register (SSPxBUF)
• MSSP Address register (SSPxADD)
• MSSP Shift register (SSPxSR)
(Not directly accessible)
SSPxCON1 and SSPxSTAT are the control and
STATUS registers in SPI mode operation. The
SSPxCON1 register is readable and writable. The
lower six bits of the SSPxSTAT are read-only. The
upper two bits of the SSPxSTAT are read/write.
In SPI master mode, SSPxADD can be loaded with a
value used in the Baud Rate Generator. More informa-
tion on the Baud Rate Generator is available in
Section 21.7 “Baud Rate Generator”.
SSPxSR is the shift register used for shifting data in
and out. SSPxBUF provides indirect access to the
SSPxSR register. SSPxBUF is the buffer register to
which data bytes are written, and from which data
bytes are read.
In receive operations, SSPxSR and SSPxBUF
together create a buffered receiver. When SSPxSR
receives a complete byte, it is transferred to SSPxBUF
and the SSPxIF interrupt is set.
Rev. 10-000080A
7/30/2013
Slave Select
General I/O SSx
Processor 1 (optional) Processor 2
Write to
SSPxBUF
SCKx
(CKP = 0
CKE = 0)
SCKx
(CKP = 1
CKE = 0)
4 Clock
SCKx Modes
(CKP = 0
CKE = 1)
SCKx
(CKP = 1
CKE = 1)
Input
Sample
(SMP = 1)
SSPxIF
SSPxSR to
SSPxBUF
SCK SCK
SPI Master SDOx SDIx SPI Slave
SDIx SDOx #1
SCK
SDIx SPI Slave
SDOx #2
SSx
SCK
SDIx SPI Slave
SDOx #3
SSx
SSx
SCKx
(CKP = 0
CKE = 0)
SCKx
(CKP = 1
CKE = 0)
Write to
SSPxBUF
Shift register SSPxSR
and bit count are reset
SSPxBUF to
SSPxSR
SDIx bit 0
bit 7 bit 7
Input
Sample
SSPxIF
Interrupt
Flag
SSPxSR to
SSPxBUF
SSx
Optional
SCKx
(CKP = 0
CKE = 0)
SCKx
(CKP = 1
CKE = 0)
Write to
SSPxBUF
Valid
SDOx bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0
SDIx
bit 7 bit 0
Input
Sample
SSPxIF
Interrupt
Flag
SSPxSR to
SSPxBUF
Write Collision
detection active
SSx
Not Optional
SCKx
(CKP = 0
CKE = 1)
SCKx
(CKP = 1
CKE = 1)
Write to
SSPxBUF
Valid
SDOx bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0
SDIx
bit 7 bit 0
Input
Sample
SSPxIF
Interrupt
Flag
SSPxSR to
SSPxBUF
Write Collision
detection active
If the requested slave exists on the bus, it will respond In some cases, the master may want to maintain con-
with an Acknowledge bit, otherwise known as an ACK. trol of the bus and re-initiate another transmission. If
The master then continues in either Transmit mode or so, the master device may send another Start bit in
Receive mode and the slave continues in the comple- place of the Stop bit or last ACK bit when it is in receive
ment, either in Receive mode or Transmit mode, mode.
respectively. The I2C bus specifies three message protocols;
A Start bit is indicated by a high-to-low transition of the • Single message where a master writes data to a
SDAx line while the SCLx line is held high. Address and slave.
data bytes are sent out, Most Significant bit (MSb) first. • Single message where a master reads data from
The Read/Write bit is sent out as a logical one when the a slave.
master intends to read data from the slave, and is sent
• Combined message where a master initiates a
out as a logical zero when it intends to write data to the minimum of two writes, or two reads, or a
slave.
combination of writes and reads, to one or more
slaves.
The I2C specification defines a Start condition as a A Restart is valid any time that a Stop would be valid.
transition of SDAx from a high to a low state while A master can issue a Restart if it wishes to hold the
SCLx line is high. A Start condition is always gener- bus after terminating the current transfer. A Restart
ated by the master and signifies the transition of the has the same effect on the slave that a Start would,
bus from an Idle to an Active state. Figure 21-12 resetting all slave logic and preparing it to clock in an
shows wave forms for Start and Stop conditions. address. The master may want to address the same or
A bus collision can occur on a Start condition if the another slave. Figure 21-13 shows the wave form for a
module samples the SDAx line low before asserting it Restart condition.
low. This does not conform to the I2C Specification In 10-bit Addressing Slave mode a Restart is required
that states no bus collision can occur on a Start. for the master to clock data out of the addressed
slave. Once a slave has been fully addressed, match-
21.4.6 STOP CONDITION ing both high and low address bytes, the master can
A Stop condition is a transition of the SDAx line from issue a Restart and the high address byte with the
low-to-high state while the SCLx line is high. R/W bit set. The slave logic will then hold the clock
and prepare to clock out data.
Note: At least one SCLx low time must appear
After a full match with R/W clear in 10-bit mode, a prior
before a Stop is valid, therefore, if the SDAx
match flag is set and maintained. Until a Stop condi-
line goes low then high again while the SCLx
tion, a high address with R/W clear, or high address
line stays high, only the Start condition is
match fails.
detected.
21.4.8 START/STOP CONDITION INTERRUPT
MASKING
SDAx
SCLx
S P
Change of Change of
Data Allowed Data Allowed
Start Stop
Condition Condition
Sr
Change of Change of
SCLx
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
SSPxIF
SSPxIF set on 9th
Cleared by software Cleared by software falling edge of
SCLx
BF
First byte
SSPxBUF is read of data is
available
in SSPxBUF
SSPOV
DS40001609C-page 199
PIC16(L)F1508/9
FIGURE 21-15:
DS40001609C-page 200
Receive Address Receive Data Receive Data ACK
SDAx A7 A6 A5 A4 A3 A2 A1 R/W=0 ACK D7 D6 D5 D4 D3 D2 D1 D0 ACK D7 D6 D5 D4 D3 D2 D1 D0
SSPxIF
BF
First byte
of data is
SSPxBUF is read available
in SSPxBUF
SSPOV
SCLx
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
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 SCLx is released
and SCLx is stretched hardware on 8th falling
edge of SCLx
ACKTIM
P
I2C SLAVE, 7-BIT ADDRESS, RECEPTION (SEN = 0, AHEN = 1, DHEN = 1)
DS40001609C-page 201
PIC16(L)F1508/9
Master sends
FIGURE 21-17:
Stop condition
Master releases
R/W = 0 SDAx to slave for ACK sequence
DS40001609C-page 202
Receiving Address Receive Data Receive Data ACK
SDAx 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
SCLx
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
S
PIC16(L)F1508/9
SSPxIF
Cleared by software No interrupt after
if not ACK
from Slave
BF
Received
address is loaded into Received data is SSPxBUF can be
SSPxBUF available on SSPxBUF read any time before
next byte is loaded
ACKDT
ACKTIM
P
I2C SLAVE, 7-BIT ADDRESS, RECEPTION (SEN = 1, AHEN = 1, DHEN = 1)
DS40001609C-page 204
SCLx
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
SSPxIF
Cleared by software
PIC16(L)F1508/9
BF
BF is automatically
Received address Data to transmit is cleared after 8th falling
is read from SSPxBUF loaded into SSPxBUF edge of SCLx
CKP
When R/W is set CKP is not
SCLx is always held for not
held low after 9th SCLx Set by software ACK
falling edge
ACKSTAT
Indicates an address
has been received
DS40001609C-page 206
SDAx 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
SCLx
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
SSPxIF
Cleared by software
PIC16(L)F1508/9
BF BF is automatically
Received address Data to transmit is cleared after 8th falling
is read from SSPxBUF loaded into SSPxBUF edge of SCLx
ACKDT
Slave clears
ACKDT to ACK
address
ACKSTAT
Master’s ACK
response is copied
to SSPxSTAT
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 SCLx
address. cleared after ACK
ACKTIM
I2C SLAVE, 7-BIT ADDRESS, TRANSMISSION (AHEN = 1)
R/W
D/A
This section describes a standard sequence of events Reception using 10-bit addressing with AHEN or
for the MSSP 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 SSPxADD register
Figure 21-20 is used as a visual reference for this using the UA bit. All functionality, specifically when the
description. CKP bit is cleared and SCLx line is held low are the
same. Figure 21-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 21-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
SSPxSTAT is set; SSPxIF is set if interrupt on
Start detect is enabled.
3. Master sends matching high address with R/W
bit clear; UA bit of the SSPxSTAT register is set.
4. Slave sends ACK and SSPxIF is set.
5. Software clears the SSPxIF bit.
6. Software reads received address from
SSPxBUF clearing the BF flag.
7. Slave loads low address into SSPxADD,
releasing SCLx.
8. Master sends matching low address byte to the
slave; UA bit is set.
Note: Updates to the SSPxADD register are not
allowed until after the ACK sequence.
Master sends
Stop condition
DS40001609C-page 208
Receive First Address Byte Receive Second Address Byte Receive Data Receive Data
SDAx
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
SCLx
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 1 2 3 4 5 6 7 8 9 P
S
PIC16(L)F1508/9
SSPxIF
Set by hardware Cleared by software
on 9th falling edge
BF
If address matches Receive address is Data is read
SSPxADD it is loaded into read from SSPxBUF from SSPxBUF
SSPxBUF
UA
When UA = 1; Software updates SSPxADD
SCLx is held low and releases SCLx
CKP
SCLx 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
BF
UA
DS40001609C-page 209
PIC16(L)F1508/9
FIGURE 21-22:
Master sends
DS40001609C-page 210
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
SDAx 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
SCLx 1 2 3 4 5 6 7 8 9 1 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
PIC16(L)F1508/9
S 2 3 4 5 P
Sr
SSPxIF
BF
Indicates an address
has been received
I2C SLAVE, 10-BIT ADDRESS, TRANSMISSION (SEN = 0, AHEN = 0, DHEN = 0)
Clock stretching occurs when a device on the bus In 10-bit Addressing mode, when the UA bit is set, the
holds the SCLx line low, effectively pausing communi- clock is always stretched. This is the only time the
cation. The slave may stretch the clock to allow more SCLx is stretched without CKP being cleared. SCLx is
time to handle data or prepare a response for the mas- released immediately after a write to SSPxADD.
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 SCLx. 21.5.6.3 Byte NACKing
The CKP bit of the SSPxCON1 register is used to con-
trol stretching in software. Any time the CKP bit is When the AHEN bit of SSPxCON3 is set; CKP is
cleared, the module will wait for the SCLx line to go cleared by hardware after the eighth falling edge of
low and then hold it. Setting CKP will release SCLx SCLx for a received matching address byte. When the
and allow more communication. DHEN bit of SSPxCON3 is set, CKP is cleared after
the eighth falling edge of SCLx for received data.
21.5.6.1 Normal Clock Stretching Stretching after the eighth falling edge of SCLx allows
Following an ACK if the R/W bit of SSPxSTAT is set, a the 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 SSPxBUF with data to 21.5.7 CLOCK SYNCHRONIZATION AND
transfer to the master. If the SEN bit of SSPxCON2 is THE CKP BIT
set, the slave hardware will always stretch the clock
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 SCLx line to go low and then hold it. However,
clearing the CKP bit will not assert the SCLx output
Note 1: The BF bit has no effect on if the clock will
low until the SCLx output is already sampled low.
be stretched or not. This is different than
Therefore, the CKP bit will not assert the SCLx line
previous versions of the module that
until an external I2C master device has already
would not stretch the clock, clear CKP, if
asserted the SCLx line. The SCLx output will remain
SSPxBUF was read before the ninth fall-
low until the CKP bit is set and all other devices on the
ing edge of SCLx.
I2C bus have released SCLx. This ensures that a write
2: Previous versions of the module did not to the CKP bit will not violate the minimum high time
stretch the clock for a transmission if requirement for SCLx (see Figure 21-23).
SSPxBUF was loaded before the ninth
falling edge of SCLx. 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
SDAx DX DX ‚ – 1
SCLx
Master device
CKP asserts clock
Master device
releases clock
WR
SSPxCON1
SCLx
1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S
SSPxIF
BF (SSPxSTAT<0>)
Cleared by software
SSPxBUF is read
GCEN (SSPxCON2<7>)
’1’
Master mode is enabled by setting and clearing the The master device generates all of the serial clock
appropriate SSPM bits in the SSPxCON1 register and pulses and the Start and Stop conditions. A transfer is
by setting the SSPEN bit. In Master mode, the SDAx ended with a Stop condition or with a Repeated Start
and SCKx pins must be configured as inputs. The condition. Since the Repeated Start condition is also
MSSP peripheral hardware will override the output the beginning of the next serial transfer, the I2C bus will
driver TRIS controls when necessary to drive the pins not be released.
low. In Master Transmitter mode, serial data is output
Master mode of operation is supported by interrupt through SDAx, while SCLx outputs the serial clock. The
generation on the detection of the Start and Stop con- first byte transmitted contains the slave address of the
ditions. The Stop (P) and Start (S) bits are cleared from receiving device (seven bits) and the Read/Write (R/W)
a Reset or when the MSSPx module is disabled. Con- bit. In this case, the R/W bit will be logic ‘0’. Serial data
trol of the I 2C bus may be taken when the P bit is set, is transmitted eight bits at a time. After each byte is
or the bus is idle. transmitted, an Acknowledge bit is received. Start and
Stop conditions are output to indicate the beginning
In Firmware Controlled Master mode, user code and the end of a serial transfer.
conducts all I 2C bus operations based on Start and
Stop bit condition detection. Start and Stop condition In Master Receive mode, the first byte transmitted
detection is the only active circuitry in this mode. All contains the slave address of the transmitting device
other communication is done by the user software (seven bits) and the R/W bit. In this case, the R/W bit
directly manipulating the SDAx and SCLx lines. will be logic ‘1’. Thus, the first byte transmitted is a 7-bit
slave address followed by a ‘1’ to indicate the receive
The following events will cause the SSPx Interrupt Flag bit. Serial data is received via SDAx, while SCLx out-
bit, SSPxIF, to be set (SSPx interrupt, if enabled): puts the serial clock. Serial data is received eight bits at
• Start condition detected a time. After each byte is received, an Acknowledge bit
is transmitted. Start and Stop conditions indicate the
• Stop condition detected
beginning and end of transmission.
• Data transfer byte transmitted/received
A Baud Rate Generator is used to set the clock
• Acknowledge transmitted/received
frequency output on SCLx. See Section 21.7 “Baud
• Repeated Start generated Rate Generator” for more detail.
Note 1: The MSSPx module, when configured in
I2C Master mode, does not allow queue-
ing of events. For instance, the user is not
allowed to initiate a Start condition and
immediately write the SSPxBUF register
to initiate transmission before the Start
condition is complete. In this case, the
SSPxBUF will not be written to and the
WCOL bit will be set, indicating that a
write to the SSPxBUF did not occur
2: When in Master mode, Start/Stop detec-
tion is masked and an interrupt is gener-
ated when the SEN/PEN bit is cleared and
the generation is complete.
SDAx DX DX ‚ – 1
BRG decrements on
Q2 and Q4 cycles
BRG
03h 02h 01h 00h (hold off) 03h 02h
Value
TBRG
SCLx
S
TBRG
DS40001609C-page 218
Write SSPxCON2<0> SEN = 1 ACKSTAT in
Start condition begins SSPxCON2 = 1
From slave, clear ACKSTAT bit SSPxCON2<6>
SEN = 0
Transmitting Data or Second Half
Transmit Address to Slave R/W = 0
of 10-bit Address ACK
SDAx A7 A6 A5 A4 A3 A2 A1 ACK = 0 D7 D6 D5 D4 D3 D2 D1 D0
SCLx 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S P
SCLx held low
while CPU
responds to SSPxIF
SSPxIF
Cleared by software service routine
Cleared by software from SSP interrupt
Cleared by software
BF (SSPxSTAT<0>)
PEN
R/W
I2C MASTER MODE WAVEFORM (TRANSMISSION, 7 OR 10-BIT ADDRESS)
begin Start condition ACK from Master Set ACKEN, start Acknowledge sequence
Master configured as a receiver SDAx = ACKDT = 0 SDAx = ACKDT = 1
by programming SSPxCON2<3> (RCEN = 1)
DS40001609C-page 220
SEN = 0
PEN bit = 1
Write to SSPxBUF 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
SDAx 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
3 6 7 9
PIC16(L)F1508/9
1 2 4 5 8 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
SCLx S P
Data shifted in on falling edge of CLK Set SSPxIF at end
of receive Set SSPxIF interrupt
Set SSPxIF interrupt at end of Acknow-
Set SSPxIF interrupt ledge sequence
at end of receive at end of Acknowledge
SSPxIF sequence
Set P bit
Cleared by software Cleared by software Cleared by software Cleared by software (SSPxSTAT<4>)
SDAx = 0, SCLx = 1 Cleared in
while CPU software and SSPxIF
responds to SSPxIF
BF
(SSPxSTAT<0>) Last bit is shifted into SSPxSR and
contents are unloaded into SSPxBUF
SSPOV
ACKEN
I2C MASTER MODE WAVEFORM (RECEPTION, 7-BIT ADDRESS)
RCEN
Master configured as a receiver RCEN cleared ACK from Master RCEN cleared
by programming SSPxCON2<3> (RCEN = 1) automatically SDAx = ACKDT = 0 automatically
SCLx 8 9
SSPxIF
Cleared in
SSPxIF set at software
the end of receive Cleared in
software SSPxIF set at the end
of Acknowledge sequence
Note: TBRG = one Baud Rate Generator period.
SDAx ACK
P
TBRG TBRG TBRG
SCLx brought high after TBRG
SDAx asserted low before rising edge of clock
to setup Stop condition
SDAx
BCLxIF
SDAx
SCLx
Set SEN, enable Start SEN cleared automatically because of bus collision.
condition if SDAx = 1, SCLx = 1 SSP module reset into Idle state.
SEN
SDAx sampled low before
Start condition. Set BCLxIF.
S bit and SSPxIF set because
BCLxIF SDAx = 0, SCLx = 1.
SSPxIF and BCLxIF are
cleared by software
SSPxIF
TBRG TBRG
SDAx
FIGURE 21-35: BRG RESET DUE TO SDA ARBITRATION DURING START CONDITION
SDAx = 0, SCLx = 1
Set S Set SSPxIF
Less than TBRG
TBRG
SCLx S
SCLx pulled low after BRG
time-out
SEN
Set SEN, enable Start
sequence if SDAx = 1, SCLx = 1
BCLxIF ‘0’
SSPxIF
SDAx = 0, SCLx = 1, Interrupts cleared
set SSPxIF by software
SDAx
SCLx
RSEN
BCLxIF
Cleared by software
S ‘0’
SSPxIF ‘0’
TBRG TBRG
SDAx
SCLx
S ‘0’
SSPxIF
PEN
BCLxIF
P ‘0’
SSPxIF ‘0’
SDAx
PEN
BCLxIF
P ‘0’
SSPxIF ‘0’
4
SSPM <3:0> SSPxADD<7:0>
8
4 Reload
SSPM <3:0>
SCLx Control Reload
8
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 SSPxSR
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 SDAx and SCLx 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)
SCKx Release Control:
1 = Initiate Stop condition on SDAx and SCLx pins. Automatically cleared by hardware.
0 = Stop condition idle
bit 1 RSEN: Repeated Start Condition Enable bit (in I2C Master mode only)
1 = Initiate Repeated Start condition on SDAx and SCLx pins. Automatically cleared by hardware.
0 = Repeated Start condition idle
bit 0 SEN: Start Condition Enable/Stretch Enable bit
In Master mode:
1 = Initiate Start condition on SDAx and SCLx pins. Automatically cleared by hardware.
0 = Start condition idle
In Slave mode:
1 = Clock stretching is enabled for both slave transmit and slave receive (stretch enabled)
0 = Clock stretching is disabled
Note 1: For bits ACKEN, RCEN, PEN, RSEN, SEN: If the I2C module is not in the Idle mode, this bit may not be
set (no spooling) and the SSPxBUF may not be written (or writes to the SSPxBUF are disabled).
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. SSPOV is still set
when a new byte is received and BF = 1, but hardware continues to write the most recent byte to SSPxBUF.
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 21-6: SSPxADD: MSSP 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:
Data bus
8 TXIE
Interrupt
TXREG register TXIF
TX_out
TXEN
TRMT
Baud Rate Generator
FOSC ÷n TX9
n
BRG16 TX9D
+1 Multiplier x4 x16 x64
SYNC 1 x 0 0 0
BRGH x 1 1 0 0
SPBRGH SPBRGL
BRG16 x 1 0 1 0
Rev. 10-000114A
7/30/2013
SPEN
SYNC 1 x 0 0 0
BRGH x 1 1 0 0
SPBRGH SPBRGL FIFO
BRG16 x 1 0 1 0 FERR RX9D RCREG Register
8
Data Bus
RCIF
Interrupt
RCIE
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)
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
TRMT bit Word 1 Word 2
(Transmit Shift Transmit Shift Reg. Transmit Shift Reg.
Reg. Empty Flag)
• 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 22.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. 22.1.2.3 Receive Interrupts
Note: 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 22-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 249
RCSTA SPEN RX9 SREN CREN ADDEN FERR OERR RX9D 248
SPBRGL BRG<7:0> 250*
SPBRGH BRG<15:8> 250*
TXSTA CSRC TX9 TXEN SYNC SENDB BRGH TRMT TX9D 247
Legend: — = unimplemented location, read as ‘0’. Shaded cells are not used for the Baud Rate Generator.
* Page provides register information.
BAUD FOSC = 20.000 MHz FOSC = 18.432 MHz FOSC = 16.000 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 129 9600 0.00 119 9615 0.16 103 9600 0.00 71
10417 10417 0.00 119 10378 -0.37 110 10417 0.00 95 10473 0.53 65
19.2k 19.23k 0.16 64 19.20k 0.00 59 19.23k 0.16 51 19.20k 0.00 35
57.6k 56.82k -1.36 21 57.60k 0.00 19 58.82k 2.12 16 57.60k 0.00 11
115.2k 113.64k -1.36 10 115.2k 0.00 9 111.1k -3.55 8 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 = 20.000 MHz FOSC = 18.432 MHz FOSC = 16.000 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.01 4166 300.0 0.00 3839 300.03 0.01 3332 300.0 0.00 2303
1200 1200 -0.03 1041 1200 0.00 959 1200.5 0.04 832 1200 0.00 575
2400 2399 -0.03 520 2400 0.00 479 2398 -0.08 416 2400 0.00 287
9600 9615 0.16 129 9600 0.00 119 9615 0.16 103 9600 0.00 71
10417 10417 0.00 119 10378 -0.37 110 10417 0.00 95 10473 0.53 65
19.2k 19.23k 0.16 64 19.20k 0.00 59 19.23k 0.16 51 19.20k 0.00 35
57.6k 56.818 -1.36 21 57.60k 0.00 19 58.82k 2.12 16 57.60k 0.00 11
115.2k 113.636 -1.36 10 115.2k 0.00 9 111.11k -3.55 8 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 = 20.000 MHz FOSC = 18.432 MHz FOSC = 16.000 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 16665 300.0 0.00 15359 300.0 0.00 13332 300.0 0.00 9215
1200 1200 -0.01 4166 1200 0.00 3839 1200.1 0.01 3332 1200 0.00 2303
2400 2400 0.02 2082 2400 0.00 1919 2399.5 -0.02 1666 2400 0.00 1151
9600 9597 -0.03 520 9600 0.00 479 9592 -0.08 416 9600 0.00 287
10417 10417 0.00 479 10425 0.08 441 10417 0.00 383 10433 0.16 264
19.2k 19.23k 0.16 259 19.20k 0.00 239 19.23k 0.16 207 19.20k 0.00 143
57.6k 57.47k -0.22 86 57.60k 0.00 79 57.97k 0.64 68 57.60k 0.00 47
115.2k 116.3k 0.94 42 115.2k 0.00 39 114.29k -0.79 34 115.2k 0.00 23
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)
RX/DT
pin bit 0 bit 1 bit 2 bit 7 bit 0 bit 1 bit 7
Word 1 Word 2
TX/CK pin
(SCKP = 0)
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.
Rev. 10-000022A
8/5/2013
PWMx_out
To Peripherals
10-bit Latch
(Not visible to user)
PWMxOE
Comparator R Q
0
PWMx
1
S Q
TMR2 Module
R PWMxPOL TRIS Control
TMR2 (1)
Comparator
T2_match
PR2
Note 1: 8-bit timer is concatenated with two bits generated by Fosc or two bits of the internal prescaler to
create 10-bit time-base.
All PWM outputs associated with Timer2 are set when Equation 23-3 is used to calculate the PWM duty cycle
TMR2 is cleared. Each PWMx is cleared when TMR2 ratio.
is equal to the value specified in the corresponding
PWMxDCH (8 MSb) and PWMxDCL<7:6> (2 LSb) reg- EQUATION 23-2: PULSE WIDTH
isters. When the value is greater than or equal to PR2,
the PWM output is never cleared (100% duty cycle). Pulse Width = PWMxDCH:PWMxDCL<7:6>
23.1.3 PWM PERIOD The 8-bit timer TMR2 register is concatenated with the
The PWM period is specified by the PR2 register of two Least Significant bits of 1/FOSC, adjusted by the
Timer2. The PWM period can be calculated using the Timer2 prescaler to create the 10-bit time base. The
formula of Equation 23-1. system clock is used if the Timer2 prescaler is set to 1:1.
Figure 23-2 shows a waveform of the PWM signal when
EQUATION 23-1: PWM PERIOD the duty cycle is set for the smallest possible pulse.
TMR2 = 0
TMR2 = PWMxDC
TMR2 = PR2
log 4 PR2 + 1
Resolution = ------------------------------------------ bits
log 2
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
Rev. 10-000025A
8/1/2013
LCxOUT
D Q
MLCxOUT
Q1
LCx_in[0]
LCx_in[1]
to Peripherals
LCx_in[2]
Input Data Selection Gates(1)
LCx_in[3]
LCx_in[4] LCxEN LCxOE
LCx_in[5] lcxg1
TRIS Control
LCx_in[6] lcxg2 Logic lcxq LCx_out
LCx_in[7]
lcxg3 Function CLCx
LCx_in[8] (2)
LCx_in[9] lcxg4
LCx_in[10]
LCxPOL
LCx_in[11]
LCx_in[12]
LCxMODE<2:0> Interrupt
LCx_in[13]
LCx_in[14] det
LCx_in[15]
LCXINTP
set bit
LCXINTN CLCxIF
Interrupt
det
Data Selection
LCx_in[0] 00000
Data GATE 1
lcxd1T LCxD1G1T
lcxd1N LCxD1G1N
LCx_in[31] 11111
LCxD2G1T
LCxD1S<4:0>
LCxD2G1N lcxg1
LCx_in[0] 00000
LCxD3G1T
LCxG1POL
lcxd2T
LCxD3G1N
lcxd2N
LCxD4G1T
LCx_in[31] 11111
LCxD2S<4:0> LCxD4G1N
LCx_in[0] 00000
Data GATE 2
lcxg2
lcxd3T
(Same as Data GATE 1)
lcxd3N
Data GATE 3
LCx_in[31] 11111
lcxg3
LCxD3S<4:0>
(Same as Data GATE 1)
lcxd4N
LCx_in[31] 11111
LCxD4S<4:0>
AND-OR OR-XOR
lcxg1 lcxg1
lcxg2 lcxg2
lcxq lcxq
lcxg3 lcxg3
lcxg4 lcxg4
lcxg1 lcxg1
S Q lcxq
lcxg2
lcxg2
lcxq
lcxg3
lcxg3
R
lcxg4 lcxg4
lcxg1 R
lcxg1 R
lcxg3 lcxg3
lcxg4
lcxg2 J Q lcxq S
lcxg2 D Q lcxq
lcxg1
lcxg4 K
R
lcxg3 LE
R
lcxg3
lcxg1
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: See Table 24-1 for signal names associated with inputs.
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: See Table 24-1 for signal names associated with inputs.
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
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
PIC16(L)F1508/9
NCOxINCH NCOxINCL Rev. 10-000028A
7/30/2013
16
(1)
INCBUFH INCBUFL
16
20
NCO_overflow Adder
HFINTOSC 00
20
FOSC 01 NCOx_clk
NCOxACCU NCOxACCH NCOxACCL
LCx_out 10 20
NCO1CLK 11
NCO_interrupt set bit
NxCKS<1:0>
2 NCOxIF
Fixed Duty
Cycle Mode
Circuitry
NxOE
D Q D Q 0 TRIS bit
_ NCOx
1
Q
NxPFM NxPOL
NCOx_out
To Peripherals
EN S Q
_ D Q NxOUT
2011-2013 Microchip Technology Inc.
Ripple
R Q
Counter
Pulse Q1
R Frequency
3 Mode Circuitry
NxPWS<2:0>
Note 1: The increment registers are double-buffered to allow for value changes to be made without first disabling the NCO module. The full increment value is loaded into the buffer registers on the
second rising edge of the NCOx_clk signal that occurs immediately after a write to NCOxINCL register. The buffers are not user-accessible and are shown here for reference.
PIC16(L)F1508/9
25.2 Fixed Duty Cycle (FDC) Mode 25.5 Interrupts
In Fixed Duty Cycle (FDC) mode, every time the When the accumulator overflows (NCO_overflow), the
accumulator overflows (NCO_overflow), the output is NCOx Interrupt Flag bit, NCOxIF, of the PIRx register is
toggled. This provides a 50% duty cycle, provided that set. To enable the interrupt event (NCO_interrupt), the
the increment value remains constant. For more following bits must be set:
information, see Figure 25-2. • NxEN bit of the NCOxCON register
The FDC mode is selected by clearing the NxPFM bit • NCOxIE bit of the PIEx register
in the NCOxCON register. • PEIE bit of the INTCON register
• GIE bit of the INTCON register
25.3 Pulse Frequency (PF) Mode The interrupt must be cleared by software by clearing
the NCOxIF bit in the Interrupt Service Routine.
In Pulse Frequency (PF) mode, every time the accumu-
lator overflows (NCO_overflow), the output becomes
active for one or more clock periods. Once the clock 25.6 Effects of a Reset
period expires, the output returns to an inactive state. All of the NCOx registers are cleared to zero as the
This provides a pulsed output. result of a Reset.
The output becomes active on the rising clock edge
immediately following the overflow event. For more 25.7 Operation In Sleep
information, see Figure 25-2.
The value of the active and inactive states depends on The NCO module operates independently from the
the polarity bit, NxPOL in the NCOxCON register. system clock and will continue to run during Sleep,
provided that the clock source selected remains
The PF mode is selected by setting the NxPFM bit in
active.
the NCOxCON register.
The HFINTOSC remains active during Sleep when the
25.3.1 OUTPUT PULSE WIDTH CONTROL NCO module is enabled and the HFINTOSC is
When operating in PF mode, the active state of the out- selected as the clock source, regardless of the system
put can vary in width by multiple clock periods. Various clock source selected.
pulse widths are selected with the NxPWS<2:0> bits in
In other words, if the HFINTOSC is simultaneously
the NCOxCLK register.
selected as the system clock and the NCO clock
When the selected pulse width is greater than the source, when the NCO is enabled, the CPU will go idle
accumulator overflow time frame, the output of the
during Sleep, but the NCO will continue to operate and
NCOx operation is indeterminate.
the HFINTOSC will remain active.
This will have a direct effect on the Sleep mode current.
25.4 Output Polarity Control
The last stage in the NCOx module is the output polar- 25.8 Alternate Pin Locations
ity. The NxPOL bit in the NCOxCON register selects the
output polarity. Changing the polarity while the inter- This module incorporates I/O pins that can be moved to
rupts are enabled will cause an interrupt for the result- other locations with the use of the alternate pin function
ing output transition. register, APFCON. To determine which pins can be
moved and what their default locations are upon a
The NCOx output can be used internally by source
Reset, see Section 11.1 “Alternate Pin Function” for
code or other peripherals. Accomplish this by reading more information.
the NxOUT (read-only) bit of the NCOxCON register.
The NCOx output signal is available to the following
peripherals:
• CLC
• CWG
PIC16(L)F1508/9
Rev. 10-000 029A_A0
NCOx
Clock
Source
NCOx
Increment 4000h 4000h 4000h
Value
NCOx
Accumulator 00000h 04000h 08000h FC000h 00000h 04000h 08000h FC000h 00000h 04000h 08000h
Value
NCO_overflow
NCO_interrupt
NCOx Output
2011-2013 Microchip Technology Inc.
FDC Mode
NCOx Output
PF Mode
NCOxPWS =
000
NCOx Output
PF Mode
NCOxPWS =
00
PIC16(L)F1508/9
25.9 Register Definitions: NCOx Control Registers
REGISTER 25-1: NCOxCON: NCOx CONTROL REGISTER
R/W-0/0 R/W-0/0 R-0/0 R/W-0/0 U-0 U-0 U-0 R/W-0/0
NxEN NxOE NxOUT NxPOL — — — NxPFM
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
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
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: Write the NCOxINCH register first, then the NCOxINCL register. See 25.1.4 “Increment Registers” 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
Note 1: Write the NCOxINCH register first, then the NCOxINCL register. See 25.1.4 “Increment Registers” for
more information.
The CWG module allows the following clock sources 26.4.2 POLARITY CONTROL
to be selected:
The polarity of each CWG output can be selected
• Fosc (system clock) independently. When the output polarity bit is set, the
• HFINTOSC (16 MHz only) corresponding output is active-high. Clearing the output
The clock sources are selected using the G1CS0 bit of polarity bit configures the corresponding output as
the CWGxCON0 register (Register 26-1). active-low. However, polarity does not affect the
override levels. Output polarity is selected with the
GxPOLA and GxPOLB bits of the CWGxCON0 register.
PIC16(L)F1508/9
2
GxASDLA
00
1
GxCS ‘0’ 10
‘1’ 11 GxASDLA = 01
FOSC
cwg_clock
CWGxDBR GxOEA
HFINTOSC
6
1
3 EN
GxIS R
= 0
TRISx CWGxA
C1OUT_async S Q GxPOLA
C2OUT_async Input Source
PWM1_out
PWM2_out R Q CWGxDBF
PWM3_out
PWM4_out 6
GxOEB
NCO1_out
LC1_out EN TRISx
R = 0
GxPOLB 1
CWGxB
GxASDLB = 01
00
CWG1FLT (INT pin) ‘0’ 10
GxASDFLT ‘1’ 11
C1OUT_async
2011-2013 Microchip Technology Inc.
GxASDC1 GxASE
Auto-Shutdown GxASDLB
C2OUT_async Source 2
GxASDC2 S shutdown
S Q D Q
LC2_out
GxASCLC
R Q
cwg_clock
PWM1
CWGxA
PIC16(L)F1508/9
cwg_clock
Input Source
CWGxA
CWGxB
FIGURE 26-4: DEAD-BAND OPERATION, CWGxDBR = 03H, CWGxDBF = 04H, SOURCE SHORTER THAN DEAD BAND
cwg_clock
Input Source
CWGxA
CWGxB
CWG Input
Source
Shutdown Source
GxASE
No Shutdown
Shutdown Output Resumes
FIGURE 26-6: SHUTDOWN FUNCTIONALITY, AUTO-RESTART ENABLED (GxARSEN = 1,GxASDLA = 01, GxASDLB = 01)
CWG Input
PIC16(L)F1508/9
Source
Shutdown Source
GxASE
DS40001609C-page 301
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
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
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
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
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
27.2 Low-Voltage Programming Entry Another connector often found in use with the PICkit™
Mode programmers is a standard 6-pin header with 0.1 inch
spacing. Refer to Figure 27-2.
The Low-Voltage Programming Entry mode allows the
PIC® Flash MCUs to be programmed using VDD only,
without high voltage. When the LVP bit of Configuration
Words is set to ‘1’, the ICSP Low-Voltage
Programming Entry mode is enabled. To disable the
Low-Voltage ICSP mode, the LVP bit must be
programmed to ‘0’.
Entry into the Low-Voltage Programming Entry mode
requires the following steps:
1. MCLR is brought to VIL.
2. A 32-bit key sequence is presented on
ICSPDAT, while clocking ICSPCLK.
Once the key sequence is complete, MCLR must be
held at VIL for as long as Program/Verify mode is to be
maintained.
If low-voltage programming is enabled (LVP = 1), the
MCLR Reset function is automatically enabled and
cannot be disabled. See Section 6.5 “MCLR” for more
information.
The LVP bit can only be reprogrammed to ‘0’ by using
the High-Voltage Programming mode.
Pin 1 Indicator
Pin Description*
1 = VPP/MCLR
1
2
2 = VDD Target
3
4 3 = VSS (ground)
5
6 4 = ICSPDAT
5 = ICSPCLK
6 = No connect
For additional interface recommendations, refer to your It is recommended that isolation devices be used to
specific device programmer manual prior to PCB separate the programming pins from other circuitry.
design. The type of isolation is highly dependent on the specific
application and may include devices such as resistors,
diodes, or even jumpers. See Figure 27-3 for more
information.
Rev. 10-000129A
7/30/2013
External Device to be
Programming VDD Programmed
Signals
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 kkkk
k[n] Move INDFn to W, Indexed Indirect. 1 11 1111 0nkk 1nmm Z 2
MOVWI n mm Move W to Indirect FSRn with pre/post inc/dec 1 00 0000 0001 kkkk 2, 3
modifier, mm
k[n] Move W to INDFn, Indexed Indirect. 1 11 1111 1nkk 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
Before Instruction
W = 0x07
After Instruction
W = value of k8
Note 1: Maximum current rating requires even load distribution across I/O pins. Maximum current rating may be
limited by the device package power dissipation characterizations, see Table 29-6: “Thermal
Characteristics” to calculate device specifications.
† NOTICE: Stresses above those listed under “Absolute Maximum Ratings” may cause permanent damage to the
device. This is a stress rating only and functional operation of the device at those or any other conditions above those
indicated in the operation listings of this specification is not implied. Exposure above maximum rating conditions for
extended periods may affect device reliability.
Rev. 10-000130A
8/6/2013
5.5
VDD (V)
2.5
2.3
0 16 20
Frequency (MHz)
Note 1: The shaded region indicates the permissible combinations of voltage and frequency.
2: Refer to Table 29-7 for each Oscillator mode’s supported frequencies.
Rev. 10-000131A
8/5/2013
3.6
VDD (V)
2.5
1.8
0 16 20
Frequency (MHz)
Note 1: The shaded region indicates the permissible combinations of voltage and frequency.
2: Refer to Table 29-7 for each Oscillator mode’s supported frequencies.
PIC16F1508/9
Param. Sym. Characteristic Min. Typ† Max. Units Conditions
No.
D001 VDD Supply Voltage
VDDMIN VDDMAX
1.8 — 3.6 V FOSC 16 MHz
2.5 — 3.6 V FOSC 20 MHz
D001 2.3 — 5.5 V FOSC 16 MHz
2.5 — 5.5 V FOSC 20 MHz
D002* VDR RAM Data Retention Voltage(1)
1.5 — — V Device in Sleep mode
D002* 1.7 — — V Device in Sleep mode
(2)
D002A* VPOR Power-on Reset Release Voltage
— 1.6 — V
D002A* — 1.6 — V
D002B* VPORR* Power-on Reset Rearm Voltage(2)
— 0.8 — V
D002B* — 1.5 — V
D003 VFVR Fixed Voltage Reference Voltage
1x gain (1.024V nominal) VDD 2.5V, -40°C TA +85°C
2x gain (2.048V nominal) -4 — +4 % VDD 2.5V, -40°C TA +85°C
4x gain (4.096V nominal) VDD 4.75V, -40°C TA +85°C
D004* SVDD VDD Rise Rate(2) 0.05 — — V/ms Ensures that the Power-on Reset
signal is released properly.
*
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: This is the limit to which VDD can be lowered in Sleep mode without losing RAM data.
2: See Figure 29-3, POR and POR REARM with Slow Rising VDD.
VDD
VPOR
VPORR
SVDD
VSS
NPOR(1)
POR REARM
VSS
TVLOW(2) TPOR(3)
PIC16F1508/9
PIC16F1508/9
PIC16F1508/9
D022 Base IPD — 0.25 3.0 10 A 2.3 WDT, BOR, FVR and SOSC
— 0.30 4.0 12 A 3.0 disabled, all Peripherals inactive,
Low-Power Sleep mode
— 0.40 6.0 15 A 5.0
D022A Base IPD — 9.8 16 18 A 2.3 WDT, BOR, FVR and SOSC
— 10.3 18 20 A 3.0 disabled, all Peripherals inactive,
Normal-Power Sleep mode,
— 11.5 21 26 A 5.0
VREGPM = 0
D023 — 0.26 2.0 9.0 A 1.8 WDT Current
— 0.44 3.0 10 A 3.0
D023 — 0.43 6.0 15 A 2.3 WDT Current
— 0.53 7.0 20 A 3.0
— 0.64 8.0 22 A 5.0
D023A — 15 28 30 A 1.8 FVR Current
— 18 30 33 A 3.0
D023A — 18 33 35 A 2.3 FVR Current
— 19 35 37 A 3.0
— 20 37 39 A 5.0
D024 — 6.0 17 20 A 3.0 BOR Current
D024 — 7.0 17 30 A 3.0 BOR Current
— 8.0 20 40 A 5.0
D24A — 0.1 4.0 10 A 3.0 LPBOR Current
D24A — 0.35 5.0 14 A 3.0 LPBOR Current
— 0.45 8.0 17 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 can be determined by subtracting the base 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 VSS.
3: ADC clock source is FRC.
— 280 — — A 5.0
D027 — 7 22 25 A 1.8 Comparator,
— 8 23 27 A 3.0 CxSP = 0
— 19 38 40 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 can be determined by subtracting the base 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 VSS.
3: ADC clock source is FRC.
Param.
Sym. Characteristic Min. Typ† Max. Units Conditions
No.
VIL Input Low Voltage
I/O PORT:
D030 with TTL buffer — — 0.8 V 4.5V VDD 5.5V
D030A — — 0.15 VDD V 1.8V VDD 4.5V
D031 with Schmitt Trigger buffer — — 0.2 VDD V 2.0V VDD 5.5V
with I2C™ levels — — 0.3 VDD V
with SMbus levels — — 0.8 V 2.7V VDD 5.5V
D032 MCLR, OSC1 (EXTRC mode) — — 0.2 VDD V (Note 1)
D033 OSC1 (HS mode) — — 0.3 VDD V
VIH Input High Voltage
I/O PORT:
D040 with TTL buffer 2.0 — — V 4.5V VDD 5.5V
D040A 0.25 VDD + — — V 1.8V VDD 4.5V
0.8
D041 with Schmitt Trigger buffer 0.8 VDD — — V 2.0V VDD 5.5V
with I2C™ levels 0.7 VDD — — V
with SMbus levels 2.1 — — V 2.7V VDD 5.5V
D042 MCLR 0.8 VDD — — V
D043A OSC1 (HS mode) 0.7 VDD — — V
D043B OSC1 (EXTRC mode) 0.9 VDD — — V VDD 2.0V (Note 1)
IIL Input Leakage Current(2)
D060 I/O Ports — ±5 ± 125 nA VSS VPIN VDD,
Pin at high-impedance, 85°C
— ±5 ± 1000 nA VSS VPIN VDD,
Pin at high-impedance, 125°C
D061 MCLR(3) — ± 50 ± 200 nA VSS VPIN VDD,
Pin at high-impedance, 85°C
IPUR Weak Pull-up Current
D070* 25 100 200 A VDD = 3.3V, VPIN = VSS
25 140 300 A VDD = 5.0V, VPIN = VSS
VOL Output Low Voltage(4)
D080 I/O Ports IOL = 8 mA, VDD = 5V
— — 0.6 V IOL = 6 mA, VDD = 3.3V
IOL = 1.8 mA, VDD = 1.8V
VOH Output High Voltage(4)
D090 I/O Ports IOH = 3.5 mA, VDD = 5V
VDD - 0.7 — — V IOH = 3 mA, VDD = 3.3V
IOH = 1 mA, VDD = 1.8V
D101* COSC2 Capacitive Loading Specifications on Output Pins
OSC2 pin In XT, HS, LP modes when
— — 15 pF external clock is used to drive
OSC1
D101A* CIO All I/O pins — — 50 pF
* 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: In EXTRC oscillator configuration, the OSC1/CLKIN pin is a Schmitt Trigger input. It is not recommended to use an
external clock in EXTRC mode.
2: Negative current is defined as current sourced by the pin.
3: The leakage current on the MCLR pin is strongly dependent on the applied voltage level. The specified levels represent
normal operating conditions. Higher leakage current may be measured at different input voltages.
4: Excluding OSC2 in CLKOUT mode.
Param.
Sym. Characteristic Typ. Units Conditions
No.
TH01 JA Thermal Resistance Junction to Ambient 62.2 C/W 20-pin DIP package
77.7 C/W 20-pin SOIC package
87.3 C/W 20-pin SSOP package
43 C/W 20-pin QFN 4X4mm package
TH02 JC Thermal Resistance Junction to Case 27.5 C/W 20-pin DIP package
23.1 C/W 20-pin SOIC package
31.1 C/W 20-pin SSOP package
5.3 C/W 20-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)
Note 1: IDD is current to run the chip alone without driving any load on the output pins.
2: TA = Ambient Temperature; TJ = Junction Temperature
Rev. 10-000133A
8/1/2013
Load Condition
Pin
CL
VSS
Q4 Q1 Q2 Q3 Q4 Q1
CLKIN
OS02 OS12 OS11
OS03
CLKOUT
(CLKOUT mode)
Param.
Sym. Characteristic Min. Typ† Max. Units Conditions
No.
OS01 FOSC External CLKIN Frequency(1) DC — 0.5 MHz External Clock (ECL)
DC — 4 MHz External Clock (ECM)
DC — 20 MHz External Clock (ECH)
Oscillator Frequency(1) — 32.768 — kHz LP Oscillator
0.1 — 4 MHz XT Oscillator
1 — 4 MHz HS Oscillator
1 — 20 MHz HS Oscillator, VDD > 2.7V
DC — 4 MHz EXTRC, VDD > 2.0V
OS02 TOSC External CLKIN Period(1) 27 — µs LP Oscillator
250 — ns XT Oscillator
50 — ns HS Oscillator
50 — ns External Clock (EC)
Oscillator Period(1) — 30.5 — µs LP Oscillator
250 — 10,000 ns XT Oscillator
50 — 1,000 ns HS Oscillator
250 — — ns EXTRC
OS03 TCY Instruction Cycle Time(1) 200 TCY DC ns TCY = 4/FOSC
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 CLKIN pin. When an external
clock input is used, the “max” cycle time limit is “DC” (no clock) for all devices.
Param. Freq.
Sym. Characteristic Min. Typ† Max. Units Conditions
No. Tolerance
OS08 HFOSC Internal Calibrated HFINTOSC ±2% — 16.0 — MHz VDD = 3.0V, TA = 25°C,
Frequency(1) (Note 2)
OS09 LFOSC Internal LFINTOSC Frequency — — 31 — kHz (Note 3)
OS10* TIOSC ST HFINTOSC — — 5 15 s
Wake-up from Sleep Start-up Time
OS10A* TLFOSC ST LFINTOSC — — 0.5 — ms -40°C TA +125°C
Wake-up from Sleep Start-up Time
*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: 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.
2: See Figure 29-6: “HFINTOSC Frequency Accuracy over Device VDD and Temperature”,
Figure 30-73: “HFINTOSC Accuracy Over Temperature, VDD = 1.8V, PIC16LF1508/9 Only”, and
Figure 30-74: “HFINTOSC Accuracy Over Temperature, 2.3V VDD 5.5V”.
3: See Figure 30-71: “LFINTOSC Frequency over VDD and Temperature, PIC16LF1508/9 Only”, and
Figure 30-72: “ LFINTOSC Frequency over VDD and Temperature, PIC16F1508/9”.
Rev. 10-000135A
7/30/2013
125
±12%
85
-4.5% to +7%
Temperature (°C)
60
25
±4.5%
±12%
-40
1.8 2.3 5.5
VDD (V)
Note: See Figure 30-73: “HFINTOSC Accuracy Over Temperature, VDD = 1.8V, PIC16LF1508/9 Only”,
and Figure 30-74: “HFINTOSC Accuracy Over Temperature, 2.3V VDD 5.5V”.
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
Param.
Sym. Characteristic Min. Typ† Max. Units Conditions
No.
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
Param.
Sym. Characteristic Min. Typ† Max. Units Conditions
No.
VDD
VBOR and VHYST
VBOR
37
Reset
33
(due to BOR)
T0CKI
40 41
42
T1CKI
45 46
47 49
TMR0 or
TMR1
Param.
Sym. Characteristic Min. Typ† Max. Units Conditions
No.
40* TT0H T0CKI High Pulse Width No Prescaler 0.5 TCY + 20 — — ns
With Prescaler 10 — — ns
41* TT0L T0CKI Low Pulse Width No Prescaler 0.5 TCY + 20 — — ns
With Prescaler 10 — — ns
42* TT0P T0CKI Period Greater of: — — ns N = prescale value
20 or TCY + 40
N
45* TT1H T1CKI High Synchronous, No Prescaler 0.5 TCY + 20 — — ns
Time Synchronous, with Prescaler 15 — — ns
Asynchronous 30 — — ns
46* TT1L T1CKI Low Synchronous, No Prescaler 0.5 TCY + 20 — — ns
Time Synchronous, with Prescaler 15 — — ns
Asynchronous 30 — — ns
47* TT1P T1CKI Input Synchronous Greater of: — — ns N = prescale value
Period 30 or TCY + 40
N
Asynchronous 60 — — ns
48 FT1 Secondary Oscillator Input Frequency Range 32.4 32.768 33.1 kHz
(Oscillator enabled by setting bit T1OSCEN)
49* TCKEZTMR1 Delay from External Clock Edge to Timer 2 TOSC — 7 TOSC — Timers in Sync
Increment mode
* 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.
Rev. 10-000031A
7/30/2013
Note 1: See FIGURE 24-1: Digital-to-Analog Converter Block Diagram to identify specific CLC signals.
Param.
Sym. Characteristic Min. Typ† Max. Units Conditions
No.
CLC01* TCLCIN CLC input time — 7 — ns
CLC02* TCLC CLC module input to output progagation time — 24 — ns VDD = 1.8V
— 12 — ns VDD > 3.6V
CLC03* TCLCOUT CLC output time Rise Time — OS18 — — (Note 1)
Fall Time — OS19 — — (Note 1)
CLC04* FCLCMAX CLC maximum switching frequency — 45 — MHz
* 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: See Table 29-9 for OS18 and OS19 rise and fall times.
BSF ADCON0, GO
1 TCY
AD133
AD131
Q4
AD130
ADC_clk
ADC Data 9 8 7 6 3 2 1 0
ADIF 1 TCY
GO DONE
Sampling Stopped
Sample AD132
BSF ADCON0, GO
AD133 1 TCY
AD131
Q4
AD130
ADC_clk
ADC Data 9 8 7 6 3 2 1 0
ADIF 1 TCY
GO DONE
Note 1: If the ADC clock source is selected as FRC, a time of TCY is added before the ADC clock starts. This allows the
SLEEP instruction to be executed.
Param.
Sym. Characteristic Min. Typ† Max. Units Conditions
No.
AD130* TAD ADC Clock Period (TADC) 1.0 — 6.0 s FOSC-based
ADC Internal FRC Oscillator Period (TFRC) 1.0 2.0 6.0 s ADCS<2:0> = x11 (ADC FRC mode)
AD131 TCNV Conversion Time — 11 — TAD Set GO/DONE bit to conversion
(not including Acquisition Time)(1) complete
AD132* TACQ Acquisition Time — 5.0 — s
AD133* THCD Holding Capacitor Disconnect Time — 1/2 TAD — FOSC-based
— 1/2 TAD + — ADCS<2:0> = x11 (ADC FRC mode)
1TCY
* 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 ADRES register may be read on the following TCY cycle.
Param.
Sym. Characteristics Min. Typ. Max. Units Comments
No.
CM01 VIOFF Input Offset Voltage — ±7.5 ±60 mV CxSP = 1,
VICM = VDD/2
CM02 VICM Input Common Mode Voltage 0 — VDD V
CM03 CMRR Common Mode Rejection Ration — 50 — dB
CM04A Response Time Rising Edge — 400 800 ns CxSP = 1
CM04B Response Time Falling Edge — 200 400 ns CxSP = 1
TRESP(2)
CM04C Response Time Rising Edge — 1200 — ns CxSP = 0
CM04D Response Time Falling Edge — 550 — ns CxSP = 0
CM05* TMC2OV Comparator Mode Change to — — 10 s
Output Valid
CM06 CHYSTER Comparator Hysteresis — 25 — mV CxHYS = 1,
CxSP = 1
* These parameters are characterized but not tested.
Note 1: See Section 30.0 “DC and AC Characteristics Graphs and Charts” for operating characterization.
2: Response time measured with one comparator input at VDD/2, while the other input transitions from VSS to
VDD.
CK
US121 US121
DT
US120 US122
Param.
Symbol Characteristic Min. Max. Units Conditions
No.
US120 TCKH2DTV SYNC XMIT (Master and Slave) — 80 ns 3.0V VDD 5.5V
Clock high to data-out valid — 100 ns 1.8V VDD 5.5V
US121 TCKRF Clock out rise time and fall time — 45 ns 3.0V VDD 5.5V
(Master mode) — 50 ns 1.8V VDD 5.5V
US122 TDTRF Data-out rise time and fall time — 45 ns 3.0V VDD 5.5V
— 50 ns 1.8V VDD 5.5V
CK
US125
DT
US126
Param.
Symbol Characteristic Min. Max. Units Conditions
No.
US125 TDTV2CKL SYNC RCV (Master and Slave)
Data-hold before CK (DT hold time) 10 — ns
US126 TCKL2DTL Data-hold after CK (DT hold time) 15 — ns
SS
SP81
SCK
(CKP = 0)
SP71 SP72
SP78 SP79
SCK
(CKP = 1)
SP79 SP78
SP80
SP75, SP76
SP74
SP73
SS
SP81
SCK
(CKP = 0)
SP71 SP72
SP79
SP73
SCK
(CKP = 1)
SP80
SP78
SP75, SP76
SP74
SS
SP70
SCK SP83
(CKP = 0)
SP71 SP72
SP78 SP79
SCK
(CKP = 1)
SP79 SP78
SP80
SP74
SP73
SP82
SS
SP70
SCK SP83
(CKP = 0)
SP71 SP72
SCK
(CKP = 1)
SP80
SP77
SP75, SP76
SDI
MSb In bit 6 - - - -1 LSb In
SP74
Param.
Symbol Characteristic Min. Typ† Max. Units Conditions
No.
SCL
SP91 SP93
SP90 SP92
SDA
Start Stop
Condition Condition
Param.
Symbol Characteristic Min. Typ Max. Units Conditions
No.
SP90* TSU:STA Start condition 100 kHz mode 4700 — — ns Only relevant for Repeated
Setup time 400 kHz mode 600 — — Start condition
SP91* THD:STA Start condition 100 kHz mode 4000 — — ns After this period, the first
Hold time 400 kHz mode 600 — — clock pulse is generated
SP92* TSU:STO Stop condition 100 kHz mode 4700 — — ns
Setup time 400 kHz mode 600 — —
SP93 THD:STO Stop condition 100 kHz mode 4000 — — ns
Hold time 400 kHz mode 600 — —
* These parameters are characterized but not tested.
SCL
SP90
SP106
SP107
SP91 SP92
SDA
In
SP110
SP109
SP109
SDA
Out
Param.
Symbol Characteristic Min. Max. Units Conditions
No.
SP100* THIGH Clock high time 100 kHz mode 4.0 — s Device must operate at a
minimum of 1.5 MHz
400 kHz mode 0.6 — s Device must operate at a
minimum of 10 MHz
SSP module 1.5TCY —
SP101* TLOW Clock low time 100 kHz mode 4.7 — s Device must operate at a
minimum of 1.5 MHz
400 kHz mode 1.3 — s Device must operate at a
minimum of 10 MHz
SSP module 1.5TCY —
SP102* TR SDA and SCL rise 100 kHz mode — 1000 ns
time 400 kHz mode 20 + 0.1CB 300 ns CB is specified to be from
10-400 pF
SP103* TF SDA and SCL fall 100 kHz mode — 250 ns
time 400 kHz mode 20 + 0.1CB 250 ns CB is specified to be from
10-400 pF
SP106* THD:DAT Data input hold time 100 kHz mode 0 — ns
400 kHz mode 0 0.9 s
SP107* TSU:DAT Data input setup 100 kHz mode 250 — ns (Note 2)
time 400 kHz mode 100 — ns
SP109* TAA Output valid from 100 kHz mode — 3500 ns (Note 1)
clock 400 kHz mode — — ns
SP110* TBUF Bus free time 100 kHz mode 4.7 — s Time the bus must be free
400 kHz mode 1.3 — s before a new transmission
can start
SP111 CB Bus capacitive loading — 400 pF
* These parameters are characterized but not tested.
Note 1: As a transmitter, the device must provide this internal minimum delay time to bridge the undefined region
(min. 300 ns) of the falling edge of SCL to avoid unintended generation of Start or Stop conditions.
2: A Fast mode (400 kHz) I2C™ bus device can be used in a Standard mode (100 kHz) I2C bus system, but
the requirement TSU:DAT 250 ns must then be met. This will automatically be the case if the device does
not stretch the low period of the SCL signal. If such a device does stretch the low period of the SCL signal,
it must output the next data bit to the SDA line TR max. + TSU:DAT = 1000 + 250 = 1250 ns (according to
the Standard mode I2C bus specification), before the SCL line is released.
18
12
Typical
IDD (µA)
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)
30
Max.
Max: 85°C + 3ı
25 Typical: 25°C
Typical
20
IDD (µA)
15
10
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
350
200 4 MHz XT
IDD (µA)
150
1 MHz XT
100
50
1 MHz EXTRC
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)
400
250
IDD (µA)
150 1 MHz XT
100
50
1 MHz EXTRC
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)
400
4 MHz EXTRC
350 Typical: 25°C
300 4 MHz XT
250
IDD (µA)
200 1 MHz XT
150
50
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
500
400
4 MHz EXTRC
350
300
IDD (µA)
250 1 MHz XT
200
150
1 MHz EXTRC
100
50
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
14
Max.
12
10
Typical
8
IDD (µA)
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)
FIGURE 30-8: IDD, EXTERNAL CLOCK (ECL), LOW-POWER MODE, FOSC = 32 kHz,
PIC16F1508/9 ONLY
25
Max.
20
Typical
15
IDD (µA)
10
Max: 85°C + 3ı
5 Typical: 25°C
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
50
45 Max: 85°C + 3ı
Typical: 25°C
40
Max.
35
30
Typical
IDD (µA)
25
20
15
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)
FIGURE 30-10: IDD, EXTERNAL CLOCK (ECL), LOW-POWER MODE, FOSC = 500 kHz,
PIC16F1508/9 ONLY
60
Max.
50
40 Typical
IDD (µA)
30
20
Max: 85°C + 3ı
10 Typical: 25°C
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
300
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)
350
250 4 MHz
200
IDD (µA)
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)
350
4 MHz
300 Typical: 25°C
250
IDD (µA)
200
150
1 MHz
100
50
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
400
4 MHz
350 Max: 85°C + 3ı
300
250
IDD (µA)
200
1 MHz
150
100
50
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
1.4
20 MHz
1.2 Typical: 25°C
1.0 16 MHz
IDD (mA)
0.8
0.6
8 MHz
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)
1.6
20 MHz
1.4 Max: 85°C + 3ı
1.2 16 MHz
1.0
IDD (mA)
0.8
8 MHz
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)
1.4
20 MHz
1.2 Typical: 25°C
16 MHz
1.0
0.8
IDD (mA)
8 MHz
0.6
0.4
0.2
0.0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
1.6
20 MHz
1.4 Max: 85°C + 3ı
1.2 16 MHz
1.0
IDD (mA)
0.8
8 MHz
0.6
0.4
0.2
0.0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
12
8
IDD (µA)
6 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)
25
Max.
20
Typical
IDD (µA)
15
10
Max: 85°C + 3ı
5 Typical: 25°C
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
400
Max: 85°C + 3ı
350 Typical: 25°C Max.
300
250 Typical
IDD (µA)
200
150
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)
250
200
150
100
50
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
1.4
16 MHz
1.0
IDD (mA)
0.8
8 MHz
0.6
4 MHz
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)
1.6
16 MHz
1.2
1.0
IDD (mA)
8 MHz
0.8
0.6 4 MHz
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)
1.2
1.0 16 MHz
0.8
IDD (mA)
8 MHz
0.6
4 MHz
0.4
0.0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
1.4
1.2 16 MHz
1.0
0.8
IDD (mA)
8 MHz
0.6
4 MHz
0.4
0.0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
1.6
1.0
IDD (mA)
0.8
0.6 8 MHz
0.4
4 MHz
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)
1.8
1.4 20 MHz
1.2
1.0
IDD (mA)
0.8
8 MHz
0.6
0.4 4 MHz
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)
1.8
20 MHz
1.6 Typical: 25°C
1.4
1.2
1.0
IDD (mA)
0.8 8 MHz
0.6
4 MHz
0.4
0.2
0.0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
2.5
Max: 85°C + 3ı
2.0 20 MHz
1.5
IDD (mA)
1.0 8 MHz
4 MHz
0.5
0.0
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
M 3ı
400
Typical: 25°C Max.
350
300
D (nA)
250
IPD
200
150
100
Typical
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)
FIGURE 30-32: IPD BASE, LOW-POWER SLEEP MODE, VREGPM = 1, PIC16F1508/9 ONLY
600
Max.
Max: 85°C + 3ı
500 Typical: 25°C
400
IPD (nA)
300
Typical
200
100
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
2.0
1.4 Max.
1.2
(µA)
IPD (µA
1.0
0.8
08
0.6 Typical
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)
1.4
Max
Max.
1.2
1.0
A)
0.8
IPD (µA
Typical
0.6
0.4
Max: 85°C + 3ı
0.2
Typical: 25°C
0.0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
45
Max: 85°C + 3ı
40
Typical: 25°C
35
Max.
30
25 Typical
A)
IPD (µA
20
15
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)
30
25 Max.
20
Typical
IPD (µA)
15
10
Max: 85°C + 3ı
5 Typical: 25°C
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
10
Max.
9
Max: 85°C + 3ı
8 Typical: 25°C
7
Typical
6
D (µA)
5
IPD
0
16
1.6 1
1.8
8 2
2.0
0 2
2.2
2 2
2.4
4 2
2.6
6 2
2.8
8 3
3.0
0 3
3.2
2 3
3.4
4 3
3.6
6 3
3.8
8
VDD (V)
12
8
Typical
IPD (µA)
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)
12
M
Max.
Max: 85°C + 3ı
10 Typical: 25°C
8
Typical
IPD (µA)
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
14
Max
Max.
12 Max: 85°C + 3ı
Typical: 25°C
10
Typical
8
IPD (µA)
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
8.0
Max: 85°C + 3ı
7.0
Typical: 25°C
6.0
Max.
5.0
A)
IPD (µA
4.0
3.0
30
Typical
2.0
1.0
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)
16
Max: 85°C + 3ı
14 Typical: 25°C
Max.
12
10
IPD (µA)
8
Typical
6
0
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
6
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)
FIGURE 30-44: IPD, COMPARATOR, LOW-POWER MODE (CxSP = 0), PIC16F1508/9 ONLY
30
25
Max.
20
IPD (µA)
Typical
yp
15
10
5 Max: 85°C + 3ı
Typical: 25°C
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
40
35 Max.
30
25
A)
IPD (µA
20 Typical
15
10
Max: 85°C + 3ı
5
Typical: 25 C
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 30-46: IPD, COMPARATOR, NORMAL-POWER MODE (CxSP = 1), PIC16F1508/9 ONLY
60
50
Max.
40
A)
IPD (µA
30
Typical
20
Max: 85°C + 3ı
10 Typical: 25°C
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
Max: 125°C + 3ı
5 Typical: 25°C
Min: -40°C - 3ı
4
VOH (V)
Min. (-40°C)
3
Typical (25°C)
2
Max. (125°C)
0
-45 -40 -35 -30 -25 -20 -15 -10 -5 0
IOH (mA)
FIGURE 30-48: VOL vs. IOL OVER TEMPERATURE, VDD = 5.5V, PIC16F1508/9 ONLY
Typical (25°C)
3
VOL (V)
Min. (-40°C)
2
0
0 10 20 30 40 50 60 70 80 90 100
IOL (mA)
3.5
Max: 125°C + 3ı
3.0 Typical: 25°C
Min: -40°C - 3ı
2.5
VOH (V)
2.0
1.5
1.0
Min. (-40°C) Typical (25°C) Max. (125°C)
0.5
0.0
-15 -13 -11 -9 -7 -5 -3 -1
IOH (mA)
3.0
Max: 125°C + 3ı
2.5 Typical: 25°C
Min: -40°C - 3ı
2.0
Min. (-40°C)
VOL (V)
1.0
0.5
0.0
0 5 10 15 20 25 30 35 40
IOL (mA)
2.0
1.2
VOH (V)
0.8
0.6
0.4
0.2
0.0
-4.5 -4.0 -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0
IOH (mA)
FIGURE 30-52: VOL vs. IOL OVER TEMPERATURE, VDD = 1.8V, PIC16LF1508/9 ONLY
1.8
1.2
VOL (V)
1.0
0.8
Max. (125°C) Typical (25°C) Min. (-40°C)
0.6
0.4
0.2
0.0
0 1 2 3 4 5 6 7 8 9 10
IOL (mA)
1.70
1.68
Max.
1.66
1.64 Typical
1.62
Voltage (V)
Min.
1.60
1.58
1.56
1.50
-60 -40 -20 0 20 40 60 80 100 120 140
Temperature (°C)
1.46
Voltage (V)
1.44
Typical
1.42
1.40
Min.
1.38
1.36
1.34
-60 -40 -20 0 20 40 60 80 100 120 140
Temperature (°C)
2.00
Max.
1.95
Voltage (V)
Typical
1.90
1.85 Min.
Max: Typical + 3ı
Min: Typical - 3ı
1.80
-60 -40 -20 0 20 40 60 80 100 120 140
Temperature (°C)
60
50 Max.
Max: Typical + 3ı
40 Typical: 25°C
Min: Typical - 3ı
Voltage (mV)
Typical
30
20
Min.
10
0
-60 -40 -20 0 20 40 60 80 100 120 140
Temperature (°C)
2.60
2.55 Max.
2.50
Typical
Voltage (V)
2.45
Min.
2.40
Max: Typical + 3ı
2.35 Min: Typical - 3ı
2.30
-60 -40 -20 0 20 40 60 80 100 120 140
Temperature (°C)
70
Max.
60
Max: Typical + 3ı
50 Typical: 25°C
Min: Typical - 3ı
Voltage (mV)
40
Typical
30
20
Min.
10
0
-60 -40 -20 0 20 40 60 80 100 120 140
Temperature (°C)
2.80
2.75
Max.
2.70
Voltage (V)
Typical
2.65
Min.
Max: Typical + 3ı
2.60 Min: Typical - 3ı
2.55
-60 -40 -20 0 20 40 60 80 100 120 140
Temperature (°C)
90
80
Min.
70
60
Typical
Voltage (mV)
50
40 Max: Typical + 3ı
Typical: 25°C
30 Min: Typical - 3ı
20
Max.
10
0
-60 -40 -20 0 20 40 60 80 100 120 140
Temperature (°C)
2.50
Max.
Max: Typical + 3ı
2.40
Min: Typical - 3ı
2.30
Typical
Voltage (V)
2.20
2.10
2.00
Min.
1.90
1.80
-60 -40 -20 0 20 40 60 80 100 120 140
Temperature (°C)
45
25
Min.
20
15
10
0
-60 -40 -20 0 20 40 60 80 100 120 140
Temperature (°C)
24
22 Max.
20
Time (ms)
18 Typical
16
Min.
14
100
80
Time (ms)
70 Typical
60
Min.
50
40
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
60
Max: Typical + 3ı
50 Typical: statistical mean @ 25°C
Max.
40
Typical
Time (us)
30
20
Note:
The FVR Stabilization Period applies when:
1) coming out of RESET or exiting Sleep mode for PIC12/16LFxxxx devices.
10 2) when exiting sleep mode with VREGPM = 1 for PIC12/16Fxxxx devices
In all other cases, the FVR is stable when released from RESET.
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)
40
35
Max.
30
Hysteresis (mV)
25
Typical
20
15
Min.
10 Max: Typical + 3ı
Typical: 25°C
5 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)
7
Max.
6
Hysteresis (mV)
5
Typical
4
2
Max: Typical + 3ı Min.
1 Typical: 25°C
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)
Max. (125°C)
200
150
Typical (25°C)
100
Min. (-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)
36
34
Max.
32
30
Typical
Frequency (kHz)
28
26 Min.
24
Max: Typical + 3ı (-40°C to +125°C)
22 Typical: statistical mean @ 25°C
Min: Typical - 3ı (-40°C to +125°C)
20
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 30-72: LFINTOSC FREQUENCY OVER VDD AND TEMPERATURE, PIC16F1508/9 ONLY
36
34
Max.
32
30
Frequency (kHz)
Typical
28
26 Min.
24
Max: Typical + 3ı (-40°C to +125°C)
22 Typical: statistical mean @ 25°C
Min: Typical - 3ı (-40°C to +125°C)
20
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
8%
6% Max: Typical + 3ı
Typical: statistical mean Max.
4% Min: Typical - 3ı
2%
Accuracy (%)
0% Typical
-2%
-4%
-6% Min.
-8%
-10%
-60 -40 -20 0 20 40 60 80 100 120 140
Temperature (°C)
8%
6% Max: Typical + 3ı
Typical: statistical mean
4% Min: Typical - 3ı Max.
Accuracy (%)
2%
Typical
0%
-2% Min.
-4%
-6%
-8%
-10%
-60 -40 -20 0 20 40 60 80 100 120 140
Temperature (°C)
5.0
4.5
Max.
4.0
3.5
3.0 Typical
Time (us)
2.5
2.0
1.5
Max: 85°C + 3ı
1.0 Typical: 25°C
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)
35
Max.
30
Typical
25
Time (us)
20
15
10
5 Max: 85°C + 3ı
Typical: 25°C
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
FIGURE 30-77: SLEEP MODE, WAKE PERIOD WITH HFINTOSC SOURCE, VREGPM = 0,
PIC16F1508/9 ONLY
12
Max.
10
8
Time (us)
Typical
6
2 Max: 85°C + 3ı
Typical: 25°C
0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
The MPASM Assembler generates relocatable object • Support for the entire device instruction set
files for the MPLINK Object Linker, Intel® standard HEX • Support for fixed-point and floating-point data
files, MAP files to detail memory usage and symbol • Command-line interface
reference, absolute LST files that contain source lines • Rich directive set
and generated machine code, and COFF files for • Flexible macro language
debugging.
• MPLAB X IDE compatibility
The MPASM Assembler features include:
• Integration into MPLAB X IDE projects
• User-defined macros to streamline
assembly code
• Conditional assembly for multipurpose
source files
• Directives that allow complete control over the
assembly process
XXXXXXXXXXXXXXXXX PIC16F1508
XXXXXXXXXXXXXXXXX -E/P e3
YYWWNNN 1120123
PIC16F1508
-E/SO e3
1120123
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.
PIC16F1508
-E/SS e3
1120123
PIC16
F1508
PIN 1 PIN 1
E/ML e3
120123
/HDG3ODVWLF'XDO,Q/LQH3±PLO%RG\>3',3@
1RWH 6)*$)%)
7
&
-$+
$$)"
7
(
)
)&
)
))588---**8
7
NOTE 1 E1
1 2 3
A A2
L
c
A1
b1
b e eB
9)$ :/;1
*$<*)$ : := >
:%*,("$ :
") !4/
)
)"
? ? !
&&"
7
7$$ !! !0 !
4
$)
)"
! ! ? ?
%&)%&@&) 1 0 0! 0
&&"
7
@&) 1! B
=#
<) B !0 !D
)
)"
< !! !0 !
<
&7$$ B ! !
9<
&@&) ,! D
<-<
&@&) , ! !B
=#
-
. 4 ? ? 0
1RWHV
! "!#$%
&'(
)%*
#
+,%)*%$),
)&-))
)&
.(
)/
)$)
0 *$$
&1!&)%&*&(
$)%$$&(
$)%$$$
)'&!2$&
*$
&)
13!
4/5 4
$*$)
'
)#
%$--)%))
$
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
/HDG3ODVWLF6KULQN6PDOO2XWOLQH66±PP%RG\>6623@
1RWH 6)*$)%)
7
&
-$+
$$)"
7
(
)
)&
)
))588---**8
7
D
N
E1
NOTE 1
1 2
e
b
c
A A2
φ
A1
L1 L
9)$ <<11
*$<*)$ : := >
:%*,("$ :
") D4/
=#
;) ? ?
&&"
7
7$$ !D ! !B
)
&(( ! ? ?
=#
@&) 1 B B
&&"
7
@&) 1! 0 D
=#
<) D
6)<) <
6)) <! !
16
<
&7$$ ?
6) E E BE
<
&@&) , ? 0B
1RWHV
! "!#$%
&'(
)%*
#
+,%)*%$),
)&-))
)&
*$$
&1!&)%&*&(
$)%$$&(
$)%$$$
)'&**$&
0 *$
&)
13!
4/5 4
$*$)
'
)#
%$--)%))
$
165
(*$+%$%
-)%))
+((*
)%$$
- /4
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
/HDG3ODVWLF4XDG)ODW1R/HDG3DFNDJH0/±[[PP%RG\>4)1@
1RWH 6)*$)%)
7
&
-$+
$$)"
7
(
)
)&
)
))588---**8
7
D D2
EXPOSED
PAD
e
E2
E
2 2 b
1 1
K
N N
NOTE 1 L
TOP VIEW BOTTOM VIEW
A3 A1
9)$ <<11
*$<*)$ : := >
:%*,("$ :
") 4/
=#
;) B !
)
&(( !
/)
)7$$ 0
16
=#
@&) 1 4/
1'$&"
&@&) 1 D B
=#
<) 4/
1'$&"
&<) D B
/)
)@&) , !B 0
/)
)<) < 0
/)
))1'$&"
& G ? ?
1RWHV
! "!#$%
&'(
)%*
#
+,%)*%$),
)&-))
)&
"
7
$$
-$%
)&
0 *$
&)
13!
4/5 4
$*$)
'
)#
%$--)%))
$
165
(*$+%$%
-)%))
+((*
)%$$
- /!D4
1RWH 6)*$)%)
7
&
-$+
$$)"
7
(
)
)&
)
))588---**8
7
Revision A (10/2011)
Original release.
Revision B (6/2013)
Updated Electrical Specifications and added
Characterization Data.
Revision C (8/2013)
Updated Electrical Specifications and added
Characterization Data.
Package:(2) ML = QFN
P = Plastic DIP Note 1: Tape and Reel identifier only appears in the
SO = SOIC catalog part number description. This
SS = SSOP identifier is used for ordering purposes and is
not printed on the device package. Check
with your Microchip Sales Office for package
Pattern: QTP, SQTP, Code or Special Requirements availability with the Tape and Reel option.
(blank otherwise) 2: For other small form-factor package
availability and marking information, please
visit www.microchip.com/packaging or
contact your local sales office.
• 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.
QUALITY MANAGEMENT SYSTEM Microchip received ISO/TS-16949:2009 certification for its worldwide
headquarters, design and wafer fabrication facilities in Chandler and
CERTIFIED BY DNV Tempe, Arizona; Gresham, Oregon and design centers in California
and India. The Company’s quality system processes and procedures
are for its PIC® MCUs and dsPIC® DSCs, KEELOQ® code hopping
== ISO/TS 16949 == 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.