PIC18LF26 27 45 46 47 55 56 57K42 Data Sheet 40001919E PDF
PIC18LF26 27 45 46 47 55 56 57K42 Data Sheet 40001919E PDF
PIC18LF26 27 45 46 47 55 56 57K42 Data Sheet 40001919E PDF
Zero-Cross Detect
Data EEPROM (B)
Data Sheet Index
CCP/10-bit PWM
Comparator
12-bit ADC2
5-bit DAC
Debug (1)
(WWDT)
I/O Pins
I2C/SPI
(SMT)
UART
CWG
NCO
CLC
(ch)
(ch)
Device
PIC18(L)F26/27/45/46/47/55/56/57K42
PIC18(L)F24K42 A 16 256 1024 25 24 1 2 3/4 Y Y 4/4 3 1 4 Y 2 Y Y 2 2/1 Y Y I
PIC18(L)F25K42 A 32 256 2048 25 24 1 2 3/4 Y Y 4/4 3 1 4 Y 2 Y Y 2 2/1 Y Y I
PIC18(L)F26K42 B 64 1024 4096 25 24 1 2 3/4 Y Y 4/4 3 1 4 Y 2 Y Y 2 2/1 Y Y I
PIC18(L)F27K42 B 128 1024 8192 25 24 1 2 3/4 Y Y 4/4 3 1 4 Y 2 Y Y 2 2/1 Y Y I
PIC18(L)F45K42 B 32 256 2048 36 35 1 2 3/4 Y Y 4/4 3 1 4 Y 2 Y Y 2 2/1 Y Y I
PIC18(L)F46K42 B 64 1024 4096 36 35 1 2 3/4 Y Y 4/4 3 1 4 Y 2 Y Y 2 2/1 Y Y I
PIC18(L)F47K42 B 128 1024 8192 36 35 1 2 3/4 Y Y 4/4 3 1 4 Y 2 Y Y 2 2/1 Y Y I
PIC18(L)F55K42 B 32 256 2048 44 43 1 2 3/4 Y Y 4/4 3 1 4 Y 2 Y Y 2 2/1 Y Y I
PIC18(L)F56K42 B 64 1024 4096 44 43 1 2 3/4 Y Y 4/4 3 1 4 Y 2 Y Y 2 2/1 Y Y I
PIC18(L)F57K42 B 128 1024 8192 44 43 1 2 3/4 Y Y 4/4 3 1 4 Y 2 Y Y 2 2/1 Y Y I
Note 1: I – Debugging integrated on chip.
Data Sheet Index:
Shaded devices are not described in this document.
A: DS40001869 PIC18(L)F24/25K42 Data Sheet, 28-Pin
B: DS40001919 PIC18(L)F26/27/45/46/47/55/56/57K42 Data Sheet, 28/40/44/48-Pin
DS40001919E-page 4
Note: For other small form-factor package availability and marking information, visit
http://www.microchip.com/packaging or contact your local sales office.
PIC18(L)F26/27/45/46/47/55/56/57K42
Pin Diagrams
VPP/MCLR/RE3 1 28 RB7/ICSPDAT
RA0 2 27 RB6/ICSPCLK
RA1 3 26 RB5
RA2 4 25 RB4
RA3 5 24 RB3
PIC18(L)F2XK42
RA4 6 23 RB2
RA5 7 22 RB1
VSS 8 21 RB0
RA7 9 20 VDD
RA6 10 19 VSS
RC0 11 18 RC7
RC1 12 17 RC6
RC2 13 16 RC5
RC3 14 15 RC4
RB6/ICSPCLK
RB7/ICSPDAT
RA0
RB5
RB4
RA1
28 27 26 25 24 23 22
RA2 1 21 RB3
RA3 2 20 RB2
RA4 3 19 RB1
RA5 4 PIC18(L)F2XK42 18 RB0
VSS 5 17 VDD
RA7 6 16 VSS
RA6 7 15 RC7
8 9 10 11 12 13 14
RC5
RC0
RC6
RC2
RC3
RC4
RC1
40-pin PDIP
VPP/MCLR/RE3 1 40 RB7/ICSPDAT
RA0 2 39 RB6/ICSPCLK
RA1 3 38 RB5
RA2 4 37 RB4
RA3 5 36 RB3
RA4 6 35 RB2
RA5 7 34 RB1
PIC18(L)F4XK42
RE0 8 33 RB0
RE1 9 32 VDD
RE2 10 31 VSS
VDD 11 30 RD7
VSS 12 29 RD6
RA7 13 28 RD5
RA6 14 27 RD4
RC0 15 26 RC7
RC1 16 25 RC6
RC2 17 24 RC5
RC3 18 23 RC4
RD0 19 22 RD3
RD1 20 21 RD2
RC4
RD3
RD2
RD1
RD0
RC3
RC2
RC1
40 39 38 37 36 35 34 33 32 31
RC7 1
RD4 2 30 RC0
RD5 3 29 RA6
RD6 4 28 RA7
RD7 5 27 VSS
VSS 6 PIC18(L)F4XK42 26 VDD
VDD 7 25 RE2
RB0 8 24 RE1
RB1 9 23 RE0
RB2 10 22 RA5
21 RA4
11 12 13 14 15 16 17 18 19 20
RB3
RA1
RA2
RA3
RB4
RB5
VPP/MCLR/RE3
RA0
ICSPCLK/RB6
ICSPDAT/RB7
RC6
RC5
RC4
RD3
RD2
RD1
RD0
RC3
RC2
RC1
RC0
43
42
41
40
39
37
36
35
34
44
38
RC7 1 33 RA6
RD4 2 32 RA7
RD5 3 31 NC
RD6 4 30 VSS
RD7 5 29 NC
VSS 6 PIC18(L)F4XK42 28 VDD
VDD 7 27 RE2
NC 8 26 RE1
RB0 9 25 RE0
RB1 10 24 RA5
RB2 11 23 RA4
22
21
12
13
14
15
16
17
18
19
20
ICSPCLK/RB6
ICSPDAT/RB7
RB3
RB4
RB5
RA0
RA2
VPP/MCLR/RE3
RA1
NC
RA3
Note 1: See Table 2 for location of all peripheral functions.
2: It is recommended that the exposed bottom pad be connected to VSS, however it must not be the
only VSS connection to the device.
RC4
RD3
RD2
RD1
RD0
RC3
RC2
RC1
NC
44 43 42 41 40 39 38 37 36 35 34
RC7 1 33 NC
RD4 2 32 RC0
RD5 3 31 RA6
4 30 RA7
RD6
RD7 5 29 VSS
6 PIC18(L)F4XK42 28 VDD
VSS
VDD 7 27 RE2
RB0 8 26 RE1
RB1 9 25 RE0
RB2 10 24 RA5
23 RA4
RB3 11
12 13 14 15 16 17 18 19 20 21 22
RA2
RA3
RB4
RB5
ICSPDAT/RB7
VPP/MCLR/RE3
RA0
RA1
ICSPCLK/RB6
NC
NC
RC5
RC6
RC4
RD3
RD2
RD1
RD0
RC3
RC2
RF3
RF2
RF1
48-pin UQFN (6x6x0.5mm)
45
44
43
41
40
39
37
46
48
47
38
42
RC7 1 36 RF0
RD4 2 35 RC1
RD5 3
34 RC0
RD6 4 RA6
33
RD7 5 32 RA7
VSS 6 31 VSS
PIC18(L)F5XK42
VDD 7 30 VDD
RB0 8 29 RE2
RB1 9 28 RE1
RB2 10 27 RE0
RB3 11 26 RA5
RF4 12 25 RA4
24
13
14
15
16
17
18
19
20
21
22
23
VPP/MCLR/RE3
RF5
RF6
RF7
RB4
RB5
RA0
RA1
RA2
RA3
ICSPCLK/RB6
ICSPDAT/RB7
Interrupt-on-Change
Voltage Reference
Comparators
Timers/SMT
PIC18(L)F26/27/45/46/47/55/56/57K42
UART
Basic
ADC2
CWG
DSM
NCO
DAC
CLC
SPI
I2C
I/O
28-Pin SPDIP/SOIC/SSOP
Interrupt-on-Change
Voltage Reference
Comparators
Timers/SMT
UART
Basic
ADC2
CWG
DSM
NCO
DAC
CLC
SPI
I2C
I/O
PIC18(L)F26/27/45/46/47/55/56/57K42
RC0 11 8 ANC0 — — — — — — — — T1CKI(1) — — — — — IOCC0 SOSCO
T3CKI(1)
T3G(1)
SMTWIN1(1)
RC1 12 9 ANC1 — — — — — — — — SMTSIG1(1) CCP2(1) — — — — IOCC1 SOSCI
RC2 13 10 ANC2 — — — — — — — — T5CKI(1) CCP1(1) — — — — IOCC2 —
RC3 14 11 ANC3 — — — — SCL1(3,4) SCK1(1) — — T2IN(1) — — — — — IOCC3 —
RC4 15 12 ANC4 — — — — SDA1(3,4) SDI1(1) — — — — — — — — IOCC4 —
RC5 16 13 ANC5 — — — — — — — — T4IN(1) — — — — — IOCC5 —
RC6 17 14 ANC6 — — — — — — CTS1(1) — — — — — — — IOCC6 —
RC7 18 15 ANC7 — — — — — — RX1(1) — — — — — — — IOCC7 —
RE3 1 26 — — — — — — — — — — — — — — — IOCE3 MCLR
VPP
VDD 20 17 — — — — — — — — — — — — — — — — —
VSS 8, 5, — — — — — — — — — — — — — — — — —
19 16
OUT(2) — — ADGRDA — — C1OUT — SDA1 SS1 DTR1 DSM TMR0 CCP1 CWG1A CLC1OUT NCO CLKR — —
ADGRDB C2OUT SCL1 SCK1 RTS1 CCP2 CWG1B CLC2OUT
SDA2 SDO1 TX1 CCP3 CWG1C CLC3OUT
SCL2 DTR2 CCP4 CWG1D CLC4OUT
RTS2 PWM5OUT CWG2A
TX2 PWM6OUT CWG2B
PWM7OUT CWG2C
PWM8OUT CWG2D
CWG3A
CWG3B
CWG3C
CWG3D
Note 1: This is a PPS remappable input signal. The input function may be moved from the default location shown to one of several other PORTx pins.
DS40001919E-page 10
Interrupt-on-Change
Voltage Reference
Timers/SMT
40-Pin PDIP
44-Pin QFN
UART
Basic
ADC2
CWG
DSM
NCO
DAC
CLC
SPI
I2C
I/O
PIC18(L)F26/27/45/46/47/55/56/57K42
RA0 2 19 17 19 ANA0 — — C1IN0- — — — — — — — — CLCIN0(1) — — IOCA0 —
C2IN0-
RA1 3 20 18 20 ANA1 — — C1IN1- — — — — — — — — CLCIN1(1) — — IOCA1 —
C2IN1-
RA2 4 21 19 21 ANA2 VREF- DAC1OUT1 C1IN0+ — — — — — — — — — — — IOCA2 —
C2IN0+
RA3 5 22 20 22 ANA3 VREF+ — C1IN1+ — — — — MDCARL(1) — — — — — — IOCA3 —
RA4 6 23 21 23 ANA4 — — — — — — — MDCARH(1) T0CKI(1) — — — — — IOCA4 —
RA5 7 24 22 24 ANA5 — — — — — SS1(1) — MDSRC(1) — — — — — — IOCA5 —
RA6 14 31 29 33 ANA6 — — — — — — — — — — — — — — IOCA6 OSC2
CLKOUT
RA7 13 30 28 32 ANA7 — — — — — — — — — — — — — — IOCA7 OSC1
CLKIN
RB0 33 8 8 9 ANB0 — — C2IN1+ ZCD — — — — — CCP4(1) CWG1IN(1) — — — INT0(1) —
IOCB0
RB1 34 9 9 10 ANB1 — — C1IN3- — SCL2(3,4) — — — — — CWG2IN(1) — — — INT1(1) —
C2IN3- IOCB1
RB2 35 10 10 11 ANB2 — — — — SDA2(3,4) — — — — — CWG3IN(1) — — — INT2(1) —
IOCB2
RB3 36 11 11 12 ANB3 — — C1IN2- — — — — — — — — — — — IOCB3 —
C2IN2-
RB4 37 14 12 14 ANB4 — — — — — — — — T5G(1) — — — — — IOCB4 —
ADCACT(1)
RB5 38 15 13 15 ANB5 — — — — — — — — T1G(1) CCP3(1) — — — — IOCB5 —
RB6 39 16 14 16 ANB6 — — — — — — CTS2(1) — - — — CLCIN2(1) — — IOCB6 ICSPCLK
RB7 40 17 15 17 ANB7 — DAC1OUT2 — — — — RX2(1) — T6IN(1) — — CLCIN3(1) — — IOCB7 ICSPDAT
RC0 15 32 30 34 ANC0 — — — — — — — — T1CKI(1) — — — — — IOCC0 SOSCO
T3CKI(1)
T3G(1)
DS40001919E-page 11
SMTWIN1(1)
RC1 16 35 31 35 ANC1 — — — — — — — — SMTSIG1(1) CCP2(1) — — — — IOCC1 SOSCI
RC2 17 36 32 36 ANC2 — — — — — — — — T5CKI(1) CCP1(1) — — — — IOCC2 —
Note 1: This is a PPS remappable input signal. The input function may be moved from the default location shown to one of several other PORTx pins.
2: All output signals shown in this row are PPS remappable.
3: This is a bidirectional signal. For normal module operation, the firmware should map this signal to the same pin in both the PPS input and PPS output registers.
4: These pins can be configured for I2C and SMB™ 3.0/2.0 logic levels; The SCLx/SDAx signals may be assigned to any of the RB1/RB2/RC3/RC4/RD0/RD1 pins. PPS assignments to the other pins (e.g., RA5) will operate, but input
logic levels will be standard TTL/ST as selected by the INLVL register, instead of the I2C specific or SMBus input buffer thresholds.
TABLE 2: 40/44-PIN ALLOCATION TABLE FOR PIC18(L)F4XK42 (CONTINUED)
2017-2019 Microchip Technology Inc.
Interrupt-on-Change
Voltage Reference
Timers/SMT
40-Pin PDIP
44-Pin QFN
UART
Basic
ADC2
CWG
DSM
NCO
DAC
CLC
SPI
I2C
I/O
PIC18(L)F26/27/45/46/47/55/56/57K42
RC3 18 37 33 37 ANC3 — — — — SCL1(3,4) SCK1(1) — — T2IN(1) — — — — — IOCC3 —
RC4 23 42 38 42 ANC4 — — — — SDA1(3,4) SDI1(1) — — — — — — — — IOCC4 —
RC5 24 43 39 43 ANC5 — — — — — — — — T4IN(1) — — — — — IOCC5 —
RC6 25 44 40 44 ANC6 — — — — — — CTS1(1) — — — — — — — IOCC6 —
RC7 26 1 1 1 ANC7 — — — — — — RX1(1) — — — — — — — IOCC7 —
RD0 19 38 34 38 AND0 — — — — —(4) — — — — — — — — — — —
RD1 20 39 35 39 AND1 — — — — —(4) — — — — — — — — — — —
RD2 21 40 36 40 AND2 — — — — — — — — — — — — — — — —
RD3 22 41 37 41 AND3 — — — — — — — — — — — — — — — —
RD4 27 2 2 2 AND4 — — — — — — — — — — — — — — — —
RD5 28 3 3 3 AND5 — — — — — — — — — — — — — — — —
RD6 29 4 4 4 AND6 — — — — — — — — — — — — — — — —
RD7 30 5 5 5 AND7 — — — — — — — — — — — — — — — —
RE0 8 25 23 25 ANE0 — — — — — — — — — — — — — — — —
RE1 9 26 24 26 ANE1 — — — — — — — — — — — — — — — —
RE2 10 27 25 27 ANE2 — — — — — — — — — — — — — — — —
RE3 1 18 16 18 — — — — — — — — — — — — — — — IOCE3 MCLR
VPP
VDD 11, 7, 7, 7, — — — — — — — — — — — — — — — — —
32 28 26 28
VSS 12, 6, 6, 6, — — — — — — — — — — — — — — — — —
31 29 27 30
Note 1: This is a PPS remappable input signal. The input function may be moved from the default location shown to one of several other PORTx pins.
2: All output signals shown in this row are PPS remappable.
3: This is a bidirectional signal. For normal module operation, the firmware should map this signal to the same pin in both the PPS input and PPS output registers.
4: These pins can be configured for I2C and SMB™ 3.0/2.0 logic levels; The SCLx/SDAx signals may be assigned to any of the RB1/RB2/RC3/RC4/RD0/RD1 pins. PPS assignments to the other pins (e.g., RA5) will operate, but input
logic levels will be standard TTL/ST as selected by the INLVL register, instead of the I2C specific or SMBus input buffer thresholds.
DS40001919E-page 12
TABLE 2: 40/44-PIN ALLOCATION TABLE FOR PIC18(L)F4XK42 (CONTINUED)
2017-2019 Microchip Technology Inc.
Interrupt-on-Change
Voltage Reference
Timers/SMT
40-Pin PDIP
44-Pin QFN
UART
Basic
ADC2
CWG
DSM
NCO
DAC
CLC
SPI
I2C
I/O
PIC18(L)F26/27/45/46/47/55/56/57K42
OUT(2) — — — — ADGRDA — — C1OUT — SDA1 SS1 DTR1 DSM TMR0 CCP1 CWG1A CLC1OUT NCO CLKR — —
ADGRDB C2OUT SCL1 SCK1 RTS1 CCP2 CWG1B CLC2OUT
SDA2 SDO1 TX1 CCP3 CWG1C CLC3OUT
SCL2 DTR2 CCP4 CWG1D CLC4OUT
RTS2 PWM5OUT CWG2A
TX2 PWM6OUT CWG2B
PWM7OUT CWG2C
PWM8OUT CWG2D
CWG3A
CWG3B
CWG3C
CWG3D
Note 1: This is a PPS remappable input signal. The input function may be moved from the default location shown to one of several other PORTx pins.
2: All output signals shown in this row are PPS remappable.
3: This is a bidirectional signal. For normal module operation, the firmware should map this signal to the same pin in both the PPS input and PPS output registers.
4: These pins can be configured for I2C and SMB™ 3.0/2.0 logic levels; The SCLx/SDAx signals may be assigned to any of the RB1/RB2/RC3/RC4/RD0/RD1 pins. PPS assignments to the other pins (e.g., RA5) will operate, but input
logic levels will be standard TTL/ST as selected by the INLVL register, instead of the I2C specific or SMBus input buffer thresholds.
DS40001919E-page 13
2017-2019 Microchip Technology Inc.
Interrupt-on-Change
Voltage Reference
Timers/SMT
UART
Basic
ADC2
CWG
DSM
NCO
DAC
CLC
SPI
I2C
I/O
PIC18(L)F26/27/45/46/47/55/56/57K42
RA0 21 21 ANA0 — — C1IN0- — — — — — — — — CLCIN0(1) — — IOCA0 —
C2IN0-
RA1 22 22 ANA1 — — C1IN1- — — — — — — — — CLCIN1(1) — — IOCA1 —
C2IN1-
RA2 23 23 ANA2 VREF- DAC1OUT1 C1IN0+ — — — — — — — — — — — IOCA2 —
C2IN0+
RA3 24 24 ANA3 VREF+ — C1IN1+ — — — — MDCARL(1) - — — — — — IOCA3 —
RA4 25 25 ANA4 — — — — — — — MDCARH(1) T0CKI(1) — — — — — IOCA4 —
RA5 26 26 ANA5 — — — — — SS1(1) — MDSRC(1) — — — — — — IOCA5 —
RA6 33 33 ANA6 — — — — — — — — — — — — — — IOCA6 OSC2
CLKOUT
RA7 32 32 ANA7 — — — — — — — — — — — — — — IOCA7 OSC1
CLKIN
RB0 8 8 ANB0 — — C2IN1+ ZCD — — — — — CCP4(1) CWG1IN(1) — — — INT0(1) —
IOCB0
RB1 9 9 ANB1 — — C1IN3- — SCL2(3,4) — — — — — CWG2IN(1) — — — INT1(1) —
C2IN3- IOCB1
RB2 10 10 ANB2 — — — — SDA2(3,4) — — — — — CWG3IN(1) — — — INT2(1) —
IOCB2
RB3 11 11 ANB3 — — C1IN2- — — — — — — — — — — — IOCB3 —
C2IN2-
RB4 16 16 ANB4 — — — — — — — — T5G(1) — — — — — IOCB4 —
ADCACT(1)
RB5 17 17 ANB5 — — — — — — — — T1G(1) CCP3(1) - — — — IOCB5 —
RB6 18 18 ANB6 — — — — — — CTS2(1) — — — — CLCIN2(1) — — IOCB6 ICSPCLK
RB7 19 19 ANB7 — DAC1OUT2 — — — — RX2(1) — T6IN(1) — — CLCIN3(1) — — IOCB7 ICSPDAT
DS40001919E-page 14
Interrupt-on-Change
Voltage Reference
Timers/SMT
UART
Basic
ADC2
CWG
DSM
NCO
DAC
CLC
SPI
I2C
I/O
PIC18(L)F26/27/45/46/47/55/56/57K42
RC1 35 35 ANC1 — - — — — — — — SMTSIG1(1) CCP2(1) — — — — IOCC1 SOSCI
RC2 40 40 ANC2 — - — — — — — — T5CKI(1) CCP1(1) — — — — IOCC2 —
RC3 41 41 ANC3 — - — — SCL1(3,4) SCK1(1) — — T2IN(1) - — — — — IOCC3 —
RC4 46 46 ANC4 — — — — SDA1(3,4) SDI1(1) — — — — — — — — IOCC4 —
RC5 47 47 ANC5 — — — — — — — — T4IN(1) — — — — — IOCC5 —
(1)
RC6 48 48 ANC6 — — — — — — CTS1 — — — — — — — IOCC6 —
RC7 1 1 ANC7 — — — — — — RX1(1) — — — — — — — IOCC7 —
RD0 42 42 AND0 — — — — —(4) — — — — — — — — — — —
RD1 43 43 AND1 — — — — —(4) — — — — — — — — — — —
RD2 44 44 AND2 — — — — — — — — — — — — — — — —
RD3 45 45 AND3 — — — — — — — — — — — — — — — —
RD4 2 2 AND4 — — — — — — — — — — — — — — — —
RD5 3 3 AND5 — — — — — — — — — — — — — — — —
RD6 4 4 AND6 — — — — — — — — — — — — — — — —
RD7 5 5 AND7 — — — — — — — — — — — — — — — —
RE0 27 27 ANE0 — — — — — — — — — — — — — — — —
RE1 28 28 ANE1 — — — — — — — — — — — — — — — —
RE2 29 29 ANE2 — — — — — — — — — — — — — — — —
RE3 20 20 — — — — — — — — — — — — — — — IOCE3 MCLR
VPP
RF0 36 36 ANF0 — — — — — — — — — — — — — — — —
RF1 37 37 ANF1 — — — — — — — — — — — — — — — —
RF2 38 38 ANF2 — — — — — — — — — — — — — — — —
RF3 39 39 ANF3 — — — — — — — — — — — — — — — —
RF4 12 12 ANF4 — — — — — — — — — — — — — — — —
DS40001919E-page 15
RF5 13 13 ANF5 — — — — — — — — — — — — — — — —
RF6 14 14 ANF6 — — — — — — — — — — — — — — — —
RF7 15 15 ANF7 — — — — — — — — — — — — — — — —
Note 1: This is a PPS remappable input signal. The input function may be moved from the default location shown to one of several other PORTx pins.
2: All output signals shown in this row are PPS remappable.
3: This is a bidirectional signal. For normal module operation, the firmware should map this signal to the same pin in both the PPS input and PPS output registers.
4: These pins can be configured for I2C and SMB™ 3.0/2.0 logic levels; The SCLx/SDAx signals may be assigned to any of the RB1/RB2/RC3/RC4/RD0/RD1 pins. PPS assignments to the other pins (e.g., RA5) will operate, but input
logic levels will be standard TTL/ST as selected by the INLVL register, instead of the I2C specific or SMBus input buffer thresholds.
TABLE 3: 48-PIN ALLOCATION TABLE FOR PIC18(L)F5XK42 (CONTINUED)
2017-2019 Microchip Technology Inc.
Interrupt-on-Change
Voltage Reference
Timers/SMT
UART
Basic
ADC2
CWG
DSM
NCO
DAC
CLC
SPI
I2C
I/O
PIC18(L)F26/27/45/46/47/55/56/57K42
VDD 7, 7, — — — — — — — — — — — — — — — — —
30 30
VSS 6, 6, — — — — — — — — — — — — — — — — —
31 31
OUT(2) — — ADGRDA — — C1OUT — SDA1 SS1 DTR1 DSM TMR0 CCP1 CWG1A CLC1OUT NCO CLKR — —
ADGRDB C2OUT SCL1 SCK1 RTS1 CCP2 CWG1B CLC2OUT
SDA2 SDO1 TX1 CCP3 CWG1C CLC3OUT
SCL2 DTR2 CCP4 CWG1D CLC4OUT
RTS2 PWM5OUT CWG2A
TX2 PWM6OUT CWG2B
PWM7OUT CWG2C
PWM8OUT CWG2D
CWG3A
CWG3B
CWG3C
CWG3D
Note 1: This is a PPS remappable input signal. The input function may be moved from the default location shown to one of several other PORTx pins.
2: All output signals shown in this row are PPS remappable.
3: This is a bidirectional signal. For normal module operation, the firmware should map this signal to the same pin in both the PPS input and PPS output registers.
4: These pins can be configured for I2C and SMB™ 3.0/2.0 logic levels; The SCLx/SDAx signals may be assigned to any of the RB1/RB2/RC3/RC4/RD0/RD1 pins. PPS assignments to the other pins (e.g., RA5) will operate, but input
logic levels will be standard TTL/ST as selected by the INLVL register, instead of the I2C specific or SMBus input buffer thresholds.
DS40001919E-page 16
PIC18(L)F26/27/45/46/47/55/56/57K42
Table of Contents
1.0 Device Overview ........................................................................................................................................................................ 19
2.0 Guidelines for Getting Started with PIC18(L)F26/27/45/46/47/55/56/57K42 Microcontrollers ................................................... 23
3.0 PIC18 CPU................................................................................................................................................................................. 26
4.0 Memory Organization ................................................................................................................................................................. 33
5.0 Device Configuration .................................................................................................................................................................. 65
6.0 Resets ........................................................................................................................................................................................ 81
7.0 Oscillator Module (with Fail-Safe Clock Monitor) ....................................................................................................................... 92
8.0 Reference Clock Output Module .............................................................................................................................................. 111
9.0 Interrupt Controller ................................................................................................................................................................... 115
10.0 Power-Saving Operation Modes .............................................................................................................................................. 170
11.0 Windowed Watchdog Timer (WWDT) ...................................................................................................................................... 178
12.0 8x8 Hardware Multiplier............................................................................................................................................................ 187
13.0 Nonvolatile Memory (NVM) Control.......................................................................................................................................... 189
14.0 Cyclic Redundancy Check (CRC) Module with Memory Scanner............................................................................................ 213
15.0 Direct Memory Access (DMA) .................................................................................................................................................. 228
16.0 I/O Ports ................................................................................................................................................................................... 260
17.0 Peripheral Pin Select (PPS) Module ........................................................................................................................................ 275
18.0 Interrupt-on-Change ................................................................................................................................................................. 286
19.0 Peripheral Module Disable (PMD)............................................................................................................................................ 290
20.0 Timer0 Module ......................................................................................................................................................................... 299
21.0 Timer1/3/5 Module with Gate Control....................................................................................................................................... 305
22.0 Timer2/4/6 Module ................................................................................................................................................................... 320
23.0 Capture/Compare/PWM Module .............................................................................................................................................. 342
24.0 Pulse-Width Modulation (PWM) ............................................................................................................................................... 355
25.0 Signal Measurement Timer (SMT) ........................................................................................................................................... 362
26.0 Complementary Waveform Generator (CWG) Module ............................................................................................................ 406
27.0 Configurable Logic Cell (CLC).................................................................................................................................................. 434
28.0 Numerically Controlled Oscillator (NCO) Module ..................................................................................................................... 449
29.0 Zero-Cross Detection (ZCD) Module........................................................................................................................................ 459
30.0 Data Signal Modulator (DSM) Module...................................................................................................................................... 464
31.0 Universal Asynchronous Receiver Transmitter (UART) With Protocol Support ....................................................................... 475
32.0 Serial Peripheral Interface (SPI) Module.................................................................................................................................. 513
33.0 I2C Module ............................................................................................................................................................................... 545
34.0 Fixed Voltage Reference (FVR) .............................................................................................................................................. 598
35.0 Temperature Indicator Module ................................................................................................................................................. 600
36.0 Analog-to-Digital Converter with Computation (ADC2) Module ............................................................................................... 602
37.0 5-Bit Digital-to-Analog Converter (DAC) Module...................................................................................................................... 640
38.0 Comparator Module ................................................................................................................................................................. 644
39.0 High/Low-Voltage Detect (HLVD)............................................................................................................................................. 653
40.0 In-Circuit Serial Programming™ (ICSP™) ............................................................................................................................... 661
41.0 Instruction Set Summary .......................................................................................................................................................... 663
42.0 Register Summary.................................................................................................................................................................... 717
43.0 Development Support............................................................................................................................................................... 734
44.0 Electrical Specifications............................................................................................................................................................ 738
45.0 DC and AC Characteristics Graphs and Charts ....................................................................................................................... 770
46.0 Packaging Information.............................................................................................................................................................. 798
The Microchip WebSite ..................................................................................................................................................................... 831
Customer Change Notification Service ............................................................................................................................................. 831
Customer Support ............................................................................................................................................................................. 831
Product Identification System ........................................................................................................................................................... 832
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.
PIC18(L)F26/27/45/46/47/55/56/57K42
Data Memory (Bytes) 4096 8192 2048 4096 8192 2048 4096 8192
Data EEPROM
1024 1024 256 1024 1024 256 1024 1024
Memory (Bytes)
28-pin SPDIP 28-pin SPDIP
40-pin PDIP 40-pin PDIP 40-pin PDIP
28-pin SOIC 28-pin SOIC
40-pin UQFN 40-pin UQFN 40-pin UQFN 48-pin TQFP 48-pin TQFP 48-pin TQFP
Packages 28-pin SSOP 28-pin SSOP
44-pin TQFP 44-pin TQFP 44-pin TQFP 48-pin UQFN 48-pin UQFN 48-pin UQFN
28-pin QFN 28-pin QFN
44-pin QFN 44-pin QFN 44-pin QFN
28-pin UQFN 28-pin UQFN
I/O Ports A,B,C,E(1) A,B,C,E(1) A,B,C,D, E(1) A,B,C,D, E(1) A,B,C,D, E(1) A,B,C,D, E(1), F A,B,C,D, E(1), F A,B,C,D, E(1), F
12-Bit Analog-to-Digital
Conversion Module
5 internal 5 internal 5 internal 5 internal 5 internal 5 internal 5 internal 5 internal
(ADC2) with
24 external 24 external 35 external 35 external 35 external 43 external 43 external 43 external
Computation
Accelerator
Capture/Compare/
4
PWM Modules (CCP)
10-Bit Pulse-Width
4
Modulator (PWM)
Timers (16-/8-bit) 4/3
Serial Communications 1 UART, 1 UART with DMX/DALI/LIN, 2 I2C, 1 SPI
Complementary
Waveform Generator 3
(CWG)
Zero-Cross Detect
1
(ZCD)
Data Signal Modulator
1
DS40001919E-page 20
(DSM)
Signal Measurement
1
Timer (SMT)
5-bit Digital to Analog
1
Converter (DAC)
Numerically Controlled
1
Oscillator (NCO)
TABLE 1-1: DEVICE FEATURES (CONTINUED)
2017-2019 Microchip Technology Inc.
PIC18(L)F26/27/45/46/47/55/56/57K42
Peripheral Pin Select
Yes
(PPS)
Peripheral Module
Yes
Disable (PMD)
16-bit CRC with
Yes
Scanner
Programmable High/
Low-Voltage Detect Yes
(HLVD)
POR, Programmable BOR,
RESET Instruction,
Stack Overflow,
Resets (and Delays)
Stack Underflow
(PWRT, OST),
MCLR, WDT, MEMV
81 Instructions;
Instruction Set
87 with Extended Instruction Set enabled
Maximum Operating
64 MHz
Frequency
Note 1: PORTE is partially implemented. Pin RE3 is an input-only pin on 28/40/44/48-pin variants. In addition to that, on 40/44/48-pin variants, PORTE also
consists of RE0, RE1 and RE2 pins.
DS40001919E-page 21
PIC18(L)F26/27/45/46/47/55/56/57K42
1.3 Register and Bit naming 1.3.2.3 Bit Fields
conventions Bit fields are two or more adjacent bits in the same
register. For example, the four Least Significant bits of
1.3.1 REGISTER NAMES the T0CON0 register contain the output prescaler
When there are multiple instances of the same select bits. The short name for this field is OUTPS and
peripheral in a device, the peripheral control registers the long name is T0OUTPS. Bit field access is only
will be depicted as the concatenation of a peripheral possible in C programs. The following example
identifier, peripheral instance, and control identifier. demonstrates a C program instruction for setting the
The control registers section will show just one Timer0 output prescaler to the 1:6 Postscaler:
instance of all the register names with an ‘x’ in the place T0CON0bits.OUTPS = 0x5;
of the peripheral instance number. This naming
Individual bits in a bit field can also be accessed with
convention may also be applied to peripherals when
long and short bit names. Each bit is the field name
there is only one instance of that peripheral in the
appended with the number of the bit position within the
device to maintain compatibility with other devices in
field. For example, the Most Significant mode bit has
the family that contain more than one.
the short bit name OUTPS3. The following two exam-
1.3.2 BIT NAMES ples demonstrate assembly program sequences for
setting the Timer0 output prescaler to 1:6 Postscaler:
There are two variants for bit names:
Example 1:
• Short name: Bit function abbreviation
MOVLW ~(1<<OUTPS3 | 1<<OUTPS1)
• Long name: Peripheral abbreviation + short name ANDWF T0CON0,F
MOVLW 1<<OUTPS2 | 1<<OUTPS0
1.3.2.1 Short Bit Names IORWF T0CON0,F
Short bit names are an abbreviation for the bit function. Example 2:
For example, some peripherals are enabled with the
BCF T0CON0,OUTPS3
EN bit. The bit names shown in the registers are the BSF T0CON0,OUTPS2
short name variant. BCF T0CON0,OUTPS1
Short bit names are useful when accessing bits in C BSF T0CON0,OUTPS0
programs. The general format for accessing bits by the
short name is RegisterNamebits.ShortName. For 1.3.3 REGISTER AND BIT NAMING
example, the enable bit, EN, in the T0CON0 register EXCEPTIONS
can be set in C programs with the instruction
T0CON0bits.EN = 1. 1.3.3.1 Status, Interrupt, and Mirror Bits
Short names are generally not useful in assembly Status, interrupt enables, interrupt flags, and mirror bits
programs because the same name may be used by are contained in registers that span more than one
different peripherals in different bit positions. When this peripheral. In these cases, the bit name shown is
occurs, during the include file generation, all instances unique so there is no prefix or short name variant.
of that short bit name are appended with an underscore
plus the name of the register in which the bit resides to
avoid naming contentions.
VDD C2 and then to the device pins. This ensures that the
decoupling capacitors are first in the power chain.
R1
Equally important is to keep the trace length
VDD
Vss
R2
MCLR between the capacitor and the power pins to a
C1 minimum, thereby reducing PCB trace
inductance.
PIC18(L)Fxxxxx
Vss 2.2.2 TANK CAPACITORS
On boards with power traces running longer than
six inches in length, it is suggested to use a tank
Key (all values are recommendations): capacitor for integrated circuits, including
C1 and C2 : 0.1 PF, 20V ceramic microcontrollers, to supply a local power source. The
R1: 10 kΩ value of the tank capacitor should be determined based
R2: 100Ω to 470Ω on the trace resistance that connects the power supply
source to the device, and the maximum current drawn
by the device in the application. In other words, select
the tank capacitor so that it meets the acceptable
voltage sag at the device. Typical values range from
4.7 F to 47 F.
R1
R2
MCLR
PIC18(L)Fxxxxx
JP
C1
OSCI
DEVICE PINS
Data Bus[8]
Table Pointer[21]
8 8 Data Latch
inc/dec logic
Data Memory
21 PCLATU PCLATH
20 Address Latch Ports
PCU PCH PCL
Program Counter 12
Data Address[12]
31-Level Stack
Address Latch 6 14 4
BSR FSR0 Access
Program Memory STKPTR Bank
(8/16/32/64 Kbytes) FSR1
FSR2 12 Peripherals
Data Latch
inc/dec
8 logic
Table Latch
8
Instruction State machine
Decode and control signals
Control
PRODH PRODL
8x8 Multiply
3 8
BITOP W
8 8 8
OSC1(2) Internal
Oscillator Power-up
Timer 8 8
Block
(2) Oscillator
OSC2 ALU[8]
LFINTOSC Start-up Timer
SOSCI Oscillator Power-on 8
Reset
64 MHz
SOSCO Oscillator WWDT
Precision
Single-Supply Brown-out Band Gap
MCLR(1) Reset
Programming Reference
In-Circuit Fail-Safe
Debugger Clock Monitor
Memory Access
CPU Scanner DMA 1 DMA 2
NVMCON
Legend
Program Flash Memory Data
Data EEPROM Data
SFR/GPR Data
EXAMPLE 3-1: PRIORITY LOCK 3.2.1 ISR PRIORITY > MAIN PRIORITY >
SEQUENCE PERIPHERAL PRIORITY
; Disable interrupts When the Peripheral Priority (DMAx, Scanner) is lower
BCF INTCON0,GIE than ISR and MAIN Priority, and the peripheral
requires:
; Bank to PRLOCK register 1. Access to the Program Flash Memory, then the
BANKSEL PRLOCK peripheral waits for an instruction cycle in which
MOVLW 55h the CPU does not need to access the PFM
(such as a branch instruction) and uses that
; Required sequence, next 4 cycle to do its own Program Flash Memory
instructions access, unless a PFM Read/Write operation is
MOVWF PRLOCK in progress.
MOVLW AAh
2. Access to the SFR/GPR, then the peripheral
MOVWF PRLOCK
waits for an instruction cycle in which the CPU
; Set PRLOCKED bit to grant memory
does not need to access the SFR/GPR (such as
access to peripherals
MOVLW, CALL, NOP) and uses that cycle to do its
BSF PRLOCK,0
own SFR/GPR access.
; Enable Interrupts 3. Access to the Data EEPROM, then the
BSF INTCON0,GIE peripheral has access to Data EEPROM unless
a Data EEPROM Read/Write operation is being
performed.
EXAMPLE 3-2: PRIORITY UNLOCK This results in the lowest throughput for the peripheral
SEQUENCE to access the memory, and does so without any impact
; Disable interrupts on execution times.
BCF INTCON0,GIE
3.2.2 PERIPHERAL PRIORITY > ISR
; Bank to PRLOCK register PRIORITY > MAIN PRIORITY
BANKSEL PRLOCK
When the Peripheral Priority (DMAx, Scanner) is higher
MOVLW 55h
than ISR and MAIN Priority, the CPU operation is
stalled when the peripheral requests memory.
; Required sequence, next 4
instructions The CPU is held in its current state until the peripheral
MOVWF PRLOCK completes its operation. Since the peripheral requests
MOVLW AAh access to the bus, the peripheral cannot be disabled
MOVWF PRLOCK until it completes its operation.
; Clear PRLOCKED bit to allow changing This results in the highest throughput for the peripheral
priority settings to access the memory, but has the cost of stalling other
BCF PRLOCK,0 execution while it occurs.
; Enable Interrupts
BSF INTCON0,GIE
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 = Hardware 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 HS = Hardware 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 HS = Hardware 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 HS = Hardware 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 HS = Hardware 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 HS = Hardware set
Note 1 Stack (31 levels) Stack (31 levels) Stack (31 levels) Note 1
Note 1: The stack is a separate SRAM panel, apart from all user memory panels.
2: 00 0008h location is used as the reset default for the IVTBASE register, the vector table can be relocated in the
memory by programming the IVTBASE register.
3: Storage area Flash is implemented as the last 128 Words of user Flash.
4: The addresses do not roll over. The region is read as ‘0’.
5: Not code-protected.
6: Hard-coded in silicon.
7: This region cannot be written by the user and it’s not affected by a Bulk Erase.
11111
11110
Top-of-Stack Registers 11101 Stack Pointer
4.2.5.2 Return Stack Pointer (STKPTR) If STVREN is set (default) and the stack has been
popped enough times to unload the stack, the next pop
The STKPTR register (Register 4-4) contains the Stack
will return a value of zero to the PC, it will set the
Pointer value. The STKOVF (Stack Overflow) Status bit
STKUNF bit and a Reset will be generated. This
and the STKUNF (Stack Underflow) Status bit can be
condition can be generated by the RETURN, RETLW and
accessed using the PCON0 register. The value of the
RETFIE instructions.
Stack Pointer can be 0 through 31. On Reset, the Stack
Pointer value will be zero. The user may read and write When STVREN = 0, STKUNF will be set but no Reset
the Stack Pointer value. This feature can be used by a will occur.
Real-Time Operating System (RTOS) for stack mainte-
nance. After the PC is pushed onto the stack 32 times
(without popping any values off the stack), the Note: Returning a value of zero to the PC on an
STKOVF bit is set. The STKOVF bit is cleared by soft- underflow has the effect of vectoring the
ware or by a POR. The action that takes place when the program to the Reset vector, where the
stack becomes full depends on the state of the stack conditions can be verified and
STVREN (Stack Overflow Reset Enable) Configuration appropriate actions can be taken. This is
bit. (Refer to Section 5.1 “Configuration Words” for not the same as a Reset, as the contents
a description of the device Configuration bits.) of the SFRs are not affected.
If STVREN is set (default), a Reset will be generated 4.2.5.3 PUSH and POP Instructions
and a Stack Overflow will be indicated by the STKOVF
bit when the 32nd push is initiated. This includes CALL Since the Top-of-Stack is readable and writable, the
and CALLW instructions, as well as stacking the return ability to push values onto the stack and pull values off
address during an interrupt response. The STKOVF bit the stack without disturbing normal program execution
will remain set and the Stack Pointer will be set to zero. is a desirable feature. The PIC18 instruction set
includes two instructions, PUSH and POP, that permit
If STVREN is cleared, the STKOVF bit will be set on the the TOS to be manipulated under software control.
32nd push and the Stack Pointer will remain at 31 but TOSU, TOSH and TOSL can be modified to place data
no Reset will occur. Any additional pushes will or a return address on the stack.
overwrite the 31st push but the STKPTR will remain at
31. The PUSH instruction places the current PC value onto
the stack. This increments the Stack Pointer and loads
Setting STKOVF = 1 in software will change the bit, but the current PC value onto the stack.
will not generate a Reset.
The POP instruction discards the current TOS by
The STKUNF bit is set when a stack pop returns a decrementing the Stack Pointer. The previous value
value of zero. The STKUNF bit is cleared by software pushed onto the stack then becomes the TOS value.
or by POR. The action that takes place when the stack
becomes full depends on the state of the STVREN
(Stack Overflow Reset Enable) Configuration bit.
(Refer to Section 5.1 “Configuration Words” for a
description of the device Configuration bits).
Legend:
R = Readable bit W = Writable bit U = Unimplemented C = Clearable only bit
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented C = Clearable only bit
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented C = Clearable only bit
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented C = Clearable only bit
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
SUB1
RETURN, FAST ;RESTORE VALUES SAVED
;IN FAST REGISTER STACK
Note: There are some instructions that take multiple cycles to execute. Refer to Section 41.0 “Instruction Set
Summary” for details.
PIC18(L)F26/27/45/46/47/55/56/57K42
Bank 1 00 0001 00h 0100h
FFh ·
Bank 2 00 0010 00h ·
FFh ·
GPR GPR GPR ·
00h ·
· ·
Bank 3 · ·
00 0011 · Virtual Bank
03FFh
FFh
00h 0400h
00 0100 · · Access RAM 00h
Banks - · GPR GPR GPR ·
4 to 7 5Fh
00 0111 · ·
FFh 07FFh SFR 60h
00h 0800h FFh
00 1000 · ·
Banks · GPR ·
8 to 15 -
00 1111 · ·
FFh 0FFFh
00h GPR 1000h
Banks 01 0000 · ·
· Unimplemented ·
16 to 31 -
01 1111 · ·
FFh Unimplemented 1FFFh
00h 2000h
Banks 10 0000 · ·
· Unimplemented ·
32 to 55 - · ·
11 0111 FFh 37FFh
00h 3800h
11 1000 · ·
Banks · SFR SFR SFR ·
56 to 62 -
11 1110 · ·
FFh 3EFFh
00h 3800h
11 1111 · SFR SFR SFR 3EFFh
Bank 63 · 3F60h
· 3FFFh
FFh
DS40001919E-page 45
FIGURE 4-5: USE OF THE BANK SELECT REGISTER (DIRECT ADDRESSING)
2017-2019 Microchip Technology Inc.
PIC18(L)F26/27/45/46/47/55/56/57K42
0300h FFh
00h
Bank 3
through
Bank 61
FFh
3E00h
00h
Bank 62
3F00h FFh
00h
Bank 63
3FFFh FFh
Note 1: The Access RAM bit of the instruction can be used to force an override of the selected bank (BSR[5:0]) to the registers of the Access Bank.
DS40001919E-page 46
PIC18(L)F26/27/45/46/47/55/56/57K42
4.5.2 GENERAL PURPOSE REGISTER 4.5.4 ACCESS BANK
FILE To streamline access for the most commonly used data
General Purpose RAM is available starting Bank 0 of memory locations, the data memory is configured with
data memory. GPRs are not initialized by a Power-on an Access Bank, which allows users to access a
Reset and are unchanged on all other Resets. mapped block of memory without specifying a BSR.
The Access Bank consists of the first 96 bytes of
4.5.3 SPECIAL FUNCTION REGISTERS memory (00h-5Fh) in Bank 0 and the last 160 bytes of
The Special Function Registers (SFRs) are registers memory (60h-FFh) in Bank 63. The lower half is known
used by the CPU and peripheral modules for controlling as the “Access RAM” and is composed of GPRs. This
the desired operation of the device. These registers are upper half is also where some of the SFRs of the device
implemented as static RAM. SFRs start at the top of are mapped. These two areas are mapped
data memory (3FFFh) and extend downward to occupy contiguously in the Access Bank and can be addressed
Bank 56 through 63 (3800h to 3FFFh). A list of these linearly by an 8-bit address (Figure 4-4).
registers is given in Table 4-3 to Table 4-11. A bitwise The Access Bank is used by core PIC18 instructions
summary of these registers can be found in that include the Access RAM bit (the ‘a’ parameter in
Section 42.0 “Register Summary”. the instruction). When ‘a’ is equal to ‘1’, the instruction
uses the BSR and the 8-bit address included in the
opcode for the data memory address. When ‘a’ is ‘0’,
however, the instruction uses the Access Bank address
map; the current value of the BSR is ignored.
Using this “forced” addressing allows the instruction to
operate on a data address in a single cycle, without
updating the BSR first. For 8-bit addresses of 60h and
above, this means that users can evaluate and operate
on SFRs more efficiently. The Access RAM below 60h
is a good place for data values that the user might need
to access rapidly, such as immediate computational
results or common program variables. Access RAM
also allows for faster and more code efficient and
switching of variables.
The mapping of the Access Bank is slightly different
when the extended instruction set is enabled (XINST
Configuration bit = 1). This is discussed in more detail
in Section 4.8.3 “Mapping the Access Bank in
Indexed Literal Offset Mode”.
PIC18(L)F26/27/45/46/47/55/56/57K42
40F8h TMR3L_M1 40D8h CCPR1L_M2 40B8h ADREF_M1 4098h — 4078h — 4058h — 4038h — 4018h —
40F7h TMR1H_M1 40D7h T4PR_M4 40B7h ADCON3_M1 4097h — 4077h — 4057h — 4037h — 4017h —
40F6h TMR1L_M1 40D6h PWM8DCH_M1 40B6h ADCON2_M1 4096h ADRESH_M1 4076h — 4056h — 4036h — 4016h —
40F5h — 40D5h PWM8DCL_M1 40B5h ADCON1_M1 4095h ADRESL_M1 4075h — 4055h — 4035h — 4015h —
40F4h — 40D4h T4PR_M3 40B4h ADCON0_M1 4094h ADPCH_M1 4074h — 4054h — 4034h — 4014h —
40F3h — 40D3h PWM7DCH_M1 40B3h ADCAP_M2 4093h ADCAP_M1 4073h — 4053h — 4033h — 4013h —
40F2h — 40D2h PWM7DCL_M1 40B2h ADACQH_M2 4092h ADACQH_M1 4072h — 4052h — 4032h — 4012h —
40F1h — 40D1h T4PR_M2 40B1h ADACQL_M2 4091h ADACQL_M1 4071h — 4051h — 4031h — 4011h —
40F0h — 40D0h CCPR4H_M1 40B0h ADPREVH_M2 4090h ADPREVH_M1 4070h — 4050h — 4030h — 4010h —
40EFh PWM8DCH_M2 40CFh CCPR4L_M1 40AFh ADPREVL_M2 408Fh ADPREVL_M1 406Fh — 404Fh — 402Fh — 400Fh —
40EEh PWM8DCL_M2 40CEh T4PR_M1 40AEh ADRPT_M2 408Eh ADRPT_M1 406Eh — 404Eh — 402Eh — 400Eh —
40EDh PWM7DCH_M2 40CDh CCPR3H_M1 40ADh ADCNT_M2 408Dh ADCNT_M1 406Dh — 404Dh — 402Dh — 400Dh —
40ECh PWM7DCL_M2 40CCh CCPR3L_M1 40ACh ADACCU_M2 408Ch ADACCU_M1 406Ch — 404Ch — 402Ch — 400Ch —
40EBh PWM6DCH_M2 40CBh T2PR_M3 40ABh ADACCH_M2 408Bh ADACCH_M1 406Bh — 404Bh — 402Bh — 400Bh —
40EAh PWM6DCL_M2 40CAh PWM6DCH_M1 40AAh ADACCL_M2 408Ah ADACCL_M1 406Ah — 404Ah — 402Ah — 400Ah —
40E9h PWM5DCH_M3 40C9h PWM6DCL_M1 40A9h ADFLTRH_M2 4089h ADFLTRH_M1 4069h — 4049h — 4029h — 4009h —
40E8h PWM5DCL_M3 40C8h T2PR_M2 40A8h ADFLTRL_M2 4088h ADFLTRL_M1 4068h — 4048h — 4028h — 4008h —
40E7h CCPR4H_M2 40C7h PWM5DCH_M1 40A7h ADSTPTH_M2 4087h ADSTPTH_M1 4067h — 4047h — 4027h — 4007h —
40E6h CCPR4L_M2 40C6h PWM5DCL_M1 40A6h ADSTPTL_M2 4086h ADSTPTL_M1 4066h — 4046h — 4026h — 4006h —
40E5h CCPR3H_M2 40C5h T2PR_M2 40A5h ADERRH_M2 4085h ADERRH_M1 4065h — 4045h — 4025h — 4005h —
40E4h CCPR3L_M2 40C4h CCPR2H_M1 40A4h ADERRL_M2 4084h ADERRL_M1 4064h — 4044h — 4024h — 4004h —
40E3h CCPR2H_M2 40C3h CCPR2L_M1 40A3h ADUTHH_M2 4083h ADUTHH_M1 4063h IOCEF_M1 4043h — 4023h — 4003h —
40E2h CCPR2L_M2 40C2h T2PR_M1 40A2h ADUTHL_M2 4082h ADUTHL_M1 4062h IOCCF_M1 4042h — 4022h — 4002h —
40E1h CCPR1H_M3 40C1h CCPR1H_M1 40A1h ADLTHH_M2 4081h ADLTHH_M1 4061h IOCBF_M1 4041h — 4021h — 4001h —
40E0h CCPR1L_M3 40C0h CCPR1L_M1 40A0h ADLTHL_M2 4080h ADLTHL_M1 4060h IOCAF_M1 4040h — 4020h — 4000h —
Note 1: Addresses in this table are accessible ONLY through DMA Source and Destination Address Registers. CPU does not have access to these registers.
DS40001919E-page 48
TABLE 4-4: SPECIAL FUNCTION REGISTER MAP FOR PIC18(L)F26/27/45/46/47/55/56/57K42 DEVICES BANK 63
2017-2019 Microchip Technology Inc.
3FFFh TOSU 3FDFh INDF2 3FBFh LATF(3) 3F9Fh T4PR 3F7Fh CCP1CAP 3F5Fh CCPTMRS1 3F3Fh NCO1CLK 3F1Fh SMT1CON1
3FFEh TOSH 3FDEh POSTINC2 3FBEh LATE(2) 3F9Eh T4TMR 3F7Eh CCP1CON 3F5Eh CCPTMRS0 3F3Eh NCO1CON 3F1Eh SMT1CON0
3FFDh TOSL 3FDDh POSTDEC2 3FBDh LATD(2) 3F9Dh T5CLK 3F7Dh CCPR1H 3F5Dh — 3F3Dh NCO1INCU 3F1Dh SMT1PRU
3FFCh STKPTR 3FDCh PRECIN2 3FBCh LATC 3F9Ch T5GATE 3F7Ch CCPR1L 3F5Ch — 3F3Ch NCO1INCH 3F1Ch SMT1PRH
3FFBh PCLATU 3FDBh PLUSW2 3FBBh LATB 3F9Bh T5GCON 3F7Bh CCP2CAP 3F5Bh — 3F3Bh NCO1INCL 3F1Bh SMT1PRL
3FFAh PCLATH 3FDAh FSR2H 3FBAh LATA 3F9Ah T5CON 3F7Ah CCP2CON 3F5Ah CWG1STR 3F3Ah NCO1ACCU 3F1Ah SMT1CPWU
3FF9h PCL 3FD9h FSR2L 3FB9h T0CON1 3F99h TMR5H 3F79h CCPR2H 3F59h CWG1AS1 3F39h NCO1ACCH 3F19h SMT1CPWH
PIC18(L)F26/27/45/46/47/55/56/57K42
3FF8h TBLPRTU 3FD8h STATUS 3FB8h T0CON0 3F98h TMR5L 3F78h CCPR2L 3F58h CWG1AS0 3F38h NCO1ACCL 3F18h SMT1CPWL
3FF7h TBLPTRH 3FD7h IVTBASEU 3FB7h TMR0H 3F97h T6RST 3F77h CCP3CAP 3F57h CWG1CON1 3F37h — 3F17h SMT1CPRU
3FF6h TBLPTRL 3FD6h IVTBASEH 3FB6h TMR0L 3F96h T6CLK 3F76h CCP3CON 3F56h CWG1CON0 3F36h — 3F16h SMT1CPRH
3FF5h TABLAT 3FD5h IVTBASEL 3FB5h T1CLK 3F95h T6HLT 3F75h CCPR3H 3F55h CWG1DBF 3F35h — 3F15h SMT1CPRL
3FF4h PRODH 3FD4h IVTLOCK 3FB4h T1GATE 3F94h T6CON 3F74h CCPR3L 3F54h CWG1DBR 3F34h — 3F14h SMT1TMRU
3FF3h PRODL 3FD3h INTCON1 3FB3h T1GCON 3F93h T6PR 3F73h CCP4CAP 3F53h CWG1ISM 3F33h — 3F13h SMT1TMRH
3FF2h — 3FD2h INTCON0 3FB2h T1CON 3F92h T6TMR 3F72h CCP4CON 3F52h CWG1CLK 3F32h — 3F12h SMT1TMRL
3FF1h PCON1 3FD1h — 3FB1h TMR1H 3F91h — 3F71h CCPR4H 3F51h CWG2STR 3F31h — 3F11h —
3FF0h PCON0 3FD0h — 3FB0h TMR1L 3F90h — 3F70h CCPR4L 3F50h CWG2AS1 3F30h — 3F10h —
3FEFh INDF0 3FCFh PORTF(3) 3FAFh T2RST 3F8Fh — 3F6Fh — 3F4Fh CWG2AS0 3F2Fh — 3F0Fh —
3FEEh POSTINC0 3FCEh PORTE 3FAEh T2CLK 3F8Eh — 3F6Eh PWM5CON 3F4Eh CWG2CON1 3F2Eh — 3F0Eh —
3FEDh POSTDEC0 3FCDh PORTD(2) 3FADh T2HLT 3F8Dh — 3F6Dh PWM5DCH 3F4Dh CWG2CON0 3F2Dh — 3F0Dh —
3FECh PRECIN0 3FCCh PORTC 3FACh T2CON 3F8Ch — 3F6Ch PWM5DCL 3F4Ch CWG2DBF 3F2Ch — 3F0Ch —
3FEBh PLUSW0 3FCBh PORTB 3FABh T2PR 3F8Bh — 3F6Bh — 3F4Bh CWG2DBR 3F2Bh — 3F0Bh —
3FEAh FSR0H 3FCAh PORTA 3FAAh T2TMR 3F8Ah — 3F6Ah PWM6CON 3F4Ah CWG2ISM 3F2Ah — 3F0Ah —
3FE9h FSR0L 3FC9h — 3FA9h T3CLK 3F89h — 3F69h PWM6DCH 3F49h CWG2CLK 3F29h — 3F09h —
3FE8h WREG 3FC8h — 3FA8h T3GATE 3F88h — 3F68h PWM6DCL 3F48h CWG3STR 3F28h — 3F08h —
(3)
3FE7h INDF1 3FC7h TRISF 3FA7h T3GCON 3F87h — 3F67h — 3F47h CWG3AS1 3F27h — 3F07h —
3FE6h POSTINC1 3FC6h TRISE(2) 3FA6h T3CON 3F86h — 3F66h PWM7CON 3F46h CWG3AS0 3F26h — 3F06h —
3FE5h POSTDEC1 3FC5h TRISD(2) 3FA5h TMR3H 3F85h — 3F65h PWM7DCH 3F45h CWG3CON1 3F25h — 3F05h —
3FE4h PRECIN1 3FC4h TRISC 3FA4h TMR3L 3F84h — 3F64h PWM7DCL 3F44h CWG3CON0 3F24h — 3F04h —
3FE3h PLUSW1 3FC3h TRISB 3FA3h T4RST 3F83h — 3F63h — 3F43h CWG3DBF 3F23h SMT1WIN 3F03h —
3FE2h FSR1H 3FC2h TRISA 3FA2h T4CLK 3F82h — 3F62h PWM8CON 3F42h CWG3DBR 3F22h SMT1SIG 3F02h —
3FE1h FSR1L 3FC1h — 3FA1h T4HLT 3F81h — 3F61h PWM8DCH 3F41h CWG3ISM 3F21h SMT1CLK 3F01h —
3FE0h BSR 3FC0h — 3FA0h T4CON 3F80h — 3F60h PWM8DCL 3F40h CWG3CLK 3F20h SMT1STAT 3F00h —
Legend: Unimplemented data memory locations and registers, read as ‘0’.
Note 1: Unimplemented in LF devices.
2: Unimplemented in PIC18(L)F26/27K42.
3: Unimplemented in PIC18(L)F26/27/45/46/47K42.
DS40001919E-page 49
TABLE 4-5: SPECIAL FUNCTION REGISTER MAP FOR PIC18(L)F26/27/45/46/47/55/56/57K42 DEVICES BANK 62
2017-2019 Microchip Technology Inc.
3EFFh ADCLK 3EDFh ADLTHH 3EBFh CM1PCH 3E9Fh — 3E7Fh — 3E5Fh — 3E3Fh — 3E1Fh —
3EFEh ADACT 3EDEh ADLTHL 3EBEh CM1NCH 3E9Eh DAC1CON0 3E7Eh — 3E5Eh — 3E3Eh — 3E1Eh —
3EFDh ADREF 3EDDh — 3EBDh CM1CON1 3E9Dh — 3E7Dh — 3E5Dh — 3E3Dh — 3E1Dh —
3EFCh ADSTAT 3EDCh — 3EBCh CM1CON0 3E9Ch DAC1CON1 3E7Ch — 3E5Ch — 3E3Ch — 3E1Ch —
3EFBh ADCON3 3EDBh — 3EBBh CM2PCH 3E9Bh — 3E7Bh — 3E5Bh — 3E3Bh — 3E1Bh —
3EFAh ADCON2 3EDAh — 3EBAh CM2NCH 3E9Ah — 3E7Ah — 3E5Ah — 3E3Ah — 3E1Ah —
— — — — — —
PIC18(L)F26/27/45/46/47/55/56/57K42
3EF9h ADCON1 3ED9h 3EB9h CM2CON1 3E99h 3E79h 3E59h 3E39h 3E19h
3EF8h ADCON0 3ED8h — 3EB8h CM2CON0 3E98h — 3E78h — 3E58h — 3E38h — 3E18h —
3EF7h ADPREH 3ED7h ADCP 3EB7h — 3E97h — 3E77h — 3E57h — 3E37h — 3E17h —
3EF6h ADPREL 3ED6h — 3EB6h — 3E96h — 3E76h — 3E56h — 3E36h — 3E16h —
3EF5h ADCAP 3ED5h — 3EB5h — 3E95h — 3E75h — 3E55h — 3E35h — 3E15h —
3EF4h ADACQH 3ED4h — 3EB4h — 3E94h — 3E74h — 3E54h — 3E34h — 3E14h —
3EF3h ADACQL 3ED3h — 3EB3h — 3E93h — 3E73h — 3E53h — 3E33h — 3E13h —
2EF2h — 3ED2h — 3EB2h — 3E92h — 3E72h — 3E52h — 3E32h — 3E12h —
3EF1h ADPCH 3ED1h — 3EB1h — 3E91h — 3E71h — 3E51h — 3E31h — 3E11h —
3EF0h ADRESH 3ED0h — 3EB0h — 3E90h — 3E70h — 3E50h — 3E30h — 3E10h —
3EEFh ADRESL 3ECFh — 3EAFh — 3E8Fh — 3E6Fh — 3E4Fh — 3E2Fh — 3E0Fh —
3EEEh ADPREVH 3ECEh — 3EAEh — 3E8Eh — 3E6Eh — 3E4Eh — 3E2Eh — 3E0Eh —
3EEDh ADPREVL 3ECDh — 3EADh — 3E8Dh — 3E6Dh — 3E4Dh — 3E2Dh — 3E0Dh —
3EECh ADRPT 3ECCh — 3EACh — 3E8Ch — 3E6Ch — 3E4Ch — 3E2Ch — 3E0Ch —
3EEBh ADCNT 3ECBh — 3EABh — 3E8Bh — 3E6Bh — 3E4Bh — 3E2Bh — 3E0Bh —
3EEAh ADACCU 3ECAh HLVDCON1 3EAAh — 3E8Ah — 3E6Ah — 3E4Ah — 3E2Ah — 3E0Ah —
3EE9h ADACCH 3EC9h HLVDCON0 3EA9h — 3E89h — 3E69h — 3E49h — 3E29h — 3E09h —
3EE8h ADACCL 3EC8h — 3EA8h — 3E88h — 3E68h — 3E48h — 3E28h — 3E08h —
3EE7h ADFLTRH 3EC7h — 3EA7h — 3E87h — 3E67h — 3E47h — 3E27h — 3E07h —
3EE6h ADFLTRL 3EC6h — 3EA6h — 3E86h — 3E66h — 3E46h — 3E26h — 3E06h —
3EE5h ADSTPTH 3EC5h — 3EA5h — 3E85h — 3E65h — 3E45h — 3E25h — 3E05h —
3EE4h ADSTPTL 3EC4h — 3EA4h — 3E84h — 3E64h — 3E44h — 3E24h — 3E04h —
3EE3h ADERRH 3EC3h ZCDCON 3EA3h — 3E83h — 3E63h — 3E43h — 3E23h — 3E03h —
3EE2h ADERRL 3EC2h — 3EA2h — 3E82h — 3E62h — 3E42h — 3E22h — 3E02h —
3EE1h ADUTHH 3EC1h FVRCON 3EA1h — 3E81h — 3E61h — 3E41h — 3E21h — 3E01h —
3EE0h ADUTHL 3EC0h CMOUT 3EA0h — 3E80h — 3E60h — 3E40h — 3E20h — 3E00h —
Legend: Unimplemented data memory locations and registers, read as ‘0’.
Note 1: Unimplemented in LF devices.
2: Unimplemented in PIC18(L)F26/27K42.
3: Unimplemented in PIC18(L)F26/27/45/46/47K42.
DS40001919E-page 50
TABLE 4-6: SPECIAL FUNCTION REGISTER MAP FOR PIC18(L)F26/27/45/46/47/55/56/57K42 DEVICES BANK 61
2017-2019 Microchip Technology Inc.
3DFFh — 3DDFh U2FIFO 3DBFh — 3D9Fh — 3D7Fh — 3D5Fh I2C2CON2 3D3Fh — 3D1Fh —
3DFEh — 3DDEh U2BRGH 3DBEh — 3D9Eh — 3D7Eh — 3D5Eh I2C2CON1 3D3Eh — 3D1Eh —
3DFDh — 3DDDh U2BRGL 3DBDh — 3D9Dh — 3D7Dh — 3D5Dh I2C2CON0 3D3Dh — 3D1Dh —
3DFCh — 3DDCh U2CON2 3DBCh — 3D9Ch — 3D7Ch I2C1BTO 3D5Ch I2C2ADR3 3D3Ch — 3D1Ch SPI1CLK
3DFBh — 3DDBh U2CON1 3DBBh — 3D9Bh — 3D7Bh I2C1CLK 3D5Bh I2C2ADR2 3D3Bh — 3D1Bh SPI1INTE
3DFAh U1ERRIE 3DDAh U2CON0 3DBAh — 3D9Ah — 3D7Ah I2C1PIE 3D5Ah I2C2ADR1 3D3Ah — 3D1Ah SPI1INTF
3DF9h U1ERRIR 3DD9h — 3DB9h — 3D99h — 3D79h I2C1PIR 3D59h I2C2ADR0 3D39h — 3D19h SPI1BAUD
PIC18(L)F26/27/45/46/47/55/56/57K42
3DF8h U1UIR 3DD8h U2P3L 3DB8h — 3D98h — 3D78h I2C1STAT1 3D58h I2C2ADB1 3D38h — 3D18h SPI1TWIDTH
3DF7h U1FIFO 3DD7h — 3DB7h — 3D97h — 3D77h I2C1STAT0 3D57h I2C2ADB0 3D37h — 3D17h SPI1STATUS
3DF6h U1BRGH 3DD6h U2P2L 3DB6h — 3D96h — 3D76h I2C1ERR 3D56h I2C2CNT 3D36h — 3D16h SPI1CON2
3DF5h U1BRGL 3DD5h — 3DB5h — 3D95h — 3D75h I2C1CON2 3D55h I2C2TXB 3D35h — 3D15h SPI1CON1
3DF4h U1CON2 3DD4h U2P1L 3DB4h — 3D94h — 3D74h I2C1CON1 3D54h I2C2RXB 3D34h — 3D14h SPI1CON0
3DF3h U1CON1 3DD3h — 3DB3h — 3D93h — 3D73h I2C1CON0 3D53h — 3D33h — 3D13h SPI1TCNTH
3DF2h U1CON0 3DD2h U2TXB 3DB2h — 3D92h — 3D72h I2C1ADR3 3D52h — 3D32h — 3D12h SPI1TCNTL
3DF1h U1P3H 3DD1h — 3DB1h — 3D91h — 3D71h I2C1ADR2 3D51h — 3D31h — 3D11h SPI1TXB
3DF0h U1P3L 3DD0h U2RXB 3DB0h — 3D90h — 3D70h I2C1ADR1 3D50h — 3D30h — 3D10h SPI1RXB
3DEFh U1P2H 3DCFh — 3DAFh — 3D8Fh — 3D6Fh I2C1ADR0 3D4Fh — 3D2Fh — 3D0Fh —
3DEEh U1P2L 3DCEh — 3DAEh — 3D8Eh — 3D6Eh I2C1ADB1 3D4Eh — 3D2Eh — 3D0Eh —
3DEDh U1P1H 3DCDh — 3DADh — 3D8Dh — 3D6Dh I2C1ADB0 3D4Dh — 3D2Dh — 3D0Dh —
3DECh U1P1L 3DCCh — 3DACh — 3D8Ch — 3D6Ch I2C1CNT 3D4Ch — 3D2Ch — 3D0Ch —
3DEBh U1TXCHK 3DCBh — 3DABh — 3D8Bh — 3D6Bh I2C1TXB 3D4Bh — 3D2Bh — 3D0Bh —
3DEAh U1TXB 3DCAh — 3DAAh — 3D8Ah — 3D6Ah I2C1RXB 3D4Ah — 3D2Ah — 3D0Ah —
3DE9h U1RXCHK 3DC9h — 3DA9h — 3D89h — 3D69h — 3D49h — 3D29h — 3D09h —
3DE8h U1RXB 3DC8h — 3DA8h — 3D88h — 3D68h — 3D48h — 3D28h — 3D08h —
3DE7h — 3DC7h — 3DA7h — 3D87h — 3D67h — 3D47h — 3D27h — 3D07h —
3DE6h — 3DC6h — 3DA6h — 3D86h — 3D66h I2C2BTO 3D46h — 3D26h — 3D06h —
3DE5h — 3DC5h — 3DA5h — 3D85h — 3D65h I2C2CLK 3D45h — 3D25h — 3D05h —
3DE4h — 3DC4h — 3DA4h — 3D84h — 3D64h I2C2PIE 3D44h — 3D24h — 3D04h —
3DE3h — 3DC3h — 3DA3h — 3D83h — 3D63h I2C2PIR 3D43h — 3D23h — 3D03h —
3DE2h U2ERRIE 3DC2h — 3DA2h — 3D82h — 3D62h I2C2STAT1 3D42h — 3D22h — 3D02h —
3DE1h U2ERRIR 3DC1h — 3DA1h — 3D81h — 3D61h I2C2STAT0 3D41h — 3D21h — 3D01h —
3DE0h U2UIR 3DC0h — 3DA0h — 3D80h — 3D60h I2C2ERR 3D40h — 3D20h — 3D00h —
Legend: Unimplemented data memory locations and registers, read as ‘0’.
Note 1: Unimplemented in LF devices.
2: Unimplemented in PIC18(L)F26/27K42.
3: Unimplemented in PIC18(L)F26/27/45/46/47K42.
DS40001919E-page 51
TABLE 4-7: SPECIAL FUNCTION REGISTER MAP FOR PIC18(L)F26/27/45/46/47/55/56/57K42 DEVICES BANK 60
2017-2019 Microchip Technology Inc.
PIC18(L)F26/27/45/46/47/55/56/57K42
3CF8h — 3CD8h — 3CB8h — 3C98h — 3C78h CLC1SEL2 3C58h CLC4SEL0 3C38h — 3C18h —
3CF7h — 3CD7h — 3CB7h — 3C97h — 3C77h CLC1SEL1 3C57h CLC4POL 3C37h — 3C17h —
3CF6h — 3CD6h — 3CB6h — 3C96h — 3C76h CLC1SEL0 3C56h CLC4CON 3C36h — 3C16h —
3CF5h — 3CD5h — 3CB5h — 3C95h — 3C75h CLC1POL 3C55h — 3C35h — 3C15h —
3CF4h — 3CD4h — 3CB4h — 3C94h — 3C74h CLC1CON 3C54h — 3C34h — 3C14h —
3CF3h — 3CD3h — 3CB3h — 3C93h — 3C73h CLC2GLS3 3C53h — 3C33h — 3C13h —
3CF2h — 3CD2h — 3CB2h — 3C92h — 3C72h CLC2GLS2 3C52h — 3C32h — 3C12h —
3CF1h — 3CD1h — 3CB1h — 3C91h — 3C71h CLC2GLS1 3C51h — 3C31h — 3C11h —
3CF0h — 3CD0h — 3CB0h — 3C90h — 3C70h CLC2GLS0 3C50h — 3C30h — 3C10h —
3CEFh — 3CCFh — 3CAFh — 3C8Fh — 3C6Fh CLC2SEL3 3C4Fh — 3C2Fh — 3C0Fh —
3CEEh — 3CCEh — 3CAEh — 3C8Eh — 3C6Eh CLC2SEL2 3C4Eh — 3C2Eh — 3C0Eh —
3CEDh — 3CCDh — 3CADh — 3C8Dh — 3C6Dh CLC2SEL1 3C4Dh — 3C2Dh — 3C0Dh —
3CECh — 3CCCh — 3CACh — 3C8Ch — 3C6Ch CLC2SEL0 3C4Ch — 3C2Ch — 3C0Ch —
3CEBh — 3CCBh — 3CABh — 3C8Bh — 3C6Bh CLC2POL 3C4Bh — 3C2Bh — 3C0Bh —
3CEAh — 3CCAh — 3CAAh — 3C8Ah — 3C6Ah CLC2CON 3C4Ah — 3C2Ah — 3C0Ah —
3CE9h — 3CC9h — 3CA9h — 3C89h — 3C69h CLC3GLS3 3C49h — 3C29h — 3C09h —
3CE8h — 3CC8h — 3CA8h — 3C88h — 3C68h CLC3GLS2 3C48h — 3C28h — 3C08h —
3CE7h — 3CC7h — 3CA7h — 3C87h — 3C67h CLC3GLS1 3C47h — 3C27h — 3C07h —
3CE6h CLKRCLK 3CC6h — 3CA6h — 3C86h — 3C66h CLC3GLS0 3C46h — 3C26h — 3C06h —
3CE5h CLKRCON 3CC5h — 3CA5h — 3C85h — 3C65h CLC3SEL3 3C45h — 3C25h — 3C05h —
3CE4h — 3CC4h — 3CA4h — 3C84h — 3C64h CLC3SEL2 3C44h — 3C24h — 3C04h —
3CE3h — 3CC3h — 3CA3h — 3C83h — 3C63h CLC3SEL1 3C43h — 3C23h — 3C03h —
3CE2h — 3CC2h — 3CA2h — 3C82h — 3C62h CLC3SEL0 3C42h — 3C22h — 3C02h —
3CE1h — 3CC1h — 3CA1h — 3C81h — 3C61h CLC3POL 3C41h — 3C21h — 3C01h —
3CE0h — 3CC0h — 3CA0h — 3C80h — 3C60h CLC3CON 3C40h — 3C20h — 3C00h —
Legend: Unimplemented data memory locations and registers, read as ‘0’.
Note 1: Unimplemented in LF devices.
2: Unimplemented in PIC18(L)F26/27K42.
3: Unimplemented in PIC18(L)F26/27/45/46/47K42.
DS40001919E-page 52
TABLE 4-8: SPECIAL FUNCTION REGISTER MAP FOR PIC18(L)F26/27/45/46/47/55/56/57K42 DEVICES BANK 59
2017-2019 Microchip Technology Inc.
3BFFh DMA1SIRQ 3BDFh DMA2SIRQ 3BBFh — 3B9Fh — 3B7Fh — 3B5Fh — 3B3Fh — 3B1Fh —
3BFEh DMA1AIRQ 3BDEh DMA2AIRQ 3BBEh — 3B9Eh — 3B7Eh — 3B5Eh — 3B3Eh — 3B1Eh —
3BFDh DMA1CON1 3BDDh DMA2CON1 3BBDh — 3B9Dh — 3B7Dh — 3B5Dh — 3B3Dh — 3B1Dh —
3BFCh DMA1CON0 3BDCh DMA2CON0 3BBCh — 3B9Ch — 3B7Ch — 3B5Ch — 3B3Ch — 3B1Ch —
3BFBh DMA1SSAU 3BDBh DMA2SSAU 3BBBh — 3B9Bh — 3B7Bh — 3B5Bh — 3B3Bh — 3B1Bh —
3BFAh DMA1SSAH 3BDAh DMA2SSAH 3BBAh — 3B9Ah — 3B7Ah — 3B5Ah — 3B3Ah — 3B1Ah —
3BF9h DMA1SSAL 3BD9h DMA2SSAL 3BB9h — 3B99h — 3B79h — 3B59h — 3B39h — 3B19h —
PIC18(L)F26/27/45/46/47/55/56/57K42
3BF8h DMA1SSZH 3BD8h DMA2SSZH 3BB8h — 3B98h — 3B78h — 3B58h — 3B38h — 3B18h —
3BF7h DMA1SSZL 3BD7h DMA2SSZL 3BB7h — 3B97h — 3B77h — 3B57h — 3B37h — 3B17h —
3BF6h DMA1SPTRU 3BD6h DMA2SPTRU 3BB6h — 3B96h — 3B76h — 3B56h — 3B36h — 3B16h —
3BF5h DMA1SPTRH 3BD5h DMA2SPTRH 3BB5h — 3B95h — 3B75h — 3B55h — 3B35h — 3B15h —
3BF4h DMA1SPTRL 3BD4h DMA2SPTRL 3BB4h — 3B94h — 3B74h — 3B54h — 3B34h — 3B14h —
3BF3h DMA1SCNTH 3BD3h DMA2SCNTH 3BB3h — 3B93h — 3B73h — 3B53h — 3B33h — 3B13h —
3BF2h DMA1SCNTL 3BD2h DMA2SCNTL 3BB2h — 3B92h — 3B72h — 3B52h — 3B32h — 3B12h —
3BF1h DMA1DSAH 3BD1h DMA2DSAH 3BB1h — 3B91h — 3B71h — 3B51h — 3B31h — 3B11h —
3BF0h DMA1DSAL 3BD0h DMA2DSAL 3BB0h — 3B90h — 3B70h — 3B50h — 3B30h — 3B10h —
3BEFh DMA1DSZH 3BCFh DMA2DSZH 3BAFh — 3B8Fh — 3B6Fh — 3B4Fh — 3B2Fh — 3B0Fh —
3BEEh DMA1DSZL 3BCEh DMA2DSZL 3BAEh — 3B8Eh — 3B6Eh — 3B4Eh — 3B2Eh — 3B0Eh —
3BEDh DMA1DPTRH 3BCDh DMA2DPTRH 3BADh — 3B8Dh — 3B6Dh — 3B4Dh — 3B2Dh — 3B0Dh —
3BECh DMA1DPTRL 3BCCh DMA2DPTRL 3BACh — 3B8Ch — 3B6Ch — 3B4Ch — 3B2Ch — 3B0Ch —
3BEBh DMA1DCNTH 3BCBh DMA2DCNTH 3BABh — 3B8Bh — 3B6Bh — 3B4Bh — 3B2Bh — 3B0Bh —
3BEAh DMA1DCNTL 3BCAh DMA2DCNTL 3BAAh — 3B8Ah — 3B6Ah — 3B4Ah — 3B2Ah — 3B0Ah —
3BE9h DMA1BUF 3BC9h DMA2BUF 3BA9h — 3B89h — 3B69h — 3B49h — 3B29h — 3B09h —
3BE8h — 3BC8h — 3BA8h — 3B88h — 3B68h — 3B48h — 3B28h — 3B08h —
3BE7h — 3BC7h — 3BA7h — 3B87h — 3B67h — 3B47h — 3B27h — 3B07h —
3BE6h — 3BC6h — 3BA6h — 3B86h — 3B66h — 3B46h — 3B26h — 3B06h —
3BE5h — 3BC5h — 3BA5h — 3B85h — 3B65h — 3B45h — 3B25h — 3B05h —
3BE4h — 3BC4h — 3BA4h — 3B84h — 3B64h — 3B44h — 3B24h — 3B04h —
3BE3h — 3BC3h — 3BA3h — 3B83h — 3B63h — 3B43h — 3B23h — 3B03h —
3BE2h — 3BC2h — 3BA2h — 3B82h — 3B62h — 3B42h — 3B22h — 3B02h —
3BE1h — 3BC1h — 3BA1h — 3B81h — 3B61h — 3B41h — 3B21h — 3B01h —
3BE0h — 3BC0h — 3BA0h — 3B80h — 3B60h — 3B40h — 3B20h — 3B00h —
Legend: Unimplemented data memory locations and registers, read as ‘0’.
Note 1: Unimplemented in LF devices.
2: Unimplemented in PIC18(L)F26/27K42.
3: Unimplemented in PIC18(L)F26/27/45/46/47K42.
DS40001919E-page 53
TABLE 4-9: SPECIAL FUNCTION REGISTER MAP FOR PIC18(L)F26/27/45/46/47/55/56/57K42 DEVICES BANK 58
2017-2019 Microchip Technology Inc.
3AFFh — 3ADFh SPI1SDIPPS 3ABFh PPSLOCK 3A9Fh — 3A7Fh — 3A5Fh — 3A3Fh — 3A1Fh RD7PPS(2)
3AFEh — 3ADEh SPI1SCKPPS 3ABEh —(4) 3A9Eh — 3A7Eh — 3A5Eh — 3A3Eh — 3A1Eh RD6PPS(2)
3AFDh — 3ADDh ADACTPPS 3ABDh — 3A9Dh — 3A7Dh — 3A5Dh — 3A3Dh — 3A1Dh RD5PPS(2)
3AFCh — 3ADCh CLCIN3PPS 3ABCh — 3A9Ch — 3A7Ch — 3A5Ch — 3A3Ch — 3A1Ch RD4PPS(2)
3AFBh — 3ADBh CLCIN2PPS 3ABBh — 3A9Bh — 3A7Bh RD1I2C(2) 3A5Bh RB2I2C 3A3Bh — 3A1Bh RD3PPS(2)
3AFAh — 3ADAh CLCIN1PPS 3ABAh — 3A9Ah — 3A7Ah RD0I2C(2) 3A5Ah RB1I2C 3A3Ah — 3A1Ah RD2PPS(2)
3AF9h — 3AD9h CLCIN0PPS 3AB9h — 3A99h —(4) 3A79h —(4) 3A59h —(4) 3A39h — 3A19h RD1PPS(2)
PIC18(L)F26/27/45/46/47/55/56/57K42
3AF8h — 3AD8h MD1SRCPPS 3AB8h — 3A98h —(4) 3A78h —(4) 3A58h —(4) 3A38h — 3A18h RD0PPS(2)
3AF7h — 3AD7h MD1CARHPPS 3AB7h — 3A97h — 3A77h — 3A57h IOCBF 3A37h — 3A17h RC7PPS
3AF6h — 3AD6h MD1CARLPPS 3AB6h — 3A96h — 3A76h — 3A56h IOCBN 3A36h — 3A16h RC6PPS
3AF5h — 3AD5h CWG3INPPS 3AB5h — 3A95h — 3A75h — 3A55h IOCBP 3A35h — 3A15h RC5PPS
3AF4h — 3AD4h CWG2INPPS 3AB4h — 3A94h INLVLF(3) 3A74h INLVLD(2) 3A54h INLVLB 3A34h — 3A14h RC4PPS
3AF3h — 3AD3h CWG1INPPS 3AB3h — 3A93h SLRCONF(3) 3A73h SLRCOND(2) 3A53h SLRCONB 3A33h — 3A13h RC3PPS
3AF2h — 3AD2h SMT1SIGPPS 3AB2h — 3A92h ODCONF(3) 3A72h ODCOND(2) 3A52h ODCONB 3A32h — 3A12h RC2PPS
3AF1h — 3AD1h SMT1WINPPS 3AB1h — 3A91h WPUF(3) 3A71h WPUD(2) 3A51h WPUB 3A31h — 3A11h RC1PPS
3AF0h — 3AD0h CCP4PPS 3AB0h — 3A90h ANSELF(3) 3A70h ANSELD(2) 3A50h ANSELB 3A30h — 3A10h RC0PPS
3AEFh — 3ACFh CCP3PPS 3AAFh — 3A8Fh — 3A6Fh — 3A4Fh — 3A2Fh RF7PPS(3) 3A0Fh RB7PPS
3AEEh — 3ACEh CCP2PPS 3AAEh — 3A8Eh — 3A6Eh — 3A4Eh — 3A2Eh RF6PPS(3) 3A0Eh RB6PPS
3AEDh — 3ACDh CCP1PPS 3AADh — 3A8Dh — 3A6Dh — 3A4Dh — 3A2Dh RF5PPS(3) 3A0Dh RB5PPS
3AECh — 3ACCh T6INPPS 3AACh — 3A8Ch — 3A6Ch — 3A4Ch — 3A2Ch RF4PPS(3) 3A0Ch RB4PPS
3AEBh — 3ACBh T4INPPS 3AABh — 3A8Bh — 3A6Bh RC4I2C 3A4Bh — 3A2Bh RF3PPS(3) 3A0Bh RB3PPS
3AEAh — 3ACAh T2INPPS 3AAAh — 3A8Ah — 3A6Ah RC3I2C 3A4Ah — 3A2Ah RF2PPS(3) 3A0Ah RB2PPS
3AE9h U2CTSPPS 3AC9h T5GPPS 3AA9h — 3A89h —(4) 3A69h —(4) 3A49h —(4) 3A29h RF1PPS(3) 3A09h RB1PPS
3AE8h U2RXPPS 3AC8h T5CKIPPS 3AA8h — 3A88h —(4) 3A68h —(4) 3A48h —(4) 3A28h RF0PPS(3) 3A08h RB0PPS
3AE7h — 3AC7h T3GPPS 3AA7h — 3A87h IOCEF 3A67h IOCCF 3A47h IOCAF 3A27h — 3A07h RA7PPS
3AE6h U1CTSPPS 3AC6h T3CKIPPS 3AA6h — 3A86h IOCEN 3A66h IOCCN 3A46h IOCAN 3A26h — 3A06h RA6PPS
3AE5h U1RXPPS 3AC5h T1GPPS 3AA5h — 3A85h IOCEP 3A65h IOCCP 3A45h IOCAP 3A25h — 3A05h RA5PPS
3AE4h I2C2SDAPPS 3AC4h T1CKIPPS 3AA4h — 3A84h INLVLE 3A64h INLVLC 3A44h INLVLA 3A24h — 3A04h RA4PPS
3AE3h I2C2SCLPPS 3AC3h T0CKIPPS 3AA3h — 3A83h SLRCONE(2) 3A63h SLRCONC 3A43h SLRCONA 3A23h — 3A03h RA3PPS
3AE2h I2C1SDAPPS 3AC2h INT2PPS 3AA2h — 3A82h ODCONE(2) 3A62h ODCONC 3A42h ODCONA 3A22h RE2PPS(2) 3A02h RA2PPS
3AE1h I2C1SCLPPS 3AC1h INT1PPS 3AA1h — 3A81h WPUE 3A61h WPUC 3A41h WPUA 3A21h RE1PPS(2) 3A01h RA1PPS
3AE0h SPI1SSPPS 3AC0h INT0PPS 3AA0h — 3A80h ANSELE(2) 3A60h ANSELC 3A40h ANSELA 3A20h RE0PPS(2) 3A00h RA0PPS
Legend: Unimplemented data memory locations and registers, read as ‘0’.
Note 1: Unimplemented in LF devices.
2: Unimplemented in PIC18(L)F26/27K42.
3: Unimplemented in PIC18(L)F26/27/45/46/47K42.
4: Reserved, maintain as ‘0’.
DS40001919E-page 54
TABLE 4-10: SPECIAL FUNCTION REGISTER MAP FOR PIC18(L)F26/27/45/46/47/55/56/57K42 DEVICES BANK 57
2017-2019 Microchip Technology Inc.
39FFh — 39DFh OSCFRQ 39BFh — 399Fh — 397Fh — 395Fh WDTU 393Fh — 391Fh —
39FEh — 39DEh OSCTUNE 39BEh — 399Eh — 397Eh — 395Eh WDTH 393Eh — 391Eh —
39FDh — 39DDh OSCEN 39BDh — 399Dh — 397Dh SCANTRIG 395Dh WDTL 393Dh — 391Dh —
39FCh — 39DCh OSCSTAT 39BCh — 399Ch — 397Ch SCANCON0 395Ch WDTCON1 393Ch — 391Ch —
39FBh — 39DBh OSCCON3 39BBh — 399Bh — 397Bh SCANHADRU 395Bh WDTCON0 393Bh — 391Bh —
39FAh — 39DAh OSCCON2 39BAh — 399Ah PIE10 397Ah SCANHADRH 395Ah — 393Ah — 391Ah —
39F9h — 39D9h OSCCON1 39B9h — 3999h PIE9 3979h SCANHADRL 3959h — 3939h — 3919h —
PIC18(L)F26/27/45/46/47/55/56/57K42
39F8h — 39D8h CPUDOZE 39B8h — 3998h PIE8 3978h SCANLADRU 3958h — 3938h — 3918h —
39F7h SCANPR 39D7h — 39B7h — 3997h PIE7 3977h SCANLADRH 3957h — 3937h — 3917h —
39F6h — 39D6h — 39B6h — 3996h PIE6 3976h SCANLADRL 3956h — 3936h — 3916h —
39F5h — 39D5h — 39B5h — 3995h PIE5 3975h — 3955h — 3935h — 3915h —
39F4h DMA2PR 39D4h — 39B4h — 3994h PIE4 3974h — 3954h — 3934h — 3914h —
39F3h DMA1PR 39D3h — 39B3h — 3993h PIE3 3973h — 3953h — 3933h — 3913h —
39F2h MAINPR 39D2h — 39B2h — 3992h PIE2 3972h — 3952h — 3932h — 3912h —
39F1h ISRPR 39D1h VREGCON(1) 39B1h — 3991h PIE1 3971h — 3951h — 3931h — 3911h —
39F0h — 39D0h BORCON 39B0h — 3990h PIE0 3970h — 3950h — 3930h — 3910h —
39EFh PRLOCK 39CFh — 39AFh — 398Fh — 396Fh — 394Fh — 392Fh — 390Fh —
39EEh — 39CEh — 39AEh — 398Eh — 396Eh — 394Eh — 392Eh — 390Eh —
39EDh — 39CDh — 39ADh — 398Dh — 396Dh — 394Dh — 392Dh — 390Dh —
39ECh — 39CCh — 39ACh — 398Ch — 396Ch — 394Ch — 392Ch — 390Ch —
39EBh — 39CBh — 39ABh — 398Bh — 396Bh — 394Bh — 392Bh — 390Bh —
39EAh — 39CAh — 39AAh PIR10 398Ah IPR10 396Ah — 394Ah — 392Ah — 390Ah —
39E9h — 39C9h — 39A9h PIR9 3989h IPR9 3969h CRCCON1 3949h — 3929h — 3909h —
39E8h — 39C8h — 39A8h PIR8 3988h IPR8 3968h CRCCON0 3948h — 3928h — 3908h —
39E7h — 39C7h PMD7 39A7h PIR7 3987h IPR7 3967h CRCXORH 3947h — 3927h — 3907h —
39E6h NVMCON2 39C6h PMD6 39A6h PIR6 3986h IPR6 3966h CRCXORL 3946h — 3926h — 3906h —
39E5h NVMCON1 39C5h PMD5 39A5h PIR5 3985h IPR5 3965h CRCSHIFTH 3945h — 3925h — 3905h —
39E4h — 39C4h PMD4 39A4h PIR4 3984h IPR4 3964h CRCSHIFTL 3944h — 3924h — 3904h —
39E3h NVMDAT 39C3h PMD3 39A3h PIR3 3983h IPR3 3963h CRCACCH 3943h — 3923h — 3903h —
39E2h — 39C2h PMD2 39A2h PIR2 3982h IPR2 3962h CRCACCL 3942h — 3922h — 3902h —
39E1h NVMADRH(4) 39C1h PMD1 39A1h PIR1 3981h IPR1 3961h CRCDATH 3941h — 3921h — 3901h —
39E0h NVMADRL 39C0h PMD0 39A0h PIR0 3980h IPR0 3960h CRCDATL 3940h — 3920h — 3900h —
Legend: Unimplemented data memory locations and registers, read as ‘0’.
Note 1: Unimplemented in LF devices.
2: Unimplemented in PIC18(L)F26/27K42.
3: Unimplemented in PIC18(L)F26/27/45/46/47K42.
4: Unimplemented in PIC18(L)F45/46K42.
DS40001919E-page 55
TABLE 4-11: SPECIAL FUNCTION REGISTER MAP FOR PIC18(L)F26/27/45/46/47/55/56/57K42 DEVICES BANK 56
2017-2019 Microchip Technology Inc.
PIC18(L)F26/27/45/46/47/55/56/57K42
38F8h — 38D8h — 38B8h — 3898h — 3878h — 3858h — 3838h — 3818h —
38F7h — 38D7h — 38B7h — 3897h — 3877h — 3857h — 3837h — 3817h —
38F6h — 38D6h — 38B6h — 3896h — 3876h — 3856h — 3836h — 3816h —
38F5h — 38D5h — 38B5h — 3895h — 3875h — 3855h — 3835h — 3815h —
38F4h — 38D4h — 38B4h — 3894h — 3874h — 3854h — 3834h — 3814h —
38F3h — 38D3h — 38B3h — 3893h — 3873h — 3853h — 3833h — 3813h —
38F2h — 38D2h — 38B2h — 3892h — 3872h — 3852h — 3832h — 3812h —
38F1h — 38D1h — 38B1h — 3891h — 3871h — 3851h — 3831h — 3811h —
38F0h — 38D0h — 38B0h — 3890h PRODH_SHAD 3870h — 3850h — 3830h — 3810h —
38EFh — 38CFh — 38AFh — 388Fh PRODL_SHAD 386Fh — 384Fh — 382Fh — 380Fh —
38EEh — 38CEh — 38AEh — 388Eh FSR2H_SHAD 386Eh — 384Eh — 382Eh — 380Eh —
38EDh — 38CDh — 38ADh — 388Dh FSR2L_SHAD 386Dh — 384Dh — 382Dh — 380Dh —
38ECh — 38CCh — 38ACh — 388Ch FSR1H_SHAD 386Ch — 384Ch — 382Ch — 380Ch —
38EBh — 38CBh — 38ABh — 388Bh FSR1L_SHAD 386Bh — 384Bh — 382Bh — 380Bh —
38EAh — 38CAh — 38AAh — 388Ah FSR0H_SHAD 386Ah — 384Ah — 382Ah — 380Ah —
38E9h — 38C9h — 38A9h — 3889h FSR0L_SHAD 3869h — 3849h — 3829h — 3809h —
38E8h — 38C8h — 38A8h — 3888h PCLATU_SHAD 3868h — 3848h — 3828h — 3808h —
38E7h — 38C7h — 38A7h — 3887h PCLATH_SHAD 3867h — 3847h — 3827h — 3807h —
38E6h — 38C6h — 38A6h — 3886h BSR_SHAD 3866h — 3846h — 3826h — 3806h —
38E5h — 38C5h — 38A5h — 3885h WREG_SHAD 3865h — 3845h — 3825h — 3805h —
38E4h — 38C4h — 38A4h — 3884h STATUS_SHAD 3864h — 3844h — 3824h — 3804h —
38E3h — 38C3h — 38A3h — 3883h SHADCON 3863h — 3843h — 3823h — 3803h —
38E2h — 38C2h — 38A2h — 3882h BSR_CSHAD 3862h — 3842h — 3822h — 3802h —
38E1h — 38C1h — 38A1h — 3881h WREG_CSHAD 3861h — 3841h — 3821h — 3801h —
38E0h — 38C0h — 38A0h — 3880h STATUS_CSHAD 3860h — 3840h — 3820h — 3800h —
Legend: Unimplemented data memory locations and registers, read as ‘0’.
Note 1: Unimplemented in LF devices.
2: Unimplemented in PIC18(L)F26/27K42.
3: Unimplemented in PIC18(L)F26/27/45/46/47K42.
DS40001919E-page 56
PIC18(L)F26/27/45/46/47/55/56/57K42
4.5.5 STATUS REGISTER
The STATUS register, shown in Register 4-2, contains
the arithmetic status of the ALU. As with any other SFR,
it can be the operand for any instruction.
If the STATUS register is the destination for an
instruction that affects the Z, DC, C, OV or N bits, the
results of the instruction are not written; instead, the
STATUS register is updated according to the
instruction performed. Therefore, the result of an
instruction with the STATUS register as its destination
may be different than intended. As an example, CLRF
STATUS will set the Z bit and leave the remaining
Status bits unchanged (‘0uuu u1uu’).
It is recommended that only BCF, BSF, SWAPF, MOVFF,
MOVWF and MOVFFL instructions are used to alter the
STATUS register, because these instructions do not
affect the Z, C, DC, OV or N bits in the STATUS
register.
For other instructions that do not affect Status bits, see
the instruction set summaries in Section
41.2 “Extended Instruction Set” and Table 41-3.
Note: The C and DC bits operate as the borrow
and digit borrow bits, respectively, in
subtraction.
— TO PD N OV Z DC C
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
0000h
When ‘a’ = 0 and f 60h:
0060h
The instruction executes in
Direct Forced mode. ‘f’ is inter- Bank 0
BSR
When ‘a’ = 1 (all values of f): 0000h 00000000
FIGURE 4-8: REMAPPING THE ACCESS BANK WITH INDEXED LITERAL OFFSET
ADDRESSING
Example Situation:
ADDWF f, d, a 0000h
FSR2H:FSR2L = 120h
Bank 0
Locations in the region
from the FSR2 pointer 0100h
(0120h) to the pointer plus Bank 1
0120h
05Fh (017Fh) are mapped Window
017Fh 00h
to the bottom of the
Bank 1
Access RAM (000h-05Fh). 0200h Bank 1 “Window”
Special File Registers at 5Fh
60h
3F60h through 3FFFh are
mapped to 60h through Bank 2
FFh, as usual. SFRs
through
Bank 0 addresses below Bank 62
5Fh can still be addressed FFh
by using the BSR. Access Bank
3F00h
Bank 63
3F60h
SFRs
3FFFh
Data Memory
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘1’
-n = Value for blank device ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘1’
-n = Value for blank device ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘1’
-n = Value for blank device ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘1’
-n = Value for blank device ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: The higher voltage setting is recommended for operation at or above 16 MHz.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘1’
-n = Value for blank device ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
WDTPS at POR
Software Control
WDTCPS[4:0] Typical Time-out
Value Divider Ratio of WDTPS?
(FIN = 31 kHz)
00000 00000 1:32 25 1 ms
00001 00001 1:64 26 2 ms
00010 00010 1:128 27 4 ms
00011 00011 1:256 28 8 ms
00100 00100 1:512 29 16 ms
00101 00101 1:1024 210 32 ms
00110 00110 1:2048 211 64 ms
00111 00111 1:4096 212 128 ms
01000 01000 1:8192 213 256 ms
01001 01001 1:16384 214 512 ms No
01010 01010 1:32768 215 1s
01011 01011 1:65536 216 2s
01100 01100 1:131072 217 4s
01101 01101 1:262144 218 8s
01110 01110 1:524299 219 16s
01111 01111 1:1048576 220 32s
10000 10000 1:2097152 221 64s
10001 10001 1:4194304 222 128s
10010 10010 1:8388608 223 256s
10011 10011
... ... 1:32 25 1 ms No
11110 11110
11111 01011 1:65536 216 2s Yes
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘1’
-n = Value for blank device ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘1’
-n = Value for blank device ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: Bits are implemented as sticky bits. Once protection is enabled through ICSP™ or a self-write, it can only be
reset through a Bulk Erase.
2: BBSIZE[2:0] bits can only be changed when BBEN = 1. Once BBEN = 0, BBSIZE[2:0] can only be changed
through a Bulk Erase.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘1’
-n = Value for blank device ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘1’
-n = Value for blank device ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘1’
-n = Value for blank device ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
30 0002h CONFIG2L BOREN[1:0] LPBOREN IVT1WAY MVECEN PWRTS[1:0] MCLRE 1111 1111
30 0003h CONFIG2H XINST — DEBUG STVREN PPS1WAY ZCD BORV[1:0] 1111 1111
5.4 User ID
Eight words in the memory space (200000h-20000Fh)
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 13.2 “Device
Information Area, Device Configuration Area, User
ID, Device ID and Configuration Word Access” for
more information on accessing these memory
locations. For more information on checksum
calculation, see the “PIC18(L)F26/27/45/46/47/55/56/
57K42 Memory Programming Specification”
(DS40001886).
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 x = Bit is unknown
Device Device ID
PIC18F26K42 6C60h
PIC18F27K42 6C40h
PIC18F45K42 6C20h
PIC18F46K42 6C00h
PIC18F47K42 6BE0h
PIC18F55K42 6BC0h
PIC18F56K42 6BA0h
PIC18F57K42 6B80h
PIC18LF26K42 6DA0h
PIC18LF27K42 6D80h
PIC18LF45K42 6D60h
PIC18LF46K42 6D40h
PIC18LF47K42 6D20h
PIC18LF55K42 6D00h
PIC18LF56K42 6CE0h
PIC18LF57K42 6CC0h
R R R R R R R R
MJRREV[1:0] MNRREV[5:0]
bit 7 bit 0
Legend:
R = Readable bit ‘1’ = Bit is set 0’ = Bit is cleared x = Bit is unknown
Stack Underflow
Stack Overflow
WWDT Time-out/
Window violation Device
Reset
Power-on
Reset
VDD
Brown-out
Reset Power-up
Timer
LFINTOSC
2
LPBOR
PWRTS<1:0>
Reset
BOR
BOR Event
REARM POR
Event To PCON0
indicator bit
POR
LPBOR
POR Event
LPBOR Event
Reset
logic
VDD
VBOR
Internal
Reset TPWRT(1)
VDD
VBOR
VDD
VBOR
Internal
Reset TPWRT(1)
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared q = Value depends on condition
VDD
Internal POR
TPWRT
Power-up Timer
MCLR
TMCLR
Internal RESET
Oscillator Modes
External Crystal
TOST
Oscillator Start-up Timer
Oscillator
FOSC
Internal Oscillator
Oscillator
FOSC
CLKIN
FOSC
Legend:
HC = Bit is cleared by hardware HS = Bit is set by hardware
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -m/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared q = Value depends on condition
— — — — — — MEMV —
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 -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
Rev. 10-000208D
5/10/2016
CLKIN/OSC1
External
Oscillator
(EXTOSC)
PIC18(L)F26/27/45/46/47/55/56/57K42
CLKOUT/OSC2
CDIV<4:0>
4x PLL
COSC<2:0>
SOSCIN/SOSCI
Secondary 512
Oscillator 1001
256
(SOSC) 111 1000
128 Sleep
SOSCO 010 0111 System Clock
64
100 0110
Post Divider
LFINTOSC 32
101 0101
31 kHz 16
110 0100 SYSCMD Peripheral Clock
Oscillator
8
Reserved 011 0011
4
Reserved 001 0010 Sleep
2
HFINTOSC Reserved 000 0001 Idle
1
0000
HFFRQ<3:0>
1,2,4,8,12,16,32,48,64
MHz
Oscillator
LFINTOSC is used to
FSCM
monitor system clock
MFINTOSC
To Peripherals
31.25 kHz and 500 kHz To Peripherals
Oscillator To Peripherals
DS40001919E-page 93
To Peripherals
PIC18(L)F26/27/45/46/47/55/56/57K42
7.2 Clock Source Types EC mode has three power modes to select from through
Configuration Words:
Clock sources can be classified as external or internal.
• ECH – High power
External clock sources rely on external circuitry for the
• ECM – Medium power
clock source to function. Examples are: oscillator
modules (ECH, ECM, ECL mode), quartz crystal • ECL – Low power
resonators or ceramic resonators (LP, XT and HS Refer to Table 44-8 for External Clock/Oscillator Timing
modes). Requirements. The Oscillator Start-up Timer (OST) is
Internal clock sources are contained within the disabled when EC mode is selected. Therefore, there
oscillator module. The internal oscillator block has two is no delay in operation after a Power-on Reset (POR)
internal oscillators that are used to generate internal or wake-up from Sleep. Because the PIC® MCU design
system clock sources. The High-Frequency Internal is fully static, stopping the external clock input will have
Oscillator (HFINTOSC) can produce 1, 2, 4, 8, 12, 16, the effect of halting the device while leaving all data
32, 48 and 64 MHz clock. The frequency can be intact. Upon restarting the external clock, the device
controlled through the OSCFRQ register (Register 7- will resume operation as if no time had elapsed.
5). The Low-Frequency Internal Oscillator (LFINTOSC)
generates a fixed 31 kHz frequency. FIGURE 7-2: EXTERNAL CLOCK (EC)
MODE OPERATION
A 4x PLL is provided that can be used with an external
clock. When used with the HFINTOSC the 4x PLL has
input frequency limitations.See Section 7.2.1.4 “4x Clock from OSC1/CLKIN
PLL” for more details. Ext. System
PIC® MCU
The system clock can be selected between external or
internal clock sources via the NOSC bits in the OSC2/CLKOUT
OSCCON1 register. See Section 7.3 “Clock FOSC/4 or I/O(1)
Switching” for additional information. The system
clock can be made available on the OSC2/CLKOUT pin Note 1: Output depends upon CLKOUTEN bit of the
for any of the modes that do not use the OSC2 pin. The Configuration Words (CONFIG1H).
clock out functionality is governed by the CLKOUTEN
bit in the CONFIG1H register (Register 5-2). If enabled,
the clock out signal is always at a frequency of FOSC/4. 7.2.1.2 LP, XT, HS Modes
The LP, XT and HS modes support the use of quartz
7.2.1 EXTERNAL CLOCK SOURCES crystal resonators or ceramic resonators connected to
An external clock source can be used as the device OSC1 and OSC2 (Figure 7-3). The three modes select
system clock by performing one of the following a low, medium or high gain setting of the internal
actions: inverter-amplifier to support various resonator types
and speed.
• Program the RSTOSC[2:0] and FEXTOSC[2:0]
bits in the Configuration Words to select an LP Oscillator mode selects the lowest gain setting of the
external clock source that will be used as the internal inverter-amplifier. LP mode current consumption
default system clock upon a device Reset. is the least of the three modes. This mode is designed to
• Write the NOSC[2:0] and NDIV[3:0] bits in the drive only 32.768 kHz tuning-fork type crystals (watch
OSCCON1 register to switch the system clock crystals), but can operate up to 100 kHz.
source. XT Oscillator mode selects the intermediate gain
See Section 7.3 “Clock Switching” for more setting of the internal inverter-amplifier. XT mode
information. current consumption is the medium of the three modes.
This mode is best suited to drive crystals and
7.2.1.1 EC Mode resonators with a frequency range up to 4 MHz.
The External Clock (EC) mode allows an externally HS Oscillator mode selects the highest gain setting of the
generated logic level signal to be the system clock internal inverter-amplifier. HS mode current consumption
source. When operating in this mode, an external clock is the highest of the three modes. This mode is best
source is connected to the OSC1 input. OSC2/ suited for resonators that require an operating frequency
CLKOUT is available for general purpose I/O or up to 20 MHz.
CLKOUT. Figure 7-2 shows the pin connections for EC Figure 7-3 and Figure 7-4 show typical circuits for
mode. quartz crystal and ceramic resonators, respectively.
PIC® MCU
OSC1/CLKIN
C1 To Internal
Logic
C1 To Internal
Logic
32.768 kHz
Quartz
Crystal
C2 SOSCO
7.2.2.4 LFINTOSC
The Low-Frequency Internal Oscillator (LFINTOSC) is
a factory-calibrated 31 kHz internal clock source.
The LFINTOSC is the frequency for the Power-up
Timer (PWRT), Windowed Watchdog Timer (WWDT)
and Fail-Safe Clock Monitor (FSCM). The LFINTOSC
can also be used as the system clock, or as a clock or
input source to other peripherals.
The LFINTOSC is enabled through one of the following
methods:
• Programming the RSTOSC[2:0] bits of
Configuration Word 1 to enable LFINTOSC.
• Write to the NOSC[2:0] bits of the OSCCON1 reg-
ister during run-time. See Section 7.3, Clock
Switching for more information.
7.2.2.5 ADCRC
The ADCRC is an oscillator dedicated to the ADC2
module. The ADCRC oscillator can be manually
enabled using the ADOEN bit of the OSCEN register.
The ADCRC runs at a fixed frequency of 600 kHz.
ADCRC is automatically enabled if it is selected as the
clock source for the ADC2 module.
OSC #1 OSC #2
ORDY
NOTE 2
NOSCR
NOTE 1
CSWIF
USER
CSWHOLD CLEAR
Note 1: CSWIF is asserted coincident with NOSCR; interrupt is serviced at OSC#2 speed.
2: The assertion of NOSCR is hidden from the user because it appears only for the duration of the switch.
OSC #1 OSC #2
ORDY
NOSCR
NOTE 1
CSWIF
USER
CSWHOLD CLEAR
Note 1: CSWIF is asserted coincident with NOSCR, and may be cleared before or after clearing CSWHOLD = 0.
OSC #1
ORDY
NOTE 2
NOSCR
NOTE 1
CSWIF
CSWHOLD
Note 1: CSWIF may be cleared before or after rewriting OSCCON1; CSWIF is not automatically cleared.
2: ORDY = 0 if OSCCON1 does not match OSCCON2; a new switch will begin.
LFINTOSC
÷ 64 R Q
Oscillator
31 kHz 488 Hz
(~32 s) (~2 ms)
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.
Note 1: EXTOSC configured by the FEXTOSC bits of Configuration Word 1 (Register 5-1).
2: HFINTOSC frequency is set with the FRQ bits of the OSCFRQ register (Register 7-5).
3: EXTOSC must meet the PLL specifications (Table 44-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 f = determined by Configuration bit setting
q = Reset value is determined by hardware
Note 1: The default value (f/f) is determined by the RSTOSC Configuration bits. See Table 7-2 below.
2: If NOSC is written with a reserved value (Table 7-1), the operation is ignored and neither NOSC nor NDIV is
written.
3: When CSWEN = 0, this register is read-only and cannot be changed from the POR value.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 POR value is the value present when user code execution begins.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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: If CSWHOLD = 0, the user may not see this bit set because, when the oscillator becomes ready there
may be a delay of one instruction clock before this bit is set. The clock switch occurs in the next instruction
cycle and 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 = Reset value is determined by 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 q = Reset value is determined by 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
CLKRDIV<2:0>
CLKREN Counter Reset
128
111
CLKREN 000
CLKRCLK<3:0>
Rev. 10-000264B
5/25/2016
P1 P2
CLKRCLK
CLKREN
CLKR Output
CLKRDIV<2:0> = 001
CLKRDC<1:0> = 10
Duty Cycle
(50%)
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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: Bits are valid for reference clock divider values of two or larger, the base clock cannot be further divided.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
0 1
High Priority
Multi-Vector Enable IVTBASE
0 IVTBASE
CONFIG 2L register Low Priority
MVECEN bit IVTBASE + 8 words
1 IVTBASE + 2*(Vector Number)
9.2.4 ACCESS CONTROL FOR IVTBASE The user must follow the sequence shown in
REGISTERS Example 9-2 to set the IVTLOCKED bit.
The Interrupt controller has an IVTLOCKED bit which
can be set to avoid inadvertent changes to the IVT- EXAMPLE 9-2: IVT LOCK SEQUENCE
BASE registers contents. Setting and clearing this bit ; Disable Interrupts:
requires a special sequence as an extra precaution BCF INTCON0, GIE;
; Bank to IVTLOCK register
against inadvertent changes.
BANKSEL IVTLOCK;
To allow writes to IVTBASE registers, the interrupts MOVLW 55h;
must be disabled (GIEH = 0) and the IVTLOCKED bit
must be cleared. The user must follow the sequence ; Required sequence, next 4 instructions
shown in Example 9-1 to clear the IVTLOCKED bit. MOVWF IVTLOCK;
MOVLW AAh;
MOVWF IVTLOCK;
EXAMPLE 9-1: IVT UNLOCK SEQUENCE
; Disable Interrupts: ; Set IVTLOCKED bit to enable writes
BCF INTCON0, GIE; BSF IVTLOCK, IVTLOCKED;
; Bank to IVTLOCK register
BANKSEL IVTLOCK; ; Enable Interrupts
MOVLW 55h; BSF INTCON0, GIE;
; Enable Interrupts
BSF INTCON0, GIE;
Rev. 10-000265A
7/6/2016
MAIN
INTSTAT = 00
PIC18(L)F26/27/45/46/47/55/56/57K42
High Interrupt addressed,
High Interrupt Low Interrupt pending Low Interrupt
HIGH LOW
requested INTSTAT = 10 INTSTAT = 01 requested
Low Interrupt addressed,
High Interrupt pending
FIGURE 9-2: INTERRUPT EXECUTION: HIGH/LOW PRIORITY INTERRUPT WHEN EXECUTING MAIN ROUTINE
PIC18(L)F26/27/45/46/47/55/56/57K42
Rev. 10-000267A
9/12/2016
RETFIE Executed
Main Code Main Code Executing Main Code Execution Halted Main Code Executing
Interrupt
Interrupt Interrupt
received cleared
DS40001919E-page 121
9.4.2 SERVING A HIGH PRIORITY INTERRUPT WHILE A LOW
2017-2019 Microchip Technology Inc.
PIC18(L)F26/27/45/46/47/55/56/57K42
serviced before servicing the pending low priority interrupt. If no other high
priority interrupt requests are active, the low priority interrupt is serviced.
FIGURE 9-3: INTERRUPT EXECUTION: HIGH PRIORITY INTERRUPT WITH A LOW PRIORITY INTERRUPT PENDING
Rev. 10-000267C
9/12/2016
Main Code Main routine Main Code Execution Halted Main routine
High Priority
Interrupt
High Interrupt High Interrupt
received cleared
Low Priority
Interrupt
Low Interrupt Low Interrupt
DS40001919E-page 122
received cleared
9.4.3 PREEMPTING LOW PRIORITY INTERRUPTS
2017-2019 Microchip Technology Inc.
PIC18(L)F26/27/45/46/47/55/56/57K42
clears GIEL.
FIGURE 9-4: INTERRUPT EXECUTION: HIGH PRIORITY INTERRUPT PREEMPTING LOW PRIORITY INTERRUPTS
Rev. 10-000267B
9/12/2016
Main Code Main routine Main Code Execution Halted Main routine
High Priority
Interrupt
High Interrupt High Interrupt
received cleared
Low Priority
Interrupt
Low Interrupt Low Interrupt
received cleared
DS40001919E-page 123
9.4.4 SIMULTANEOUS LOW AND HIGH PRIORITY
2017-2019 Microchip Technology Inc.
INTERRUPTS
When both high and low interrupts are active in the same instruction cycle (i.e.,
simultaneous interrupt events), both the high and the low priority requests are
generated. The high priority ISR is serviced first before servicing the low priority
interrupt see Figure 9-5.
FIGURE 9-5: INTERRUPT EXECUTION: SIMULTANEOUS LOW AND HIGH PRIORITY INTERRUPTS
PIC18(L)F26/27/45/46/47/55/56/57K42
Rev. 10-000267D
9/12/2016
Main Code Main routine Main Code Execution Halted Main routine
High Priority
Interrupt
High Interrupt High Interrupt
received cleared
Low Priority
Interrupt
Low Interrupt Low Interrupt
received cleared
DS40001919E-page 124
PIC18(L)F26/27/45/46/47/55/56/57K42
9.5 Context Saving
The Interrupt controller supports a two-level deep
context saving (Main routine context and Low ISR
context). Refer to state machine shown in Figure 9-6
for details.
The Program Counter (PC) is saved on the dedicated
device PC stack. CPU registers saved include STATUS,
WREG, BSR, FSR0/1/2, PRODL/H and PCLATH/U.
After WREG has been saved to the context registers,
the resolved vector number of the interrupt source to be
serviced is copied into WREG. Context save and
restore operation is completed by the interrupt
controller based on current state of the interrupts and
the order in which they were sent to the CPU.
Context save/restore works the same way in both
states of MVECEN. When IPEN = 0, there is only one
level interrupt active. Hence, only the main context is
saved when an interrupt is received.
Rev. 10-000266A
7/6/2016
MAIN
INTSTAT = 00
PIC18(L)F26/27/45/46/47/55/56/57K42
No Context Save/Restore
No Context HIGH LOW No Context
Save/Restore INTSTAT = 10 INTSTAT = 01 Save/Restore
No Context Save/Restore
Rev. 10-000269A
9/12/2016
1 2 3 4 5 6 7 8 9 10
System
Clock
Program
X X+2 X+2 0x82 0x218 0x21A 0x21C X+2 X+4 X+6
Counter
PIC18(L)F26/27/45/46/47/55/56/57K42
Instruction
Inst @ X(1) FNOP FNOP FNOP Inst @ 0x218 Inst @ 0x21A FNOP Inst @ X+2 Inst @ X+4
Register
BCF RETFIE
Interrupt
IVTBASE 0x80
Vector
1
Number
Program Memory
0x86
0x82
Rev. 10-000269B
9/12/2016
1 2 3 4 5 6 7 8 9 10 11
System
Clock
Program
Y Y+2 Y+2 Y+2 0x82 0x218 0x21A 0x21C Y+2 Y+4 Y+6
Counter
PIC18(L)F26/27/45/46/47/55/56/57K42
Instruction
Inst @ Y(1) Inst @ Y(1) FNOP FNOP FNOP Inst @ 0x218 Inst @ 0x21A FNOP Inst @ Y+2 Inst @ Y+4
Register
BCF RETFIE
Interrupt
IVTBASE 0x80
Vector
1
Number
Program Memory
0x86
0x82
Rev. 10-000269C
9/12/2016
1 2 3 4 5 6 7 8 9 10 11 12
System
Clock
Program
Z Z+2 Z+2 Z+2 Z+2 0x82 0x218 0x21A 0x21C Z+2 Z+4 Z+6
Counter
PIC18(L)F26/27/45/46/47/55/56/57K42
Instruction Inst @ Inst @
Inst @ Z(1) Inst @ Z(1) Inst @ Z(1) FNOP FNOP FNOP FNOP Inst @ Z+2 Inst @ Z+4
Register 0x218 0x21A
BCF RETFIE
Interrupt
IVTBASE 0x80
Vector
1
Number
Program Memory
0x86
0x82
If the last instruction before the interrupt controller vectors to the ISR from main
routine clears the GIE, PIE or PIR bit associated with the interrupt, the controller
executes one force NOP cycle before it returns to the main routine.
Figure 9-10 illustrates the sequence of events when a peripheral interrupt is
asserted and then cleared on the last executed instruction cycle.
If the GIE, PIE or PIR bit associated with the interrupt is cleared prior to
PIC18(L)F26/27/45/46/47/55/56/57K42
vectoring to the ISR, then the controller continues executing the main routine.
Rev. 10-000269D
7/6/2016
1 2 3 4 5
Instruction
Clock
Program
X X+2 X+2 X+4 X+6
Counter
Instruction
Inst @ X(1) FNOP Inst @ X+2 Inst @ X+4
Register
Interrupt
Note 1: Inst @ X clears the interrupt flag, Example BCF INTCON0, GIE.
DS40001919E-page 131
PIC18(L)F26/27/45/46/47/55/56/57K42
9.8 Interrupt Setup Procedure 9.10 Wake-up from Sleep
1. When using interrupt priority levels, set the IPEN The interrupt controller provides a wake-up request to
bit in INTCON0 register and then select the the CPU whenever an interrupt event occurs, if the
user-assigned priority level for the interrupt interrupt event is enabled. This occurs regardless of
source by writing the control bits in the whether the part is in Run, Idle/Doze or Sleep modes.
appropriate IPRx Control register. The status of the GIEH/GIEL bits has no effect on the
Note: At a device Reset, the IPRx registers are wake-up request. The wake-up request will be
initialized, such that all user interrupt asynchronous to all clocks.
sources are assigned to high priority.
9.11 Interrupt Compatibility
2. Clear the Interrupt Flag Status bit associated
with the peripheral in the associated PIRx Status When the MVECEN bit in Configuration Word 2L is
register. cleared (Register 5-3), the Interrupt Vector Table
3. Enable the interrupt source by setting the feature is disabled and interrupts are compatible with
interrupt enable control bit associated with the previous high performance 8-bit PIC18 microcontroller
source in the appropriate PIEx Control register. devices. In this mode, the Interrupt Vector Table priority
4. If the vector table is used (MVECEN = 1), then has no effect.
setup the start address for the Interrupt Vector When the IPEN bit is also cleared, the interrupt priority
Table using the IVTBASE register. See Section feature is disabled and interrupts are compatible with
9.2.2 “Interrupt Vector Table Contents”. PIC®16 microcontroller mid-range devices. All
5. Once the IVTBASE is written to, set the Interrupt interrupts branch to address 0008h since the interrupt
enable bits in INTCON0 register. priority is disabled.
6. An example of setting up interrupts and ISRs
using assembly and C can be found in
Examples 9-3 and 9-4.
IntInit:
; Disable all interrupts
BCF INTCON0, GIE, ACCESS
; Enable interrupts
BANKSEL PIE7
BSF PIE7, CLC2IE
BSF PIE3, TMR0IE
BSF PIE7, TMR4IE
; Enable interrupts
BSF INTCON0, GIEH, ACCESS
BSF INTCON0, GIEL, ACCESS
RETURN 1
// NOTE 1: If IVTBASE is changed from its default value of 0x000008, then the
// "base(...)" argument must be provided in the ISR. Otherwise the vector
// table will be placed at 0x0008 by default regardless of the IVTBASE value.
// NOTE 3: Multiple interrupts can be handled by the same ISR if they are
// specified in the "irq(...)" argument. Ex: irq(IRQ_TMR0, IRQ_CCP1)
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 7 bit 0
Legend:
HC = Bit is cleared 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 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 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 HS = Hardware 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 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 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 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 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 HS = Bit is set in hardware
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 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 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
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 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
REGISTER 9-36: IVTBASEU: INTERRUPT VECTOR TABLE BASE ADDRESS UPPER REGISTER
U-0 U-0 U-0 R/W-0/0 R/W-0/0 R/W-0/0 R/W-0/0 R/W-0/0
— — — BASE[20: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
REGISTER 9-37: IVTBASEH: INTERRUPT VECTOR TABLE BASE ADDRESS HIGH REGISTER
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
BASE[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
REGISTER 9-38: IVTBASEL: INTERRUPT VECTOR TABLE BASE ADDRESS LOW REGISTER
R/W-0/0 R/W-0/0 R/W-0/0 R/W-0/0 R/W-1/1 R/W-0/0 R/W-0/0 R/W-0/0
BASE[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
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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: The IVTLOCK bit can only be set or cleared after the unlock sequence in Example 9-1.
2: If IVT1WAY = 1, the IVTLOCK bit cannot be cleared after it has been set. See Register 5-3.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
//Mainline operation
bool somethingToDo = FALSE:
void main()
{
initializeSystem();
// DOZE = 64:1 (for example)
// ROI = 1;
GIE = 1; // enable interrupts
while (1)
{
// If ADC completed, process data
if (somethingToDo)
{
doSomething();
DOZEN = 1; // resume low-power
}
}
}
FOSC
CPU Operation
Exec Exec Exec FNOP FNOP FNOP Exec Exec
(Note 1)
(Note 2)
Interrupt
Here
(ROI = ‘1’)
Note 1: Multicycle instructions are executed to completion before fetching the interrupt vector.
2: If the prefetched instruction clears the interrupt enable or GIEx, ISR vectoring will not occur, but DOZEN is
cleared and the CPU will resume execution at full speed.
10.2 Sleep Mode I/O pins that are high-impedance inputs should be
pulled to VDD or VSS externally to avoid switching
Sleep mode is entered by executing the SLEEP currents caused by floating inputs.
instruction, while the Idle Enable (IDLEN) bit of the
CPUDOZE register is clear (IDLEN = 0). Examples of internal circuitry that might be sourcing
current include modules such as the DAC and FVR
Upon entering Sleep mode, the following conditions modules. See Section 37.0 “5-Bit Digital-to-Analog
exist: Converter (DAC) Module” and Section 34.0 “Fixed
1. WDT will be cleared but keeps running if Voltage Reference (FVR)” for more information on
enabled for operation during Sleep these modules.
2. The PD bit of the STATUS register is cleared
(Register 4-2)
3. The TO bit of the STATUS register is set
(Register 4-2)
4. The CPU clock is disabled
5. LFINTOSC, SOSC, HFINTOSC and ADCRC
are unaffected and peripherals using them may
continue operation in Sleep.
6. I/O ports maintain the status they had before
Sleep was executed (driving high, low, or high-
impedance)
7. Resets other than WDT are not affected by
Sleep mode
Refer to individual chapters for more details on
peripheral operation during Sleep.
To minimize current consumption, the following
conditions should be considered:
- I/O pins should not be floating
- External circuitry sinking current from I/O pins
- Internal circuitry sourcing current from I/O
pins
- Current draw from pins with internal weak
pull-ups
- Modules using any oscillator
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
CLKIN(1)
CLKOUT(2) TOST(3)
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)
10.2.3 LOW-POWER SLEEP MODE 10.2.3.1 Sleep Current vs. Wake-up Time
The PIC18F26/27/45/46/47/55/56/57K42 device family In the default operating mode, the LDO and reference
contains an internal Low Dropout (LDO) voltage circuitry remain in the normal configuration while in
regulator, which allows the device I/O pins to operate at Sleep. The device is able to exit Sleep mode quickly
voltages up to 5.5V while the internal device logic since all circuits remain active. In Low-Power Sleep
operates at a lower voltage. The LDO and its mode, when waking-up from Sleep, an extra delay time
associated reference circuitry must remain active when is required for these circuits to return to the normal
the device is in Sleep mode. configuration and stabilize.
The PIC18F26/27/45/46/47/55/56/57K42 devices allow The Low-Power Sleep mode is beneficial for
the user to optimize the operating current in Sleep, applications that stay in Sleep mode for long periods of
depending on the application requirements. time. The Normal mode is beneficial for applications
that need to wake from Sleep quickly and frequently.
Low-Power Sleep mode can be selected by setting the
VREGPM bit of the VREGCON register.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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; HS = Bit is set by
hardware
Rev. 10-000162D
1/27/2017
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
SOSC 010
MFINTOSC 31.25 kHz 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
CLRWDT Instruction
(or other WDT reset)
Window Period
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 CONFIG3H = 111, the Reset value of CS[2:0] is 000.
2: The Reset value of WINDOW[2:0] is determined by the value of WDTCWS[2:0] in the CONFIG3H register.
3: If WDTCCS[2:0] in CONFIG3H ≠ 111, these bits are read-only.
4: If WDTCWS[2:0] in CONFIG3H ≠ 111, these bits are read-only.
REGISTER 11-3: WDTPSL: WWDT 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
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 not be read during normal
operation.
REGISTER 11-4: WDTPSH: WWDT 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]
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 not 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 not be read during normal
operation.
12.2 Operation
Example 12-1 shows the instruction sequence for an
8x8 unsigned multiplication. Only one instruction is
required when one of the arguments is already loaded in
the WREG register.
Example 12-2 shows the sequence to do an 8x8 signed
multiplication. To account for the sign bits of the
arguments, each argument’s Most Significant bit (MSb)
is tested and the appropriate subtractions are done.
00 0000h
Program Flash Memory Read/
••• Read 10 —(3)
(PFM) Write(1)
01 FFFFh
20 0000h
Read/
User IDs(2) ••• No Access x1 —(3)
Write
20 000Fh
20 0010h
Reserved No Access —(3)
2F FFFFh
30 0000h
Read/
Configuration ••• No Access x1 —(3)
Write(1)
30 0009h
30 000Ah
Reserved No Access —(3)
30 FFFFh
31 0000h
User Data Memory Read/
••• No Access 00 —(3)
(Data EEPROM) Write(1)
31 03FFh
31 0400h
Reserved No Access —(3)
3E FFFFh
3F 0000h
Device Information Area
••• No Access x1 Read —(3)
(DIA)
3F 003Fh
3F 0040h
Reserved No Access —(3)
3F FF09h
3F FF00h
Device Configuration Information
••• No Access x1 Read —(3)
(DCI)
3F FF09h
3F FF0Ah
Reserved No Access —(3)
3F FFFBh
3F FFFCh
Revision ID/
••• No Access x1 Read —(3)
Device ID
3F FFFFh
Program Memory
Table Pointer(1)
Table Latch (8-bit)
TBLPTRU TBLPTRH TBLPTRL
TABLAT
Program Memory
(TBLPTR)
Program Memory
(TBLPTR[MSBs])
Note 1: During table writes the Table Pointer does not point directly to program memory. The LSBs of TBLPRTL
actually point to an address within the write block holding registers. The MSBs of the Table Pointer deter-
mine where the write block will eventually be written. The process for writing the holding registers to the
program memory array is discussed in Section 13.1.6 “Writing to Program Flash Memory”.
The WR control bit initiates erase/write cycle operation Figure 13-3 describes the relevant boundaries of
when the REG[1:0] bits point to the Data EEPROM TBLPTR based on Program Flash Memory operations.
Memory location, and it initiates a write operation when
the REG[1:0] bits point to the PFM location. The WR bit
cannot be cleared by firmware; it can only be set by
firmware. Then the WR bit is cleared by hardware at
the completion of the write operation.
TABLE 13-2: TABLE POINTER OPERATIONS WITH TBLRD AND TBLWT INSTRUCTIONS
Example Operation on Table Pointer
TBLRD*
TBLPTR is not modified
TBLWT*
TBLRD*+
TBLPTR is incremented after the read/write
TBLWT*+
TBLRD*-
TBLPTR is decremented after the read/write
TBLWT*-
TBLRD+*
TBLPTR is incremented before the read/write
TBLWT+*
Program Memory
Start
Read Operation
Select PFM
(NVMREG<1:0> = 0x10)
End
Read Operation
Note 1: Sequence begins when NVMCON2 is written; steps 1-4 must occur in the cycle-accurate order
shown. If the timing of the steps 1 to 4 is corrupted by an interrupt or a debugger Halt, the action
will not take place.
2: Opcodes shown are illustrative; any instruction that has the indicated effect may be used.
TABLAT
Write Register
8 8 8 8
Program Memory
Note 1: Refer to Table 5-4 for number of holding registers (e.g., YY = 3F for 64 holding registers).
Rev. 10-000049B
12/4/2015
Start
Write Operation
Determine number of
words to be written into Load the value to write
PFM. The number of TABLAT
words cannot exceed the
number of words per row
(word_cnt)
Disable Interrupts
Select Write Operation (GIE = 0)
(FREE = 0)
CPU stalls while Write
operation completes
(2 ms typical)
Load Write Latches Only Unlock Sequence(1)
Enable Write/Erase
Operation (WREN = 1) No delay when writing to Re-enable Interrupts
PFM Latches (GIE = 1)
Disable Write/Erase
Operation (WREN = 0)
Re-enable Interrupts
(GIE = 1)
End
Write Operation
Increment Address
TBLPTR++
TABLE 13-3: DIA, DCI, USER ID, DEV/REV ID AND CONFIGURATION WORD ACCESS
(REG[1:0] = X1)
Address Function Read Access Write Access
20 0000h-20 000Fh User IDs Yes Yes
30 0000h-30 0009h Configuration Words Yes Yes
3F 0000h-3F 003Fh DIA Yes No
3F FF00h-3F FF09h DCI Yes No
3F FFFCh-3F FFFFh Revision ID/Device ID Yes No
Legend:
R = Readable bit W = Writable bit HC = Bit is cleared by hardware
x = Bit is unknown -n = Value at POR S = Bit can be set by software, but not cleared
‘0’ = Bit is cleared ‘1’ = Bit is set U = Unimplemented bit, read as ‘0’
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
x = Bit is unknown ‘0’ = Bit is cleared ‘1’ = Bit is set
-n = Value at POR
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
x = Bit is unknown ‘0’ = Bit is cleared ‘1’ = Bit is set
-n = Value at POR
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
x = Bit is unknown ‘0’ = Bit is cleared ‘1’ = Bit is set
-n = Value at POR
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
x = Bit is unknown ‘0’ = Bit is cleared ‘1’ = Bit is set
-n = Value at POR
bit 7-0 DAT[7:0]: The value of the data memory word returned from NVMADR after a Read command, or the
data written by a Write command.
CRC-16-ANSI
x16 + x15 + x2 + 1 (17 bits)
Standard 16-bit representation = 0x8005
CRCXORH = 0b10000000
CRCXORL = 0b0000010- (1)
Data Sequence:
0x55, 0x66, 0x77, 0x88
DLEN = 0b0111
PLEN = 0b1111
Rev. 10-000207A
Linear Feedback Shift Register for CRC-16-ANSI 5/27/2014
x16 + x15 + x2 + 1
Data in
Augmentation Mode ON
Data in
Augmentation Mode OFF
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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
u = Bit is unchanged 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 = 1 (SCANCON0 register) does not affect any other register content.
2: Scanner trigger selection can be set using the SCANTRIG register.
3: This bit can be cleared in software. It is cleared in hardware when LADR>HADR (and a data cycle is not
occurring) or when CRCGO = 0 (CRCCON0 register).
4: CRCEN and CRCGO bits (CRCCON0 register) must be set before setting the SGO bit.
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: Registers SCANLADRU/H/L form a 22-bit value, but are not guarded for atomic or asynchronous access;
registers should only be read or written while SGO = 0 (SCANCON0 register).
2: While SGO = 1 (SCANCON0 register), writing to this register is ignored.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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: Registers SCANHADRU/H/L form a 22-bit value but are not guarded for atomic or asynchronous access;
registers should only be read or written while SGO = 0 (SCANCON0 register).
2: While SGO = 1 (SCANCON0 register), writing to this register is ignored.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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: Registers SCANHADRU/H/L form a 22-bit value, but are not guarded for atomic or asynchronous access; registers
should only be read or written while SGO = 0 (SCANCON0 register).
2: While SGO = 1 (SCANCON0 register), writing to this register is ignored.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
1010 = Reserved
1001 = SMT1_output
1000 = TMR6_postscaled
0111 = TMR5_output
0110 = TMR4_postscaled
0101 = TMR3_output
0100 = TMR2_postscaled
0011 = TMR1_output
0010 = TMR0_output
0001 = CLKREF_output
0000 = LFINTOSC
Configure DMA
Module
EN = 1
DMA Source/
Destination Pointers/
Counters are loaded
SIRQEN = 1 & N
Trigger?
DGO = 1
N
Bubble?
Y
DMAxBUF = &DMAxSPTR
Source Read
XIP = 1
N
Bubble?
Y
&DMAxDPTR = DMABUF
Destination Write
XIP = 0
Y Reload
DMAxSCNTIF
DMAxSCNT = 0 DMAxSCNT & DGO = 0
=1
DMAxSPTR
N
Update Y
DMAxSSA, SIRQEN = 0 SSTP = 1
DMAxSCNT
Y Reload
DMAxDCNTIF
DMAxDCNT = 0 DMAxDCNT & DGO = 0
=1
DMAxDPTR
N
Y
Update AIRQEN = 0 DSTP = 1
DMAxDSA,
DMAxDCNT
N
N
DGO = 0
End Process
• Stalling the CPU execution until it has completed Program Flash Memory GPR
its transfers (DMA has higher priority over the Program Flash Memory SFR
CPU in this mode of operation) Data EE GPR
• Utilizing unused CPU cycles for DMA transfers
(CPU has higher priority over the DMA in this Data EE SFR
mode of operation). Unused CPU cycles are GPR GPR
referred to as bubbles which are instruction cycles SFR GPR
available for use by the DMA to perform read and
GPR SFR
write operations. In this way, the effective
bandwidth for handling data is increased; at the SFR SFR
same time, DMA operations can proceed without
causing a processor stall.
Note: Even though the DMA module has access
to all memory and peripherals that are
15.4 DMA Interface
also available to the CPU, it is
The DMA module transfers data from the source to the recommended that the DMA does not
destination one byte at a time, this smallest data access any register that is part of the
movement is called a DMA data transaction. A DMA System arbitration. The DMA, as a system
Message refers to one or more DMA data transactions. arbitration client should not be read or
written by itself or by another DMA
Each DMA data transaction consists of two separate
instantiation.
actions:
• Reading the Source Address Memory and storing The following sections discuss the various control
the value in the DMA Buffer register interfaces required for DMA data transfers.
• Writing the contents of the DMA Buffer register to
15.4.1 DMA ADDRESSING
the Destination Address Memory
The start addresses for the source read and destination
Note: DMA data movement is a two-cycle
write operations are set using the DMAxSSA [21:0] and
operation.
DMAxDSA [15:0] registers, respectively.
The XIP bit (DMAxCON0 register) is a status bit to When the DMA Message transfers are in progress, the
indicate whether or not the data in the DMAxBUF DMAxSPTR [21:0] and DMAxDPTR [15:0] registers
register has been written to the destination address. If contain the current address pointers for each source
the bit is set then data is waiting to be written to the read and destination write operation, these registers
destination. If clear, it means that either data has been are modified after each transaction based on the
written to the destination or that no source read has Address mode selection bits.
occurred.
The SMODE and DMODE bits in the DMAxCON1
The DMA has read access to PFM, Data EEPROM, control register determine the address modes of
and SFR/GPR space, and write access to SFR/GPR operation by controlling how the DMAxSPTR [21:0] and
space. Based on these memory access capabilities, DMAxDPTR [15:0] bits are updated after every DMA
the DMA can support the following memory data transaction combination (Figure 15-2).
transactions:
Each address can be separately configured to:
• Remain unchanged
• Increment by 1
• Decrement by 1
DMAxSSA[21:0] DMAxDSA[15:0]
DMAxSPTR[21:0] DMAxDPTR[15:0]
+1 +1
0 0
-1 -1
SMODE<1:0> DMODE<1:0>
The DMA can initiate data transfers from the PFM, Data
EEPROM or SFR/GPR Space. The SMR[1:0] bits in the
DMAxCON1 register are used to select the type of
memory being pointed to by the Source Address
Pointer. The SMR[1.0] bits are required because the
PFM and SFR/GPR spaces have overlapping
addresses that do not allow the specified address to
uniquely define the memory location to be accessed.
Note 1: For proper memory read access to occur,
the combination of address and space
selection must be valid.
2: The destination does not have space
selection bits because it can only write to
the SFR/GPR space.
DMAxSSIZ[11:0] DMAxDSIZ[11:0]
DMAxSCNT[11:0] DMAxDCNT[11:0]
1 1
Configure DMA
Module
EN = 1
SIRQEN = 1 & N
Trigger?
DGO = 1
Bubble?
DMAxBUF = &DMAxSPTR
Source Read
XIP = 1
N
Bubble?
Y
&DMAxDPTR = DMABUF
Destination Write
XIP = 0
Y Reload
DMAxSCNTIF
DMAxSCNT = 0 DMAxSCNT & DGO = 0
=1
DMAxSPTR
N
Update Y
DMAxSSA, SIRQEN = 0 SSTP = 1
DMAxSCNT
Y Reload
DMAxDCNTIF
DMAxDCNT = 0 DMAxDCNT & DGO = 0
=1
DMAxDPTR
Y
Update AIRQEN = 0 DSTP = 1
DMAxDSA,
DMAxDCNT
N
N
DGO = 0
End Process
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Instruction
Clock
EN
SIRQEN
Source Hardware
Trigger
DGO
DMAxSCNT 4 3 2 1 4
DMAxDCNT 2 1 2 1 2
DMA STATE IDLE SR(1) DW(2) SR(1) DW(2) IDLE SR(1) DW(2) SR(1) DW(2) IDLE
DMAxSCNTIF
DMAxDCNTIF
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Instruction
Clock
EN
SIRQEN
Source Hardware
Trigger
DGO
DMAxSCNT 2 1 2 1 2
DMAxDCNT 4 3 2 1 4
DMA STATE IDLE SR(1) DW(2) SR(1) DW(2) IDLE SR(1) DW(2) SR(1) DW(2) IDLE
DMAxSCNTIF
DMAxDCNTIF
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
Instruction
Clock
EN
SIRQEN
Source
Hardware
Trigger
DGO
DMAxSPTR 0x100 0x101 0x100 0x101 0x100 0x101 0x100 0x101 0x100
DMAxDPTR 0x200 0x201 0x202 0x203 0x200 0x201 0x202 0x203 0x202
DMAxSCNT 2 1 2 1 2 1 2 1 2
DMAxDCNT 4 3 2 1 4 3 2 1 2
DMA (1) (2)
IDLE SR DW SR(1) DW(2) IDLE SR(1) DW(2) SR(1) DW(2) IDLE SR(1) DW(2) SR(1) DW(2) IDLE SR(1) DW(2) SR(1) DW(2) IDLE
STATE
DMAxSCNTIF
DMAxDCNTIF
Instruction
Clock
EN
SIRQEN
Source Hardware
Trigger
DGO
DMAxSCNT 2 1 2 1 2
DMAxDCNT 10 9 8 7 6
DMAxSCNTIF
DMAxDCNTIF
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Instruction
Clock
EN
SIRQEN
Source Hardware
Trigger
DGO
DMAxSCNT 2 1 2 1 2
DMAxDCNT 4 3 2 1 4
DMA STATE IDLE SR(1) DW(2) SR(1) DW(2) IDLE SR(1) DW(2) SR(1) DW(2) IDLE
DMAxSCNTIF
DMAxDCNTIF
DMAxORIF
DMAxCON1bits.SMA = 01
Instruction
Clock
EN
SIRQEN
AIRQEN
Source Hardware
Trigger
Abort Hardware
Trigger
DGO
DMAxSCNT 2 1 2 1 2
DMAxDCNT 10 9 2 1 10
DMA STATE IDLE SR(1) DW(2) SR(1) DW(2) IDLE SR(1) DW(2) SR(1) DW(2) IDLE
DMAxSCNTIF
DMAxDCNTIF
DMAxAIF
DMAxSSA 0x3EEF DMAxDSA 0x100
Rev. 10-000275G
8/12/2016
1 2 3 4 5 6 7 8 9 10 10 11 12
Instruction
Clock
EN
SIRQEN
AIRQEN
Source Hardware
Trigger
Abort Hardware
Trigger
DGO
DMAxSCNT 2 1 2
DMAxDCNT 10 9 8
DMAxCONbits.XIP
DMAxAIF
Source Module Source Register(s) Destination Module Destination Register(s) DCHxSIRQ Comment
Signal Measurement SMTxCPW[U:H:L] GPR GPR[x,y,z] SMTxPWAIF Store Captured Pulse-width
Timer values
(SMT) SMTxCPR[U:H:L] SMTxPRAIF Store Captured Period values
GPR/SFR/Program MEMORY[x,y] TMR0 TMR0[H:L] TMR0IF Use as a Timer0 reload for
Flash/Data EEPROM custom 16-bit value
PIC18(L)F26/27/45/46/47/55/56/57K42
GPR/SFR/ Program MEMORY[x] TMR0 PR0 ANY Update TMR0 frequency
Flash/Data EEPROM based on a specific trigger
GPR/SFR/ Program MEMORY[x,y] TMR1 TMR1[H:L] TMR1IF Use as a Timer1 reload for
Flash/Data EEPROM custom 16-bit value
TMR1 TMR1[H:L] GPR GPR[x,y] TMR1GIF Use TMR1 Gate interrupt flag
to read data out of TMR1
register
GPR/SFR/ Program MEMORY[x] TMR2 PR2 TMR2IF
Flash/Data EEPROM
GPR/SFR/ Program MEMORY[x,y,z] TMR2 PR2 ANY Frequency generator with 50%
Flash/Data EEPROM CCP or PWM CCPR[H:L] or duty cycle look up table
PWMDC[H:L]
CCP CCPR[H:L] GPR GPR[x,y] CCPxIF Move data from CCP 16b
Capture
GPR/SFR/ Program MEMORY[x,y] CCP CCPR[H:L] ANY Load Compare value or PWM
Flash/Data EEPROM values into the CCP
GPR/SFR/ Program MEMORY [x,y,z,u,v,w] CCPx CCPxR[H:L] ANY Update multiple PWM values
Flash/Data EEPROM CCPy CCPyR[H:L] at the same time
CCPz CCPzR[H:L] e.g. 3-phase motor control
GPR/SFR/ Program MEMORY[x,y,z] NCO NCOxINC[U:H:L] ANY Frequency Generator look-up
Flash/Data EEPROM table
GPR/SFR/ Program MEMORY[x] DAC DACxCON0 ANY Update DAC values
Flash/Data EEPROM
GPR/SFR/ Program MEMORY[x] OSCTUNE OSCTUNE ANY Automated Frequency
Flash/Data EEPROM dithering
DS40001919E-page 246
PIC18(L)F26/27/45/46/47/55/56/57K42
15.10 Reset 15.12 DMA Register Interfaces
The DMA registers are set to the default state on any The DMA can transfer data to any GPR or SFR
Reset. The registers are also reset to the default state location. For better user accessibility, some of the more
when the enable bit is cleared (DMA1CON1bits.EN=0). commonly used SFR spaces have their Mirror registers
placed in a separate data memory location (0x4000-
15.11 Power Saving Mode Operation 0x40FF). These Mirror registers can be only accessed
through the DMA Source and Destination Address
The DMA utilizes system clocks and it is treated as a registers. Refer to Table 4-3 for details about these
peripheral when it comes to power saving operations. mirror registers.
Like other peripherals, the DMA also uses Peripheral
Module Disable bits to further tailor its operation in low-
power states.
void main() {
//System Initialize
initializeSystem();
//Setup UART1
initializeUART1();
//Setup DMA1
//DMA1CON1 - DPTR remains, Source Memory Region PFM, SPTR increments, SSTP
DMA1CON1 = 0x0B;
//Source registers
//Source size
DMA1SSZH = 0x00;
DMA1SSZL = 0x0A;
//Destination registers
//Destination size
DMA1DSZH = 0x00;
DMA1DSZL = 0x01;
while (1) {
doSomething();
}
}
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n/n = Value at POR 0 = bit is cleared x = bit is unknown
and BOR/Value at all u = bit is unchanged
other Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n/n = Value at POR 1 = bit is set 0 = bit is cleared x = bit is unknown
and BOR/Value at all u = bit is unchanged
other Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n/n = Value at POR 1 = bit is set 0 = bit is cleared x = bit is unknown
and BOR/Value at all u = bit is unchanged
other Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n/n = Value at POR and 1 = bit is set 0 = bit is cleared x = bit is unknown
BOR/Value at all other u = bit is unchanged
Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n/n = Value at POR 1 = bit is set 0 = bit is cleared x = bit is unknown
and BOR/Value at all u = bit is unchanged
other Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n/n = Value at POR and 1 = bit is set 0 = bit is cleared x = bit is unknown
BOR/Value at all other u = bit is unchanged
Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n/n = Value at POR and 1 = bit is set 0 = bit is cleared x = bit is unknown
BOR/Value at all other u = bit is unchanged
Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n/n = Value at POR and 1 = bit is set 0 = bit is cleared x = bit is unknown
BOR/Value at all other u = bit is unchanged
Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n/n = Value at POR and 1 = bit is set 0 = bit is cleared x = bit is unknown
BOR/Value at all other u = bit is unchanged
Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n/n = Value at POR and 1 = bit is set 0 = bit is cleared x = bit is unknown
BOR/Value at all other u = bit is unchanged
Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n/n = Value at POR and 1 = bit is set 0 = bit is cleared x = bit is unknown
BOR/Value at all other u = bit is unchanged
Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n/n = Value at POR 1 = bit is set 0 = bit is cleared x = bit is unknown
and BOR/Value at all u = bit is unchanged
other Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n/n = Value at POR and 1 = bit is set 0 = bit is cleared x = bit is unknown
BOR/Value at all other u = bit is unchanged
Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n/n = Value at POR and 1 = bit is set 0 = bit is cleared x = bit is unknown
BOR/Value at all other u = bit is unchanged
Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n/n = Value at POR and 1 = bit is set 0 = bit is cleared x = bit is unknown
BOR/Value at all other u = bit is unchanged
Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n/n = Value at POR and 1 = bit is set 0 = bit is cleared x = bit is unknown
BOR/Value at all other u = bit is unchanged
Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n/n = Value at POR and 1 = bit is set 0 = bit is cleared x = bit is unknown
BOR/Value at all other u = bit is unchanged
Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n/n = Value at POR and 1 = bit is set 0 = bit is cleared x = bit is unknown
BOR/Value at all other u = bit is unchanged
Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n/n = Value at POR and 1 = bit is set 0 = bit is cleared x = bit is unknown
BOR/Value at all other u = bit is unchanged
Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n/n = Value at POR and 1 = bit is set 0 = bit is cleared x = bit is unknown
BOR/Value at all other u = bit is unchanged
Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n/n = Value at POR 1 = bit is set 0 = bit is cleared x = bit is unknown
and BOR/Value at all u = bit is unchanged
other Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n/n = Value at POR 1 = bit is set 0 = bit is cleared x = bit is unknown
and BOR/Value at all u = bit is unchanged
other Resets
PORTB
PORTC
PORTD
Write LATx
PORTE
PORTA
PORTF
Write PORTx
Device CK VDD
Data Register
PIC18(L)F26K42 • • • •(1)
PIC18(L)F27K42 • • • •(1) Data Bus
PIC18(L)F45K42 • • • • •(2) I/O pin
(2) Read PORTx
PIC18(L)F46K42 • • • • •
PIC18(L)F47K42 • • • • •(2) To digital peripherals
VSS
PIC18(L)F55K42 • • • • •(2) • ANSELx
To analog peripherals
PIC18(L)F56K42 • • • • •(2) •
(2)
PIC18(L)F57K42 • • • • • •
Note 1: Pin RE3 only. 16.1 I/O Priorities
2: Pins RE0, RE1, RE2 and RE3 only.
Each pin defaults to the PORT data latch after Reset.
Each port has ten registers to control the operation. Other functions are selected with the peripheral pin
These registers are: select logic. See Section 17.0 “Peripheral Pin Select
• PORTx registers (reads the levels on the pins of (PPS) Module” for more information.
the device) Analog input functions, such as ADC and comparator
• LATx registers (output latch) inputs, are not shown in the peripheral pin select lists.
• TRISx registers (data direction) These inputs are active when the I/O pin is set for
• ANSELx registers (analog select) Analog mode using the ANSELx register. Digital output
• WPUx registers (weak pull-up) functions may continue to control the pin when it is in
• INLVLx (input level control) Analog mode.
• SLRCONx registers (slew rate control) Analog outputs, when enabled, take priority over digital
• ODCONx registers (open-drain control) outputs and force the digital output driver into a
Most port pins share functions with device peripherals, high-impedance state.
both analog and digital. In general, when a peripheral The pin function priorities are as follows:
is enabled on a port pin, that pin cannot be used as a
1. Configuration bits
general purpose output; however, the pin can still be
read. 2. Analog outputs (disable the input buffers)
3. Analog inputs
The Data Latch (LATx registers) is useful for
read-modify-write operations on the value that the I/O 4. Port inputs and outputs from PPS
pins are driving.
A write operation to the LATx register has the same
16.2 PORTx Registers
effect as a write to the corresponding PORTx register. In this section, the generic names such as PORTx,
A read of the LATx register reads of the values held in LATx, TRISx, etc. can be associated with PORTA,
the I/O PORT latches, while a read of the PORTx PORTB, and PORTC. The functionality of PORTE is
register reads the actual I/O pin value. different compared to other ports and is explained in a
Ports that support analog inputs have an associated separate section.
ANSELx register. When an ANSELx 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 16-1.
16.3.4 INTERRUPT-ON-CHANGE
The interrupt-on-change feature is available only on the
RE3 pin of PORTE for all devices. If MCLRE = 1 or
LVP = 1, RE3 port functionality is disabled and
interrupt-on-change on RE3 is not available. For further
details refer to Section 18.0 “Interrupt-on-Change”.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
-n/n = Value at POR and BOR/Value at all other Resets
Note 1: Writes to PORTx are actually written to the corresponding LATx register.
Reads from PORTx register return actual I/O pin values.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
-n/n = Value at POR and BOR/Value at all other Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
-n/n = Value at POR and BOR/Value at all other Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
-n/n = Value at POR and BOR/Value at all other Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
-n/n = Value at POR and BOR/Value at all other Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
-n/n = Value at POR and BOR/Value at all other Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
-n/n = Value at POR and BOR/Value at all other Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
-n/n = Value at POR and BOR/Value at all other Resets
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 = Hardware set
PORTA RA7 RA6 RA5 RA4 RA3 RA2 RA1 RA0 264
PORTB RB7(1) RB6(1) RB5 RB4 RB3 RB2 RB1 RB0 264
PORTC RC7 RC6 RC5 RC4 RC3 RC2 RC1 RC0 264
PORTD(6) RD7 RD6 RD5 RD4 RD3 RD2 RD1 RD0 264
PORTE — — — — RE3(2) RE2(6) RE1(6) RE0(6) 264
PORTF(7) RF7 RF6 RF5 RF4 RF3 RF2 RF1 RF0 264
TRISA TRISA7 TRISA6 TRISA5 TRISA4 TRISA3 TRISA2 TRISA1 TRISA0 265
TRISB TRISB7(3) TRISB6(3) TRISB5 TRISB4 TRISB3 TRISB2 TRISB1 TRISB0 265
TRISC TRISC7 TRISC6 TRISC5 TRISC4 TRISC3 TRISC2 TRISC1 TRISC0 265
TRISD(6) TRISD7 TRISD6 TRISD5 TRISD4 TRISD3 TRISD2 TRISD1 TRISD0 265
TRISE(6) — — — — — TRISE2 TRISE1 TRISE0 265
TRISF(7) TRISF7 TRISF6 TRISF5 TRISF4 TRISF3 TRISF2 TRISF1 TRISF0 265
LATA LATA7 LATA6 LATA5 LATA4 LATA3 LATA2 LATA1 LATA0 266
LATB LATB7 LATB6 LATB5 LATB4 LATB3 LATB2 LATB1 LATB0 266
LATC LATC7 LATC6 LATC5 LATC4 LATC3 LATC2 LATC1 LATC0 266
LATD(6) LATD7 LATD6 LATD5 LATD4 LATD3 LATD2 LATD1 LATD0 266
LATE(6) — — — — — LATE2 LATE1 LATE0 266
LATF(7) LATF7 LATF6 LATF5 LATF4 LATF3 LATF2 LATF1 LATF0 266
ANSELA ANSELA7 ANSELA6 ANSELA5 ANSELA4 ANSELA3 ANSELA2 ANSELA1 ANSELA0 267
ANSELB ANSELB7 ANSELB6 ANSELB5 ANSELB4 ANSELB3 ANSELB2 ANSELB1 ANSELB0 267
ANSELC ANSELC7 ANSELC6 ANSELC5 ANSELC4 ANSELC3 ANSELC2 ANSELC1 ANSELC0 267
ANSELD(6) ANSELD7 ANSELD6 ANSELD5 ANSELD4 ANSELD3 ANSELD2 ANSELD1 ANSELD0 267
ANSELE(6) — — — — — ANSELE2 ANSELE1 ANSELE0 267
ANSELF(7) ANSELF7 ANSELF6 ANSELF5 ANSELF4 ANSELF3 ANSELF2 ANSELF1 ANSELF0 267
WPUA WPUA7 WPUA6 WPUA5 WPUA4 WPUA3 WPUA2 WPUA1 WPUA0 268
WPUB WPUB7 WPUB6 WPUB5 WPUB4 WPUB3 WPUB2 WPUB1 WPUB0 268
WPUC WPUC7 WPUC6 WPUC5 WPUC4 WPUC3 WPUC2 WPUC1 WPUC0 268
WPUD(6) WPUD7 WPUD6 WPUD5 WPUD4 WPUD3 WPUD2 WPUD1 WPUD0 268
WPUE — — — — WPUE3(4) WPUE2(6) WPUE1(6) WPUE0(6) 268
WPUF(6) WPUF7 WPUF6 WPUF5 WPUF4 WPUF3 WPUF2 WPUF1 WPUF0 268
ODCONA ODCA7 ODCA6 ODCA5 ODCA4 ODCA3 ODCA2 ODCA1 ODCA0 269
ODCONB ODCB7 ODCB6 ODCB5 ODCB4 ODCB3 ODCB2 ODCB1 ODCB0 269
ODCONC ODCC7 ODCC6 ODCC5 ODCC4 ODCC3 ODCC2 ODCC1 ODCC0 269
ODCOND(6) ODCD7 ODCD6 ODCD5 ODCD4 ODCD3 ODCD2 ODCD1 ODCD0 269
ODCONE(6) — — — — — ODCE2 ODCE1 ODCE0 269
ODCONF(7) ODCF7 ODCF6 ODCF5 ODCF4 ODCF3 ODCF2 ODCF1 ODCF0 269
SLRCONA SLRA7 SLRA6 SLRA5 SLRA4 SLRA3 SLRA2 SLRA1 SLRA0 270
SLRCONB SLRB7 SLRB6 SLRB5 SLRB4 SLRB3 SLRB2 SLRB1 SLRB0 270
SLRCONC SLRC7 SLRC6 SLRC5 SLRC4 SLRC3 SLRC2 SLRC1 SLRC0 270
SLRCOND(6) SLRD7 SLRD6 SLRD5 SLRD4 SLRD3 SLRD2 SLRD1 SLRD0 270
SLRCONE(6) — — — — — SLRE2 SLRE1 SLRE0 270
SLRCONF(7) SLRF7 SLRF6 SLRF5 SLRF4 SLRF3 SLRF2 SLRF1 SLRF0 270
INLVLA INLVLA7 INLVLA6 INLVLA5 INLVLA4 INLVLA3 INLVLA2 INLVLA1 INLVLA0 271
INLVLB INLVLB7 INLVLB6 INLVLB5 INLVLB4 INLVLB3 INLVLB2(5) INLVLB1(5) INLVLB0 271
Legend: — = unimplemented location, read as ‘0’. Shaded cells are not used by I/O Ports.
Note 1: Bits RB6 and RB7 read ‘1’ while in Debug mode.
2: Bit PORTE3 is read-only, and will read ‘1’ when MCLRE = 1 (Master Clear enabled).
3: Bits RB6 and RB7 read ‘1’ while in Debug mode.
4: If MCLRE = 1, the weak pull-up in RE3 is always enabled; bit WPUE3 is not affected.
5: Any peripheral using the I2C pins read the I2C ST inputs when enabled via RxyI2C.
6: Unimplemented in PIC18(L)F26/27K42.
7: Unimplemented in PIC18(L)F26/27/45/46/47K42 parts.
INLVLC INLVLC7 INLVLC6 INLVLC5 INLVLC4(5) INLVLC3(5) INLVLC2 INLVLC1 INLVLC0 271
INLVLD(6) INLVLD7 INLVLD6 INLVLD5 INLVLD4 INLVLD3 INLVLD2 INLVLD1(5) INLVLD0(5) 271
INLVLF(7) INLVLF7 INLVLF6 INLVLF5 INLVLF4 INLVLF3 INLVLF2 INLVLF1 INLVLF0 271
INLVLE — — — — INLVLE3 — — — 271
RB1I2C — SLEW PU[1:0] — — TH[1:0] 272
RB2I2C — SLEW PU[1:0] — — TH[1:0] 272
RC3I2C — SLEW PU[1:0] — — TH[1:0] 272
RC4I2C — SLEW PU[1:0] — — TH[1:0] 272
RD0I2C(6) — SLEW PU[1:0] — — TH[1:0] 272
RD1I2C(6) — SLEW PU[1:0] — — TH[1:0] 272
Legend: — = unimplemented location, read as ‘0’. Shaded cells are not used by I/O Ports.
Note 1: Bits RB6 and RB7 read ‘1’ while in Debug mode.
2: Bit PORTE3 is read-only, and will read ‘1’ when MCLRE = 1 (Master Clear enabled).
3: Bits RB6 and RB7 read ‘1’ while in Debug mode.
4: If MCLRE = 1, the weak pull-up in RE3 is always enabled; bit WPUE3 is not affected.
5: Any peripheral using the I2C pins read the I2C ST inputs when enabled via RxyI2C.
6: Unimplemented in PIC18(L)F26/27K42.
7: Unimplemented in PIC18(L)F26/27/45/46/47K42 parts.
Rev. 10-000262D
3/27/2017
RxyPPS
abcPPS
Rxy
Rxy
Peripheral abc
RxyPPS
Rxy
Peripheral xyz
RxyPPS
Rxy
xyzPPS
Rxy
; Enable Interrupts
BSF INTCON0,GIE
Legend:
R = Readable bit W = Writable bit -n/n = Value at POR and BOR/Value at all other Resets
u = Bit is unchanged x = Bit is unknown q = value depends on peripheral
‘1’ = Bit is set U = Unimplemented bit, m = value depends on default location for that input
‘0’ = Bit is cleared read as ‘0’
Note 1: The Reset value ‘m’ of this register is determined by device default locations for that input.
2: Reserved on PIC18LF26/27/45/46/47K42 parts.
3: Reserved on PIC18LF26K42 parts.
PIC18(L)F26/27/45/46/47/55/56/57K42
Interrupt 2 INT2PPS RB2 0b0 1010 A B — A B — — — — B — — — F
Timer0 Clock T0CKIPPS RA4 0b0 0100 A B — A B — — — A — — — — F
Timer1 Clock T1CKIPPS RC0 0b1 0000 A — C A — C — — — — C — E —
Timer1 Gate T1GPPS RB5 0b0 1101 — B C — B C — — — B C — — —
Timer3 Clock T3CKIPPS RC0 0b1 0000 — B C — B C — — - — C — E —
Timer3 Gate T3GPPS RC0 0b1 0000 A — C A — C — — A — C — — —
Timer5 Clock T5CKIPPS RC2 0b1 0010 A — C A — C — — — — C — E —
Timer5 Gate T5GPPS RB4 0b0 1100 — B C — B — D — — B — D — —
Timer2 Clock T2INPPS RC3 0b1 0011 A — C A — C — — A — C — — —
Timer4 Clock T4INPPS RC5 0b1 0101 — B C — B C — — — B C — — —
Timer6 Clock T6INPPS RB7 0b0 1111 — B C — B — D — — B — D — —
CCP1 CCP1PPS RC2 0b1 0010 — B C — B C — — — — C — — F
CCP2 CCP2PPS RC1 0b1 0001 — B C — B C — — — — C — — F
CCP3 CCP3PPS RB5 0b0 1101 — B C — B — D — — B — D — —
CCP4 CCP4PPS RB0 0b0 1000 — B C — B — D — — B — D — —
SMT1 Window SMT1WINPPS RC0 0b1 0000 — B C — B C — — — — C — — F
SMT1 Signal SMT1SIGPPS RC1 0b1 0001 — B C — B C — — — — C — — F
CWG1 CWG1PPS RB0 0b0 1000 — B C — B — D — — B — D — —
CWG2 CWG2PPS RB1 0b0 1001 — B C — B — D — — B — D — —
CWG3 CWG3PPS RB2 0b0 1010 — B C — B — D — — B — D — —
DSM1 Carrier MD1CARLPPS RA3 0b0 0011 A — C A — — D — A — — D — —
Low
DSM1 Carrier MD1CARHPPS RA4 0b0 0100 A — C A — — D — A — — D — —
High
DS40001919E-page 279
PIC18(L)F26/27/45/46/47/55/56/57K42
SPI1 Slave SPI1SSPPS RA5 0b0 0101 A — C A — — D — A — — D — —
Select
I2C1 Clock I2C1SCLPPS RC3 0b1 0011 — B C — B C — — — B C — — —
I2C1 Data I2C1SDAPPS RC4 0b1 0100 — B C — B C — — — B C — — —
I2C2 Clock I2C2SCLPPS RB1 0b0 1001 — B C — B — D — — B — D — —
I2C2 Data I2C2SDAPPS RB2 0b0 1010 — B C — B — D — — B — D — —
UART1 Receive U1RXPPS RC7 0b1 0111 — B C — B C — — — — C — — F
UART1 Clear To U1CTSPPS RC6 0b1 0110 — B C — B C — — — — C — — F
Send
UART2 Receive U2RXPPS RB7 0b0 1111 — B C — B — D — — B — D — —
UART2 Clear To U2CTSPPS RB6 0b0 1110 — B C — B — D — — B — D — —
Send
DS40001919E-page 280
PIC18(L)F26/27/45/46/47/55/56/57K42
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
PIC18(L)F26/27/45/46/47/55/56/57K42
0b11 0000 CWG3D A — C A — — D — A — — D — —
0b10 1111 CWG3C A — C A — — D — A — — D — —
0b10 1110 CWG3B A — C A — — — E A — — — E —
0b10 1101 CWG3A — B C — B C — — — B C — — —
0b10 1100 CWG2D — B C — B — D — — B — D — —
0b10 1011 CWG2C — B C — B — D — — B — D — —
0b10 1010 CWG2B — B C — B — D — — B — D — —
0b10 1001 CWG2A — B C — B C — — — B C — — —
0b10 1000 DSM1 A — C A — — D — A — — D - —
0b10 0111 CLKR — B C — B C — — — B — — E —
0b10 0110 NCO1 A — C A — — D — A — — D — —
0b10 0101 TMR0 — B C — B C — — — — C — — F
0b10 0100 I2C2 (SDA) — B C — B — D — — B — D — —
0b10 0011 I2C2 (SCL) — B C — B — D — — B — D — —
0b10 0010 I2C1 (SDA) — B C — B C — — — B C — — —
0b10 0001 I2C1 (SCL) — B C — B C — — — B C — — —
0b10 0000 SPI1 (SS) A — C A — — D — A — — D — —
0b01 1111 SPI1 (SDO) — B C — B C — — — B C — — —
0b01 1110 SPI1 (SCK) — B C — B C — — — B C — — —
0b01 1101 C2OUT A — C A — — — E A — — — E —
0b01 1100 C1OUT A — C A — — D — A — — D — —
0b01 1011 - Reserved
0b01 1001
0b01 1000 UART2 (RTS) — B C — B — D — — B — D — —
DS40001919E-page 282
Device Configuration
RxyPPS[5:0] Pin Rxy Output Source
PIC18(L)F26K42 PIC18(L)F45/46K42 PIC18(L)F55/56/57K42
PIC18(L)F26/27/45/46/47/55/56/57K42
0b00 1110 PWM6 A — C A — — D — A — — D — —
0b00 1101 PWM5 A — C A — C — — A — — — — F
0b00 1100 CCP4 — B C — B — D — — B — D — —
0b00 1011 CCP3 — B C — B — D — — B — D — —
0b00 1010 CCP2 — B C — B C — — — — C — — F
0b00 1001 CCP1 — B C — B C — — — — C — — F
0b00 1000 CWG1D — B C — B — D — — B — D — —
0b00 0111 CWG1C — B C — B — D — — B — D — —
0b00 0110 CWG1B — B C — B — D — — B — D — —
0b00 0101 CWG1A — B C — B C — — — B C — — —
0b00 0100 CLC4OUT — B C — B — D — — B — D — —
0b00 0011 CLC3OUT — B C — B — D — — B — D — —
0b00 0010 CLC2OUT A — C A — C — — A — — — — F
0b00 0001 CLC1OUT A — C A — C — — A — — — — F
0b00 0000 LATxy A B C A B C D E A B C D E F
DS40001919E-page 283
PIC18(L)F26/27/45/46/47/55/56/57K42
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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
IOCAPx D Q D Q IOCAFx
0 or 1
R
write IOCAFx
IOCIE
Q2
IOC interrupt
to CPU core
from all other
IOCnFx individual
pin detectors
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 q = Value depends on condition
Note 1: Clearing the SYSCMD bit disables the system clock (FOSC) to peripherals, however peripherals clocked
by FOSC/4 are not affected.
2: Subject to SCANE bit in CONFIG4H.
3: When enabling NVM, a delay of up to 1 µs may be required before accessing data.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 q = Value depends on condition
CLC1 111
SOSC 110 T0_match
Peripherals
MFINTOSC 101 CKPS<3:0>
LFINTOSC 100 TMR0 OUTPS<3:0> T0IF
Prescaler 1
HFINTOSC 011 IN OUT Postscaler T0_out
SYNC 0
FOSC/4 010
PPS 001 FOSC/4 MD16 TMR0
ASYNC D Q PPS
000
T0CKIPPS CK Q RxyPPS
CS<2:0>
8
Read TMR0L
COMPARATOR OUT
Write TMR0L
T0_match 8
8 TMR0H
TMR0 High
Byte
Latch 8
Enable
TMR0H
8
Internal Data Bus
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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
5
TxGPPS
GSPM
PPS 00000
1
0 Single Pulse D Q GVAL
NOTE (5) 0
11111
1 Acq. Control
Q1
D Q
GPOL GGO/DONE
CK Q
ON Interrupt
set bit
R
GTM det TMRxGIF
GE
set flag bit
TMRxIF
ON
EN
(2) To Comparators (6)
TMRx
Tx_overflow Synchronized Clock Input
TMRxH TMRxL Q D 0
1
TxCLK
SYNC
CS<4:0>
5
TxCKIPPS
(1)
PPS 00000
Prescaler
Synchronize(3)
1,2,4,8
Note (4) det
11111
2
Fosc/2
CKPS<1:0> Internal Sleep
Clock Input
TABLE 21-1: TIMER1/3/5 ENABLE Note: In Counter mode, a falling edge must be
SELECTIONS registered by the counter prior to the first
Timer1/3/5 incrementing rising edge after any one or
ON GE more of the following conditions:
Operation
1 1 Count Enabled • Timer1/3/5 enabled after POR
• Write to TMRxH or TMRxL
1 0 Always On
• Timer1/3/5 is disabled
0 1 Off
• Timer1/3/5 is disabled (TMRxON = 0)
0 0 Off when TxCKI is high then Timer1/3/5
is enabled (TMRxON = 1) when
21.2 Clock Source Selection TxCKI is low.
The CS[4:0] bits of the TMRxCLK register (Register 21-
21.2.2 EXTERNAL CLOCK SOURCE
3) are used to select the clock source for Timer1/3/5.
The TxCLK register allows the selection of several When the external clock source is selected, the Timer1/
possible synchronous and asynchronous clock 3/5 module may work as a timer or a counter.
sources. Register 21-3 displays the clock source When enabled to count, Timer1/3/5 is incremented on
selections. the rising edge of the external clock input of the
TxCKIPPS pin. This external clock source can be
21.2.1 INTERNAL CLOCK SOURCE synchronized to the microcontroller system clock or it
When the internal clock source is selected the can run asynchronously.
TMRxH:TMRxL register pair will increment on multiples When used as a timer with a clock oscillator, an
of FOSC as determined by the Timer1/3/5 prescaler. external 32.768 kHz crystal can be used in conjunction
When the FOSC internal clock source is selected, the with the dedicated secondary internal oscillator circuit.
Timer1/3/5 register value will increment by four counts
every instruction clock cycle. Due to this condition, a
2 LSB error in resolution will occur when reading the
Timer1/3/5 value. To utilize the full resolution of Timer1/
3/5, an asynchronous input signal must be used to gate
the Timer1/3/5 clock input.
Read TMR1L
Write TMR1L
8
8
TMR1H
8
8
Internal Data Bus
For more information on selecting high or low priority For more information, see Section 23.0 “Capture/
status for the Timer1/3/5 Overflow Interrupt, see Compare/PWM Module”.
Section 9.0 “Interrupt Controller”.
21.10 CCP Special Event Trigger
Note: The TMRxH:TMRxL register pair and the
TMRxIF bit should be cleared before When any of the CCP’s are configured to trigger a
enabling interrupts. special event, the trigger will clear the TMRxH:TMRxL
register pair. This special event does not cause a
Timer1/3/5 interrupt. The CCP module may still be
21.8 Timer1/3/5 Operation During Sleep
configured to generate a CCP interrupt.
Timer1/3/5 can only operate during Sleep when set up In this mode of operation, the CCPRxH:CCPRxL
in Asynchronous Counter mode. In this mode, an register pair becomes the period register for Timer1/3/
external crystal or clock source can be used to 5.
increment the counter. To set up the timer to wake the
device: Timer1/3/5 should be synchronized and FOSC/4 should
be selected as the clock source in order to utilize the
• ON bit of the TxCON register must be set Special Event Trigger. Asynchronous operation of
• TMRxIE bit of the respective PIE register must be Timer1/3/5 can cause a Special Event Trigger to be
set missed.
• SYNC bit of the TxCON register must be set In the event that a write to TMRxH or TMRxL coincides
• Configure the TMRxCLK register for using with a Special Event Trigger from the CCP, the write will
secondary oscillator as the clock source take precedence.
• Enable the SOSCEN bit of the OSCEN register
(Register 7-7)
The device will wake-up on an overflow and execute
the next instruction. If the GIE/GIEH bit of the
INTCON0 register is set, the device will call the
Interrupt Service Routine.
The secondary oscillator will continue to operate in
Sleep regardless of the SYNC bit setting.
TxCKI = 1
when TxTMR
Enabled
TxCKI = 0
when TxTMR
Enabled
TMRxGE
TxGPOL
TxG_IN
TxCKI
TxGVAL
TMRxGE
TxGPOL
TxGTM
TxTxG_IN
TxCKI
TxGVAL
TMRxGE
TxGPOL
TxGSPM
Cleared by hardware on
TxGGO/ Set by software falling edge of TxGVAL
DONE
Counting enabled on
rising edge of TxG
TxG_IN
TxCKI
TxGVAL
Cleared by
TMRxGIF Cleared by software Set by hardware on software
falling edge of TxGVAL
TMRxGE
TxGPOL
TxGSPM
TxGTM
Cleared by hardware on
TxGGO/ Set by software falling edge of TxGVAL
DONE Counting enabled on
rising edge of TxG
TxG_IN
TxCKI
TxGVAL
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared u = unchanged
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared u = unchanged
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared u = unchanged
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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
TxINPPS
TxIN PPS MODE<4:0> MODE<3>
enable MODE<4:3>=01
Clear ON
MODE<4:1>=1011 D Q
CKPOL
TMRx_clk Prescaler 0
R
TxTMR
Set flag bit
3 Sync 1 TMRxIF
4
ON Sync
1
(2 Clocks) TxPR OUTPS<3:0>
0
CKSYNC
1111
22.1.3 MONOSTABLE MODE
Monostable modes are similar to One-Shot modes
except that the ON bit is not cleared and the timer can
be restarted by an external Reset event.
22.1 Timer2 Operation
22.2 Timer2 Output
Timer2 operates in three major modes:
The Timer2 module’s primary output is
• Free Running Period
T2TMR_postscaled, which pulses for a single
• One-Shot T2TMR_clk period when the postscaler counter
• Monostable matches the value in the OUTPS bits of the TxCON
Within each mode there are several options for starting, register. The T2PR postscaler is incremented each
stopping, and reset. Table 22-1 lists the options. time the T2TMR value matches the T2PR value. This
signal can be selected as an input to several other input
In all modes the T2TMR count register is incremented
modules.
on the rising edge of the clock signal from the
programmable prescaler. When T2TMR equals T2PR Timer2 is also used by the CCP module for pulse
then a high level is output to the postscaler counter. generation in PWM mode. Both the actual T2TMR
T2TMR is cleared on the next clock input. value as well as other internal signals are sent to the
CCP module to properly clock both the period and
An external signal from hardware can also be
pulse width of the PWM signal. See Section
configured to gate the timer operation or force a
23.0 “Capture/Compare/PWM Module” for more
T2TMR count Reset. In gate modes, the counter stops
details on setting up Timer2 for use with the CCP, as
when the gate is disabled and resumes when the gate
well as the timing diagrams in Section
is enabled. In Reset modes the T2TMR count is reset
22.5 “Operation Examples” for examples of how the
on either the level or edge from the external source.
varying Timer2 modes affect CCP PWM output.
The T2TMR and T2PR registers are both directly
readable and writable. The T2TMR register is cleared 22.3 External Reset Sources
and the T2PR register initializes to FFh on any device
Reset. Both the prescaler and postscaler counters are In addition to the clock source, the Timer2 also takes in
cleared on the following events: an external Reset source. This external Reset source
is selected for Timer2, Timer4, and Timer6 with the
• a write to the T2TMR register
T2RST, T4RST, and T6RST registers, respectively.
• a write to the TxCON register This source can control starting and stopping of the
• any device Reset timer, as well as resetting the timer, depending on
• External Reset Source event that resets the timer. which mode the timer is in. The mode of the timer is
Note: T2TMR is not cleared when TxCON is controlled by the MODE bits of the T2HLT register.
written. Edge Triggered modes require six Timer clock periods
between external triggers. Level Triggered modes
require the triggering level to be at least three Timer
22.1.1 FREE RUNNING PERIOD MODE
clock periods long. External triggers are ignored while
The value of T2TMR is compared to that of the Period in Debug Freeze mode.
register, T2PR, on each clock cycle. When the two
values match, the comparator resets the value of
T2TMR to 00h on the next cycle and increments the
Rev. 10-000205B
9/12/2016
CKPS 0b010
TxPR 1
OUTPS 0b0001
TMRx_clk
TxTMR 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
TxPR 5
TxTMR 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 .
Rev. 10-000196C
9/12/2016
MODE 0b00001
TMRx_clk
TMRx_ers
TxPR 5
TxTMR 0 1 2 3 4 5 0 1 2 3 4 5 0 1
TMRx_postscaled
PWM Duty
3
Cycle
PWM Output
FIGURE 22-6: EDGE TRIGGERED HARDWARE LIMIT MODE TIMING DIAGRAM (MODE=00100)
Rev. 10-000197C
9/12/2016
MODE 0b00100
TMRx_clk
TxPR 5
ON
TMRx_ers
TxTMR 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 .
Rev. 10-000198C
9/12/2016
MODE 0b00111
TMRx_clk
TxPR 5
ON
TMRx_ers
TxTMR 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 22-8: SOFTWARE START ONE-SHOT MODE TIMING DIAGRAM (MODE = 01000)
Rev. 10-000199C
9/12/2016
MODE 0b01000
TMRx_clk
TxPR 5
ON
TxTMR 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.
FIGURE 22-9: EDGE TRIGGERED ONE-SHOT MODE TIMING DIAGRAM (MODE = 01001)
Rev. 10-000200C
9/12/2016
MODE 0b01001
TMRx_clk
TxPR 5
ON
TMRx_ers
TxTMR 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.
MODE period value. External signal edges will have no effect until after software sets
the ON bit. Figure 22-10 illustrates the rising edge hardware limit one-shot
In Edge-Triggered Hardware Limit One-Shot modes, the timer starts on the operation.
first external signal edge after the ON bit is set and resets on all subsequent
When this mode is used in conjunction with the CCP then the first starting edge
edges. Only the first edge after the ON bit is set is needed to start the timer.
trigger, and all subsequent Reset edges, will activate the PWM drive. The PWM
The counter will resume counting automatically two clocks after all subsequent drive will deactivate when the timer matches the CCPRx pulse width value and
external Reset edges. Edge triggers are as follows: stay deactivated until the timer halts at the T2PR period match unless an
PIC18(L)F26/27/45/46/47/55/56/57K42
• Rising edge Start and Reset (MODE[4:0] = 01100) external signal edge resets the timer before the match occurs.
• Falling edge Start and Reset (MODE[4:0] = 01101)
FIGURE 22-10: EDGE TRIGGERED HARDWARE LIMIT ONE-SHOT MODE TIMING DIAGRAM (MODE = 01100))
Rev. 10-000201C
9/12/2016
MODE 0b01100
TMRx_clk
TxPR 5
ON
TMRx_ers
TxTMR 0 1 2 3 4 5 0 1 2 0 1 2 3 4 5 0
TMRx_postscaled
PWM Duty
3
Cycle
DS40001919E-page 331
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.
22.5.8 LEVEL RESET, EDGE-TRIGGERED HARDWARE LIMIT When the timer count matches the T2PR period count, the timer is reset and
2017-2019 Microchip Technology Inc.
ONE-SHOT MODES the ON bit is cleared. When the ON bit is cleared by either a T2PR match or by
software control a new external signal edge is required after the ON bit is set to
In Level Triggered One-Shot mode, the timer count is reset on the external start the counter.
signal level and starts counting on the rising/falling edge of the transition from
When Level Triggered Reset One-Shot mode is used in conjunction with the
reset level to the active level while the ON bit is set. Reset levels are selected
CCP PWM operation, the PWM drive goes active with the external signal edge
as follows: that starts the timer. The PWM drive goes inactive when the timer count equals
• Low reset level (MODE[4:0] = 01110) the CCPRx pulse-width count. The PWM drive does not go active when the
PIC18(L)F26/27/45/46/47/55/56/57K42
• High reset level (MODE[4:0] = 01111) timer count clears at the T2PR period count match.
FIGURE 22-11: LOW LEVEL RESET, EDGE-TRIGGERED HARDWARE LIMIT ONE-SHOT MODE TIMING DIAGRAM (MODE = 01110)
Rev. 10-000202C
9/12/2016
MODE 0b01110
TMRx_clk
TxPR 5
ON
TMRx_ers
TxTMR 0 1 2 3 4 5 0 1 0 1 2 3 4 5 0
TMRx_postscaled
PWM Duty
3
Cycle
DS40001919E-page 332
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.
22.5.9 EDGE-TRIGGERED MONOSTABLE MODES When an Edge-Triggered Monostable mode is used in conjunction with the
2017-2019 Microchip Technology Inc.
CCP PWM operation the PWM drive goes active with the external Reset signal
The Edge-Triggered Monostable modes start the timer on an edge from the
edge that starts the timer, but will not go active when the timer matches the
external Reset signal input, after the ON bit is set, and stop incrementing the
T2PR value. While the timer is incrementing, additional edges on the external
timer when the timer matches the T2PR period value. The following edges will
Reset signal will not affect the CCP PWM.
start the timer:
• Rising edge (MODE[4:0] = 10001)
• Falling edge (MODE[4:0] = 10010)
PIC18(L)F26/27/45/46/47/55/56/57K42
• Rising or Falling edge (MODE[4:0] = 10011)
FIGURE 22-12: RISING EDGE-TRIGGERED MONOSTABLE MODE TIMING DIAGRAM (MODE = 10001)
Rev. 10-000203B
12/13/2016
MODE 0b10001
TMRx_clk
TxPR 5
ON
TMRx_ers
TxTMR 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
DS40001919E-page 333
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.
22.5.10 LEVEL-TRIGGERED HARDWARE LIMIT ONE-SHOT When the timer count matches the T2PR period count, the timer is reset and
2017-2019 Microchip Technology Inc.
MODES the ON bit is cleared. When the ON bit is cleared by either a T2PR match or by
software control, the timer will stay in Reset until both the ON bit is set and the
The Level Triggered Hardware Limit One-Shot modes hold the timer in Reset
external signal is not at the Reset level.
on an external Reset level and start counting when both the ON bit is set and
the external signal is not at the Reset level. If one of either the external signal When Level Triggered Hardware Limit One-Shot modes are used in conjunction
is not in reset or the ON bit is set then the other signal being set/made active with the CCP PWM operation, the PWM drive goes active with either the
will start the timer. Reset levels are selected as follows: external signal edge or the setting of the ON bit, whichever of the two starts the
timer.
• Low reset level (MODE[4:0] = 10110)
PIC18(L)F26/27/45/46/47/55/56/57K42
• High reset level (MODE[4:0] = 10111)
FIGURE 22-13: LEVEL-TRIGGERED HARDWARE LIMIT ONE-SHOT MODE TIMING DIAGRAM (MODE = 10110)
Rev. 10-000204B
12/13/2016
MODE 0b10110
TMRx_clk
TxPR 5
ON
TMRx_ers
TxTMR 0 1 2 3 4 5 0 1 2 3 0 1 2 3 4 5 0
TMRx_postscaled
PWM Duty
‘D3
Cycle
DS40001919E-page 334
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.
PIC18(L)F26/27/45/46/47/55/56/57K42
22.6 Timer2 Operation During Sleep
When PSYNC = 1, Timer2 cannot be operated while
the processor is in Sleep mode. The contents of the
T2TMR 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
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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: In certain modes, the ON bit will be auto-cleared by hardware. See Section 22.1.2 “One-Shot 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
Note 1: Setting this bit ensures that reading TxTMR will return a valid data 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 TxTMR 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 TxTMR).
7: When TxTMR = TxPR, the next clock clears TxTMR, regardless of the operating mode.
Rev. 10-000158J
9/13/2016
RxyPPS
CCPx
CTS<2:0>
TRIS Control
CLC4_out 111
CLC3_out 110 CCPRxH CCPRxL
CLC2_out 101 16
set CCPxIF
CLC1_out 100 Prescaler and
IOC_interrupt 011 1,4,16 Edge Detect
16
CMP2_out 010
CMP1_out 001 MODE <3:0> TMR1H TMR1L
CCPx PPS 000
CCPxPPS
Rev. 10-000159C
5/26/2016
To Peripherals
CCPRxH CCPRxL
CCPx_out
set CCPxIF
Output S Q PPS CCPx Pin
Comparator
Logic
R TRIS Control
4 RxyPPS
TMR1H TMR1L MODE<3:0>
23.3.1 CCPx PIN CONFIGURATION In Compare mode, Timer1 must be running in either
Timer mode or Synchronized Counter mode. The
The software must configure the CCPx pin as an output
compare operation may not work in Asynchronous
by clearing the associated TRIS bit and defining the
Counter mode.
appropriate output pin through the RxyPPS registers.
See Section 17.0 “Peripheral Pin Select (PPS) See Section 21.0 “Timer1/3/5 Module with Gate
Module” for more details. Control” for more information on configuring Timer1.
Note: Clocking Timer1 from the system clock
(FOSC) should not be used in Compare
Note: Clearing the CCPxCON register will force
mode. In order for Compare mode to
the CCPx compare output latch to the
recognize the trigger event on the CCPx
default low level. This is not the PORT I/O
pin, TImer1 must be clocked from the
data latch.
instruction clock (FOSC/4) or from an
external clock source.
23.3.2 TIMER1 MODE RESOURCE
Pulse Width
T2TMR = T2PR
T2TMR reloaded with 0
Rev. 10-000157D
CCPRxH CCPRxL
CCPx_out
To Peripherals
set CCPxIF
10-bit Latch(2)
(Not accessible by user)
S RxyPPS
TMR2 Module TRIS Control
R
T2TMR (1)
ERS logic
Comparator CCPx_pset
T2PR
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 CCPxFMT bit.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: The set and clear operations of the Compare mode are reset by setting MODE = 4’b0000 or EN = 0.
2: When MODE = 0001 or 1011, then the timer associated with the CCP module is cleared. TMR1 is the default selection
for the CCP module, so it is used for indication purpose only.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Connection
CTS[1:0]
CCP1 CCP2 CCP3 CCP4
111 CLC4_out
110 CLC3_out
101 CLC2_out
100 CLC1_out
011 IOC_Interrupt
010 CMP2_output
001 CMP1_output
Pin selected by Pin selected by Pin selected by Pin selected by
000
CCP1PPS CCP2PPS CCP3PPS CCP4PPS
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Rev. 10-000022D
9/13/2016
PWMxDCH
PWMx_out
To Peripherals
10-bit Latch
(Not visible to user)
Comparator R Q
0
PPS PWMx
1
S Q
TMR2 Module
R POL RxyPPS TRIS Control
T2TMR (1)
Comparator
T2_match
T2PR
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.
FIGURE 24-2: PWM OUTPUT For a step-by-step procedure on how to set up this
Period Rev. 10-000023E
module for PWM operation, refer to Section
24.1.9 “Setup for PWM Operation using PWMx
9/13/2016
Pins”.
Pulse Width
T2TMR = T2PR
T2TMR reloaded with 0
PWMxDCH:PWMxDCL<7:6> -
Duty Cycle Ratio = ----------------------------------------------------------------------------------
4 T2 PR + 1
4 T2PR + 1 - bits
Resolution = log
---------------------------------------------
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’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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-000161E
10/12/2016
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
CSEL<2:0>
See See
SMTxSIG SMT_signal SMTxWIN SMT_window
Register Register
SSEL<4:0> WSEL<4:0>
SMTx Clock
PIC18(L)F26/27/45/46/47/55/56/57K42
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
DS40001919E-page 366
PIC18(L)F26/27/45/46/47/55/56/57K42
25.6.2 GATED TIMER MODE
Gated Timer mode uses the SMTSIGx input to control
whether or not the SMT1TMR will increment. Upon a
falling edge of the external signal, the SMT1CPW
register will update to the current value of the
SMT1TMR. Example waveforms for both repeated and
single acquisitions are provided in Figure 25-4 and
Figure 25-5.
SMTx_signal
SMTx_signalsync
PIC18(L)F26/27/45/46/47/55/56/57K42
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxPR 0xFFFFFF
SMTxTMR 0 1 2 3 4 5 6 7
SMTxCPW 5 7
SMTxPWAIF
DS40001919E-page 368
FIGURE 25-5: GATED TIMER MODE SINGLE ACQUISITION TIMING DIAGRAM
2017-2019 Microchip Technology Inc.
SMTx_signal
PIC18(L)F26/27/45/46/47/55/56/57K42
SMTx_signalsync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxPR 0xFFFFFF
SMTxTMR 0 1 2 3 4 5
SMTxCPW 5
SMTxPWAIF
DS40001919E-page 369
PIC18(L)F26/27/45/46/47/55/56/57K42
25.6.3 PERIOD AND DUTY CYCLE MODE
In Duty Cycle mode, either the duty cycle or period
(depending on polarity) of the SMT1_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 SMT1TMR resetting to 0x0001. In addition, the
GO bit is reset on a rising edge when the SMT is in
Single Acquisition mode. See Figure 25-6 and
Figure 25-7.
SMTx_signal
PIC18(L)F26/27/45/46/47/55/56/57K42
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
DS40001919E-page 371
FIGURE 25-7: PERIOD AND DUTY-CYCLE SINGLE ACQUISITION TIMING DIAGRAM
2017-2019 Microchip Technology Inc.
SMTx_signal
PIC18(L)F26/27/45/46/47/55/56/57K42
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
DS40001919E-page 372
PIC18(L)F26/27/45/46/47/55/56/57K42
25.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 SMT1TMR on a rising edge on the
SMTSIGx input, then updates the SMT1CPW register
with the value and resets the SMT1TMR on a falling
edge, starting to increment again. Upon observing
another rising edge, it updates the SMT1CPR register
with its current value and once again resets the
SMT1TMR value and begins incrementing again. See
Figure 25-8 and Figure 25-9.
SMTx_signal
PIC18(L)F26/27/45/46/47/55/56/57K42
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
DS40001919E-page 374
FIGURE 25-9: HIGH AND LOW MEASURE MODE SINGLE ACQUISITION TIMING DIAGRAM
2017-2019 Microchip Technology Inc.
SMTx_signal
PIC18(L)F26/27/45/46/47/55/56/57K42
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
DS40001919E-page 375
PIC18(L)F26/27/45/46/47/55/56/57K42
25.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 SMT1CPR register with the value of the
timer and resets the timer on a second rising edge. See
Figure 25-10 and Figure 25-11.
SMTxWIN
PIC18(L)F26/27/45/46/47/55/56/57K42
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
DS40001919E-page 377
FIGURE 25-11: WINDOWED MEASURE MODE SINGLE ACQUISITION TIMING DIAGRAM
2017-2019 Microchip Technology Inc.
SMTxWIN
PIC18(L)F26/27/45/46/47/55/56/57K42
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
DS40001919E-page 378
PIC18(L)F26/27/45/46/47/55/56/57K42
25.6.6 GATED WINDOWED MEASURE
MODE
This mode measures the duty cycle of the SMT1_signal
input over a known input window. It does so by
incrementing the timer on each pulse of the clock signal
while the SMT1_signal input is high, updating the
SMT1CPR register and resetting the timer on every
rising edge of the SMTWINx input after the first. See
Figure 25-12 and Figure 25-13.
SMTxWIN
PIC18(L)F26/27/45/46/47/55/56/57K42
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
DS40001919E-page 380
FIGURE 25-13: GATED WINDOWED MEASURE MODE SINGLE ACQUISITION TIMING DIAGRAMS
DS40001919E-page 381
PIC18(L)F26/27/45/46/47/55/56/57K42
Rev. 10-000 183A
12/19/201 3
SMTxWIN
SMTxWIN_sync
SMTx_signal
SMTx_signalsync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxTMR 0 1 2 3 4 5 6
SMTxCPR 6
SMTxPRAIF
2017-2019 Microchip Technology Inc.
PIC18(L)F26/27/45/46/47/55/56/57K42
25.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
SMT1_signal input, beginning to increment the timer
upon observing a rising edge on the SMTWINx input,
while updating the SMT1CPR register and resetting the
timer upon observing a rising edge on the SMT1_signal
input. In the event of two SMTWINx rising edges
without an SMT1_signal rising edge, it will update the
SMT1CPW register with the current value of the timer
and reset the timer value. See Figure 25-14 and
Figure 25-15.
Rev. 10-000186A
4/22/2016
SMTxWIN
PIC18(L)F26/27/45/46/47/55/56/57K42
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
SMTxPRAIF
DS40001919E-page 383
FIGURE 25-15: TIME OF FLIGHT MODE SINGLE ACQUISITION TIMING DIAGRAM
2017-2019 Microchip Technology Inc.
Rev. 10-000185A
4/26/2016
SMTxWIN
SMTxWIN_sync
PIC18(L)F26/27/45/46/47/55/56/57K42
SMTx_signal
SMTx_signalsync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxTMR 0 1 2 3 4 5
SMTxCPW
SMTxCPR 4
SMTxPWAIF
SMTxPRAIF
DS40001919E-page 384
PIC18(L)F26/27/45/46/47/55/56/57K42
25.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 GO
bit being set, and updates the value of the SMT1CPR
register on each rising edge of SMTWINx, and updates
the value of the CPW register on each falling edge of
the SMTWINx. See Figure 25-16 and Figure 25-17.
SMTxWIN
PIC18(L)F26/27/45/46/47/55/56/57K42
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
DS40001919E-page 386
FIGURE 25-17: CAPTURE MODE SINGLE ACQUISITION TIMING DIAGRAM
DS40001919E-page 387
PIC18(L)F26/27/45/46/47/55/56/57K42
Rev. 10-000 187A
12/19/201 3
SMTxWIN
SMTxWIN_sync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxTMR 0 1 2 3
SMTxCPW 3
SMTxCPR 2
SMTxPWAIF
SMTxPRAIF
2017-2019 Microchip Technology Inc.
25.6.9 COUNTER MODE
2017-2019 Microchip Technology Inc.
This mode increments the timer on each pulse of the SMT1_signal input. This
mode is asynchronous to the SMT clock and uses the SMT1_signal as a time
source. The SMT1CPW register will be updated with the current SMT1TMR
value on the rising edge of the SMT1WIN input. See Figure 25-18.
PIC18(L)F26/27/45/46/47/55/56/57K42
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
DS40001919E-page 388
PIC18(L)F26/27/45/46/47/55/56/57K42
25.6.10 GATED COUNTER MODE
This mode counts pulses on the SMT1_signal input,
gated by the SMT1WIN input. It begins incrementing
the timer upon seeing a rising edge of the SMT1WIN
input and updates the SMT1CPW register upon a
falling edge on the SMT1WIN input. See Figure 25-
19 and Figure 25-20.
Rev. 10-000190A
12/18/2013
SMTxWIN
SMTx_signal
PIC18(L)F26/27/45/46/47/55/56/57K42
SMTxEN
SMTxGO
SMTxTMR 0 1 2 3 4 5 6 7 8 9 10 11 12 13
SMTxCPW 8 13
SMTxPWAIF
SMTxWIN
SMTx_signal
SMTxEN
SMTxGO
DS40001919E-page 390
SMTxTMR 0 1 2 3 4 5 6 7 8
SMTxCPW 8
SMTxPWAIF
PIC18(L)F26/27/45/46/47/55/56/57K42
25.6.11 WINDOWED COUNTER MODE
This mode counts pulses on the SMT1_signal input,
within a window dictated by the SMT1WIN input. It
begins counting upon seeing a rising edge of the
SMT1WIN input, updates the SMT1CPW register on a
falling edge of the SMT1WIN input, and updates the
SMT1CPR register on each rising edge of the
SMT1WIN input beyond the first. See Figure 25-21 and
Figure 25-22.
Rev. 10-000192A
12/18/2013
SMTxWIN
SMTx_signal
PIC18(L)F26/27/45/46/47/55/56/57K42
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
DS40001919E-page 392
FIGURE 25-22: WINDOWED COUNTER MODE SINGLE ACQUISITION TIMING DIAGRAM
DS40001919E-page 393
PIC18(L)F26/27/45/46/47/55/56/57K42
Rev. 10-000193A
12/18/2013
SMTxWIN
SMTx_signal
SMTxEN
SMTxGO
SMTxTMR 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
SMTxCPW 9
SMTxCPR 16
SMTxPWAIF
SMTxPRAIF
2017-2019 Microchip Technology Inc.
PIC18(L)F26/27/45/46/47/55/56/57K42
25.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.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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
bit 7-0 SMT1TMR[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 SMT1TMR[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 SMT1TMR[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 SMT1CPR[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 SMT1CPR[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 SMT1CPR[23:16]: Significant bits of the SMT Period Latch – Upper Byte
REGISTER 25-13: SMT1CPWL: 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
SMT1CPW[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 SMT1CPW[7:0]: Significant bits of the SMT PW Latch – Low Byte
REGISTER 25-14: SMT1CPWH: 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
SMT1CPW[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 SMT1CPW[15:8]: Significant bits of the SMT PW Latch – High Byte
REGISTER 25-15: SMT1CPWU: 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
SMT1CPW[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 SMT1CPW[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 SMT1PR[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 SMT1PR[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 SMT1PR[23:16]: Significant bits of the SMT Timer Value for Period Match – Upper Byte
FIGURE 26-1: SIMPLIFIED CWG BLOCK DIAGRAM (HALF-BRIDGE MODE, MODE[2:0] = 100)
‘1’ 00
‘0’ 01
High-Z 10
11
Rising Dead-Band Block
CWG Clock clock 1
CWG Data A
data out
CWG Data data in 0 CWG1A
POLA
LSBD<1:0>
E LSAC<1:0>
EN ‘1’ 00
‘0’ 01
High-Z 10
11
1
0 CWG1C
POLC
Auto-shutdown source S Q
(CWGxAS1 register) LSBD<1:0>
R
REN ‘1’ 00
SHUTDOWN = 0 ‘0’ 01
High-Z 10
11
1
0 CWG1D
POLD
SHUTDOWN
FREEZE
D Q
CWG Data
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
FIGURE 26-3: SIMPLIFIED CWG BLOCK DIAGRAM (PUSH-PULL MODE, MODE[2:0] = 101)
LSAC<1:0>
Rev. 10-000210D
2/2/2016
‘1’ 00
‘0’ 01
High-Z 10
11
1
CWG Data CWG Data A
0 CWG1A
POLA
LSBD<1:0>
D Q
Q
‘1’ 00
‘0’ 01
High-Z 10
CWG Data B 11
1
CWG Data Input CWG 0 CWG1B
POLB
Data
D Q
LSAC<1:0>
E
‘1’ 00
EN ‘0’ 01
High-Z 10
11
1
0 CWG1C
POLC
Auto-shutdown source S Q
(CWGxAS1 register)
R LSBD<1:0>
REN 00
‘1’
SHUTDOWN = 0
‘0’ 01
High-Z 10
11
1
0 CWG1D
POLD
SHUTDOWN
FREEZE
D Q
CWG Data
CWG1
clock
Input
source
CWG1A
CWG1B
VDD
FET QA QC
FET
Driver Driver
CWG1A
CWG1B LOAD
CWG1D QB QD
FIGURE 26-6: SIMPLIFIED CWG BLOCK DIAGRAM (FORWARD AND REVERSE FULL-BRIDGE
MODES)
LSAC<1:0>
MODE<2:0> = 011: Reverse
‘1’ 00
Rising Dead-Band Block ‘0’ 01
CWG Clock clock
signal out High-Z 10
signal in 11
CWG 1
CWG Data A
Data
MODE<2:0> 0 CWG1A
POLA
D Q
CWG Q LSBD<1:0>
Data
1
CWG Data Input CWG Data B
CWG Data
0 CWG1B
POLB
D Q
E LSAC<1:0>
‘1’ 00
EN
‘0’ 01
High-Z 10
11
CWG Data C
1
0 CWG1C
POLC
Auto-shutdown source S Q
(CWGxAS1 register)
R LSBD<1:0>
REN
‘1’ 00
SHUTDOWN = 0
‘0’ 01
High-Z 10
11
CWG Data D
1
0 CWG1D
POLD
SHUTDOWN
FREEZE
D Q
CWG Data
CWG1A(2)
CWG1B(2)
CWG1C(2)
Pulse Width
CWG1D(2)
(1) (1)
Reverse
Mode
Period
CWG1A(2)
Pulse Width
CWG1B(2)
CWG1C(2)
CWG1D(2)
(1) (1)
Note 1: A rising CWG data input creates a rising event on the modulated output.
2: Output signals shown as active-high; all POLy bits are clear.
FIGURE 26-8: EXAMPLE OF PWM DIRECTION CHANGE AT NEAR 100% DUTY CYCLE
t1
Forward Period Reverse Period
CWG1A
CWG1C
External Switch C
TOFF
External Switch D
CWG1
clock
Input
source
CWG1A
CWG1B
CWG1
INPUT
End of Instruction Cycle End of Instruction Cycle
STRA
CWG1A
Rev. 10-000211D
5/30/2017
‘1’ 00
‘0’ 01
High-Z 10
11
CWG Data A 1
1
POLA 0 CWG1A
0
OVRA
STRA LSBD<1:0>
‘1’ 00
‘0’ 01
CWG
CWG Data Data High-Z 10
Input
11
D Q CWG Data B
1
E 1
POLB 0 CWG1B
0
OVRB
EN
STRB LSAC<1:0>
‘1’ 00
‘0’ 01
High-Z 10
11
CWG Data C 1
Auto-shutdown source S Q 1
(CWGxAS1 register) POLC 0 CWG1C
R 0
OVRC
‘1’ 00
‘0’ 01
High-Z 10
11
CWG Data D
1
1
POLD 0 CWG1D
0
OVRD
SHUTDOWN
STRD
FREEZE
D Q
CWG Data
cwg_clock
PIC18(L)F26/27/45/46/47/55/56/57K42
Input Source
CWGxA
CWGxB
FIGURE 26-13: DEAD-BAND OPERATION, CWGxDBR = 0x03, CWGxDBF = 0x06, SOURCE SHORTER THAN DEAD BAND
cwg_clock
Input Source
CWGxA
DS40001919E-page 419
CWGxB
T
JITTER
= T
DEAD – BAND _ MAX
– TDEAD – BAND _ MIN
1
T = --------------------------------------------
JITTER F
CWG _ CLOCK
T = T +T
DEAD – BAND _ MAX DEAD – BAND _ MIN JITTER
EXAMPLE
DBR<4:0> = 0x0A = 10
F = 8 MHz
CWG_CLOCK
1
T = ---------------- = 125 ns
JITTER 8MHz
T = 125 ns*10 = 125 s
DEAD – BAND_MIN
SHUTDOWN bit
PPS
AS0E
CWGxINPPS
CMP1_out
PIC18(L)F26/27/45/46/47/55/56/57K42
AS4E
CMP2_out
AS5E
TMR2_postscaled SHUTDOWN S
S Q
AS1E D Q CWG_shutdown
TMR4_postscaled
REN FREEZE
R
AS2E Write ‘0’ to
SHUTDOWN bit
TMR6_postscaled CWG_data CK
AS3E
CLC2_out
AS6E
FIGURE 26-15: SHUTDOWN FUNCTIONALITY, AUTO-RESTART DISABLED (REN = 0, LSAC = 01, LSBD = 01)
CWG Input
Source
Shutdown Source
SHUTDOWN
CWG Input
Source
Shutdown Source
PIC18(L)F26/27/45/46/47/55/56/57K42
SHUTDOWN
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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: This bit can only be set after EN = 1; it cannot be set in the same cycle when 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:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 (Register 26-1, Steering modes).
2: This bit is 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 HS/HC = Bit is set/cleared by hardware
q = Value depends on condition
Note 1: This bit may be written while EN = 0 (Register 26-1), to place the outputs into the shutdown configuration.
2: The outputs will remain in auto-shutdown state until the next rising edge of the CWG data input 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
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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
OUT
D Q
CLCxOUT
Q1
LCx_in[0]
LCx_in[1] CLCx_out
to Peripherals
LCx_in[2]
. lcxg2
lcxg3
Logic
Function
(2)
lcxq
PPS CLCx
. lcxg4
POL TRIS
27.1 CLCx Setup Data inputs are selected with CLCxSEL0 through
CLCxSEL3 registers (Register 27-3 through
Programming the CLCx module is performed by Register 27-6).
configuring the four stages in the logic signal flow. The
four stages are: Note: Data selections are undefined at power-up.
• Data selection
• Data gating
• Logic function selection
• Output polarity
Each stage is setup at run time by writing to the
corresponding CLCx Special Function Registers. This
has the added advantage of permitting logic
reconfiguration on-the-fly during program execution.
Data Selection
LCx_in[0] 000000
Data GATE 1
d1T G1D1T
d1N G1D1N
LCx_in[n] 111111
G1D2T
D1S[5:0]
G1D2N lcxg1
LCx_in[0] 000000
G1D3T
G1POL
d2T
G1D3N
d2N
G1D4T
LCx_in[n] 111111
D2S[5:0] G1D4N
LCx_in[0] 000000
Data GATE 2
lcxg2
d3T
(Same as Data GATE 1)
d3N
Data GATE 3
LCx_in[n] 111111
lcxg3
D3S[5:0]
(Same as Data GATE 1)
d4N
LCx_in[n] 111111
D4S[5: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
Register on
Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Page
PIC18(L)F26/27/45/46/47/55/56/57K42
NCOxINCU NCOxINCH NCOxINCL Rev. 10-000028E
10/12/2016
20
(1)
INCBUFU INCBUFH INCBUFL
20
20
1111
NCO_overflow Adder
NCOx Clock 20
Sources
NCOx_clk
NCOxACCU NCOxACCH NCOxACCL
See 20
NCOxCLK
Register
NCO_interrupt set bit
NCOxIF
0000 Fixed Duty
Cycle Mode
Circuitry
CKS<3:0> D Q D Q 0 TRIS bit
4
_ NCOxOUT
1
Q
PFM POL
NCOx_out
To Peripherals
S Q
2017-2019 Microchip Technology Inc.
EN
_ D Q OUT
Ripple
R Q
Counter
Pulse Q1
R Frequency
3 Mode Circuitry
PWS<2:0>
Note 1: The increment registers are double-buffered to allow for value changes to be made without first disabling the NCO module. The full increment value is loaded into the buffer registers on the
second rising edge of the NCOx_clk signal that occurs immediately after a write to NCOxINCL register. The buffers are not user-accessible and are shown here for reference.
PIC18(L)F26/27/45/46/47/55/56/57K42
28.1 NCO Operation
The NCO operates by repeatedly adding a fixed value to
an accumulator. Additions occur at the input clock rate.
The accumulator will overflow with a carry periodically,
which is the raw NCO output (NCO_overflow). This
effectively reduces the input clock by the ratio of the
addition value to the maximum accumulator value. See
Equation 28-1.
The NCO output can be further modified by stretching
the pulse or toggling a flip-flop. The modified NCO
output is then distributed internally to other peripherals
and can be optionally output to a pin. The accumulator
overflow also generates an interrupt (NCO_overflow).
The NCO period changes in discrete steps to create an
average frequency. This output depends on the ability
of the receiving circuit (i.e., CWG or external resonant
converter circuitry) to average the NCO output to
reduce uncertainty.
28.1.3 ADDER Note: The increment buffer registers are not user-
The NCO Adder is a full adder, which operates accessible.
independently from the source clock. The addition of
the previous result and the increment value replaces
the accumulator value on the rising edge of each input
clock.
NCOx
Clock
Source
NCOx
Increment 4000h 4000h 4000h
Value
NCOx
Accumulator 00000h 04000h 08000h FC000h 00000h 04000h 08000h FC000h 00000h 04000h 08000h
Value
NCO_overflow
NCO_interrupt
NCOx Output
FDC Mode
NCOx Output
PF Mode
NCOxPWS =
000
NCOx Output
PF Mode
NCOxPWS =
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
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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: The accumulator spans registers NCO1ACCU:NCO1ACCH: NCO1ACCL. The 24 bits are reserved but
not all are used.This register updates in real time, asynchronously to the CPU; there is no provision to
guarantee atomic access to this 24-bit space using an 8-bit bus. Writing to this register while the module is
operating will produce undefined results.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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
Register
Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
on Page
VCPINV
optional
VDD RPULLUP
- ZCDxIN RSERIES
External
Zcpinv + RPULLDOWN voltage
source
optional
POL
OUT pin
Interrupt
det
INTP Set
ZCDxIF
INTN flag
Interrupt
det
R SERIES V CPINV
R PULLDOWN = ---------------------------------------------
V DD – V CPINV
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
See
MD1CARH CARH
Register
CHPOL D
11..1 SYNC
Q
MS<n:0> 1
0
00..0
CHSYNC
RxyPPS
See
MOD
MD1SRC
PPS
Register
OPOL
11..1
CL<n:0>
D
SYNC
00..0 Q
1
0
See
MD1CARL CARL
Register CLSYNC
CLPOL
11..1
Modulator (BIT)
CHSYNC = 1
CLSYNC = 0
CHSYNC = 1
CLSYNC = 1
CHSYNC = 0
CLSYNC = 0
CHSYNC = 0
CLSYNC = 1
carrier_high
carrier_low
modulator
MDCHSYNC = 0
MDCLSYNC = 0
Active Carrier
carrier_high carrier_low carrier_high carrier_low
State
carrier_high
carrier_low
modulator
MDCHSYNC = 1
MDCLSYNC = 0
carrier_high
carrier_low
modulator
MDCHSYNC = 0
MDCLSYNC = 1
Active Carrier
State carrier_high carrier_low carrier_high carrier_low
carrier_high
carrier_low
Active Carrier
State carrier_high carrier_low carrier_high CL
30.6 Programmable Modulator Data Upon any device Reset, the DSM module is disabled.
The user’s firmware is responsible for initializing the
The BIT of the MD1CON0 register can be selected as module before enabling the output. The registers are
the source for the modulator signal. This gives the user reset to their default values.
the ability to program the value used for modulation.
30.10 Peripheral Module Disable
30.7 Modulated Output Polarity
The DSM module can be completely disabled using the
The modulated output signal provided on the DSM pin PMD module to achieve maximum power saving. The
can also be inverted. Inverting the modulated output DSMMD bit of PMD6 (Register 19-7) when set disables
signal is enabled by setting the OPOL bit of the the DSM module completely. When enabled again, all
MD1CON0 register. the registers of the DSM module default to POR status.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Note 1: The modulated output frequency can be greater and asynchronous from the clock that updates this
register bit, the bit value may not be valid for higher speed modulator or carrier signals.
2: BIT bit must be selected as the modulation source in the MD1SRC register for this operation.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 30-3: SUMMARY OF REGISTERS ASSOCIATED WITH DATA SIGNAL MODULATOR MODE
Register
Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
on Page
MD1CON0 EN — OUT OPOL — — — BIT 470
MD1CON1 — — CHPOL CHSYNC — — CLPOL CLSYNC 471
MD1CARH — — — CH[4:0] 472
MD1CARL — — — CL[4:0] 472
MD1SRC — — — MS[4:0] 473
Legend: — = unimplemented, read as ‘0’. Shaded cells are not used in the Data Signal Modulator mode.
+ Interrupt
UxTXCHK UxTXB Register UxTXIF
8 RxyPPS
TXEN
MSb LSb TX pin
(8) 0 Mode
• • • Control PPS
Transmit Shift Register (TSR)
TXMTIF TX_out
Address or
Baud Rate Generator FOSC Parity Mode
÷n
n
+1 Multiplier x4 x16
BRGS 1 0
UxBRGH UxBRGL
RXPPS
RX pin MSb RSR Register LSb
Pin Buffer Mode Data
PPS and Control Recovery
Stop (8) 7 ••• 1 0 Start
+1 n
Multiplier x4 x16
BRGS 1 0
UxBRGH UxBRGL FIFO
FERIF PERIF UxRXB Register
8
Data Bus
RXIF Interrupt
RXIE
The operation of the UART module is controlled represents a ‘1’ data bit, and a VOL space state, which
through nineteen registers: represents a ‘0’ data bit. NRZ refers to the fact that
• Three control registers (UxCON0-UxCON2) consecutively transmitted data bits of the same value
• Error enable and status (UxERRIE, UxERRIR, stay at the output level of that bit without returning to a
UxUIR) neutral level between each bit transmission. An NRZ
• UART buffer status and control (UxFIFO) transmission port idles in the Mark state. Each character
• Three 9-bit protocol parameters (UxP1-UxP3) transmission consists of one Start bit followed by seven
• 16-bit baud rate generator (UxBRGH:L) or eight data bits, one optional parity or address bit, and
• Transmit buffer write (UxTXB) is always terminated by one or more Stop bits. The Start
• Receive buffer read (UxRXB) bit is always a space and the Stop bits are always
• Receive checksum (UxRXCHK) marks. The most common data format is eight bits with
• Transmit checksum (UxTXCHK) no parity. Each transmitted bit persists for a period of 1/
(Baud Rate). An on-chip dedicated 16-bit Baud Rate
These registers are detailed in Section 31.21 “Register Generator is used to derive standard baud rate
Definitions: UART Control”. frequencies from the system oscillator. See
Section 31.17 “UART Baud Rate Generator (BRG)”
31.1 UART I/O Pin Configuration for more information.
The RX input pin is selected with the UxRPPS register. In all the asynchronous modes, the UART transmits
The TX output pin is selected with each pin’s RxyPPS and receives the LSb first. The UART’s transmitter and
register. When the TRIS control for the pin corresponding receiver are functionally independent, but share the
to the TX output is cleared, then the UART will maintain same data format and baud rate. Parity is supported by
control and the logic level on the TX pin. Changing the the hardware by even and odd parity modes.
TXPOL bit in UxCON2 will immediately change the TX
pin logic level regardless of the value of EN or TXEN. 31.2.1 UART ASYNCHRONOUS
TRANSMITTER
31.2 UART Asynchronous Modes The UART transmitter block diagram is shown in
Figure 31-1. The heart of the transmitter is the serial
The UART has five asynchronous modes: Transmit Shift Register (TSR), which is not directly
• 7-bit accessible by software. The TSR obtains its data from
• 8-bit the transmit buffer, which is the UxTXB register.
• 8-bit with even parity in the 9th bit
• 8-bit with odd parity in the 9th bit
• 8-bit with address indicator in the 9th bit
The UART transmits and receives data using the
standard Non-Return-to-Zero (NRZ) format. NRZ is
implemented with two levels: a VOH mark state, which
Write to UxTXB
Word 1
BRG Output
(Shift Clock)
TX
pin Start bit bit 0 bit 1 last bit Stop bit
Word 1
UxTXIF bit
(Transmit Buffer 1 TCY
Reg. Empty Flag)
Word 1
TXMTIF bit Transmit Shift Reg.
(Transmit Shift
Reg. Empty Flag)
Write to UxTXB
Word 1 Word 2
BRG Output
(Shift Clock)
TX
pin Start bit bit 0 bit 1 last bit Stop bit Start bit bit 0
UxTXIF bit 1 TCY Word 1 Word 2
(Transmit Buffer
Reg. Empty Flag) 1 TCY
Note: This timing diagram shows the first transmission and the start of the second consecutive transmission.
A framing error will generate a summary UxERR 31.2.2.7 Asynchronous Reception Setup
interrupt when the FERIE bit in the UxERRIE register is
1. Initialize the UxBRGH, UxBRGL register pair
set. The summary error is reset when the FERIF bit of
and the BRGS bit to achieve the desired baud
the top of the FIFO is ‘0’ or when all FIFO characters
rate (see Section 31.17 “UART Baud Rate
have been retrieved.
Generator (BRG)”).
When FERIE is set, UxRXIF interrupts are suppressed 2. Configure the RXPPS register for the desired RX
when FERIF is ‘1’. pin
3. Clear the ANSEL bit for the RX pin (if
31.2.2.5 Receiver Parity Modes
applicable).
Even and odd parity is automatically detected when the 4. Set the MODE[3:0] bits to the desired
MODE[3:0] bits are set to ‘0011’ and ‘0010’, asynchronous mode.
respectively. Parity modes receive eight data bits and
5. Set the RXPOL bit if the data stream is inverted.
one parity bit for a total of nine bits for each character.
The PERIF bit in the UxERRIR register represents the 6. Enable the serial port by setting the ON bit.
parity error of the top unread character of the receive 7. If interrupts are desired, set the UxRXIE bit in
FIFO rather than the parity bit itself. The parity error must the PIEx register and the GIE bits in the
be read before reading the UxRXB register advances INTCON0 register.
the FIFO. 8. Enable reception by setting the RXEN bit.
A parity error will generate a summary UxERR interrupt 9. The UxRXIF interrupt flag bit will be set when a
when the PERIE bit in the UxERRIE register is set.The character is transferred from the RSR to the
summary error is reset when the PERIF bit of the top of receive buffer. An interrupt will be generated if
the FIFO is ‘0’ or when all FIFO characters have been the UxRXIE interrupt enable bit is also set.
retrieved. 10. Read the UxERRIR register to get the error
When PERIE is set, UxRXIF interrupts are suppressed flags.
when PERIF is ‘1’. 11. Read the UxRXB register to get the received
byte.
12. If an overrun occurred, clear the RXFOIF bit.
Read Rcv
Buffer Reg.
UxRXB
UxRXIF
(Interrupt Flag)
RXFOIF bit
Cleared by software
Note: This timing diagram shows three words appearing on the RX input. The UxRXB (receive buffer) is not read before the third word
is received, causing the RXFOIF (FIFO overrun) bit to be set. STPMD = 0, STP[1:0] = 00.
MAB(1)
TX pin Break Start Code byte 1 byte 2 byte n software Break MAB Start Code
UxTXIF bit delay
(Transmit Buffer
Reg. Empty Flag)
TXMTIF bit
(Transmit Shift
Reg. Empty Flag)
TXEN bit
(optional
synchronization)
31.5 LIN Modes (UART1 only) When a Slave receives data, the checksum is
accumulated on each byte as it is received using the
LIN is a protocol used primarily in automotive same algorithm as the sending process. The last byte,
applications. The LIN network consists of two kinds of which is the inverted checksum value calculated by the
software processes: a Master process and a Slave sending process, is added to the locally calculated
process. Each network has only one Master process checksum by the UART. The check passes when the
and one or more Slave processes. result is all ‘1’s, otherwise the check fails and the
From a physical layer point of view, the UART on one CERIF bit is set.
processor may be driven by both a Master and a Slave Two methods for computing the checksum are
process, as long as only one Master process exists on available: legacy and enhanced. The legacy checksum
the network. includes only the data bytes. The enhanced checksum
A LIN transaction consists of a Master process followed includes the PID and the data. The C0EN control bit in
by a Slave process. The Slave process may involve the UxCON2 register determines the checksum
more than one Slave where one is transmitting and the method. Setting C0EN to ‘1’ selects the enhanced
other(s) are receiving. The transaction begins by the method. Software must select the appropriate method
following Master process transmission sequence: before the Start bit of the checksum byte is received.
1. Break
31.5.1 LIN MASTER/SLAVE MODE
2. Delimiter bit
The LIN Master mode includes capabilities to generate
3. Sync Field
Slave processes. The Master process stops at the PID
4. PID byte transmission. Any data that is transmitted in Master/
The PID determines which Slave processes are Slave mode is done as a Slave process. LIN Master/
expected to respond to the Master. When the PID byte Slave mode is configured by the following settings:
is complete, the TX output remains in the Idle state. • MODE[3:0] = 1100
One or more of the Slave processes may respond to • TXEN = 1
the Master process. If no one responds within the inter- • RXEN = 1
byte period, the Master is free to start another • UxBRGH:L = Value to achieve desired baud rate
transmission. The inter-byte period is timed by software • TXPOL = 0 (for high Idle state)
using a means other than the UART. • STP = desired Stop bits selection
The Slave process follows the Master process. When • C0EN = desired checksum mode
the Slave software recognizes the PID then that Slave • RxyPPS = TX pin selection code
process responds by either transmitting the required • TX pin TRIS control = 0
response or by receiving the transmitted data. Only • ON = 1
Slave processes send data. Therefore, Slave
processes receiving data are receiving that of another
Slave process. Note: The TXEN bit must be set before the
Master process is received and remain set
When a Slave sends data, the Slave UART
while in LIN mode whether or not the slave
automatically calculates the checksum for the
process is a transmitter.
transmitted bytes as they are sent and appends the
inverted checksum byte to the slave response.
Any writes to the UxTXB register that occur after The forward frame is received one byte at a time in the
TXMTIF goes true, but before the UxP1 wait time receive FIFO and retrieved by reading the UxRXB
expires, are held and then transmitted immediately register. At the end of the forward frame, when the stop
following the wait time. If a backward frame is received bit is received, the CERIF bit in UxERRIR register is
during the wait time, any bytes that may have been set. This bit needs to be cleared in the software. The
written to UxTXB will be transmitted after completion of end of the forward frame starts a timer to delay the
the backward frame reception plus the UxP1 wait time. backward frame response by wait time equal to the
number of half-bit periods stored in UxP1.
The wait timer is reset by the backward frame and
starts over immediately following the reception of the The data received in the forward frame is processed by
Stop bits of the backward frame. Data pending in the the application software. If the application decides to
transmit shift register will be sent when the wait time send a backward frame in response to the forward
elapses. frame, the value of the backward frame is written to
UxTXB. This value is held for transmission in the
To replace or delete any pending forward frame data, transmit shift register until the wait time expires and is
the TXBE bit needs to be set to flush the shift register then transmitted.
and transmit buffer. A new control byte can then be
written to the UxTXB register. The control byte will be If the backward frame data is written to UxTXB after the
held in the buffer and sent at the beginning of the next wait time has expired, it is held in the UxTXB register
forward frame following the UxP1 wait time. until the end of the wait time following the next forward
frame. The TXMTIF bit is false when the backward
In Control Device mode, PERIF is set when a forward frame data is held in the transmit shift register.
frame is received. This helps the software to determine Receiving a UxRXIF interrupt before the TXMTIF goes
whether the received byte is part of a forward frame true indicates that the backward frame write was too
from a Control Device (either from the Control Device late and another forward frame was received before
under consideration or from another Control Device on sending the backward frame. The pending backward
the bus) or a backward frame from a Control Gear. frame has to be flushed by setting the TXBE bit, to
prevent it from being sent after the next Forward
31.6.2 CONTROL GEAR Frame.
The Control Gear mode is configured with the following
settings:
• MODE = 0b1001
• TXEN = 1
• RXEN = 1
• UxP1 = Back Frames are held for transmission
this number of half-bit periods after the completion
of a Forward Frame.
• UxP2 = Forward/Back Frame threshold delimiter.
Idle periods more than this number of half-bit
periods are detected as Forward Frames.
• UxBRGH:L = Value to achieve 1200 baud rate
• TXPOL = appropriate polarity for interface circuit
• RXPOL = same as TXPOL
• STP = 0b10 for two Stop bits
• CERIE = 1 to enable interrupt when STP bit is
TXMTIF bit
(Transmit Shift
Reg. Empty Flag)
TXMTIF bit
(Transmit Shift
Reg. Empty Flag)
The high baud rate range (BRGS = 1) is intended to 1 High Rate FOSC/[4 (n+1)]
extend the baud rate range up to a faster rate when the
0 Normal Rate FOSC/[16(n+1)]
desired baud rate is not possible otherwise. Using the
normal baud rate range (BRGS = 0) is recommended Legend: n = value of UxBRGH, UxBRGL register pair.
when the desired baud rate is achievable with either
range.
Writing a new value to the UxBRGH, UxBRGL register
pair causes the BRG timer to be reset (or cleared). This
ensures that the BRG does not wait for a timer overflow
before outputting the new baud rate.
If the system clock is changed during an active receive
operation, a receive error or data loss may result. To
avoid this problem, check the status of the RXIDL bit to
make sure that the receive operation is idle before
changing the system clock.
BRG Clock
RXIDL
ABDIF bit
(Interrupt)
Cleared by software
UxBRG XXXXh 001Ch
WUIF
Cleared by software
Note 1: The UART 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 UART remains in idle while the WUE bit is set.
Write to UxTXB
Sync Write
BRG Output
(Shift Clock)
TX (pin) Start bit bit 0 bit 1 bit 11 Sync start
Stop bit
Break
UxTXIF bit
(Transmit
Interrupt Flag)
TXMTIF bit
(Transmit Shift
Empty Flag)
Auto Cleared
SENDB
(send Break
control bit)
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 = Hardware clear
Note 1: Changing the UART MODE while ON = 1 may cause unexpected results.
2: Clearing TXEN or RXEN will not clear the corresponding buffers. Use TXBE or RXBE to clear the buffers.
3: When MODE = 100x, then ABDEN bit is ignored.
4: UART1 only.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared HC = Hardware clear
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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: All modes transmit selected number of Stop bits. Only DMX and DALI receivers verify selected number of
Stop bits and all others verify only the first Stop bit.
2: UART1 only.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared S = Hardware set C = Hardware clear
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 S = Hardware 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 S = Hardware set C = Hardware clear
bit 7 TXWRE: Transmit Write Error Status bit (Must be cleared by software)
LIN Master mode:
1 = UxP1L was written when a master process was active
LIN Slave mode:
1 = UxTXB was written when UxP2 = 0 or more than UxP2 bytes have been written to UxTXB since
last Break
Address Detect mode:
1 = UxP1L was written before the previous data in UxP1L was transferred to TX shifter
All modes:
1 = A new byte was written to UxTXB when the output FIFO was full
0 = No error
bit 6 STPMD: Stop Bit Detection Mode bit
1 = Assert UxRXIF at end of last Stop bit or end of first Stop bit when STP = 11
0 = Assert UxRXIF in middle of first Stop bit
bit 5 TXBE: Transmit Buffer Empty Status bit
1 = Transmit buffer is empty. Setting this bit will clear the transmit buffer and output shift register.
0 = Transmit buffer is not empty. Software cannot clear this bit.
bit 4 TXBF: Transmit Buffer Full Status bit
1 = Transmit buffer is full
0 = Transmit buffer is not full
bit 3 RXIDL: Receive Pin Idle Status bit
1 = Receive pin is in Idle state
0 = UART is receiving Start, Stop, Data, Auto-baud, or Break
bit 2 XON: Software Flow Control Transmit Enable Status bit
1 = Transmitter is enabled
0 = Transmitter is disabled
bit 1 RXBE: Receive Buffer Empty Status bit
1 = Receive buffer is empty. Setting this bit will clear the RX buffer(1)
0 = Receive buffer is not empty. Software cannot clear this bit.
bit 0 RXBF: Receive Buffer Full Status bit
1 = Receive buffer is full
0 = Receive buffer is not full
Note 1: The BSF instruction should not be used to set RXBE because doing so will clear a byte pending in the
transmit shift register when the UxTXB register is empty. Instead, use the MOVWF instruction with a ‘0’ in
the TXBE bit location.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Read Write
8 8
8 8
SDOP
1
RXR TXR
1
SS(in) SPIxSSPPS
0 RxyPPS
SSP SCK(out)
CKP
SSET SPI Control Module
and Transfer Counter
See
SPIxCLK
Register SCK Generator 1
0
1
SPIxBAUD
1
MST
0 RxyPPS
SS(out)
CLKSEL<3:0>
SSP
SCK(in) SPIxSCKPPS
SSET
CKP
Note 1: If TXR=1 and the transmit FIFO is empty, the previous value of the
receive shift register will be sent to the transmit serializer.
Receive FIFO
Transmit FIFO (SPIxRXB)
(SPIxTXB) SDOx SDIx
Receive Shift
Register
LSb MSb LSb MSb
(Note 1) (Note 1)
Receive FIFO
(SPIxRXB) Transmit FIFO
SDIx SDOx (SPIxTXB)
Receive Shift
Register Serial clock
SCKx SCKx
MSb LSb MSb LSb
Slave Select
SSxOUT/ SSxIN
Device 1 GPIO (optional) Device 2
Note 1: In some modes, if the Transmit FIFO is empty, the most recently
received byte of data will be transmitted
2: This diagram assumes that the LSBF bit is cleared (communications are
MSb-first). If LSBF is set, the communications will be LSb-first.
Software Write To
TXR
TXR
Software Write to
RXR
RXR
SCK_out Note 3
SRMTIF
TCZIF Note 2
Software Write
to SPIxTXB
TXFIFO 0 1 2 1 2 1 2 1 0 1 0
Occupancy
SPIxTIF
Software Read
from SPIxRXB
RXFIFO 0 1 0 1 0 1 0 1 0 1 0
Occupancy
SPIxRIF
Software Write
to TXR
TXR
Software Write
to RXR
RXR
SCK_out
BCZIF
Software Write to
TxCNTL
SPIxTXCNT 0 -1 -2 3 2 1 0
Software Write to
TXR
TXR
Software Write
to RXR
RXR
SCK_out
SRMTIF Note 2
TCZIF
Software Write
to SPIxTXB
TXFIFO 0 1 2 1 0
Occupancy
Software Read
from SPIxRXB
RXFIFO 0 1 0 1 0 1 0
Occupancy
SPIxRIF
baud_clock
Software Write to
SPIxTCNTL
Transfer 1 0
Counter
SS_out
SCK_out
SDO_bit_number 7 6 5 4 3 2 1 0
Note: 1. SDO bit number illustrates the transmitted bit number, and is not intended to imply SDO (out) tristate operation.
2. Assumes SPIxTXB holds data when SPIxTCNTL is written.
SCK A I A I A I A I A I A I A I A I
SDO Previous bit 0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 CKP =
SCK A I A I A I A I A I A I A I A I
SDO Previous bit 0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 CKP =
Rev. 10-
000315A
10/13/2016
MSTEN = , CKE = , SMP =
SCK A I A I A I A I A I A I A I A I
SDO bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 next CKP =
tx_buf
input sample clock write
A I A I A I A I A I A I A I A I
SCK
SDO bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 next CKP =
tx_buf
input sample clock write
SCK A I A I A I A I A I A I A I A I
SDO previous bit 0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 CKP =
SCK A I A I A I A I A I A I A I A I
SDO previous bit 0 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 CKP =
SCK I A I A I A I A I A I A I A I A
SDO bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 CKP =
SCK I A I A I A I A I A I A I A I A
SDO bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 CKP =
32.5.6.3 SCK Start-Up Delay SPIxBAUD (indicating lower SCK frequencies), this
delay is much smaller and the first SCK can appear
When starting an SPI data exchange, the master
relatively quickly after SS is set.
device sets the SS output (either through hardware or
software) and then triggers the module to send data. By default, the SPI module inserts a ½ baud delay (half
These data triggers are synchronized to the clock of the period of the clock selected by the SPIxCLK
selected by the SPIxCLK register before the first SCK register) before the first SCK pulse. This allows for
pulse appears, usually requiring one or two clocks of systems with a high SPIxBAUD value to have extra set-
the selected clock. up time before the first clock. Setting the FST bit in
SPIxCON1 removes this additional delay, allowing
The SPI module includes synchronization delays on
systems with low SPIxBAUD values (and thus, long
SCK generation specifically designed to ensure that
synchronization delays) to forego this unnecessary
the Slave Select output timing is correct, without
extra delay.
requiring precision software timing loops.
When the value of the SPIxBAUD register is a small
number (indicating higher SCK frequencies), the
synchronization delay can be relatively long between
setting SS and the first SCK. With larger values of
FIGURE 32-11: SPI SLAVE MODE OPERATION – INTERRUPT-DRIVEN, MASTER WRITES 2+3
BYTES
Rev. 10-
000285A
9/22/2016
SS_in
SCK_in Note 1
SOSIF Note 2
EOSIF
Transfer Counter 0 -1 -2 3 2 1 0
Receiver process
SPIxRIF
Software
Read from
SPIxRXB
Note: 1. This delay is exaggerated for illustration, and can be as short as1/2 bit period.
2. If the device is sleeping, SOSIF will wake it up for interrupt service.
3. Setting SPIxTCNTL is optional in this example, otherwise it will count -3, -4, -5, and TCZIF will not occur
SCK SCK
SPI Master SDOx SDIx SPI Slave
SDIx SDOx #1
SSxOUT/GPIO SSxIN
SCK
SDIx SPI Slave
SDOx #2
SSxIN
SCK
SDIx SPI Slave
SDOx #3
SSxIN
Rev. 10-000082C
10/13/2016
SCK SCK(in)
SPI Master SDOx SDIx SPI Slave
SDIx #1
SSxIN
SSxOUT/GPIO
SCK(out) SDOx
SCK(in) SDIx
SPI Slave
SSxIN #2
SCK(out) SDOx
SCK(in) SDIx
SDOx
Rev. 10-000286A
9/14/2016
SS(in)
SCK
SDO_bit_number 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
SRMTIF
SOSIF
Note 3
TCZIF
EOSIF Note 3
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
HS = Bit can be set by hardware
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
C = Clearable bit
S = Settable bit
HS = Bit can be set by hardware
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
The device has two dedicated, independent I2C modules. Figure 33-1 is a block
diagram of the I2C interface module. The figure shows both the Master and
Slave modes together.
PIC18(L)F26/27/45/46/47/55/56/57K42
Rev. 10-000 312A
11/2/201 6
SDAHT<1:0>
Slave
Module RxyPPS SCL(out)
I2CBTO<2:0>
Interrupt
SCL(in) I2CxSCLPPS Controller
DS40001919E-page 545
I2CLVL<1:0>
PIC18(L)F26/27/45/46/47/55/56/57K42
33.1 I2C Features 33.2 I2C Module Overview
• Inter-Integrated Circuit (I2C) interface supports The I2C module provides a synchronous interface
the following modes in hardware: between the microcontroller and other I2C-compatible
- Master mode devices using the two-wire I2C serial bus. Devices
- Slave mode with byte NACKing communicate in a master/slave environment. The I2C
- Multi-Master mode bus specifies two signal connections:
• Dedicated Address, Receive and Transmit buffers • Serial Clock (SCL)
• Up to four Slave addresses matching • Serial Data (SDA)
• General Call address matching
• 7-bit and 10-bit addressing with masking Both the SCL and SDA connections are bidirectional
• Start, Restart, Stop, Address, Write, and ACK open-drain lines, each requiring pull-up resistors to the
Interrupts supply voltage. Pulling the line to ground is considered
• Clock Stretching hardware for: a logical zero and letting the line float is considered a
- RX Buffer Full logical one. Every transaction on the I2C bus has to be
- TX Buffer Empty initiated by the Master.
- After Address, Write, and ACK Figure 33-2 shows a typical connection between a
• Bus Collision Detection with arbitration master and more than one slave.
• Bus Timeout Detection
• SDA hold time selection
• I2C, SMBus 2.0, and SMBus 3.0 input level
selections
Receive Buffer
SDA
Shift Register SCK Transmit Buffer
I2C Slave 1
Transmit Buffer
SCK
Receive Buffer
I2C Master
SDA
Shift Register
I2C Slave 2
SDA
SCL
S P
Change of Change of
Data Allowed Data Allowed
Start Stop
Condition Condition
SDA
SCL
RS
Change of Change of
Data Allowed Data Allowed
Restart
Condition
SCL
S 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
ADRIF
Cleared by so ftwa re
Matchin g a ddress written to I2CxA DB0
PIC18(L)F26/27/45/46/47/55/56/57K42
Rev. 10-000 293B
1/28/201 9
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
CSTR
CSTR is not held low
SMA
SCIF is set
PCIF is set
R
ACKTIF is set WRIF is set ACKTIF is set WRIF is set ACKTIF is set
R/W c opied from matching address
ADRIF is set NACKIF is set
D
CNTIF is set
RXBF
PIC18(L)F26/27/45/46/47/55/56/57K42
NACK
SDA A7 A6 A5 A4 A3 A2 A1 R/W= 0 ACK D7 D6 D5 D4 D3 D2 D1 D0 ACK D7 D6 D5 D4 D3 D2 D1 D0
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
CSTR
R
ACKTIF is set WRIF is set ACKTIF is set WRIF is set ACKTIF is set
R/W copied from matching address
NACKIF is set
ADRIF is set
D
matching address copied to
I2CxADB0
PIC18(L)F26/27/45/46/47/55/56/57K42
Rev. 10-000 295B
1/28/201 9
Master sends
Master Releases SDA to
stop condition
slave for ACK sequence
S
Receiving Data Received Data P
Receiving Address R/W = 0 NACK
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
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
CSTR
Software clears CSTR, Software clears CSTR
CSTR is set by hardware CSTR is set by hardware SCL is released SCL is released
R
WRIF is set WRIF is set ACKTIF is set
R/W copied from ma tching address
ADRIF is set NACKIF is set
D
matching address written to
Data byte written to I2CxRXB Second data byte to I2CxRXB
I2CxADB0
ACKDT
edge of SCL
I2CxCNT 0x44 0x44 0x43 0x42
RXBF
PIC18(L)F26/27/45/46/47/55/56/57K42
Rev. 10-000 296B
1/28/201 9
Master sends
Master Releases SDA stop condition
Master sends ACK Master sends NACK
Slave sends ACK
S Slave Transmitting Data Slave Transmitting Data
R/W = 1
SDA A7 A6 A5 A4 A3 A2 A1 D7 D6 D5 D4 D3 D2 D1 D0 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
CSTR
ACKSTAT
Master sends
Master Releases SDA stop condition
Master sends ACK Master sends NACK
Slave sends ACK
S
R/W = 1 Slave Transmitting Data Slave Transmitting Data P
SDA A7 A6 A5 A4 A3 A2 A1 D7 D6 D5 D4 D3 D2 D1 D0 D7 D6 D5 D4 D3 D2 D1 D0
PIC18(L)F26/27/45/46/47/55/56/57K42
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
CSTR
R
R/W copied from matching address
ADRIF is set ACKTIF is set ACKTIF is set
ACKSTAT
CNTIF is set
TXBE
Software writes
DS40001919E-page 559
PIC18(L)F26/27/45/46/47/55/56/57K42
High Address copied Low Address copied
to I2CxRXB to I2CxRXB
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
CSTR
PCIF is set
SCIF is set
R
R/W copied from matching address ACKTIF is ACKTIF is
ACKTIF NOT set for
ADRIF is set set set
high address
SMA
RXBF
Master sends
Master sends Master sends stop event
start event restart event Master sends
NACK
R/W = 0 R/W = 1
S Sr ACK = 1STOP
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 D7 D6 D5 D4 D3 D2 D1 D0
PIC18(L)F26/27/45/46/47/55/56/57K42
High Address copied Low Address copied High Address copied Transmit data loaded from
to I2CxADB1[7:0] to I2CxADB0[7:0] to I2CxADB1[7:0] I2CxTXB to TX shift reg
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
CSTR
SMA
R
R/W copied from matching ad dress ACKTIF NOT set
ADRIF is set for high address /w ACKTIF is set ACKTIF is set
ACKTIF is set
D
matching add ress copied to
I2CxADB1/I2CxRXB
TXBE
I2CxTXIF is set
DS40001919E-page 563
TSCL TSCL
2
I C_clk
SDA
SCL
Master device
releases clock Slave releases bus
SCL is shortened but
is 2*TCLK, min
Master drives Master device
SCL low detects clock high twice Master waits to
detect SCL twice
SDA
SCL
Master device
Slave releases
releases clock
bus, a shortened
Master device SCL clock appears
Master drives
detects clock high Master waits to detect
SCL low
SCL no longer held low
S
SDA
1st bit 2nd bit
SCL
I2C_clk 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4
Repeated Start
RSCIF bit set
2
Write to I CCON0<START>
Completion of Restart
Sr
st
1 bit
SDA
SCL
I2C_clk 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2
33.5.7 ACKNOWLEDGE SEQUENCE should set the ACKDT bit before starting an
TIMING Acknowledge sequence. The master then waits one
clock period (TSCL) and the SCL pin is released high.
An Acknowledge sequence is enabled automatically
When the SCL pin is sampled high (clock arbitration),
following an address/data byte transmission. The SCL
the master counts another TSCL. The SCL pin is then
pin is pulled low and the contents of the Acknowledge
pulled low. Figure 33-17 shows the timings for
Data bits (ACKDT/ACKCNT) are presented on the SDA
Acknowledge sequence.
pin. If the user wishes to generate an Acknowledge,
then the ACKDT bit should be cleared. If not, the user
TSCL
SDA D0 ACK
SCL 8 9
xxxIF
Cleared in
WRIF set at software
the end of receive Cleared in
ASTIF set at the end
software
of Acknowledge sequence
33.5.8 STOP CONDITION TIMING transitions high while SCL is high, the PCIF bit of the
I2CxIF register is set. Figure 33-18 shows the timings
A Stop bit is asserted on the SDA pin at the end of
for a Stop condition.
receive/transmit when I2CxCNT = 0. After the last byte
of a receive/transmit sequence, the SCL line is held
low. The master asserts the SDA line low. The SCL pin
is then released high TSCL/2 later and is detected high.
The SDA pin is then released. When the SDA pin
SDA ACK
SCL
I2C_clk 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4
PIC18(L)F26/27/45/46/47/55/56/57K42
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 ACK
MMA
ACKSTAT
CNTIF is set
I2CxCNT = 0
RSEN = 0, mas ter se nds Stop
TXBE
Softwa re writes
Before Start, I2CxTXB
DS40001919E-page 569
RSEN = 0;
Slave Sends ACK Master sends
stop condition
R/W = 1 from I2CxADB1[0] Master sends ACK Master sends NACK
S
PIC18(L)F26/27/45/46/47/55/56/57K42
Slave Transmitting Data Slave Transmitting Data STOP
SDA A7 A6 A5 A4 A3 A2 A1 D7 D6 D5 D4 D3 D2 D1 D0 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
MMA
MDR
PCIF is set
SCIF is set
ACKDT
CNTIF is set
RXBF
DS40001919E-page 571
PIC18(L)F26/27/45/46/47/55/56/57K42
High Address copied Low Address copied
from I2CxADB1[7:1] from I2CxADB0[7:0]
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
MMA
Software sets START to
start transmission Hardware clears MMA
SCIF is set PCIF is set
ACKSTAT
CNTIF is set
I2CxCNT = 0
Master sends Stop
TXBE
DS40001919E-page 573
PIC18(L)F26/27/45/46/47/55/56/57K42
S Sr ACK = 1STOP
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 D7 D6 D5 D4 D3 D2 D1 D0
Low Address c opied High Addres s copied Receive data loaded from
High Addres s copied
from I2CxADB1[7:1] from I2CxADB0[7:0] from I2CxADB1[7:1] RX shift reg to I2CxRXB
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
MMA
MDR
MDR cleared by
setting START
ACKSTAT
RSEN
Software writes
I2CxCN T before CNTIF is set
Software sends no write data
setting START I2CxCNT = 0
Master sends Stop
RXBF
I2CxRXIF is set
PIC18(L)F26/27/45/46/47/55/56/57K42
33.6 I2C Multi-Master Mode In master operation, the SDA line must be monitored
for arbitration to see if the signal level is the expected
In Multi-Master mode, the bus-free (BFRE) bit allows output level. This check is performed by hardware with
the master to determine when the bus is free. Control the result placed in the BCLIF bit. MMA is cleared when
of the I2C bus may be taken when the BFRE bit of the BCLIF is set. The states where arbitration can be lost
I2CxSTAT0 register is set. Interrupt generation on the are:
detection of a slave address match, ADRIE; causes a
clock stretch and allows user software to respond to the • Address Transfer
Master being addressed as a slave device. The slave • Data Transfer (master write)
active (SMA) bit is set for a matching received slave • Repeated Start Condition
address. • Acknowledge Condition
Clock arbitration occurs when the master, during any 33.6.1 MULTI-MASTER MODE BUS
receive, transmit or Restart/Stop condition, releases COLLISION
the SCL pin (SCL allowed to float high). When the SCL
pin is allowed to float high, the SCL line is monitored to Multi-Master mode support is achieved by bus
see if the pin is actually sampled high. arbitration. When the master outputs address/data bits
onto the SDA pin, arbitration takes place when the
master outputs a ‘1’ on SDA, by letting SDA float high
Note: In this mode, the slave hardware has and another master asserts a ‘0’. When the SCL pin
priority over the master hardware. Master floats high, data is stable. If the expected data on SDA
mode communication can only be initiated is a ‘1’ and the data sampled on the SDA pin is ‘0’, then
when the SMA = 0. a bus collision has taken place. The master will set the
Bus Collision Interrupt Flag, BCLIF and reset the I2C
bus to its Idle state. Refer to Figure 33-23 for a detailed
timing diagram.
SDA
BCLIF
Other Master
Add ress copied Another Mas ter clocks ACK sends stop
from I2CxA DB1 and begin sending data condition
PIC18(L)F26/27/45/46/47/55/56/57K42
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
CSTR
MMA
ACKDT
RXBF
I2CxRXIF is se t I2CxRXIF is se t
Softwa re r eads d ata from I2CxRXB Softwa re r eads I2CxRXB
DS40001919E-page 578
PIC18(L)F26/27/45/46/47/55/56/57K42
33.7 Register Definitions: I2C Control
This section defines all the registers associated with
the control and status of the I2C bus.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 = Hardware set HC = Hardware clear
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 = Hardware set HC = Hardware clear
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 = Hardware set HC = Hardware clear
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 = Hardware set HC = Hardware clear
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 = Hardware set HC = Hardware clear
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 = Hardware set HC = Hardware clear
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 = Hardware set HC = Hardware clear
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 = Hardware set HC = Hardware clear
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 = Hardware set HC = Hardware clear
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 = Hardware set HC = Hardware clear
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 = Hardware set HC = Hardware clear
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 = Hardware set HC = Hardware clear
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 = Hardware set HC = Hardware clear
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 = Hardware set HC = Hardware clear
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 = Hardware set HC = Hardware clear
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 = Hardware set HC = Hardware clear
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 = Hardware set HC = Hardware clear
Rev. 10-000053E
1/27/2017
2
ADFVR<1:0>
1x
FVR Buffer 1
2x
4x (To ADC Module)
2
CDAFVR<1:0>
1x FVR Buffer 2
2x (To ADC, Comparator
4x and DAC Modules)
EN
+
_ RDY
Any peripheral
requiring Fixed
Reference
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared q = Value depends on condition
FVR_buffer1 11 Positive
VREF+ pin Reference
10 Select
Reserved 01
00
NREF
VDD
VREF- pin 1
0
VSS CS
AN0
ANa Vref- Vref+
External .
Channel . FOSC /n Fosc
. Divider FOSC
Inputs ADC_clk ADC
ANz sampled Clock
VSS input Select ADCRC
ADCRC
Temp Indicator
Internal
Channel DACx_output ADC CLOCK SOURCE
Inputs
FVR_buffer ADC
Sample Circuit
PCH<5:0>
FM
set bit ADIF
12
complete 12-bit Result
Write to bit
GO/DONE
GO/DONE 16
start
ADRESH ADRESL
Enable
Trigger Select
ACT<4:0> ON
. . . VSS
Trigger Sources
AUTO CONVERSION
TRIGGER
There are several channel selections available: For correct conversion, the appropriate TAD specification
must be met. Refer to Table 44-15 for more information.
• Eight PORTA pins (RA[7:0]) Table 36-1 gives examples of appropriate ADC clock
• Eight PORTB pins (RB[7:0]) selections.
• Eight PORTC pins (RC[7:0])
Note 1: Unless using the ADCRC, any changes
• Eight PORTD pins (RD[7:0], PIC18(L)F45/46/47/ in the system clock frequency will change
55/56/57K42 only) the ADC clock frequency, which may
• Three PORTE pins (RE[2:0], PIC18(L)F45/46/47/ adversely affect the ADC result.
55/56/57K42 only)
2: The internal control logic of the ADC runs
• Eight PORTF pins (RD[7:0], PIC18(L)F55/56/ off of the clock selected by the CS bit of
57K42 only) ADCON0. What this can mean is when
• Temperature Indicator the CS bit of ADCON0 is set to ‘1’ (ADC
• DAC output runs on ADCRC), there may be
• Fixed Voltage Reference (FVR) unexpected delays in operation when
setting ADC control bits.
• VSS (ground)
The ADPCH register determines which channel is
connected to the sample and hold circuit.
When changing channels, a delay is required before
starting the next conversion.
Refer to Section 36.2 “ADC Operation” for more
information.
FOSC/2 000000 31.25 ns(2) 62.5 ns(2) 100 ns(2) 125 ns(2) 250 ns(2) 500 ns(2) 2.0 s
FOSC/4 000001 62.5 ns(2) 125 ns(2) 200 ns(2) 250 ns(2) 500 ns(2) 1.0 s 4.0 s
FOSC/6 000010 93.75 ns(2) 187.5 ns(2) 300 ns(2) 375 ns(2) 750 ns(2) 1.5 s 6.0 s
FOSC/8 000011 125 ns(2) 250 ns(2) 400 ns(2) 500 ns(2) 1.0 s 2.0 s 8.0 s
... ... ... ... ... ... ... ... ...
FOSC/16 000111 250 ns(2) 500 ns(2) 800 ns(2) 1.0 s 2.0 s 4.0 s 16.0 s(2)
... ... ... ... ... ... ... ... ...
FOSC/128 111111 2.0 s 4.0 s 6.4 s 8.0 s 16.0 s(2) 32.0 s(2) 128.0 s(2)
ADCRC ADCON0.CS = 1 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 1.0-6.0 s 1.0-6.0 s
Legend: Shaded cells are outside of recommended range.
Note 1: See TAD parameter for ADCRC source typical TAD value.
2: These values violate the required TAD time.
3: The ADC clock period (TAD) and total ADC conversion time can be minimized when the ADC clock is derived from the system
clock FOSC. However, the ADCRC oscillator source must be used when conversions are to be performed with the device in
Sleep mode.
Set GO bit
ADRESH ADRESL
(FM = 0) MSB
bit 7 bit 0 bit 7 LSB bit 0
//Setup ADC
ADCON0bits.FM = 1; //right justify
ADCON0bits.CS = 1; //ADCRC Clock
ADPCH = 0x00; //RA0 is Analog channel
TRISAbits.TRISA0 = 1; //Set RA0 to input
ANSELAbits.ANSELA0 = 1; //Set RA0 to analog
ADCON0bits.ON = 1; //Turn ADC On
while (1) {
ADCON0bits.GO = 1; //Start conversion
while (ADCON0bits.GO); //Wait for conversion done
resultHigh = ADRESH; //Read result
resultLow = ADRESL; //Read result
}
}
T ACQ = Amplifier Settling Time + Hold Capacitor Charging Time + Temperature Coefficient
= T AMP + T C + T COFF
= 2µs + T C + Temperature - 25°C 0.05µs/°C
1
V APPLIED 1 – -------------------------- = V CHOLD ;[1] VCHOLD charged to within 1/2 lsb
n+1
2 –1
–T C
----------
RC
V APPLIED 1 – e = V CHOLD ;[2] VCHOLD charge response to VAPPLIED
– Tc
---------
1
V APPLIED 1 – e = V APPLIED 1 – -------------------------- ;combining [1] and [2]
RC
n+1
2 –1
Note: Where n = number of bits of the ADC.
T C = – C HOLD R IC + R SS + R S ln(1/8191)
= – 28pF 1k + 7k + 1k ln(0.0001221)
= 2.27 µs
Therefore:
T ACQ = 2µs + 2.27 µs + 50°C- 25°C 0.05 µs/°C
= 5.52µs
Note 1: The reference voltage (VREF) has no effect on the equation, since it cancels itself out.
2: The charge holding capacitor (CHOLD) is not discharged after each conversion.
3: The maximum recommended impedance for analog sources is mentioned in Parameter AD08 in Table 44-
14. This is required to meet the pin leakage specification.
Sampling
VDD Rev. 10-000070C
4/16/2019
Switch
Analog
VT ≈ 0.6V SS
RS Input pin RIC ≤ 1KΩ RSS
VSS Ref-
Full-Scale Range
FFFh
FFEh
FFDh
FFCh
ADC Output Code
FFBh
03h
02h
01h
00h
Analog Input Voltage
0.5 LSB 1.5 LSB
REF- Zero-Scale
Transition Full-Scale
Transition REF+
TMD
ADRES
CRS
ADFLTR
Set
Error ADERR Threshold
Interrupt
Average/ Calculation Logic
1 Flag
Filter ADPREV
0
ADSTPT
ADUTH ADLTH
PSIS
The operation of the ADC computational features is • Low-Pass Filter (LPF): With each trigger, the ADC
controlled by MD[2:0] bits in the ADCON2 register. conversion result is sent through a filter. When RPT
The module can be operated in one of five modes: samples have occurred, a threshold test is performed.
Every trigger after that the ADC conversion result is
• Basic: In this mode, ADC conversion occurs on single sent through the filter and another threshold test is
(DSEN = 0) or double (DSEN = 1) samples. ADIF is performed.
set after all the conversion are complete.
The five modes are summarized in Table 36-2 below.
• Accumulate: With each trigger, the ADC conversion
result is added to accumulator and CNT increments.
ADIF is set after each conversion. ADTIF is set
according to the calculation mode.
• Average: With each trigger, the ADC conversion
result is added to the accumulator. When the RPT
number of samples have been accumulated, a
threshold test is performed. Upon the next trigger, the
accumulator is cleared. For the subsequent tests,
additional RPT samples are required to be
accumulated.
• Burst Average: At the trigger, the accumulator is
cleared. The ADC conversion results are then collected
repetitively until RPT samples are accumulated and
finally the threshold is tested.
Mode MD ACC and CNT ACC CNT Retrigger Threshold Test Interrupt ADAOV FLTR CNT
Basic 0 ACLR = 1 Unchanged Unchanged No Every Sample If threshold=true N/A N/A count
Accumulate 1 ACLR = 1 S + ACC If (CNT=0xFF): CNT, No Every Sample If threshold=true ACC Overflow ACC/2CRS count
or otherwise: CNT+1
PIC18(L)F26/27/45/46/47/55/56/57K42
(S2-S1) + ACC
Average 2 ACLR = 1 or CNT>=RPT at S + ACC If (CNT=0xFF): CNT, No If CNT>=RPT If threshold=true ACC Overflow ACC/2CRS count
GO or retrigger or otherwise: CNT+1
(S2-S1) + ACC
Burst 3 ACLR = 1 or GO set or Each repetition: same as Each repetition: same as Repeat If CNT>=RPT If threshold=true ACC Overflow ACC/2CRS RPT
Average retrigger Average Average while
End with sum of all End with CNT=RPT CNT<RPT
samples
Low-pass 4 ACLR = 1 S+ACC-ACC/ Count up, stop counting No If CNT>=RPT If threshold=true ACC Overflow ACC/2CRS count
Filter 2CRS when CNT = 0xFF (Filtered Value)
or
(S2-S1)+ACC-ACC/2CRS
Note: S1 and S2 are abbreviations for Sample 1 and Sample 2, respectively. When DSEN = 0, S1 = ADRES; When DSEN = 1, S1 = PREV and S2 = ADRES.
DS40001919E-page 612
PIC18(L)F26/27/45/46/47/55/56/57K42
36.5.1 DIGITAL FILTER/AVERAGE the ADSTAT register, as well as the ADCNT register.
The ACLR bit is cleared by the hardware when
The digital filter/average module consists of an
accumulator clearing action is complete.
accumulator with data feedback options, and control
logic to determine when threshold tests need to be
applied. The ADACC register is a 24-bit wide register Note: When ADC is operating from ADCRC, five
which can be accessed through the ADCRC clock cycles are required to
ADACCU:ADACCH:ADACCL register pair. It contains execute the ACC clearing operation.
18-bit accumulator value ACC [17:0] and one extended The CRS [2:0] bits in the ADCON2 register control the
sign bit. data shift on the accumulator result, which effectively
Upon each trigger event (the GO bit set or external divides the value in accumulator
event trigger), the ADC conversion result is added to (ADACCU:ADACCH:ADACCL) register pair. The right-
the accumulator. If the accumulated result exceeds shifted value is stored in the signed
2(accumulator_width)-1 = 262143, the overflow bit ADAOV ADFLTRH:ADFLTRL register pair. When the value in
in the ADSTAT register is set. the ADFLTR register overflows, the overflow bit
ADAOV in the ADSTAT register is set. For the
The number of samples to be accumulated is
Accumulate mode of the digital filter, the shift provides
determined by the RPT (A/D Repeat Setting) register.
a simple scaling operation. For the Average/Burst
Each time a sample is added to the accumulator, the
Average mode, the shift bits are used to determine the
ADCNT register is incremented. Once RPT samples
number of logical right shifts to be performed on the
are accumulated (CNT = RPT), an accumulator clear
accumulated result. For the Low-pass Filter mode, the
command can be issued by the software by setting the
shift is an integral part of the filter, and determines the
ACLR bit in the ADCON2 register. Setting the ACLR bit
cut-off frequency of the filter. Table 36-3 shows the -3
will also clear the ADAOV (Accumulator overflow) bit in
dB cut-off frequency in ωT (radians) and the highest
signal attenuation obtained by this filter at nyquist
frequency (ωT = π).
Rev. 10-000322C
4/16/2019
VDD VDD
ADCAP
Additional
Sample
Capacitors
This is an example to configure ADC for CVD 4. Start double sample conversion by setting the
operation: GO bit.
1. Configure Port: 5. Wait for ADC conversion to complete by one
1.1 Disable pin output driver (Refer to the of the following:
TRISx register) • Polling the GO bit
1.2 Configure pin as analog (Refer to the • Waiting for the ADC interrupt (if interrupt is
ANSELx register) enabled)
2. Configure the ADC module: 6. Second ADC conversion depends on the
2.1. Select ADC conversion clock state of CONT:
2.2. Configure voltage reference 6.1. If CONT = 1, both conversion will repeat
2.3. Select ADC input channel automatically form a single trigger
2.4. Configure precharge (ADPRE) and 6.2. If CONT = 0, each conversion must be
acquisition (ADACQ) time period triggered separately
2.5. Select precharge polarity (PPOL bit) 7. ADERR register contains the CVD result
2.6. Enable Double Sampling (DSEN bit) 8. Clear the ADC interrupt flag (if interrupt is
2.7. Turn on ADC module enabled).
3. Configure ADC interrupt (optional): Note 1: With global interrupts disabled (GIE = 0),
3.1. Clear ADC interrupt flag the device will wake from Sleep but will
3.2. Enable ADC interrupt not enter an Interrupt Service Routine.
3.3. Enable global interrupt (GIE bit)(1)
VDD
Note 1 Note 1
Voltage
VSS
Note 1: External Capacitive Sensor voltage during the conversion phase may vary as per the configuration of the
corresponding pin.
Rev. 10-000336B
Precharge Acquire Convert Precharge Acquire Convert 4/17/2019
VDD
Note 1 Note 1
Voltage
VSS
Time
ADGRDA
ADGRDB
Note 1: External Capacitive Sensor voltage during the conversion phase may vary as per the configuration of the
corresponding 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 HC = Bit is cleared by hardware
HS = Bit is set by 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
Otherwise:
The bit is ignored
bit 6 IPEN: A/D Inverted Precharge Enable bit
If DSEN = 1
1 = The precharge and guard signals in the second conversion cycle are the opposite polarity of the
first cycle
0 = Both Conversion cycles use the precharge and guards specified by PPOL and GPOL
Otherwise:
The bit is ignored
bit 5 GPOL: Guard Ring Polarity Selection bit
1 = ADC guard Ring outputs start as digital high during Precharge stage
0 = ADC guard Ring outputs start as digital low during Precharge stage
bit 4-1 Unimplemented: Read as ‘0’
bit 0 DSEN: Double-sample enable bit
1 = Two conversions are performed on each trigger. Data from the first conversion appears in PREV
0 = One conversion is performed for each trigger
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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’
u = Bit is unchanged 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: When PSIS = 0, the value of (RES-PREV) is the value of (S2-S1) from Table 36-2.
2: When PSIS = 0
3: When PSIS = 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 HS/HC = Bit is set/cleared by 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
Note: ADC clock divider is only available if FOSC is selected as the ADC clock source (ADCON0.CS = 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
REGISTER 36-9: ADPREL: ADC PRECHARGE TIME CONTROL REGISTER (LOW BYTE)
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
PRE[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
REGISTER 36-10: ADPREH: ADC PRECHARGE TIME CONTROL REGISTER (HIGH BYTE)
U-0 U-0 U-0 R/W-0/0 R/W-0/0 R/W-0/0 R/W-0/0 R/W-0/0
— — — PRE[12: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
REGISTER 36-11: ADACQL: ADC ACQUISITION TIME CONTROL REGISTER (LOW BYTE)
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
ACQ[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
REGISTER 36-12: ADACQH: ADC ACQUISITION TIME CONTROL REGISTER (HIGH BYTE)
U-0 U-0 U-0 R/W-0/0 R/W-0/0 R/W-0/0 R/W-0/0 R/W-0/0
— — — ACQ[12: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
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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-0 FLTR[15:8]: ADC Filter Output Most Significant bits — Signed 2’s Complement
In Accumulate, Average, and Burst Average mode, this is equal to ACC right shifted by the CRS bits
of ADCON2. In LPF mode, this is the output of the Low-pass Filter.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 FLTR[7:0]: ADC Filter Output Least Significant bits — Signed 2’s Complement
In Accumulate, Average, and Burst Average mode, this is equal to ACC right shifted by the CRS bits
of ADCON2. In LPF mode, this is the output of the Low-pass Filter.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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-4 RES[3:0]: ADC Result Register bits. Lower four bits of 12-bit conversion result.
bit 3-0 Reserved
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 RES[7:0]: ADC Result Register bits. Lower eight bits of 12-bit conversion result.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Note 1: If PSIS = 0, ADPREVH and ADPREVL are formatted the same way as ADRES is, depending on the FM
bit.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Note 1: If PSIS = 0, ADPREVH and ADPREVL are formatted the same way as ADRES is, depending on the FM
bit.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 ACC[15:8]: ADC Accumulator middle bits — Signed 2’s Complement. Middle eight bits of accumulator
value. See Table 36-2 for more details.
Note 1: The ADACC register is a 24-bit wide register which contains the 18-bit accumulator value and six copies
of the sign bit.
2: This register can only be written when GO=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 ACC[7:0]: ADC Accumulator LSB — Signed 2’s Complement. Lower eight bits of accumulator value.
See Table 36-2 for more details.
Note 1: The ADACC register is a 24-bit wide register which contains the 18-bit accumulator value and six copies
of the sign bit.
2: This register can only be written when GO=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 STPT[15:8]: ADC Threshold Setpoint MSB — Signed 2’s Complement. Upper byte of ADC threshold
setpoint, depending on CALC, may be used to determine ERR, see Register 36-29 for more 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
bit 7-0 STPT[7:0]: ADC Threshold Setpoint LSB — Signed 2’s Complement. Lower byte of ADC threshold
setpoint, depending on CALC, may be used to determine ERR, see Register 36-30 for more 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
bit 7-0 ERR[15:8]: ADC Setpoint Error MSB — Signed 2’s Complement. Upper byte of ADC Setpoint Error.
Setpoint Error calculation is determined by CALC bits of ADCON3, see Register 36-4 for more 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
bit 7-0 ERR[7:0]: ADC Setpoint Error LSB — Signed 2’s Complement. Lower byte of ADC Setpoint Error cal-
culation is determined by CALC bits of ADCON3, see Register 36-4 for more 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
bit 7-0 LTH[15:8]: ADC Lower Threshold MSB — Signed 2’s Complement. LTH and UTH are compared with
ERR to set the UTHR and LTHR bits of ADSTAT. Depending on the setting of TMD, an interrupt may
be triggered by the results of this comparison.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 LTH[7:0]: ADC Lower Threshold LSB — Signed 2’s Complement. LTH and UTH are compared with
ERR to set the UTHR and LTHR bits of ADSTAT. Depending on the setting of TMD, an interrupt may
be triggered by the results of this comparison.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 UTH[15:8]: ADC Upper Threshold MSB — Signed 2’s Complement. LTH and UTH are compared with
ERR to set the UTHR and LTHR bits of ADSTAT. Depending on the setting of TMD, an interrupt may
be triggered by the results of this comparison.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 UTH[7:0]: ADC Upper Threshold LSB — Signed 2’s Complement. LTH and UTH are compared with
ERR to set the UTHR and LTHR bits of ADSTAT. Depending on the setting of TMD, an interrupt may
be triggered by the results of this comparison.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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= Hardware set
Reserved 11
VSOURCE+ DATA<4:0>
FVR Buffer 10 5
VREF+ 01 R
AVDD 00
R
PSS
R
32-to-1 MUX
32 DACx_output
To Peripherals
Steps
EN
R DACxOUT1(1)
OE1
R
DACxOUT2(1)
NSS
Note: See the DAC1CON0 register for the available VSOURCE+ and VSOURCE- selections.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Output
Rev. 10-000027N
10/12/2016
3 (1)
NCH<2:0> EN
Interrupt INTP
Rising
Edge set bit
CxIN0- 000 CxIF
Interrupt INTN
CxIN1- 001
Falling
CxIN2- 010 EN(1) Edge
111
SP HYS POL
CxOUT_sync To Other
Peripherals
SYNC
CxIN0+ 000
TRIS bit
CxIN1+ 001 0
PCH<2:0> EN(1)
3
Note 1: When CxON = 0, all multiplexer inputs are disconnected and the Comparator will produce a ‘0’ at the output.
VDD
Analog
VT ≈ 0.6V
RS Input pin RIC
To Comparator
(1)
ILEA KAGE
VA CPIN VT ≈ 0.6V
5pF
VSS
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
VDD
4 SEL<3:0>
Rev. 10-000256B
10/13/2016
EN
16-to-1 MUX
OUT
- Trigger/
Interrupt HLVDIF
+ Generation
RDY INTH INTL
Bandgap
Reference
EN Volatge
VDD
VHLVD
HLVDIF
Enable HLVD
TFVRST
RDY
HLVDIF Cleared in Software
Band Gap Reference Voltage is Stable
CASE 2:
VDD
VHLVD
HLVDIF
Enable HLVD
TFVRST
RDY
Band Gap Reference Voltage is Stable
HLVDIF Cleared in Software
VHLVD
VDD
HLVDIF
Enable HLVD
RDY TIRVST
CASE 2:
VHLVD
VDD
HLVDIF
Enable HLVD
RDY TIRVST
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared u = Bit is unchanged
Pin 1 Indicator
Pin Description*
1 1 = VPP/MCLR
2
2 = VDD Target
3
4 3 = VSS (ground)
5
6 4 = ICSPDAT
5 = ICSPCLK
6 = No Connect
External
Programming VDD Device to be
Signals Programmed
VDD VDD
VPP MCLR/VPP
VSS VSS
Data ICSPDAT
Clock ICSPCLK
* * *
To Normal Connections
1. The file register (specified by ‘f’) One instruction cycle consists of four oscillator periods.
Thus, for an oscillator frequency of 4 MHz, the normal
2. The destination of the result (specified by ‘d’)
instruction execution time is 1 s. If a conditional test is
3. The accessed memory (specified by ‘a’)
true, or the program counter is changed as a result of
The file register designator ‘f’ specifies which file an instruction, the instruction execution time is 2 s.
register is to be used by the instruction. The destination Two-word branch instructions (if true) would take 3 s.
designator ‘d’ specifies where the result of the
Figure 41-1 shows the general formats that the
operation is to be placed. If ‘d’ is zero, the result is
instructions can have. All examples use the convention
placed in the WREG register. If ‘d’ is one, the result is
‘nnh’ to represent a hexadecimal number.
placed in the file register specified in the instruction.
The Instruction Set Summary, shown in Table 41-3,
All bit-oriented instructions have three operands:
lists the standard instructions recognized by the
1. The file register (specified by ‘f’) Microchip Assembler (MPASMTM).
2. The bit in the file register (specified by ‘b’) Section 41.1.1 “Standard Instruction Set” provides
3. The accessed memory (specified by ‘a’) a description of each instruction.
The bit field designator ‘b’ selects the number of the bit
affected by the operation, while the file register
designator ‘f’ represents the number of the file in which
the bit is located.
15 10 9 8 7 0
OPCODE d a f (FILE #) ADDWF MYREG, W, B
15 12 11 0
OPCODE f (Source FILE #) MOVFF MYREG1, MYREG2
15 12 11 0
1111 f (Destination FILE #)
15 4 3 0
OPCODE FILE # MOVFFL MYREG1, MYREG2
15 12 11 0
1111 FILE #
15 12 11 0
1111 FILE #
15 12 11 9 8 7 0
OPCODE b (BIT #) a f (FILE #) BSF MYREG, bit, B
Literal operations
15 8 7 0
OPCODE k (literal) MOVLW 7Fh
15 12 11 0
1111 n[19:8] (literal)
15 8 7 0
OPCODE S n[7:0] (literal) CALL MYFUNC
15 12 11 0
1111 n[19:8] (literal)
S = Fast bit
15 11 10 0
15 8 7 0
OPCODE n[7:0] (literal) BC MYFUNC
CONTROL INSTRUCTIONS
BC n Branch if Carry 1 (2) 1110 0010 nnnn nnnn None 1
BN n Branch if Negative 1 (2) 1110 0110 nnnn nnnn None 1
BNC n Branch if Not Carry 1 (2) 1110 0011 nnnn nnnn None 1
BNN n Branch if Not Negative 1 (2) 1110 0111 nnnn nnnn None 1
BNOV n Branch if Not Overflow 1 (2) 1110 0101 nnnn nnnn None 1
BNZ n Branch if Not Zero 1 (2) 1110 0001 nnnn nnnn None 1
BOV n Branch if Overflow 1 (2) 1110 0100 nnnn nnnn None 1
BRA n Branch Unconditionally 2 1101 0nnn nnnn nnnn None
BZ n Branch if Zero 1 (2) 1110 0000 nnnn nnnn None 1
CALL k, s Call subroutine 1st word 2 1110 110s kkkk kkkk None 2
2nd word 1111 kkkk kkkk kkkk
CALLW — Call subroutine using WREG 2 0000 0000 0001 0100 None 1
GOTO k Go to address 1st word 2 1110 1111 kkkk kkkk None 2
— 2nd word 1111 kkkk kkkk kkkk
RCALL n Relative Call 2 1101 1nnn nnnn nnnn None 1
RETFIE s Return from interrupt enable 2 0000 0000 0001 000s None 1
RETLW k Return with literal in WREG 2 0000 1100 kkkk kkkk None 1
RETURN s Return from Subroutine 2 0000 0000 0001 001s None 1
INHERENT INSTRUCTIONS
CLRWDT — Clear Watchdog Timer 1 0000 0000 0000 0100 None
DAW — Decimal Adjust WREG 1 0000 0000 0000 0111 C
NOP — No Operation 1 0000 0000 0000 0000 None
NOP — No Operation 1 1111 xxxx xxxx xxxx None 2
POP — Pop top of return stack (TOS) 1 0000 0000 0000 0110 None
PUSH — Push top of return stack (TOS) 1 0000 0000 0000 0101 None
RESET Software device Reset 1 0000 0000 1111 1111 All
SLEEP — Go into Standby mode 1 0000 0000 0000 0011 None
Note 1: If Program Counter (PC) is modified or a conditional test is true, the instruction requires an additional cycle. The extra cycle is
executed as a NOP.
2: Some instructions are multi word instructions. The second/third words of these instructions will be decoded as a NOP, unless the
first word of the instruction retrieves the information embedded in these 16-bits. This ensures that all program memory locations
have a valid instruction.
3: fs and fd do not cover the full memory range. 2 MSBs of bank selection are forced to ‘b00 to limit the range of these instructions to
lower 4k addressing space.
LITERAL INSTRUCTIONS
ADDLW k Add literal and WREG 1 0000 1111 kkkk kkkk C, DC, Z, OV, N
ANDLW k AND literal with WREG 1 0000 1011 kkkk kkkk Z, N
IORLW k Inclusive OR literal with WREG 1 0000 1001 kkkk kkkk Z, N
LFSR f n, k Load FSR(fn) with a 14-bit 2 1110 1110 00ff kkkk None
literal (k) 1111 00kk kkkk kkkk
ADDFSR f n, k Add FSR(fn) with (k) 1 1110 1000 ffkk kkkk None
SUBFSR f n, k Subtract (k) from FSR(fn) 1 1110 1001 ffkk kkkk None
MOVLB k Move literal to BSR[5:0] 1 0000 0001 00kk kkkk None
MOVLW k Move literal to WREG 1 0000 1110 kkkk kkkk None
MULLW k Multiply literal with WREG 1 0000 1101 kkkk kkkk None
RETLW k Return with literal in WREG 2 0000 1100 kkkk kkkk None
SUBLW k Subtract WREG from literal 1 0000 1000 kkkk kkkk C, DC, Z, OV, N
XORLW k Exclusive OR literal with WREG 1 0000 1010 kkkk kkkk Z, N
DATA MEMORY PROGRAM MEMORY INSTRUCTIONS
TBLRD* Table Read 2-5 0000 0000 0000 1000 None
TBLRD*+ Table Read with post-increment 0000 0000 0000 1001 None
TBLRD*- Table Read with post-decrement 0000 0000 0000 1010 None
TBLRD+* Table Read with pre-increment 0000 0000 0000 1011 None
TBLWT* Table Write 2-5 0000 0000 0000 1100 None
TBLWT*+ Table Write with post-increment 0000 0000 0000 1101 None
TBLWT*- Table Write with post-decrement 0000 0000 0000 1110 None
TBLWT+* Table Write with pre-increment 0000 0000 0000 1111 None
Note 1: If Program Counter (PC) is modified or a conditional test is true, the instruction requires an additional cycle. The extra cycle is
executed as a NOP.
2: Some instructions are multi word instructions. The second/third words of these instructions will be decoded as a NOP, unless the
first word of the instruction retrieves the information embedded in these 16-bits. This ensures that all program memory locations
have a valid instruction.
3: fs and fd do not cover the full memory range. 2 MSBs of bank selection are forced to ‘b00 to limit the range of these instructions to
lower 4k addressing space.
Note: All PIC18 instructions may take an optional label argument preceding the instruction mnemonic for use in
symbolic addressing. If a label is used, the instruction format then becomes: {label} instruction argument(s).
BTFSC Bit Test File, Skip if Clear BTFSS Bit Test File, Skip if Set
Syntax: BTFSC f, b {,a} Syntax: BTFSS f, b {,a}
Operands: 0 f 255 Operands: 0 f 255
0b7 0b<7
a [0,1] a [0,1]
Operation: skip if (f<b>) = 0 Operation: skip if (f<b>) = 1
Status Affected: None Status Affected: None
Encoding: 1011 bbba ffff ffff Encoding: 1010 bbba ffff ffff
Description: If bit ‘b’ in register ‘f’ is ‘0’, then the next Description: If bit ‘b’ in register ‘f’ is ‘1’, then the next
instruction is skipped. If bit ‘b’ is ‘0’, then instruction is skipped. If bit ‘b’ is ‘1’, then
the next instruction fetched during the the next instruction fetched during the
current instruction execution is discarded current instruction execution is discarded
and a NOP is executed instead, making and a NOP is executed instead, making
this a 2-cycle instruction. this a 2-cycle instruction.
If ‘a’ is ‘0’, the Access Bank is selected. If If ‘a’ is ‘0’, the Access Bank is selected. If
‘a’ is ‘1’, the BSR is used to select the ‘a’ is ‘1’, the BSR is used to select the
GPR bank. GPR bank.
If ‘a’ is ‘0’ and the extended instruction If ‘a’ is ‘0’ and the extended instruction
set is enabled, this instruction operates in set is enabled, this instruction operates
Indexed Literal Offset Addressing in Indexed Literal Offset Addressing
mode whenever f 95 (5Fh). mode whenever f 95 (5Fh).
See Section 41.2.3 “Byte-Oriented and See Section 41.2.3 “Byte-Oriented and
Bit-Oriented Instructions in Indexed Bit-Oriented Instructions in Indexed
Literal Offset Mode” for details. Literal Offset Mode” for details.
Words: 1 Words: 1
Cycles: 1(2) Cycles: 1(2)
Note: 3 cycles if skip and followed Note: 3 cycles if skip and followed
by a 2-word instruction. 4 cycles if by a 2-word instruction. 4 cycles if
skip and followed by a 3-word skip and followed by a 3-word
instruction. instruction.
Q Cycle Activity: Q Cycle Activity:
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
Decode Read Process No Decode Read Process No
register ‘f’ Data operation register ‘f’ Data operation
If skip: If skip:
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
No No No No No No No No
operation operation operation operation operation operation operation operation
If skip and followed by 2-word instruction: If skip and followed by 2-word instruction:
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
No No No No No No No No
operation operation operation operation operation operation operation operation
No No No No No No No No
operation operation operation operation operation operation operation operation
CLRF Clear f
CALLW Subroutine Call Using WREG
Syntax: CLRF f {,a}
Syntax: CALLW
Operands: 0 f 255
Operands: None a [0,1]
Operation: (PC + 2) TOS, Operation: 000h f
(W) PCL, 1Z
(PCLATH) PCH,
Status Affected: Z
(PCLATU) PCU
Encoding: 0110 101a ffff ffff
Status Affected: None
Encoding: 0000 0000 0001 0100 Description: Clears the contents of the specified
register.
Description First, the return address (PC + 2) is If ‘a’ is ‘0’, the Access Bank is selected.
pushed onto the return stack. Next, the If ‘a’ is ‘1’, the BSR is used to select the
contents of W are written to PCL; the GPR bank.
existing value is discarded. Then, the If ‘a’ is ‘0’ and the extended instruction
contents of PCLATH and PCLATU are set is enabled, this instruction operates
latched into PCH and PCU, in Indexed Literal Offset Addressing
respectively. The second cycle is mode whenever f 95 (5Fh). See Sec-
executed as a NOP instruction while the tion 41.2.3 “Byte-Oriented and Bit-
new next instruction is fetched. Oriented Instructions in Indexed Lit-
Unlike CALL, there is no option to eral Offset Mode” for details.
update W, Status or BSR.
Words: 1
Words: 1
Cycles: 1
Cycles: 2
Q Cycle Activity:
Q Cycle Activity:
Q1 Q2 Q3 Q4
Q1 Q2 Q3 Q4 Decode Read Process Write
Decode Read PUSH PC No register ‘f’ Data register ‘f’
WREG to stack operation
No No No No Example: CLRF FLAG_REG, 1
operation opera- operation operation Before Instruction
tion FLAG_REG = 5Ah
After Instruction
FLAG_REG = 00h
Example: HERE CALLW
Before Instruction
PC = address (HERE)
PCLATH = 10h
PCLATU = 00h
W = 06h
After Instruction
PC = 001006h
TOS = address (HERE + 2)
PCLATH = 10h
PCLATU = 00h
W = 06h
POP Pop Top of Return Stack PUSH Push Top of Return Stack
Syntax: POP Syntax: PUSH
Operands: None Operands: None
Operation: (TOS) bit bucket Operation: (PC) + 2 TOS
Status Affected: None Status Affected: None
Encoding: 0000 0000 0000 0110 Encoding: 0000 0000 0000 0101
Description: The TOS value is pulled off the return Description: The PC + 2 is pushed onto the top of
stack and is discarded. The TOS value the return stack. The previous TOS
then becomes the previous value that value is pushed down on the stack.
was pushed onto the return stack. This instruction allows implementing a
This instruction is provided to enable software stack by modifying TOS and
the user to properly manage the return then pushing it onto the return stack.
stack to incorporate a software stack.
Words: 1
Words: 1 Cycles: 1
Cycles: 1
Q Cycle Activity:
Q Cycle Activity: Q1 Q2 Q3 Q4
Q1 Q2 Q3 Q4 Decode PUSH No No
Decode No POP TOS No PC + 2 onto operation operation
operation value operation return stack
Example: RETFIE 1
After Interrupt
PC = TOS
WREG = WREG_SHAD
BSR = BSR_SHAD
STATUS = STATUS_SHAD
FSR0L/H = FSR0L/H_SHAD
FSR1L/H = FSR1L/H_SHAD
FSR2L/H = FSR2L/H_SHAD
PRODL/H = PRODL/H_SHAD
PCLATH/U = PCLATH/U_SHAD
RLNCF Rotate Left f (No Carry) RRCF Rotate Right f through Carry
Syntax: RLNCF f {,d {,a}} Syntax: RRCF f {,d {,a}}
Operands: 0 f 255 Operands: 0 f 255
d [0,1] d [0,1]
a [0,1] a [0,1]
Operation: (f<n>) dest<n + 1>, Operation: (f<n>) dest<n – 1>,
(f<7>) dest<0> (f<0>) C,
(C) dest<7>
Status Affected: N, Z
Status Affected: C, N, Z
Encoding: 0100 01da ffff ffff
Description: The contents of register ‘f’ are rotated Encoding: 0011 00da ffff ffff
one bit to the left. If ‘d’ is ‘0’, the result Description: The contents of register ‘f’ are rotated
is placed in W. If ‘d’ is ‘1’, the result is one bit to the right through the CARRY
stored back in register ‘f’ (default). flag. If ‘d’ is ‘0’, the result is placed in W.
If ‘a’ is ‘0’, the Access Bank is selected. If ‘d’ is ‘1’, the result is placed back in
If ‘a’ is ‘1’, the BSR is used to select the register ‘f’ (default).
GPR bank. If ‘a’ is ‘0’, the Access Bank is selected.
If ‘a’ is ‘0’ and the extended instruction If ‘a’ is ‘1’, the BSR is used to select the
set is enabled, this instruction operates GPR bank.
in Indexed Literal Offset Addressing If ‘a’ is ‘0’ and the extended instruction
mode whenever f 95 (5Fh). See Sec- set is enabled, this instruction operates
tion 41.2.3 “Byte-Oriented and Bit- in Indexed Literal Offset Addressing
Oriented Instructions in Indexed Lit- mode whenever f 95 (5Fh). See Sec-
eral Offset Mode” for details. tion 41.2.3 “Byte-Oriented and Bit-
Oriented Instructions in Indexed Lit-
register f
eral Offset Mode” for details.
Words: 1 C register f
Cycles: 1
Words: 1
Q Cycle Activity:
Cycles: 1
Q1 Q2 Q3 Q4
Decode Read Process Write to Q Cycle Activity:
register ‘f’ Data destination Q1 Q2 Q3 Q4
Decode Read Process Write to
Example: RLNCF REG, 1, 0 register ‘f’ Data destination
Before Instruction
REG = 1010 1011 Example: RRCF REG, 0, 0
After Instruction Before Instruction
REG = 0101 0111 REG = 1110 0110
C = 0
After Instruction
REG = 1110 0110
W = 0111 0011
C = 0
SWAPF Swap f
Syntax: SWAPF f {,d {,a}}
Operands: 0 f 255
d [0,1]
a [0,1]
Operation: (f[3:0]) dest[7:4],
(f[7:4]) dest[3:0]
Status Affected: None
Encoding: 0011 10da ffff ffff
Description: The upper and lower nibbles of register
‘f’ are exchanged. If ‘d’ is ‘0’, the result
is placed in W. If ‘d’ is ‘1’, the result is
placed in register ‘f’ (default).
If ‘a’ is ‘0’, the Access Bank is selected.
If ‘a’ is ‘1’, the BSR is used to select the
GPR bank.
If ‘a’ is ‘0’ and the extended instruction
set is enabled, this instruction operates
in Indexed Literal Offset Addressing
mode whenever f 95 (5Fh). See Sec-
tion 41.2.3 “Byte-Oriented and Bit-
Oriented Instructions in Indexed Lit-
eral Offset Mode” for details.
Words: 1
Cycles: 1
Q Cycle Activity:
Q1 Q2 Q3 Q4
Decode Read Process Write to
register ‘f’ Data destination
ADDULNK k Add FSR2 with (k) & return 2 1110 1000 11kk kkkk None
MOVSF zs, fd Move zs (source) to 1st word 2 1110 1011 0zzz zzzz None
fd (destination) 2nd word 2 1111 ffff ffff ffff
MOVSFL zs, fd Opcode 1st word 0000 0000 0000 0010 None
Move zs (source) to 2nd word 3 1111 xxxz zzzz zzff
fd (full destination) 3rd word 1111 ffff ffff ffff
MOVSS zs, zd Move zs (source) to 1st word 1110 1011 1zzz zzzz None
zd (destination) 2nd word 2 1111 xxxx xzzz zzzz
PUSHL k Store Literal at FSR2, Decrement 1 1110 1010 kkkk kkkk None
FSR2
SUBULNK k Subtract (k) from FSR2 & return 2 1110 1001 11kk kkkk None
Note 1: If Program Counter (PC) is modified or a conditional test is true, the instruction requires an additional cycle. The extra
cycle is executed as a NOP.
2: Some instructions are multi word instructions. The second/third words of these instructions will be decoded as a NOP,
unless the first word of the instruction retrieves the information embedded in these 16-bits. This ensures that all program
memory locations have a valid instruction.
3: Only available when extended instruction set is enabled.
4: fs and fd do not cover the full memory range. 2 MSBs of bank selection are forced to ‘b00 to limit the range of these
instructions to lower 4k addressing space.
Q Cycle Activity:
Q1 Q2 Q3 Q4
Decode Read Process Write to
literal ‘k’ Data FSR
No No No No
Operation Operation Operation Operation
Note: All PIC18 instructions may take an optional label argument preceding the instruction mnemonic for use in
symbolic addressing. If a label is used, the instruction syntax then becomes: {label} instruction argument(s).
MOVSS Move Indexed to Indexed PUSHL Store Literal at FSR2, Decrement FSR2
Syntax: MOVSS [zs], [zd] Syntax: PUSHL k
Operands: 0 zs 127 Operands: 0k 255
0 zd 127
Operation: k (FSR2),
Operation: ((FSR2) + zs) ((FSR2) + zd) FSR2 – 1 FSR2
Status Affected: None Status Affected: None
Encoding:
Encoding: 1111 1010 kkkk kkkk
1st word (source) 1110 1011 1zzz zzzzs
2nd word (dest.) 1111 xxxx xzzz zzzzd Description: The 8-bit literal ‘k’ is written to the data
Description The contents of the source register are memory address specified by FSR2. FSR2
is decremented by 1 after the operation.
moved to the destination register. The
This instruction allows users to push values
addresses of the source and destination
registers are determined by adding the onto a software stack.
7-bit literal offsets ‘zs’ or ‘zd’, Words: 1
respectively, to the value of FSR2. Both Cycles: 1
registers can be located anywhere in
the 16 Kbyte data space (0000h to Q Cycle Activity:
3FFFh). Q1 Q2 Q3 Q4
The MOVSS instruction cannot use the Decode Read ‘k’ Process Write to
PCL, TOSU, TOSH or TOSL as the data destination
destination register.
If the resultant source address points to
an indirect addressing register, the Example: PUSHL 08h
value returned will be 00h. If the
resultant destination address points to Before Instruction
an indirect addressing register, the FSR2H:FSR2L = 01ECh
Memory (01ECh) = 00h
instruction will execute as a NOP.
Words: 2 After Instruction
Cycles: 2 FSR2H:FSR2L = 01EBh
Memory (01ECh) = 08h
Q Cycle Activity:
Q1 Q2 Q3 Q4
Decode Determine Determine Read
source addr source addr source reg
Decode Determine Determine Write
dest addr dest addr to dest reg
3FD1h - — Unimplemented
3FD0h
3FCFh PORTF(3) RF7 RF6 RF5 RF4 RF3 RF2 RF1 RF0 264
3FCEh PORTE — — — — RE0 RE2(2) RE1(2) RE1(2) 264
3FCDh PORTD(2) RD7 RD6 RD5 RD4 RD3 RD2 RD1 RD0 264
3FCCh PORTC RC7 RC6 RC5 RC4 RC3 RC2 RC1 RC0 264
3FCBh PORTB RB7 RB6 RB5 RB4 RB3 RB2 RB1 RB0 264
3FCAh PORTA RA7 RA6 RA5 RA4 RA3 RA2 RA1 RA0 264
3FC9h - — Unimplemented
3FC8h
3FB7h TRISF(3) TRISF7 TRISF6 TRISF5 TRISF4 TRISF3 TRISF2 TRISF1 TRISF0 265
3FB6h TRISE(2) TRISE7 TRISE6 TRISE5 TRISE4 TRISE3 TRISE2 TRISE1 TRISE0 265
3FB5h TRISD(2) TRISD7 TRISD6 TRISD5 TRISD4 TRISD3 TRISD2 TRISD1 TRISD0 265
3FC4h TRISC TRISC7 TRISC6 TRISC5 TRISC4 TRISC3 TRISC2 TRISC1 TRISC0 265
3FC3h TRISB TRISB7 TRISB6 TRISB5 TRISB4 TRISB3 TRISB2 TRISB1 TRISB0 265
3FC2h TRISA TRISA7 TRISA6 TRISA5 TRISA4 TRISA3 TRISA2 TRISA1 TRISA0 265
3FC1h - — Unimplemented
3FC0h
3FBFh LATF(3) LATF7 LATF6 LATF5 LATF4 LATF3 LATF2 LATF1 LATF0 266
3FBEh LATE(2) LATE7 LATE7 LATE7 LATE7 LATE7 LATE7 LATE7 LATE7 266
3FBDh LATD(2) LATD7 LATD6 LATD5 LATD4 LATD3 LATD2 LATD1 LATD0 266
3FBCh LATC LATC7 LATC6 LATC5 LATC4 LATC3 LATC2 LATC1 LATC0 266
3FBBh LATB LATB7 LATB6 LATB5 LATB4 LATB3 LATB2 LATB1 LATB0 266
3FBAh LATA LATA7 LATA6 LATA5 LATA4 LATA3 LATA2 LATA1 LATA0 266
3FB9h T0CON1 CS[2:0] ASYNC CKPS[3:0] 303
3FB8h T0CON0 EN — OUT MD16 OUTPS 302
3FB7h TMR0H TMR0H 304
3FB6h TMR0L TMR0L 304
3FB5h T1CLK CS 316
3FB4h T1GATE GSS 317
3FB3h T1GCON GE GPOL GTM GSPM GGO GVAL — — 315
3FB2h T1CON — — CKPS[1:0] — SYNC RD16 ON 339
3FB1h TMR1H TMR1H 318
3FB0h TMR1L TMR1L 318
3FAFh T2RST — — — RSEL 337
3FAEh T2CLK — — — — CS 316
3FADh T2HLT PSYNC CKPOL CKSYNC MODE 340
3FACh T2CON ON CKPS OUTPS 314
3FABh T2PR PR2 338
3FAAh T2TMR TMR2 338
3FA9h T3CLK CS 316
3FA8h T3GATE GSS 317
3FA7h T3GCON GE GPOL GTM GSPM GGO GVAL — — 315
3FA6h T3CON — — CKPS — NOT_SYNC RD16 ON 339
3FA5h TMR3H TMR3H 318
3FA4h TMR3L TMR3L 318
3FA3h T4RST — — — RSEL 337
3FA2h T4CLK — — — — CS 336
Legend: x = unknown, u = unchanged, — = unimplemented, q = value depends on condition
Note 1: Unimplemented in LF devices.
2: Unimplemented in PIC18(L)F26K42.
3: Unimplemented on PIC18(L)F26/27/45/46/47K42 devices.
4: Unimplemented in PIC18(L)F45/55K42.
3F65h PWM7DCH DC9 DC8 DC7 DC6 DC5 DC4 DC3 DC2 361
3F65h PWM7DCH DC 361
3F64h PWM7DCL DC1 DC0 — — — — — — 361
3F64h PWM7DCL DC — — — — — — 361
3F63h — Unimplemented
3F62h PWM8CON EN — OUT POL — — — — 359
3F61h PWM8DCH DC9 DC8 DC7 DC6 DC5 DC4 DC3 DC2 361
3F61h PWM8DCH DC 361
3F60h PWM8DCL DC1 DC0 — — — — — — 361
3F60h PWM8DCL DC — — — — — — 361
3F5Fh CCPTMRS1 P8TSEL P7TSEL P6TSEL P5TSEL 360
3F5Eh CCPTMRS0 C4TSEL C3TSEL C2TSEL C1TSEL 360
3F5Dh - — Unimplemented
3F5Bh
3F5Ah CWG1STR OVRD OVRC OVRB OVRA STRD STRC STRB STRA 429
3F59h CWG1AS1 — AS6E AS5E AS4E AS3E AS2E AS1E AS0E 431
3F58h CWG1AS0 SHUTDOWN REN LSBD LSAC — — 430
3F57h CWG1CON1 — — IN — POLD POLC POLB POLA 426
3F56h CWG1CON0 EN LD — — — MODE 425
3F55h CWG1DBF — — DBF 432
3F54h CWG1DBR — — DBR 432
3F53h CWG1ISM — — — — IS 428
3F52h CWG1CLK — — — — — — — CS 427
3F51h CWG2STR OVRD OVRC OVRB OVRA STRD STRC STRB STRA 429
3F50h CWG2AS1 — AS6E AS5E AS4E AS3E AS2E AS1E AS0E 431
3F4Fh CWG2AS0 SHUTDOWN REN LSBD LSAC — — 430
3F4Eh CWG2CON1 — — IN — POLD POLC POLB POLA 426
3F4Dh CWG2CON0 EN LD — — — MODE 425
3F4Ch CWG2DBF — — DBF 432
3F4Bh CWG2DBR — — DBR 432
3F4Ah CWG2ISM — — — — IS 428
3F49h CWG2CLK — — — — — — — CS 427
3F48h CWG3STR OVRD OVRC OVRB OVRA STRD STRC STRB STRA 429
3F47h CWG3AS1 — AS6E AS5E AS4E AS3E AS2E AS1E AS0E 431
3F46h CWG3AS0 SHUTDOWN REN LSBD LSAC — — 430
3F45h CWG3CON1 — — IN — POLD POLC POLB POLA 426
3F44h CWG3CON0 EN LD — — — MODE 425
3F43h CWG3DBF — — DBF 432
3F42h CWG3DBR — — DBR 432
3F41h CWG3ISM — — — — IS 428
3F40h CWG3CLK — — — — — — — CS 427
3F3Fh NCO1CLK PWS — CKS 455
3F3Eh NCO1CON EN — OUT POL — — — PFM 454
3F3Dh NCO1INCU INC 458
3F3Ch NCO1INCH INC 457
3F3Bh NCO1INCL INC 457
3F3Ah NCO1ACCU ACC 457
3F39h NCO1ACCH ACC 456
Legend: x = unknown, u = unchanged, — = unimplemented, q = value depends on condition
Note 1: Unimplemented in LF devices.
2: Unimplemented in PIC18(L)F26K42.
3: Unimplemented on PIC18(L)F26/27/45/46/47K42 devices.
4: Unimplemented in PIC18(L)F45/55K42.
3CE4h - — Unimplemented
3C7Fh
3C7Eh CLCDATA0 — — — — CLC4OUT CLC3OUT CLC2OUT CLC1OUT 448
3C7Dh CLC1GLS3 G4D4T G4D4N G4D3T G4D3N G4D2T G4D2N G4D1T G4D1N 447
3C7Ch CLC1GLS2 G3D4T G3D4N G3D3T G3D3N G3D2T G3D2N G3D1T G3D1N 446
3C7Bh CLC1GLS1 G2D4T G2D4N G2D3T G2D3N G2D2T G2D2N G2D1T G2D1N 445
3C7Ah CLC1GLS0 G1D4T G1D4N G1D3T G1D3N G1D2T G1D2N G1D1T G1D1N 444
3C79h CLC1SEL3 D4S 443
3C78h CLC1SEL2 D3S 443
3C77h CLC1SEL1 D2S 443
3C76h CLC1SEL0 D1S 443
3C75h CLC1POL POL — — — G4POL G3POL G2POL G1POL 442
3C74h CLC1CON EN OE OUT INTP INTN MODE 441
3C73h CLC2GLS3 G4D4T G4D4N G4D3T G4D3N G4D2T G4D2N G4D1T G4D1N 447
3C72h CLC2GLS2 G3D4T G3D4N G3D3T G3D3N G3D2T G3D2N G3D1T G3D1N 446
3C71h CLC2GLS1 G2D4T G2D4N G2D3T G2D3N G2D2T G2D2N G2D1T G2D1N 445
3C70h CLC2GLS0 G1D4T G1D4N G1D3T G1D3N G1D2T G1D2N G1D1T G1D1N 444
3C6Fh CLC2SEL3 D4S 443
3C6Eh CLC2SEL2 D3S 443
3C6Dh CLC2SEL1 D2S 443
3C6Ch CLC2SEL0 D1S 443
3C6Bh CLC2POL POL — — — G4POL G3POL G2POL G1POL 442
3C6Ah CLC2CON EN OE OUT INTP INTN MODE 441
3C69h CLC3GLS3 G4D4T G4D4N G4D3T G4D3N G4D2T G4D2N G4D1T G4D1N 447
3C68h CLC3GLS2 G3D4T G3D4N G3D3T G3D3N G3D2T G3D2N G3D1T G3D1N 446
3C67h CLC3GLS1 G2D4T G2D4N G2D3T G2D3N G2D2T G2D2N G2D1T G2D1N 445
3C66h CLC3GLS0 G1D4T G1D4N G1D3T G1D3N G1D2T G1D2N G1D1T G1D1N 444
3C65h CLC3SEL3 D4S 443
3C64h CLC3SEL2 D3S 443
3C63h CLC3SEL1 D2S 443
3C62h CLC3SEL0 D1S 444
3C61h CLC3POL POL — — — G4POL G3POL G2POL G1POL 442
3C60h CLC3CON EN OE OUT INTP INTN MODE 441
3C5Fh CLC4GLS3 G4D4T G4D4N G4D3T G4D3N G4D2T G4D2N G4D1T G4D1N 447
3C5Eh CLC4GLS2 G3D4T G3D4N G3D3T G3D3N G3D2T G3D2N G3D1T G3D1N 446
3C5Dh CLC4GLS1 G2D4T G2D4N G2D3T G2D3N G2D2T G2D2N G2D1T G2D1N 445
3C5Ch CLC4GLS0 G1D4T G1D4N G1D3T G1D3N G1D2T G1D2N G1D1T G1D1N 444
3C5Bh CLC4SEL3 D4S 443
3C5Ah CLC4SEL2 D3S 443
3C59h CLC4SEL1 D2S 443
3C58h CLC4SEL0 D1S 444
3C57h CLC4POL POL — — — G4POL G3POL G2POL G1POL 442
3C56h CLC4CON EN OE OUT INTP INTN MODE 441
3C55h - — Unimplemented
3C00h
3BFFh DMA1SIRQ — SIRQ 257
3BFEh DMA1AIRQ — AIRQ 257
3BFDh DMA1CON1 EN SIRQEN DGO — — AIRQEN — XIP 250
Legend: x = unknown, u = unchanged, — = unimplemented, q = value depends on condition
Note 1: Unimplemented in LF devices.
2: Unimplemented in PIC18(L)F26K42.
3: Unimplemented on PIC18(L)F26/27/45/46/47K42 devices.
4: Unimplemented in PIC18(L)F45/55K42.
3A8Fh- — Unimplemented
3A88h
3A87h IOCEF — — — — IOCEF3 — — — 288
3A86h IOCEN — — — — IOCEN3 — — — 288
3A85h IOCEP — — — — IOCEP3 — — — 288
3A84h INLVLE — — — — INLVLE3 INLVLE2(2) INLVLE1(2) INLVLE0(2) 271
3A83h SLRCONE(2) — — — — — SRLE2(2) SRLE1(2) SRLE0(2) 270
3A82h ODCONE(2) — — — — — ODCE2(2) ODCE1(2) ODCE0(2) 269
3A81h WPUE — — — — WPUE3 WPUE2(2) WPUE1(2) WPUE0(2) 268
3A80h ANSELE(2) ANSELE7 ANSELE6 ANSELE5 ANSELE4 ANSELE3 ANSELE2 ANSELE1 ANSELE0 267
3A7Fh- — Unimplemented
3A7CH
3A7Bh RD1I2C(2) — IOCEN3 PU — — TH 264
3A7Ah RD0I2C(2) — IOCEN3 PU — — TH 264
3A79h- — Unimplemented
3A75h
3A74h INLVLD(2) INLVLD7 INLVLD6 INLVLD5 INLVLD4 INLVLD3 INLVLD2 INLVLD1 INLVLD0 271
3A73h SLRCOND(2) SRLD7 SRLD6 SRLD5 SRLD4 SRLD3 SRLD2 SRLD1 SRLD0 270
3A72h ODCOND(2) ODCD7 ODCD6 ODCD5 ODCD4 ODCD3 ODCD2 ODCD1 ODCD0 269
3A71h WPUD(2) WPUD7 WPUD6 WPUD5 WPUD4 WPUD3 WPUD2 WPUD1 WPUD0 268
3A70h ANSELD(2) ANSELD7 ANSELD6 ANSELD5 ANSELD4 ANSELD3 ANSELD2 ANSELD1 ANSELD0 267
3A6Fh- — Unimplemented
3A6Ch
3A6Bh RC4I2C — SLEW PU — — TH 264
3A6Ah RC3I2C — SLEW PU — — TH 264
3A69h — Unimplemented
3A68h — Unimplemented
3A67h IOCCF IOCCF7 IOCCF6 IOCCF5 IOCCF4 IOCCF3 IOCCF2 IOCCF1 IOCCF0 288
3A66h IOCCN IOCCN7 IOCCN6 IOCCN5 IOCCN4 IOCCN3 IOCCN2 IOCCN1 IOCCN0 288
3A65h IOCCP IOCCP7 IOCCP6 IOCCP5 IOCCP4 IOCCP3 IOCCP2 IOCCP1 IOCCP0 288
3A64h INLVLC INLVLC7 INLVLC6 INLVLC5 INLVLC4 INLVLC3 INLVLC2 INLVLC1 INLVLC0 271
3A63h SLRCONC SLRC7 SLRC6 SLRC5 SLRC4 SLRC3 SLRC2 SLRC1 SLRC0 270
3A62h ODCONC ODCC7 ODCC6 ODCC5 ODCC4 ODCC3 ODCC2 ODCC1 ODCC0 269
3A61h WPUC WPUC7 WPUC6 WPUC5 WPUC4 WPUC3 WPUC2 WPUC1 WPUC0 268
3A60h ANSELC ANSELC7 ANSELC6 ANSELC5 ANSELC4 ANSELC3 ANSELC2 ANSELC1 ANSELC0 267
3A5Fh - — Unimplemented
3A5Ch
3A5Bh RB2I2C — SLEW PU — — TH 264
3A5Ah RB1I2C — SLEW PU — — TH 264
3A59h — Unimplemented
3A58h — Unimplemented
3A57h IOCBF IOCBF7 IOCBF6 IOCBF5 IOCBF4 IOCBF3 IOCBF2 IOCBF1 IOCBF0 288
3A56h IOCBN IOCBN7 IOCBN6 IOCBN5 IOCBN4 IOCBN3 IOCBN2 IOCBN1 IOCBN0 288
3A55h IOCBP IOCBP7 IOCBP6 IOCBP5 IOCBP4 IOCBP3 IOCBP2 IOCBP1 IOCBP0 288
3A54h INLVLB INLVLB7 INLVLB6 INLVLB5 INLVLB4 INLVLB3 INLVLB2 INLVLB1 INLVLB0 271
3A53h SLRCONB SLRB7 SLRB6 SLRB5 SLRB4 SLRB3 SLRB2 SLRB1 SLRB0 270
3A52h ODCONB ODCB7 ODCB6 ODCB5 ODCB4 ODCB3 ODCB2 ODCB1 ODCB0 269
3A51h WPUB WPUB7 WPUB6 WPUB5 WPUB4 WPUB3 WPUB2 WPUB1 WPUB0 268
3A50h ANSELB ANSELB7 ANSELB6 ANSELB5 ANSELB4 ANSELB3 ANSELB2 ANSELB1 ANSELB0 267
Legend: x = unknown, u = unchanged, — = unimplemented, q = value depends on condition
Note 1: Unimplemented in LF devices.
2: Unimplemented in PIC18(L)F26K42.
3: Unimplemented on PIC18(L)F26/27/45/46/47K42 devices.
4: Unimplemented in PIC18(L)F45/55K42.
3A4Fh - — Unimplemented
3A48h
3A47h IOCAF IOCAF7 IOCAF6 IOCAF5 IOCAF4 IOCAF3 IOCAF2 IOCAF1 IOCAF0 288
3A46h IOCAN IOCAN7 IOCAN6 IOCAN5 IOCAN4 IOCAN3 IOCAN2 IOCAN1 IOCAN0 288
3A45h IOCAP IOCAP7 IOCAP6 IOCAP5 IOCAP4 IOCAP3 IOCAP2 IOCAP1 IOCAP0 288
3A44h INLVLA INLVLA7 INLVLA6 INLVLA5 INLVLA4 INLVLA3 INLVLA2 INLVLA1 INLVLA0 271
3A43h SLRCONA SLRA7 SLRA6 SLRA5 SLRA4 SLRA3 SLRA2 SLRA1 SLRA0 270
3A42h ODCONA ODCA7 ODCA6 ODCA5 ODCA4 ODCA3 ODCA2 ODCA1 ODCA0 269
3A41h WPUA WPUA7 WPUA6 WPUA5 WPUA4 WPUA3 WPUA2 WPUA1 WPUA0 268
3A40h ANSELA ANSELA7 ANSELA6 ANSELA5 ANSELA4 ANSELA3 ANSELA2 ANSELA1 ANSELA0 267
3A3Fh - — Unimplemented
3A30h
3A2Fh RF7PPS(3) — — RF7PPS5 RF7PPS4 RF7PPS3 RF7PPS2 RF7PPS1 RF7PPS0 281
3A2Eh RF6PPS(3) — — RF6PPS5 RF6PPS4 RF6PPS3 RF6PPS2 RF6PPS1 RF6PPS0 281
3A2Dh RF5PPS(3) — — RF5PPS5 RF5PPS4 RF5PPS3 RF5PPS2 RF5PPS1 RF5PPS0 281
3A2Ch RF4PPS(3) — — RF4PPS5 RF4PPS4 RF4PPS3 RF4PPS2 RF4PPS1 RF4PPS0 281
3A2Bh RF3PPS(3) — — RF3PPS5 RF3PPS4 RF3PPS3 RF3PPS2 RF3PPS1 RF3PPS0 281
3A2Ah RF2PPS(3) — — RF2PPS5 RF2PPS4 RF2PPS3 RF2PPS2 RF2PPS1 RF2PPS0 281
3A29h RF1PPS(3) — — RF1PPS5 RF1PPS4 RF1PPS3 RF1PPS2 RF1PPS1 RF1PPS0 281
3A28h RF0PPS(3) — — RF0PPS5 RF0PPS4 RF0PPS3 RF0PPS2 RF0PPS1 RF0PPS0 281
3A27h- — Unimplemented
3A23h
3A22h RE2PPS(2) — — RE2PPS5 RE2PPS4 RE2PPS3 RE2PPS2 RE2PPS1 RE2PPS0 281
3A21h RE1PPS(2) — — RE1PPS5 RE1PPS4 RE1PPS3 RE1PPS2 RE1PPS1 RE1PPS0 281
3A20h RE0PPS(2) — — RE0PPS5 RE0PPS4 RE0PPS3 RE0PPS2 RE0PPS1 RE0PPS0 281
3A1Fh RD7PPS(2) — — RD7PPS5 RD7PPS4 RD7PPS3 RD7PPS2 RD7PPS1 RD7PPS0 281
3A1Eh RD6PPS(2) — — RD6PPS5 RD6PPS4 RD6PPS3 RD6PPS2 RD6PPS1 RD6PPS0 281
3A1Dh RD5PPS(2) — — RD5PPS5 RD5PPS4 RD5PPS3 RD5PPS2 RD5PPS1 RD5PPS0 281
3A1Ch RD4PPS(2) — — RD4PPS5 RD4PPS4 RD4PPS3 RD4PPS2 RD4PPS1 RD4PPS0 281
3A1Bh RD3PPS(2) — — RD3PPS5 RD3PPS4 RD3PPS3 RD3PPS2 RD3PPS1 RD3PPS0 281
3A1Ah RD2PPS(2) — — RD2PPS5 RD2PPS4 RD2PPS3 RD2PPS2 RD2PPS1 RD2PPS0 281
3A19h RD1PPS(2) — — RD1PPS5 RD1PPS4 RD1PPS3 RD1PPS2 RD1PPS1 RD1PPS0 281
3A18h RD0PPS(2) — — RD0PPS5 RD0PPS4 RD0PPS3 RD0PPS2 RD0PPS1 RD0PPS0 281
3A17h RC7PPS — — RC7PPS5 RC7PPS4 RC7PPS3 RC7PPS2 RC7PPS1 RC7PPS0 281
3A16h RC6PPS — — RC6PPS5 RC6PPS4 RC6PPS3 RC6PPS2 RC6PPS1 RC6PPS0 281
3A15h RC5PPS — — RC5PPS5 RC5PPS4 RC5PPS3 RC5PPS2 RC5PPS1 RC5PPS0 281
3A14h RC4PPS — — RC4PPS5 RC4PPS4 RC4PPS3 RC4PPS2 RC4PPS1 RC4PPS0 281
3A13h RC3PPS — — RC3PPS5 RC3PPS4 RC3PPS3 RC3PPS2 RC3PPS1 RC3PPS0 281
3A12h RC2PPS — — RC2PPS5 RC2PPS4 RC2PPS3 RC2PPS2 RC2PPS1 RC2PPS0 281
3A11h RC1PPS — — RC1PPS5 RC1PPS4 RC1PPS3 RC1PPS2 RC1PPS1 RC1PPS0 281
3A10h RC0PPS — — RC0PPS5 RC0PPS4 RC0PPS3 RC0PPS2 RC0PPS1 RC0PPS0 281
3A0Fh RB7PPS — — RB7PPS5 RB7PPS4 RB7PPS3 RB7PPS2 RB7PPS1 RB7PPS0 281
3A0Eh RB6PPS — — RB6PPS5 RB6PPS4 RB6PPS3 RB6PPS2 RB6PPS1 RB6PPS0 281
3A0Dh RB5PPS — — RB5PPS5 RB5PPS4 RB5PPS3 RB5PPS2 RB5PPS1 RB5PPS0 281
3A0Ch RB4PPS — — RB4PPS5 RB4PPS4 RB4PPS3 RB4PPS2 RB4PPS1 RB4PPS0 281
3A0Bh RB3PPS — — RB3PPS5 RB3PPS4 RB3PPS3 RB3PPS2 RB3PPS1 RB3PPS0 281
3A0Ah RB2PPS — — RB2PPS5 RB2PPS4 RB2PPS3 RB2PPS2 RB2PPS1 RB2PPS0 281
3A09h RB1PPS — — RB1PPS5 RB1PPS4 RB1PPS3 RB1PPS2 RB1PPS1 RB1PPS0 281
Legend: x = unknown, u = unchanged, — = unimplemented, q = value depends on condition
Note 1: Unimplemented in LF devices.
2: Unimplemented in PIC18(L)F26K42.
3: Unimplemented on PIC18(L)F26/27/45/46/47K42 devices.
4: Unimplemented in PIC18(L)F45/55K42.
39C1h PMD1 NCO1MD TMR6MD TMR5MD TMR4MD TMR3MD TMR2MD TMR1MD TMR0MD 292
39C0h PMD0 SYSCMD FVRMD HLVDMD CRCMD SCANMD NVMMD CLKRMD IOCMD 291
39BFh - — Unimplemented
39ABh
39AAh PIR10 — — — — — — CLC4IF CCP4IF 146
39A9h PIR9 — — — — CLC3IF CWG3IF CCP3IF TMR6IF 145
39A8h PIR8 TMR5GIF TMR5IF — — — — — — 145
39A7h PIR7 — — INT2IF CLC2IF CWG2IF — CCP2IF TMR4IF 144
39A6h PIR6 TMR3GIF TMR3IF U2IF U2EIF U2TXIF U2RXIF I2C2EIF I2C2IF 143
39A5h PIR5 I2C2TXIF I2C2RXIF DMA2AIF DMA2ORIF DMA2DCN- DMA2SCN- C2IF INT1IF 142
TIF TIF
39A4h PIR4 CLC1IF CWG1IF NCO1IF — CCP1IF TMR2IF TMR1GIF TMR1IF 141
39A3h PIR3 TMR0IF U1IF U1EIF U1TXIF U1RXIF I2C1EIF I2C1IF I2C1TXIF 140
39A2h PIR2 I2C1RXIF SPI1IF SPI1TXIF SPI1RXIF DMA1AIF DMA1ORIF DMA1DCN- DMA1SCNTIF 138
TIF
39A1h PIR1 SMT1PWAIF SMT1PRAIF SMT1IF C1IF ADTIF ADIF ZCDIF INT0IF 138
39A0h PIR0 IOCIF CRCIF SCANIF NVMIF CSWIF OSFIF HLVDIF SWIF 137
399Fh - — Unimplemented
399Bh
399Ah PIE10 — — — — — — CLC4IE CCP4IE 156
3999h PIE9 — — — — CLC3IE CWG3IE CCP3IE TMR6IE 155
3998h PIE8 TMR5GIE TMR5IE — — — — — — 155
3997h PIE7 — — INT2IE CLC2IE CWG2IE — CCP2IE TMR4IE 154
3996h PIE6 TMR3GIE TMR3IE U2IE U2EIE U2TXIE U2RXIE I2C2EIE I2C2IE 153
3995h PIE5 I2C2TXIE I2C2RXIE DMA2AIE DMA2ORIE DMA2DCN- DMA2SCN- C2IE INT1IE 152
TIE TIE
3994h PIE4 CLC1IE CWG1IE NCO1IE — CCP1IE TMR2IE TMR1GIE TMR1IE 151
3993h PIE3 TMR0IE U1IE U1EIE U1TXIE U1RXIE I2C1EIE I2C1IE I2C1TXIE 150
3992h PIE2 I2C1RXIE SPI1IE SPI1TXIE SPI1RXIE DMA1AIE DMA1ORIE DMA1DCN- DMA1SCNTIE 149
TIE
3991h PIE1 SMT1PWAIE SMT1PRAIE SMT1IE C1IE ADTIE ADIE ZCDIE INT0IE 148
3990h PIE0 IOCIE CRCIE SCANIE NVMIE CSWIE OSFIE HLVDIE SWIE 147
398Fh - — Unimplemented
398Bh
398Ah IPR10 — — — — — — CLC4IP CCP4IP 165
3989h IPR9 — — — — CLC3IP CWG3IP CCP3IP TMR6IP 165
3988h IPR8 TMR5GIP TMR5IP — — — — — — 164
3987h IPR7 — — INT2IP CLC2IP CWG2IP - CCP2IP TMR4IP 164
3986h IPR6 TMR3GIP TMR3IP U2IP U2EIP U2TXIP U2RXIP I2C2EIP I2C2IP 163
3985h IPR5 I2C2TXIP I2C2RXIP DMA2AIP DMA2ORIP DMA2DCN- DMA2SCN- C2IP INT1IP 162
TIP TIP
3984h IPR4 CLC1IP CWG1IP NCO1IP — CCP1IP TMR2IP TMR1GIP TMR1IP 161
3983h IPR3 TMR0IP U1IP U1EIP U1TXIP U1RXIP I2C1EIP I2C1IP I2C1TXIP 160
3982h IPR2 I2C1RXIP SPI1IP SPI1TXIP SPI1RXIP DMA1AIP DMA1ORIP DMA1DCN- DMA1SCNTIP 159
TIP
3981h IPR1 SMT1PWAIP SMT1PRAIP SMT1IP C1IP ADTIP ADIP ZCDIP INT0IP 158
3980h IPR0 IOCIP CRCIP SCANIP NVMIP CSWIP OSFIP HLVDIP SWIP 157
397Fh - — Unimplemented
397Eh
397Dh SCANTRIG — — — — TSEL 226
397Ch SCANCON0 EN TRIGEN SGO — — MREG BURSTMD BUSY 222
Legend: x = unknown, u = unchanged, — = unimplemented, q = value depends on condition
Note 1: Unimplemented in LF devices.
2: Unimplemented in PIC18(L)F26K42.
3: Unimplemented on PIC18(L)F26/27/45/46/47K42 devices.
4: Unimplemented in PIC18(L)F45/55K42.
387Fh - — Unimplemented
3800h
Legend: x = unknown, u = unchanged, — = unimplemented, q = value depends on condition
Note 1: Unimplemented in LF devices.
2: Unimplemented in PIC18(L)F26K42.
3: Unimplemented on PIC18(L)F26/27/45/46/47K42 devices.
4: Unimplemented in PIC18(L)F45/55K42.
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
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 44-7 to calculate device
specifications.
2: Power dissipation is calculated as follows:
PDIS = VDD x {IDD - IOH} + VDD - VOH) x IOH} + VOI 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.
5.5
2.7
VDD (V)
2.5
2.3
0 4 10 16 32 64
Frequency (MHz)
Note 1: The shaded region indicates the permissible combinations of voltage and frequency.
2: Refer to Table 44-8 for each Oscillator mode’s supported frequencies.
3.6
VDD (V)
2.7
2.5
1.8
0 4 10 16 32 64
Frequency (MHz)
Note 1: The shaded region indicates the permissible combinations of voltage and frequency.
2: Refer to Table 44-8 for each Oscillator mode’s supported frequencies.
PIC18F26/27/45/46/47/55/56/57K42
Param.
Sym. Characteristic Min. Typ.† Max. Units Conditions
No.
Supply Voltage
D002 VDD 1.8 — 3.6 V FOSC 16 MHz
2.5 — 3.6 V FOSC 16 MHz
2.7 — 3.6 V FOSC 32 MHz
D002 VDD 2.3 — 5.5 V FOSC 16 MHz
2.5 — 5.5 V FOSC MHz
2.7 — 5.5 V FOSC 32 MHz
RAM Data Retention(1)
D003 VDR 1.5 — — V Device in Sleep mode
D003 VDR 1.7 — — V Device in Sleep mode
Power-on Reset Release Voltage(2)
D004 VPOR — 1.6 — V BOR or LPBOR disabled(3)
D004 VPOR — 1.6 — V BOR or LPBOR disabled(3)
Power-on Reset Rearm Voltage(2)
D005 VPORR — 0.8 — V BOR or LPBOR disabled(3)
D005 VPORR — 1.5 — V BOR or LPBOR disabled(3)
VDD Rise Rate to ensure internal Power-on Reset signal(2)
D006 SVDD 0.05 — — V/ms BOR or LPBOR disabled(3)
D006 SVDD 0.05 — — V/ms BOR or LPBOR disabled(3)
†
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 44-3, POR and POR REARM with Slow Rising VDD.
3: See Table 44-12 for BOR and LPBOR trip point information.
VDD
VPOR
VPORR
SVDD
VSS
NPOR(1)
POR REARM
VSS
TVLOW(3) TPOR(2)
PIC18F26/45/46/55/56K42
Param. Conditions
Symbol Device Characteristics Min. Typ.† Max. Units
No. VDD Note
D100 IDDXT4 XT = 4 MHz — 620 1000 A 3.0V
D100 IDDXT4 XT = 4 MHz — 680 1100 A 3.0V
D100A IDDXT4 XT = 4 MHz — 400 — A 3.0V PMD’s all 1’s
D100A IDDXT4 XT = 4 MHz — 460 — A 3.0V PMD’s all 1’s
D101 IDDHFO16 HFINTOSC = 16 MHz — 2.9 4.1 mA 3.0V
D101 IDDHFO16 HFINTOSC = 16 MHz — 3 4.2 mA 3.0V
D101A IDDHFO16 HFINTOSC = 16 MHz — 2 — mA 3.0V PMD’s all 1’s
D101A IDDHFO16 HFINTOSC = 16 MHz — 2.1 — mA 3.0V PMD’s all 1’s
D102 IDDHFOPLL HFINTOSC = 64 MHz — 11.5 13.9 mA 3.0V
D102 IDDHFOPLL HFINTOSC = 64 MHz — 11.6 14 mA 3.0V
D102A IDDHFOPLL HFINTOSC = 64 MHz — 7.5 — mA 3.0V PMD’s all 1’s
D102A IDDHFOPLL HFINTOSC = 64 MHz — 7.6 — mA 3.0V PMD’s all 1’s
D103 IDDHSPLL64 HS+PLL = 64 MHz — 9.8 12.9 mA 3.0V
D103 IDDHSPLL64 HS+PLL = 64 MHz — 9.9 13 mA 3.0V
D103A IDDHSPLL64 HS+PLL = 64 MHz — 6.3 — mA 3.0V PMD’s all 1’s
D103A IDDHSPLL64 HS+PLL = 64 MHz — 6.4 — mA 3.0V PMD’s all 1’s
D104 IDDIDLE Idle mode, HFINTOSC = 16 MHz — 1.8 2.8 mA 3.0V
D104 IDDIDLE Idle mode, HFINTOSC = 16 MHz — 1.9 2.9 mA 3.0V
D105 IDDDOZE(3) Doze mode, HFINTOSC = 16 MHz, Doze Ratio = 16 — 1.8 — mA 3.0V
D105 IDDDOZE(3) Doze mode, HFINTOSC = 16 MHz, Doze Ratio = 16 — 1.9 — mA 3.0V
† 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 test conditions for all IDD measurements in active operation mode are: OSC1 = external square wave, from
rail-to-rail; all I/O pins are outputs driven low; MCLR = VDD; WDT disabled.
2: The supply current is mainly a function of the operating voltage and frequency. Other factors, such as I/O pin loading and
switching rate, oscillator type, internal code execution pattern and temperature, also have an impact on the current consumption.
3: IDDDOZE = [IDDIDLE*(N-1)/N] + IDDHFO16/N where N = Doze Ratio (Register 10-2).
4: PMD bits are all in the default state, no modules are disabled.
PIC18F27/47/57K42
Param. Conditions
Symbol Device Characteristics Min. Typ.† Max. Units
No. VDD Note
D100 IDDXT4 XT = 4 MHz — 750 1300 A 3.0V
D100 IDDXT4 XT = 4 MHz — 810 1400 A 3.0V
D100A IDDXT4 XT = 4 MHz — 515 — A 3.0V PMD’s all 1’s
D100A IDDXT4 XT = 4 MHz — 575 — A 3.0V PMD’s all 1’s
D101 IDDHFO16 HFINTOSC = 16 MHz — 3.4 4.7 mA 3.0V
D101 IDDHFO16 HFINTOSC = 16 MHz — 3.5 4.8 mA 3.0V
D101A IDDHFO16 HFINTOSC = 16 MHz — 2.5 — mA 3.0V PMD’s all 1’s
D101A IDDHFO16 HFINTOSC = 16 MHz — 2.6 — mA 3.0V PMD’s all 1’s
D102 IDDHFOPLL HFINTOSC = 64 MHz — 12.5 18.5 mA 3.0V
D102 IDDHFOPLL HFINTOSC = 64 MHz — 12.6 18.6 mA 3.0V
D102A IDDHFOPLL HFINTOSC = 64 MHz — 9.1 — mA 3.0V PMD’s all 1’s
D102A IDDHFOPLL HFINTOSC = 64 MHz — 9.2 — mA 3.0V PMD’s all 1’s
D103 IDDHSPLL64 HS+PLL = 64 MHz — 11.7 17.5 mA 3.0V
D103 IDDHSPLL64 HS+PLL = 64 MHz — 11.8 17.6 mA 3.0V
D103A IDDHSPLL64 HS+PLL = 64 MHz — 8.2 — mA 3.0V PMD’s all 1’s
D103A IDDHSPLL64 HS+PLL = 64 MHz — 8.3 — mA 3.0V PMD’s all 1’s
D104 IDDIDLE Idle mode, HFINTOSC = 16 MHz — 1.9 2.9 mA 3.0V
D104 IDDIDLE Idle mode, HFINTOSC = 16 MHz — 2.0 3.0 mA 3.0V
D105 IDDDOZE(3) Doze mode, HFINTOSC = 16 MHz, Doze Ratio = 16 — 1.6 — mA 3.0V
D105 IDDDOZE(3) Doze mode, HFINTOSC = 16 MHz, Doze Ratio = 16 — 1.7 — mA 3.0V
† 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 test conditions for all IDD measurements in active operation mode are: OSC1 = external square wave, from
rail-to-rail; all I/O pins are outputs driven low; MCLR = VDD; WDT disabled.
2: The supply current is mainly a function of the operating voltage and frequency. Other factors, such as I/O pin loading and
switching rate, oscillator type, internal code execution pattern and temperature, also have an impact on the current consumption.
3: IDDDOZE = [IDDIDLE*(N-1)/N] + IDDHFO16/N where N = Doze Ratio (Register 10-2).
4: PMD bits are all in the default state, no modules are disabled.
5: Data in this table is Preliminary data.
Param
Sym. Characteristic Min. Typ† Max. Units Conditions
No.
Rev. 10-000133A
8/1/2013
Load Condition
Pin
CL
VSS
CLKIN
OS1 OS2 OS2
OS20
CLKOUT
(CLKOUT Mode)
Param
Sym. Characteristic Min. Typ† Max. Units Conditions
No.
ECL Clock
OS1 FECL Clock Frequency — — 500 kHz
OS2 TECL_DC Clock Duty Cycle 40 — 60 %
ECM Clock
OS3 FECM Clock Frequency — — 8 MHz
OS4 TECM_DC Clock Duty Cycle 40 — 60 %
ECH Clock
OS5 FECH Clock Frequency — — 64 MHz
OS6 TECH_DC Clock Duty Cycle 40 — 60 %
LP Oscillator
OS7 FLP Clock Frequency — — 100 kHz Note 4
XT Oscillator
OS8 FXT Clock Frequency — — 4 MHz Note 4
HS Oscillator
OS9 FHS Clock Frequency — — 20 MHz Note 4
Secondary Oscillator
OS10 FSEC Clock Frequency 32.4 32.768 33.1 kHz
System Oscillator
OS20 FOSC System Clock Frequency — — 64 MHz (Note 2, Note 3)
* 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 consumption. All devices are tested to operate at “min” values with an external clock applied to OSC1 pin.
When an external clock input is used, the “max” cycle time limit is “DC” (no clock) for all devices.
2: The system clock frequency (FOSC) is selected by the “main clock switch controls” as described in Section 10.0
“Power-Saving Operation Modes”.
3: The system clock frequency (FOSC) must meet the voltage requirements defined in the Section 44.2 “Standard
Operating Conditions”.
4: LP, XT and HS oscillator modes require an appropriate crystal or resonator to be connected to the device. For clocking
the device with the external square wave, one of the EC mode selections must be used.
Param
Sym. Characteristic Min. Typ† Max. Units Conditions
No.
OS21 FCY Instruction Frequency — FOSC/4 — MHz
OS22 TCY Instruction Period 62.5 1/FCY — ns
* 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 consumption. All devices are tested to operate at “min” values with an external clock applied to OSC1 pin.
When an external clock input is used, the “max” cycle time limit is “DC” (no clock) for all devices.
2: The system clock frequency (FOSC) is selected by the “main clock switch controls” as described in Section 10.0
“Power-Saving Operation Modes”.
3: The system clock frequency (FOSC) must meet the voltage requirements defined in the Section 44.2 “Standard
Operating Conditions”.
4: LP, XT and HS oscillator modes require an appropriate crystal or resonator to be connected to the device. For clocking
the device with the external square wave, one of the EC mode selections must be used.
Param
Sym. Characteristic Min. Typ† Max. Units Conditions
No.
OS50 FHFOSC Precision Calibrated HFINTOSC — 4 — MHz (Note 2)
Frequency 8
12
16
48
64
OS51 FHFOSCLP Low-Power Optimized HFINTOSC 0.92 1 1.08 MHz -40°C to 85°C
Frequency 1.84 2 2.16 MHz -40°C to 85°C
0.88 1 1.12 MHz -40°C to 125°C
1.76 2 2.24 MHz -40°C to 125°C
OS53* FLFOSC Internal LFINTOSC Frequency 24.80 31 37.2 kHz
OS54* THFOSCST HFINTOSC — 11 20 s VREGPM = 0
Wake-up from Sleep Start-up — 50 — s VREGPM = 1
Time
OS56 TLFOSCST LFINTOSC — 0.2 — 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 44-6: Precision Calibrated HFINTOSC and MFINTOSC Frequency Accuracy Over Device VDD
and Temperature.
125
± 5%
85
± 3%
Temperature (°C)
60
± 2%
0
± 5%
-40
1.8 2.0 2.3 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
VDD
MCLR
RST01
Internal
POR
RST04
PWRT
Time-out RST05
OSC
Start-up Time
Internal Reset(1)
Watchdog Timer
Reset(1)
RST03
RST02
RST02
I/O pins
VDD
VBOR and VHYST
VBOR
RST08
Reset
RST04(1)
(due to BOR)
Param
Sym. Characteristic Min. Typ† Max. Units Conditions
No.
Param
Sym. Characteristic Min. Typ† Max. Units Conditions
No.
Using FOSC as the ADC clock
AD20 1 — 9 s
source ADCS = 1
TAD ADC Clock Period
Using ADCRC as the ADC clock
AD21 — 2 — s
source ADCS = 0
Using FOSC as the ADC clock
— 14 TAD + 2 TCY — —
source ADCS = 1
AD22 TCNV Conversion Time
Using ADCRC as the ADC clock
— 16 TAD + 2 TCY — —
source ADCS = 0
Using FOSC as the ADC clock
— 2 TAD + 1 TCY — —
source ADCS = 1
Sample and Hold Capacitor
AD24 THCD Using ADCRC as the ADC clock
Disconnect Time
— 3 TAD + 2 TCY — — source ADCS = 0
BSF ADCON0, GO
1 TCY
AD22
AD24 1 TCY
1 TCY AD20
ADC_clk
ADIF
GO DONE
BSF ADCON0, GO
1 TCY
AD22
AD24
2 TCY(1) AD21
ADC_clk
ADIF
GO DONE
Note 1: If the ADC clock source is selected as ADCRC, a time of TCY is added before the ADC clock starts. This
allows the SLEEP instruction to be executed.
Param
Sym. Characteristics Min. Typ. Max. Units Comments
No.
CM01 VIOFF Input Offset Voltage — — ±60 mV VICM = VDD/2
CM02 VICM Input Common Mode Range GND — VDD V
CM03 CMRR Common Mode Input Rejection Ratio — 50 — dB
CM04 VHYST Comparator Hysteresis 10 25 40 mV
CM05 TRESP(1) Response Time, Rising Edge — 300 900 ns
Response Time, Falling Edge — 220 500 ns
* These parameters are characterized but not tested.
Note 1: Response time measured with one comparator input at VDD/2, while the other input transitions from VSS to VDD.
2: A mode change includes changing any of the control register values, including module enable.
Param
Sym. Characteristics Min. Typ. Max. Units Comments
No.
Param.
Symbol Characteristic Min. Typ. Max. Units Conditions
No.
FVR01 VFVR1 1x Gain (1.024V) -4 — +4 % VDD 2.5V, -40°C to 85°C
FVR02 VFVR2 2x Gain (2.048V) -4 — +4 % VDD 2.5V, -40°C to 85°C
FVR03 VFVR4 4x Gain (4.096V) -5 — +5 % VDD 4.75V, -40°C to 85°C
FVR04 TFVRST FVR Start-up Time — 25 — us
Param.
Sym. Characteristics Min Typ† Max Units Comments
No.
ZC01 VPINZC Voltage on Zero Cross Pin — 0.75 — V
ZC02 IZCD_MAX Maximum source or sink current — — 600 A
ZC03 TRESPH Response Time, Rising Edge — 1 — s
TRESPL Response Time, Falling Edge — 1 — s
† Data in “Typ” column is at 3.0V, 25°C unless otherwise stated. These parameters are for design guidance only and are not tested.
T0CKI
40 41
42
T1CKI
45 46
47 49
TMR0 or
TMR1
CC01 CC02
CC03
SS
SP81
SCK
(CKP = 0)
SP71 SP72
SP78 SP79
SCK
(CKP = 1)
SP79 SP78
SP80
SP75, SP76
SP74
SP73
SS
SP81
SCK
(CKP = 0)
SP71 SP72
SP79
SP73
SCK
(CKP = 1)
SP80
SP78
SP75, SP76
SP74
SS
SP70
SCK SP83
(CKP = 0)
SP71 SP72
SP78 SP79
SCK
(CKP = 1)
SP79 SP78
SP80
SP74
SP73
SP82
SS
SP70
SCK SP83
(CKP = 0)
SP71 SP72
SCK
(CKP = 1)
SP80
SP77
SP75, SP76
SDI
MSb In bit 6 - - - -1 LSb In
SP74
Param
Symbol Characteristic Min. Typ† Max. Units Conditions
No.
Param
Symbol Characteristic Min. Typ† Max. Units Conditions
No.
SCL
SP91 SP93
SP90 SP92
SDA
Start Stop
Condition Condition
Param
Symbol Characteristic Min. Typ Max. Units Conditions
No.
SP90* TSU:STA Start condition 100 kHz mode 4700 — — ns Only relevant for Repeated Start
Setup time 400 kHz mode 600 — — condition
1 MHz mode 260 — —
SP91* THD:STA Start condition 100 kHz mode 4000 — — ns After this period, the first clock
Hold time 400 kHz mode 600 — — pulse is generated
1 MHz 260 — —
SP92* TSU:STO Stop condition 100 kHz mode 4000 — — ns
Setup time 400 kHz mode 600 — —
1 MHz 260 — —
SP93 THD:STO Stop condition 100 kHz mode 4700 — — ns
Hold time 400 kHz mode 1300 — —
1 MHz 500 — —
* These parameters are characterized but not tested.
SCL
SP90
SP106
SP107
SP91 SP92
SDA
In
SP110
SP109
SP109
SDA
Out
Param.
Symbol Characteristic Min. Max. Units Conditions
No.
SP100* THIGH Clock high time 100 kHz mode 4000 — ns Device must operate at a
minimum of 1.5 MHz
400 kHz mode 600 — ns Device must operate at a
minimum of 10 MHz
1 MHz module 260 — ns Device must operate at a
minimum of 10 MHz
SP101* TLOW Clock low time 100 kHz mode 4700 — ns Device must operate at a
minimum of 1.5 MHz
400 kHz mode 1300 — ns Device must operate at a
minimum of 10 MHz
1 MHz module 500 — — Device must operate at a
minimum of 10 MHz
SP102* TR SDA and SCL rise 100 kHz mode — 1000 ns
time 400 kHz mode 20 300 ns CB is specified to be from
10-400 pF
1 MHz module — 120 ns
SP103* TF SDA and SCL fall time 100 kHz mode — 250 ns
400 kHz mode 20 X (VDD/ 250 ns CB is specified to be from
5.5V) 10-400 pF
1 MHz module 20 X (VDD/ 120 ns
5.5V)
SP106* THD:DAT Data input hold time 100 kHz mode 0 — ns
400 kHz mode 0 — ns
1 MHz module 0 — ns
(2)
SP107* TSU:DAT Data input setup time 100 kHz mode 250 — ns
400 kHz mode 100 — ns
1 MHz module 50 — ns
SP109* TAA (1)
Output valid from 100 kHz mode — 3450 ns
clock 400 kHz mode — 900 ns
1 MHz module — 450 ns
SP110* TBUF Bus free time 100 kHz mode 4700 — ns Time the bus must be free
400 kHz mode 1300 — ns before a new transmission
can start
1 MHz module 500 — ns
SP111 CB Bus capacitive loading — 400 pF
* These parameters are characterized but not tested.
Note 1: As a transmitter, the device must provide this internal minimum delay time to bridge the undefined region (min. 300 ns)
of the falling edge of SCL to avoid unintended generation of Start or Stop conditions.
2: A Fast mode (400 kHz) I2C bus device can be used in a Standard mode (100 kHz) I2C bus system, but the requirement
TSU:DAT 250 ns must then be met. This will automatically be the case if the device does not stretch the low period of
the SCL signal. If such a device does stretch the low period of the SCL signal, it must output the next data bit to the SDA
line TR max. + TSU:DAT = 1000 + 250 = 1250 ns (according to the Standard mode I2C bus specification), before the SCL
line is released.
Param
Symbol Characteristic Min. Typ† Max. Units Conditions
No.
TS01* TACQMIN Minimum ADC Acquisition Time Delay — 25 — µs
TS02* MV Voltage Sensitivity High Range — -3.684 — mV/°C TSRNG = 1
Low Range — -2.456 — mV/°C TSRNG = 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.
1,000 800
Max: 85°C + 3ı Max: 85°C + 3ı
Typical: 25°C Typical: 25°C
900
700
800 Max
600
700
Max
IDD (µA)
Typical
IDD (µA)
600 500
500 Typical
400
400
300
300
200
200
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 45-1: IDD, XT Oscillator, 4 MHz, FIGURE 45-4: IDD, XT Oscillator, 4 MHz,
PIC18LF26/45/46/55/56K42 Only. PMD’s All ‘1’s, PIC18F26/45/46/55/56K42 Only.
1,000 15.0
Max: 85°C + 3ı Max: 85°C + 3ı
Typical: 25°C 14.0 Typical: 25°C
900 Max
13.0
12.0
800
Typical
11.0
IDD (µA)
IDD (mA)
700 10.0
Max
9.0
600
8.0
Typical
7.0
500
6.0
400 5.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 45-2: IDD, XT Oscillator, 4 MHz, FIGURE 45-5: IDD, HS+PLL Oscillator,
PIC18F26/45/46/55/56K42 Only. 64 MHz, PIC18LF26/45/46/55/56K42 Only.
700 15.0
Max: 85°C + 3ı Max: 85°C + 3ı
Typical: 25°C Typical: 25°C
14.0
600
13.0
Max
12.0
500
11.0
Max
IDD (µA)
IDD (mA)
Typical
400 10.0
9.0
Typical
300
8.0
7.0
200
6.0
100 5.0
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V) VDD (V)
FIGURE 45-3: IDD, XT Oscillator, 4 MHz, FIGURE 45-6: IDD, HS+PLL Oscillator,
PMD’s All ‘1’s, PIC18LF26/45/46/55/56K42 Only. 64 MHz, PIC18F26/45/46/55/56K42 Only.
10.0 16.0
Max: 85°C + 3ı Max: 85°C + 3ı
Typical: 25°C 15.0 Typical: 25°C
9.0
14.0
Max
8.0 13.0
12.0
7.0
IDD (mA)
IDD (mA)
6.0 10.0
9.0
5.0
Typical
8.0
4.0
7.0
6.0
3.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 45-7: IDD, HS+PLL Oscillator, FIGURE 45-10: IDD, HFINTOSC Mode,
64 MHz, PMD’s All ‘1’s, PIC18LF26/45/46/55/ Fosc = 64 MHz, PIC18F26/45/46/55/56K42
56K42 Only. Only.
10.0 12.0
Max: 85°C + 3ı Max: 85°C + 3ı
Typical: 25°C Typical: 25°C
11.0
9.0
Max 10.0
8.0
9.0
7.0 8.0
IDD (mA)
IDD (mA)
Max
Typical
7.0
6.0
Typical
6.0
5.0
5.0
4.0
4.0
3.0 3.0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 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 45-8: IDD, HS+PLL Oscillator, FIGURE 45-11: IDD, HFINTOSC Mode,
64 MHz, PMD’s All ‘1’s, PIC18F26/45/46/55/ Fosc = 64 MHz, PMD’s All ‘1’s, PIC18LF26/45/
56K42 Only. 46/55/56K42 Only.
16.0 12.0
Max: 85°C + 3ı Max: 85°C + 3ı
15.0 Typical: 25°C Typical: 25°C
11.0
14.0
10.0
13.0
Max
9.0
12.0
IDD (mA)
IDD (mA)
9.0
Typical
6.0
8.0
5.0
7.0
6.0 4.0
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V) VDD (V)
FIGURE 45-9: IDD, HFINTOSC Mode, FIGURE 45-12: IDD, HFINTOSC Mode,
Fosc = 64 MHz, PIC18LF26/45/46/55/56K42 Fosc = 16 MHz, PIC18F26/45/46/55/56K42
Only. Only.
5.0 3.0
Max: 85°C + 3ı Max: 85°C + 3ı
Typical: 25°C Typical: 25°C
4.5 Max
2.5
4.0
Typical
3.5
2.0
IDD (mA)
IDD (mA)
3.0 Max
2.5 1.5
Typical
2.0
1.0
1.5
1.0 0.5
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
VDD (V) VDD (V)
FIGURE 45-13: IDD, HFINTOSC Mode, FIGURE 45-16: IDD, HFINTOSC Mode,
Fosc = 16 MHz, PIC18LF26/45/46/55/56K42 Fosc = 16 MHz, PMD’s All ‘1’s, PIC18F26/45/46/
Only. 55/56K42 Only.
5.0 3.0
Max: 85°C + 3ı Max: 85°C + 3ı
Typical: 25°C Typical: 25°C
4.5
2.5
4.0
Max
3.5 2.0
IDD (mA) Max
IDD (mA)
3.0
Typical
1.5 Typical
2.5
2.0
1.0
1.5
1.0 0.5
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 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 45-14: IDD, HFINTOSC Mode, FIGURE 45-17: IDD, HFINTOSC Idle Mode,
Fosc = 16 MHz, PIC18F26/45/46/55/56K42 Fosc = 16 MHz, PIC18LF26/45/46/55/56K42
Only. Only.
3.0 3.0
Max: 85°C + 3ı Max: 85°C + 3ı
Typical: 25°C Typical: 25°C
2.5 2.5
Max
Max
2.0 2.0
Typical
IDD (mA)
IDD (mA)
1.5 Typical
1.5
1.0 1.0
0.5 0.5
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
VDD (V) VDD (V)
FIGURE 45-15: IDD, HFINTOSC Mode, FIGURE 45-18: IDD, HFINTOSC Idle Mode,
Fosc = 16 MHz, PMD’s All ‘1’s, PIC18LF26/45/ Fosc = 16 MHz, PIC18F26/45/46/55/56K42
46/55/56K42 Only. Only.
1,000
6 Max: 85°C + 3ı
Max: 85°C + 3ı
Typical: 25°C
Typical: 25°C
Max
900
5
Max
800 Typical
4
IDD (µA)
IDD (mA)
700
3
600
2
Typical
500
1
400
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 45-19: IDD, HFINTOSC Doze FIGURE 45-22: IDD, XT Oscillator 4 MHz,
Mode, Fosc = 16 MHz, PIC18LF26/45/46/55/ PIC18F27/47/57K42 Only
56K42 Only.
6 700
Max: 85°C + 3ı Max: 85°C + 3ı
Typical: 25°C Typical: 25°C
5 Max 600
Max
4 500
IDD (mA)
IDD (µA)
Typical
3 400
2 300
Typical
1 200
0 100
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 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 45-20: IDD, HFINTOSC Doze FIGURE 45-23: IDD, XT Oscillator 4 MHz,
Mode, Fosc = 16 MHz, PIC18F26/45/46/55/ PMD’s All ‘1’s, PIC18LF27/47/57K42 Only
56K42 Only.
1,000 800
Max: 85°C + 3ı Max: 85°C + 3ı
Typical: 25°C Typical: 25°C Max
900
700
Typical
800
Max
600
700
IDD (µA)
IDD (µA)
600 Typical
500
500
400
400
300
300
200
200
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 45-21: IDD, XT Oscillator 4 MHz, FIGURE 45-24: IDD, XT Oscillator 4 MHz,
PIC18LF27/47/57K42 Only PMD’s All ‘1’s, PIC18F27/47/57K42 Only
18.0 15.0
Max: 85°C + 3ı Max: 85°C + 3ı
Typical: 25°C 14.0 Typical: 25°C
16.0
13.0
12.0
14.0
11.0
Max
IDD (mA)
IDD (mA)
12.0 10.0
Max
9.0
10.0 Typical
8.0
Typical
7.0
8.0
6.0
6.0 5.0
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
FIGURE 45-25: IDD, HS+PLL Oscillator, FIGURE 45-28: IDD, HS+PLL Oscillator,
64 MHz, PIC18LF27/47/57K42 Only. 64 MHz, PMD’s All ‘1’s, PIC18F27/47/57K42
Only.
18.0
18.0 Max: 85°C + 3ı
Max: 85°C + 3ı
17.0 Typical: 25°C
Typical: 25°C
16.0 16.0
Max 15.0
14.0
14.0
IDD (mA)
IDD (mA)
Typical 13.0
12.0
Max
12.0
10.0 11.0
Typical
10.0
8.0
9.0
8.0
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
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
VDD (V)
FIGURE 45-26: IDD, HS+PLL Oscillator, FIGURE 45-29: IDD, HFINTOSC Mode,
64 MHz, PIC18F27/47/57K42 Only. FOSC = 64 MHz, PIC18LF27/47/57K42 Only.
12.0 16.0
Max: 85°C + 3ı Max: 85°C + 3ı
Typical: 25°C Typical: 25°C
11.0 15.0
Max
10.0 14.0
Typical
9.0 13.0
IDD (mA)
IDD (mA)
Max 12.0
8.0
7.0 11.0
9.0
5.0
8.0
4.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 45-27: IDD, HS+PLL Oscillator, FIGURE 45-30: IDD, HFINTOSC Mode,
64 MHz, PMD’s All ‘1’s, PIC18LF27/47/57K42 FOSC = 64 MHz, PIC18F27/47/57K42 Only.
Only.
12.0 5.0
Max: 85°C + 3ı Max: 85°C + 3ı
Typical: 25°C Typical: 25°C
11.0 4.5
Max
10.0 4.0
Max Typical
IDD (mA)
IDD (mA)
9.0 3.5
Typical
8.0 3.0
7.0 2.5
6.0 2.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
FIGURE 45-31: IDD, HFINTOSC Mode, FIGURE 45-34: IDD, HFINTOSC Mode,
Fosc = 64 MHz, PMD’s All ‘1’s, FOSC = 16 MHz, PIC18F27/47/57K42 Only.
PIC18LF27/47/57K42 Only.
12.0
4.0
Max: 85°C + 3ı Max: 85°C + 3ı
Typical: 25°C Typical: 25°C
11.0
3.5
Max
10.0
3.0
Typical
Max
IDD (mA)
IDD (mA)
9.0
2.5
Typical
8.0
2.0
7.0
1.5
6.0
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 1.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 45-32: IDD, HFINTOSC Mode, FIGURE 45-35: IDD, HFINTOSC Mode,
Fosc = 64 MHz, PMD’s All ‘1’s, Fosc = 16 MHz, PMD’s All ‘1’s,
PIC18F27/47/57K42 Only. PIC18LF27/47/57K42 Only.
5.0 4.0
Max: 85°C + 3ı Max: 85°C + 3ı
Typical: 25°C Typical: 25°C
4.5
3.5
4.0
Max
Max
3.5 3.0
IDD (mA)
IDD (mA)
Typical
3.0 Typical
2.5
2.5
2.0
2.0
1.5
1.5
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
VDD (V)
VDD (V)
FIGURE 45-33: IDD, HFINTOSC Mode, FIGURE 45-36: IDD, HFINTOSC Mode,
FOSC = 16 MHz, PIC18LF27/47/57K42 Only. FOSC = 16 MHz, PMD’s All ‘1’s, PIC18F27/47/
57K42 Only.
3.0 6
Max: 85°C + 3ı Max: 85°C + 3ı
Typical: 25°C Typical: 25°C
5
2.5
Max
4
2.0
IDD (mA)
IDD (mA)
Max
3
1.5 Typical
2
Typical
1.0
1
0.5 0
1.6 1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 3.8 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
FIGURE 45-37: IDD, HFINTOSC Idle Mode, FIGURE 45-40: IDD, HFINTOSC Doze
Fosc = 16 MHz, PIC18LF27/47/57K42 Only. Mode, Fosc = 16 MHz, PIC18F27/47/57K42
Only.
3.0 600
Max: 85°C + 3ı Max: 85°C + 3ı
Typical: 25°C Typical: 25°C
500
2.5 Max.
Max
400
Typical
2.0 IPD (nA)
IDD (mA)
300
1.5
200
1.0 100
Typical
0
0.5 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
VDD (V)
VDD (V)
FIGURE 45-38: IDD, HFINTOSC Idle Mode, FIGURE 45-41: IPD, Base, LP Sleep Mode,
Fosc = 16 MHz, PIC18F27/47/57K42 Only. PIC18LF26/27/45/46/47/55/56/57K42 Only.
6 2.0
Max: 85°C + 3ı Max: 85°C + 3ı
Typical: 25°C 1.8 Typical: 25°C
5
1.6
Max 1.4
4
1.2
IPD (µA)
Max.
IDD (mA)
3 1.0
0.8 Typical
2 0.6
0.4
Typical
1
0.2
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 45-39: IDD, HFINTOSC Doze FIGURE 45-42: IPD, Watchdog Timer
Mode, Fosc = 16 MHz, PIC18LF27/47/57K42 (WDT), PIC18LF26/27/45/46/47/55/56/57K42
Only. Only.
1.6
11.0
1.4 Max.
10.5
IPD (µA)
1.2
IPD (µA)
Typical
1.0 10.0 Max.
0.8 9.5
Typical
0.6
9.0
0.4
8.5
0.2
0.0 8.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 45-43: IPD, Watchdog Timer FIGURE 45-46: IPD, Brown-Out Reset
(WDT), PIC18F26/27/45/46/47/55/56/57K42 (BOR), PIC18LF26/27/45/46/47/55/56/57K42
Only. Only.
60 14.0
Max: 85°C + 3ı Max: 85°C + 3ı
Typical: 25°C Typical: 25°C
55
13.0
50
12.0
IPD (µA)
45 Max.
IPD (µA)
40 11.0
Max.
35
10.0 Typical
Typical
30
9.0
25
20 8.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 45-44: IPD, Fixed Voltage FIGURE 45-47: IPD, Brown-Out Reset
Reference (FVR), PIC18LF26/27/45/46/47/55/ (BOR), PIC18F26/27/45/46/47/55/56/57K42
56/57K42 Only. Only.
1
60 Max: 85°C + 3ı
Max: 85°C + 3ı Typical: 25°C
Typical: 25°C 0.9
55
0.8
50
0.7
Max.
45 0.6
IPD (µA)
0.5 Max.
40
IPD (µA)
0.4
35 Typical
0.3
30
0.2
Typical
25 0.1
0
20 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 45-45: IPD, Fixed Voltage FIGURE 45-48: IPD, Low-Power Brown-Out
Reference (FVR), PIC18F26/27/45/46/47/55/56/ Reset (LPBOR), PIC18LF26/27/45/46/47/55/56/
57K42 Only. 57K42 Only.
1.0 70
Max: 85°C + 3ı Max: 85°C + 3ı
0.9 Typical: 25°C Typical: 25°C Max.
60
0.8
Max.
Typical
0.7 50
0.6
IPD (µA)
IPD (µA)
40
0.5
Typical 30
0.4
0.3 20
0.2
10
0.1
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
FIGURE 45-49: IPD, Low-Power Brown-Out FIGURE 45-52: IPD Base, NP Sleep Mode,
Reset (LPBOR), PIC18F26/27/45/46/47/55/56/ PIC18F26/27/45/46/47/55/56/57K42 Only.
57K42 Only.
40 1000
Max: 85°C + 3ı Max: 85°C + 3ı
38 Typical: 25°C Typical: 25°C
900
36 800
34 700
Max. Max.
32 600
IPD (nA)
IPD (µA)
30 500
28 400
Typical
26 300
Typical
24 200
22 100
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 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
FIGURE 45-50: IPD, Comparator, FIGURE 45-53: IPD Base, LP Sleep Mode,
PIC18LF26/27/45/46/47/55/56/57K42 Only. PIC18F26/27/45/46/47/55/56/57K42 Only
36 14.0
Max: 85°C + 3ı Max: 85°C + 3ı
Typical: 25°C Typical: 25°C
34
12.0
Max.
32
10.0 Max.
30
Typical
IPD (µA)
8.0
IPD (µA)
28
6.0
26 Typical
4.0
24
22 2.0
20 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
10
Typical
1.0%
Error (%)
8
IPD (µA)
-1.0%
6
4 -3.0%
2
-5.0%
1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6
0 VDD (V)
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V) Typical 25°C ı-40°C to +125°C) -ı-40°C to +125°C)
5.0 4.0%
Max: 85°C + 3ı
Typical: 25°C
3.0%
4.0
2.0%
1.0%
Error (%)
3.0
IPD (µA)
Max. 0.0%
-1.0%
2.0
-2.0%
-3.0%
1.0 Typical
-4.0%
2 2.5 3 3.5 4 4.5 5 5.5
0.0 VDD (V)
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) Typical 25°C ı-40°C to +125°C) -ı-40°C to +125°C)
5 2.5%
Max: 85°C + 3ı
Typical: 25°C 2.0%
4.5
1.5%
4
1.0%
3.5 Max. 0.5%
Error (%)
3 0.0%
IPD (µA)
2.5 -0.5%
-1.0%
2
-1.5%
1.5
Typical -2.0%
1 -2.5%
0.5 -3.0%
-50 0 50 100 150
0
Temperature (°C)
2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
4.0%
3.0%
2.0%
1.0%
Error (%)
Error (%)
0.0%
-1.0%
-2.0%
-3.0% -4.0%
-6.0%
-5.0%
2 2.5 3 3.5 4 4.5 5 5.5
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)
Typical 25°C ı-40°C to +125°C) -ı-40°C to +125°C) Typical 25°C ı-40°C to +125°C) -ı-40°C to +125°C)
4.0% 2.0%
3.0% 1.0%
0.0%
2.0%
-1.0%
1.0%
Error (%)
Error (%)
-2.0%
0.0%
-3.0%
-1.0%
-4.0%
-2.0%
-5.0%
-3.0%
-6.0%
-4.0% -7.0%
2 2.2 2.4 2.6 2.8 3 3.2 3.4 3.6 3.8 4 4.2 4.4 4.6 4.8 5 5.2 5.4 5.6 -50 0 50 100 150
VDD (V) Temperature (°C)
Typical 25°C ı-40°C to +125°C) -ı-40°C to +125°C) Typical +3 Sigma -3 Sigma
350.0
6.0%
300.0
4.0%
Pull-Up Current (µA)
250.0
2.0%
200.0
Error (%)
0.0%
150.0
-2.0%
100.0
-4.0%
50.0
-6.0% 0.0
1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V) VDD (V)
Typical 25°C ı-40°C to +125°C) -ı-40°C to +125°C) Typical 25°C ı-40°C to +125°C) - ı-40°C to +125°C)
140.0
2.5
120.0
2.0
VOH (V)
100.0
80.0
1.5
60.0 -40°C
40.0
1.0
Typical
20.0
0.5
0.0 125°C
1.8 2.0 2.2 2.4 2.6 2.8 3.0 3.2 3.4 3.6
0.0
VDD (V) -30 -25 -20 -15 -10 -5 0
Typical 25°C ı-40°C to +125°C) - ı-40°C to +125°C) IOH (mA)
FIGURE 45-67: Weak Pull-Up Current, FIGURE 45-70: VOH vs. IOH Over
PIC18LF26/27/45/46/47/55/56/57K42 Only. Temperature, VDD = 3.0V.
6 3.0
Graph represents 3ı Limits Graph represents 3ı Limits 125°C
5 2.5
-40°C
Typical
4 2.0
Typical
VOL (V)
VOH (V)
3 1.5
125°C
2 1.0
-40°C
1 0.5
0 0.0
-45 -40 -35 -30 -25 -20 -15 -10 -5 0 0 5 10 15 20 25 30 35 40 45 50 55 60
FIGURE 45-68: VOH vs. IOH Over FIGURE 45-71: VOL vs. IOL Over
Temperature, VDD = 5.5V, PIC18F26/27/45/46/ Temperature, VDD = 3.0V.
47/55/56/57K42 Only.
2.0
3 Graph represents 3ı Limits
Graph represents 3ı Limits
1.8
1.6
1.4
2 -40°C
1.2
Typical
VOH (V)
VOL (V)
125°C
1.0
0.8
125°C
1 0.6
Typical
0.4
-40°C
0.2
0.0
0
-8 -7.5 -7 -6.5 -6 -5.5 -5 -4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0
0 10 20 30 40 50 60
IOL (mA)
IOH (mA)
FIGURE 45-69: VOL vs. IOL Over FIGURE 45-72: VOH vs. IOH Over
Temperature, VDD = 5.5V, PIC18F26/27/45/46/ Temperature, VDD = 1.8V, PIC18LF26/27/45/46/
47/55/56/57K42 Only. 47/55/56/57K42 Only.
2.75
1.4
1.2
125°C Typical -40°C 2.70
Voltage (V)
VOL (V)
2.65
0.8
0.6
2.60
0.4
0.2 2.55
-60 -40 -20 0 20 40 60 80 100 120 140
0
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Temperature (°C)
FIGURE 45-73: VOL vs. IOL Over FIGURE 45-76: Brown-Out Reset Voltage,
Temperature, VDD = 1.8V, PIC18LF26/27/45/46/ Trip Point (BORV = 01).
47/55/56/57K42 Only
2.95 60.0
50.0
2.90
40.0
2.85
Voltage (V)
Voltage (mV)
30.0
2.80
20.0
2.75
10.0
2.70 0.0
-60 -40 -20 0 20 40 60 80 100 120 140 -60 -40 -20 0 20 40 60 80 100 120 140
Temperature (°C) Temperature (°C)
2.55
60.0
50.0
2.50
40.0
Voltage (V)
Voltage (mV)
2.45
30.0
20.0
2.40
10.0
2.35
0.0 -60 -40 -20 0 20 40 60 80 100 120 140
-60 -40 -20 0 20 40 60 80 100 120 140
Temperature (°C)
Temperature (°C)
+3 Sigma -3 Sigma Typical
Typical +3 Sigma -3 Sigma
50.0 2.30
45.0
2.20
40.0
35.0 2.10
Voltage (V)
Voltage (mV)
30.0
2.00
25.0
20.0
1.90
15.0
1.80
10.0 -60 -40 -20 0 20 40 60 80 100 120 140
-60 -40 -20 0 20 40 60 80 100 120 140
Temperature (°C)
Temperature (°C)
2.00
60
50
1.95
40
Voltage (V)
Voltage (mV)
1.90 30
20
1.85
10
1.80 0
-60 -40 -20 0 20 40 60 80 100 120 140 -60 -40 -20 0 20 40 60 80 100 120 140
Temperature (°C)
Temperature (°C)
FIGURE 45-80: Brown-Out Reset Voltage, FIGURE 45-83: LPBOR Reset Hysteresis.
Trip Point (BORV = 11), PIC18LF26/27/45/46/47/
55/56/57K42 Only.
50.0
45.0
40.0 HLVDSEL=0000
4.50
HLVDSEL=0001
35.0 HLVDSEL=0010
HLVDSEL=0011
30.0
Voltage (mV)
HLVDSEL=0100
HLVDSEL=0101
25.0
Voltage (V)
3.50 HLVDSEL=0110
HLVDSEL=0111
20.0
HLVDSEL=1000
HLVDSEL=1001
15.0
HLVDSEL=1010
50.0 5.0
45.0 4.5
40.0 4.0
35.0 3.5
30.0 3.0
Time (µs)
Voltage (mV)
25.0 2.5
20.0 2.0
15.0 1.5
10.0 1.0
5.0 0.5
0.0
0.0
-60 -40 -20 0 20 40 60 80 100 120 140
2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7
Temperature (°C) VDD (V)
6.0% 7
4.0% 6
5
2.0%
Time (µs)
Error (%)
4
0.0%
3
-2.0%
2
-4.0%
1
-6.0%
-60 -40 -20 0 20 40 60 80 100 120 140 0
2.6 2.8 3 3.2 3.4 3.6 3.8 4 4.2 4.4 4.6 4.8 5 5.2 5.4 5.6
Temperature (°C)
VDD (V)
Typical ı-40°C to +125°C) -ı-40°C to +125°C) Typical 25°C +3 Sigma 125°C
FIGURE 45-86: High/Low-Voltage Detect Trip FIGURE 45-89: BOR Response Time,
Voltage, Typical Error (HLVDSEL[3:0] = 0001). PIC18F26/27/45/46/47/55/56/57K42 Only.
6.0% 1.0
4.0%
2.0% 0.5
0.0%
DNL (LSb)
Error (%)
-2.0%
0.0
-4.0%
-6.0%
-0.5
-8.0%
-10.0%
-60 -40 -20 0 20 40 60 80 100 120 140 -1.0
0 512 1024 1536 2048 2560 3072 3584
Temperature (°C)
Output Code
Typical ı-40°C to +125°C) -ı-40°C to +125°C)
FIGURE 45-90: ADC 12-bit Mode, Single-
FIGURE 45-87: High/Low-Voltage Detect Trip Ended DNL, VDD = 3.0V, VREF = 3.0V, TAD = 1 S,
Voltage, Typical Error (HLVDSEL[3:0] = 0000). CP OFF, 25°C.
1.0 2.0
1.0
1.5
1.0
0.5 0.5
0.5
DNL (LSb)
0.0
DNL (LSb)
INL (LSb)
-0.5
0.0 0.0
-1.0
-1.5
-0.5 -2.0
-0.5
0 512 1024 1536 2048 2560 3072 3584 4096
Output Code
-1.0 -1.0
0 512 1024 1536 2048 2560 3072 3584 0 512 1024 1536 2048 2560 3072 3584
FIGURE 45-91: ADC 12-bit Mode, Single- FIGURE 45-94: ADC 12-bit Mode, Single-
Ended DNL, VDD = 3.0V, VREF = 3.0V, TAD = 1 S, Ended INL, VDD = 3.0V, VREF = 3.0V, TAD = 1 S,
CP ON, 25°C. CP ON, 25°C.
1.0 2.0
1.0
1.5
1.0
0.5 0.5
0.5
DNL (LSb)
DNL (LSb)
0.0
INL (LSb)
-0.5
0.0 0.0
-1.0
-1.5
-0.5 -2.0
-0.5
0 512 1024 1536 2048 2560 3072 3584 4096
Output Code
-1.0 -1.0
0 512 1024 1536 2048 2560 3072 3584 0 512 1024 1536 2048 2560 3072 3584
Output Code Output Code
FIGURE 45-92: ADC 12-bit Mode, Single- FIGURE 45-95: ADC 12-bit Mode, Single-
Ended DNL, VDD = 2.3V, VREF = 2.3V, Ended INL, VDD = 2.3V, VREF = 2.3V, TAD = 1 S,
TAD = 1 S, CP ON, 25°C. CP ON, 25°C.
1
1.0
Max 85°C
0.5
0.5 Max 25°C
DNL(LSB)
INL (LSb)
Max -40°C
0
0.0 Min 85°C
Min 25°C
-0.5
-0.5 Min -40°C
-1.0 -1
0 512 1024 1536 2048 2560 3072 3584 1.8 2.3 2.5 3
VREF
Output Code
FIGURE 45-93: ADC 12-bit Mode, Single- FIGURE 45-96: ADC 12-bit Mode, Single-
Ended INL, VDD = 3.0V, VREF = 3.0V, TAD = 1 S, Ended Typical DNL, VDD = 3.0V, TAD = 1 S,
CP OFF, 25°C. CP ON
0.02
Max 85°C
0.015
0.5
Max 25°C 0.01
INL(LSB)
DNL (LSb)
Max -40°C 0.005
-40°C
0
25°C
Min 85°C 0
85°C
-0.005 125°C
Min 25°C
-0.5
-0.01
Min -40°C
-0.015
-1 -0.02
1.8 2.3 2.5 3 0 16 32 48 64 80 96 112 128 144 160 176 192 208 224 240
VREF Output Code
FIGURE 45-97: ADC 12-bit Mode, Single- FIGURE 45-100: Typical DAC DNL Error,
Ended Typical INL, VDD = 3.0V, TAD = 1 S, VDD = 3.0V, VREF = External 3.0V.
CP ON.
5.0
0.00
4.5
-0.05
4.0
-0.10
3.5
3.0 -0.15
Time (µs)
2.5
INL (LSb)
-0.20
-40°C
2.0 25°C
-0.25
1.5 85°C
-0.30 125°C
1.0
0.5 -0.35
0.0 -0.40
1.7 1.9 2.1 2.3 2.5 2.7 2.9 3.1 3.3 3.5 3.7
VDD (V)
-0.45
Typical 25°C ı-40°C to +125°C) -ı-40°C to +125°C) 0 14 28 42 56 70 84 98 112 126 140 154 168 182 196 210 224 238 252
Output Code
FIGURE 45-98: ADC RC Oscillator Period, FIGURE 45-101: Typical DAC INL Error,
PIC18LF26/27/45/46/47/55/56/57K42 Only. VDD = 3.0V, VREF = External 3.0V.
0.020
4.0
3.5 0.015
3.0 0.010
2.5
Time (µs)
DNL (LSb)
0.005
-40°C
2.0
25°C
0.000
1.5 85°C
125°C
1.0 -0.005
0.5
-0.010
0.0
2.2 2.4 2.6 2.8 3 3.2 3.4 3.6 3.8 4 4.2 4.4 4.6 4.8 5 5.2 5.4 5.6 -0.015
VDD (V) 0 14 28 42 56 70 84 98 112126140154168182196210224238252
Output Code
Typical 25°C ı-40°C to +125°C) -ı-40°C to +125°C)
FIGURE 45-99: ADC RC Oscillator Period, FIGURE 45-102: Typical DAC DNL Error,
PIC18F26/27/45/46/47/55/56/57K42 Only. VDD = 5.0V, VREF = External 5.0V,
PIC18F26/27/45/46/47/55/56/57K42 Only.
0.00 0.90
-2.1
-0.05
-2.3
0.88
-2.7
0.86 Vref = Ext. 1.8V -40
-0.15
AbsoluteAbsolute
Vref = Ext. 2.0V 25
-2.9
INL (LSb)
-0.20 85
-40°C Vref = Ext. 3.0V
0.84 125
25°C -3.1
-0.25
85°C -3.3
-0.30 125°C 0.82
-3.5
0.0 1.0 2.0 3.0 4.0 5.0
-0.35
Temperature (°C)
0.80
-0.40
-0.45 0.78
0 14 28 42 56 70 84 98 112 126 140 154 168 182 196 210 224 238 252 -60.0 -40.0 -20.0 0.0 20.0 40.0 60.0 80.0 100.0 120.0 140.0
Output Code Temperature (°C)
FIGURE 45-103: Typical DAC INL Error, FIGURE 45-106: Absolute Value of DAC INL
VDD = 5.0V, VREF = External 5.0V Error, VDD = 3.0V, VREF = VDD.
PIC18F26/27/45/46/47/55/56/57K42 Only.
0.30
0.3
24
0.25
22 Vref = Int. Vdd
DNL (LSb)
Max. 0.26
0.2 Vref = Ext. 1.8V
20
Vref = Ext. 2.0V -40
DNL (LSb)
0.15
25
AbsoluteAbsolute
0.22
DNL (LSb)
14 0
0.0 1.0 2.0 3.0 4.0 5.0 6.0
Min. Max: Typical + 3ı (-40°C to 0.14 Temperature (°C)
12 +125°C)
Typical; statistical mean @ 25°C
Min: Typical - 3ı (-40°C to +125°C)
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 0.10
-60.0 -40.0 -20.0 0.0 20.0 40.0 60.0 80.0 100.0 120.0 140.0
Output Code Temperature (°C)
FIGURE 45-104: DAC INL Error, FIGURE 45-107: Absolute Value of DAC DNL
VDD = 3.0V, PIC18LF26/27/45/46/47/55/56/ Error, VDD = 5.0V, VREF = VDD, PIC18F26/27/45/
57K42 Only. 46/47/55/56/57K42 Only
0.4
0.45 0.9
-2.1
0.4
-2.3
0.35 Vref = Int. Vdd 0.88 Vref = Int. Vdd
INL (LSb)INL (LSb)
DNL (LSb)
0.2
-2.9 Vref = Ext. 5.0V
Vref = Ext. 2.0V 85
0.15 0.84
0.2 Vref = Ext. 3.0V -3.1 125
0.1
-3.3
0.05
0.82
0 -3.5
0.1 -50 0 50 100 150 0.0 1.0 2.0 3.0 4.0 5.0 6.0
Temperature (°C) Temperature (°C)
0.8
0.0 0.78
-60 -40 -20 0 20 40 60 80 100 120 140 -60.0 -40.0 -20.0 0.0 20.0 40.0 60.0 80.0 100.0 120.0 140.0
Temperature (°C) Temperature (°C)
FIGURE 45-105: Absolute Value of DAC DNL FIGURE 45-108: Absolute Value of DAC INL
Error, VDD = 3.0V, VREF = VDD. Error, VDD = 5.0V, VREF = VDD, PIC18F26/27/45/
46/47/55/56/57K42 Only.
45 50
43
45
41
39
40
Hysteresis (mV)
Hysteresis (mV)
37
35 35
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
30 30
25 25
20 20
15 15
Hysteresis (mV)
Offset Voltage (mV)
10 10
MAX
MAX
5 5
0 0
-5 -5
MIN MIN
-10 -10
-15 -15
-20 -20
0.0 0.5 1.0 1.5 2.0 2.5 3.0 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0
40
30
25 30
20
Offset Voltage (mV)
20
15
Offset Voltage (mV)
10
MAX 10
MAX
5
0 0
-5
MIN MIN
-10
-10
-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
Common Mode Voltage (V)
Common Mode Voltage (V)
140 800
Max: Typical + 3ı (-40°C to +125°C) Max: Typical + 3ı (-40°C to +125°C)
Typical; statistical mean @ 25°C Typical; statistical mean @ 25°C
Min: Typical - 3ı (-40°C to +125°C) 700 Min: Typical - 3ı (-40°C to +125°C)
120
600
100
125°C 500
Time (ns)
Time (ns)
80
125°C
400
25°C
60
300
25°C
40
200
-40°C
20 100
-40°C
0 0
1.7 2.0 2.3 2.6 2.9 3.2 3.5 2.2 2.5 2.8 3.1 3.4 3.7 4 4.3 4.6 4.9 5.2 5.5
FIGURE 45-115: Comparator Response Time FIGURE 45-118: Comparator Output Filter
Over Voltage, NP Mode (CxSP = 1), Typical Delay Time Over Temp., NP Mode (CxSP = 1),
Measured Values, PIC18LF26/27/45/46/47/55/56/ Typical Measured Values, PIC18F26/27/45/46/47/
57K42 Only. 55/56/57K42 Only.
90 300
Max: Typical + 3ı (-40°C to +125°C)
Typical; statistical mean @ 25°C
80 Min: Typical - 3ı (-40°C to +125°C)
250
70
125°C
60 200
Time (ns)
Time (ns)
50
25°C 150
40
100
30
-40°C
20 50
10
0
0 1.7 1.9 2.1 2.3 2.5 2.7 2.9 3.1 3.3 3.5 3.7
2.2 2.5 2.8 3.1 3.4 3.7 4.0 4.3 4.6 4.9 5.2 5.5 VDD (V)
FIGURE 45-116: Comparator Response Time FIGURE 45-119: Comparator Response Time
Over Voltage, NP Mode (CxSP = 1), Typical Falling Edge, PIC18LF26/27/45/46/47/55/56/
Measured Values, PIC18F26/27/45/46/47/55/56/ 57K42 Only.
57K42 Only
1,400 250
Max: Typical + 3ı (-40°C to +125°C)
Typical; statistical mean @ 25°C
Min: Typical - 3ı (-40°C to +125°C)
1,200
200
1,000
Time (ns)
150
Time (ns)
800
125°C
600
100
400 25°C
50
200
-40°C
0 0
1.8 2 2.2 2.4 2.6 2.8 3 3.2 3.4 3.6 2.2 2.4 2.6 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
VDD (V)
VDD (V)
Typical 25°C +3 Sigma 125°C
FIGURE 45-117: Comparator Output Filter FIGURE 45-120: Comparator Response Time
Delay Time Over Temp., NP Mode (CxSP = 1), Falling Edge, PIC18F26/27/45/46/47/55/56/57K42
Typical Measured Values, PIC18LF26/27/45/46/ Only.
47/55/56/57K42 Only.
700 70
600 60
500 50
40
Time (µs)
Time (ns)
400
300 30
200 20
100 10 Note:
The FVR Stabiliztion Period applies when coming out of
RESET or exiting sleep mode.
0 0
1.7 1.9 2.1 2.3 2.5 2.7 2.9 3.1 3.3 3.5 3.7 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 45-121: Comparator Response Time FIGURE 45-124: FVR Stabilization Period,
Rising Edge, PIC18LF26/27/45/46/47/55/56/57K42 PIC18LF26/27/45/46/47/55/56/57K42 Only.
Only.
900
1.1%
800
1.0%
700
0.9%
600 0.8%
0.7%
Time (ns)
500
0.5%
300
0.4%
200
0.3%
100 0.2%
0 0.1%
2.2 2.4 2.6 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
0.0%
VDD (V) 2.4 2.5 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7
VDD (V)
Typical 25°C +3 Sigma 125°C
Typical -40°C Typical 25°C Typical 85°C Typical 125°C
FIGURE 45-122: Comparator Response Time FIGURE 45-125: Typical FVR Voltage 1x,
Rising Edge, PIC18F26/27/45/46/47/55/56/57K42 PIC18LF26/27/45/46/47/55/56/57K42 Only.
Only.
1.2%
70
1.0%
60
0.8%
50
Error (%)
Time (µs)
0.6%
40
30 0.4%
20 0.2%
10 0.0%
1.6 1.8 2 2.2 2.4 2.6 2.8 3 3.2 3.4 3.6 3.8 2.4 2.6 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
VDD (V) VDD (V)
Typical 25°C ı-40°C to +125°C) Typical -40°C Typical 25°C Typical 85°C Typical 125°C
1.0% 4
3.5
0.8%
3
0.6%
2.5
Voltage (V)
Error (%)
0.4%
2
0.2% 1.5
0.0% 1
0.5
-0.2%
0
1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
-0.4%
2.4 2.5 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7
VDD (V)
VDD (V)
Typical -40°C Typical 25°C Typical 85°C Typical 125°C Typical 25°C ı-40°C to +125°C) -ı-40°C to +125°C)
FIGURE 45-127: FVR Voltage Error 2x, FIGURE 45-130: Schmitt Trigger High Values.
PIC18LF26/27/45/46/47/55/56/57K42 Only.
1.0%
2.5
0.8%
2
0.6%
Voltage (V)
1.5
Error (%)
0.4%
1
0.2%
0.5
0.0%
-0.2% 0
2.4 2.6 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.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
Typical -40°C Typical 25°C Typical 85°C Typical 125°C Typical 25°C ı-40°C to +125°C) -ı-40°C to +125°C)
0.8% 1.4
Voltage (V)
1.2
0.6%
1
Error (%)
0.4% 0.8
0.6
0.2%
0.4
0.0% 0.2
0
-0.2% 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5
VDD (V)
-0.4%
4.7 4.8 4.9 5.0 5.1 5.2 5.3 5.4 5.5 5.6 Typical 25°C ı-40°C to +125°C) -ı-40°C to +125°C)
VDD (V)
45 18
40 16
35 14
30 12
Time (ns)
Time (ns)
25 10
20 8
15 6
10 4
5 2
0 0
1.5 2.5 3.5 4.5 5.5 1.5 2.5 3.5 4.5 5.5
VDD (V) VDD (V)
Typical 25°C +3 Sigma (-40°C to 125°C) Typical 25°C +3 Sigma (-40°C to 125°C)
FIGURE 45-133: Rise Time, Slew Rate FIGURE 45-136: Fall Time, Slew Rate Control
Control Enabled. Disabled.
60 4.00%
Max: Typical + 3ı (-40°C to +125°C)
Typical; statistical mean @ 25°C
50 3.00% Min: Typical - 3ı (-40°C to +125°C)
2.00%
40
Time (ns)
1.00%
30
Error (%)
Max
0.00%
Min
20
-1.00% Average
10
-2.00%
0
-3.00%
1.5 2.5 3.5 4.5 5.5
VDD (V)
-4.00%
-32 -24 -16 -8 0 8 16 24 32
Min Center Max
Typical 25°C +3 Sigma (-40°C to 125°C) OSCTUNE Setting
FIGURE 45-134: Fall Time, Slew Rate Control FIGURE 45-137: OSCTUNE Center
Enabled. Frequency, PIC18LF26/27/45/46/47/55/56/57K42
Only.
30 1.6
1.55
25
1.5 +3 Sigma
20 1.45
Time (ns)
Typical
Voltage (V)
1.4
15
1.35
10 1.3 -3 Sigma
1.25
5
1.2
0
1.15
1.5 2.5 3.5 4.5 5.5
VDD (V) 1.1
-60 -40 -20 0 20 40 60 80 100 120 140
FIGURE 45-135: Rise Time, Slew Rate FIGURE 45-138: POR Release Voltage.
Control Disabled.
1.8
1.75
17
1.6 Max: Typical + 3ı
Typical: 25°C
1.4 Min: Typical - 3ı
16
1.2
1.7
Time (µs)
(V) (V)
1
15
Voltage
+3 Sigma
0.8
Voltage
0.6
1.65 14
Typical
0.4
0.2 -3 Sigma 13
0
1.6
-40 -20 0 20 40 60 80 100 120
12
Temperature (°C) 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
VDD (V)
1.55 Typical 25°C ı-40°C to +125°C)
-60 -40 -20 0 20 40 60 80 100 120 140
FIGURE 45-139: POR Rearm Voltage, NP FIGURE 45-142: Wake from Sleep,
Mode, PIC18F26/27/45/46/47/55/56/57K42 Only. VREGPM = 0, HFINTOSC = 4 MHz,
PIC18F26/27/45/46/47/55/56/57K42 Only.
120
74.0 110
72.0 100
90
70.0
80
Time (µs)
Time (ms)
68.0 70
60
66.0
50
64.0
40
62.0 30
20
60.0
1.5 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)
Typical 25°C ı-40°C to +125°C) - ı-40°C to +125°C) Typical 25°C ı-40°C to +125°C)
FIGURE 45-140: PWRT Period, PIC18F26/27/ FIGURE 45-143: Wake from Sleep,
45/46/47/55/56/57K42 Only. VREGPM = 1, HFINTOSC = 4 MHz,
PIC18F26/27/45/46/47/55/56/57K42 Only.
28
75.0
27
73.0
26
71.0
25
69.0
Time (µs)
Time (ms)
67.0 24
65.0 23
63.0
22
61.0
21
59.0
20
57.0 1.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
VDD (V)
VDD (V)
Typical 25°C ı-40°C to +125°C)
Typical 25°C ı-40°C to +125°C) - ı-40°C to +125°C)
110
100 4.1
90
Time (µs)
Time (ms)
80 4.0
70
60 3.9
50
40 3.8
1.5 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
Typical 25°C ı-40°C to +125°C) Typical 25°C ı-40°C to +125°C) -ı-40°C to +125°C)
FIGURE 45-145: Wake from Sleep, FIGURE 45-148: WDT Time-Out Period,
VREGPM = 1, HFINTOSC = 16 MHz, PIC18F26/27/45/46/47/55/56/57K42 Only.
PIC18F26/27/45/46/47/55/56/57K42 Only.
700
4.2
650
600 4.1
550
Time (µs)
Time (ms)
500 4.0
450
400 3.9
350
300 3.8
2.2 2.4 2.6 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 45-146: Wake from Sleep, FIGURE 45-149: WDT Time-Out Period,
VREGPM = 1, PIC18F26/27/45/46/47/55/56/ PIC18LF26/27/45/46/47/55/56/57K42 Only.
57K42 Only.
700
-3.450
650
-3.500
600
-3.550
550
-3.600
Time (µs)
Slope (mV/C)
500 -3.650
450 -3.700
-3.750
400
-3.800
350
-3.850
300
-3.900
1.7 2.2 2.7 3.2 3.7
-60 -40 -20 0 20 40 60 80 100 120 140
VDD (V)
Temperature (oC)
Typical 25°C ı-40°C to +125°C)
Typical +3 Sigma -3 Sigma
-2.300
-2.350
-2.400
Slope (mV/C)
-2.450
-2.500
-2.550
-2.600
-60 -40 -20 0 20 40 60 80 100 120 140
Temperature (oC)
20
15
10
5
Error (°C)
0
-40
-34
-28
-22
-16
-10
-4
2
8
14
20
26
32
38
44
50
56
62
68
74
80
86
92
98
104
110
116
122
128
134
140
146
-5
-10
-15
-20
Temperature (°C)
PIC18F26K42
/SP e3
1526017
XXXXXXXXXXXXXXXXXXXX PIC18F26K42
XXXXXXXXXXXXXXXXXXXX /SO e3
XXXXXXXXXXXXXXXXXXXX
YYWWNNN 1526017
PIC18F26K42
/SS e3
1526017
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.
PIN 1 PIN 1
XXXXXXXX 18F26K42
XXXXXXXX /ML e3
YYWWNNN 1526017
526017
XXXXXXXXXXXXXXXXXX PIC18F45K42
XXXXXXXXXXXXXXXXXX /P e3
XXXXXXXXXXXXXXXXXX
YYWWNNN 1526017
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.
PIN 1 PIN 1
PIC18
F45K42
/MV e 3
1526017
44-Lead QFN (8x8x0.9 mm) Example
PIN 1 PIN 1
XXXXXXXXXXX
18F45K42
XXXXXXXXXXX /ML e3
XXXXXXXXXXX 1526017
YYWWNNN
XXXXXXXXXX 18F45K42
XXXXXXXXXX /PT e3
XXXXXXXXXX
YYWWNNN 1526017
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.
PIN 1 PIN 1
XXXXXXXX 18F56K42
XXXXXXXX /MV e3
1526017
YYWWNNN
XXXXXXXXXX 18F56K42
XXXXXXXXXX /PT e3
XXXXXXXXXX 1526017
YYWWNNN
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.
!" 5
()#( $
(
6%
,#*
##(
! 6
' ( (%(
((
477,,,)
)7
6
NOTE 1
E1
1 2 3
A A2
L c
A1 b1
b e eB
8(# 9.:0
)#;)(# 9 9< =
9$)+
'!# 9 >
!( 3.
((! ? ?
%%! 6 6## /
3#((! ? ?
$%
($%
@%( 0 / //
%%! 6@%( 0 >
<"
;( / /A
((! ; /
;% 6## >
8
;%@%( +
;,
;%@%( + >
<"
,
- 3 ? ? /
!"
!"#$%&'($
)"
*+$()$#(+ (%,((( %
-' (.
(
#(
/ )##%0%( $%)%'#
(
$##%'#
(
$###(& %1
#%
)#%(
02
3.4 3# )#
( & ("$#,,($((
#
, .3
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
#$
%
&'
%
!" 5
()#( $
(
6%
,#*
##(
! 6
' ( (%(
((
477,,,)
)7
6
D
N
E
E1
1 2
b
NOTE 1
e
c
A A2
φ
A1
L1 L
8(# ;;00
)#;)(# 9 9< =
9$)+
'!# 9 >
!( A3.
<"
:( ? ?
%%! 6 6## A >
(%'' ? ?
<"
@%( 0 > >
%%! 6@%( 0 / A
<"
;(
5(;( ;
5(
( ; 05
;% 6## ?
5( B B >B
;%@%( + ? />
!"
!"#$%&'($
)"
*+$()$#(+ (%,((( %
)##%0%( $%)%'#
(
$##%'#
(
$###(& %))
#%
/ )#%(
02
3.4 3# )#
( & ("$#,,($((
#
054 '
)#*$#$,($((
*'
'
)(
$
##
, ./3
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
( )* ! + , -.- ()!
/# '&& 0
+#
!" 5
()#( $
(
6%
,#*
##(
! 6
' ( (%(
((
477,,,)
)7
6
28-Lead Plastic Quad Flat, No Lead Package (MX) - 6x6x0.5mm Body [UQFN]
Ultra-Thin with 0.40 x 0.60 mm Terminal Width/Length and Corner Anchors
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
(DATUM A)
E
(DATUM B)
2X
0.15 C
2X
0.15 C
TOP VIEW
A
C 0.10 C
SEATING
PLANE
(A3) A1
NOTE 4
0.08 C
SIDE VIEW
4x b1
4x b2
0.10 C A B
D2 4x b1
0.10 C A B
4x b2
E2
K
2
1
N
L b 0.10 C A B
NOTE 4
e 0.05 C
BOTTOM VIEW
Microchip Technology Drawing C04-0209 Rev C Sheet 1 of 2
28-Lead Plastic Quad Flat, No Lead Package (MX) - 6x6x0.5mm Body [UQFN]
Ultra-Thin with 0.40 x 0.60 mm Terminal Width/Length and Corner Anchors
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 28
Pitch e 0.65 BSC
Overall Height A 0.40 0.50 0.60
Standoff A1 0.00 0.02 0.05
Terminal Thickness (A3) 0.127 REF
Overall Width E 6.00 BSC
Exposed Pad Width E2 4.00
Overall Length D 6.00 BSC
Exposed Pad Length D2 4.00
Terminal Width b 0.35 0.40 0.45
Corner Pad b1 0.55 0.60 0.65
Corner Pad, Metal Free Zone b2 0.15 0.20 0.25
Terminal Length L 0.55 0.60 0.65
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.
4. Outermost portions of corner structures may vary slightly.
28-Lead Plastic Quad Flat, No Lead Package (MX) - 6x6 mm Body [UQFN]
With 0.60mm Contact Length And Corner Anchors
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
C1
X2
W1
Y2
E
G
C2 T2
Y1
X1
SILK SCREEN
Units MILLIMETERS
Dimension Limits MIN NOM MAX
Contact Pitch E 0.65 BSC
Optional Center Pad Width W1 4.05
Optional Center Pad Length T2 4.05
Contact Pad Spacing C1 5.70
Contact Pad Spacing C2 5.70
Contact Pad Width (X28) X1 0.45
Contact Pad Length (X28) Y1 1.00
Corner Pad Width (X4) X2 0.90
Corner Pad Length (X4) Y2 0.90
Distance Between Pads G 0.20
Notes:
1. Dimensioning and tolerancing per ASME Y14.5M
BSC: Basic Dimension. Theoretically exact value shown without tolerances.
(
6%
,#*
##(
! 6
' ( (%(
((
477,,,)
)7
6
NOTE 1
E1
1 2 3
A A2
L c
b1
A1
b e eB
8(# 9.:0
)#;)(# 9 9< =
9$)+
'!# 9
!( 3.
((! ? ?
%%! 6 6## ?
3#((! ? ?
$%
($%
@%( 0 ? A
%%! 6@%( 0 > ? >
<"
;( > ?
((! ; ?
;% 6## > ?
8
;%@%( + / ?
;,
;%@%( + ? /
<"
,
- 3 ? ?
!"
!"#$%&'($
)"
*+$()$#(+ (%,((( %
-' (.
(
#(
/ )##%0%( $%)%'#
(
$##%'#
(
$###(& %1
#%
)#%(
02
3.4 3# )#
( & ("$#,,($((
#
, .A3
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
44-Lead Plastic Quad Flat, No Lead Package (ML) - 8x8 mm Body [QFN or VQFN]
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
0.10 C A1
C
SEATING A
PLANE 44X
A3 0.08 C
SIDE VIEW
L
0.10 C A B
D2
0.10 C A B
E2
K
2
1
NOTE 1 N
44X b
e 0.07 C A B
0.05 C
BOTTOM VIEW
Microchip Technology Drawing C04-103D Sheet 1 of 2
44-Lead Plastic Quad Flat, No Lead Package (ML) - 8x8 mm Body [QFN or VQFN]
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 44
Pitch e 0.65 BSC
Overall Height A 0.80 0.90 1.00
Standoff A1 0.00 0.02 0.05
Terminal Thickness A3 0.20 REF
Overall Width E 8.00 BSC
Exposed Pad Width E2 6.25 6.45 6.60
Overall Length D 8.00 BSC
Exposed Pad Length D2 6.25 6.45 6.60
Terminal Width b 0.20 0.30 0.35
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.
44-Lead Plastic Quad Flat, No Lead Package (ML) - 8x8 mm Body [QFN or VQFN]
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
C1
X2
EV
44
G2
1
2
ØV
EV
C2 Y2
G1
Y1
E SILK SCREEN
X1
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
D A
D1 B
NOTE 2
(DATUM A)
(DATUM B)
E1 E
NOTE 1 A A
2X
N
0.20 H A B
2X 1 2 3
0.20 H A B 4X 11 TIPS
TOP VIEW
0.20 C A B
A A2
C
SEATING PLANE
0.10 C A1
SIDE VIEW
1 2 3
NOTE 1
44 X b
e 0.20 C A B
BOTTOM VIEW
Microchip Technology Drawing C04-076C Sheet 1 of 2
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
L θ
(L1)
SECTION A-A
Units MILLIMETERS
Dimension Limits MIN NOM MAX
Number of Leads N 44
Lead Pitch e 0.80 BSC
Overall Height A - - 1.20
Standoff A1 0.05 - 0.15
Molded Package Thickness A2 0.95 1.00 1.05
Overall Width E 12.00 BSC
Molded Package Width E1 10.00 BSC
Overall Length D 12.00 BSC
Molded Package Length D1 10.00 BSC
Lead Width b 0.30 0.37 0.45
Lead Thickness c 0.09 - 0.20
Lead Length L 0.45 0.60 0.75
Footprint L1 1.00 REF
Foot Angle θ 0° 3.5° 7°
Notes:
1. Pin 1 visual index feature may vary, but must be located within the hatched area.
2. Exact shape of each corner is optional.
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.
44-Lead Plastic Thin Quad Flatpack (PT) - 10X10X1 mm Body, 2.00 mm Footprint [TQFP]
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
C1
44
1
2
G
C2
Y1
X1 E
SILK SCREEN
Units MILLIMETERS
Dimension Limits MIN NOM MAX
Contact Pitch E 0.80 BSC
Contact Pad Spacing C1 11.40
Contact Pad Spacing C2 11.40
Contact Pad Width (X44) X1 0.55
Contact Pad Length (X44) Y1 1.50
Distance Between Pads G 0.25
Notes:
1. Dimensioning and tolerancing per ASME Y14.5M
BSC: Basic Dimension. Theoretically exact value shown without tolerances.
Microchip Technology Drawing No. C04-2076B
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
48X TIPS
0.20 C A-B D
D
D1
D1
2
A B
E1 E
E1
A A 2
E1
4 N
NOTE 1 1 2 4X
D1 0.20 H A-B D
4
48x b
e 0.08 C A-B D
TOP VIEW
0.10 C H
C A2
A
SEATING
PLANE 0.08 C
A1 SIDE VIEW
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
E T
L
(L1)
SECTION A-A
Units MILLIMETERS
Dimension Limits MIN NOM MAX
Number of Leads N 48
Lead Pitch e 0.50 BSC
Overall Height A - - 1.20
Standoff A1 0.05 - 0.15
Molded Package Thickness A2 0.95 1.00 1.05
Foot Length L 0.45 0.60 0.75
Footprint L1 1.00 REF
Foot Angle I 0° 3.5° 7°
Overall Width E 9.00 BSC
Overall Length D 9.00 BSC
Molded Package Width E1 7.00 BSC
Molded Package Length D1 7.00 BSC
Lead Thickness c 0.09 - 0.16
Lead Width b 0.17 0.22 0.27
Mold Draft Angle Top D 11° 12° 13°
Mold Draft Angle Bottom E 11° 12° 13°
Notes:
1. Pin 1 visual index feature may vary, but must be located within the hatched area.
2. Chamfers at corners are optional; size may vary.
3. Dimensions D1 and E1 do not include mold flash or protrusions. Mold flash or
protrusions shall not exceed 0.25mm per side.
4. 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.
5. Datums A-B and D to be determined at center line between leads where leads exit
plastic body at datum plane H
Microchip Technology Drawing C04-300-Y8 Rev A Sheet 2 of 2
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
C1
C2 G
SILK SCREEN
48
Y1
1 2
X1
E
Units MILLIMETERS
Dimension Limits MIN NOM MAX
Contact Pitch E 0.50 BSC
Contact Pad Spacing C1 8.40
Contact Pad Spacing C2 8.40
Contact Pad Width (X48) X1 0.30
Contact Pad Length (X48) Y1 1.50
Distance Between Pads G 0.20
Notes:
1. Dimensioning and tolerancing per ASME Y14.5M
BSC: Basic Dimension. Theoretically exact value shown without tolerances.
2. For best soldering results, thermal vias, if used, should be filled or tented to avoid solder loss during
reflow process
Revision E (5/2019)
Removed Preliminary from page 744.
Updated Figures 45-20 and 45-21 and Table 44-3,
Added Figures 45-21 though 45-40 to Characterization
Data chapter.
Revision D (4/2019)
Updated Examples 13-3, 13-4 and 15-1; Figures 3-1,
3-2, 3-11, 3-18, 3-19, 3-20, 30-1, 30-3, 33-5, 33-6,
33-7, 33-8, 33-9, 33-10, 33-21, 33-22, 36-1, and 44-6:
Registers 33-1, 33-2, 33-3, 33-6, 33-7, 33-8, 33-10,
33-11, 33-12, 33-13, 33-14, 33-15, 33-17, 33-21, 36-2,
36-3, 36-5, 36-7,36-22, 36-23, 36-27, 36-31, 36-32,
35-33,36-34, and 36-35; Sections 4.5.6, 7.1, 7.2.1.2,
7.2.1.3, 7.2.2, 7.2.2.3, 7.2.2.4, 11.0, 15.6.1, 15.6.2,
16.2.6, 17.2, 17.5, 23.1.2, 24.2, 27.0, 27.1.1, 33.1,
33.2, 33.3.7, 33.3.8, 33.3.9, 33.3.10.1, 33.3.10.2,
33.3.10.3, 33.3.12, 33.3.12.1, 33.3.12.2, 33.3.13,
33.4.2, 33.4.3, 33.4.3.1, 33.4.3.2, 33.4.3.3, 33.4.3.4,
33.4.3.5, 33.5, 33.5.1.1, 33.5.1.2, 33.5.9, 33.5.10,
33.5.11, 33.5.12, 33.6, 36.1.4, 36.1.5, 36.1.6, 36.2.2,
36.2.3, 36.2.4,36.5.4, 36.6, 36.6.1, 36.6.2, 36.6.3,
36.6.4, 36.6.5, 36.6.6, 36.6.7, 36.6.8, 36.6.9, 39.8,
41.1, 41.1.1, 41.2, and 41.2.5; Tables 7-1, 15-2, 33-1,
36-1, 36-2, 36-4, 36-5, 36-6, 33-18, 41-1, 41-2, 41-3,
44-2, 44-3, 44-4, 44-9, 44-11, 44-12, 44-13, 44-15 and
44-16.
Removed Table 44-5.
Revision C (9/2018)
Added Figure 3-2.
Updated Examples 9-3 and 13-2; Figures 15-2, 36-6,
45-1, 45-2, and 45-3; Registers 17-1, 25-3, 31-4, 31-5,
32-9, 34-1, and 36-5; Sections 4.5.6, 7.2.1.2, 9.1, 15.9,
15.12, 25.6.8, 31.6, 31.6.1, 31.6.2, 31.13.2, 32.2,
32.3.1, 32.3.2, 32.3.5, 32.4, 32.4.1, 32.4.2, 32.5.1,
32.5.2, 32.8.3.1, 32.8.3.2, and 36.6.1; and Tables 4-3,
5-1, 17-3, 22-1, 36-6, 42-1, 44-1, 44-2, 44-4, 44-5 and
44-9.
Updated Instruction Set: LFSR. Updated 48-pin TQFP
Packaging information from (PT) to (Y8).
Revision B (12/2017)
Standard operating conditions updated in Section 44.0,
Electrical Specifications. Other minor corrections.
Revision A (6/2017)
Initial release of the document.
• 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 ==