Curiosity Datasheet
Curiosity Datasheet
Curiosity Datasheet
Description
PIC16(L)F1615/9 microcontrollers deliver on-chip features that are unique to the design for embedded control of small
motors and general purpose applications in 14/20-pin count packages. Features like 10-bit A/D, CCP, 24-bit SMT and
Zero-Cross Detection offer an excellent solution to the variety of applications. The product family also has a CRC+
memory scan and Windowed WDT to support safety-critical systems in home appliances, white goods and other end
equipment.
Windowed Watchdog
8-bit Timer with HLT
Zero-Cross Detect
Data Sheet Index
CCP/10-bit PWM
10-bit ADC (ch)
Angular Timer
Comparators
16-bit Timer
Data SRAM
24-bit SMT
EUSART
I/O Pins
I2C/SPI
(bytes)
(bytes)
Timer
CWG
CLC
PPS
(kB)
(W)
Device
Note: For other small form-factor package availability and marking information, please visit
PIC16(L)F1615/9
http://www.microchip.com/packaging or contact your local sales office.
DS40001770D-page 3
PIC16(L)F1615/9
TABLE 2: PACKAGES
Packages PDIP SOIC DFN UDFN TSSOP QFN UQFN SSOP
PIC16(L)F1615
PIC16(L)F1619
PIN DIAGRAMS
PIC16(L)F1615
MCLR/VPP/RA3 4 11 RA2
RC5 5 10 RC0
RC4 6 9 RC1
RC3 7 8 RC2
16-pin UQFN
VDD
Vss
NC
NC
16 15 14 13
RA5 1 12 RA0
PI
C
RA4
16
2 11 RA1
(L
RA3/MCLR/VPP
)
3 10 RA2
F1
61
RC5 4 9 RC0
5
5 6 7 8
RC3
RC1
RC4
RC2
VDD 1 20 VSS
RA5 2 19 RA0
RA4 3 18 RA1
MCLR/VPP/RA3 4 17 RA2
PIC16(L)F1619
RC5 5 16 RC0
RC4 6 15 RC1
RC3 7 14 RC2
RC6 8 13 RB4
RC7 9 12 RB5
RB7 10 11 RB6
RA4
RA5
RA0
VDD
Vss
20 19 18 17 16
RA3/MCLR/VPP 1 15 RA1
9
RC5 2 14
61
RA2
RC4 3
F1
13 RC0
L)
RC3 4 12 RC1
(
RC6
16
5 11 RC2
C
PI
6 7 8 9 10
RC7
RB7
RB4
RB6
RB5
Comparator
Reference
Interrupt
EUSART
Pull-up
Timers
MSSP
Basic
PWM
CWG
CCP
SMT
ZCD
CLC
A/D
I/O
PIC16(L)F1615/9
RC4 6 5 — — — T3G(1) — — — CLCIN1(1) CK(1) — ATCC2(1) — — HIC4 IOC Y —
RC5 5 4 — — — T3CKI (1)
CCP1 (1)
— — — RX(1,3) — ATIN(1) — — HIC5 IOC Y —
(1)
ATCC3
VDD 1 16 — — — — — — — — — — — — — — — — VDD
VSS 14 13 — — — — — — — — — — — — — — — — VSS
Comparator
Reference
Interrupt
EUSART
Pull-up
Timers
MSSP
Basic
PWM
CWG
CCP
SMT
ZCD
CLC
A/D
I/O
PIC16(L)F1615/9
C2IN2-
RC3 7 4 AN7 — C1IN3- T5G(1) CCP2(1) — — CLCIN0(1) — — ATCC(1) — — — IOC Y —
C2IN3-
RC4 6 3 — — — T3G(1) — — — CLCIN1(1) — — — — — HIC4 IOC Y —
RC5 5 2 — — — T3CKI(1) CCP1(1) — — — — — ATIN(1) — — HIC5 IOC Y —
RC6 8 5 AN8 — — — — — — — — — — SS(1) — — IOC Y —
DS40001770D-page 7
Comparator
Reference
EUSART
Interrupt
Pull-up
Timers
MSSP
Basic
PWM
CWG
CCP
SMT
ZCD
CLC
A/D
I/O
PIC16(L)F1615/9
DS40001770D-page 8
PIC16(L)F1615/9
TABLE OF CONTENTS
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 Website; 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.
PIC16(L)F1615
PIC16(L)F1619
Figure 1-1, the available peripherals are shown in
Table 1-1, and the pin out descriptions are shown in
Tables 1-2 and 1-3. Peripheral
PIC16(L)F1615/9
Rev. 10-000039H
Program 5/23/2014
Flash Memory
RAM
PORTA
CLKOUT
(4)
/OSC2 Timing PORTB
Generation
CPU
CLKIN/
OSC1 INTRC PORTC
Oscillator
(Note 3)
MCLR
Temp ADC
TMR6 TMR5 TMR4 TMR3 TMR2 TMR1 TMR0 PWM4 PWM3 C2 C1 DAC FVR
Indicator 10-bit
CWG1 SMT2 SMT1 AT PID EUSART MSSP CLC4 CLC3 CLC2 CLC1 Scanner CRC ZCD1 CCP2 CCP1
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
High-Endurance Flash
Program Memory Space Last Program Memory
Device Memory Address
(Words) Address
Range(1)
PIC16(L)F1615/9 8,192 1FFFh 1F80h-1FFFh
Note 1: High-endurance Flash applies to low byte of each address in the range.
Addresses BANKx
x00h or x80h INDF0
x01h or x81h INDF1
x02h or x82h PCL
x03h or x83h STATUS
x04h or x84h FSR0L
x05h or x85h FSR0H
x06h or x86h FSR1L
x07h or x87h FSR1H
x08h or x88h BSR
x09h or x89h WREG
x0Ah or x8Ah PCLATH
x0Bh or x8Bh INTCON
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)F1615/9
96 Bytes 0EFh 36Fh 3EFh
16Fh 1EFh 26Fh 2EFh
0F0h 170h 1F0h 270h 2F0h 370h 3F0h
Common RAM Common RAM Common RAM Common RAM Common RAM Common RAM Common RAM
(Accesses (Accesses (Accesses (Accesses (Accesses (Accesses (Accesses
70h – 7Fh) 70h – 7Fh) 70h – 7Fh) 70h – 7Fh) 70h – 7Fh) 70h – 7Fh) 70h – 7Fh)
07Fh 0FFh 17Fh 1FFh 27Fh 2FFh 37Fh 3FFh
PIC16(L)F1615/9
0EFh 16Fh 1EFh 26Fh 2EFh 36Fh 3EFh
0F0h Common RAM 170h Common RAM 1F0h Common RAM 270h Common RAM 2F0h Common RAM 370h Common RAM 3F0h Common RAM
(Accesses (Accesses (Accesses (Accesses (Accesses (Accesses (Accesses
07Fh 0FFh 70h – 7Fh) 17Fh 70h – 7Fh) 1FFh 70h – 7Fh) 27Fh 70h – 7Fh) 2FFh 70h – 7Fh) 37Fh 70h – 7Fh) 3FFh 70h – 7Fh)
PIC16(L)F1615/9
47Fh 4FFh 57Fh 5FFh 67Fh 6FFh 77Fh 7FFh
PIC16(L)F1615/9
DS40001770D-page 30
TABLE 3-6: PIC16(L)F1615/9 MEMORY MAP, BANK 24-31
2014-2017 Microchip Technology Inc.
PIC16(L)F1615/9
C70h CF0h D70h DF0h E70h EF0h F70h FF0h
Accesses Accesses Accesses Accesses Accesses Accesses Accesses Accesses
70h – 7Fh 70h – 7Fh 70h – 7Fh 70h – 7Fh 70h – 7Fh 70h – 7Fh 70h – 7Fh 70h – 7Fh
CFFh CFFh D7Fh DFFh E7Fh EFFh F7Fh FFFh
Bank 29 Bank 29
E8Ch --- E8Ch ---
E8Dh --- E8Dh ---
E8Eh --- E8Eh ---
E8Fh --- E8Fh ---
E90h RA0PPS E90h RA0PPS
E91h RA1PPS E91h RA1PPS
E92h RA2PPS E92h RA2PPS
E93h — E93h —
E94h RA4PPS E94h RA4PPS
E95h RA5PPS E95h RA5PPS
E96h --- E96h ---
E97h --- E97h ---
E98h --- E98h ---
E99h --- E99h ---
E9Ah --- E9Ah ---
E9Bh --- E9Bh ---
E9Ch --- E9Ch RB4PPS
E9Dh --- E9Dh RB5PPS
E9Eh --- E9Eh RB6PPS
E9Fh --- E9Fh RB7PPS
EA0h RC0PPS EA0h RC0PPS
EA1h RC1PPS EA1h RC1PPS
EA2h RC2PPS EA2h RC2PPS
EA3h RC3PPS EA3h RC3PPS
EA4h RC4PPS EA4h RC4PPS
EA5h RC5PPS EA5h RC5PPS
EA6h
EA6h RC6PPS
—
EA7h RC7PPS
EEFh EA8h
—
EEFh
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’.
PIC16(L)F1615/9
01Fh T2RST — — — — RSEL<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: PIC16F1615/9 only.
2: Unimplemented, read as ‘1’.
3: PIC16(L)F1615 only.
4: PIC16(L)F1619 only.
DS40001770D-page 36
TABLE 3-14: SPECIAL FUNCTION REGISTER SUMMARY (CONTINUED)
2014-2017 Microchip Technology Inc.
PIC16(L)F1615/9
0000 0--- 0000 0---
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented, r = reserved. Shaded locations are unimplemented, read as ‘0’.
Note 1: PIC16F1615/9 only.
2: Unimplemented, read as ‘1’.
3: PIC16(L)F1615 only.
4: PIC16(L)F1619 only.
DS40001770D-page 37
TABLE 3-14: SPECIAL FUNCTION REGISTER SUMMARY (CONTINUED)
2014-2017 Microchip Technology Inc.
PIC16(L)F1615/9
Note 1: PIC16F1615/9 only.
2: Unimplemented, read as ‘1’.
3: PIC16(L)F1615 only.
4: PIC16(L)F1619 only.
DS40001770D-page 38
TABLE 3-14: SPECIAL FUNCTION REGISTER SUMMARY (CONTINUED)
2014-2017 Microchip Technology Inc.
PIC16(L)F1615/9
Note 1: PIC16F1615/9 only.
2: Unimplemented, read as ‘1’.
3: PIC16(L)F1615 only.
4: PIC16(L)F1619 only.
DS40001770D-page 39
TABLE 3-14: SPECIAL FUNCTION REGISTER SUMMARY (CONTINUED)
2014-2017 Microchip Technology Inc.
PIC16(L)F1615/9
DS40001770D-page 40
TABLE 3-14: SPECIAL FUNCTION REGISTER SUMMARY (CONTINUED)
2014-2017 Microchip Technology Inc.
PIC16(L)F1615/9
30Ch SLRCONA — — SLRA5 SLRA4 — SLRA2 SLRA1 SLRA0 --11 -111 --11 -111
30Dh SLRCONB(4) SLRB7 SLRB6 SLRB5 SLRB4 — — — — 1111 ---- 1111 ----
30Eh SLRCONC SLRC7(4) SLRC6(4) SLRC5 SLRC4 SLRC3 SLRC2 SLRC1 SLRC0 1111 1111 1111 1111
30Fh
— — Unimplemented — —
31Fh
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented, r = reserved. Shaded locations are unimplemented, read as ‘0’.
DS40001770D-page 41
PIC16(L)F1615/9
DS40001770D-page 42
TABLE 3-14: SPECIAL FUNCTION REGISTER SUMMARY (CONTINUED)
2014-2017 Microchip Technology Inc.
PIC16(L)F1615/9
3: PIC16(L)F1615 only.
4: PIC16(L)F1619 only.
DS40001770D-page 43
TABLE 3-14: SPECIAL FUNCTION REGISTER SUMMARY (CONTINUED)
2014-2017 Microchip Technology Inc.
PIC16(L)F1615/9
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented, r = reserved. Shaded locations are unimplemented, read as ‘0’.
Note 1: PIC16F1615/9 only.
2: Unimplemented, read as ‘1’.
3: PIC16(L)F1615 only.
4: PIC16(L)F1619 only.
DS40001770D-page 44
TABLE 3-14: SPECIAL FUNCTION REGISTER SUMMARY (CONTINUED)
2014-2017 Microchip Technology Inc.
PIC16(L)F1615/9
Note 1: PIC16F1615/9 only.
2: Unimplemented, read as ‘1’.
3: PIC16(L)F1615 only.
4: PIC16(L)F1619 only.
DS40001770D-page 45
TABLE 3-14: SPECIAL FUNCTION REGISTER SUMMARY (CONTINUED)
2014-2017 Microchip Technology Inc.
PIC16(L)F1615/9
Note 1: PIC16F1615/9 only.
2: Unimplemented, read as ‘1’.
3: PIC16(L)F1615 only.
4: PIC16(L)F1619 only.
DS40001770D-page 46
TABLE 3-14: SPECIAL FUNCTION REGISTER SUMMARY (CONTINUED)
2014-2017 Microchip Technology Inc.
PIC16(L)F1615/9
DS40001770D-page 47
TABLE 3-14: SPECIAL FUNCTION REGISTER SUMMARY (CONTINUED)
2014-2017 Microchip Technology Inc.
PIC16(L)F1615/9
4: PIC16(L)F1619 only.
DS40001770D-page 48
TABLE 3-14: SPECIAL FUNCTION REGISTER SUMMARY (CONTINUED)
2014-2017 Microchip Technology Inc.
PIC16(L)F1615/9
DS40001770D-page 49
TABLE 3-14: SPECIAL FUNCTION REGISTER SUMMARY (CONTINUED)
2014-2017 Microchip Technology Inc.
PIC16(L)F1615/9
Note 1: PIC16F1615/9 only.
2: Unimplemented, read as ‘1’.
3: PIC16(L)F1615 only.
4: PIC16(L)F1619 only.
DS40001770D-page 50
TABLE 3-14: SPECIAL FUNCTION REGISTER SUMMARY (CONTINUED)
2014-2017 Microchip Technology Inc.
PIC16(L)F1615/9
x9Fh
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented, r = reserved. Shaded locations are unimplemented, read as ‘0’.
Note 1: PIC16F1615/9 only.
2: Unimplemented, read as ‘1’.
3: PIC16(L)F1615 only.
4: PIC16(L)F1619 only.
DS40001770D-page 51
TABLE 3-14: SPECIAL FUNCTION REGISTER SUMMARY (CONTINUED)
2014-2017 Microchip Technology Inc.
PIC16(L)F1615/9
D9Eh SMT2TMRL SMT2TMR<7:0> 0000 0000 0000 0000
D9Fh SMT2TMRH SMT2TMR<15:8> 0000 0000 0000 0000
DA0h SMT2TMRU SMT2TMR<23:16> 0000 0000 0000 0000
DA1h SMT2CPRL SMT2CPR<7:0> xxxx xxxx xxxx xxxx
DA2h SMT2CPRH SMT2CPR<15:8> xxxx xxxx xxxx xxxx
DS40001770D-page 52
PIC16(L)F1615/9
DS40001770D-page 53
TABLE 3-14: SPECIAL FUNCTION REGISTER SUMMARY (CONTINUED)
2014-2017 Microchip Technology Inc.
PIC16(L)F1615/9
E20h SSPCLKPPS(4) — — — SSPCLKPPS<4:0> ---1 0000 ---0 1110
(3)
E21h SSPDATPPS — — — SSPDATPPS<4:0> ---1 0001 ---1 0001
E21h SSPDATPPS(4) — — — SSPDATPPS<4:0> ---1 0001 ---0 1100
E22h SSPSSPPS(3) — — — SSPSSPPS<4:0> ---1 0011 ---1 0011
E22h SSPSSPPS(4) — — — SSPSSPPS<4:0> ---1 0110 ---1 0110
DS40001770D-page 54
PIC16(L)F1615/9
DS40001770D-page 55
TABLE 3-14: SPECIAL FUNCTION REGISTER SUMMARY (CONTINUED)
2014-2017 Microchip Technology Inc.
PIC16(L)F1615/9
---0 0000 ---0 0000
EA6h RC6PPS(4) — — — RC6PPS<4:0> ---0 0000 ---0 0000
EA7h RC7PPS(4) — — — RC7PPS<4:0> ---0 0000 ---0 0000
EA8h — Unimplemented — —
to
EEFh
DS40001770D-page 56
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented, r = reserved. Shaded locations are unimplemented, read as ‘0’.
Note 1: PIC16F1615/9 only.
2: Unimplemented, read as ‘1’.
3: PIC16(L)F1615 only.
4: PIC16(L)F1619 only.
TABLE 3-14: SPECIAL FUNCTION REGISTER SUMMARY (CONTINUED)
2014-2017 Microchip Technology Inc.
PIC16(L)F1615/9
F21h CLC2GLS1 LC2G2D4T LC2G2D4N LC2G2D3T LC2G2D3N LC2G2D2T LC2G2D2N LC2G2D1T LC2G2D1N xxxx xxxx xxxx xxxx
F22h CLC2GLS2 LC2G3D4T LC2G3D4N LC2G3D3T LC2G3D3N LC2G3D2T LC2G3D2N LC2G3D1T LC2G3D1N xxxx xxxx xxxx xxxx
F23h CLC2GLS3 LC2G4D4T LC2G4D4N LC2G4D3T LC2G4D3N LC2G4D2T LC2G4D2N LC2G4D1T LC2G4D1N xxxx xxxx xxxx xxxx
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented, r = reserved. Shaded locations are unimplemented, read as ‘0’.
Note 1: PIC16F1615/9 only.
2: Unimplemented, read as ‘1’.
DS40001770D-page 57
3: PIC16(L)F1615 only.
4: PIC16(L)F1619 only.
TABLE 3-14: SPECIAL FUNCTION REGISTER SUMMARY (CONTINUED)
2014-2017 Microchip Technology Inc.
PIC16(L)F1615/9
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: PIC16F1615/9 only.
2: Unimplemented, read as ‘1’.
3: PIC16(L)F1615 only.
DS40001770D-page 58
4: PIC16(L)F1619 only.
PIC16(L)F1615/9
TABLE 3-14: SPECIAL FUNCTION REGISTER SUMMARY (CONTINUED)
Addr Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 B
Bank 31
F8Ch — Unimplemented
—
FE3h
FE4h STATUS_ — — — — — Z_SHAD DC_SHAD C_
SHAD
FE5h WREG_ Working Register Shadow
SHAD
FE6h BSR_ — — — Bank Select Register Shadow
SHAD
FE7h PCLATH_ — Program Counter Latch High Register Shadow
SHAD
FE8h FSR0L_ Indirect Data Memory Address 0 Low Pointer Shadow
SHAD
FE9h FSR0H_ Indirect Data Memory Address 0 High Pointer Shadow
SHAD
FEAh FSR1L_ Indirect Data Memory Address 1 Low Pointer Shadow
SHAD
FEBh FSR1H_ Indirect Data Memory Address 1 High Pointer Shadow
SHAD
FECh — Unimplemented
FEDh STKPTR — — — Current Stack Pointer
FEEh TOSL Top-of-Stack Low byte
FEFh TOSH — Top-of-Stack High byte
Legend: x = unknown, u = unchanged, q = value depends on condition, - = unimplemented, r = reserved. Shaded locations are unimplemented,
Note 1: PIC16F1615/9 only.
2: Unimplemented, read as ‘1’.
3: PIC16(L)F1615 only.
4: PIC16(L)F1619 only.
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
0x0EF Program
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: Enabling Brown-out Reset does not automatically enable Power-up Timer.
2: 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’.
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
WDTPS at POR
Software
WDTCPS Typical control of
<4:0> Value Divider Ratio time out WDTPS
(FIN = 31 kHz)
Default
11111 01011 1:65536 216 2s Yes
fuse = 11111
10011 10011
... ... 1:32 25 1 ms No
11110 11110
10010 10010 1:8388608 223 256 s
10001 10001 1:4194304 222 128 s
10000 10000 1:2097152 221 64 s
01111 01111 1:1048576 220 32 s
01110 01110 1:524299 219 16 s
01101 01101 1:262144 218 8s
01100 01100 1:131072 217 4s
01011 01011 1:65536 216 2s
01010 01010 1:32768 215 1s
01001 01001 1:16384 214 512 ms No
01000 01000 1:8192 213 256 ms
00111 00111 1:4096 212 128 ms
00110 00110 1:2048 211 64 ms
00101 00101 1:1024 210 32 ms
00100 00100 1:512 29 16 ms
00011 00011 1:256 28 8 ms
00010 00010 1:128 27 4 ms
00001 00001 1:64 26 2 ms
00000 00000 1:32 25 1 ms
Note 1: A window delay of 12.5% is only available in Software Control mode via the WDTCON1 register.
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)F1612/16(L)F161X
Memory Programming Specification” (DS40001720).
R R R R R R R R
DEV<7:0>
bit 7 bit 0
Legend:
R = Readable bit
‘1’ = Bit is set ‘0’ = Bit is cleared
R R R R R R R R
REV<7:0>
bit 7 bit 0
Legend:
R = Readable bit
‘1’ = Bit is set ‘0’ = Bit is cleared
Rev. 10-000155C
1/21/2015
FOSC<2:0>
CLKIN/ OSC1
3 Sleep
Primary
Oscillator
(OSC) 0 FOSC(1)
00
4x PLL(2) 1 to CPU and
Peripherals
CLKOUT/
OSC2 PLLEN
SPLLEN
INTOSC
1x
16 MHz
8 MHz
4 MHz 2
16 MHz
*500 kHz
31 kHz LFINTOSC(1)
to WDT, PWRT, and
Oscillator other Peripherals
to Peripherals
600 kHz FRC(1) to ADC and
Oscillator other Peripherals
C1 To Internal
5.2.1.1 EC Mode Logic
Quartz
The External Clock (EC) mode allows an externally
Crystal RF(2) Sleep
generated logic level signal to be the system clock
source. When operating in this mode, an external clock
source is connected to the CLKIN input. CLKOUT is C2 RS(1)
OSC2/CLKOUT
available for general purpose I/O or CLKOUT. Figure 5-2
shows the pin connections for EC mode.
Note 1: A series resistor (Rs) may be required for
EC mode has three power modes to select from through quartz crystals with low drive level.
the FOSC bits in the Configuration Words:
2: The value of RF varies with the Oscillator mode
• ECH – High power, 4-20 MHz selected (typically between 2 MΩ and 10 MΩ).
• ECM – Medium power, 0.5-4 MHz
• ECL – Low power, 0-0.5 MHz
C1 To Internal
Logic
OSC2/CLKOUT
C2 RS(1)
When the OSCTUNE register is modified, the oscillator The postscaler outputs of the 16 MHz HFINTOSC, 500
frequency will begin shifting to the new frequency. Code kHz MFINTOSC, and 31 kHz LFINTOSC output
execution continues during this shift. There is no connect to a multiplexer (see Figure 5-1). The Internal
indication that the shift has occurred. Oscillator Frequency Select bits IRCF<3:0> of the
OSCCON register select the frequency output of the
OSCTUNE does not affect the LFINTOSC frequency. internal oscillators. One of the following frequencies
Operation of features that depend on the LFINTOSC can be selected via software:
clock source frequency, such as the Power-up Timer
(PWRT), Watchdog Timer (WDT), and peripherals, are - 16 MHz
not affected by the change in frequency. - 8 MHz
- 4 MHz
5.2.2.4 LFINTOSC - 2 MHz
The Low-Frequency Internal Oscillator (LFINTOSC) is - 1 MHz
an uncalibrated 31 kHz internal clock source. - 500 kHz (default after Reset)
The output of the LFINTOSC connects to a multiplexer - 250 kHz
(see Figure 5-1). Select 31 kHz, via software, using the - 125 kHz
IRCF<3:0> bits of the OSCCON register. See
- 62.5 kHz
Section5.2.2.8 “Internal Oscillator Clock Switch
Timing” for more information. The LFINTOSC is also - 31.25 kHz
the frequency for the Power-up Timer (PWRT), - 31 kHz (LFINTOSC)
Watchdog Timer (WDT) and Fail-Safe Clock Monitor Note: Following any Reset, the IRCF<3:0> bits
(FSCM). of the OSCCON register are set to ‘0111’
The LFINTOSC is enabled by selecting 31 kHz and the frequency selection is set to
(IRCF<3:0> bits of the OSCCON register = 000) as the 500 kHz. The user can modify the IRCF
system clock source (SCS bits of the OSCCON bits to select a different frequency.
register = 1x), or when any of the following are The IRCF<3:0> bits of the OSCCON register allow
enabled: duplicate selections for some frequencies. These dupli-
• Configure the IRCF<3:0> bits of the OSCCON cate choices can offer system design trade-offs. Lower
register for the desired LF frequency, and power consumption can be obtained when changing
• FOSC<1:0> = 00, or oscillator sources for a given frequency. Faster transi-
• Set the System Clock Source (SCS) bits of the tion times can be obtained between frequency changes
OSCCON register to ‘1x’ that use the same oscillator source.
LFINTOSC
System Clock
LFINTOSC
System Clock
LFINTOSC HFINTOSC/MFINTOSC
LFINTOSC turns off unless WDT is enabled
LFINTOSC
Start-up Time 2-cycle Sync Running
HFINTOSC/
MFINTOSC
IRCF <3:0> =0 0
System Clock
INTOSC
TOST
OSC2
Program Counter PC - N PC PC + 1
System Clock
Sample Clock
System Oscillator
Clock Failure
Output
Note: The system clock is normally at a much higher frequency than the sample clock. The relative frequencies in
this example have been chosen for clarity.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared q = Conditional
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Stack Underflow
Stack Overflow
WDT
Time-out WDT Device
Window Reset
Violation
Power-on
Reset
VDD BOR Active(1)
R
Brown-out Power-up
Reset Timer
LFINTOSC PWRTE
LPBOR
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)
TPWRT
Note 1: delay only if PWRTE bit is programmed to ‘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 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
Note 1: Bit PEIE of the INTCON register must be set to enable any peripheral interrupt.
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
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) can
utilize the HFINTOSC oscillator as either a clock
8.2.1 SLEEP CURRENT VS. WAKE-UP source or as an input source. Under certain condi-
TIME tions, when the HFINTOSC is selected for use with the
CWG modules, the HFINTOSC will remain active
In the Default Operating mode, the LDO and reference during Sleep. This will have a direct effect on the
circuitry remain in the normal configuration while in Sleep mode current.
Sleep. The device is able to exit Sleep mode quickly
since all circuits remain active. In Low-Power Sleep Please refer to sections Section 28.11 “Operation
mode, when waking up from Sleep, an extra delay time During Sleep” for more information.
is required for these circuits to return to the normal con-
figuration and stabilize.
Note: The PIC16LF1615/9 does not have a con-
The Low-Power Sleep mode is beneficial for applica- figurable Low-Power Sleep mode.
tions that stay in Sleep mode for long periods of time. PIC16LF1615/9 is an unregulated device
The Normal mode is beneficial for applications that and is always in the lowest power state
need to wake from Sleep quickly and frequently. when in Sleep, with no wake-up time pen-
alty. This device has a lower maximum
VDD and I/O voltage than the
PIC16F1615/9. See Section
35.0 “Electrical Specifications” 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
WWDT
Armed
WDT
Window
Violation
Window Closed
Window
Comparator
CLRWDT Sizes
WINDOW
RESET
Reserved 111
Reserved 110
Reserved 101
R
Reserved 100 18-bit Prescale
Reserved 011 Counter
E
626& 010
MFINTOSC/16 001
LFINTOSC 000
CS
PS
R
5-bit Overflow
WDT Time-out
WDT Counter Latch
WDTE<1:0> = 01
SEN
WDTE<1:0> = 11
WDTE<1:0> = 10
Sleep
WDT protection is unchanged by Sleep. See Table 9-1 9.5.1 CLRWDT CONSIDERATIONS
for more details. (WINDOWED MODE)
TABLE 9-1: WDT OPERATING MODES When in Windowed mode, the WDT must be armed
before a CLRWDT instruction will clear the timer. This is
Device WDT performed by reading the WDTCON0 register. Execut-
WDTE<1:0> SEN
Mode Mode ing a CLRWDT instruction without performing such an
arming action will trigger a window violation.
11 X X Active
See Table 9-2 for more information.
Awake Active
10 X
Sleep Disabled 9.6 Operation During Sleep
1 X Active When the device enters Sleep, the WDT is cleared. If
01 the WDT is enabled during Sleep, the WDT resumes
0 X Disabled
counting. When the device exits Sleep, the WDT is
00 X X Disabled cleared again.
The WDT remains clear until the OST, if enabled, com-
9.3 Time-Out Period pletes. See Section5.0 “Oscillator Module” for more
information on the OST.
The WDTPS bits of the WDTCON0 register set the
time-out period from 1 ms to 256 seconds (nominal). When a WDT time-out occurs while the device is in
After a Reset, the default time-out period is two Sleep, no Reset is generated. Instead, the device
seconds. wakes up and resumes operation. The TO and PD bits
in the STATUS register are changed to indicate the
event. The RWDT bit in the PCON register can also be
used. See Section3.0 “Memory Organization” for
more information.
Rev. 10-000163A
8/15/2016
CLRWDT Instruction
(or other WDT Reset)
Window Period
Time-out Event
Window Delay
(window violation can occur)
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
Note 1: If WDTCCS <2:0> in CONFIG3 = 111, the Reset value of WDTCS<2:0> is 000.
2: The Reset value of WINDOW<2:0> is determined by the value of WDTCWS<2:0> in the CONFIG3 register.
3: If WDTCCS<2:0> in CONFIG3 ≠ 111, these bits are read-only.
4: If WDTCWS<2:0> in CONFIG3 ≠ 111, these bits are read-only.
REGISTER 9-3: WDTPSL: WDT PRESCALE SELECT LOW BYTE REGISTER (READ ONLY)
R-0/0 R-0/0 R-0/0 R-0/0 R-0/0 R-0/0 R-0/0 R-0/0
(1)
PSCNT<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
Note 1: The 18-bit WDT prescale value, PSCNT<17:0> includes the WDTPSL, WDTPSH and the lower bits of the WDTTMR
registers. PSCNT<17:0> is intended for debug operations and should be read during normal operation.
REGISTER 9-4: WDTPSH: WDT PRESCALE SELECT HIGH BYTE REGISTER (READ ONLY)
R-0/0 R-0/0 R-0/0 R-0/0 R-0/0 R-0/0 R-0/0 R-0/0
PSCNT<15:8>(1)
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
Note 1: The 18-bit WDT prescale value, PSCNT<17:0> includes the WDTPSL, WDTPSH and the lower bits of the WDTTMR
registers. PSCNT<17:0> is intended for debug operations and should be read during normal operation.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Note 1: The 18-bit WDT prescale value, PSCNT<17:0> includes the WDTPSL, WDTPSH and the lower bits of the WDTTMR
registers. PSCNT<17:0> is intended for debug operations and should be read during normal operation.
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 AAh ;
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
Rev. 10-000004D
7 6 0 7 4 3 0 7 5 0 7 0 7/21/2014
14
Write Latch #0 Write Latch #1 Write Latch #30 Write Latch #31
00h 01h 1Eh 1Fh
PMADRL<3:0>
14 14 14 14
PIC16(L)F1615/9
7FEh 7FE0h 7FE1h 7FDEh 7FDFh
Row 7FFh 7FF0h 7FF1h 7FFEh 7FFFh
Address
PMADRH<6:0>: Decode Flash Program Memory
PMADRL<7:4>
DS40001770D-page 127
800h 8000h - 8003h 8004h 8005h 8006h 8007h – 8009h 800Ah - 801Fh
MASK/ DEVICE ID Configuration
USER ID 0 - 3 reserved reserved
CFGS = 1 REV ID Words
Configuration Memory
PIC16(L)F1615/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
MOVLW AAh ;
Required
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/8005h Device ID/Revision ID Yes No
8007h-8009h Configuration Words 1, 2, and 3 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
CRC-16-ANSI
The Cyclic Redundancy Check (CRC) module provides x16 + x15 + x2 + 1 (17 bits)
a software-configurable hardware-implemented CRC
checksum generator. This module includes the following Standard 16-bit representation = 0x8005
features: CRCXORH = 0b10000000
CRCXORL = 0b0000010- (1)
x16 + x15 + x2 + 1
Data in
Augmentation Mode ON
Data in
Augmentation Mode OFF
11.4.2 CRC FROM FLASH • Write the saved CRCACC value to the CRCDAT input
To use the CRC module on data located in Flash The properly oriented check value will be in the
memory, the user can initialize the Program Memory CRCACC registers as the result.
Scanner as defined in Section 11.8, Program Mem-
ory Scan Configuration. 11.6 CRC Interrupt
The CRC will generate an interrupt when the BUSY bit
transitions from 1 to 0. The CRCIF interrupt flag bit of the
PIR4 register is set every time the BUSY bit transitions,
regardless of whether or not the CRC interrupt is enabled.
The CRCIF bit can only be cleared in software. The CRC
interrupt enable is the CRCIE bit of the PIE4 register.
In general, if INTM = 0, the scanner will take prece- response latency. If INTM = 1, the interrupt will take
dence over the interrupt, resulting in decreased inter- precedence and have a better speed, delaying the
rupt processing speed and/or increased interrupt memory scan.
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
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 HC = Bit is cleared by hardware
Note 1: Setting EN = 0 (SCANCON0 register) does not affect any other register content.
2: This bit is cleared when LADR > HADR (and a data cycle is not occurring).
3: If INTM = 1, this bit is overridden (to zero, but not cleared) during an interrupt response.
4: BUSY = 1 when the NVM is being accessed, or when the CRC sends a ready signal.
5: See Table 11-1 for more detailed information.
6: An invalid address happens when the entire range of the PFM is scanned and completed, i.e., device
memory is 0x4000 and SCANHADR = 0x3FFF, after the last scan SCANLADR increments to 0x4000, the
address is invalid.
LADR<15:8>(1, 2)
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
HADR<15:8>(1, 2)
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
DEVICE
PORTA
PORTB
PORTC
Device
PIC16(L)F1619 ● ● ●
PIC16(L)F1615 ● ●
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 12-1.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
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
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 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
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
bit 7-6 ANSC<7:6>: Analog Select between Analog or Digital Function on Pins RC<7:6>, respectively(1)
1 = Analog input. Pin is assigned as analog input(2). 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(2). Digital input buffer disabled.
0 = Digital I/O. Pin is assigned to port or digital special function.
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
abcPPS RA0
RA0
Peripheral abc
RxyPPS
Rxy
Peripheral xyz
RC7 RC7PPS
xyzPPS RC7
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 peripheral
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
IOCANx D Q
R Q4Q1
edge
detect
RAx
to data bus
data bus = S
IOCAFx
IOCAPx D Q
0 or 1
D Q
R
write IOCAFx
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
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
2
ADFVR<1:0>
1x
FVR_buffer1
2x
4x (To ADC Module)
2
CDAFVR<1:0>
1x FVR_buffer2
2x (To Comparators
4x and DAC)
FVREN
+
_ FVRRDY
Note 1
Note 1: Any peripheral requiring the Fixed Reference (See Table 15-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 clear-
ing the Buffer Gain Selection bits.
2: FVRRDY is always ‘1’ for the PIC16LF1615/9 devices.
3: See Section16.0 “Temperature Indicator Module” for additional information.
4: Fixed Voltage Reference output cannot exceed VDD.
TABLE 15-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> 186
Legend: Shaded cells are unused by the Fixed Voltage Reference module.
FVR_buffer1 11 Positive
VREF+ pin Reference
10 Select
Reserved 01
00
VDD
VSS ADCS<2:0>
AN0
ANa Vref- Vref+
External .
Channel . FOSC/n Fosc
. Divider FOSC
Inputs ADC
ANz ADC_clk
sampled Clock
VSS 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 1: The FRC source has a typical TAD time of 1.7 us.
2: When the device frequency is greater than 1 MHz, the FRC clock source is only recommended if the
conversion will be performed during Sleep.
3: 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.
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)
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 SectionTABLE 35-13: “Analog-to-Digital Converter (ADC)
Characteristics(1,2,3)” 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
V AP P LI ED 1 – -------------------------- = V CHOLD
1
;[1] VCHOLD charged to within 1/2 lsb
n+1
2 –1
–TC
----------
RC
V AP P LI ED 1 – e = V CHOLD ;[2] VCHOLD charge response to VAPPLIED
– Tc
---------
V AP P LI ED 1 – e = V A PP LIE D 1 – -------------------------- ;combining [1] and [2]
RC 1
n+1
2 –1
T C = – C HOLD R IC + R SS + R S ln(1/2047)
= – 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.
Rev. 10-000070A
8/23/2016
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
RS = Source Resistance (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 00
VREF+ 01 VSOURCE+
FVR_buffer2 10 DACR<7:0>
8
Reserved 11 R
DACPSS R
DACEN R
32-to-1 MUX
32 DACx_output
To Peripherals
Steps
R DACxOUT1 (1)
DACOE1
R
VSOURCE-
VSS
PIC® MCU
DAC
R
Module
+
Voltage DACXOUT1 Buffered DAC Output
–
Reference
Output
Impedance
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
3
CxNCH<2:0> CxON(1)
Interrupt CxINTP
Rising
Edge set bit
CxIN0- 000 CxIF
Interrupt CxINTN
CxIN1- 001
Falling
CxIN2- 010 CxON(1) Edge
CxOUT_sync to
peripherals
CxSYNC
CxIN+ 00
TRIS bit
DAC_output 01 0
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
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
VCPINV
optional
VDD RPULLUP
- ZCDxIN RSERIES
External
Zcpinv + RPULLDOWN voltage
source
optional
ZCDx_output
D Q OUT bit
POL
Q1
Interrupt
det
INTP Set
ZCDIF
INTN flag
Interrupt
det
asin ------------------
Vcpinv
2 2
R = Z – XC V PEAK
T OFFSET = ----------------------------------
–4 2 Freq
V C = X C 3 10
When External Voltage Source is relative to VDD:
= Tan -------
–1 X C
R
asin --------------------------------
V DD – Vcpinv
T = ---------
2f V PEAK
T OFFSET = -------------------------------------------------
2 Freq
EXAMPLE 20-1: R-C CALCULATIONS
This offset time can be compensated for by adding a
VRMS = 120
pull-up or pull-down biasing resistor to the ZCD pin. A
VPEAK = VRMS *= 169.7
pull-up resistor is used when the external voltage
f = 60 Hz
source is varying relative to VSS. A pull-down resistor is
C = 0.1 µF used when the voltage is varying relative to VDD. The
V PEAK 169.7 resistor adds a bias to the ZCD pin so that the target
Z = -------------------
–4
- = 565.7k
- = -------------------
–4 external voltage source must go to zero to pull the pin
3 10 3 10 voltage to the VCPINV switching voltage. The pull-up or
pull-down value can be determined with the equations
1 1
- = 26.53k
X C = ------------- = -------------------------------------------------
–7
shown in Equation 20-4 or Equation 20-5.
2fC 2 60 1 10
EQUATION 20-4: ZCD PULL-UP/DOWN
2 2
R = Z X C = 565.1k computed When External Signal is relative to Vss:
V MAXPEAK + V MINPEAK
R SERIES = ---------------------------------------------------------
–4
7 10
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 configuration bits
• 8-bit timer/counter register (TMR0) 8-Bit Counter mode using the T0CKI pin is selected by
setting the TMR0CS bit in the OPTION_REG register to
• 3-bit prescaler (independent of Watchdog Timer)
‘1’.
• Programmable internal or external clock source
The rising or falling transition of the incrementing edge
• Programmable external clock edge selection
for either input source is determined by the TMR0SE bit
• Interrupt on overflow in the OPTION_REG register.
• TMR0 can be used to gate Timer1
Figure 21-1 is a block diagram of the Timer0 module.
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
T1GPPS
T1GSPM
PPS 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>
LFINTOSC 11
(1)
T1CKI PPS 10 Prescaler
Fosc Synchronize(3)
01 1,2,4,8
Internal Clock det
00
2
T1CKIPPS Fosc/4 Fosc/2
Internal Clock T1CKPS<1:0> Internal Sleep
Clock Input
22.4.1 READING AND WRITING TIMER1 IN T1CLK T1GPOL T1G Timer1 Operation
ASYNCHRONOUS COUNTER 0 0 Counts
MODE 0 1 Holds Count
Reading TMR1H or TMR1L while the timer is running 1 0 Holds Count
from an external asynchronous clock will ensure a valid 1 1 Counts
read (taken care of in hardware). However, the user
should keep in mind that reading the 16-bit timer in two 22.5.2 TIMER1 GATE SOURCE
8-bit values itself, poses certain problems, since the
SELECTION
timer may overflow between the reads.
Timer1 gate source selections are shown in Table 22-4.
Source selection is controlled by the T1GSS<1:0> bits
of the T1GCON register. The polarity for each available
source is also selectable. Polarity selection is controlled
by the T1GPOL bit of the T1GCON register.
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
TxINPPS
TxIN PPS
MODE<4:0> MODE<3>
enable MODE<4:3>=01
Clear ON
MODE<4:1>=1011 D Q
CKPOL
TMRx_clk Pre scaler 0
R
TMRx
Set flag bi t
3 Sync 1 TMRxIF
4
ON Sync
(2 Clocks)
1
PRx OUTPS<3:0>
0
CKSYNC
CKPS 0b010
PRx 1
OUTPS 0b0001
TMRx_clk
TMRx 0 1 0 1 0 1 0
TMRx_postscaled
Note 1: Setting the interrupt flag is synchronized with the instruction clock.
Synchronization may take as many as 2 instruction cycles
2: Cleared by software.
MODE 0b00000
TMRx_clk
ON
PRx 5
TMRx 0 1 2 3 4 5 0 1 2 3 4 5 0 1 2 3 4 5 0 1
TMRx_postscaled
PWM Duty
3
Cycle
PWM Output
Note 1: BSF and BCF represent Bit-Set File and Bit-Clear File instructions executed by the CPU to
set or clear the ON bit of TxCON. CPU execution is asynchronous to the timer clock input.
MODE 0b00001
TMRx_clk
TMRx_ers
PRx 5
TMRx 0 1 2 3 4 5 0 1 2 3 4 5 0 1
TMRx_postscaled
PWM Duty
3
Cycle
PWM Output
MODE 0b00100
TMRx_clk
PRx 5
ON
TMRx_ers
TMRx 0 1 2 0 1 2 3 4 5 0 1 2 3 4 5 0 1
TMRx_postscaled
PWM Duty
3
Cycle
PWM Output
Note 1: BSF and BCF represent Bit-Set File and Bit-Clear File instructions executed by the CPU to
set or clear the ON bit of TxCON. CPU execution is asynchronous to the timer clock input.
MODE 0b00111
TMRx_clk
PRx 5
ON
TMRx_ers
TMRx 0 1 2 0 1 2 3 4 5 0 0 1 2 3 4 5 0
TMRx_postscaled
PWM Duty
3
Cycle
PWM Output
Note 1: BSF and BCF represent Bit-Set File and Bit-Clear File instructions executed by the CPU to
set or clear the ON bit of TxCON. CPU execution is asynchronous to the timer clock input.
FIGURE 23-8: SOFTWARE START ONE-SHOT MODE TIMING DIAGRAM (MODE = 01000)
Rev. 10-000199B
4/7/2016
MODE 0b01000
TMRx_clk
PRx 5
ON
TMRx 0 1 2 3 4 5 0 1 2 3 4 5 0
TMRx_postscaled
PWM Duty
3
Cycle
PWM Output
Note 1: BSF and BCF represent Bit-Set File and Bit-Clear File instructions
executed by the CPU to set or clear the ON bit of TxCON. CPU
execution is asynchronous to the timer clock input.
MODE 0b01001
TMRx_clk
PRx 5
ON
TMRx_ers
TMRx 0 1 2 3 4 5 0 1 2
CCP_pset
TMRx_postscaled
PWM Duty
3
Cycle
PWM Output
Note 1: BSF and BCF represent Bit-Set File and Bit-Clear File instructions executed by the CPU to
set or clear the ON bit of TxCON. CPU execution is asynchronous to the timer clock input.
Rev. 10-000201B
4/7/2016
MODE 0b01100
TMRx_clk
PRx 5
ON
TMRx_ers
TMRx 0 1 2 3 4 5 0 1 2 0 1 2 3 4 5 0
TMRx_postscaled
PWM Duty
3
Cycle
PWM Output
Note 1: BSF and BCF represent Bit-Set File and Bit-Clear File instructions executed by the CPU to
set or clear the ON bit of TxCON. CPU execution is asynchronous to the timer clock input.
PIC16(L)F1615/9
DS40001770D-page 247
PIC16(L)F1615/9
23.6.8 LEVEL RESET, EDGE-TRIGGERED
HARDWARE LIMIT ONE-SHOT
MODES
In Level -Triggered One-Shot mode the timer count is
reset on the external signal level and starts counting
on the rising/falling edge of the transition from Reset
level to the active level while the ON bit is set. Reset
levels are selected as follows:
• Low Reset level (MODE<4:0> = 01110)
• High Reset level (MODE<4:0> = 01111)
When the timer count matches the PRx period count,
the timer is reset and the ON bit is cleared. When the
ON bit is cleared by either a PRx match or by software
control a new external signal edge is required after the
ON bit is set to start the counter.
When Level-Triggered Reset One-Shot mode is used
in conjunction with the CCP PWM operation the PWM
drive goes active with the external signal edge that
starts the timer. The PWM drive goes inactive when the
timer count equals the CCPRx pulse width count. The
PWM drive does not go active when the timer count
clears at the PRx period count match.
Rev. 10-000202B
4/7/2016
MODE 0b01110
TMRx_clk
PRx 5
ON
TMRx_ers
TMRx 0 1 2 3 4 5 0 1 0 1 2 3 4 5 0
TMRx_postscaled
PWM Duty
3
Cycle
PWM Output
Note 1: BSF and BCF represent Bit-Set File and Bit-Clear File instructions executed by the CPU to
set or clear the ON bit of TxCON. CPU execution is asynchronous to the timer clock input.
PIC16(L)F1615/9
DS40001770D-page 249
PIC16(L)F1615/9
23.6.9 EDGE-TRIGGERED MONOSTABLE
MODES
The Edge-Triggered Monostable modes start the timer
on an edge from the external Reset signal input, after
the ON bit is set, and stop incrementing the timer when
the timer matches the PRx period value. The following
edges will start the timer:
• Rising edge (MODE<4:0> = 10001)
• Falling edge (MODE<4:0> = 10010)
• Rising or Falling edge (MODE<4:0> = 10011)
When an Edge-Triggered Monostable mode is used in
conjunction with the CCP PWM operation the PWM
drive goes active with the external Reset signal edge
that starts the timer, but will not go active when the
timer matches the PRx value. While the timer is incre-
menting, additional edges on the external Reset signal
will not affect the CCP PWM.
Rev. 10-000203A
4/7/2016
MODE 0b10001
TMRx_clk
PRx 5
ON
TMRx_ers
TMRx 0 1 2 3 4 5 0 1 2 3 4 5 0 1 2 3 4 5 0
TMRx_postscaled
PWM Duty
3
Cycle
PWM Output
Note 1: BSF and BCF represent Bit-Set File and Bit-Clear File instructions executed by the CPU to
set or clear the ON bit of TxCON. CPU execution is asynchronous to the timer clock input.
PIC16(L)F1615/9
DS40001770D-page 251
PIC16(L)F1615/9
23.6.10 LEVEL-TRIGGERED HARDWARE
LIMIT ONE-SHOT MODES
The Level-Triggered Hardware Limit One-Shot modes
hold the timer in Reset on an external Reset level and
start counting when both the ON bit is set and the exter-
nal signal is not at the Reset level. If one of either the
external signal is not in Reset or the ON bit is set then
the other signal being set/made active will start the
timer. Reset levels are selected as follows:
• Low Reset level (MODE<4:0> = 10110)
• High Reset level (MODE<4:0> = 10111)
When the timer count matches the PRx period count,
the timer is reset and the ON bit is cleared. When the
ON bit is cleared by either a PRx match or by software
control the timer will stay in Reset until both the ON bit
is set and the external signal is not at the Reset level.
When Level-Triggered Hardware Limit One-Shot
modes are used in conjunction with the CCP PWM
operation the PWM drive goes active with either the
external signal edge or the setting of the ON bit, which-
ever of the two starts the timer.
Rev. 10-000204A
4/7/2016
MODE 0b10110
TMR2_clk
PRx 5
ON
TMR2_ers
TMRx 0 1 2 3 4 5 0 1 2 3 0 1 2 3 4 5 0
TMR2_postscaled
PWM Duty
‘D3
Cycle
PWM Output
Note 1: BSF and BCF represent Bit-Set File and Bit-Clear File instructions executed by the CPU to
set or clear the ON bit of TxCON. CPU execution is asynchronous to the timer clock input.
PIC16(L)F1615/9
DS40001770D-page 253
PIC16(L)F1615/9
23.7 Timer2 Operation During Sleep
When PSYNC = 1, Timer2 cannot be operated while
the processor is in Sleep mode. The contents of the
TMR2 and T2PR registers will remain unchanged while
processor is in Sleep mode.
When PSYNC = 0, Timer2 will operate in Sleep as long
as the clock source selected is also still running.
Selecting the LFINTOSC, MFINTOSC, or HFINTOSC
oscillator as the timer clock source will keep the
selected oscillator running during Sleep.
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
Note 1: In certain modes, the ON bit will be auto-cleared by hardware. See Section 23.6 “Operation Examples”.
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: Setting this bit ensures that reading TMRx will return a valid value.
2: When this bit is ‘1’, Timer2 cannot operate in Sleep mode.
3: CKPOL should not be changed while ON = 1.
4: Setting this bit ensures glitch-free operation when the ON is enabled or disabled.
5: When this bit is set then the timer operation will be delayed by two TMRx input clocks after the ON bit is set.
6: Unless otherwise indicated, all modes start upon ON = 1 and stop upon ON = 0 (stops occur without affecting the value
of TMRx).
7: When TMRx = PRx, the next clock clears TMRx, regardless of the operating mode.
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
Data Bus
Read Write
SSPxBUF Reg
SSPDATPPS
SDI
PPS SSPSR Reg
SDO bit 0 Shift
Clock
PPS
RxyPPS
Edge
SSPSSPPS Select
SSPCLKPPS(2) SSPM<3:0>
SCK PPS
4
( T2_match
2
)
Edge Prescaler TOSC
PPS Select 4, 16, 64
Internal
data bus [SSPM<3:0>]
SSPDATPPS(1) Read Write
SDA
SDA in
PPS SSPxBUF Baud Rate
Generator
(SSPxADD)
Shift
RxyPPS(1) Clock
PPS
PPS
Note 1: SDA pin selections must be the same for input and output.
2: SCL pin selections must be the same for input and output.
Internal
Data Bus
Read Write
SSPxMSK Reg
SSPDATPPS(1)
SDA Match Detect Addr Match
PPS
SSPxADD Reg
PPS
Start and Set, Reset
RxyPPS(1) Stop bit Detect S, P bits
(SSPxSTAT Reg)
Note 1: SDA pin selections must be the same for input and output.
2: SCL pin selections must be the same for input and output.
• Serial Clock (SCK) Whether the data is meaningful or not (dummy data),
depends on the application software. This leads to
• Serial Data Out (SDO)
three scenarios for data transmission:
• Serial Data In (SDI)
• Master sends useful data and slave sends dummy
• Slave Select (SS)
data.
Figure 24-1 shows the block diagram of the MSSP • Master sends useful data and slave sends useful
module when operating in SPI mode. data.
The SPI bus operates with a single master device and • Master sends dummy data and slave sends useful
one or more slave devices. When multiple slave data.
devices are used, an independent Slave Select
Transmissions may involve any number of clock
connection is required from the master device to each
cycles. When there is no more data to be transmitted,
slave device.
the master stops sending the clock signal and it
Figure 24-4 shows a typical connection between a deselects the slave.
master device and multiple slave devices.
Every slave device connected to the bus that has not
The master selects only one slave at a time. Most slave been selected through its slave select line must disre-
devices have tri-state outputs so their output signal gard the clock and transmission signals and must not
appears disconnected from the bus when they are not transmit out any data of its own.
selected.
Transmissions involve two shift registers, eight bits in
size, one in the master and one in the slave. With either
the master or the slave device, data is always shifted
out one bit at a time, with the Most Significant bit (MSb)
shifted out first. At the same time, a new Least
Significant bit (LSb) is shifted into the same register.
Figure 24-5 shows a typical connection between two
processors configured as master and slave devices.
Data is shifted out of both shift registers on the
programmed clock edge and latched on the opposite
edge of the clock.
The master device transmits information out on its SDO
output pin which is connected to, and received by, the
slave’s SDI input pin. The slave device transmits infor-
mation out on its SDO output pin, which is connected
to, and received by, the master’s SDI input pin.
To begin communication, the master device first sends
out the clock signal. Both the master and the slave
devices should be configured for the same clock polar-
ity.
The master device starts a transmission by sending out
the MSb from its shift register. The slave device reads
this bit from that same line and saves it into the LSb
position of its shift register.
SCK SCK
SPI Master
SDO SDI SPI Slave
SDI SDO #1
General I/O SS
General I/O
General I/O SCK
SDI SPI Slave
SDO #2
SS
SCK
SDI SPI Slave
SDO #3
SS
Slave Select
General I/O SS
Processor 1 (optional) Processor 2
Write to
SSPxBUF
SCK
(CKP = 0
CKE = 0)
SCK
(CKP = 1
CKE = 0)
4 Clock
SCK Modes
(CKP = 0
CKE = 1)
SCK
(CKP = 1
CKE = 1)
Input
Sample
(SMP = 1)
SSPxIF
SSPSR to
SSPxBUF
The SS pin allows a Synchronous Slave mode. The When the SPI module resets, the bit counter is forced
SPI must be in Slave mode with SS pin control enabled to ‘0’. This can be done by either forcing the SS pin to
(SSPxCON1<3:0> = 0100). a high level or clearing the SSPEN bit.
SCK SCK
SPI Master
SDO SDI SPI Slave
SDI SDO #1
General I/O SS
SCK
SDI SPI Slave
SDO #2
SS
SCK
SDI SPI Slave
SDO #3
SS
SS
SCK
(CKP = 0
CKE = 0)
SCK
(CKP = 1
CKE = 0)
Write to
SSPxBUF
Shift register SSPSR
and bit count are reset
SSPxBUF to
SSPSR
SDI bit 0
bit 7 bit 7
Input
Sample
SSPxIF
Interrupt
Flag
SSPSR to
SSPxBUF
SS
Optional
SCK
(CKP = 0
CKE = 0)
SCK
(CKP = 1
CKE = 0)
Write to
SSPxBUF
Valid
SDO bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0
SDI
bit 7 bit 0
Input
Sample
SSPxIF
Interrupt
Flag
SSPSR to
SSPxBUF
Write Collision
detection active
SS
Not Optional
SCK
(CKP = 0
CKE = 1)
SCK
(CKP = 1
CKE = 1)
Write to
SSPxBUF
Valid
SDO bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0
SDI
bit 7 bit 0
Input
Sample
SSPxIF
Interrupt
Flag
SSPSR to
SSPxBUF
Write Collision
detection active
SDA
SCL
S P
Change of Change of
Data Allowed Data Allowed
Start Stop
Condition Condition
Sr
Change of Change of
Data Allowed Data Allowed
Restart
Condition
FIGURE 24-14:
I2C SLAVE, 7-BIT ADDRESS, RECEPTION (SEN = 0, AHEN = 0, DHEN = 0)
Bus Master sends
Stop condition
From Slave to Master
SCL
1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S P
SSPxIF
SSPxIF set on 9th
Cleared by software Cleared by software falling edge of
SCL
BF
First byte
SSPxBUF is read of data is
available
in SSPxBUF
PIC16(L)F1615/9
SSPOV
FIGURE 24-15:
Bus Master sends
Stop condition
SSPxIF
BF
First byte
of data is
SSPxBUF is read available
in SSPxBUF
SSPOV
PIC16(L)F1615/9
SSPOV set because
SSPxBUF is still full.
ACK is not sent.
CKP
FIGURE 24-16:
Master Releases SDA Master sends
to slave for ACK sequence Stop condition
SSPxIF
If AHEN = 1: SSPxIF is set on
SSPxIF is set 9th falling edge of Cleared by software No interrupt
SCL, after ACK after not ACK
BF from Slave
Address is
read from Data is read from SSPxBUF
ACKDT SSBUF
Slave software
clears ACKDT to Slave software
ACK the received sets ACKDT to
CKP byte not ACK
When AHEN=1:
When DHEN=1: CKP set by software,
CKP is cleared by hardware
CKP is cleared by SCL is released
and SCL is stretched hardware on 8th falling
edge of SCL
ACKTIM
PIC16(L)F1615/9
ACKTIM set by hardware ACKTIM cleared by ACKTIM set by hardware
on 8th falling edge of SCL hardware in 9th on 8th falling edge of SCL
rising edge of SCL
S
DS40001770D-page 280
P
2014-2017 Microchip Technology Inc.
FIGURE 24-17:
Master sends
Stop condition
Master releases
R/W = 0 SDA to slave for ACK sequence
Receiving Address Receive Data Receive Data ACK
SDA
SCL
1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 P
S
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
PIC16(L)F1615/9
ACKTIM
S
DS40001770D-page 281
P
PIC16(L)F1615/9
24.5.3 SLAVE TRANSMISSION 24.5.3.2 7-bit Transmission
When the R/W bit of the incoming address byte is set A master device can transmit a read request to a slave,
and an address match occurs, the R/W bit of the and then clock data out of the slave. The list below out-
SSPxSTAT register is set. The received address is lines what software for a slave will need to do to
loaded into the SSPxBUF register, and an ACK pulse is accomplish a standard transmission. Figure 24-18 can
sent by the slave on the ninth bit. be used as a reference to this list.
Following the ACK, slave hardware clears the CKP bit 1. Master sends a Start condition on SDA and
and the SCL pin is held low (see Section SCL.
24.5.6 “Clock Stretching” for more detail). By 2. S bit of SSPxSTAT is set; SSPxIF is set if inter-
stretching the clock, the master will be unable to assert rupt on Start detect is enabled.
another clock pulse until the slave is done preparing 3. Matching address with R/W bit set is received by
the transmit data. the Slave setting SSPxIF bit.
The transmit data must be loaded into the SSPxBUF 4. Slave hardware generates an ACK and sets
register which also loads the SSPSR register. Then the SSPxIF.
SCL pin should be released by setting the CKP bit of 5. SSPxIF bit is cleared by user.
the SSPxCON1 register. The eight data bits are shifted
6. Software reads the received address from
out on the falling edge of the SCL input. This ensures
SSPxBUF, clearing BF.
that the SDA signal is valid during the SCL high time.
7. R/W is set so CKP was automatically cleared
The ACK pulse from the master-receiver is latched on after the ACK.
the rising edge of the ninth SCL input pulse. This ACK
8. The slave software loads the transmit data into
value is copied to the ACKSTAT bit of the SSPxCON2
SSPxBUF.
register. If ACKSTAT is set (not ACK), then the data
transfer is complete. In this case, when the not ACK is 9. CKP bit is set releasing SCL, allowing the
latched by the slave, the slave goes idle and waits for master to clock the data out of the slave.
another occurrence of the Start bit. If the SDA line was 10. SSPxIF is set after the ACK response from the
low (ACK), the next transmit data must be loaded into master is loaded into the ACKSTAT register.
the SSPxBUF register. Again, the SCL pin must be 11. SSPxIF bit is cleared.
released by setting bit CKP. 12. The slave software checks the ACKSTAT bit to
An MSSP interrupt is generated for each data transfer see if the master wants to clock out more data.
byte. The SSPxIF bit must be cleared by software and Note 1: If the master ACKs the clock will be
the SSPxSTAT register is used to determine the status stretched.
of the byte. The SSPxIF bit is set on the falling edge of
the ninth clock pulse. 2: ACKSTAT is the only bit updated on the
rising edge of SCL (9th) rather than the
24.5.3.1 Slave Mode Bus Collision falling.
A slave receives a Read request and begins shifting 13. Steps 9-13 are repeated for each transmitted
data out on the SDA line. If a bus collision is detected byte.
and the SBCDE bit of the SSPxCON3 register is set, 14. If the master sends a not ACK; the clock is not
the BCL1IF bit of the PIR2 register is set. Once a bus held, but SSPxIF is still set.
collision is detected, the slave goes idle and waits to be 15. The master sends a Restart condition or a Stop.
addressed again. User software can use the BCL1IF bit
16. The slave is no longer addressed.
to handle a slave bus collision.
FIGURE 24-18:
Master sends
Stop condition
SSPxIF
Cleared by software
BF
BF is automatically
Received address Data to transmit is cleared after 8th falling
is read from SSPxBUF loaded into SSPxBUF edge of SCL
CKP
When R/W is set CKP is not
SCL is always held for not
held low after 9th SCL Set by software ACK
falling edge
ACKSTAT
PIC16(L)F1615/9
R/W is copied from the
matching address byte
D/A
Indicates an address
has been received
DS40001770D-page 283
P
PIC16(L)F1615/9
24.5.3.3 7-bit Transmission with Address
Hold Enabled
Setting the AHEN bit of the SSPxCON3 register
enables additional clock stretching and interrupt
generation after the eighth falling edge of a received
matching address. Once a matching address has
been clocked in, CKP is cleared and the SSPxIF
interrupt is set.
Figure 24-19 displays a standard waveform of a 7-bit
address slave transmission with AHEN enabled.
1. Bus starts Idle.
2. Master sends Start condition; the S bit of
SSPxSTAT is set; SSPxIF is set if interrupt on
Start detect is enabled.
3. Master sends matching address with R/W bit
set. After the eighth falling edge of the SCL line
the CKP bit is cleared and SSPxIF interrupt is
generated.
4. Slave software clears SSPxIF.
5. Slave software reads ACKTIM bit of SSPxCON3
register, and R/W and D/A of the SSPxSTAT
register to determine the source of the interrupt.
6. Slave reads the address value from the
SSPxBUF register clearing the BF bit.
7. Slave software decides from this information if it
wishes to ACK or not ACK and sets the ACKDT
bit of the SSPxCON2 register accordingly.
8. Slave sets the CKP bit releasing SCL.
9. Master clocks in the ACK value from the slave.
10. Slave hardware automatically clears the CKP bit
and sets SSPxIF after the ACK if the R/W bit is
set.
11. Slave software clears SSPxIF.
12. Slave loads value to transmit to the master into
SSPxBUF setting the BF bit.
Note: SSPxBUF cannot be loaded until after the
ACK.
13. Slave sets the CKP bit releasing the clock.
14. Master clocks out the data from the slave and
sends an ACK value on the 9th SCL pulse.
15. Slave hardware copies the ACK value into the
ACKSTAT bit of the SSPxCON2 register.
16. Steps 10-15 are repeated for each byte transmit-
ted to the master from the slave.
17. If the master sends a not ACK the slave
releases the bus allowing the master to send a
Stop and end the communication.
Note: Master must send a not ACK on the last
byte to ensure that the slave releases the
SCL line to receive a Stop.
FIGURE 24-19:
Master sends
Master releases SDA Stop condition
to slave for ACK sequence
Receiving Address R/W = 1 Automatic Transmitting Data Automatic Transmitting Data ACK
SDA
A7 A6 A5 A4 A3 A2 A1 ACK D7 D6 D5 D4 D3 D2 D1 D0 ACK D7 D6 D5 D4 D3 D2 D1 D0
SSPxIF
Cleared by software
BF BF is automatically
Received address Data to transmit is cleared after 8th falling
is read from SSPxBUF loaded into SSPxBUF edge of SCL
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;
PIC16(L)F1615/9
Set by software, after not ACK
after receiving matching CKP is always releases SCL
address. cleared after ACK
ACKTIM
ACKTIM is set on 8th falling ACKTIM is cleared
edge of SCL on 9th rising edge of SCL
DS40001770D-page 285
R/W
D/A
PIC16(L)F1615/9
24.5.4 SLAVE MODE 10-BIT ADDRESS 24.5.5 10-BIT ADDRESSING WITH
RECEPTION ADDRESS OR DATA HOLD
This section describes a standard sequence of events Reception using 10-bit addressing with AHEN or
for the 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 24-20 is used as a visual reference for this using the UA bit. All functionality, specifically when the
description. CKP bit is cleared and SCL line is held low are the
same. Figure 24-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 24-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 SCL.
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.
FIGURE 24-20:
Master sends
Stop condition
SCL
1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 P
S
SCL is held low
while CKP = 0
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
PIC16(L)F1615/9
When UA = 1; Software updates SSPxADD
SCL is held low and releases SCL
CKP
DS40001770D-page 287
FIGURE 24-21:
Receive First Address Byte R/W = 0 Receive Second Address Byte Receive Data Receive Data
SDA 1 1 1 1 0 A9 A8 ACK A7 A6 A5 A4 A3 A2 A1 A0 ACK D7 D6 D5 D4 D3 D2 D1 D0 ACK D7 D6 D5
SSPxIF
Set by hardware Cleared by software Cleared by software
on 9th falling edge
BF
UA
PIC16(L)F1615/9
Update to SSPxADD is Update of SSPxADD,
not allowed until 9th
falling edge of SCL clears UA and releases
SCL
FIGURE 24-22:
Master sends
Master sends Stop condition
Receiving Address R/W = 0 Receiving Second Address Byte Receive First Address Byte Transmitting Data Byte ACK = 1
SDA 1 1 1 1 0 A9 A8 ACK A7 A6 A5 A4 A3 A2 A1 A0 ACK 1 1 1 1 0 A9 A8 ACK D7 D6 D5 D4 D3 D2 D1 D0
SCL 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 P
S
Sr
SSPxIF
BF
PIC16(L)F1615/9
When R/W = 1; Set by software
ACKSTAT CKP is cleared on releases SCL
9th falling edge of SCL
Indicates an address
has been received
PIC16(L)F1615/9
24.5.6 CLOCK STRETCHING 24.5.6.2 10-bit Addressing Mode
Clock stretching occurs when a device on the bus In 10-bit Addressing mode, when the UA bit is set the
holds the SCL line low, effectively pausing communi- clock is always stretched. This is the only time the SCL
cation. The slave may stretch the clock to allow more is stretched without CKP being cleared. SCL is
time to handle data or prepare a response for the released immediately after a write to SSPxADD.
master 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
handled by the hardware that generates SCL.
24.5.6.3 Byte NACKing
The CKP bit of the SSPxCON1 register is used to
control 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 SCL line to go low cleared by hardware after the eighth falling edge of
and then hold it. Setting CKP will release SCL and SCL for a received matching address byte. When the
allow more communication. DHEN bit of SSPxCON3 is set; CKP is cleared after
the eighth falling edge of SCL for received data.
24.5.6.1 Normal Clock Stretching Stretching after the eighth falling edge of SCL 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
transfer to the master. If the SEN bit of SSPxCON2 is 24.5.6.4 Clock Synchronization and
set, the slave hardware will always stretch the clock the CKP Bit
after the ACK sequence. Once the slave is ready; CKP Any time the CKP bit is cleared, the module will wait
is set by software and communication resumes. for the SCL line to go low and then hold it. However,
clearing the CKP bit will not assert the SCL output low
Note 1:The BF bit has no effect on if the clock will
until the SCL output is already sampled low. There-
be stretched or not. This is different than
fore, the CKP bit will not assert the SCL line until an
previous versions of the module that
external I2C master device has already asserted the
would not stretch the clock, clear CKP, if
SCL line. The SCL output will remain low until the CKP
SSPxBUF was read before the 9th falling
bit is set and all other devices on the I2C bus have
edge of SCL.
released SCL. This ensures that a write to the CKP bit
2: Previous versions of the module did not will not violate the minimum high time requirement for
stretch the clock for a transmission if SCL (see Figure 24-23).
SSPxBUF was loaded before the 9th
falling edge of SCL. It is now always
cleared for read requests.
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
SDA DX DX ‚ – 1
SCL
Master device
CKP asserts clock
Master device
releases clock
WR
SSPxCON1
SCL
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 of operation is supported by interrupt In Master Transmitter mode, serial data is output
generation on the detection of the Start and Stop through SDA, while SCL outputs the serial clock. The
conditions. The Stop (P) and Start (S) bits are cleared first byte transmitted contains the slave address of the
from a Reset or when the MSSP module is disabled. receiving device (7 bits) and the Read/Write (R/W) bit.
Control of the I 2C bus may be taken when the P bit is In this case, the R/W bit will be logic ‘0’. Serial data is
set, or the bus is Idle. transmitted eight bits at a time. After each byte is
transmitted, an Acknowledge bit is received. Start and
In Firmware Controlled Master mode, user code Stop conditions are output to indicate the beginning
conducts all I 2C bus operations based on Start and and the end of a serial transfer.
Stop bit condition detection. Start and Stop condition
detection is the only active circuitry in this mode. All In Master Receive mode, the first byte transmitted
other communication is done by the user software contains the slave address of the transmitting device
directly manipulating the SDA and SCL lines. (7 bits) and the R/W bit. In this case, the R/W bit will be
logic ‘1’. Thus, the first byte transmitted is a 7-bit slave
The following events will cause the SSP Interrupt Flag address followed by a ‘1’ to indicate the receive bit.
bit, SSPxIF, to be set (SSP interrupt, if enabled): Serial data is received via SDA, while SCL outputs the
• Start condition detected serial clock. Serial data is received eight bits at a time.
After each byte is received, an Acknowledge bit is
• Stop condition detected
transmitted. Start and Stop conditions indicate the
• Data transfer byte transmitted/received beginning and end of transmission.
• Acknowledge transmitted/received
A Baud Rate Generator is used to set the clock
• Repeated Start generated frequency output on SCL. See Section 24.7 “Baud
Note 1:The MSSP module, when configured in I2C Rate Generator” for more detail.
Master mode, does not allow queuing 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: Master mode suspends Start/Stop
detection when sending the Start/Stop
condition by means of the SEN/PEN
control bits. The SSPxIF bit is set at the
end of the Start/Stop generation when
hardware clears the control bit.
SDA DX DX ‚ – 1
BRG decrements on
Q2 and Q4 cycles
BRG
03h 02h 01h 00h (hold off) 03h 02h
Value
TBRG
SCL
S
TBRG
BF (SSPxSTAT<0>)
PEN
R/W
I2C MASTER MODE WAVEFORM (TRANSMISSION, 7 OR 10-BIT ADDRESS)
PIC16(L)F1615/9
DS40001770D-page 297
PIC16(L)F1615/9
24.6.7 I2C MASTER MODE RECEPTION 24.6.7.4 Typical Receive Sequence:
Master mode reception (Figure 24-29) is enabled by 1. The user generates a Start condition by setting
programming the Receive Enable bit, RCEN bit of the the SEN bit of the SSPxCON2 register.
SSPxCON2 register. 2. SSPxIF is set by hardware on completion of the
Note: The MSSP module must be in an Idle Start.
state before the RCEN bit is set or the 3. SSPxIF is cleared by software.
RCEN bit will be disregarded. 4. User writes SSPxBUF with the slave address to
transmit and the R/W bit set.
The Baud Rate Generator begins counting and on each
rollover, the state of the SCL pin changes (high-to-low/ 5. Address is shifted out the SDA pin until all eight
low-to-high) and data is shifted into the SSPSR. After bits are transmitted. Transmission begins as
the falling edge of the eighth clock, the receive enable soon as SSPxBUF is written to.
flag is automatically cleared, the contents of the 6. The MSSP module shifts in the ACK bit from the
SSPSR are loaded into the SSPxBUF, the BF flag bit is slave device and writes its value into the
set, the SSPxIF flag bit is set and the Baud Rate Gen- ACKSTAT bit of the SSPxCON2 register.
erator is suspended from counting, holding SCL low. 7. The MSSP module generates an interrupt at the
The MSSP is now in Idle state awaiting the next com- end of the ninth clock cycle by setting the
mand. When the buffer is read by the CPU, the BF flag SSPxIF bit.
bit is automatically cleared. The user can then send an 8. User sets the RCEN bit of the SSPxCON2 regis-
Acknowledge bit at the end of reception by setting the ter and the master clocks in a byte from the slave.
Acknowledge Sequence Enable, ACKEN bit of the 9. After the eighth falling edge of SCL, SSPxIF and
SSPxCON2 register. BF are set.
24.6.7.1 BF Status Flag 10. Master clears SSPxIF and reads the received
byte from SSPxBUF, clears BF.
In receive operation, the BF bit is set when an address
11. Master sets ACK value sent to slave in ACKDT
or data byte is loaded into SSPxBUF from SSPSR. It is
bit of the SSPxCON2 register and initiates the
cleared when the SSPxBUF register is read.
ACK by setting the ACKEN bit.
24.6.7.2 SSPOV Status Flag 12. Master’s ACK is clocked out to the slave and
SSPxIF is set.
In receive operation, the SSPOV bit is set when eight
bits are received into the SSPSR and the BF flag bit is 13. User clears SSPxIF.
already set from a previous reception. 14. Steps 8-13 are repeated for each received byte
from the slave.
24.6.7.3 WCOL Status Flag 15. Master sends a not ACK or Stop to end
If the user writes the SSPxBUF when a receive is communication.
already in progress (i.e., SSPSR is still shifting in a data
byte), the WCOL bit is set and the contents of the buffer
are unchanged (the write does not occur).
FIGURE 24-29:
Write to SSPxCON2<4>
to start Acknowledge sequence
SDA = ACKDT (SSPxCON2<5>) = 0
Write to SSPxCON2<0>(SEN = 1),
begin Start condition ACK from Master Set ACKEN, start Acknowledge sequence
Master configured as a receiver SDA = ACKDT = 0 SDA = ACKDT = 1
SEN = 0 by programming SSPxCON2<3> (RCEN = 1)
PEN bit = 1
Bus master
ACK is not sent terminates
transfer
1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
SCL S P
Data shifted in on falling edge of CLK Set 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>)
SDA = 0, SCL = 1 Cleared in
while CPU software and SSPxIF
responds to SSPxIF
BF
(SSPxSTAT<0>) Last bit is shifted into SSPSR and
contents are unloaded into SSPxBUF
SSPOV
PIC16(L)F1615/9
SSPOV is set because
SSPxBUF is still full
ACKEN
DS40001770D-page 299
RCEN
Master configured as a receiver RCEN cleared ACK from Master RCEN cleared
by programming SSPxCON2<3> (RCEN = 1) automatically SDA = ACKDT = 0 automatically
PIC16(L)F1615/9
24.6.8 ACKNOWLEDGE SEQUENCE 24.6.9 STOP CONDITION TIMING
TIMING A Stop bit is asserted on the SDA pin at the end of a
An Acknowledge sequence is enabled by setting the receive/transmit by setting the Stop Sequence Enable
Acknowledge Sequence Enable bit, ACKEN bit of the bit, PEN bit of the SSPxCON2 register. At the end of a
SSPxCON2 register. When this bit is set, the SCL pin is receive/transmit, the SCL line is held low after the
pulled low and the contents of the Acknowledge data bit falling edge of the ninth clock. When the PEN bit is set,
are presented on the SDA pin. If the user wishes to the master will assert the SDA line low. When the SDA
generate an Acknowledge, then the ACKDT bit should line is sampled low, the Baud Rate Generator is
be cleared. If not, the user should set the ACKDT bit reloaded and counts down to ‘0’. When the Baud Rate
before starting an Acknowledge sequence. The Baud Generator times out, the SCL pin will be brought high
Rate Generator then counts for one rollover period and one TBRG (Baud Rate Generator rollover count)
(TBRG) and the SCL pin is deasserted (pulled high). later, the SDA pin will be deasserted. When the SDA
When the SCL pin is sampled high (clock arbitration), pin is sampled high while SCL is high, the P bit of the
the Baud Rate Generator counts for TBRG. The SCL pin SSPxSTAT register is set. A TBRG later, the PEN bit is
is then pulled low. Following this, the ACKEN bit is auto- cleared and the SSPxIF bit is set (Figure 24-31).
matically cleared, the Baud Rate Generator is turned off
and the MSSP module then goes into Idle mode 24.6.9.1 WCOL Status Flag
(Figure 24-30). If the user writes the SSPxBUF when a Stop sequence
is in progress, then the WCOL bit is set and the
24.6.8.1 WCOL Status Flag contents of the buffer are unchanged (the write does
If the user writes the SSPxBUF when an Acknowledge not occur).
sequence is in progress, then WCOL bit is set and the
contents of the buffer are unchanged (the write does
not occur).
FIGURE 24-30: ACKNOWLEDGE SEQUENCE WAVEFORM
Acknowledge sequence starts here, ACKEN automatically cleared
write to SSPxCON2
ACKEN = 1, ACKDT = 0
TBRG TBRG
SDA D0 ACK
SCL 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.
SDA ACK
P
TBRG TBRG TBRG
SCL brought high after TBRG
SDA asserted low before rising edge of clock
to setup Stop condition
SDA
BCL1IF
SDA
SCL
Set SEN, enable Start SEN cleared automatically because of bus collision.
condition if SDA = 1, SCL = 1 SSP module reset into Idle state.
SEN
SDA sampled low before
Start condition. Set BCL1IF.
S bit and SSPxIF set because
BCL1IF SDA = 0, SCL = 1.
SSPxIF and BCL1IF are
cleared by software
SSPxIF
TBRG TBRG
SDA
FIGURE 24-35: BRG RESET DUE TO SDA ARBITRATION DURING START CONDITION
SDA = 0, SCL = 1
Set S Set SSPxIF
Less than TBRG
TBRG
SCL S
SCL pulled low after BRG
time-out
SEN
Set SEN, enable Start
sequence if SDA = 1, SCL = 1
BCL1IF ’0’
SSPxIF
SDA = 0, SCL = 1, Interrupts cleared
set SSPxIF by software
SDA
SCL
RSEN
BCL IF
Cleared by software
S ’0’
SSPxIF ’0’
TBRG TBRG
SDA
SCL
S ’0’
SSPxIF
PEN
BCL1IF
P ’0’
SSPxIF ’0’
SDA
PEN
BCL1IF
P ’0’
SSPxIF ’0’
SSPM<3:0> SSPxADD<7:0>
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared HS = Bit is set by hardware C = User cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared HC = Cleared by hardware S = User set
bit 7 GCEN: General Call Enable bit (in I2C Slave mode only)
1 = Enable interrupt when a general call address (0x00 or 00h) is received in the SSPSR
0 = General call address disabled
bit 6 ACKSTAT: Acknowledge Status bit (in I2C mode only)
1 = Acknowledge was not received
0 = Acknowledge was received
bit 5 ACKDT: Acknowledge Data bit (in I2C mode only)
In Receive mode:
Value transmitted when the user initiates an Acknowledge sequence at the end of a receive
1 = Not Acknowledge
0 = Acknowledge
bit 4 ACKEN: Acknowledge Sequence Enable bit (in I2C Master mode only)
In Master Receive mode:
1 = Initiate Acknowledge sequence on SDA and SCL pins, and transmit ACKDT data bit.
Automatically cleared by hardware.
0 = Acknowledge sequence idle
bit 3 RCEN: Receive Enable bit (in I2C Master mode only)
1 = Enables Receive mode for I2C
0 = Receive idle
bit 2 PEN: Stop Condition Enable bit (in I2C Master mode only)
SCKMSSP Release Control:
1 = Initiate Stop condition on SDA and SCL pins. Automatically cleared by hardware.
0 = Stop condition Idle
bit 1 RSEN: Repeated Start Condition Enable bit (in I2C Master mode only)
1 = Initiate Repeated Start condition on SDA and SCL pins. Automatically cleared by hardware.
0 = Repeated Start condition Idle
bit 0 SEN: Start Condition Enable/Stretch Enable bit
In Master mode:
1 = Initiate Start condition on SDA and SCL pins. Automatically cleared by hardware.
0 = Start condition Idle
In Slave mode:
1 = Clock stretching is enabled for both slave transmit and slave receive (stretch enabled)
0 = Clock stretching is disabled
Note 1: For bits ACKEN, RCEN, PEN, RSEN, SEN: If the I2C module is not in the Idle mode, this bit may not be
set (no spooling) and the SSP1BUF may not be written (or writes to the SSP1BUF are disabled).
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Note 1: For daisy-chained SPI operation; allows the user to ignore all but the last received byte. SSPOV is still set
when a new byte is received and BF = 1, but hardware continues to write the most recent byte to
SSP1BUF.
2: This bit has no effect in Slave modes that Start and Stop condition detection is explicitly listed as enabled.
3: The ACKTIM Status bit is only active when the AHEN bit or DHEN bit is set.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
REGISTER 24-6: SSP1ADD: 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
pattern sent by master is fixed by I2C specification and must be equal to ‘11110’. However, those bits
are compared by hardware and are not affected by the value in this register.
bit 2-1 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:
TRMT TX_out
Baud Rate Generator FOSC
÷n
TX9
BRG16 n
+1 Multiplier x4 x16 x64
TX9D TX/CK pin
SYNC 1 X 0 0 0 0
SPxBRGH SPxBRGL PPS
BRGH X 1 1 0 0
1
BRG16 X 1 0 1 0
RxyPPS
SYNC
Note 1: In Synchronous mode the DT output and RX input PPS CSRC
selections should enable the same pin.
RXPPS(1)
RX/DT pin MSb RSR Register LSb
Pin Buffer Data
PPS and Control Recovery
Stop (8) 7 ••• 1 0 Start
BRG16
+1 n
Multiplier x4 x16 x64
SYNC 1 X 0 0 0
SPxBRGH SPxBRGL BRGH FIFO
X 1 1 0 0 FERR RX9D RCxREG Register
BRG16 X 1 0 1 0
8
Data Bus
Note 1: In Synchronous mode the DT output and RX input PPS RCIF Interrupt
selections should enable the same pin. RCIE
Write to TXxREG
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 TXxREG
Word 1 Word 2
BRG Output
(Shift Clock)
TX/CK
pin Start bit bit 0 bit 1 bit 7/8 Stop bit Start bit bit 0
TXIF bit 1 TCY Word 1 Word 2
(Transmit Buffer
Reg. Empty Flag) 1 TCY
• CREN = 1 Immediately after all data bits and the Stop bit have
been received, the character in the RSR is transferred
• SYNC = 0
to the EUSART receive FIFO and the RCIF interrupt
• SPEN = 1 flag bit of the PIR1 register is set. The top character in
All other EUSART control bits are assumed to be in the FIFO is transferred out of the FIFO by reading the
their default state. RCxREG register.
Setting the CREN bit of the RCxSTA register enables Note: If the receive FIFO is overrun, no additional
the receiver circuitry of the EUSART. Clearing the SYNC characters will be received until the overrun
bit of the TXxSTA register configures the EUSART for condition is cleared. See Section
asynchronous operation. Setting the SPEN bit of the 25.1.2.5 “Receive Overrun Error” for
RCxSTA register enables the EUSART. The more information on overrun errors.
programmer must set the corresponding TRIS bit to
configure the RX/DT I/O pin as an input. 25.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.
RCxREG
RCIF
(Interrupt Flag)
OERR bit
CREN
Note: This timing diagram shows three words appearing on the RX input. The RCxREG (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 25-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
BAUD1CON ABDOVF RCIDL — SCKP BRG16 — WUE ABDEN 325
RC1STA SPEN RX9 SREN CREN ADDEN FERR OERR RX9D 324
SP1BRGL BRG<7:0> 326
SP1BRGH BRG<15:8> 326
TX1STA CSRC TX9 TXEN SYNC SENDB BRGH TRMT TX9D 323
Legend: — = unimplemented location, read as ‘0’. Shaded cells are not used for the Baud Rate Generator.
* Page provides register information.
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 300 0.00 191 300 0.16 51
1200 1202 0.16 103 1202 0.16 51 1200 0.00 47 1202 0.16 12
2400 2404 0.16 51 2404 0.16 25 2400 0.00 23 — — —
9600 9615 0.16 12 — — — 9600 0.00 5 — — —
10417 10417 0.00 11 10417 0.00 5 — — — — — —
19.2k — — — — — — 19.20k 0.00 2 — — —
57.6k — — — — — — 57.60k 0.00 0 — — —
115.2k — — — — — — — — — — — —
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 — — —
0 0 FOSC/64 FOSC/512
0 1 FOSC/16 FOSC/128
1 0 FOSC/16 FOSC/128
1 1 FOSC/4 FOSC/32
Note: During the ABD sequence, SPxBRGL and
SPxBRGH registers are both used as a 16-
bit counter, independent of the BRG16
setting.
BRG Clock
RCIDL
RCIF bit
(Interrupt)
Read
RCxREG
Note 1: The ABD sequence requires the EUSART module to be configured in Asynchronous mode.
RCIF
Cleared due to User Read of RCxREG
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 TXxREG
Dummy Write
BRG Output
(Shift Clock)
TX/CK pin
(SCKP = 1)
Write to
TXxREG Reg Write Word 1 Write Word 2
TXIF bit
(Interrupt Flag)
TRMT bit
‘1’ ‘1’
TXEN bit
Note: Sync Master mode, SPxBRGL = 0, continuous transmission of two 8-bit words.
TX/CK pin
Write to
TXxREG 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
RCxREG
Note: Timing diagram demonstrates Sync Master mode with bit SREN = 1 and bit BRGH = 0.
Rev. 10-000158D
7/17/2014
RxyPPS
CCPx
CTS<2:0>
TRIS Control
Reserved 111
Reserved 110 CCPRxH CCPRxL
LC2_output 101 16
set CCPxIF
LC1_output 100 Prescaler and
IOC_interrupt 011 1,4,16 Edge Detect
16
C2OUT_sync 010
C1OUT_sync 001 MODE <3:0> TMR1H TMR1L
CCPx 000
To Peripherals
CCPRxH CCPRxL
set CCPxIF
Output S Q PPS CCP x
Comparator
Logic
R TRIS Control
4 RxyPPS
TMR1H TMR1L MODE<3:0>
CCPRxH CCPRxL
CCPx_out
To Peripherals
set CCPIF
10-bit Latch(2)
(Not accessible by user)
S RxyPPS
TMR2 Module TRIS Control
R
TMR2 (1)
ERS logic
Comparator CCPx_pset
PR2
Notes: 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.
2. The alignment of the 10 bits from the CCPR register is determined by the FMT bit.
Note: The Timer postscaler (see Figure ) is not 10-bit Duty Cycle
used in the determination of the PWM 9 8 7 6 5 4 3 2 1 0
frequency.
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 Reset
‘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 Reset
‘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 Reset
‘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 Reset
‘1’ = Bit is set ‘0’ = Bit is cleared
Rev. 10-000022B
9/24/2014
PWMx_out
To Peripherals
10-bit Latch
(Not visible to user)
Comparator R Q
0
PPS PWMx
1
S Q
TMR2 Module
R PWMxPOL RxyPPS 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.
PWM Period = PR2 + 1 4 T OSC Figure 27-2 shows a waveform of the PWM signal when
the duty cycle is set for the smallest possible pulse.
(TMR2 Prescale Value)
Q1 Q2 Q3 Q4 Rev. 10-000023A
7/30/2013
FOSC
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-000166B
8/29/2014
CWG_data
D Q
CWGxISM<3:0>
E Q
R
Falling Deadband Block
clock CWG_dataB
signal_out
signal_in CWG_dataD
EN
SHUTDOWN
HFINTOSC 1
FOSC 0
PIC16(L)F1615/9
CWGxCLK<0>
DS40001770D-page 366
PIC16(L)F1615/9
28.1.2 PUSH-PULL MODE
In Push-Pull mode, two output signals are generated,
alternating copies of the input as illustrated in
Figure 28-2. This alternation creates the push-pull
effect required for driving some transformer-based
power supply designs.
The push-pull sequencer is reset whenever EN = 0 or
if an auto-shutdown event occurs. The sequencer is
clocked by the first input pulse, and the first output
appears on CWGxA.
The unused outputs CWGxC and CWGxD drive copies
of CWGxA and CWGxB, respectively, but with polarity
controlled by the POLC and POLD bits of the
CWGxCON1 register, respectively.
Rev. 10-000167B
8/29/2014
CWG_data
See
CWGxISM
Register D Q
CWG_dataA
Q CWG_dataC
R
CWG_dataB
D Q
CWG_dataD
CWGxISM<3:0>
E Q
R
EN
SHUTDOWN
PIC16(L)F1615/9
DS40001770D-page 368
FIGURE 28-3: SIMPLIFIED CWG BLOCK DIAGRAM (FORWARD AND REVERSE FULL-BRIDGE MODES)
2014-2017 Microchip Technology Inc.
Rev. 10-000165B
8/29/2014
D Q CWG_dataB
D Q
Q CWG_dataC
CWGxISM<3:0>
E
R
Q CWG_dataD
clock
signal_out
signal_in
Forward Deadband Block
EN CWG_data
SHUTDOWN
HFINTOSC 1
FOSC 0
PIC16(L)F1615/9
CWGxCLK<0>
DS40001770D-page 369
PIC16(L)F1615/9
28.1.4 STEERING MODES
In Steering modes, the data input can be steered to any
or all of the four CWG output pins. In Synchronous
Steering mode, changes to steering selection registers
take effect on the next rising input.
In Non-Synchronous mode, steering takes effect on the
next instruction cycle. Additional details are provided in
Section 28.9 “CWG Steering Mode”.
Rev. 10-000164B
8/26/2015
See
CWGxISM CWG_dataA
Register
CWG_dataB
CWG_data
CWG_dataC
CWG_dataD
D Q
CWGxISM <3:0>
E Q
R
EN
SHUTDOWN
PIC16(L)F1615/9
DS40001770D-page 371
PIC16(L)F1615/9
28.2 Clock Source
The CWG module allows the following clock sources to
be selected:
• Fosc (system clock)
• HFINTOSC (16 MHz only)
The clock sources are selected using the CS bit of the
CWGxCLKCON register.
Rev. 10-000171B
9/24/2014
LSAC<1:0>
‘1’ 11 RxyPPS
TRIS Control
‘0’ 10
1
CWG_dataA High Z 01 PPS CWGxA
1 0
POLA 00
OVRA 0
STRA(1)
LSBD<1:0>
‘1’ 11 RxyPPS
TRIS Control
‘0’ 10
1
CWG_dataB High Z 01 PPS CWGxB
1 0
POLB 00
OVRB 0
STRB(1)
LSAC<1:0>
‘1’ 11 RxyPPS
TRIS Control
‘0’ 10
1
CWG_dataC High Z 01 PPS CWGxC
1 0
POLC 00
OVRC 0
STRC(1)
LSBD<1:0>
‘1’ 11 RxyPPS
TRIS Control
‘0’ 10
1
CWG_dataD High Z 01 PPS CWGxD
1 0
POLD 00
OVRD 0
STRD(1)
CWG_shutdown
Note 1: STRx is held to 1 in all modes other than Output Steering Mode.
cwg_clock
Input Source
CWGxA
CWGxB
FIGURE 28-7: DEAD-BAND OPERATION, CWGXDBR = 0X03, CWGXDBF = 0X04, SOURCE SHORTER THAN DEAD BAND
cwg_clock
Input Source
PIC16(L)F1615/9
CWGxA
CWGxB
Therefore:
1
TDEADBAND_UNCERTAINTY = -----------------------------
Fcwg_clock
1
= ------------------
16MHz
= 62.5ns
MODE0
CWGxA
CWGxB
CWGxC
CWGxD
Note 1:WGPOL{ABCD} = 0
2: The direction bit MODE<0> (Register 28-1) can be written any time during the PWM cycle, and takes effect at the
next rising CWGx_data.
3: When changing directions, CWGxA and CWGxC switch at rising CWGx_data; modulated CWGxB and CWGxD are
held inactive for the dead band duration shown; dead band affects only the first pulse after the direction change.
CWGx_clock
CWGxA
CWGxC
Rising Event Dead Band Rising Event D
Falling Event Dead Band Falling Event Dead Band
CWGxB
CWGxD
CWGx_data
Note: CWGx_rising_src = CCP1_out, CWGx_falling_src = ~CCP1_out
Rising Event
CWGx_data
(Rising and Falling Source)
STR<D:A>
follows CWGx_data
CWGx_data
(Rising and Falling Source)
STR<D:A>
follows CWGx_data
PPS
INAS
CWGINPPS
C1OUT_sync
C1AS
C2OUT_sync
C2AS
TMR2_postscaled SHUTDOWN S
S Q
TMR2AS
D Q CWG_shutdown
TMR4_postscaled
REN FREEZE
R
TMR4AS Write ‘0’ to
SHUTDOWN bit
TMR6_postscaled CWG_data CK
TMR6AS
PIC16(L)F1615/9
DS40001770D-page 379
PIC16(L)F1615/9
28.12 Configuring the CWG 28.12.2 AUTO-SHUTDOWN RESTART
The following steps illustrate how to properly configure After an auto-shutdown event has occurred, there are
the CWG. two ways to resume operation:
CWG Input
Source
Shutdown Source
SHUTDOWN
PIC16(L)F1615/9
DS40001770D-page 381
PIC16(L)F1615/9
FIGURE 28-14: SHUTDOWN FUNCTIONALITY, AUTO-RESTART ENABLED (REN = 1, LSAC = 01,
LSBD = 01)
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
Note 1: This bit can only be set after EN = 1 and cannot be set in the same instruction that EN 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 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:
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
Note 1: This bit may be written while EN = 0 (CWGxCON0 register) to place the outputs into the shutdown config-
uration.
2: The outputs will remain in auto-shutdown state until the next rising edge of the input signal after this 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 = 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
Note 1: The bits in this register apply only when MODE<2:0> = 00x.
2: This bit is effectively double-buffered when MODE<2:0> = 001.
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
Period Latch
Set SMTxPRAIF
SMT_window SMT
Clock SMTxPR
Sync
Circuit
Control Set SMTxIF
Logic Comparator
SMT_signal SMT
Clock
Sync
Circuit
24-bit
Reset SMTxCPR
Buffer
SMTxCLK<2:0>
See See
SMTxSIG SMT_signal SMTxWIN SMT_window
Register Register
SMTxSIG<3:0> SMTxWIN<3:0>
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxPR 11
SMTxTMR 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 6 7 8 9
SMTxIF
PIC16(L)F1615/9
DS40001770D-page 395
PIC16(L)F1615/9
29.6.2 GATED TIMER MODE
Gated Timer mode uses the SMTSIGx input to control
whether or not the SMTxTMR will increment. Upon a
falling edge of the external signal, the SMTxCPW
register will update to the current value of the
SMTxTMR. Example waveforms for both repeated and
single acquisitions are provided in Figure 29-4 and
Figure 29-5.
SMTx_signal
SMTx_signalsync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxPR 0xFFFFFF
SMTxTMR 0 1 2 3 4 5 6 7
SMTxCPW 5 7
SMTxPWAIF
PIC16(L)F1615/9
DS40001770D-page 397
FIGURE 29-5: GATED TIMER MODE SINGLE ACQUISITION TIMING DIAGRAM
2014-2017 Microchip Technology Inc.
SMTx_signal
SMTx_signalsync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxPR 0xFFFFFF
SMTxTMR 0 1 2 3 4 5
SMTxCPW 5
SMTxPWAIF
PIC16(L)F1615/9
DS40001770D-page 398
PIC16(L)F1615/9
29.6.3 PERIOD AND DUTY-CYCLE MODE
In Duty-Cycle mode, either the duty cycle or period
(depending on polarity) of the SMTx_signal can be
acquired relative to the SMT clock. The CPW register is
updated on a falling edge of the signal, and the CPR
register is updated on a rising edge of the signal, along
with the SMTxTMR resetting to 0x0001. In addition, the
SMTxGO bit is reset on a rising edge when the SMT is
in Single Acquisition mode. See Figure 29-6 and
Figure 29-7.
SMTx_signal
SMTx_signalsync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxTMR 0 1 2 3 4 5 6 7 8 9 10 11 1 2 3 4 5
SMTxCPW 5 2
SMTxCPR 11
SMTxPWAIF
SMTxPRAIF
PIC16(L)F1615/9
DS40001770D-page 400
FIGURE 29-7: PERIOD AND DUTY-CYCLE SINGLE ACQUISITION TIMING DIAGRAM
2014-2017 Microchip Technology Inc.
SMTx_signal
SMTx_signalsync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxTMR 0 1 2 3 4 5 6 7 8 9 10 11
SMTxCPW 5
SMTxCPR 11
SMTxPWAIF
SMTxPRAIF
PIC16(L)F1615/9
DS40001770D-page 401
PIC16(L)F1615/9
29.6.4 HIGH AND LOW MEASURE MODE
This mode measures the high and low pulse time of the
SMTSIGx relative to the SMT clock. It begins
incrementing the SMTxTMR on a rising edge on the
SMTSIGx input, then updates the SMTxCPW register
with the value and resets the SMTxTMR on a falling
edge, starting to increment again. Upon observing
another rising edge, it updates the SMTxCPR register
with its current value and once again resets the
SMTxTMR value and begins incrementing again. See
Figure 29-8 and Figure 29-9.
SMTx_signal
SMTx_signalsync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxTMR 0 1 2 3 4 5 1 2 3 4 5 6 1 2 1 2 3
SMTxCPW 5 2
SMTxCPR 6
SMTxPWAIF
SMTxPRAIF
PIC16(L)F1615/9
DS40001770D-page 403
FIGURE 29-9: HIGH AND LOW MEASURE MODE SINGLE ACQUISITION TIMING DIAGRAM
2014-2017 Microchip Technology Inc.
SMTx_signal
SMTx_signalsync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxTMR 0 1 2 3 4 5 1 2 3 4 5 6
SMTxCPW 5
SMTxCPR 6
SMTxPWAIF
SMTxPRAIF
PIC16(L)F1615/9
DS40001770D-page 404
PIC16(L)F1615/9
29.6.5 WINDOWED MEASURE MODE
This mode measures the window duration of the
SMTWINx input of the SMT. It begins incrementing the
timer on a rising edge of the SMTWINx input and
updates the SMTxCPR register with the value of the
timer and resets the timer on a second rising edge. See
Figure 29-10 and Figure 29-11.
SMTxWIN
SMTxWIN_sync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxTMR 0 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 1 2 3 4
SMTxCPR 12 8
SMTxPRAIF
PIC16(L)F1615/9
DS40001770D-page 406
FIGURE 29-11: WINDOWED MEASURE MODE SINGLE ACQUISITION TIMING DIAGRAM
2014-2017 Microchip Technology Inc.
SMTxWIN
SMTxWIN_sync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxTMR 0 1 2 3 4 5 6 7 8 9 10 11 12
SMTxCPR 12
SMTxPRAIF
PIC16(L)F1615/9
DS40001770D-page 407
PIC16(L)F1615/9
29.6.6 GATED WINDOW MEASURE MODE
This mode measures the duty cycle of the SMTx_signal
input over a known input window. It does so by
incrementing the timer on each pulse of the clock signal
while the SMTx_signal input is high, updating the
SMTxCPR register and resetting the timer on every
rising edge of the SMTWINx input after the first. See
Figure 29-12 and Figure 29-13.
SMTxWIN
SMTxWIN_sync
SMTx_signal
SMTx_signalsync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxTMR 0 1 2 3 4 5 6 0 1 2 3 0
SMTxCPR 6 3
SMTxPRAIF
PIC16(L)F1615/9
DS40001770D-page 409
FIGURE 29-13: GATED WINDOWED MEASURE MODE SINGLE ACQUISITION TIMING DIAGRAMS
2014-2017 Microchip Technology Inc.
SMTxWIN
SMTxWIN_sync
SMTx_signal
SMTx_signalsync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxTMR 0 1 2 3 4 5 6
SMTxCPR 6
SMTxPRAIF
PIC16(L)F1615/9
DS40001770D-page 410
PIC16(L)F1615/9
29.6.7 TIME OF FLIGHT MEASURE MODE
This mode measures the time interval between a rising
edge on the SMTWINx input and a rising edge on the
SMTx_signal input, beginning to increment the timer
upon observing a rising edge on the SMTWINx input,
while updating the SMTxCPR register and resetting the
timer upon observing a rising edge on the SMTx_signal
input. In the event of two SMTWINx rising edges
without an SMTx_signal rising edge, it will update the
SMTxCPW register with the current value of the timer
and reset the timer value. See Figure 29-14 and
Figure 29-15.
Rev. 10-000186A
4/22/2016
SMTxWIN
SMTxWIN_sync
SMTx_signal
SMTx_signalsync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxTMR 0 1 2 3 4 5 1 2 3 4 5 6 7 8 9 10 11 12 13 1 2
SMTxCPW 13
SMTxCPR 4
SMTxPWAIF
PIC16(L)F1615/9
SMTxPRAIF
DS40001770D-page 412
FIGURE 29-15: TIME OF FLIGHT MODE SINGLE ACQUISITION TIMING DIAGRAM
2014-2017 Microchip Technology Inc.
Rev. 10-000185A
4/26/2016
SMTxWIN
SMTxWIN_sync
SMTx_signal
SMTx_signalsync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxTMR 0 1 2 3 4 5
SMTxCPW
SMTxCPR 4
SMTxPWAIF
PIC16(L)F1615/9
SMTxPRAIF
DS40001770D-page 413
PIC16(L)F1615/9
29.6.8 CAPTURE MODE
This mode captures the Timer value based on a rising
or falling edge on the SMTWINx input and triggers an
interrupt. This mimics the capture feature of a CCP
module. The timer begins incrementing upon the
SMTxGO bit being set, and updates the value of the
SMTxCPR register on each rising edge of SMTWINx,
and updates the value of the CPW register on each
falling edge of the SMTWINx. The timer is not reset by
any hardware conditions in this mode and must be
reset by software, if desired. See Figure 29-16 and
Figure 29-17.
SMTxWIN
SMTxWIN_sync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxTMR 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
SMTxCPW 3 19 32
SMTxCPR 2 18 31
SMTxPWAIF
SMTxPRAIF
PIC16(L)F1615/9
DS40001770D-page 415
FIGURE 29-17: CAPTURE MODE SINGLE ACQUISITION TIMING DIAGRAM
2014-2017 Microchip Technology Inc.
SMTxWIN
SMTxWIN_sync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxTMR 0 1 2 3
SMTxCPW 3
SMTxCPR 2
SMTxPWAIF
SMTxPRAIF
PIC16(L)F1615/9
DS40001770D-page 416
PIC16(L)F1615/9
29.6.9 COUNTER MODE
This mode increments the timer on each pulse of the
SMTx_signal input. This mode is asynchronous to the
SMT clock and uses the SMTx_signal as a time source.
The SMTxCPW register will be updated with the
current SMTxTMR value on the falling edge of the
SMTxWIN input. See Figure 29-18.
Rev. 10-000189A
4/12/2016
SMTxWIN
SMTx_signal
SMTxEN
SMTxGO
SMTxTMR 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
SMTxCPW 12 25
PIC16(L)F1615/9
DS40001770D-page 418
PIC16(L)F1615/9
29.6.10 GATED COUNTER MODE
This mode counts pulses on the SMTx_signal input,
gated by the SMTxWIN input. It begins incrementing
the timer upon seeing a rising edge of the SMTxWIN
input and updates the SMTxCPW register upon a fall-
ing edge on the SMTxWIN input. See Figure 29-19
and Figure 29-20.
Rev. 10-000190A
12/18/2013
SMTxWIN
SMTx_signal
SMTxEN
SMTxGO
SMTxTMR 0 1 2 3 4 5 6 7 8 9 10 11 12 13
SMTxCPW 8 13
SMTxPWAIF
SMTxWIN
SMTx_signal
PIC16(L)F1615/9
SMTxEN
SMTxGO
SMTxTMR 0 1 2 3 4 5 6 7 8
DS40001770D-page 420
SMTxCPW 8
SMTxPWAIF
PIC16(L)F1615/9
29.6.11 WINDOWED COUNTER MODE
This mode counts pulses on the SMTx_signal input,
within a window dictated by the SMTxWIN input. It
begins counting upon seeing a rising edge of the
SMTxWIN input, updates the SMTxCPW register on a
falling edge of the SMTxWIN input, and updates the
SMTxCPR register on each rising edge of the
SMTxWIN input beyond the first. See Figure 29-21 and
Figure 29-22.
SMTxWIN
SMTx_signal
SMTxEN
SMTxGO
SMTxTMR 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 2 3 4 5
SMTxCPW 9 5
SMTxCPR 16
SMTxPWAIF
SMTxPRAIF
SMTxWIN
SMTx_signal
SMTxEN
PIC16(L)F1615/9
SMTxGO
SMTxTMR 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
SMTxCPW 9
DS40001770D-page 422
SMTxCPR 16
SMTxPWAIF
SMTxPRAIF
PIC16(L)F1615/9
29.7 Interrupts
The SMT can trigger an interrupt under three different
conditions:
• PW Acquisition Complete
• PR Acquisition Complete
• Counter Period Match
The interrupts are controlled by the PIR and PIE
registers of the device.
TABLE 29-2:
Peripheral Bit Name Prefix
SMT1 SMT1
SMT2 SMT2
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:
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
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
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
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 SMTxTMR<7:0>: Significant bits of the SMT Counter – Low Byte
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 SMTxTMR<15:8>: Significant bits of the SMT Counter – High Byte
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 SMTxTMR<23:16>: Significant bits of the SMT Counter – Upper Byte
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 SMTxCPR<7:0>: Significant bits of the SMT Period Latch – Low Byte
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 SMTxCPR<15:8>: Significant bits of the SMT Period Latch – High Byte
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 SMTxCPR<23:16>: Significant bits of the SMT Period Latch – Upper Byte
REGISTER 29-15: SMTxCPWL: SMT CAPTURED PULSE WIDTH REGISTER – LOW BYTE
R-x/x R-x/x R-x/x R-x/x R-x/x R-x/x R-x/x R-x/x
SMTxCPW<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
bit 7-0 SMTxCPW<7:0>: Significant bits of the SMT PW Latch – Low Byte
REGISTER 29-16: SMTxCPWH: SMT CAPTURED PULSE WIDTH REGISTER – HIGH BYTE
R-x/x R-x/x R-x/x R-x/x R-x/x R-x/x R-x/x R-x/x
SMTxCPW<15:8>
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
bit 7-0 SMTxCPW<15:8>: Significant bits of the SMT PW Latch – High Byte
REGISTER 29-17: SMTxCPWU: SMT CAPTURED PULSE WIDTH REGISTER – UPPER BYTE
R-x/x R-x/x R-x/x R-x/x R-x/x R-x/x R-x/x R-x/x
SMTxCPW<23:16>
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
bit 7-0 SMTxCPW<23:16>: Significant bits of the SMT PW Latch – Upper Byte
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 SMTxPR<7:0>: Significant bits of the SMT Timer Value for Period Match – Low Byte
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 SMTxPR<15:8>: Significant bits of the SMT Timer Value for Period Match – High Byte
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 SMTxPR<23:16>: Significant bits of the SMT Timer Value for Period Match – Upper Byte
PIE4 SCANIE CRCIE SMT2PWAIE SMT2PRAIE SMT2IE SMT1PWAIE SMT1PRAIE SMT1IE 101
PIR4 SCANIF CRCIF SMT2PWAIF SMT2PRAIF SMT2IF SMT1PWAIF SMT1PRAIF SMT1IF 106
SMT1CON0 EN — STP WPOL SPOL CPOL SMT1PS<1:0> 424
SMT1CON1 SMT1GO REPEAT — — MODE<3:0> 425
SMT1CPRH SMT1CPR<15:8> 433
SMT1CPRL SMT1CPR<7:0> 433
SMT1CPRU SMT1CPR<23:16> 433
SMT1CPWH SMT1CPW<15:8> 434
SMT1CPWL SMT1CPW<7:0> 434
SMT1CPWU SMT1CPW<23:16> 434
SMT1PRH SMT1PR<15:8> 435
SMT1PRL SMT1PR<7:0> 435
SMT1PRU SMT1PR<23:16> 435
SMT1SIG — — — SSEL<4:0> 430
SMT1STAT CPRUP CPWUP RST — — TS WS AS 426
SMT1TMRH SMT1TMR<15:8> 432
SMT1TMRL SMT1TMR<7:0> 432
SMT1TMRU SMT1TMR<23:16> 432
SMT1WIN — — — WSEL<4:0> 428
SMT2CLK — — — — — CSEL<2:0> 427
SMT2CON0 EN — STP WPOL SPOL CPOL SMT2PS<1:0> 424
SMT2CON1 SMT2GO REPEAT — — MODE<3:0> 425
SMT2CPRH SMT2CPR<15:8> 433
SMT2CPRL SMT2CPR<7:0> 433
SMT2CPRU SMT2CPR<23:16> 433
SMT2CPWH SMT2CPW<15:8> 434
SMT2CPWL SMT2CPW<7:0> 434
SMT2CPWU SMT2CPW<23:16> 434
SMT2PRH SMT2PR<15:8> 435
SMT2PRL SMT2PR<7:0> 435
SMT2PRU SMT2PR<23:16> 435
SMT2SIG — — — — — SSEL<2:0> 430
SMT2STAT CPRUP CPWUP RST — — TS WS AS 426
SMT2TMRH SMT2TMR<15:8> 432
SMT2TMRL SMT2TMR<7:0> 432
SMT2TMRU SMT2TMR<23:16> 432
SMT2WIN — — — WSEL<4:0> 427
Legend: x = unknown, u = unchanged, — = unimplemented read as ‘0’, q = value depends on condition. Shaded cells are not used for SMTx module.
Rev. 10-000025E
7/7/2014
LCxOUT
D Q
MLCxOUT
Q1
LCx_in[0]
LCx_in[1] LCx_out
to Peripherals
LCx_in[2]
Input Data Selection Gates(1)
. g1
EN
CLCxPPS
. g2
g3
Logic
Function
(2)
q
PPS CLCx
. g4
POL TRIS
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
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
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
CLC3GLS1 LC3G2D4T LC3G2D4N LC3G2D3T LC3G2D3N LC3G2D2T LC3G2D2N LC3G2D1T LC3G2D1N 456
CLC3GLS2 LC3G3D4T LC3G3D4N LC3G3D3T LC3G3D3N LC3G3D2T LC3G3D2N LC3G3D1T LC3G3D1N 457
CLC3GLS3 LC3G4D4T LC3G4D4N LC3G4D3T LC3G4D3N LC3G4D2T LC3G4D2N LC3G4D1T LC3G4D1N 458
CLC3POL LC3POL — — — LC3G4POL LC3G3POL LC3G2POL LC3G1POL 452
CLC3SEL0 — — LC3D1S<5:0> 453
CLC3SEL1 — — LC3D2S<5:0> 453
CLC3SEL2 — — LC3D3S<5:0> 453
CLC3SEL3 — — LC3D4S<5:0> 454
CLC4CON LC4EN — LC4OUT LC4INTP LC4INTN LC4MODE<2:0> 451
CLC4GLS0 LC4G1D4T LC4G1D4N LC4G1D3T LC4G1D3N LC4G1D2T LC4G1D2N LC4G1D1T LC4G1D1N 455
CLC4GLS1 LC4G2D4T LC4G2D4N LC4G2D3T LC4G2D3N LC4G2D2T LC4G2D2N LC4G2D1T LC4G2D1N 456
CLC4GLS2 LC4G3D4T LC4G3D4N LC4G3D3T LC4G3D3N LC4G3D2T LC4G3D2N LC4G3D1T LC4G3D1N 457
CLC4GLS3 LC4G4D4T LC4G4D4N LC4G4D3T LC4G4D3N LC4G4D2T LC4G4D2N LC4G4D1T LC4G4D1N 458
CLC4POL LC4POL — — — LC4G4POL LC4G3POL LC4G2POL LC4G1POL 452
CLC4SEL0 — — LC4D1S<5:0> 453
CLC4SEL1 — — LC4D2S<5:0> 453
CLC4SEL2 — — LC4D3S<5:0> 453
CLC4SEL3 — — LC4D4S<5:0> 454
INTCON GIE PEIE TMR0IE INTE IOCIE TMR0IF INTF IOCIF 97
PIE3 — — CWGIE ZCDIE CLC4IE CLC3IE CLC2IE CLC1IE 108
PIR3 — — CWGIF ZCDIF CLC4IF CLC3IF CLC2IF CLC1IF 113
TRISA — — TRISA5 TRISA4 —(1) TRISA2 TRISA1 TRISA0 151
TRISB TRISB7 TRISB6 TRISB5 TRISB4 — — — — 158
TRISC TRISC7(2) TRISC6(2) TRISC5 TRISC4 TRISC3 TRISC2 TRISC1 TRISC0 165
Legend: — = unimplemented read as ‘0’,. Shaded cells are not used for CLC module.
Note 1: Unimplemented, read as ‘1’.
2: PIC16(L)F1619 only.
Rev. 10-000245A
ATxRES 1/21/2015
15
Set PERIF
SSEL Divide by Period
ATxRES+1 Counter
R R
ATx_perclk
PRP
LC4_out 111
PREC 15
LC3_out 110 ATxMISS
LC2_out 101
+ Divide by 2
LC1_out 100 Sync ATxsig LD ATxPER Difference
ZCD1_out 011 (2 Clocks)
-
15
C2OUT_sync 010 1 0 APMOD
C1OUT_sync 001
PPS 000 MPP ATx_missedpulse
Comparator
ATxINPPS
PHP
PS 1 Clock
CS Delay
ATx_phsclk
HFINTOSC (16 MHz) 1 Divide by Phase
Prescaler ATxclk
PIC16(L)F1615/9
FOSC 0 ATxPER+1 Counter
R R Set PHSIF
ATxclkcc
10
To Capture/
DS40001770D-page 454
Compare
Instruction
LD ATxPHS
Clock
FIGURE 31-2: ANGULAR TIMER SIMPLIFIED BLOCK DIAGRAM, MULTI-PULSE MODE
DS40001770D-page 455
PIC16(L)F1615/9
Rev. 10-000246A
ATxRES 1/21/2015
15
PREC ATx_perclk
LC4_out 111 PRP
15
LC3_out 110 ATx_missedpulse ATxMISS
ATxperiod
LC2_out 101
+ Divide by 2
LC1_out 100 Missing ATxsig
ATx_in
Pulse Period LD ATxPER Difference
ZCD1_out 011 Trigger -
15
C2OUT_sync 010 1 0 APMOD
C1OUT_sync 001
PPS 000 MPP ATx_missedpulse
Comparator
ATxINPPS
PHP
PS 1 Clock
CS Delay
ATx_phsclk
HFINTOSC (16 MHz) 1 ATxclk Divide by Phase
Prescaler
FOSC 0 ATxPER+1 Counter
R R Set PHSIF
ATxclkcc
2014-2017 Microchip Technology Inc.
10
To Capture/
Compare
Instruction
LD ATxPHS
Clock
FIGURE 31-3: ANGULAR TIMER SIMPLIFIED MULTI-PULSE PERIOD TRIGGER BLOCK DIAGRAM
2014-2017 Microchip Technology Inc.
Rev. 10-000247A
7/25/2014
1 D Q D Q
ATxsig
Atx_in
R
Atxclk
ATxperiod
1 D Q D Q
Atx_missedpulse
R
PIC16(L)F1615/9
DS40001770D-page 456
PIC16(L)F1615/9
31.2.3 MISSING PULSE DETECTION
In both Single-Pulse and Multi-Pulse modes, the AT
module monitors for missing pulses in the following
manner. The latched value of the ATxPER register pair
is continuously subtracted from the value of the period
counter as it counts up. The result of this subtraction is
compared to a third value and a missing pulse event is
generated when the comparison is equal.
The third value is either the ATxMISS register pair or the
ATxPER register pair divided by two. The APMOD bit of
ATxCON0 register (Register 31-1) selects which of
these two values is used.
In Single-Pulse mode, a missing pulse event generates
the missing pulse output of the module as well as
triggering the MISSIF interrupt.
In Multi-Pulse mode, a missing pulse event generates
the output and interrupt, and is also used to determine
the period signal timing.
Rev. 10-000243A
7/25/2014
Input Signal
(case #1: narrow)
Input Signal
(case #2: wide)
ATxPER
ATx_perclk
ATx_phsclk
ATxPHS
Input Signal
ATxPER
PIC16(L)F1615/9
ATx_missedpulse
ATx_perclk
ATx_phsclk
DS40001770D-page 458
ATxPHS
PIC16(L)F1615/9
31.2.5 VALID BIT The actual error can be determined with Equation 31-7.
Several values used by the AT module must be
calculated from external signals. As such, these values EQUATION 31-7:
may be inaccurate for a period of time after the angular
timer starts up. Because of this, the module will not F ATxclk
output signals or trigger interrupts for a period of time period = ---------------------------------------------------------------------
F ATxsig ATxRES + 1
after the module is enabled, or under certain other
conditions that might jeopardize accurate output
values. This output inhibition is indicated by the period – int period + 1
read-only VALID bit of the ATxCON1 being clear. error% = 100 --------------------------------------------------------------
period
The following cases will clear the VALID bit in hardware:
• Any write to ATxRES register pair
• Phase counter overflow (ATxPHS register pair) 31.3 Input and Clock Selection
clocked beyond 0x3FF) The input clock for the AT module can come from either
• In-Circuit Debugger halt the FOSC system clock or the 16 MHz HFINTOSC, and
• EN = 0 is chosen by the CS0 bit of the ATxCLK register. In
• ATxPER register pair = 0 addition, the clock is run through a prescaler that can
• Device Reset be /1, /2, /4, or /8, which is configured by the PS<1:0>
bits of the ATxCON0 register. This prescaled clock is
As long as the VALID bit is cleared, the following then used for all clock operations of the Angular Timer,
occurs: and as such, should be used for all of the equations
• Period clock is not output and associated demonstrated above determining the Angular Timer’s
interrupts do not trigger. behavior.
• Missed pulse is not output and associated The input signal for the AT module can come from a
interrupts do not trigger. variety of sources. The source is selected by the SSEL
• Phase clock is not output and associated bits of the ATxSIG register (Register 31-4).
interrupts do not trigger.
• Phase counter does not increment. 31.4 Module Outputs
• Capture logic does not function and associated
interrupts do not trigger. 31.4.1 ANGLE/PHASE CLOCK OUTPUT
• Compare logic does not function and associated The angle/phase clock signal (ATx_phsclk) can be
interrupts do not trigger. used by the CLC as an input signal to combinational
• Every ATxsig edge latches the period counter into logic. The polarity of this signal is configured by the
the ATxPER register pair, regardless of mode. PHP bit of the ATxCON1 register.
In single-pulse modes, the VALID bit becomes set upon 31.4.2 PERIOD CLOCK OUTPUT
the 3rd active input edge of the signal that latches the
ATxPER register pair. In multi-pulse modes, a missing The period clock signal (ATx_perclk) can be used as an
pulse trigger is also required, ensuring that at least one input clock for the Timer2/4/6 and Signal Measurement
full revolution of the input has occurred. module, as well as an input signal to the CLC for
combinational logic. The polarity of this signal is
An example of the VALID bit in Single-Pulse mode is configured by the PRP bit of the ATxCON1 register
shown in Figure 31-6. (Register 31-2).
31.2.6 DETERMINING ACCURACY 31.4.3 MISSED PULSE OUTPUT
The ATxRES register pair determines the resolution of The missed pulse signal (ATx_missedpulse) can be
the period measurement and, by extension, the used by the CLC as an input signal to combinational
maximum value that the phase counter reaches at the logic. The polarity of this signal is configured by the
end of each input signal period. The interim value, MPP bit of the ATxCON1 register.
ATxPER, used to derive the phase counter is, by nature
of the circuitry, an integer. The ratio of the integer value
obtained by the circuit and the calculated floating point
value is the inherent error of the measurement. When
ATxRES is small then integer rounding results in large
errors. Factors that contribute to large errors include:
• Large values for ATxRES
• Relatively low ATxclk frequency
• Relatively high ATxsig input frequency
Rev. 10-000242A
5/29/2014
ATxRES 4
Input Signal
ATxPER 5 20
Atx_phsclk
ATxPHS 0 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3
VALID
PIC16(L)F1615/9
DS40001770D-page 460
PIC16(L)F1615/9
31.5 Period Set Point and Error The capture event also generates a pulse that can be
Measurement used for the following:
• Trigger an ADC reading
The ATxSTPT register pair controls the period set point
• CLC logic input
of the AT module. The signal period captured in the
• Set the CCyIF bit
ATxPER register pair at every signal input pulse. The
unsigned 15-bit ATxSTPT value is subtracted from the See Section 31.7 “Interrupts” for more details on the
unsigned 15-bit ATxPER value and the signed 16-bit interrupts triggered by the AT module.
result is placed in the ATxERR register pair. The capture input signal source is selected by the
The ATxSTPT value is double buffered requiring an capture/compare’s respective ATxCSELy register
ATxSTPTL value write for the ATxSTPTH value to take (Register 31-22), and its polarity is selected by the
effect. This is done so that all 16 bits update at the ATxCAPyP bit of the ATxCCONy register
same time, thereby avoiding a miscalculation of the (Register 31-21). Note that when in Capture mode, the
error. ATxCCy register pair is read-only.
ATxERR
Rev. 10-000218A
7/25/2014
ATxPHS
FOSC Clock
Set CCyIF(1)
Sync(2)
ATxCCy(1)
CCPyPOL
ATx_cmpy(1)
PPS
ATCCyPPS(1)
Notes 1: This diagram applies to all capture/compare units in the Angular Timer
module. Replace “y” with the appropriate number for all registers/
signals
2: The CCyIF interrupt trigger is synchronized with FOSC unless the
device is in Sleep, in which case this synchronizer is bypassed
Rev. 10-000217A
7/25/2014
CCPyPOL
Compare ATx_cmpy(1)
ATx_clkcc
ATxPHS
Notes 1: This diagram applies to all capture/compare units in the Angular Timer
module. Replace “y” with the appropriate number for all registers/
signals
2: The CCyIF interrupt trigger is synchronized with FOSC unless the
device is in Sleep, in which case this synchronizer is bypassed
TABLE 31-1:
Peripheral Bit Name Prefix
AT1 AT1
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
Note 1: Writing to this register resets VALID bit of the ATxCON1 (Register 31-2); output signals are inhibited for at
least two input cycles.
2: This register is not guarded for atomic access, and should only be accessed while the timer is not running.
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
bit 7-0 RES<7:0>: ATxRES Least Significant bits, the Phase Counter Resolution
Note 1: Writing to this register resets VALID bit of the ATxCON1 (Register 31-2); output signals are inhibited for at
least two input cycles.
2: This register is not guarded for atomic access, and should only be accessed while the timer is not running.
REGISTER 31-7: ATxMISSH: ANGULAR TIMER MISSING PULSE DELAY HIGH REGISTER
R/W-x/u R/W-x/u R/W-x/u R/W-x/u R/W-x/u R/W-x/u R/W-x/u R/W-x/u
MISS<15:8>(1)
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 q = Value depends on condition
bit 7-0 MISS<15:8>(1): Most Significant bits (2’s complement) of ATxMISS. ATxMISS defines the period
counter value at which the missing pulse output becomes valid, based on the difference between the
current counter value and the latched-in value of ATxPER.
Note 1: ATxMISSH is held until ATxMISSL is written. Proper writes of ATxMISS should write to ATxMISSH first,
then ATxMISSL to ensure the value is properly written.
REGISTER 31-8: ATxMISSL: ANGULAR TIMER MISSING PULSE DELAY LOW REGISTER
R/W-x/u R/W-x/u R/W-x/u R/W-x/u R/W-x/u R/W-x/u R/W-x/u R/W-x/u
MISS<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 q = Value depends on condition
bit 7-0 MISS<7:0>: Least Significant bits (2’s complement) of ATxMISS. ATxMISS defines the period counter
value at which the missing pulse output becomes valid, based on the difference between the current
counter value and the latched-in value of ATxPER.
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
bit 7-0 PER<7:0>: Least Significant bits of ATxPER. ATxPER is the measured period value from the period
counter.
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
bit 7-0 PHS<7:0>: Least Significant bits of ATxPHS. ATxPHS is the instantaneous value of the phase
counter.
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
REGISTER 31-17: ATxSTPTH: ANGULAR TIMER SET POINT HIGH REGISTER (1)
U-0 R/W-x/u R/W-x/u R/W-x/u R/W-x/u R/W-x/u R/W-x/u R/W-x/u
— STPT<14:8>
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 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
bit 7-0 STPT<7:0>: Set Point Least Significant bits. ATxSTPT determines the threshold setting that the
period is compared against for error calculation.
REGISTER 31-19: ATxERRH: ANGULAR TIMER SET POINT ERROR VALUE HIGH REGISTER
R-x/x R-x/x R-x/x R-x/x R-x/x R-x/x R-x/x R-x/x
ERR<15:8>
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 q = Value depends on condition
bit 7-0 ERR<15:8>: Most Significant bits of ATxERR. ATxERR is the error of the measured period value
compared to the threshold setting, defined as ATxPER-ATxSTPTP.
REGISTER 31-20: ATxERRL: ANGULAR TIMER SET POINT ERROR VALUE LOW REGISTER
R-x/x R-x/x R-x/x R-x/x R-x/x R-x/x R-x/x R-x/x
ERR<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 q = Value depends on condition
bit 7-0 ERR<7:0>: Least Significant bits of ATxERR. ATxERR is the error of the measured period value
compared to the threshold setting, defined as ATxPER-ATxSTPTP.
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
PIC16(L)F1615/9
Rev. 10-000227A
PIDxSET PIDxK1 3/3/2016
+
Difference Z0 Multiplier
-
PIDxIIN
PIDxK2
+ +
PIDxZ1 Multiplier + Adder + Accumulator PIDxOUT
+
PIDxK3
2014-2017 Microchip Technology Inc.
PIDxZ2 Multiplier
Note 1: After the results of PIDxZ2 are multiplied by PIDxK3 and the result is added to the
accumulator, the current value from PIDxZ1 is loaded into PIDxZ2. The same is true
for PIDxZ1 and the current SET-IN value.
PIC16(L)F1615/9
Within the controller, the input is subtracted from a pre- To operate the module in PID controller mode, perform
programmed set point to get an error value. This error the following steps:
value, along with the previous two error values (if any), 1. Set the MODE<2:0> bits of the PIDxCON regis-
are multiplied by user-input coefficients and the results ter to ‘101’, then set the EN bit of the PIDxCON
of these multiplications are added together to make up register.
the output. If the MODE<2:0> bits of the PIDxCON reg-
2. Write the previously calculated K1, K2, and K3
ister = 101, the PID output is equal to the current output
values to the PIDxK1, PIDxK2, and PIDxK3
added to any previous outputs.
registers, respectively.
The three user-input coefficients (K1, K2, and K3) are 3. Write the desired set point that the input will be
derived from the three classic PID coefficients Kp, Ki, compared against to the PIDxSET registers.
and Kd, and must be calculated prior to using the PID
4. Write the high byte of the value from the external
module.
system to PIDxINH. Then write the low byte of
1. K1 is the coefficient that is multiplied with the the value from the external system to PIDxINL.
current error (SET-IN). It is defined by the following This will begin the calculation and set the BUSY
equation: bit of the PIDxCON register.
5. Either poll the BUSY bit of the PIDxCON register
EQUATION 32-1: to check for it clearing or wait for the PIDxDIF
interrupt to trigger, indicating that the operation
has completed.
Kd 6. Read the PIDxOUT registers for the output
K1 = Kp + Ki T + ------- value. If the PID was in Accumulation mode,
T
PIDxOUT will contain the accumulation of the
output added to the previous outputs, otherwise,
Note: T is the sampling period. it will contain only the latest output.
7. For proper PID operation, this output needs to
be applied to the external system before the
2. K2 is the coefficient that is multiplied with the next input to the PID is applied. This is to ensure
previous iteration’s error (Z1). Where T is the that the system can adjust based on the PID
sampling period, it is defined by the following controller’s feedback before the next calculation
equation: is made.
Note: The BUSY bit of the PIDxCON register
EQUATION 32-2: goes high as soon as PIDxINL is written
and remains high until all computation is
complete. Until the BUSY bit goes low, the
PIDxOUT values are not valid, and none
K2 = – Kp + ----------
2Kd of the registers associated with the PID
T module should be written to, as any such
writes will corrupt the calculation.
FIGURE 32-2: PID MODULE BASIC DATA FLOW BLOCK DIAGRAM, ADD AND MULTIPLY
MODES
Rev. 10-000228A
4/7/2015
0
PIDxACC
PIDxIN PIDxK1
MODE<0> 0 1
+ +
Adder Multiplier + Adder PIDxOUT
+
PIDxSET
All Add and Multiply modes perform operations of the In order to perform an Add and Multiply operation,
following form. perform the following steps:
1. Set the MODE<2:0> bits of the PIDxCON
EQUATION 32-4: register to one of the four Add/Multiply modes,
depending on which form of the calculation is
desired, then set the EN bit of the PIDxCON
OUTPUT = A + B C register.
2. Write the value of C to the PIDxK1H/L register
pair and the value of B to the PIDxSETH/L reg-
Note: A = PIDxIN, B = PICxSET, and C = PIDxK1. ister pair, as well as the high byte of A to the
PIDxINH register.
3. Finally, write the low byte of A to the PIDxINL
The four different Add and Multiply modes are: register. This will begin the mathematical
• MODE<2:0> = 000: Inputs are unsigned, and the operation and set the BUSY bit of the PIDxCON
output does not accumulate register.
• MODE<2:0> = 001: Inputs are unsigned, and the 4. Either poll the BUSY bit of the PIDxCON register
output accumulates with previous outputs to check for it clearing or wait for the PIDxDIF
• MODE<2:0> = 010: Inputs are signed, and the interrupt to trigger, indicating that the operation
output does not accumulate has completed.
• MODE<2:0> = 011: Inputs are signed, and the 5. Read the PIDxOUT registers for the result of the
output accumulates with previous outputs calculation. In accumulation modes, the
PIDxOUT register will hold any previous values
added to the current calculation’s value. In non-
accumulation modes, the PIDxOUT register will
just hold the current calculation’s value.
These modes can also be used to perform 16-bit
addition (by setting the C term in the above equation to
1) or 16-bit multiplication (by setting A or B to 0).
IF (PIR5BITS.PID1EIF==1&&PIE5BITS.PID1EIE==1)
{
//saturate the PID1OUT registers
PID1OUTHH=0xFF;
PID1OUTHL=0xFF;
PID1OUTLH=0xFF;
PID1OUTLL=0xFF;
PID1OUTHH=0xFF;
//clear the interrupt flag
PIR5bits.PID1EIF=0;
}
Legend:
HC = Bit is cleared by hardware HS = Bit is set by hardware
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -m/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared q = Value depends on condition
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
bit 7-0 IN<15:8>: IN upper eight bits. IN is the 16-bit input from the control system to the PID module
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
bit 7-0 IN<7:0>: IN lower eight bits. IN is the 16-bit input from the control system to the PID module
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
bit 7-0 SET<15:8>: SET upper eight bits. SET is the 16-bit user-controlled variable that the input from the control system is
compared against to determine the error in the system
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
bit 7-0 SET<7:0>: SET lower eight bits. SET is the 16-bit user-controlled variable that the input from the control system is
compared against to determine the error in the system
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
bit 7-0 K1<15:8>: K1 upper eight bits. K1 is the 16-bit user-controlled coefficient calculated from Kp + Ki + Kd
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
bit 7-0 K1<7:0>: K1 lower eight bits. K1 is the 16-bit user-controlled coefficient calculated from Kp + Ki + Kd
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
bit 7-0 K2<15:8>: K2 upper eight bits. K2 is the 16-bit user-controlled coefficient calculated from -(Kp + 2Kd)
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
bit 7-0 K2<7:0>: K2 lower eight bits. K2 is the 16-bit user-controlled coefficient calculated from -(Kp + 2Kd)
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
bit 7-0 K3<15:8>: K3 upper eight bits. K3 is the 16-bit user-controlled coefficient calculated from Kd
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
bit 7-0 K3<7:0>: K3 lower eight bits. K3 is the 16-bit user-controlled coefficient calculated from Kd
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
bit 7-0 OUT<31:24>: Bits <31:24> of OUT. OUT is the output value of the PID after completing the designated
calculation on the specified 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 q = Value depends on condition
bit 7-0 OUT<23:16>: Bits <23:16> of OUT. OUT is the output value of the PID after completing the designated
calculation on the specified 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 q = Value depends on condition
bit 7-0 OUT<15:8>: Bits <15:8> of OUT. OUT is the output value of the PID after completing the designated
calculation on the specified 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 q = Value depends on condition
bit 7-0 OUT<7:0>: Bits <7:0> of OUT. OUT is the output value of the PID after completing the designated
calculation on the specified 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 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
bit 7-0 Z1<15:8>: Bits <15:8> of Z1. In PID mode, Z1 is the value of the error (IN minus SET) from the previ-
ous iteration of the PID control loop.
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
bit 7-0 Z1<7:0>: Bits <7:0> of Z1. In PID mode, Z1 is the value of the error (IN minus SET) from the previous
iteration of the PID control loop.
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
bit 7-0 Z2<15:8>: Bits <15:8> of Z2. In PID mode, Z2 is the value of the error (IN minus SET) from the
previous iteration of the PID control loop.
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
bit 7-0 Z2<7:0>: Bits <7:0> of Z2. In PID mode, Z2 is the value of the error (IN minus SET) from the previous
iteration of the PID control loop.
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
bit 7-0 ACC<31:24>: Bits <31:24> of ACC. ACC is the accumulator register in which all of the multiplier
results for the PID are accumulated before being written to the 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 q = Value depends on condition
bit 7-0 ACC<23:16>: Bits <23:16> of ACC. ACC is the accumulator register in which all of the multiplier
results for the PID are accumulated before being written to the 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 q = Value depends on condition
bit 7-0 ACC<15:8>: Bits <15:8> of ACC. ACC is the accumulator register in which all of the multiplier results
for the PID are accumulated before being written to the 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 q = Value depends on condition
bit 7-0 ACC<7:0>: Bits <7:0> of ACC. ACC is the accumulator register in which all of the multiplier results for
the PID are accumulated before being written to the output.
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 33-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.
COMF Complement f
CALLW Subroutine Call With W
Syntax: [ label ] COMF f,d
Syntax: [ label ] CALLW Operands: 0 f 127
Operands: None d [0,1]
Operation: (PC) +1 TOS, Operation: (f) (destination)
(W) PC<7:0>, Status Affected: Z
(PCLATH<6:0>) PC<14:8>
Description: The contents of register ‘f’ are com-
plemented. If ‘d’ is ‘0’, the result is
Status Affected: None stored in W. If ‘d’ is ‘1’, the result is
Description: Subroutine call with W. First, the stored back in register ‘f’.
return address (PC + 1) is pushed
onto the return stack. Then, the con-
tents of W is loaded into PC<7:0>,
and the contents of PCLATH into
PC<14:8>. CALLW is a 2-cycle
instruction.
DECF Decrement f
CLRF Clear f
Syntax: [ label ] DECF f,d
Syntax: [ label ] CLRF f
Operands: 0 f 127
Operands: 0 f 127 d [0,1]
Operation: 00h (f) Operation: (f) - 1 (destination)
1Z
Status Affected: Z
Status Affected: Z
Description: Decrement register ‘f’. If ‘d’ is ‘0’, the
Description: The contents of register ‘f’ are cleared result is stored in the W register. If ‘d’
and the Z bit is set. is ‘1’, the result is stored back in regis-
ter ‘f’.
CLRW Clear W
DECFSZ Decrement f, Skip if 0
Syntax: [ label ] CLRW
Operands: None Syntax: [ label ] DECFSZ f,d
Mode Syntax mm
Preincrement ++FSRn 00
Predecrement --FSRn 01
Postincrement FSRn++ 10
Postdecrement FSRn-- 11
Description: The 7-bit literal ‘k’ is loaded into the Operands: n [0,1]
PCLATH register. mm [00,01, 10, 11]
-32 k 31
Operation: W INDFn
MOVLW Move literal to W Effective address is determined by
• FSR + 1 (preincrement)
Syntax: [ label ] MOVLW k
• FSR - 1 (predecrement)
Operands: 0 k 255 • FSR + k (relative offset)
Operation: k (W) After the Move, the FSR value will be
either:
Status Affected: None • FSR + 1 (all increments)
Description: The 8-bit literal ‘k’ is loaded into W reg- • FSR - 1 (all decrements)
ister. The “don’t cares” will assemble as Unchanged
‘0’s. Status Affected: None
Words: 1
Cycles: 1 Mode Syntax mm
Example: MOVLW 0x5A Preincrement ++FSRn 00
After Instruction Predecrement --FSRn 01
W = 0x5A
Postincrement FSRn++ 10
Postdecrement FSRn-- 11
MOVWF Move W to f
Syntax: [ label ] MOVWF f
Description: This instruction is used to move data
Operands: 0 f 127 between W and one of the indirect
Operation: (W) (f) registers (INDFn). Before/after this
move, the pointer (FSRn) is updated by
Status Affected: None
pre/post incrementing/decrementing it.
Description: Move data from W register to register
‘f’. Note: The INDFn registers are not
physical registers. Any instruction that
Words: 1
accesses an INDFn register actually
Cycles: 1 accesses the register at the address
Example: MOVWF OPTION_REG specified by the FSRn.
Before Instruction
FSRn is limited to the range 0000h -
OPTION_REG = 0xFF
FFFFh. Incrementing/decrementing it
W = 0x4F
beyond these bounds will cause it to
After Instruction
wrap-around.
OPTION_REG = 0x4F
W = 0x4F
The increment/decrement operation on
FSRn WILL NOT affect any Status bits.
Before Instruction
W = 0x07
After Instruction
W = value of k8
Words: 1
Cycles: 1
Example: RLF REG1,0
Before Instruction
REG1 = 1110 0110
C = 0
After Instruction
REG1 = 1110 0110
W = 1100 1100
C = 1
DC = 0 W<3:0> k<3:0>
DC = 1 W<3:0> k<3:0>
TRIS Load TRIS Register with W
Syntax: [ label ] TRIS f
Operands: 5f7
SUBWF Subtract W from f
Operation: (W) TRIS register ‘f’
Syntax: [ label ] SUBWF f,d
Status Affected: None
Operands: 0 f 127
d [0,1] Description: Move data from W register to TRIS
register.
Operation: (f) - (W) destination) When ‘f’ = 5, TRISA is loaded.
Status Affected: C, DC, Z When ‘f’ = 6, TRISB is loaded.
When ‘f’ = 7, TRISC is loaded.
Description: Subtract (2’s complement method) W
register from register ‘f’. If ‘d’ is ‘0’, the
result is stored in the W
register. If ‘d’ is ‘1’, the result is stored
back in register ‘f.
C=0 Wf
C=1 Wf
DC = 0 W<3:0> f<3:0>
DC = 1 W<3:0> f<3:0>
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 35-6: “Thermal Characteris-
tics” to calculate device specifications.
2: Power dissipation is calculated as follows: PDIS = VDD x {IDD – IOH} + {(VDD – VOH) x IOH} + (VOl x IOL).
.
† NOTICE: Stresses above those listed under “Absolute Maximum Ratings” may cause permanent damage to the
device. This is a stress rating only and functional operation of the device at those or any other conditions above those
indicated in the operation listings of this specification is not implied. Exposure above maximum rating conditions for
extended periods may affect device reliability.
Rev. 10-000130B
9/19/2013
5.5
VDD (V)
2.5
2.3
0 16 32
Frequency (MHz)
Note 1: The shaded region indicates the permissible combinations of voltage and frequency.
2: Refer to Table 35-7 for each Oscillator mode’s supported frequencies.
Rev. 10-000131B
9/19/2013
3.6
VDD (V)
2.5
1.8
0 16 32
Frequency (MHz)
Note 1: The shaded region indicates the permissible combinations of voltage and frequency.
2: Refer to Table 35-7 for each Oscillator mode’s supported frequencies.
PIC16F1615/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 32 MHz
D001 2.3 — 5.5 V FOSC 16 MHz
2.5 — 5.5 V FOSC 32 MHz
D002* VDR RAM Data Retention Voltage(1)
1.5 — — V Device in Sleep mode
D002* 1.7 — — V Device in Sleep mode
D002A* VPOR Power-on Reset Release Voltage(2)
— 1.6 — V
D002A* — 1.6 — V
(2)
D002B* VPORR* Power-on Reset Rearm Voltage
— 0.8 — V
D002B* — 1.5 — V
D003 VFVR Fixed Voltage Reference Voltage
— 1.024 — V -40°C TA +85°C
D003 — 1.024 — V -40°C TA +85°C
D003A VADFVR FVR Gain Voltage Accuracy for ADC
1x VFVR, VDD 2.5V
-4 — +4 % 2x VFVR, VDD 2.5V
D003A 1x VFVR, VDD 2.5V
-5 — +5 % 2x VFVR, VDD 2.5V
4x VFVR, VDD 4.75V
D003B VCDAFVR FVR Gain Voltage Accuracy for Comparator/DAC
1x VFVR, VDD 2.5V
-4 — +4 % 2x VFVR, VDD 2.5V
D003B 1x VFVR, VDD 2.5V
-7 — +7 % 2x VFVR, VDD 2.5V
4x VFVR, VDD 4.75V
D004* SVDD VDD Rise Rate(2)
0.05 — — V/ms Ensures that the Power-on Reset
signal is released properly.
D004* 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 35-3, POR and POR REARM with Slow Rising VDD.
VDD
VPOR
VPORR
SVDD
VSS
NPOR(1)
POR REARM
VSS
TVLOW(2) TPOR(3)
PIC16F1615/9
PIC16F1615/9
PIC16F1615/9
D022 Base IPD — 0.25 3.0 10 A 2.3 WDT, BOR, FVR disabled, all
— 0.30 4.0 12 A 3.0 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 disabled, all
— 10.3 18 20 A 3.0 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
D026 — 0.11 1.5 9.0 A 1.8 ADC Current (Note 3),
— 0.12 2.7 10 A 3.0 No conversion in progress
— 280 — — 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.
Legend: TBD = To Be Determined
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.
— 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.
Legend: TBD = To Be Determined
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
D032 MCLR — — 0.2 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
D042 MCLR 0.8 VDD — — V
IIL Input Leakage Current(1)
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(3)
D080 I/O Ports IOL = 8.0 mA, VDD = 5.0V
— — 0.6 V IOL = 6.0 mA, VDD = 3.3V
IOL = 1.8 mA, VDD = 1.8V
D080A High Drive I/O(1) — 2.5V — V IOL = 100 mA, VDD = 5.0V
VOH Output High Voltage(3)
D090 I/O Ports IOH = 3.5 mA, VDD = 5.0V
VDD - 0.7 — — V IOH = 3.0 mA, VDD = 3.3V
IOH = 1.0 mA, VDD = 1.8V
D090A High Drive I/O(1) — 2.5V — V IOL = 100 mA, VDD = 5.0V
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: Negative current is defined as current sourced by the pin.
2: 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.
3: 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 — 32 MHz External Clock (ECH)
OS02 TOSC External CLKIN Period(1) 31.25 — ns External Clock (EC)
OS03 TCY Instruction Cycle Time(1) 200 TCY DC ns TCY = 4/FOSC
* 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 — — 16.0 — MHz (Note 2)
Frequency(1)
OS09 LFOSC Internal LFINTOSC Frequency — — 31 — kHz (Note 3)
OS10 TWARM HFINTOSC — — 5 15 s
Wake-up from Sleep Start-up Time
LFINTOSC — — 0.5 — ms
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 35-6: “HFINTOSC Frequency Accuracy over Device VDD and Temperature”,
3: See Figure 36-43: “LFINTOSC Frequency over VDD and Temperature, PIC16LF1615/9 Only”, and
Figure 36-44: “LFINTOSC Frequency over VDD and Temperature, PIC16F1615/9 Only”.
125
±5%
85
±3%
Temperature (°C)
60
25
±2%
±5%
-40
1.8 2.3 5.5
VDD (V)
Q4 Q1 Q2 Q3
F
OSC
OS11 OS12
OS20
CLKOUT
OS21
OS19 OS18
OS16
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.
V
DD
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
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.
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
AD132
Sample
AD133 1 Tcy
AD131
Q4
AD130
ADC_clk
ADC Data 9 8 7 6 3 2 1 0
ADIF 1 Tcy
GO
DONE
Sampling Stopped
AD132
Sample
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 + 1TCY — ADCS<2:0> = x11 (ADC FRC 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.
Note 1: The ADRES register may be read on the following TCY cycle.
18 300 Max.
IDD (µA)
10
200
8
Typical 180
6
160
4 140
2 120
0 100
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
FIGURE 36-1: IDD, EC Oscillator LP Mode, FIGURE 36-4: IDD, EC Oscillator LP Mode,
Fosc = 32 kHz, PIC16LF1615/9 Only. Fosc = 500 kHz, PIC16F1615/9 Only.
2.5
35
25
16 MHz
1.5
IDD (mA)
IDD (µA)
Typical
20
8 MHz
15 1.0
4 MHz
10
0.5
Max: 85°C + 3ı
5 Typical: 25°C 1 MHz
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
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
VDD (V)
FIGURE 36-2: IDD, EC Oscillator LP Mode, FIGURE 36-5: IDD Typical, EC Oscillator
Fosc = 32 kHz, PIC16F1615/9 Only. MP Mode, PIC16LF1615/9 Only.
6.0
220
Max: 85°C + 3ı
200 Max: 85°C + 3ı 5.0
Typical: 25°C
32 MHz
180 4.0
IDD (mA)
Max.
IDD (µA)
160 3.0
16 MHz
140 2.0
8 MHz
Typical 4 MHz
120
1.0
1 MHz
100
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8 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) VDD (V)
FIGURE 36-3: IDD, EC Oscillator LP Mode, FIGURE 36-6: IDD Maximum, EC Oscillator
Fosc = 500 kHz, PIC16LF1615/9 Only. MP Mode, PIC16LF1615/9 Only.
2.5
25 Max.
32 MHz
IDD (µA)
1.5 16 MHz 15
IDD (mA)
1.0 8 MHz 10
4 MHz
5
0.5
1 MHz
0
0.0 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V) VDD (V)
FIGURE 36-7: IDD Typical, EC Oscillator FIGURE 36-10: IDD Maximum, EC Oscillator
MP Mode, PIC16F1615/9 Only. HP Mode, PIC16LF1615/9 Only.
5.0
32 MHz 70
4.5 Max: 85°C + 3ı
60 Max: 85°C + 3ı
4.0 Typical: 25°C
3.5 50
Max.
3.0
IDD (mA)
40 Typical
IDD (µA)
2.5
16 MHz 30
2.0
1.5 8 MHz 20
4 MHz
1.0
10
1 MHz
0.5
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
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V) VDD (V)
FIGURE 36-8: IDD Maximum, EC Oscillator FIGURE 36-11: IDD Typical, EC Oscillator
MP Mode, PIC16F1615/9 Only. HP Mode, PIC16F1615/9 Only.
12 Max. 80
Max.
70 Max: 85°C + 3ı
10 Max: 85°C + 3ı Typical: 25°C
Typical: 25°C
60
8
50
IDD (µA)
Typical
IDD (µA)
6 Typical
40
30
4
20
2
10
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 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
FIGURE 36-9: IDD Typical, EC Oscillator FIGURE 36-12: IDD Maximum, EC Oscillator
HP Mode, PIC16LF1615/9 Only. HP Mode, PIC16F1615/9 Only.
350 600
Max: 85°C + 3ı
300 Typical: 25°C 500
4 MHz
4 MHz
250
400
IDD (µA)
200
IDD (µA)
300
150 1 MHz
200
100 1 MHz
100
50
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 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
FIGURE 36-13: IDD, LFINTOSC Mode, FIGURE 36-16: IDD, MFINTOSC Mode,
Fosc = 31 kHz, PIC16LF1615/9 Only. Fosc = 500 kHz, PIC16F1615/9 Only.
500
2.5
450
Max: 85°C + 3ı 4 MHz
Typical: 25°C 32 MHz
400
2.0
350
300
IDD (µA)
1.5
IDD (mA)
250
200 16 MHz
1.0
150 1 MHz
100 8 MHz
0.5
50
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 1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8
FIGURE 36-14: IDD, LFINTOSC Mode, FIGURE 36-17: IDD Typical, HFINTOSC
Fosc = 31 kHz, PIC16F1615/9 Only. Mode, PIC16LF1615/9 Only.
400 4.0
250 2.5
IDD (µA)
IDD (mA)
200 2.0
1 MHz 16 MHz
150 1.5
100 1.0
8 MHz
50 0.5
0 0.0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.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
FIGURE 36-15: IDD, MFINTOSC Mode, FIGURE 36-18: IDD Maximum, HFINTOSC
Fosc = 500 kHz, PIC16LF1615/9 Only. Mode, PIC16LF1615/9 Only.
2.5 2.0
32 MHz
1.8 Max: 85°C + 3ı
Typical: 25°C
20 MHz
2.0 1.6
1.4 16 MHz
1.5 1.2
IDD (mA)
IDD (mA)
16 MHz
1.0
8 MHz
0.6
0.5 0.4
4 MHz
0.2
0.0 0.0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8
FIGURE 36-19: IDD Typical, HFINTOSC FIGURE 36-22: IDD Maximum, HS Oscillator,
Mode, PIC16F1615/9 Only. PIC16LF1615/9 Only.
, ,
2
4.0 20 MHz
1.8
32 MHz
Max: 85°C + 3ı
3.5 16 MHz
1.6
3.0 1.4
1.2
2.5
IDD (mA)
IDD (mA)
1 8 MHz
16 MHz
2.0
0.8
1.5
8 MHz 0.6
1.0 0.4
4 MHz
0.5 0.2
0
0.0 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
VDD (V)
FIGURE 36-20: IDD Maximum, HFINTOSC FIGURE 36-23: IDD Typical, HS Oscillator,
Mode, PIC16F1615/9 Only. 25°C, PIC16F1615/9 Only.
2 2.1
Max: 85°C + 3ı 20 MHz
1.8
1.8
20 MHz
1.6 16 MHz
1.4 1.5
1.2 16 MHz
1.2
IDD (mA)
IDD (mA)
1 8 MHz
0.9
0.8 8 MHz
0.6 4 MHz
0.6
0.4
0.3
0.2 4 MHz
0 0.0
2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
FIGURE 36-21: IDD Typical, HS Oscillator, FIGURE 36-24: IDD Maximum, HS Oscillator,
25°C, PIC16LF1615/9 Only. PIC16F1615/9 Only.
4.5
1.2
4.0 Max.
Max
1
3.5
3.0 0.8
Typical
IPD (µA)
2.5
IDD (mA)
Max: 85°C + 3ı
0.6 Typical: 25°C
2.0
1.5 0.4
Typical
1.0
Typical: 25°C 0.2
0.5 Max: 85°C + 3ı
0.0 0
2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
FIGURE 36-25: IDD, HS Oscillator, 32 MHz FIGURE 36-28: IPD Base, LP Sleep Mode
(8 MHz + 4x PLL), PIC16LF1615/9 Only. (VREGPM = 1), PIC16F1615/9 Only.
4.5 35
Max: 85°C + 3ı
4.0 Max Typical: 25°C
30
3.5
Max.
3.0 25
Typical
IPD (nA)
2.5
IDD (mA)
20
2.0
Typical
1.5 15
1.0
10
Typical: 25°C
0.5 Max: 85°C + 3ı
0.0 5
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.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
FIGURE 36-26: IDD, HS Oscillator, 32 MHz FIGURE 36-29: IPD, Fixed Voltage Reference
(8 MHz + 4x PLL), PIC16F1615/9 Only. (FVR), PIC16LF1615/9 Only.
450 35
400 Max.
Max. 30
350
25
300
Typical
IPD (nA)
IPD (nA)
250 20
0
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8 0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
VDD (V)
11 1.8
9
1.2
IPD (nA)
Typical
IPD (µA)
8 1.0
0.8
7
0.6
6 Typical
0.4
5 0.2
4 0.0
2.9 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 2.8 3.0 3.2 3.4 3.6 3.8 4.0 4.2 4.4 4.6 4.8 5.0 5.2 5.4 5.6
FIGURE 36-31: IPD, Brown-Out Reset FIGURE 36-34: IPD, LP Brown-Out Reset
(BOR), BORV = 1, PIC16LF1615/9 Only. (LPBOR = 0), PIC16F1615/9 Only.
7
13
Max: 85°C + 3ı Max: 85°C + 3ı
12 Typical: 25°C 6 Typical: 25°C
Max. Max.
11
5
10
IPD (µA)
4
9
IPD (nA)
Typical
8 3
Typical
7
2
6
1
5
4 0
2.8 3.0 3.2 3.4 3.6 3.8 4.0 4.2 4.4 4.6 4.8 5.0 5.2 5.4 5.6 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)
VDD (V)
FIGURE 36-32: IPD, Brown-Out Reset FIGURE 36-35: IPD, Timer1 Oscillator,
(BOR), BORV = 1, PIC16F1615/9 Only. FOSC = 32 kHz, PIC16LF1615/9 Only.
1.8 12
Max: 85°C + 3ı
1.6 Max.
Typical: 25°C
10
1.4
Max.
1.2 8
Max: 85°C + 3ı
IPD (µA)
1 Typical: 25°C
IPD (nA)
6
0.8 Typical
0.6 4
Typical
0.4
2
0.2
0 0
2.9 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
FIGURE 36-33: IPD, LP Brown-Out Reset FIGURE 36-36: IPD, Timer1 Oscillator,
(LPBOR = 0), PIC16LF1615/9 Only. FOSC = 32 kHz, PIC16F1615/9 Only.
800
500
Max: -40°C + 3ı
Typical: 25°C Max.
450 Max: 85°C + 3ı
Typical: 25°C 700
Max.
400
350 600
300 Typical
IPD(µA)
IPD (nA)
500
250
200
400
150
100 300
Typical
50
200
0 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.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)
VDD (V)
FIGURE 36-37: IPD, ADC Non-Converting, FIGURE 36-40: IPD, Comparator, NP Mode
PIC16LF1615/9 Only. (CxSP = 1), PIC16F1615/9 Only.
6
Graph represents 3ı Limits
1.4
Max: 85°C + 3ı 5
1.2 Typical: 25°C
Max.
4
1
VOH (V)
-40°C
IPD(µA)
0.8 3
0.6 125°C
2 Typical
0.4
Typical
1
0.2
0 0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 -30 -25 -20 -15 -10 -5 0
IOH (mA)
VDD (V)
FIGURE 36-38: IPD, ADC Non-Converting, FIGURE 36-41: VOH vs. IOH Over
PIC16F1615/9 Only. Temperature, VDD = 5.0V, PIC16F1615/9 Only.
800 5
600
3
Typical
IPD(µA)
VOL (V)
500 -40°C
2 Typical
400
125°C
1
300
200 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 0 10 20 30 40 50 60 70 80
IOL (mA)
VDD (V)
6 3.0
4 2.0
VOL (V)
-40°C
VOH (V)
3 1.5 Typical
Min. (-40°C)
125°C
2 Typical (25°C) Max. (85°C) 1.0
1 0.5
0 0.0
-200 -180 -160 -140 -120 -100 -80 -60 -40 -20 0 0 5 10 15 20 25 30
FIGURE 36-43: VOH vs. IOH Over FIGURE 36-46: VOL vs. IOL Over
Temperature for High Drive Pins, VDD = 5.0V, Temperature, VDD = 3.0V.
PIC16F1615/9 Only.
2.0
Graph represents 3ı Limits
1.8
5
1.6
VOH (V)
1.0 125°C
Max. (125°C) Typical (25°C)
3
0.8
VOL (V)
Typical
0.6 -40°C
0.2
1
0.0
-4.0 -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0
0 IOH (mA)
0 20 40 60 80 100 120 140 160 180 200
IOL (mA) FIGURE 36-47: VOH vs. IOH Over
Temperature, VDD = 1.8V, PIC16LF1615/9 Only.
FIGURE 36-44: VOL vs. IOL Over
Temperature for High Drive Pins, VDD = 5.0V,
1.8
PIC16F1615/9 Only. Graph represents 3ı Limits
1.6
1.4
3.5
1.2
Graph represents 3ı Limits
3.0
Vol (V)
1.0
125°C Typical
2.5 0.8
-40°C
0.6
2.0
VOH (V)
0.4
1.5
125°C
0.2
Typical
1.0 0.0
0 1 2 3 4 5 6 7 8 9 10
-40°C
0.5 IOL (mA)
40,000 24
38,000
Max. 22
Max.
36,000
20
34,000
Typical
Time (ms)
Frequency (Hz)
32,000 18
Typical
30,000
Min. 16
28,000
Min.
26,000 14
20,000 10
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8 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)
VDD (V)
40,000 2.00
38,000
Max.
Max.
36,000
1.95
34,000
Typical
Typical
Voltage (V)
Frequency (Hz)
32,000
30,000 1.90
Min.
28,000 Min.
26,000
1.85
24,000 Max: Typical + 3ı
Max: Typical + 3ı (-40°C to +125°C) Typical: statistical mean
22,000 Typical; statistical mean @ 25°C Min: Typical - 3ı
Min: Typical - 3ı (-40°C to +125°C)
20,000 1.80
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 -60 -40 -20 0 20 40 60 80 100 120 140
Temperature (°C)
( C)
VDD (V)
70
22
Max: Typical + 3ı
Max.
60 Typical: statistical mean
Min: Typical - 3ı
20
50 Max.
Time (ms)
18
Typical
Voltage (mV)
40
16
Min. 30
14 Typical
2.60 80
Max: Typical + 3ı
70 Typical: statistical mean
2.55 Min: Typical - 3ı
Max. Max.
Typical 60
2.50
50
Voltage (V)
Voltage (mV)
Min. Typical
2.45 40
30
2.40
Max: Typical + 3ı
20
Typical: statistical mean
2.35 Min: Typical - 3ı Min.
10
2.30 0
-60 -40 -20 0 20 40 60 80 100 120 140 -60 -40 -20 0 20 40 60 80 100 120 140
FIGURE 36-55: Brown-Out Reset Voltage, FIGURE 36-58: Brown-Out Reset Hysteresis,
Low Trip Point (BORV = 1), PIC16F1615/9 Only. High Trip Point (BORV = 0).
70.0 2.7
Max: Typical + 3ı Max: Typical + 3ı
Typical: statistical mean 2.6 Typical: statistical mean
60.0 Min: Typical - 3ı Min: Typical - 3ı Max.
Max. 2.5
50.0 2.4
Voltage (V)
Voltage (mV)
2.3
40.0
Typical 2.2
30.0 Typical
2.1
20.0 2.0
Min. 1.9
Min.
10.0
1.8
0.0 1.7
-60 -40 -20 0 20 40 60 80 100 120 140 -60 -40 -20 0 20 40 60 80 100 120 140
FIGURE 36-56: Brown-Out Reset Hysteresis, FIGURE 36-59: LPBOR Reset Voltage.
Low Trip Point (BORV = 1), PIC16F1615/9 Only.
50
30
25
Voltage (V)
2.75
Typical
20
Typical
2.70 Min. 15
10
2.65 5
0
-60 -40 -20 0 20 40 60 80 100 120 140
2.60
-60 -40 -20 0 20 40 60 80 100 120 140 Temperature (°C)
1.58
1.58
100
Max: Typical + 3ı (-40°C to +125°C)
Max: Typical + 3ı
Typical; statistical mean @ 25°C 1.56 Typical: 25°C
1.56 Min: Typical - 3ı
90 Min: Typical - 3ı (-40°C to +125°C)
Max.
Max.
1.54
1.54
(V) (V)
80
Typical
Voltage
1.52
Time (ms)
1.52
Typical
Voltage
70 1.5
1.50
Min. Min.
60 1.48
1.48
1.46
Max: Typical + 3ı 0
50 1.46 -40 Typical:-20
statistical mean
20 40 60 80 100 120
40 1.44
2 2.5 3 3.5 4 4.5 5 5.5 6 -50 -25 0 25 50 75 100 125 150
Temperature (°C)
VDD (V)
100 1.4
Max: Typical + 3ı (-40°C to +125°C)
Typical; statistical mean @ 25°C 1.3
Min: Typical - 3ı (-40°C to +125°C)
90 Max.
Max. 1.2
80
1.1
Voltage (V)
Time (ms)
Typical
Typical 1.0
70
0.9
60 Min.
Min.
0.8
50 Max: Typical + 3ı
0.7 Typical: statistical mean
Min: Typical - 3ı
40 0.6
1.6 1.8 2 2.2 2.4 2.6 2.8 3 3.2 3.4 3.6 3.8 -50 -25 0 25 50 75 100 125 150
Temperature (°C)
VDD (V)
12
1.70
Max: Typical + 3ı (-40°C to +125°C)
Typical; statistical mean @ 25°C
1.68 Min: Typical - 3ı (-40°C to +125°C)
10
Max.
1.66
1.64 8
Typical
Time (µs)
Voltage (V)
1.62 Max.
6
1.60
Min. Typical
1.58
4
1.56
1.54 2
Max: Typical + 3ı
Typical: statistical mean
1.52 Min: Typical - 3ı
0
1.50 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
-50 -25 0 25 50 75 100 125 150
VDD (V)
Temperature (°C)
FIGURE 36-63: POR Release Voltage. FIGURE 36-66: Wake From Sleep,
VREGPM = 0.
1.0
50
45
40
Max. 0.5
35
DNL (LSb)
Time (µs)
30
Typical
0.0
25
20
15
-0.5
10 Max: Typical + 3ı (-40°C to +125°C)
Typical; statistical mean @ 25°C
5 Min: Typical - 3ı (-40°C to +125°C)
0 -1.0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 0 128 256 384 512 640 768 896 1024
Output Code
VDD (V)
FIGURE 36-67: Wake From Sleep, FIGURE 36-70: ADC 10-bit Mode,
VREGPM = 1. Single-Ended DNL, VDD = 3.0V, TAD = 4 S, 25°C.
1.0
40
Max: Typical + 3ı
Typical: statistical mean @ 25°C
35
0.5
Max.
30
INL (LSb)
Time (µs)
Typical 0.0
25
20
-0.5
Note:
15 The FVR Stabiliztion Period applies when coming out of RESET
or exiting sleep mode.
-1.0
10
0 128 256 384 512 640 768 896 1024
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8
FIGURE 36-68: FVR Stabilization Period, FIGURE 36-71: ADC 10-bit Mode,
PIC16LF1615/9 Only. Single-Ended INL, VDD = 3.0V, TAD = 1 S, 25°C.
2.0
1.0
1.0
1.5
1.0
0.5 0.5
0.5
(LSb)(LSb)
0.0
DNL (LSb)
INL DNL
-0.5
0.0 0.0
-1.0
-1.5
-0.5 -0.5
-2.0
0 512 1024 1536 2048 2560 3072 3584 4096
Output Code
-1.0 -1.0
0 128 256 384 512 640 768 896 1024 0 128 256 384 512 640 768 896 1024
FIGURE 36-69: ADC 10-bit Mode, FIGURE 36-72: ADC 10-bit Mode,
Single-Ended DNL, VDD = 3.0V, TAD = 1 S, 25°C. Single-Ended INL, VDD = 3.0V, TAD = 4 S, 25°C
2
2.5
2 1.5
Max -40C
1 Max 125C
1.5
Min 125C
Max 25C
1 0.5
Min -40C
0.5 0
DNL (LSB)
Min 25C
INL (LSB)
Min -40C
0 -0.5
Min 25C
Min 25C
-0.5 -1
Min 125C Min 125C
-1 -1.5
Min -40C
-1.5 -2
-2 -2.5
DC 10-BIT
-2.5 MODE, SINGLE-ENDED INL, Vdd = 3.0V, VREF = 3.0V, -3
5.00E-07 1.00E-06 2.00E-06 4.00E-06 8.00E-06 1.8 2.3 3
TADs VREF
FIGURE 36-73: ADC 10-bit Mode, FIGURE 36-76: ADC 10-bit Mode,
Single-Ended DNL, VDD = 3.0V, VREF = 3.0V. Single-Ended INL, VDD = 3.0V, TAD = 1 S.
2 800
ADC VREF+ SET TO VDD
ADC VREF- SET TO GND
1.5 700
Max.
Max -40C
1 600
Max 125C Typical
0 400
Min 25C
Min -40C 300
-0.5
0
-2 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
5.00E-07 1.00E-06 2.00E-06 4.00E-06 8.00E-06
TADs VDD (V)
FIGURE 36-74: ADC 10-bit Mode, FIGURE 36-77: Temp. Indicator Initial Offset,
Single-Ended INL, VDD = 3.0V, VREF = 3.0V. High Range, Temp. = 20°C, PIC16F1615/9 Only.
2 900
ADC VREF+ SET TO VDD
ADC VREF- SET TO GND Max.
Max 125C
1.5
800 Typical
Max 25C
700
0.5
ADC Output Codes
DNL (LSB)
600
0
Min -40C
-0.5 500
Min 25C
-1 Max: Typical + 3ı
Min 125C 400 Typical; statistical mean
Min: Typical - 3ı
-1.5
300
-2 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
1.8 2.3 3
VDD (V)
VREF
FIGURE 36-75: ADC 10-bit Mode, FIGURE 36-78: Temp. Indicator Initial Offset,
Single-Ended DNL, VDD = 3.0V, TAD = 1 S. Low Range, Temp. = 20°C, PIC16F1615/9 Only.
800 150
ADC VREF+ SET TO VDD ADC VREF+ SET TO VDD Max.
ADC VREF- SET TO GND 125 ADC VREF- SET TO GND
700 Max. Typical
100
Typical
600 Min.
Min. 75
500 50
25
400
0
300
-25
Max: Typical + 3ı
200 Max: Typical + 3ı
-50 Typical; statistical mean
Typical; statistical mean
Min: Typical - 3ı
Min: Typical - 3ı
100 -75
1.5 1.8 2.1 2.4 2.7 3.0 3.3 3.6 3.9 -50 -25 0 25 50 75 100 125 150
FIGURE 36-79: Temp. Indicator Initial Offset, FIGURE 36-82: Temp. Indicator Slope
Low Range, Temp. = 20°C, PIC16LF1615/9 Only. Normalized to 20°C, Low Range, VDD = 3.0V,
PIC16F1615/9 Only.
150
ADC VREF+ SET TO VDD Max.
ADC VREF- SET TO GND 250
125 Typical
ADC VREF+ SET TO VDD Max.
ADC VREF- SET TO GND
100 200 Typical
Min.
75 150
Min.
ADC Output Codes
50 100
ADC Output Codes
25 50
0 0
-25
-50
Max: Typical + 3ı
Typical; statistical mean
-50 Max: Typical + 3ı
Min: Typical - 3ı -100
Typical; statistical mean
-75 Min: Typical - 3ı
-50 -25 0 25 50 75 100 125 150 -150
Temperature (°C)
( C) -50 -25 0 25 50 75 100 125 150
Normalized to 20°C, High Range, VDD = 5.5V, FIGURE 36-83: Temp. Indicator Slope
PIC16F1615/9 Only. Normalized to 20°C, Low Range, VDD = 1.8V,
PIC16LF1615/9 Only.
250
ADC VREF+ SET TO VDD 150
Max.
ADC VREF- SET TO GND
200 ADC VREF+ SET TO VDD Max.
Typical
ADC VREF- SET TO GND
Typical
150 Min. 100
Min.
100
ADC Output Codes
50
50
0
0
-50
Max: Typical + 3ı
-100 -50
Typical; statistical mean
Max: Typical + 3ı
Min: Typical - 3ı
Typical; statistical mean
-150 Min: Typical - 3ı
-50 -25 0 25 50 75 100 125 150 -100
-50 -25 0 25 50 75 100 125 150
Temperature (°C)
( C)
Temperature (°C)
( C)
FIGURE 36-81: Temp. Indicator Slope
FIGURE 36-84: Temp. Indicator Slope
Normalized to 20°C, High Range, VDD = 3.0V,
Normalized to 20°C, Low Range, VDD = 3.0V,
PIC16F1615/9 Only.
PIC16LF1615/9 Only.
250 30
ADC VREF+ SET TO VDD Max.
ADC VREF- SET TO GND 25
200
Typical Max.
20
150
Min.
15
50 5
0
0 Min.
-5
-50
-10
Max: Typical + 3ı
-100 Typical; statistical mean -15
Min: Typical - 3ı
-20
-150
0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5
-50 -25 0 25 50 75 100 125 150
FIGURE 36-85: Temp. Indicator Slope FIGURE 36-88: Comparator Offset, NP Mode
Normalized to 20°C, High Range, VDD = 3.6V, (CxSP = 1), VDD = 3.0V, Typical Measured Values
PIC16LF1615/9 Only. From -40°C to 125°C.
45 50
43
-40°C 45
41 -40°C
39
Hysteresis (mV)
40
Hysteresis (mV)
25°C
25°C
37 85°C 85°C
35 35 125°C
125°C
33
30
31
29 25
27
25 20
0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
30
30
25
25
20 Max.
20
Max. 15
Hysteresis (mV)
15
Offset Voltage (mV)
10
10
5
5
0
Min.
0
Min. -5
-5
-10
-10
-15
-15
-20
-20 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5
Common Mode Voltage (V)
Common Mode Voltage (V)
FIGURE 36-90: Comparator Offset, NP Mode
FIGURE 36-87: Comparator Offset, NP Mode
(CxSP = 1), VDD = 5.0V, Typical Measured Values
(CxSP = 1), VDD = 3.0V, Typical Measured Values
at 25°C, PIC16F1615/9 Only.
at 25°C.
1,400
40
Max: Typical + 3ı (-40°C to +125°C)
1,200 Typical; statistical mean @ 25°C
Min: Typical - 3ı (-40°C to +125°C)
30
Max.
1,000
Offset Voltage (mV)
20
Time (ns)
800
10
600
0 400
Min. Max.
-20 0
0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 1.5 2.0 2.5 3.0 3.5 4.0
VDD (V)
Common Mode Voltage (V)
FIGURE 36-91: Comparator Offset, NP Mode FIGURE 36-94: Comparator Output Filter
(CxSP = 1), VDD = 5.5V, Typical Measured Values Delay Time Over Temp., NP Mode (CxSP = 1),
From -40°C to 125°C, PIC16F1615/9 Only. Typical Measured Values, PIC16LF1615/9 Only.
TYPICAL MEASURED VALUES
140 800
600
100
500
Time (ns)
Time (ns)
80
400
60
Max.
300
40 Typical
200 Max.
Min.
Typical
20
100
Min.
0 0
1.5 2.0 2.5 3.0 3.5 4.0 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
9''
VDD (V)
FIGURE 36-92: Comparator Response Time FIGURE 36-95: Comparator Output Filter
Over Voltage, NP Mode (CxSP = 1), Typical Delay Time Over Temp., NP Mode (CxSP = 1),
Measured Values, PIC16LF1615/9 Only. Typical Measured Values, PIC16F1615/9 Only.
0.025
90
60 0.01
Time (ns)
DNL (LSb)
50 0.005
-40°C
Max. 25°C
40 0
Typical 85°C
30 -0.005 125°C
Min.
20 -0.01
10 -0.015
0
-0.02
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
0 16 32 48 64 80 96 112 128 144 160 176 192 208 224 240
VDD (V) Output Code
FIGURE 36-93: Comparator Response Time FIGURE 36-96: Typical DAC DNL Error,
Over Voltage, NP Mode (CxSP = 1), Typical VDD = 3.0V, VREF = External 3V.
Measured Values, PIC16F1615/9 Only.
0.00
24
-0.05
22
Max.
-0.10
20
-0.15
DNL (LSb)
18
Typical
INL (LSb)
-0.20
-40°C 16
25°C
-0.25
85°C 14
Min. Max: Typical + 3ı (-40°C to +125°C)
-0.30 125°C Typical; statistical mean @ 25°C
12 Min: Typical - 3ı (-40°C to +125°C)
-0.35
10
1.6 1.8 2 2.2 2.4 2.6 2.8 3 3.2 3.4 3.6 3.8
-0.40
VREF (V)
-0.45
0 14 28 42 56 70 84 98 112126140154168182196210224238252
Output Code
FIGURE 36-97: Typical DAC INL Error, FIGURE 36-100: DAC INL Error, VDD = 3.0V.
VDD = 3.0V, VREF = External 3V.
0.45
0.4
0.4
0.020
0.35 Vref = Int. Vdd
DNL (LSb)
0.015 0.3
0.3 Vref = Ext. 1.8V
DNL (LSb)
0.010 Vref = Ext. 1.8V
Absolute
0.2 Vref = Ext. 3.0V
Vref = Ext. 2.0V
0.15
0.2
Absolute
Vref = Ext. 3.0V
DNL (LSb)
0.005
-40°C 0.1
25°C 0.05
0.000
85°C
0.10
125°C -50 0 50 100 150
-0.005 0
-0.010
0.0
-60 -40 -20 0 20 40 60 80 100 120 140
-0.015 Temperature (°C)
0 14 28 42 56 70 84 98 112126140154168182196210224238252
Output Code FIGURE 36-101: Absolute Value of DAC DNL
FIGURE 36-98: Typical DAC INL Error, Error, VDD = 3.0V, VREF = VDD.
VDD = 5.0V, VREF = External 5V, PIC16F1615/9
Only. 0.90
-2.1
-2.3
0.88 Vref = Int. Vdd
INL (LSb)
0.00
-2.5 Vref = Ext. 1.8V
-2.7
Absolute
-3.1 125
-0.15
-3.3
INL (LSb)
-0.20 0.82
-40°C
25°C -3.5
-0.25 0.0 1.0 2.0 3.0 4.0 5.0
85°C 0.80 0
-0.30 125°C
-0.35 0.78
-60.0 -40.0 -20.0 0.0 20.0 40.0 60.0 80.0 100.0 120.0 140.0
-0.40 Temperature (°C)
0.30
0.3 25 Max.
0.15
IDD (µA)
0.22 25 15
Absolute
125
10
0.18
0.05
0
5
0.14 0.0 1.0 2.0 3.0 4.0 5.0 6.0
0
0
0.10 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
-60.0 -40.0 -20.0 0.0 20.0 40.0 60.0 80.0 100.0 120.0 140.0
Temperature (°C) VDD (V)
FIGURE 36-103: Absolute Value of DAC DNL FIGURE 36-106: ZCD Response Time over
Error, VDD = 5.0V, VREF = VDD, PIC16F1615/9 Voltage Typical Measured Values.
Only.
8.00
5.5V
3.0V
-2.3
0.88 Vref = Int. Vdd
4.00
INL (LSb)
25 1.8V
-2.9 Vref = Ext. 5.0V
85
0.84 0.00
Absolute
-3.1 125
0.00 0.50 1.00 1.50 2.00
-3.3
0.82 -2.00
-3.5
0.0 1.0 2.0 3.0 4.0 5.0 6.0
0.8 0 -4.00
ZCD Pin Voltage (V)
0.78
-60.0 -40.0 -20.0 0.0 20.0 40.0 60.0 80.0 100.0 120.0 140.0
Temperature (°C) FIGURE 36-107: ZCD Pin Current over ZCD
FIGURE 36-104: Absolute Value of DAC INL Pin Voltage, Typical Measured Values from
Error, VDD = 5.0V, VREF = VDD, PIC16F1615/9 -40°C to 125°C.
Only.
1.00
0.90
0.85
0.80
0.80 0.70
Time (us)
0.60
ZCD Pin Voltage (V)
-40°C
0.75 0.50
0.40
25°C
0.70 1.8V
0.30
2.3V
0.20 3.0V
85°C
0.65 5.5V
0.10
125°
30.00 80.00 130.00 180.00 230.00 280.00 330.00 380.00 430.00
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
XXXXXXXXXXXXXX PIC16F1614
XXXXXXXXXXXXXX \P e3
YYWWNNN 1410017
XXXXXXXXXXX PIC16F1614
XXXXXXXXXXX \SL e3
YYWWNNN 1410017
XXXXXXXX F1614ST
YYWW 1410
NNN 017
Note: In the event the full Microchip part number cannot be marked on one line, it will
be carried over to the next line, thus limiting the number of available
characters for customer-specific information.
XXXXXXXXXXXXXXXXX PIC16F1618
XXXXXXXXXXXXXXXXX \P e3
YYWWNNN 1420123
PIC16F1618
/SO e3
1420123
PIC16F1618
/SS e3
1420123
PIC16
F1618
PIN 1 PIN 1
/ML e3
420123
PIC16
F1618
PIN 1 PIN 1
/ML e3
420123
6(
)#(
$(
7%, #*##(
!
7
'
(
(%(
((588,,,)
)8
7
NOTE 1
E1
1 2 3
A A2
L c
A1
b1
b e eB
9 (# :.;0
)# < ) (# : := >
:$)+'! # :
! (
4.
(( ! ? ?
%%!
7
7## 3 / 3
4#(( ! 3 ? ?
$%(
$%@ %(
0 / /3
%%!
7@ %(
0 3 B
="<(
/3 3 3
(( ! < 3 / 3
<%
7##
B 3
9<%@ %(
+ 3 D
<,<%@ %(
+ B
=",
- 4 ? ? /
! " #$ %&'($)"*+$()$#(+
(%, (
(
(
%
- '
(.
( #(
/ )# #%0%(
$%)%'#
($# #%'#
($# ##
(&
%1# %
)# %(
023
4.54#
)#
(
&
("$#
,, (
$((
#
, .34
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
6(
)#(
$(
7%, #*##(
!
7
'
(
(%(
((588,,,)
)8
7
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
!
6(
)#(
$(
7%, #*##(
!
7
'
(
(%(
((588,,,)
)8
7
NOTE 1 E1
1 2 3
A A2
L
c
A1
b1
b e eB
9 (# :.;0
)# < ) (# : := >
:$)+'! # :
! (
4.
(( ! ? ?
%%!
7
7## 3 / 3
4#(( ! 3 ? ?
$%(
$%@ %(
0 / / /3
%%!
7@ %(
0 3 B
="<(
B / D
(( ! < 3 / 3
<%
7##
B 3
9<%@ %(
+ 3 D
<,<%@ %(
+ B
=",
- 4 ? ? /
! " #$ %&'($)"*+$()$#(+
(%, (
(
(
%
- '
(.
( #(
/ )# #%0%(
$%)%'#
($# #%'#
($# ##
(&
%1# %
)# %(
023
4.5 4#
)#
(
&
("$#
,, (
$((
#
, .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
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
!
"#$% " &
"" '( ""&
6(
)#(
$(
7%, #*##(
!
7
'
(
(%(
((588,,,)
)8
7
D
N
E1
NOTE 1
1 2
e
b
c
A A2
φ
A1
L1 L
9 (# <<00
)# < ) (# : := >
:$)+'! # :
! (
D34.
=";
( ? ?
%%!
7
7## D3 3 B3
(%'' 3 ? ?
="@ %(
0 B B
%%!
7@ %(
0 3 3/ 3D
="<(
D 3
6(<(
< 33 3 3
6( ( < 306
<%
7##
? 3
6( ^ ^ B^
<%@ %(
+ ? /B
! " #$ %&'($)"*+$()$#(+
(%, (
(
(
%
)# #%0%(
$%)%'#
($# #%'#
($# ##
(&
%))# %
/ )# %(
023
4.5 4#
)#
(
&
("$#
,, (
$((
#
065 '
)# *$#$, (
$((
*' ')( $##
, .4
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
16-Lead Plastic Quad Flat, No Lead Package (ML) - 4x4x0.9mm Body [QFN]
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
D A B
N
NOTE 1
2
E
(DATUM B)
(DATUM A)
2X
0.15 C
2X
0.15 C TOP VIEW
0.10 C
C A1
A
SEATING
PLANE 16X
(A3) 0.08 C
SIDE VIEW
0.10 C A B
D2
0.10 C A B
E2
2
e
2
1
NOTE 1
K
N
0.40 16X b
e 0.10 C A B
BOTTOM VIEW
Microchip Technology Drawing C04-127D Sheet 1 of 2
16-Lead Plastic Quad Flat, No Lead Package (ML) - 4x4x0.9mm Body [QFN]
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
Units MILLIMETERS
Dimension Limits MIN NOM MAX
Number of Pins N 16
Pitch e 0.65 BSC
Overall Height A 0.80 0.90 1.00
Standoff A1 0.00 0.02 0.05
Contact Thickness A3 0.20 REF
Overall Width E 4.00 BSC
Exposed Pad Width E2 2.50 2.65 2.80
Overall Length D 4.00 BSC
Exposed Pad Length D2 2.50 2.65 2.80
Contact Width b 0.25 0.30 0.35
Contact Length L 0.30 0.40 0.50
Contact-to-Exposed Pad K 0.20 - -
Notes:
1. Pin 1 visual index feature may vary, but must be located within the hatched area.
2. Package is saw singulated
3. Dimensioning and tolerancing per ASME Y14.5M
BSC: Basic Dimension. Theoretically exact value shown without tolerances.
REF: Reference Dimension, usually without tolerance, for information purposes only.
Microchip Technology Drawing C04-127D Sheet 2 of 2
16-Lead Plastic Quad Flat, No Lead Package (ML) - 4x4x0.9mm Body [QFN]
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
!
) *
+
%, - ..(/ )*
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 (# <<00
)# < ) (# : := >
:$)+'! # :
! (
34.
=";
( B
(%'' 3
.(
(
7## / 06
="@ %(
0 4.
0&#%!%@ %(
0 D B
="<(
4.
0&#%!%<(
D B
.(
(@ %(
+ B 3 /
.(
(<(
< / 3
.(
((0&#%!% _ ? ?
! " #$ %&'($)"*+$()$#(+
(%, (
(
(
%
!
7 ##,# $(%
/ )# %(
023
4.5 4#
)#
(
&
("$#
,, (
$((
#
065 '
)# *$#$, (
$((
*' ')( $##
, .D4
6(
)#(
$(
7%, #*##(
!
7
'
(
(%(
((588,,,)
)8
7
20-Lead Ultra Thin Plastic Quad Flat, No Lead Package (GZ) - 4x4x0.5 mm Body [UQFN]
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
D A B
N
NOTE 1
1
2
E
(DATUM B)
(DATUM A)
2X
0.20 C
2X
0.20 C TOP VIEW
C 0.10 C A1
SEATING A
PLANE 20X
(A3) 0.08 C
SIDE VIEW
0.10 C A B
D2
L
0.10 C A B
E2
2
K
1
NOTE 1 N
20X b
e 0.10 C A B
BOTTOM VIEW
Microchip Technology Drawing C04-255A Sheet 1 of 2
20-Lead Ultra Thin Plastic Quad Flat, No Lead Package (GZ) - 4x4x0.5 mm Body [UQFN]
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
Units MILLIMETERS
Dimension Limits MIN NOM MAX
Number of Terminals N 20
Pitch e 0.50 BSC
Overall Height A 0.45 0.50 0.55
Standoff A1 0.00 0.02 0.05
Terminal Thickness A3 0.127 REF
Overall Width E 4.00 BSC
Exposed Pad Width E2 2.60 2.70 2.80
Overall Length D 4.00 BSC
Exposed Pad Length D2 2.60 2.70 2.80
Terminal Width b 0.20 0.25 0.30
Terminal Length L 0.30 0.40 0.50
Terminal-to-Exposed-Pad K 0.20 - -
Notes:
1. Pin 1 visual index feature may vary, but must be located within the hatched area.
2. Package is saw singulated
3. Dimensioning and tolerancing per ASME Y14.5M
BSC: Basic Dimension. Theoretically exact value shown without tolerances.
REF: Reference Dimension, usually without tolerance, for information purposes only.
20-Lead Ultra Thin Plastic Quad Flat, No Lead Package (GZ) - 4x4x0.5 mm Body [UQFN]
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
C1
X2
20
1
2
C2 Y2
G1
Y1
X1
E SILK SCREEN
Units MILLIMETERS
Dimension Limits MIN NOM MAX
Contact Pitch E 0.50 BSC
Optional Center Pad Width X2 2.80
Optional Center Pad Length Y2 2.80
Contact Pad Spacing C1 4.00
Contact Pad Spacing C2 4.00
Contact Pad Width (X20) X1 0.30
Contact Pad Length (X20) Y1 0.80
Contact Pad to Center Pad (X20) G1 0.20
Notes:
1. Dimensioning and tolerancing per ASME Y14.5M
BSC: Basic Dimension. Theoretically exact value shown without tolerances.
Microchip Technology Drawing C04-2255A
Revision A (10/2014)
Original release.
Revision B (4/2015)
Added High-Current pins.
Updated PIC12/16(L)F161X Family Types table and
Packages Table
Added Figures 36-7 and 36-8 for VOH vs. IOH for high
drive pins.
Deleted Figures 36-27 and 36-28.
Updated Example 3-2.
Updated Figures 5-1, 23-1, 23-2, 28-12, 31-1, 31-2,
31-4, 1, and 35-6.
Updated Registers 23-4, 27-2, 31-4 and 31-7.
Updated Sections 26.3, 25.4.2, 27.1, 30.0, 35.0, and
35.1.
Updated Table 1-2, 1-3, 3-5, 3-16, 13-2, 23-3, 23-4,
23-7, 28-1, 35-4, 35-8, and 35-17.
Updated Section 23 - added missing modes/mode
summary table, reworded text to be more clear/descrip-
tive.
Minor typos corrected.
Revision C (5/2016)
Added High endurance column to Table 1:
PIC12/16(L)F161x Family Types.
Minor typos corrected.
Updated the High-Endurance Flash data memory infor-
mation on the cover page. Updated Register 21-1.
Updated Section 19.6, 19.7. Updated Registers 19-2,
29-1, and 31-22. Updated Table 3: Pin Allocations
Table and Table 5-1. Updated Figure 19-2.
Updated Package Drawings C04-127.
Revision D (11/2017)
Added Equation 21-2: R-C Calculations and Example
21-1. Added Sections 5.3.2 Clock Switching Before
Sleep; 20.5.1: Correction by AC Coupling, and 23.2:
PRx Period Register.
Updated Example 17-1; Figure 16-1; Register 12-8,
12-16, 24-4; Sections 11.3, 11.5, 17.1.2, 17.2.6, 23.1
and 24.6; Tables 1, 1-3, 5.1, 24-4, 35-8 and 35-11.
Removed Figures 36-29, 36-30, IPD Watchdog Timer.
• 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.
== ISO/TS 16949 ==