A
A
Zero-Cross Detect
Data EEPROM (B)
Data Sheet Index
CCP/10-bit PWM
12-bit ADC2 (ch)
Comparator
5-bit DAC
Debug(1)
I/O Pins
I2C/SPI
CWG
NCO
CAN
CLC
Device
Note: For other small form-factor package availability and marking information, visit
http://www.microchip.com/packaging or contact your local sales office.
TABLE 2: PACKAGES
Device SPDIP SOIC SSOP UQFN QFN
PIC18(L)F25K83
PIC18(L)F26K83
Note 1: Pin details are subject to change.
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)F25K83
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)F26K83 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
Interrupt-on Change
Voltage Reference
Comparators
Timers/SMT
ECAN
UART
Basic
CWG
NCO
DSM
ADC
DAC
CLC
SPI
I2 C
I/O
CLKOUT
RA7 9 6 ANA7 — — — — — — — — — — — — — — — IOCA7 OSC1
CLKIN
RB0 21 18 ANB0 — — C2IN1+ ZCD — — — — — CCP4(1) CWG1(1) — — — — IOCB0 —
INT0(1)
RB1 22 19 ANB1 — — C1IN3- — SCL2(1,3,4) — — — — — CWG2(1) — — — — IOCB1 —
C2IN3- INT1(1)
RB2 23 20 ANB2 — — — — SDA2(1,3,4) — — — — — CWG3(1) — — — — IOCB2 —
PIC18(L)F25/26K83
INT2(1)
RB3 24 21 ANB3 — — C1IN2- — — — — — — — — — — — CANRX( IOCB3 —
C2IN2- 1)
28-Pin SPDIP/SOIC/SSOP
Interrupt-on Change
Voltage Reference
Comparators
Timers/SMT
ECAN
UART
Basic
CWG
NCO
DSM
ADC
DAC
CLC
SPI
I2C
I/O
PIC18(L)F25/26K83
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 SMBTM 3.0/2.0 logic levels; the SCLx/SDAx signals may be assigned to any of the RB1/RB2/RC3/RC4 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.
DS40001943A-page 7
PIC18(L)F25/26K83
Table of Contents
1.0 Device Overview ........................................................................................................................................................................ 10
2.0 Guidelines for Getting Started with PIC18(L)F25/26K83 Microcontrollers ................................................................................. 13
3.0 PIC18 CPU................................................................................................................................................................................. 16
4.0 Memory Organization ................................................................................................................................................................. 23
5.0 Device Configuration .................................................................................................................................................................. 55
6.0 Resets ........................................................................................................................................................................................ 71
7.0 Oscillator Module (with Fail-Safe Clock Monitor) ....................................................................................................................... 82
8.0 Reference Clock Output Module .............................................................................................................................................. 101
9.0 Interrupt Controller ................................................................................................................................................................... 105
10.0 Power-Saving Operation Modes .............................................................................................................................................. 161
11.0 Windowed Watchdog Timer (WWDT) ...................................................................................................................................... 168
12.0 8x8 Hardware Multiplier............................................................................................................................................................ 177
13.0 Nonvolatile Memory (NVM) Control.......................................................................................................................................... 179
14.0 Cyclic Redundancy Check (CRC) Module with Memory Scanner............................................................................................ 203
15.0 Direct Memory Access (DMA) .................................................................................................................................................. 218
16.0 I/O Ports ................................................................................................................................................................................... 249
17.0 Peripheral Pin Select (PPS) Module ........................................................................................................................................ 262
18.0 Interrupt-on-Change ................................................................................................................................................................. 270
19.0 Peripheral Module Disable (PMD)............................................................................................................................................ 274
20.0 Timer0 Module ......................................................................................................................................................................... 283
21.0 Timer1/3/5 Module with Gate Control....................................................................................................................................... 289
22.0 Timer2/4/6 Module ................................................................................................................................................................... 304
23.0 Capture/Compare/PWM Module .............................................................................................................................................. 326
24.0 Pulse-Width Modulation (PWM) ............................................................................................................................................... 340
25.0 Signal Measurement Timer (SMTX)......................................................................................................................................... 347
26.0 Complementary Waveform Generator (CWG) Module ............................................................................................................ 391
27.0 Configurable Logic Cell (CLC).................................................................................................................................................. 419
28.0 Numerically Controlled Oscillator (NCO) Module ..................................................................................................................... 434
29.0 Zero-Cross Detection (ZCD) Module........................................................................................................................................ 444
30.0 Data Signal Modulator (DSM) Module...................................................................................................................................... 449
31.0 Universal Asynchronous Receiver Transmitter (UART) With Protocol Support ....................................................................... 460
32.0 Serial Peripheral Interface (SPI) Module.................................................................................................................................. 497
33.0 I2C Module ............................................................................................................................................................................... 529
34.0 CAN Module ............................................................................................................................................................................. 581
35.0 Fixed Voltage Reference (FVR) .............................................................................................................................................. 647
36.0 Temperature Indicator Module ................................................................................................................................................. 649
37.0 Analog-to-Digital Converter with Computation (ADC2) Module ............................................................................................... 652
38.0 5-Bit Digital-to-Analog Converter (DAC) Module...................................................................................................................... 690
39.0 Comparator Module ................................................................................................................................................................. 694
40.0 High/Low-Voltage Detect (HLVD)............................................................................................................................................. 703
41.0 In-Circuit Serial Programming™ (ICSP™) ............................................................................................................................... 711
42.0 Instruction Set Summary .......................................................................................................................................................... 713
43.0 Register Summary.................................................................................................................................................................... 767
44.0 Development Support............................................................................................................................................................... 788
45.0 Electrical Specifications............................................................................................................................................................ 792
46.0 DC and AC Characteristics Graphs and Tables....................................................................................................................... 821
47.0 Packaging Information.............................................................................................................................................................. 822
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.
VDD C2
and then to the device pins. This ensures that the
R1
decoupling capacitors are first in the power chain.
VDD
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 capac-
Key (all values are recommendations): itor for integrated circuits, including microcontrollers, to
C1 and C2 : 0.1 PF, 20V ceramic supply a local power source. The value of the tank
R1: 10 kΩ
capacitor should be determined based on the trace
R2: 100Ω to 470Ω
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)F25/26K83
JP
C1
Use a grounded copper pour around the oscillator cir- DEVICE PINS
cuit to isolate it from surrounding circuits. The
grounded copper pour should be routed directly to the
MCU ground. Do not run any signal traces or power
Primary OSC1
traces inside the ground pour. Also, if using a two-sided Oscillator
board, avoid any traces on the other side of the board C1 ` OSC2
where the crystal is placed.
C2 GND
Layout suggestions are shown in Figure 2-3. In-line `
packages may be handled with a single-sided layout
SOSCO
that completely encompasses the oscillator pins. With
fine-pitch packages, it is not always possible to com- SOSCI
Secondary Oscillator
pletely surround the pins and components. A suitable (SOSC)
solution is to tie the broken guard sections to a mirrored Crystal `
ground layer. In all cases, the guard trace(s) must be
returned to ground.
SOSC: C1 SOSC: C2
In planning the application’s routing and I/O assign-
ments, ensure that adjacent port pins, and other
signals in close proximity to the oscillator, are benign
(i.e., free of high frequencies, short rise and fall times, Fine-Pitch (Dual-Sided) Layouts:
and other similar noise). Top Layer Copper Pour
(tied to ground)
For additional information and design guidance on
oscillator circuits, refer to these Microchip Application
Notes, available at the corporate website Bottom Layer
Copper Pour
(www.microchip.com): (tied to ground)
• AN826, “Crystal Oscillator Basics and Crystal
Selection for rfPIC™ and PICmicro® Devices” OSCO
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
OSC2(2) Oscillator ALU<8>
LFINTOSC Start-up Timer
SOSCI Oscillator Power-on 8
Reset
64 MHz
SOSCO Oscillator WWT
Precision
Single-Supply Brown-out Band Gap
MCLR(1) Reset
Programming Reference
In-Circuit Fail-Safe
Debugger Clock Monitor
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
PIC18(L)F25K83 PIC18(L)F26K83
PC<21:0> PC<21:0>
31 0100h 31 0100h
••• •••
31 03FFh 31 03FFh
31 0400h 31 0400h
••• Reserved •••
3E FFFFh 3E FFFFh
3F 0000h 3F 0000h
••• Device Information Area(5),(7) •••
3F 003Fh 3F 003Fh
3F0040h 3F0040h
••• Reserved •••
3F FEFFh 3F FEFFh
3F FF00h 3F FF00h
••• Device Configuration Information (5 Words)(5),(6),(7) •••
3F FF09h 3F FF09h
3F FF0Ah 3F FF0Ah
••• Reserved •••
3F FFFBh 3F FFFBh
3F FFFCh 3F FFFCh
••• Revision ID (1 Word)(5),(6),(7) •••
3F FFFDh 3F FFFDh
3F FFFEh 3F FFFEh
••• Device ID (1 Word)(5),(6),(7) •••
3F FFFFh 3F FFFFh
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, if present.
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 is 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
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
OSC1
Q1
Q2 Internal
Q3 Phase
Clock
Q4
PC PC PC + 2 PC + 4
OSC2/CLKOUT
(RC mode)
Execute INST (PC – 2)
Fetch INST (PC) Execute INST (PC)
Fetch INST (PC + 2) Execute INST (PC + 2)
Fetch INST (PC + 4)
Note: There are some instructions that take multiple cycles to execute. Refer to Section 42.0 “Instruction Set
Summary” for details.
BSR(1)
Data Memory From Opcode(2)
7 0 0000h 00h 7 0
0 0 0 0 0 0 1 0 Bank 0 1 1 1 1 1 1 1 1
FFh
0100h 00h
Bank 1
Bank Select(2) 0200h FFh
00h
Bank 2
0300h FFh
00h
Bank 3
through
Bank 61
FFh
3E00h
Preliminary
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.
PIC18(L)F25/26K83
DS40001943A-page 36
PIC18(L)F25/26K83
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-5).
registers is given in Table 4-3 to Table 4-10. 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 43.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”.
3FFFh TOSU 3FDFh INDF2 3FBFh — 3F9Fh T4PR 3F7Fh CCP1CAP 3F5Fh CCPTMRS1 3F3Fh NCO1CLK 3F1Fh SMT1CON1
3FFEh TOSH 3FDEh POSTINC2 3FBEh — 3F9Eh T4TMR 3F7Eh CCP1CON 3F5Eh CCPTMRS0 3F3Eh NCO1CON 3F1Eh SMT1CON0
3FFDh TOSL 3FDDh POSTDEC2 3FBDh — 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
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 ECANCON 3F71h CCPR4H 3F51h CWG2STR 3F31h — 3F11h SMT2WIN
3FF0h PCON0 3FD0h — 3FB0h TMR1L 3F90h COMSTAT 3F70h CCPR4L 3F50h CWG2AS1 3F30h — 3F10h SMT2SIG
3FEFh INDF0 3FCFh — 3FAFh T2RST 3F8Fh CANCON 3F6Fh — 3F4Fh CWG2AS0 3F2Fh — 3F0Fh SMT2CLK
3FEEh POSTINC0 3FCEh PORTE 3FAEh T2CLK 3F8Eh CANSTAT 3F6Eh PWM5CON 3F4Eh CWG2CON1 3F2Eh — 3F0Eh SMT2STAT
3FEDh POSTDEC0 3FCDh — 3FADh T2HLT 3F8Dh RXB0D7 3F6Dh PWM5DCH 3F4Dh CWG2CON0 3F2Dh — 3F0Dh SMT2CON1
3FECh PRECIN0 3FCCh PORTC 3FACh T2CON 3F8Ch RXB0D6 3F6Ch PWM5DCL 3F4Ch CWG2DBF 3F2Ch — 3F0Ch SMT2CON0
Preliminary
3FEBh PLUSW0 3FCBh PORTB 3FABh T2PR 3F8Bh RXB0D5 3F6Bh — 3F4Bh CWG2DBR 3F2Bh — 3F0Bh SMT2PRU
3FEAh FSR0H 3FCAh PORTA 3FAAh T2TMR 3F8Ah RXB0D4 3F6Ah PWM6CON 3F4Ah CWG2ISM 3F2Ah — 3F0Ah SMT2PRH
3FE9h FSR0L 3FC9h — 3FA9h T3CLK 3F89h RXB0D3 3F69h PWM6DCH 3F49h CWG2CLK 3F29h — 3F09h SMT2PRL
3FE8h WREG 3FC8h — 3FA8h T3GATE 3F88h RXB0D2 3F68h PWM6DCL 3F48h CWG3STR 3F28h — 3F08h SMT2CPWU
3FE7h INDF1 3FC7h — 3FA7h T3GCON 3F87h RXB0D1 3F67h — 3F47h CWG3AS1 3F27h — 3F07h SMT2CPWH
3FE6h POSTINC1 3FC6h — 3FA6h T3CON 3F86h RXB0D0 3F66h PWM7CON 3F46h CWG3AS0 3F26h — 3F06h SMT2CPWL
3FE5h POSTDEC1 3FC5h — 3FA5h TMR3H 3F85h RXB0DLC 3F65h PWM7DCH 3F45h CWG3CON1 3F25h — 3F05h SMT2CPRU
PIC18(L)F25/26K83
3FE4h PRECIN1 3FC4h TRISC 3FA4h TMR3L 3F84h RXB0EIDL 3F64h PWM7DCL 3F44h CWG3CON0 3F24h — 3F04h SMT2CPRH
3FE3h PLUSW1 3FC3h TRISB 3FA3h T4RST 3F83h RXB0EIDH 3F63h — 3F43h CWG3DBF 3F23h SMT1WIN 3F03h SMT2CPRL
3FE2h FSR1H 3FC2h TRISA 3FA2h T4CLK 3F82h RXB0SIDL 3F62h PWM8CON 3F42h CWG3DBR 3F22h SMT1SIG 3F02h SMT2TMRU
3FE1h FSR1L 3FC1h — 3FA1h T4HLT 3F81h RXB0SIDH 3F61h PWM8DCH 3F41h CWG3ISM 3F21h SMT1CLK 3F01h SMT2TMRH
3FE0h BSR 3FC0h — 3FA0h T4CON 3F80h RXB0CON 3F60h PWM8DCL 3F40h CWG3CLK 3F20h SMT1STAT 3F00h SMT2TMRL
Legend: Unimplemented data memory locations and registers, read as ‘0’.
DS40001943A-page 38
TABLE 4-4: SPECIAL FUNCTION REGISTER MAP FOR PIC18(L)F25/26K83 DEVICES BANK 62
2017 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 —
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 —
Preliminary
PIC18(L)F25/26K83
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’.
DS40001943A-page 39
TABLE 4-5: SPECIAL FUNCTION REGISTER MAP FOR PIC18(L)F25/26K83 DEVICES BANK 61
2017 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 U2P3H 3DB9h — 3D99h — 3D79h I2C1PIR 3D59h I2C2ADR0 3D39h — 3D19h SPI1BAUD
3DF8h U1UIR 3DD8h U2P3L 3DB8h — 3D98h — 3D78h I2C1STAT1 3D58h I2C2ADB1 3D38h — 3D18h SPI1TWIDTH
3DF7h U1FIFO 3DD7h U2P2H 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 U2P1H 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 U2TXCHK 3DB3h — 3D93h — 3D73h I2C1CON0 3D53h — 3D33h — 3D13h SPI1TCNTH
3DF2h U1CON0 3DD2h U2TXB 3DB2h — 3D92h — 3D72h I2C1ADR3 3D52h — 3D32h — 3D12h SPI1TCNTL
3DF1h U1P3H 3DD1h U2RXCHK 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 —
Preliminary
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 —
PIC18(L)F25/26K83
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’.
DS40001943A-page 40
TABLE 4-6: SPECIAL FUNCTION REGISTER MAP FOR PIC18(L)F25/26K83 DEVICES BANK 60
2017 Microchip Technology Inc.
PIC18(L)F25/26K83
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’.
DS40001943A-page 41
TABLE 4-7: SPECIAL FUNCTION REGISTER MAP FOR PIC18(L)F25/26K83 DEVICES BANK 59
2017 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 —
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 —
Preliminary
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 —
PIC18(L)F25/26K83
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’.
DS40001943A-page 42
TABLE 4-8: SPECIAL FUNCTION REGISTER MAP FOR PIC18(L)F25/26K83 DEVICES BANK 58
2017 Microchip Technology Inc.
3AFFh — 3ADFh ADACTPPS 3ABFh PPSLOCK 3A9Fh — 3A7Fh — 3A5Fh — 3A3Fh — 3A1Fh —
3AFEh — 3ADEh CLCIN3PPS 3ABEh — 3A9Eh — 3A7Eh — 3A5Eh — 3A3Eh — 3A1Eh —
3AFDh — 3ADDh CLCIN2PPS 3ABDh — 3A9Dh — 3A7Dh — 3A5Dh — 3A3Dh — 3A1Dh —
3AFCh — 3ADCh CLCIN1PPS 3ABCh — 3A9Ch — 3A7Ch — 3A5Ch — 3A3Ch — 3A1Ch —
3AFBh — 3ADBh CLCIN0PPS 3ABBh — 3A9Bh — 3A7Bh — 3A5Bh RB2I2C 3A3Bh — 3A1Bh —
3AFAh — 3ADAh MD1SRCPPS 3ABAh — 3A9Ah — 3A7Ah — 3A5Ah RB1I2C 3A3Ah — 3A1Ah —
3AF9h — 3AD9h MD1CARHPPS 3AB9h — 3A99h — 3A79h — 3A59h — 3A39h — 3A19h —
3AF8h — 3AD8h MD1CARLPPS 3AB8h — 3A98h — 3A78h — 3A58h — 3A38h — 3A18h —
3AF7h — 3AD7h CWG3INPPS 3AB7h — 3A97h — 3A77h — 3A57h IOCBF 3A37h — 3A17h RC7PPS
3AF6h — 3AD6h CWG2INPPS 3AB6h — 3A96h — 3A76h — 3A56h IOCBN 3A36h — 3A16h RC6PPS
3AF5h — 3AD5h CWG1INPPS 3AB5h — 3A95h — 3A75h — 3A55h IOCBP 3A35h — 3A15h RC5PPS
3AF4h — 3AD4h SMT2SIGPPS 3AB4h — 3A94h — 3A74h — 3A54h INLVLB 3A34h — 3A14h RC4PPS
3AF3h — 3AD3h SMT2WINPPS 3AB3h — 3A93h — 3A73h — 3A53h SLRCONB 3A33h — 3A13h RC3PPS
3AF2h — 3AD2h SMT1SIGPPS 3AB2h — 3A92h — 3A72h — 3A52h ODCONB 3A32h — 3A12h RC2PPS
3AF1h — 3AD1h SMT1WINPPS 3AB1h — 3A91h — 3A71h — 3A51h WPUB 3A31h — 3A11h RC1PPS
3AF0h — 3AD0h CCP4PPS 3AB0h — 3A90h — 3A70h — 3A50h ANSELB 3A30h — 3A10h RC0PPS
3AEFh — 3ACFh CCP3PPS 3AAFh — 3A8Fh — 3A6Fh — 3A4Fh — 3A2Fh — 3A0Fh RB7PPS
3AEEh — 3ACEh CCP2PPS 3AAEh — 3A8Eh — 3A6Eh — 3A4Eh — 3A2Eh — 3A0Eh RB6PPS
3AEDh CANRXPPS 3ACDh CCP1PPS 3AADh — 3A8Dh — 3A6Dh — 3A4Dh — 3A2Dh — 3A0Dh RB5PPS
3AECh — 3ACCh T6INPPS 3AACh — 3A8Ch — 3A6Ch — 3A4Ch — 3A2Ch — 3A0Ch RB4PPS
Preliminary
3AEBh U2CTSPPS 3ACBh T4INPPS 3AABh — 3A8Bh — 3A6Bh RC4I2C 3A4Bh — 3A2Bh — 3A0Bh RB3PPS
3AEAh U2RXPPS 3ACAh T2INPPS 3AAAh — 3A8Ah — 3A6Ah RC3I2C 3A4Ah — 3A2Ah — 3A0Ah RB2PPS
3AE9h — 3AC9h T5GPPS 3AA9h — 3A89h — 3A69h — 3A49h — 3A29h — 3A09h RB1PPS
3AE8h U1CTSPPS 3AC8h T5CKIPPS 3AA8h — 3A88h — 3A68h — 3A48h — 3A28h — 3A08h RB0PPS
3AE7h U1RXPPS 3AC7h T3GPPS 3AA7h — 3A87h IOCEF 3A67h IOCCF 3A47h IOCAF 3A27h — 3A07h RA7PPS
3AE6h I2C2SDAPPS 3AC6h T3CKIPPS 3AA6h — 3A86h IOCEN 3A66h IOCCN 3A46h IOCAN 3A26h — 3A06h RA6PPS
3AE5h I2C2SCLPPS 3AC5h T1GPPS 3AA5h — 3A85h IOCEP 3A65h IOCCP 3A45h IOCAP 3A25h — 3A05h RA5PPS
PIC18(L)F25/26K83
3AE4h I2C1SDAPPS 3AC4h T1CKIPPS 3AA4h — 3A84h INLVLE 3A64h INLVLC 3A44h INLVLA 3A24h — 3A04h RA4PPS
3AE3h I2C1SCLPPS 3AC3h T0CKIPPS 3AA3h — 3A83h — 3A63h SLRCONC 3A43h SLRCONA 3A23h — 3A03h RA3PPS
3AE2h SPI1SSPPS 3AC2h INT2PPS 3AA2h — 3A82h — 3A62h ODCONC 3A42h ODCONA 3A22h — 3A02h RA2PPS
3AE1h SPI1SDIPPS 3AC1h INT1PPS 3AA1h — 3A81h WPUE 3A61h WPUC 3A41h WPUA 3A21h — 3A01h RA1PPS
3AE0h SPI1SCKPPS 3AC0h INT0PPS 3AA0h — 3A80h — 3A60h ANSELC 3A40h ANSELA 3A20h — 3A00h RA0PPS
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 — 397Ah SCANHADRH 395Ah — 393Ah — 391Ah —
39F9h — 39D9h OSCCON1 39B9h — 3999h PIE9 3979h SCANHADRL 3959h — 3939h — 3919h —
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 —
Preliminary
PIC18(L)F25/26K83
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 — 39C1h PMD1 39A1h PIR1 3981h IPR1 3961h CRCDATH 3941h — 3921h — 3901h —
39E0h NVMADRL 39C0h PMD0 39A0h PIR0 3980h IPR0 3960h CRCDATL 3940h — 3920h — 3900h —
PIC18(L)F25/26K83
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 —
37FFh CANCON_RO0 37DFh CANCON_RO2 37BFh RXM1EIDL 379Fh CANCON_RO4 377Fh CANCON_RO6 375Fh CANCON_RO8 373Fh TXBIE 371Fh RXF11EIDL
37FEh CANSTAT_RO0 37DEh CANSTAT_RO2 37BEh RXM1EIDH 379Eh CANSTAT_RO4 377Eh CANSTAT_RO6 375Eh CANSTAT_RO8 373Eh BIE0 371Eh RXF11EIDH
37FDh RXB1D7 37DDh TXB1D7 37BDh RXM1SIDL 379Dh B5D7 377Dh B3D7 375Dh B1D7 373Dh BSEL0 371Dh RXF11SIDL
37FCh RXB1D6 37DCh TXB1D6 37BCh RXM1SIDH 379Ch B5D6 377Ch B3D6 375Ch B1D6 373Ch MSEL3 371Ch RXF11SIDH
37FBh RXB1D5 37DBh TXB1D5 37BBh RXM0EIDL 379Bh B5D5 377Bh B3D5 375Bh B1D5 373Bh MSEL2 371Bh RXF10EIDL
37FAh RXB1D4 37DAh TXB1D4 37BAh RXM0EIDH 379Ah B5D4 377Ah B3D4 375Ah B1D4 373Ah MSEL1 371Ah RXF10EIDH
37F9h RXB1D3 37D9h TXB1D3 37B9h RXM0SIDL 3799h B5D3 3779h B3D3 3759h B1D3 3739h MSEL0 3719h RXF10SIDL
37F8h RXB1D2 37D8h TXB1D2 37B8h RXM0SIDH 3798h B5D2 3778h B3D2 3758h B1D2 3738h RXFBCON7 3718h RXF10SIDH
37F7h RXB1D1 37D7h TXB1D1 37B7h RXF5EIDL 3797h B5D1 3777h B3D1 3757h B1D1 3737h RXFBCON6 3717h RXF9EIDL
37F6h RXB1D0 37D6h TXB1D0 37B6h RXF5EIDH 3796h B5D0 3776h B3D0 3756h B1D0 3736h RXFBCON5 3716h RXF9EIDH
37F5h RXB1DLC 37D5h TXB1DLC 37B5h RXF5SIDL 3795h B5DLC 3775h B3DLC 3755h B1DLC 3735h RXFBCON4 3715h RXF9SIDL
37F4h RXB1EIDL 37D4h TXB1EIDL 37B4h RXF5SIDH 3794h B5EIDL 3774h B3EIDL 3754h B1EIDL 3734h RXFBCON3 3714h RXF9SIDH
37F3h RXB1EIDH 37D3h TXB1EIDH 37B3h RXF4EIDL 3793h B5EIDH 3773h B3EIDH 3753h B1EIDH 3733h RXFBCON2 3713h RXF8EIDL
37F2h RXB1SIDL 37D2h TXB1SIDL 37B2h RXF4EIDH 3792h B5SIDL 3772h B3SIDL 3752h B1SIDL 3732h RXFBCON1 3712h RXF8EIDH
37F1h RXB1SIDH 37D1h TXB1SIDH 37B1h RXF4SIDL 3791h B5SIDH 3771h B3SIDH 3751h B1SIDH 3731h RXFBCON0 3711h RXF8SIDL
37F0h RXB1CON 37D0h TXB1CON 37B0h RXF4SIDH 3790h B5CON 3770h B3CON 3750h B1CON 3730h SDFLC 3710h RXF8SIDH
37EFh CANCON_RO1 37CFh CANCON_RO3 37AFh RXF3EIDL 378Fh CANCON_RO5 376Fh CANCON_RO7 374Fh CANCON_RO9 372Fh RXF15EIDL 370Fh RXF7EIDL
37EEh CANSTAT_RO1 37CEh CANSTAT_RO3 37AEh RXF3EIDH 378Eh CANSTAT_RO5 376Eh CANSTAT_RO7 374Eh CANSTAT_RO9 372Eh RXF15EIDH 370Eh RXF7EIDH
37EDh TXB0D7 37CDh TXB2D7 37ADh RXF3SIDL 378Dh B4D7 376Dh B2D7 374Dh B0D7 372Dh RXF15SIDL 370Dh RXF7SIDL
37ECh TXB0D6 37CCh TXB2D6 37ACh RXF3SIDH 378Ch B4D6 376Ch B2D6 374Ch B0D6 372Ch RXF15SIDH 370Ch RXF7SIDH
Preliminary
37EBh TXB0D5 37CBh TXB2D5 37ABh RXF2EIDL 378Bh B4D5 376Bh B2D5 374Bh B0D5 372Bh RXF14EIDL 370Bh RXF6EIDL
37EAh TXB0D4 37CAh TXB2D4 37AAh RXF2EIDH 378Ah B4D4 376Ah B2D4 374Ah B0D4 372Ah RXF14EIDH 370Ah RXF6EIDH
37E9h TXB0D3 37C9h TXB2D3 37A9h RXF2SIDL 3789h B4D3 3769h B2D3 3749h B0D3 3729h RXF14SIDL 3709h RXF6SIDL
37E8h TXB0D2 37C8h TXB2D2 37A8h RXF2SIDH 3788h B4D2 3768h B2D2 3748h B0D2 3728h RXF14SIDH 3708h RXF6SIDH
37E7h TXB0D1 37C7h TXB2D1 37A7h RXF1EIDL 3787h B4D1 3767h B2D1 3747h B0D1 3727h RXF13EIDL 3707h RXFCON1
37E6h TXB0D0 37C6h TXB2D0 37A6h RXF1EIDH 3786h B4D0 3766h B2D0 3746h B0D0 3726h RXF13EIDH 3706h RXFCON0
37E5h TXB0DLC 37C5h TXB2DLC 37A5h RXF1SIDL 3785h B4DLC 3765h B2DLC 3745h B0DLC 3725h RXF13SIDL 3705h BRGCON3
PIC18(L)F25/26K83
37E4h TXB0EIDL 37C4h TXB2EIDL 37A4h RXF1SIDH 3784h B4EIDL 3764h B2EIDL 3744h B0EIDL 3724h RXF13SIDH 3704h BRGCON2
37E3h TXB0EIDH 37C3h TXB2EIDH 37A3h RXF0EIDL 3783h B4EIDH 3763h B2EIDH 3743h B0EIDH 3723h RXF12EIDL 3703h BRGCON1
37E2h TXB0SIDL 37C2h TXB2SIDL 37A2h RXF0EIDH 3782h B4SIDL 3762h B2SIDL 3742h B0SIDL 3722h RXF12EIDH 3702h TXERRCNT
37E1h TXB0SIDH 37C1h TXB2SIDH 37A1h RXF0SIDL 3781h B4SIDH 3761h B2SIDH 3741h B0SIDH 3721h RXF12SIDL 3701h RXERRCNT
37E0h TXB0CON 37C0h TXB2CON 37A0h RXF0SIDH 3780h B4CON 3760h B2CON 3740h B0CON 3720h RXF12SIDH 3700h CIOCON
Legend: Unimplemented data memory locations and registers, read as ‘0’.
DS40001943A-page 46
PIC18(L)F25/26K83
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
42.2 “Extended Instruction Set” and Table 42-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
8
00011 00011 1:256 2 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
14
01001 01001 1:16384 2 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
20
01111 01111 1:1048576 2 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-200000Fh)
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)F25/26K83 Memory
Programming Specification” (DS40000000).
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
PIC18F25K83 6EE0h
PIC18F26K83 6EC0h
PIC18LF25K83 6F20h
PIC18LF26K83 6F00h
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
MCLR Reset during normal operation 0 -uuu uuuu uuuu 0uuu ---- --u-
MCLR Reset during Sleep 0 -10u uuuu uuuu 0uuu ---- --u-
WDT Time-out Reset 0 -0uu uuuu uuu0 uuuu ---- --u-
WWDT Window Violation Reset 0 -uuu uuuu uu0u uuuu ---- --u-
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)
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
Preliminary
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
PIC18(L)F25/26K83
1
0000
FRQ<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
DS40001943A-page 83
Oscillator To Peripherals
To Peripherals
PIC18(L)F25/26K83
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, above 8 MHz
External clock sources rely on external circuitry for the
• ECM – Medium power, 100 kHz-8 MHz
clock source to function. Examples are: oscillator
modules (ECH, ECM, ECL mode), quartz crystal • ECL – Low power, below 100 MHz
resonators or ceramic resonators (LP, XT and HS The Oscillator Start-up Timer (OST) is disabled when
modes). EC mode is selected. Therefore, there is no delay in
Internal clock sources are contained within the operation after a Power-on Reset (POR) or wake-up
oscillator module. The internal oscillator block has two from Sleep. Because the PIC® MCU design is fully
internal oscillators that are used to generate internal static, stopping the external clock input will have the
system clock sources. The High-Frequency Internal effect of halting the device while leaving all data intact.
Oscillator (HFINTOSC) can produce 1, 2, 4, 8, 12, 16, Upon restarting the external clock, the device will
32, 48 and 64 MHz clock. The frequency can be resume operation as if no time had elapsed.
controlled through the OSCFRQ register (Register 7-
5). The Low-Frequency Internal Oscillator (LFINTOSC) FIGURE 7-2: EXTERNAL CLOCK (EC)
generates a fixed 31 kHz frequency. MODE OPERATION
A 4x PLL is provided that can be used with an external
clock. When used with the EXTOSC the 4x PLL has Clock from OSC1/CLKIN
input frequency limitations. See Section 7.2.1.4 “4x Ext. System
PLL” for more details. PIC® MCU
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 a high drive setting
CLKOUT is available for general purpose I/O or (above 8 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 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
register 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 45-9).
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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)F25/26K83
HIGH High Interrupt
INTSTAT = 11 requested
DS40001943A-page 110
9.4.1 SERVING A HIGH OR LOW PRIORITY INTERRUPT
2017 Microchip Technology Inc.
FIGURE 9-2: INTERRUPT EXECUTION: HIGH/LOW PRIORITY INTERRUPT WHEN EXECUTING MAIN ROUTINE
Rev. 10-000267A
9/12/2016
Preliminary
RETFIE Executed
Main Code Main Code Executing Main Code Execution Halted Main Code Executing
PIC18(L)F25/26K83
Interrupt
Interrupt Interrupt
received cleared
DS40001943A-page 111
9.4.2 SERVING A HIGH PRIORITY INTERRUPT WHILE A LOW
2017 Microchip Technology Inc.
FIGURE 9-3: INTERRUPT EXECUTION: HIGH PRIORITY INTERRUPT WITH A LOW PRIORITY INTERRUPT PENDING
Rev. 10-000267C
9/12/2016
Preliminary
PIC18(L)F25/26K83
RETFIE Executed
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
DS40001943A-page 112
received cleared
9.4.3 PREEMPTING LOW PRIORITY INTERRUPTS
2017 Microchip Technology Inc.
FIGURE 9-4: INTERRUPT EXECUTION: HIGH PRIORITY INTERRUPT PREEMPTING LOW PRIORITY INTERRUPTS
Rev. 10-000267B
9/12/2016
Preliminary
PIC18(L)F25/26K83
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
DS40001943A-page 113
9.4.4 SIMULTANEOUS LOW AND HIGH PRIORITY
2017 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
Rev. 10-000267D
9/12/2016
Main Code Main routine Main Code Execution Halted Main routine
High Priority
PIC18(L)F25/26K83
Interrupt
High Interrupt High Interrupt
received cleared
Low Priority
Interrupt
Low Interrupt Low Interrupt
received cleared
DS40001943A-page 114
PIC18(L)F25/26K83
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
No Context Save/Restore
No Context No Context
Preliminary
HIGH LOW
Save/Restore INTSTAT = 10 INTSTAT = 01 Save/Restore
No Context Save/Restore
PIC18(L)F25/26K83
HIGH No Context
INTSTAT = 11 Save/Restore
DS40001943A-page 116
PIC18(L)F25/26K83
9.6 Returning from Interrupt Service
Routine (ISR)
The “Return from Interrupt” instruction (RETFIE) is
used to mark the end of an ISR.
When RETFIE 1 instruction is executed, the PC is
loaded with the saved PC value from the top of the PC
stack. Saved context is also restored with the execution
of this instruction. Thus, execution returns to the previ-
ous state of operation that existed before the interrupt
occurred.
When RETFIE 0 instruction is executed, the saved
context is not restored back to the registers.
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
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
PIC18(L)F25/26K83
Interrupt Location = Interrupt vector table entry << 2
= 0x86 << 2 = 0x218
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
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
PIC18(L)F25/26K83
Interrupt Location = Interrupt vector table entry << 2
= 0x86 << 2 = 0x218
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
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
PIC18(L)F25/26K83
Interrupt Location = Interrupt vector table entry << 2
= 0x86 << 2 = 0x218
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
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
Preliminary
Program
X X+2 X+2 X+4 X+6
Counter
Instruction
Inst @ X(1) FNOP Inst @ X+2 Inst @ X+4
Register
Interrupt
PIC18(L)F25/26K83
Routine MAIN FNOP MAIN
Note 1: Inst @ X clears the interrupt flag, Example BCF INTCON0, GIE.
DS40001943A-page 121
PIC18(L)F25/26K83
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 appropri- whether the part is in Run, Idle/Doze or Sleep modes.
ate 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 asyn-
initialized, such that all user interrupt chronous 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 inter- feature is disabled and interrupts are compatible with
rupt 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.
InterruptInit:
BANKSEL INTCON0 ; Select bank for INTCON0
BSF INTCON0, GIEH ; Enable high priority interrupts
BSF INTCON0, GIEL ; Enable low priority interrupts
BSF INTCON0, IPEN_INTCON0 ; Enable interrupt priority
VectorTableInit:
; Set IVTBASE (optional - default is 0x000008)
MOVLW 0x00 ; This is optional
MOVWF IVTBASEU, ACCESS ; If not included, then the
MOVLW 0x40 ; hardware default value of
MOVWF IVTBASEH, ACCESS ; 0x0008 will be taken.
MOVLW 0x08
MOVWF IVTBASEL, 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
Note 1: Interrupt flag bits get set when an interrupt condition occurs, regardless of the state of its corresponding
enable bit, or the global enable bit. User software should ensure the appropriate interrupt flag bits are
clear prior to enabling an interrupt.
2: IOCIF is a read-only bit. To clear the interrupt condition, all bits in the IOCxF registers must be cleared.
3: The CSWIF interrupt will not wake the system from Sleep. The system will sleep until another interrupt
causes the wake-up.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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
Note 1: Interrupt flag bits get set when an interrupt condition occurs, regardless of the state of its corresponding
enable bit, or the global enable bit. User software should ensure the appropriate interrupt flag bits are
clear prior to enabling an interrupt.
2: The external interrupt GPIO pin is selected by the INTxPPS 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 HS = Hardware set
Note 1: Interrupt flag bits get set when an interrupt condition occurs, regardless of the state of its corresponding
enable bit, or the global enable bit. User software should ensure the appropriate interrupt flag bits are clear
prior to enabling an interrupt.
2: I2CxTXIF and I2CxRXIF are read-only bits. To clear the interrupt condition, the CLRBF bit in I2CxSTAT1
register must be set.
3: SPIxIF is a read-only bit. To clear the interrupt condition, all bits in the SPIxINTF register must be cleared.
4: SPIxTXIF and SPIxRXIF are read-only bits and cannot be set/cleared by the software.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared HS = Bit is set in hardware
Note 1: Interrupt flag bits get set when an interrupt condition occurs, regardless of the state of its corresponding
enable bit, or the global enable bit. User software should ensure the appropriate interrupt flag bits are
clear prior to enabling an interrupt.
2: UxIF is a read-only bit. To clear the interrupt condition, all bits in the UxUIR register must be cleared.
3: UxEIF is a read-only bit. To clear the interrupt condition, all bits in the UxERRIR register must be cleared.
4: UxTXIF and UxRXIF are read-only bits and cannot be set/cleared by the software.
5: I2CxEIF is a read-only bit. To clear the interrupt condition, all bits in the I2CxERR register must be cleared.
6: I2CxIF is a read-only bit. To clear the interrupt condition, all bits in the I2CxPIR register must be cleared.
7: I2CxTXIF and I2CxRXIF are read-only bits. To clear the interrupt condition, the CLRBF bit in I2CxSTAT1
register must be set.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared 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
Note 1: Interrupt flag bits get set when an interrupt condition occurs, regardless of the state of its corresponding enable bit, or the global
enable bit. User software should ensure the appropriate interrupt flag bits are clear prior to enabling an interrupt.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared HS = Bit is set in hardware
Note 1: Interrupt flag bits get set when an interrupt condition occurs, regardless of the state of its corresponding enable bit, or
the global enable bit. User software should ensure the appropriate interrupt flag bits are clear prior to enabling an inter-
rupt.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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
Note 1: Interrupt flag bits get set when an interrupt condition occurs, regardless of the state of its corresponding
enable bit, or the global enable bit. User software should ensure the appropriate interrupt flag bits are
clear prior to enabling an interrupt.
2: UxIF is a read-only bit. To clear the interrupt condition, all bits in the UxUIR register must be cleared.
3: UxEIF is a read-only bit. To clear the interrupt condition, all bits in the UxERRIR register must be cleared.
4: UxTXIF and UxRXIF are read-only bits and cannot be set/cleared by the software.
5: I2CxEIF is a read-only bit. To clear the interrupt condition, all bits in the I2CxERR register must be cleared.
6: I2CxIF is a read-only bit. To clear the interrupt condition, all bits in the I2CxPIR register must be cleared.
7: I2CxTXIF and I2CxRXIF are read-only bits. To clear the interrupt condition, the CLRBF bit in I2CxSTAT1
register must be set.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared HS = Bit is set in hardware
Note 1: Interrupt flag bits get set when an interrupt condition occurs, regardless of the state of its corresponding
enable bit, or the global enable bit. User software should ensure the appropriate interrupt flag bits are
clear prior to enabling an interrupt.
2: The external interrupt GPIO pin is selected by the INTxPPS 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
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 9-33: 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-34: 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-35: 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
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.
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 PIC18F25/26K83 device family contains an In the default operating mode, the LDO and reference
internal Low Dropout (LDO) voltage regulator, which circuitry remain in the normal configuration while in
allows the device I/O pins to operate at voltages up to Sleep. The device is able to exit Sleep mode quickly
5.5V while the internal device logic operates at a lower since all circuits remain active. In Low-Power Sleep
voltage. The LDO and its associated reference circuitry mode, when waking-up from Sleep, an extra delay time
must remain active when the device is in Sleep mode. is required for these circuits to return to the normal
The PIC18F25/26K83 devices allows the user to configuration and stabilize.
optimize the operating current in Sleep, depending on The Low-Power Sleep mode is beneficial for
the application requirements. applications that stay in Sleep mode for long periods of
time. The Normal mode is beneficial for applications
Low-Power Sleep mode can be selected by setting the
that need to wake from Sleep quickly and frequently.
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
Note 1: When ROI = 1 or DOE = 1, DOZEN is changed by hardware interrupt entry and/or exit.
2: Entering ICD overrides DOZEN, returning the CPU to full execution speed; this bit is not affected.
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-3: 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-4: 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.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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 Even though the DMA module has access to all
causing a processor stall. memory and peripherals that are also available to the
CPU, it is recommended that the DMA does not access
15.4 DMA Interface any register that is part of the System arbitration. The
DMA, as a system arbitration client should not be read
The DMA module transfers data from the source to the or written by itself or by another DMA instantiation.
destination one byte at a time, this smallest data move-
ment is called a DMA data transaction. A DMA Mes- The following sections discuss the various control
sage refers to one or more DMA data transactions. interfaces required for DMA data transfers.
Each DMA data transaction consists of two separate 15.4.1 DMA ADDRESSING
actions:
The start addresses for the source read and destination
• Reading the Source Address Memory and storing write operations are set using the DMAxSSA <21:0>
the value in the DMA Buffer register and DMAxDSA <15:0> registers, respectively.
• Writing the contents of the DMA Buffer register to
When the DMA Message transfers are in progress, the
the Destination Address Memory
DMAxSPTR <21:0> and DMAxDPTR <15:0> registers
Note: DMA data movement is a two-cycle contain the current address pointers for each source
operation. read and destination write operation, these registers
are modified after each transaction based on the
The XIP bit (DMAxCON0 register) is a Status bit to
Address mode selection bits.
indicate whether or not the data in the DMAxBUF
register has been written to the destination address. If The SMODE and DMODE bits in the DMAxCON1
the bit is set then data is waiting to be written to the control register determine the address modes of
destination. If clear it means that either data has been operation by controlling how the DMAxSPTR <21:0>
written to the destination or that no source read has and DMAxDPTR <15:0> bits are updated after every
occurred. DMA data transaction combination (Figure 15-2).
The DMA has read access to PFM, Data EEPROM, Each address can be separately configured to:
and SFR/GPR space, and write access to SFR/GPR • Remain unchanged
space. Based on these memory access capabilities, • Increment by 1
the DMA can support the following memory • Decrement by 1
transactions:
DMAxSSA[21:0] DMAxDSA[15:0]
DMAxSPTR[21:0] DMAxSPTR[15:0]
+1 +1
0 0
-1 -1
SMODE<1:0> DMODE<1:0>
The DMA can initiate data transfers from the PFM, Data A message is started by setting the DGO bit of the
EEPROM or SFR/GPR Space. The SMR<1:0> bits in DMAxCON0 register and terminates when the smaller
the DMAxCON1 register are used to select the type of of the two counters reaches zero.
memory being pointed to by the Source Address When either counter reaches zero the DGO bit is
Pointer. The SMR<1.0> bits are required because the cleared and the counter and pointer registers are
PFM and SFR/GPR spaces have overlapping immediately reloaded with the corresponding size and
addresses that do not allow the specified address to address data. If the other counter did not reach zero
uniquely define the memory location to be accessed. then the next message will continue with the count and
Note 1: For proper memory read access to occur, address corresponding to that register.
the combination of address and space When the source and destination size registers are not
selection must be valid. equal then the ratio of the largest to the smallest size
2: The destination does not have space determines how many messages are in the DMA
selection bits because it can only write to process. For example, when the destination size is 6
the SFR/GPR space. and the source size is 2 then each message will consist
of two transactions and the complete DMA process will
15.4.2 DMA MESSAGE SIZE/COUNTERS consist of three messages. When the larger size is not
an even integer of the smaller size then the last
A transaction is the transfer of one byte. A message message in the process will terminate early when the
consists of one or more transactions. A complete DMA larger count reaches zero. In that case, the larger
process consists of one or more messages. The size counter will reset and the smaller counter will have a
registers determine how many transactions are in a remainder skewing any subsequent messages by that
message. The DMAxSSZ registers determine the amount.
source size and DMAxDSZ registers determine the
destination size. Note: Reading the DMAxSCNT or DMAxDCNT
registers will never return zero. When
When a DMA transfer is initiated, the size registers are
either register is decremented from ‘1’ it is
copied to corresponding counter registers that control
immediately reloaded from the
the duration of the message. The DMAxSCNT registers
corresponding size register.
count the source transactions and the DMAxDCNT
registers count the destination transactions. Both are
simultaneously decremented by one after each
transaction.
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
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
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%
Preliminary
PIC18(L)F25/26K83
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
DS40001943A-page 235
PIC18(L)F25/26K83
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 Bank 64 (0x4000-0x40FF), these Mirror
15.11 Power Saving Mode Operation registers can be only accessed through the DMA
Source and Destination Address registers.
The DMA utilizes system clocks and it is treated as a
peripheral when it comes to power-saving operations.
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
PORTA
PORTE
Device
Read LATx
TRISx
PIC18(L)F25K83 (1)
D Q
PIC18(L)F26K83 (1) Write LATx
Write PORTx
Note 1: Pin RE3 only. CK VDD
Each port has ten registers to control the operation. Data Register
These registers are:
Data Bus
• PORTx registers (reads the levels on the pins of I/O pin
the device) Read PORTx
• LATx registers (output latch) To digital peripherals
• TRISx registers (data direction) VSS
ANSELx
• ANSELx registers (analog select) To analog peripherals
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
Note 1: Writes to LATx are equivalent with writes to the corresponding PORTx register. Reads from LATx register
return register values, not 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’
u = Bit is unchanged 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
Rev. 10-000262D
3/27/2017
RxyPPS
abcPPS
Rxy
Rxy
Peripheral abc
RxyPPS
Rxy
Peripheral xyz
RxyPPS
Rxy
xyzPPS
Rxy
Note: Refer to Table 17-1 for pins that are I2C ; Required sequence, next 4 instructions
MOVWF PPSLOCK
compatible. Clock and data signals can be
MOVLW AAh
routed to any pin, however pins without MOVWF PPSLOCK
I2C compatibility will operate at standard
TTL/ST logic levels as selected by the ; Clear PPSLOCKED bit to enable writes
INVLV register. ; Only a BCF instruction will work
BCF PPSLOCK,0
17.4 PPS Lock ; Enable Interrupts
The PPS includes a mode in which all input and output BSF INTCON0,GIE
selections can be locked to prevent inadvertent
changes. PPS selections are locked by setting the 17.5 PPS One-way Lock
PPSLOCKED bit of the PPSLOCK register. Setting and
clearing this bit requires a special sequence as an extra When this bit is set, the PPSLOCKED bit can only be
precaution against inadvertent changes. Examples of cleared and set one time after a device Reset. This
setting and clearing the PPSLOCKED bit are shown in allows for clearing the PPSLOCKED bit so that the
Example 17-1. input and output selections can be made during initial-
ization. When the PPSLOCKED bit is set after all selec-
EXAMPLE 17-1: PPS LOCK SEQUENCE tions have been made, it will remain set and cannot be
; Disable interrupts: cleared until after the next device Reset event.
BCF INTCON0,GIE
17.6 Operation During Sleep
; Bank to PPSLOCK register
BANKSEL PPSLOCK PPS input and output selections are unaffected by
MOVLB PPSLOCK Sleep.
MOVLW 55h
17.7 Effects of a Reset
; Required sequence, next 4 instructions
MOVWF PPSLOCK A device Power-on-Reset (POR) clears all PPS input
MOVLW AAh and output selections to their default values. All other
MOVWF PPSLOCK Resets leave the selections unchanged. Default input
selections are shown in pin allocation Table 3. The PPS
; Set PPSLOCKED bit to disable writes
one-way lock is also removed.
; Only a BSF instruction will work
BSF PPSLOCK,0
; 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.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
IOCANx D Q
R Q4Q1
edge
detect
RAx
to data bus
data bus = S
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
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 T2TMR_posts-
• Free Running Period
caled, which pulses for a single T2TMR_clk period
• One-Shot when the postscaler counter matches the value in the
• Monostable OUTPS bits of the TxCON register. The T2PR posts-
Within each mode there are several options for starting, caler is incremented each time the T2TMR value
stopping, and reset. Table 22-1 lists the options. matches the T2PR value. this signal can be selected as
an input to several other input modules.
In all modes the T2TMR count register is incremented
on the rising edge of the clock signal from the program- Timer2 is also used by the CCP module for pulse gen-
mable prescaler. When T2TMR equals T2PR then a eration in PWM mode. Both the actual T2TMR value as
high level is output to the postscaler counter. T2TMR is well as other internal signals are sent to the CCP mod-
cleared on the next clock input. ule to properly clock both the period and pulse width of
the PWM signal. See Section 23.0 “Capture/Com-
An external signal from hardware can also be config-
pare/PWM Module” for more details on setting up
ured to gate the timer operation or force a T2TMR
Timer2 for use with the CCP, as well as the timing dia-
count Reset. In gate modes the counter stops when the
grams in Section 22.5 “Operation Examples” for
gate is disabled and resumes when the gate is
examples of how the varying Timer2 modes affect CCP
enabled. In Reset modes the T2TMR count is reset on
PWM output.
either the level or edge from the external source.
The T2TMR and T2PR registers are both directly read- 22.3 External Reset Sources
able and writable. The T2TMR register is cleared and
the T2PR register initializes to FFh on any device In addition to the clock source, the Timer2 also takes in
Reset. Both the prescaler and postscaler counters are an external Reset source. This external Reset source
cleared on the following events: is selected for Timer2, Timer4, and Timer6 with the
T2RST, T4RST, and T6RST registers, respectively.
• a write to the T2TMR register
This source can control starting and stopping of the
• a write to the TxCON register timer, as well as resetting the timer, depending on
• any device Reset which mode the timer is in. The mode of the timer is
• External Reset Source event that resets the timer. controlled by the MODE bits of the T2HLT register.
Note: T2TMR is not cleared when TxCON is Edge Triggered modes require six Timer clock periods
written. between external triggers. Level Triggered modes
require the triggering level to be at least three Timer
clock periods long. External triggers are ignored while
22.1.1 FREE RUNNING PERIOD MODE
in Debug Freeze mode.
The value of T2TMR is compared to that of the Period
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 first operation.
external signal edge after the ON bit is set and resets on all subsequent edges.
When this mode is used in conjunction with the CCP then the first starting edge
Only the first edge after the ON bit is set is needed to start the timer. The
trigger, and all subsequent Reset edges, will activate the PWM drive. The PWM
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 exter-
• Rising edge Start and Reset (MODE<4:0> = 01100) nal 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
Preliminary
TMRx_clk
TxPR 5
PIC18(L)F25/26K83
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
DS40001943A-page 315
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 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
• 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
Preliminary
TMRx_clk
TxPR 5
ON
PIC18(L)F25/26K83
TMRx_ers
TxTMR 0 1 2 3 4 5 0 1 0 1 2 3 4 5 0
TMRx_postscaled
PWM Duty
3
Cycle
DS40001943A-page 316
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 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)
• 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
Preliminary
ON
TMRx_ers
PIC18(L)F25/26K83
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
DS40001943A-page 317
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 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 exter-
will start the timer. Reset levels are selected as follows: nal signal edge or the setting of the ON bit, whichever of the two starts the timer.
• Low reset level (MODE<4:0> = 10110)
• 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
Preliminary
TxPR 5
ON
PIC18(L)F25/26K83
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
DS40001943A-page 318
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)F25/26K83
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.
Note: If an event occurs during a 2-byte read, Note: Clocking Timer1 from the system clock
the high and low-byte data will be from (FOSC) should not be used in Capture
different events. It is recommended while mode. In order for Capture mode to
reading the CCPRxH:CCPRxL register recognize the trigger event on the CCPx
pair to either disable the module or read pin, Timer1 must be clocked from the
the register pair twice for data integrity. instruction clock (FOSC/4) or from an
Figure 23-1 shows a simplified diagram of the capture external clock source.
operation.
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>
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
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<3:0>
CCP1 CCP2 CCP3 CCP4
1111-1001 Reserved
1000 CAN_rx_timestamp
0111 CLC4_out
0110 CLC3_out
0101 CLC2_out
0100 CLC1_out
0011 IOC_Interrupt
0010 CMP2_output
0001 CMP1_output
Pin selected by Pin selected by Pin selected by Pin selected by
0000
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
log 4 T2PR + 1
Resolution = ---------------------------------------------- bits
log 2
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-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
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
Preliminary
SMTxIF
PIC18(L)F25/26K83
DS40001943A-page 351
PIC18(L)F25/26K83
25.6.2 GATED TIMER MODE
Gated Timer mode uses the SMTSIGx input to control
whether or not the SMTxTMR will increment. Upon a
falling edge of the external signal, the SMTxCPW
register will update to the current value of the
SMTxTMR. Example waveforms for both repeated and
single acquisitions are provided in Figure 25-4 and
Figure 25-5.
SMTx_signal
SMTx_signalsync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxPR 0xFFFFFF
Preliminary
SMTxTMR 0 1 2 3 4 5 6 7
SMTxCPW 5 7
SMTxPWAIF
PIC18(L)F25/26K83
DS40001943A-page 353
FIGURE 25-5: GATED TIMER MODE SINGLE ACQUISITION TIMING DIAGRAM
2017 Microchip Technology Inc.
SMTx_signal
SMTx_signalsync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxPR 0xFFFFFF
Preliminary
SMTxTMR 0 1 2 3 4 5
SMTxCPW 5
SMTxPWAIF
PIC18(L)F25/26K83
DS40001943A-page 354
PIC18(L)F25/26K83
25.6.3 PERIOD AND DUTY CYCLE MODE
In Duty Cycle mode, either the duty cycle or period
(depending on polarity) of the SMTx_signal can be
acquired relative to the SMT clock. The CPW register is
updated on a falling edge of the signal, and the CPR
register is updated on a rising edge of the signal, along
with the SMTxTMR resetting to 0x0001. In addition, the
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
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
Preliminary
SMTxCPW 5 2
SMTxCPR 11
SMTxPWAIF
PIC18(L)F25/26K83
SMTxPRAIF
DS40001943A-page 356
FIGURE 25-7: PERIOD AND DUTY-CYCLE SINGLE ACQUISITION TIMING DIAGRAM
2017 Microchip Technology Inc.
SMTx_signal
SMTx_signalsync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxTMR 0 1 2 3 4 5 6 7 8 9 10 11
Preliminary
SMTxCPW 5
SMTxCPR 11
SMTxPWAIF
PIC18(L)F25/26K83
SMTxPRAIF
DS40001943A-page 357
PIC18(L)F25/26K83
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 SMTxTMR on a rising edge on the
SMTSIGx input, then updates the SMTxCPW register
with the value and resets the SMTxTMR on a falling
edge, starting to increment again. Upon observing
another rising edge, it updates the SMTxCPR register
with its current value and once again resets the
SMTxTMR value and begins incrementing again. See
Figure 25-8 and Figure 25-9.
SMTx_signal
SMTx_signalsync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
Preliminary
SMTxTMR 0 1 2 3 4 5 1 2 3 4 5 6 1 2 1 2 3
SMTxCPW 5 2
SMTxCPR 6
SMTxPWAIF
PIC18(L)F25/26K83
SMTxPRAIF
DS40001943A-page 359
FIGURE 25-9: HIGH AND LOW MEASURE MODE SINGLE ACQUISITION TIMING DIAGRAM
2017 Microchip Technology Inc.
SMTx_signal
SMTx_signalsync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
Preliminary
SMTxTMR 0 1 2 3 4 5 1 2 3 4 5 6
SMTxCPW 5
SMTxCPR 6
PIC18(L)F25/26K83
SMTxPWAIF
SMTxPRAIF
DS40001943A-page 360
PIC18(L)F25/26K83
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 SMTxCPR 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
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
Preliminary
SMTxCPR 12 8
SMTxPRAIF
PIC18(L)F25/26K83
DS40001943A-page 362
FIGURE 25-11: WINDOWED MEASURE MODE SINGLE ACQUISITION TIMING DIAGRAM
2017 Microchip Technology Inc.
SMTxWIN
SMTxWIN_sync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxTMR 0 1 2 3 4 5 6 7 8 9 10 11 12
Preliminary
SMTxCPR 12
SMTxPRAIF
PIC18(L)F25/26K83
DS40001943A-page 363
PIC18(L)F25/26K83
25.6.6 GATED WINDOWED MEASURE
MODE
This mode measures the duty cycle of the SMTx_signal
input over a known input window. It does so by
incrementing the timer on each pulse of the clock signal
while the SMTx_signal input is high, updating the
SMTxCPR register and resetting the timer on every
rising edge of the SMTWINx input after the first. See
Figure 25-12 and Figure 25-13.
SMTxWIN
SMTxWIN_sync
SMTx_signal
SMTx_signalsync
SMTx Clock
SMTxEN
Preliminary
SMTxGO
SMTxGO_sync
SMTxTMR 0 1 2 3 4 5 6 0 1 2 3 0
PIC18(L)F25/26K83
SMTxCPR 6 3
SMTxPRAIF
DS40001943A-page 365
FIGURE 25-13: GATED WINDOWED MEASURE MODE SINGLE ACQUISITION TIMING DIAGRAMS
2017 Microchip Technology Inc.
PIC18(L)F25/26K83
Rev. 10-000 183A
12/19/201 3
SMTxWIN
SMTxWIN_sync
SMTx_signal
SMTx_signalsync
SMTx Clock
SMTxEN
SMTxGO
Preliminary
SMTxGO_sync
SMTxTMR 0 1 2 3 4 5 6
SMTxCPR 6
SMTxPRAIF
DS40001943A-page 366
PIC18(L)F25/26K83
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
SMTx_signal input, beginning to increment the timer
upon observing a rising edge on the SMTWINx input,
while updating the SMTxCPR register and resetting the
timer upon observing a rising edge on the SMTx_signal
input. In the event of two SMTWINx rising edges
without an SMTx_signal rising edge, it will update the
SMTxCPW register with the current value of the timer
and reset the timer value. See Figure 25-14 and
Figure 25-15.
Rev. 10-000186A
4/22/2016
SMTxWIN
SMTxWIN_sync
SMTx_signal
SMTx_signalsync
SMTx Clock
SMTxEN
Preliminary
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
PIC18(L)F25/26K83
SMTxCPW 13
SMTxCPR 4
SMTxPWAIF
SMTxPRAIF
DS40001943A-page 368
FIGURE 25-15: TIME OF FLIGHT MODE SINGLE ACQUISITION TIMING DIAGRAM
2017 Microchip Technology Inc.
Rev. 10-000185A
4/26/2016
SMTxWIN
SMTxWIN_sync
SMTx_signal
SMTx_signalsync
SMTx Clock
SMTxEN
SMTxGO
Preliminary
SMTxGO_sync
SMTxTMR 0 1 2 3 4 5
SMTxCPW
PIC18(L)F25/26K83
SMTxCPR 4
SMTxPWAIF
SMTxPRAIF
DS40001943A-page 369
PIC18(L)F25/26K83
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 SMTxCPR
register on each rising edge of SMTWINx, and updates
the value of the CPW register on each falling edge of
the SMTWINx. The timer is not reset by any hardware
conditions in this mode and must be reset by software,
if desired. See Figure 25-16 and Figure 25-17.
SMTxWIN
SMTxWIN_sync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
Preliminary
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
PIC18(L)F25/26K83
SMTxPWAIF
SMTxPRAIF
DS40001943A-page 371
FIGURE 25-17: CAPTURE MODE SINGLE ACQUISITION TIMING DIAGRAM
2017 Microchip Technology Inc.
PIC18(L)F25/26K83
Rev. 10-000 187A
12/19/201 3
SMTxWIN
SMTxWIN_sync
SMTx Clock
SMTxEN
SMTxGO
SMTxGO_sync
SMTxTMR 0 1 2 3
Preliminary
SMTxCPW 3
SMTxCPR 2
SMTxPWAIF
SMTxPRAIF
DS40001943A-page 372
25.6.9 COUNTER MODE
2017 Microchip Technology Inc.
This mode increments the timer on each pulse of the SMTx_signal input. This
mode is asynchronous to the SMT clock and uses the SMTx_signal as a time
source. The SMTxCPW register will be updated with the current SMTxTMR
value on the rising edge of the SMTxWIN input. See Figure 25-18.
Rev. 10-000189A
4/12/2016
SMTxWIN
SMTx_signal
SMTxEN
Preliminary
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
PIC18(L)F25/26K83
DS40001943A-page 373
PIC18(L)F25/26K83
25.6.10 GATED COUNTER MODE
This mode counts pulses on the SMTx_signal input,
gated by the SMTxWIN input. It begins incrementing
the timer upon seeing a rising edge of the SMTxWIN
input and updates the SMTxCPW register upon a fall-
ing edge on the SMTxWIN input. See Figure 25-19
and Figure 25-20.
Rev. 10-000190A
12/18/2013
SMTxWIN
SMTx_signal
SMTxEN
SMTxGO
SMTxTMR 0 1 2 3 4 5 6 7 8 9 10 11 12 13
SMTxCPW 8 13
SMTxPWAIF
Preliminary
PIC18(L)F25/26K83
SMTxWIN
SMTx_signal
SMTxEN
SMTxGO
DS40001943A-page 375
SMTxTMR 0 1 2 3 4 5 6 7 8
SMTxCPW 8
SMTxPWAIF
PIC18(L)F25/26K83
25.6.11 WINDOWED COUNTER MODE
This mode counts pulses on the SMTx_signal input,
within a window dictated by the SMTxWIN input. It
begins counting upon seeing a rising edge of the
SMTxWIN input, updates the SMTxCPW register on a
falling edge of the SMTxWIN input, and updates the
SMTxCPR register on each rising edge of the
SMTxWIN input beyond the first. See Figure 25-21 and
Figure 25-22.
Rev. 10-000192A
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 1 2 3 4 5
SMTxCPW 9 5
SMTxCPR 16
Preliminary
SMTxPWAIF
SMTxPRAIF
PIC18(L)F25/26K83
DS40001943A-page 377
FIGURE 25-22: WINDOWED COUNTER MODE SINGLE ACQUISITION TIMING DIAGRAM
2017 Microchip Technology Inc.
PIC18(L)F25/26K83
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
Preliminary
SMTxPWAIF
SMTxPRAIF
DS40001943A-page 378
PIC18(L)F25/26K83
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 SMTxTMR<7:0>: Significant bits of the SMT Counter – Low Byte
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
bit 7-0 SMTxTMR<15:8>: Significant bits of the SMT Counter – High Byte
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
bit 7-0 SMTxTMR<23:16>: Significant bits of the SMT Counter – Upper Byte
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
bit 7-0 SMTxCPR<7:0>: Significant bits of the SMT Period Latch – Low Byte
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
bit 7-0 SMTxCPR<15:8>: Significant bits of the SMT Period Latch – High Byte
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
bit 7-0 SMTxCPR<23:16>: Significant bits of the SMT Period Latch – Upper Byte
REGISTER 25-13: SMTxCPWL: SMT CAPTURED PULSE WIDTH REGISTER – LOW BYTE
R-x/x R-x/x R-x/x R-x/x R-x/x R-x/x R-x/x R-x/x
SMTxCPW<7:0>
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
bit 7-0 SMTxCPW<7:0>: Significant bits of the SMT PW Latch – Low Byte
REGISTER 25-14: SMTxCPWH: SMT CAPTURED PULSE WIDTH REGISTER – HIGH BYTE
R-x/x R-x/x R-x/x R-x/x R-x/x R-x/x R-x/x R-x/x
SMTxCPW<15:8>
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
bit 7-0 SMTxCPW<15:8>: Significant bits of the SMT PW Latch – High Byte
REGISTER 25-15: SMTxCPWU: SMT CAPTURED PULSE WIDTH REGISTER – UPPER BYTE
R-x/x R-x/x R-x/x R-x/x R-x/x R-x/x R-x/x R-x/x
SMTxCPW<23:16>
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
bit 7-0 SMTxCPW<23:16>: Significant bits of the SMT PW Latch – Upper Byte
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
bit 7-0 SMTxPR<7:0>: Significant bits of the SMT Timer Value for Period Match – Low Byte
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
bit 7-0 SMTxPR<15:8>: Significant bits of the SMT Timer Value for Period Match – High Byte
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
bit 7-0 SMTxPR<23:16>: Significant bits of the SMT Timer Value for Period Match – Upper Byte
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
2/2/2016
‘1’ 00
‘0’ 01
High-Z 10
11
CWG Data A 1
1
POLA 0 CWG1A
0
DATA
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
DATB
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
DATC
‘1’ 00
‘0’ 01
High-Z 10
11
CWG Data D
1
1
POLD 0 CWG1D
0
DATD
SHUTDOWN
STRD
FREEZE
D Q
CWG Data
cwg_clock
Input Source
CWGxA
CWGxB
Preliminary
FIGURE 26-13: DEAD-BAND OPERATION, CWGxDBR = 0x03, CWGxDBF = 0x06, SOURCE SHORTER THAN DEAD BAND
PIC18(L)F25/26K83
cwg_clock
Input Source
CWGxA
DS40001943A-page 404
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
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
Preliminary
FIGURE 26-15: SHUTDOWN FUNCTIONALITY, AUTO-RESTART DISABLED (REN = 0, LSAC = 01, LSBD = 01)
PIC18(L)F25/26K83
CWG Input
Source
Shutdown Source
SHUTDOWN
CWG Input
Source
Shutdown Source
SHUTDOWN
PIC18(L)F25/26K83
DS40001943A-page 409
PIC18(L)F25/26K83
26.14 Register Definitions: CWG Control
Long bit name prefixes for the CWG peripheral is
shown below. Refer to Section 1.3.2.2 “Long Bit
Names” for more information.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared 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 corre-
sponding 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)F25/26K83
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
Preliminary
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
EN S Q
_ D Q OUT
Ripple
R Q
Counter
Pulse Q1
DS40001943A-page 435
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)F25/26K83
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
V MAXPEAK + V MINPEAK
R SERIES = ---------------------------------------------------------
–4
7 10
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
1111 SYNC
Q
MS<4:0> 1
0
00000
CHSYNC
RxyPPS
See
MOD
MD1SRC
PPS
Register
OPOL
11111
CL<4:0>
D
SYNC
00000 Q
1
0
See
MD1CARL CARL
Register CLSYNC
CLPOL
11111
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 455
MD1CON1 — — CHPOL CHSYNC — — CLPOL CLSYNC 456
MD1CARH — — — — — CHS<2:0> 457
MD1CARL — — — — — CLS<2:0> 457
MDSRC — — — — SRCS<3:0> 458
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)
To replace or delete any pending forward frame data, The UART starts listening for a forward frame when the
the TXBE bit needs to be set to flush the shift register Control Gear mode is entered. Only the frames that fol-
and transmit buffer, then write the new control byte to low an Idle period longer than UxP2 half-bit periods are
the UxTXB register. The new control byte will be held in detected as forward frames. Backward frames from
the buffer and sent as the beginning of the next forward other Control Gear are ignored. Only forward frames
frame following the UxP1 wait time. will be stored in UxRXB. This is necessary because a
backward frame can be sent only as a response to a
In Control Device mode, PERIF is set when a forward forward frame.
frame is received. This helps the software distinguish
whether the received byte is part of a forward frame The forward frame is received one byte at a time in the
from a Control Device (either from the Control Device receive FIFO and retrieved by reading the UxRXB reg-
under consideration or from another Control Device on ister. The end of the forward frame starts a timer to
the bus) or a backward frame from a Control Gear. delay the backward frame response by wait time equal
to the number of half-bit periods stored in UxP1. The
data received in the forward frame is processed by the
application software. If the application decides to send
a backward frame in response to the forward frame, the
value of the backward frame is written to UxTXB. This
value is held for transmission in the transmit shift regis-
ter until the wait time expires and is then transmitted.
If the backward frame data is written to UxTXB after the
wait time has expired, it is held in the UxTXB register
until the end of the wait time following the next forward
frame. The TXMTIF bit is false when the backward
frame data is held in the transmit shift register. Receiv-
ing a UxRXIF interrupt before the TXMTIF goes true
indicates that the backward frame write was too late
and another forward frame was received before send-
ing the backward frame. The pending backward frame
has to be flushed by setting the TXBE bit, to prevent it
from being sent after the next Forward Frame.
TXMTIF bit
(Transmit Shift
Reg. Empty Flag)
TXMTIF bit
(Transmit Shift
Reg. Empty Flag)
RX R 4k7
(1) RE A
TXDE
DE B
TX D 4k7
SN75176
Gnd
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: ABDEN is read-only when MODE = 1001. When MODE = 100x and ABDEN = 1, then auto-baud is determined from
Start 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
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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
PIC18F2X/4XK42 GPIO (optional) PIC18F2X/4XK42
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.
SDAHT<1:0>
I2CxADD0/1/2/3
PIC18(L)F25/26K83
Transfer
Counter
I2CCLK<3:0>
Master
See
Module
I2CxBTO
Register
Slave
Module RxyPPS SCL(out)
I2CBTO<2:0>
Interrupt
SCL(in) I2CxSCLPPS Controller
DS40001943A-page 529
I2CLVL<1:0>
PIC18(L)F25/26K83
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
Add ress is compared to Genera l Call Add ress (I2CxA DR0 = 0x00)
afte r ACK, set interrup t
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)F25/26K83
Rev. 10-000 293A
11/2/201 6
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
SCIE = 0 ADRIE = 0 WRIE = 0 WRIE = 0
CSTR is not held low ACKTIE = 0 ACKTIE = 0 ACKTIE = 0
SMA
SCIF is set
PCIF is set
Preliminary
R/W
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/A
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/W
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/A
matching address copied to
I2CxADB0
PIC18(L)F25/26K83
I2CxCNT 0x02 0x02 0x01 0x00
Slave sends ACKCNT
value for I2CxCNT = 0
CNTIF is set
RXBF
PIC18(L)F25/26K83
Rev. 10-000 295A
11/2/201 6
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
CSTR cleared software, Software clears CSTR
ADRIE = 1 WRIE = 1
SCL is released SCL is released
CSTR is set by hardware CSTR is set by hardware WRIE = 1
R/W
WRIF is set WRIF is set ACKTIF is set
Preliminary
D/A
matching address written to
Data byte written to I2CxRXB Second data byte to I2CxRXB
I2CxADB0
ACKDT
RXBF
DS40001943A-page 540
PIC18(L)F25/26K83
Rev. 10-000 296A
11/2/201 6
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 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
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/W
R/W copied from matching address
ADRIF is set ACKTIF is set ACKTIF is set
D/A
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
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
ADRIE = 0
SCIF is set ACKTIE = 0 ACKTIE = 0 ACKTIE = 0 PCIF is set
R/W
R/W copied from matching address
Preliminary
D/A
ACKSTAT
PIC18(L)F25/26K83
Master’s ACK NACKIF is set
copied to ACKSTAT
CNTIF is set
TXBE
Software writes
Before Start, software loads
I2CxTXB
one byte in I2CxTXB
No new TX data on I2CxCNT = 0
MSb is of I2CxTXB copied to SDA
DS40001943A-page 543
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
ADRIE = 0 ADRIE = 0 PCIF is set
SCIF is set ACKTIE = 0
R/W
R/W copied from matching address ACKTIF is ACKTIF is
ACKTIF NOT set for
Preliminary
D/A
PIC18(L)F25/26K83
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 = 1 P
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
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
Preliminary
SMA
PIC18(L)F25/26K83
R/W
R/W copied from matching ad dress ACKTIE NOT set
ADRIF is set for high address /w ACKTIE is set ACKTIE is set
ACKTIE is set
D/A
matching add ress R/W value
copied
TXBE
DS40001943A-page 547
I2CxTXIF is set
Software load s I2CxTXB
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 Acknowl-
TIMING edge sequence. The master then waits one clock
period (TSCL) and the SCL pin is released high. When
An Acknowledge sequence is enabled automatically
the SCL pin is sampled high (clock arbitration), the
following an address/data byte transmission. The SCL
master counts another TSCL. The SCL pin is then pulled
pin is pulled low and the contents of the Acknowledge
low. Figure 33-17 shows the timings for Acknowledge
Data bits (ACKDT/ACKCNT) are presented on the SDA
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 sitions high while SCL is high, the PCIF bit of the I2CxIF
register is set. Figure 33-18 shows the timings for a
A Stop bit is asserted on the SDA pin at the end of
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 tran-
SDA ACK
SCL
I2C_clk 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4
MMA
ACKSTAT
PIC18(L)F25/26K83
I2CxCNT 0x02 0x01 0x00 0x00
CNTIF is set
I2CxCNT = 0
RSEN = 0, mas ter se nds Stop
TXBE
Softwa re writes
Before Start, I2CxTXB
software loads one MSb is of I2CxTXB copied to SDA
MSb is of I2CxTXB copied to SDA
byte in I2CxTXB Second da ta byte loa ded fro m No new TX data o n I2CxCNT = 0
DS40001943A-page 553
RSEN = 0;
Slave Sends ACK Master sends
stop condition
R/W = 1 from I2CxADB1[0] Master sends ACK Master sends NACK
S
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
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
PIC18(L)F25/26K83
ACKDT
CNTIF is set
RXBF
DS40001943A-page 555
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
Preliminary
PIC18(L)F25/26K83
ACKSTAT
CNTIF is set
I2CxCNT = 0
Master sends Stop
TXBE
DS40001943A-page 557
Low Address c opied High Addres s copied Receive data loaded from
High Addres s copied
from I2CxADB0[7:0] from I2CxADB1[7:1] RX shift reg to I2CxRXB
from I2CxADB1[7:1]
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
PIC18(L)F25/26K83
ACKSTAT
RSEN
Software writes
I2CxCN T before CNTIF is set
Software sends no write data
sett ing START I2CxCNT = 0
Master sends Stop
RXBF
I2CxRXIF is set
PIC18(L)F25/26K83
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. MSTACK is cleared
of the I2C bus may be taken when the BFRE bit of the when BCLIF is set. The states where arbitration can be
I2CxSTAT0 register is set. Interrupt generation on the lost 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 arbitra-
see if the pin is actually sampled high. tion. 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 and
Note: In this mode, the slave hardware has pri- another master asserts a ‘0’. When the SCL pin floats
ority over the master hardware. Master high, data is stable. If the expected data on SDA is a ‘1’
mode communication can only be initiated and the data sampled on the SDA pin is ‘0’, then a bus
when the SMA = 0. 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
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
Preliminary
ACKDT
PIC18(L)F25/26K83
User m us t clear BCLIF to se nd ACK
RXBF
I2CxRXIF is se t I2CxRXIF is se t
Softwa re r eads d ata from I2CxRXB Softwa re r eads I2CxRXB
DS40001943A-page 561
PIC18(L)F25/26K83
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
BUFFERS
Acceptance Mask
16 - 4 to 1 MUXs
RXM0
Acceptance Filters
TXB0 TXB1 TXB2 (RXF0-RXF05)
VCC
A MODE 0
c
MESSAGE
MESSAGE
MESSAGE
MTXBUFF
MTXBUFF
MTXBUFF
MSGREQ
MSGREQ
MSGREQ
c
TXERR
TXERR
TXERR
Acceptance Mask
MLOA
MLOA
MLOA
ABTF
ABTF
ABTF
e
p Acceptance Filters RXF15
RXM1
t (RXF06-RXF15)
MODE 1, 2
Message MODE 0
2 RX Identifier
Queue
Control
Buffers M
A
Transmit Byte Sequencer Data Field B
Transmit Option
MESSAGE
BUFFERS
Transmit Err-Pas
Error Bus-Off
Counter
Transmit<7:0> Receive<8:0>
Shift<14:0>
{Transmit<5:0>, Receive<8:0>}
Comparator
Protocol
Finite
State
CRC<14:0> Machine
Bit
Transmit Clock
Timing
Logic Logic Generator
Configuration
TX RX Registers
MESSAGE
MESSAGE
MESSAGE
MESSAGE
TXLARB
TXLARB
TXLARB
TXLARB
TXREQ
TXREQ
TXREQ
TXREQ
TXERR
TXERR
TXERR
TXERR
TXB0IF
TXB1IF
TXB2IF
TXB2IF
TXABT
TXABT
TXABT
TXABT
Message
Queue
Control
Transmit Byte Sequencer
RXFn0 RXMn0
RXFnn RXMnn
34.8 Baud Rate Setting The “Nominal Bit Time” is defined as:
TQ
Sample Point
Nominal Bit Time
Nominal Clock
Once these considerations are taken into account, it is EQUATION 34-6: RESULTANT FREQUENCY
possible to show that the relation between the jitter and ERROR:
the total frequency error can be defined as: –9
2 1.25 10 –5
- = 3.125 10 = 0.0031%
--------------------------------------
–6
EQUATION 34-4: JITTER AND TOTAL 10 8 10
FREQUENCY ERROR
Table 34-2 shows the relation between the clock
T jitter 2 P jitter generated by the PLL and the frequency error from
f = ------------------------ = ------------------------
10 NBT 10 NBT jitter (measured jitter-induced error of 2%, Gaussian
distribution, within three standard deviations), as a
where jitter is expressed in terms of time and NBT is the percentage of the nominal clock frequency.
Nominal Bit Time. This is clearly smaller than the expected drift of a
For example, assume a CAN bit rate of 125 Kb/s, which crystal oscillator, typically specified at 100 ppm or
gives an NBT of 8 µs. For a 16 MHz clock generated 0.01%. If we add jitter to oscillator drift, we have a total
from a 4x PLL, the jitter at this clock frequency is: frequency drift of 0.0132%. The total oscillator
frequency errors for common clock frequencies and bit
rates, including both drift and jitter, are shown in
EQUATION 34-5: 16 MHz CLOCK FROM 4x
Table 34-3.
PLL JITTER:
1 0.02
2% ------------------- = -----------------6 = 1.25ns
16 MHz 16 10
TABLE 34-2: FREQUENCY ERROR FROM JITTER AT VARIOUS PLL GENERATED CLOCK SPEEDS
Frequency Error at Various Nominal Bit Times (Bit Rates)
PLL
Pjitter Tjitter 8 s 4 s 2 s 1 s
Output
(125 Kb/s) (250 Kb/s) (500 Kb/s) (1 Mb/s)
40 MHz 0.5 ns 1 ns 0.00125% 0.00250% 0.005% 0.01%
24 MHz 0.83 ns 1.67 ns 0.00209% 0.00418% 0.008% 0.017%
16 MHz 1.25 ns 2.5 ns 0.00313% 0.00625% 0.013% 0.025%
Input
Signal
TQ
Sample Point
Nominal Bit Length
FIGURE 34-7: SHORTENING A BIT PERIOD (SUBTRACTING SJW FROM PHASE SEGMENT 2)
TQ Sample Point
Actual Bit Length
Nominal Bit Length
Reset
Error-
Passive
TXERRCNT > 255
Bus-
Off
Note 1: This bit will clear when all transmissions are aborted.
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: To achieve maximum power saving and/or able to wake-up on CAN bus activity, switch the CAN module in
Disable/Sleep mode before putting the device to Sleep.
2: If the buffer is configured as a receiver, the EICODE bits will contain ‘10000’ upon interrupt.
EXAMPLE 34-3: WIN AND ICODE BITS USAGE IN INTERRUPT SERVICE ROUTINE TO ACCESS
TX/RX BUFFERS
; Save application required context.
; Poll interrupt flags and determine source of interrupt
; This was found to be CAN interrupt
; TempCANCON and TempCANSTAT are variables defined in Access Bank low
MOVFF CANCON, TempCANCON ; Save CANCON.WIN bits
; This is required to prevent CANCON
; from corrupting CAN buffer access
; in-progress while this interrupt
; occurred
MOVFF CANSTAT, TempCANSTAT ; Save CANSTAT register
; This is required to make sure that
; we use same CANSTAT value rather
; than one changed by another CAN
; interrupt.
MOVF TempCANSTAT, W ; Retrieve ICODE bits
ANDLW B’00001110’
ADDWF PCL, F ; Perform computed GOTO
; to corresponding interrupt cause
BRA NoInterrupt ; 000 = No interrupt
BRA ErrorInterrupt ; 001 = Error interrupt
BRA TXB2Interrupt ; 010 = TXB2 interrupt
BRA TXB1Interrupt ; 011 = TXB1 interrupt
BRA TXB0Interrupt ; 100 = TXB0 interrupt
BRA RXB1Interrupt ; 101 = RXB1 interrupt
BRA RXB0Interrupt ; 110 = RXB0 interrupt
; 111 = Wake-up on interrupt
WakeupInterrupt
BCF PIR3, WAKIF ; Clear the interrupt flag
;
; User code to handle wake-up procedure
;
;
; Continue checking for other interrupt source or return from here
…
NoInterrupt
… ; PC should never vector here. User may
; place a trap such as infinite loop or pin/port
; indication to catch this error.
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: These bits can only be changed in Configuration mode. See Register 34-1 to change to Configuration mode.
2: This bit is used in Mode 2 only.
3: If FIFO is configured to contain four or less buffers, then the FIFO interrupt will trigger.
bit 7 Mode 0:
RXB0OVFL: Receive Buffer 0 Overflow bit
1 = Receive Buffer 0 has overflowed
0 = Receive Buffer 0 has not overflowed
Mode 1:
Unimplemented: Read as ‘0’
Mode 2:
FIFOEMPTY: FIFO Not Empty bit
1 = Receive FIFO is not empty
0 = Receive FIFO is empty
bit 6 Mode 0:
RXB1OVFL: Receive Buffer 1 Overflow bit
1 = Receive Buffer 1 has overflowed
0 = Receive Buffer 1 has not overflowed
Mode 1, 2:
RXBnOVFL: Receive Buffer n Overflow bit
1 = Receive Buffer n has overflowed
0 = Receive Buffer n has not overflowed
bit 5 TXBO: Transmitter Bus-Off bit
1 = Transmit error counter > 255
0 = Transmit error counter 255
bit 4 TXBP: Transmitter Bus Passive bit
1 = Transmit error counter > 127
0 = Transmit error counter 127
bit 3 RXBP: Receiver Bus Passive bit
1 = Receive error counter > 127
0 = Receive error counter 127
bit 2 TXWARN: Transmitter Warning bit
1 = Transmit error counter > 95
0 = Transmit error counter 95
bit 1 RXWARN: Receiver Warning bit
1 = 127 Receive error counter > 95
0 = Receive error counter 95
bit 0 EWARN: Error Warning bit
This bit is a flag of the RXWARN and TXWARN bits.
1 = The RXWARN or the TXWARN bits are set
0 = Neither the RXWARN or the TXWARN bits are set
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
bit 7-0 EID<15:8>: Extended Identifier bits (not used when transmitting standard identifier message)
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-0 EID<7:0>: Extended Identifier bits (not used when transmitting standard identifier message)
REGISTER 34-10: TXBnDm: TRANSMIT BUFFER ‘n’ DATA FIELD BYTE ‘m’ REGISTERS
[0 n 2, 0 m 7]
R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x
TXBnDm7 TXBnDm6 TXBnDm5 TXBnDm4 TXBnDm3 TXBnDm2 TXBnDm1 TXBnDm0
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
bit 7-0 TXBnDm<7:0>: Transmit Buffer n Data Field Byte m bits (where 0 n < 3 and 0 m < 8)
Each transmit buffer has an array of registers. For example, Transmit Buffer 0 has 7 registers: TXB0D0
to TXB0D7.
REGISTER 34-11: TXBnDLC: TRANSMIT BUFFER ‘n’ DATA LENGTH CODE REGISTERS [0 n 2]
U-0 R/W-x U-0 U-0 R/W-x R/W-x R/W-x R/W-x
— TXRTR — — DLC3 DLC2 DLC1 DLC0
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
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
; Now that all data bytes are loaded, mark it for transmission.
MOVLW B’00001000’ ; Normal priority; Request transmission
MOVWF TXB0CON
; Message is transmitted.
; Now that all data bytes are loaded, mark it for transmission.
MOVLW B’00001000’ ; Normal priority; Request transmission
MOVWF RXB0CON
; Message is transmitted.
; If required, reset the WIN bits to default state.
Note 1: This bit is set by the CAN module upon receiving a message and must be cleared by software after the
buffer is read. As long as RXFUL is set, no new message will be loaded and the buffer will be considered
full. After clearing the RXFUL flag, the PIR5 bit, RXB0IF, can be cleared. If RXB0IF is cleared, but RXFUL
is not cleared, then RXB0IF is set again.
2: This bit allows the same filter jump table for both RXB0CON and RXB1CON.
Note 1: This bit is set by the CAN module upon receiving a message and must be cleared by software after the
buffer is read. As long as RXFUL is set, no new message will be loaded and the buffer will be considered
full. After clearing the RXFUL flag, the PIR5 bit, RXB0IF, can be cleared. If RXB0IF is cleared, but RXFUL
is not cleared, then RXB0IF is set again.
2: This bit allows the same filter jump table for both RXB0CON and RXB1CON.
Note 1: This bit is set by the CAN module upon receiving a message and must be cleared by software after the buffer
is read. As long as RXFUL is set, no new message will be loaded and the buffer will be considered full.
Note 1: This bit is set by the CAN module upon receiving a message and must be cleared by software after the buffer
is read. As long as RXFUL is set, no new message will be loaded and the buffer will be considered full.
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
REGISTER 34-19: RXBnDLC: RECEIVE BUFFER ‘n’ DATA LENGTH CODE REGISTERS [0 n 1]
U-0 R-x R-x R-x R-x R-x R-x R-x
— RXRTR RB1 RB0 DLC3 DLC2 DLC1 DLC0
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
REGISTER 34-20: RXBnDm: RECEIVE BUFFER ‘n’ DATA FIELD BYTE ‘m’ REGISTERS
[0 n 1, 0 m 7]
R-x R-x R-x R-x R-x R-x R-x R-x
RXBnDm7 RXBnDm6 RXBnDm5 RXBnDm4 RXBnDm3 RXBnDm2 RXBnDm1 RXBnDm0
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
bit 7-0 RXBnDm<7:0>: Receive Buffer n Data Field Byte m bits (where 0 n < 1 and 0 < m < 7)
Each receive buffer has an array of registers. For example, Receive Buffer 0 has eight registers:
RXB0D0 to RXB0D7.
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
REGISTER 34-22: BnCON: TX/RX BUFFER ‘n’ CONTROL REGISTERS IN RECEIVE MODE
[0 n 5, TXnEN (BSEL0<n>) = 0](1)
R/W-0 R/W-0 R-0 R-0 R-0 R-0 R-0 R-0
(2)
RXFUL RXM1 RXRTRRO FILHIT4 FILHIT3 FILHIT2 FILHIT1 FILHIT0
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
REGISTER 34-23: BnCON: TX/RX BUFFER ‘n’ CONTROL REGISTERS IN TRANSMIT MODE
[0 n 5, TXnEN (BSEL0<n>) = 1](1)
R/W-0 R-0 R-0 R-0 R/W-0 R/W-0 R/W-0 R/W-0
TXBIF(3) TXABT(3) TXLARB(3) TXERR(3) TXREQ(2,4) RTREN TXPRI1(5) TXPRI0(5)
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
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
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
REGISTER 34-32: BnDm: TX/RX BUFFER ‘n’ DATA FIELD BYTE ‘m’ REGISTERS IN RECEIVE MODE
[0 n 5, 0 m 7, TXnEN (BSEL<n>) = 0](1)
R-x R-x R-x R-x R-x R-x R-x R-x
BnDm7 BnDm6 BnDm5 BnDm4 BnDm3 BnDm2 BnDm1 BnDm0
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
bit 7-0 BnDm<7:0>: Receive Buffer n Data Field Byte m bits (where 0 n < 3 and 0 < m < 8)
Each receive buffer has an array of registers. For example, Receive Buffer 0 has 7 registers: B0D0 to
B0D7.
REGISTER 34-33: BnDm: TX/RX BUFFER ‘n’ DATA FIELD BYTE ‘m’ REGISTERS IN TRANSMIT MODE
[0 n 5, 0 m 7, TXnEN (BSEL<n>) = 1](1)
R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x
BnDm7 BnDm6 BnDm5 BnDm4 BnDm3 BnDm2 BnDm1 BnDm0
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
bit 7-0 BnDm<7:0>: Transmit Buffer n Data Field Byte m bits (where 0 n < 3 and 0 < m < 8)
Each transmit buffer has an array of registers. For example, Transmit Buffer 0 has 7 registers: TXB0D0
to TXB0D7.
REGISTER 34-34: BnDLC: TX/RX BUFFER ‘n’ DATA LENGTH CODE REGISTERS IN RECEIVE MODE
[0 n 5, TXnEN (BSEL<n>) = 0](1)
U-0 R-x R-x R-x R-x R-x R-x R-x
— RXRTR RB1 RB0 DLC3 DLC2 DLC1 DLC0
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
REGISTER 34-35: BnDLC: TX/RX BUFFER ‘n’ DATA LENGTH CODE REGISTERS IN TRANSMIT MODE
[0 n 5, TXnEN (BSEL<n>) = 1](1)
U-0 R/W-x U-0 U-0 R/W-x R/W-x R/W-x R/W-x
— TXRTR — — DLC3 DLC2 DLC1 DLC0
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
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
REGISTER 34-37: RXFnSIDH: RECEIVE ACCEPTANCE FILTER ‘n’ STANDARD IDENTIFIER FILTER
REGISTERS, HIGH BYTE [0 n 15](1)
R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x
SID10 SID9 SID8 SID7 SID6 SID5 SID4 SID3
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
REGISTER 34-38: RXFnSIDL: RECEIVE ACCEPTANCE FILTER ‘n’ STANDARD IDENTIFIER FILTER
REGISTERS, LOW BYTE [0 n 15](1)
R/W-x R/W-x R/W-x U-0 R/W-x U-0 R/W-x R/W-x
SID2 SID1 SID0 — EXIDEN(2) — EID17 EID16
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
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
REGISTER 34-41: RXMnSIDH: RECEIVE ACCEPTANCE MASK ‘n’ STANDARD IDENTIFIER MASK
REGISTERS, HIGH BYTE [0 n 1]
R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x
SID10 SID9 SID8 SID7 SID6 SID5 SID4 SID3
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
bit 7-0 SID<10:3>: Standard Identifier Mask bits or Extended Identifier Mask bits (EID<28:21>)
REGISTER 34-42: RXMnSIDL: RECEIVE ACCEPTANCE MASK ‘n’ STANDARD IDENTIFIER MASK
REGISTERS, LOW BYTE [0 n 1]
R/W-x R/W-x R/W-x U-0 R/W-0 U-0 R/W-x R/W-x
SID2 SID1 SID0 — EXIDEN(1) — EID17 EID16
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
bit 7-5 SID<2:0>: Standard Identifier Mask bits or Extended Identifier Mask bits (EID<20:18>)
bit 4 Unimplemented: Read as ‘0’
bit 3 Mode 0:
Unimplemented: Read as ‘0’
Mode 1, 2:
EXIDEN: Extended Identifier Filter Enable Mask bit(1)
1 = Messages selected by the EXIDEN bit in RXFnSIDL will be accepted
0 = Both standard and extended identifier messages will be accepted
bit 2 Unimplemented: Read as ‘0’
bit 1-0 EID<17:16>: Extended Identifier Mask bits
REGISTER 34-43: RXMnEIDH: RECEIVE ACCEPTANCE MASK ‘n’ EXTENDED IDENTIFIER MASK
REGISTERS, HIGH BYTE [0 n 1]
R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x
EID15 EID14 EID13 EID12 EID11 EID10 EID9 EID8
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
REGISTER 34-44: RXMnEIDL: RECEIVE ACCEPTANCE MASK ‘n’ EXTENDED IDENTIFIER MASK
REGISTERS, LOW BYTE [0 n 1]
R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x
EID7 EID6 EID5 EID4 EID3 EID2 EID1 EID0
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
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: Register 34-46 through Register 34-51 are writable in Configuration mode only.
REGISTER 34-46: SDFLC: STANDARD DATA BYTES FILTER LENGTH COUNT REGISTER(1)
U-0 U-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
— — — FLC4 FLC3 FLC2 FLC1 FLC0
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
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
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
Note 1: When CLKSEL = 1, the clock supplied by FEXTOSC must be less than or equal to the system clock. If the
CAN clock is greater than the system clock, unexpected behavior will occur.
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 IRXIF: CAN Bus Error Message Received Interrupt Flag bit
1 = An invalid message has occurred on the CAN bus
0 = No invalid message on the CAN bus
bit 6 WAKIF: CAN Bus Activity Wake-up Interrupt Flag bit
1 = Activity on the CAN bus has occurred
0 = No activity on the CAN bus
bit 5 ERRIF: CAN Module Error Interrupt Flag bit
1 = An error has occurred in the CAN module (multiple sources; refer to Section 34.14.6 “Error Interrupt”)
0 = No CAN module errors
bit 4 When CAN is in Mode 0:
TXB2IF: CAN Transmit Buffer 2 Interrupt Flag bit
1 = Transmit Buffer 2 has completed transmission of a message and may be reloaded
0 = Transmit Buffer 2 has not completed transmission of a message
When CAN is in Mode 1 or 2:
TXBnIF: Any Transmit Buffer Interrupt Flag bit
1 = One or more transmit buffers have completed transmission of a message and may be reloaded
0 = No transmit buffer is ready for reload
bit 3 TXB1IF: CAN Transmit Buffer 1 Interrupt Flag bit(1)
1 = Transmit Buffer 1 has completed transmission of a message and may be reloaded
0 = Transmit Buffer 1 has not completed transmission of a message
bit 2 TXB0IF: CAN Transmit Buffer 0 Interrupt Flag bit(1)
1 = Transmit Buffer 0 has completed transmission of a message and may be reloaded
0 = Transmit Buffer 0 has not completed transmission of a message
bit 1 When CAN is in Mode 0:
RXB1IF: CAN Receive Buffer 1 Interrupt Flag bit
1 = Receive Buffer 1 has received a new message
0 = Receive Buffer 1 has not received a new message
When CAN is in Mode 1 or 2:
RXBnIF: Any Receive Buffer Interrupt Flag bit
1 = One or more receive buffers has received a new message
0 = No receive buffer has received a new message
bit 0 When CAN is in Mode 0:
RXB0IF: CAN Receive Buffer 0 Interrupt Flag bit
1 = Receive Buffer 0 has received a new message
0 = Receive Buffer 0 has not received a new message
When CAN is in Mode 1:
Unimplemented: Read as ‘0’
When CAN is in Mode 2:
FIFOWMIF: FIFO Watermark Interrupt Flag bit
1 = FIFO high watermark is reached
0 = FIFO high watermark is not reached
Note 1: In CAN Mode 1 and 2, these bits are forced to ‘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
bit 7 IRXIE: CAN Bus Error Message Received Interrupt Enable bit
1 = Enable invalid message received interrupt
0 = Disable invalid message received interrupt
bit 6 WAKIE: CAN bus Activity Wake-up Interrupt Enable bit
1 = Enable bus activity wake-up interrupt
0 = Disable bus activity wake-up interrupt
bit 5 ERRIE: CAN bus Error Interrupt Enable bit
1 = Enable CAN module error interrupt
0 = Disable CAN module error interrupt
bit 4 When CAN is in Mode 0:
TXB2IE: CAN Transmit Buffer 2 Interrupt Enable bit
1 = Enable Transmit Buffer 2 interrupt
0 = Disable Transmit Buffer 2 interrupt
When CAN is in Mode 1 or 2:
TXBnIE: CAN Transmit Buffer Interrupts Enable bit
1 = Enable transmit buffer interrupt; individual interrupt is enabled by TXBIE and BIE0
0 = Disable all transmit buffer interrupts
bit 3 TXB1IE: CAN Transmit Buffer 1 Interrupt Enable bit(1)
1 = Enable Transmit Buffer 1 interrupt
0 = Disable Transmit Buffer 1 interrupt
bit 2 TXB0IE: CAN Transmit Buffer 0 Interrupt Enable bit(1)
1 = Enable Transmit Buffer 0 interrupt
0 = Disable Transmit Buffer 0 interrupt
bit 1 When CAN is in Mode 0:
RXB1IE: CAN Receive Buffer 1 Interrupt Enable bit
1 = Enable Receive Buffer 1 interrupt
0 = Disable Receive Buffer 1 interrupt
When CAN is in Mode 1 or 2:
RXBnIE: CAN Receive Buffer Interrupts Enable bit
1 = Enable receive buffer interrupt; individual interrupt is enabled by BIE0
0 = Disable all receive buffer interrupts
bit 0 When CAN is in Mode 0:
RXB0IE: CAN Receive Buffer 0 Interrupt Enable bit
1 = Enable Receive Buffer 0 interrupt
0 = Disable Receive Buffer 0 interrupt
When CAN is in Mode 1:
Unimplemented: Read as ‘0’
When CAN is in Mode 2:
FIFOWMIE: FIFO Watermark Interrupt Enable bit
1 = Enable FIFO watermark interrupt
0 = Disable FIFO watermark interrupt
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 IRXIP: CAN Bus Error Message Received Interrupt Priority bit
1 = High priority
0 = Low priority
bit 6 WAKIP: CAN Bus Activity Wake-up Interrupt Priority bit
1 = High priority
0 = Low priority
bit 5 ERRIP: CAN Module Error Interrupt Priority bit
1 = High priority
0 = Low priority
bit 4 When CAN is in Mode 0:
TXB2IP: CAN Transmit Buffer 2 Interrupt Priority bit
1 = High priority
0 = Low priority
When CAN is in Mode 1 or 2:
TXBnIP: CAN Transmit Buffer Interrupt Priority bit
1 = High priority
0 = Low priority
bit 3 TXB1IP: CAN Transmit Buffer 1 Interrupt Priority bit(1)
1 = High priority
0 = Low priority
bit 2 TXB0IP: CAN Transmit Buffer 0 Interrupt Priority bit(1)
1 = High priority
0 = Low priority
bit 1 When CAN is in Mode 0:
RXB1IP: CAN Receive Buffer 1 Interrupt Priority bit
1 = High priority
0 = Low priority
When CAN is in Mode 1 or 2:
RXBnIP: CAN Receive Buffer Interrupts Priority bit
1 = High priority
0 = Low priority
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
bit 7-2 B<5:0>IE: Programmable Transmit/Receive Buffer 5-0 Interrupt Enable bits(2)
1 = Interrupt is enabled
0 = Interrupt is disabled
bit 1-0 RXB<1:0>IE: Dedicated Receive Buffer 1-0 Interrupt Enable bits(2)
1 = Interrupt is enabled
0 = Interrupt is disabled
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
TSEN
VOUT
To ADC
Temp.
Indicator
TSRNG
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 FRC
FRC
Temp Indicator
Internal
Channel DACx_output ADC CLOCK SOURCE
Inputs
FVR_buffer ADC
Sample Circuit
PCH<5:0>
ADFM
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> ADON
. . . VSS
Trigger Sources
AUTO CONVERSION
TRIGGER
ADC
CS<5:0> 64 MHz 32 MHz 20 MHz 16 MHz 8 MHz 4 MHz 1 MHz
Clock Source
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 125 ns(2) 187.5 ns(2) 300 ns(2) 375 ns(2) 750 ns(2) 1.5 s 6.0 s
FOSC/8 000011 187.5 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(3)
... ... ... ... ... ... ... ... ...
FOSC/128 111111 2.0 s 4.0 s 6.4 s 8.0 s 16.0 s(3) 32.0 s(2) 128.0 s(2)
FRC CS(ADCON0<4>) = 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 FRC source typical TAD value.
2: These values violate the required TAD time.
3: Outside the recommended TAD time.
4: The ADC clock period (TAD) and total ADC conversion time can be minimized when the ADC clock is derived from the system
clock FOSC. However, the FRC oscillator source must be used when conversions are to be performed with the device in Sleep
mode.
TAD 11
External and Internal External and Internal Conversion starts
Channels are Channels share
charged/discharged charge
Holding capacitor CHOLD is disconnected from analog input (typically 100ns)
ADRESH ADRESL
(FM = 0) MSB
bit 7 bit 0 bit 7 LSB bit 0
//Setup ADC
ADCON0bits.FM = 1; //right justify
ADCON0bits.CS = 1; //FRC 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
V AP P LI ED 1 – -------------------------- = V CHOLD
1
;[1] VCHOLD charged to within 1/2 lsb
n+1
2 –1
–TC
----------
RC
V AP P LI ED 1 – e = V CHOLD ;[2] VCHOLD charge response to VAPPLIED
– Tc
---------
V AP P LI ED 1 – e = V A PP LIE D 1 – -------------------------- ;combining [1] and [2]
RC 1
n+1
2 –1
T C = – C HOLD R IC + R SS + R S ln(1/8191)
= – 28pF 1k + 7k + 10k ln(0.0001221)
= 4.54 µs
Therefore:
T A CQ = 2µs + 4.54µs + 50°C- 25°C 0.05 µs/°C
= 7.79µs
Note 1: The reference voltage (VREF) has no effect on the equation, since it cancels itself out.
2: The charge holding capacitor (CHOLD) is not discharged after each conversion.
3: The maximum recommended impedance for analog sources is 10 k. This is required to meet the pin
leakage specification.
VDD
Analog Sampling
Input Switch
VT 0.6V
Rs pin RIC 1k SS Rss
VA CPIN I LEAKAGE(1)
VT 0.6V CHOLD = 28 pF
5 pF
Ref-
6V
5V RSS
Legend: CHOLD = Sample/Hold Capacitance VDD 4V
3V
CPIN = Input Capacitance 2V
I LEAKAGE = Leakage current at the pin due to
various junctions
5 6 7 8 9 10 11
RIC = Interconnect Resistance
Sampling Switch
RSS = Resistance of Sampling Switch (k)
SS = Sampling Switch
VT = Threshold Voltage
Full-Scale Range
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+
ADOUT Pad
ADOUT
VDD
ADIPPOL =1
ANx Pads
ADIPPOL = 0
VGND
ADDCAP<2:0>
Additional
Sample and
Hold Cap
VSS
First Sample Second Sample
Time
Voltage
External Capacitive Sensor
Guard Ring Output
VSS
First Sample Second Sample
Time
ADCALC<2:0>
ADMD<2:0>
ADRES
ADFILT
Set
Error Threshold
Interrupt
Average/ Calculation ADERR Logic
1 Flag
Filter ADPREV
0
ADSTPT
ADUTHR ADLTHR
ADPSIS
Mode ADMD ACC and CNT ACC CNT Retrigger Threshold Interrupt ADAOV FLTR CNT
Test
Basic 0 ADACLR = 1 Unchanged Unchanged No Every Sam- If threshold=true N/A N/A count
ple
Accumulate 1 ADACLR = 1 S + ACC If (CNT=0xFF): CNT, oth- No Every Sam- If threshold=true ACC Overflow ACC/2ADCRS count
or erwise: CNT+1 ple
(S2-S1) + ACC
Average 2 ADACLR = 1 or CNT>=RPT S + ACC If (CNT=0xFF): CNT, oth- No If If threshold=true ACC Overflow ACC/2ADCRS count
at GO or retrigger or erwise: CNT+1 CNT>=RPT
(S2-S1) + ACC
Burst 3 ADACLR = 1 or GO set or Each repetition: same as Each repetition: same as Repeat while If If threshold=true ACC Overflow ACC/2ADCRS RPT
Average retrigger Average Average CNT<RPT CNT>=RPT
End with sum of all End with CNT=RPT
samples
Low-pass 4 ADACLR = 1 S+ACC-ACC/ Count up, stop counting No If If threshold=true ACC Overflow Filtered Value count
Filter 2ADCRS when CNT = 0xFF CNT>=RPT
or
(S2-S1)+ACC-ACC/2ADCRS
Preliminary
Note: S1 and S2 are abbreviations for Sample 1 and Sample 2, respectively. When ADDSEN = 0, S1 = ADRES; When ADDSEN = 1, S1 = PREV and S2 = ADRES.
PIC18(L)F25/26K83
DS40001943A-page 666
PIC18(L)F25/26K83
37.6.1 DIGITAL FILTER/AVERAGE ADCNT register. The ADACLR bit is cleared by the
hardware when accumulator clearing action is
The digital filter/average module consists of an accu-
complete.
mulator with data feedback options, and control logic to
determine when threshold tests need to be applied.
The accumulator is a 16-bit wide register which can be Note: When ADC is operating from FRC, five
accessed through the ADACCH:ADACCL register pair. FRC clock cycles are required to execute
the ACC clearing operation.
Upon each trigger event (the GO bit set or external
event trigger), the ADC conversion result is added to The ADCRS <2:0> bits in the ADCON2 register control
the accumulator. If the accumulated result exceeds the data shift on the accumulator result, which
2(accumulator_width)-1 = 18 = 262143, the overflow bit effectively divides the value in accumulator
ADAOV in the ADSTAT register is set. (ADACCU:ADACCH:ADACCL) register pair. For the
Accumulate mode of the digital filter, the shift provides
The number of samples to be accumulated is
a simple scaling operation. For the Average/Burst
determined by the RPT (A/D Repeat Setting) register.
Average mode, the shift bits are used to determine the
Each time a sample is added to the accumulator, the
number of logical right shifts to be performed on the
ADCNT register is incremented. Once RPT samples
accumulated result. For the Low-pass Filter mode, the
are accumulated (CNT = RPT), an Accumulator Clear
shift is an integral part of the filter, and determines the
command can be issued by the software by setting the
cut-off frequency of the filter. Table 37-3 shows the -3
ADACLR bit in the ADCON2 register. Setting the
dB cut-off frequency in ωT (radians) and the highest
ADACLR bit will also clear the ADAOV (Accumulator
signal attenuation obtained by this filter at nyquist
overflow) bit in the ADSTAT register, as well as the
frequency (ωT = π).
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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
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 ADPPOL and ADGPOL
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 37-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
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged x = Bit is unknown -n/n = Value at POR and BOR/Value at all other Resets
‘1’ = Bit is set ‘0’ = Bit is cleared
Note 1: See Section 38.0 “5-Bit Digital-to-Analog Converter (DAC) Module” for more information.
2: See Section 35.0 “Fixed Voltage Reference (FVR)” for more information.
3: See Section 36.0 “Temperature Indicator Module” for more information.
REGISTER 37-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 37-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
Note: If PRE is not equal to ‘0’, then ADACQ = b’00000000 means Acquisition time is 256 clocks of the selected
ADC clock.
REGISTER 37-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 37-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
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
u = Bit is unchanged 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-4 ADRES<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 ADRES<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 ADPSIS = 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 ADPSIS = 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. Middle eight bits of accumulator value. See Table 37-2 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 ACC<7:0>: ADC Accumulator LSB. Lower eight bits of accumulator value. See Table 37-2 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<15:8>: ADC Threshold Setpoint MSB. Upper byte of ADC threshold setpoint, depending on
ADCALC, may be used to determine ERR, see Register 37-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. Lower byte of ADC threshold setpoint, depending on
ADCALC, may be used to determine ERR, see Register 37-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. Upper byte of ADC Setpoint Error. Setpoint Error calculation
is determined by CALC bits of ADCON3, see Register 37-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. Lower byte of ADC Setpoint Error calculation is determined by
CALC bits of ADCON3, see Register 37-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. LTH and UTH are compared with ERR to set the ADUTHR
and ADLTHR bits of ADSTAT. Depending on the setting of ADTMD, 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. LTH and UTH are compared with ERR to set the ADUTHR
and ADLTHR bits of ADSTAT. Depending on the setting of ADTMD, 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. LTH and UTH are compared with ERR to set the ADUTHR
and ADLTHR bits of ADSTAT. Depending on the setting of ADTMD, 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. LTH and UTH are compared with ERR to set the ADUTHR
and ADLTHR bits of ADSTAT. Depending on the setting of ADTMD, 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
DATA 4:0
DACx_output = VREF+ – VREF- ----------------------------
5
- + VREF-
2
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.
Rev. 10-000071A
8/2/2013
VDD
Analog
VT § 0.6V
RS < 10K Input pin RIC
To Comparator
ILEAKAGE(1)
VA CPIN VT § 0.6V
5pF
VSS
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-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
RDY TFVRST
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
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
OPCODE n<10:0> (literal) BRA MYFUNC
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 2 1110 0001 nnnn nnnn None 1
BOV n Branch if Overflow 1 (2) 1110 0100 nnnn nnnn None 1
BRA n Branch Unconditionally 1 (2) 1101 0nnn nnnn nnnn None
BZ n Branch if Zero 1 (2) 1110 0000 nnnn nnnn None 1
CALL n, s Call subroutine 1st word 2 1110 110s nnnn nnnn None 2
2nd word 1111 nnnn nnnn nnnn
GOTO n Go to address 1st word 2 1110 1111 nnnn nnnn None 2
— 2nd word 1111 nnnn nnnn nnnn
CALLW — W -> PCL and Call subroutine 2 0000 0000 0001 0100 None 1
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 exe-
cuted 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 fn, k Load FSR(fn) with a 14-bit 2 1110 1110 00ff kkkk None
literal (k) 1111 00kk kkkk kkkk
ADDFSR fn, k Add FSR(fn) with (k) 1 1110 1000 ffkk kkkk None
SUBFSR fn, 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 exe-
cuted 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 42.2.3 “Byte-Oriented and See Section 42.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. by a 2-word 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,
(PCLATU) PCU Status Affected: Z
W = E2h Q1 Q2 Q3 Q4
PRODH = ADh Decode Read Process Write
PRODL = 08h register ‘f’ Data registers
PRODH:
PRODL
Words: 1
Cycles: 1
Q Cycle Activity:
Q1 Q2 Q3 Q4
Decode Read Process Write
register ‘f’ Data register ‘f’
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
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,
Status Affected: N, Z (C) dest<7>
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
Cycles: 1
Q Cycle Activity:
Example: SUBFSR 2, 23h
Q1 Q2 Q3 Q4
Before Instruction
Decode No Process Go to
operation Data Sleep FSR2 = 03FFh
After Instruction
FSR2 = 03DCh
Example: SLEEP
Before Instruction
TO = ?
PD = ?
After Instruction
TO = 1†
PD = 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 42.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 Push literal to POSTDEC2 1 1110 1010 kkkk kkkk None
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. Two 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
memory address specified by FSR2. FSR2
Description The contents of the source register are
moved to the destination register. The is decremented by 1 after the operation.
addresses of the source and destination This instruction allows users to push values
onto a software stack.
registers are determined by adding the
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 4096-byte data memory space Q Cycle Activity:
(000h to FFFh). 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
3F37h -
— Unimplemented —
3F24h
3F23h SMT1WIN — — — WSEL 384
3F22h SMT1SIG — — — SSEL 385
3F21h SMT1CLK — — — — — CSEL 383
3F20h SMT1STAT CPRUP CPWUP RST — — TS WS AS 382
3F1Fh SMT1CON1 GO REPEAT — — MODE 381
3F1Eh SMT1CON0 EN — STP WPOL SPOL CPOL PS 380
3F1Dh SMT1PRU PR 387
3F1Ch SMT1PRH PR 389
3F1Bh SMT1PRL PR 389
3F1Ah SMT1CPWU CPW 388
3F19h SMT1CPWH CPW 388
3F18h SMT1CPWL CPW 388
3F17h SMT1CPRU CPR 387
3F16h SMT1CPRH CPR 387
3F15h SMT1CPRL CPR 387
3F14h SMT1TMRU TMR 386
3F13h SMT1TMRH TMR 386
3F12h SMT1TMRL TMR 386
3F11h SMT2WIN — — — WSEL 384
3F10h SMT2SIG — — — SSEL 385
3F0Fh SMT2CLK — — — — — CSEL 383
3F0Eh SMT2STAT CPRUP CPWUP RST — — TS WS AS 382
3F0Dh SMT2CON1 GO REPEAT — — MODE 381
3F0Ch SMT2CON0 EN — STP WPOL SPOL CPOL PS 380
3F0Bh SMT2PRU PR 387
3F0Ah SMT2PRH PR 389
3F09h SMT2PRL PR 389
3F08h SMT2CPWU CPW 388
3F07h SMT2CPWH CPW 388
3F06h SMT2CPWL CPW 388
3F05h SMT2CPRU CPR 387
3F04h SMT2CPRH CPR 387
3F03h SMT2CPRL CPR 387
3F02h SMT2TMRU TMR 386
3F01h SMT2TMRH TMR 386
3F00h SMT2TMRL TMR 386
3EFFh ADCLK — — CS 674
3EFEh ADACT — — — ACT 674
3EFDh ADREF NREF PREF 674
3EFCh ADSTAT OV UTHR LTHR MATH — STAT 673
3EFBh ADCON3 — CALC SOI TMD 672
3EFAh ADCON2 PSIS CRS ACLR MODE 671
3EF9h ADCON1 PPOL IPEN GPOL — — — — DSEN 670
3EF8h ADCON0 ON CONT — CS FM — GO 669
3EF7h ADPREH — — — PRE 676
3EF6h ADPREL PRE 676
3EF5h ADCAP — — — ADCAP 678
3EF4h ADACQH — — — ACQ 677
Legend: x = unknown, u = unchanged, — = unimplemented, q = value depends on condition
Note 1: Not present in LF devices.
3DF9h U1ERRIR TXMTIF PERIF ABDOVF CERIF FERIF RXBKIF RXFOIF TXCIF 486
3DF8h U1UIR WUIF ABDIF — — — ABDIE — — 488
3DF7h U1FIFO TXWRE STPMD TXBE TXBF RXIDL XON RXBE RXBF 489
3DF6h U1BRGH BRGH 490
3DF5h U1BRGL BRGL 490
3DF4h U1CON2 RUNOVF RXPOL STP C0EN TXPOL FLO 485
3DF3h U1CON1 ON — — WUE RXBIMD — BRKOVR SENDB 484
3DF2h U1CON0 BRGS ABDEN TXEN RXEN MODE 483
3DF1h U1P3H — — — — — — — P3H 494
3DF0h U1P3L P3L 494
3DEFh U1P2H — — — — — — — P2H 493
3DEEh U1P2L P2L 493
3DEDh U1P1H — — — — — — — P1H 492
3DECh U1P1L P1L 492
3DEBh U1TXCHK TXCHK 495
3DEAh U1TXB TXB 491
3DE9h U1RXCHK RXCHK 495
3DE8h U1RXB RXB 491
3DE7h -
— Unimplemented —
3DE3h
3DE2h U2ERRIE TXMTIE PERIE ABDOVE CERIE FERIE RXBKIE RXFOIE TXCIE 487
3DE1h U2ERRIR TXMTIF PERIF ABDOVF CERIF FERIF RXBKIF RXFOIF TXCIF 486
3DE0h U2UIR WUIF ABDIF — — — ABDIE — — 488
3DDFh U2FIFO TXWRE STPMD TXBE TXBF RXIDL XON RXBE RXBF 489
3DDEh U2BRGH BRGH 490
3DDDh U2BRGL BRGL 490
3DDCh U2CON2 RUNOVF RXPOL STP — TXPOL FLO 485
3DDBh U2CON1 ON — — WUE RXBIMD — BRKOVR SENDB 484
3DDAh U2CON0 BRGS ABDEN TXEN RXEN MODE 483
3DD9h U2P3H — — — — — — — P3H 494
3DD8h U2P3L P3L 494
3DD7h U2P2H — — — — — — — P2H 493
3DD6h U2P2L P2L 493
3DD5h U2P1H — — — — — — — P1H 492
3DD4h U2P1L P1L 492
3DD3h U2TXCHK TXCHK 495
3DD2h U2TXB TXB 491
3DD1h U2RXCHK RXCHK 495
3DD0h U2RXB RXB 491
3DCFh
- — Unimplemented —
3D7Dh
3D7Ch I2C1BTO BTO 567
3D7Bh I2C1CLK CLK 566
3D7Ah I2C1PIE CNTIE ACKTIE — WRIE ADRIE PCIE RSCIE SCIE 573
3D79h I2C1PIR CNTIF ACKTIF — WRIF ADRIF PCIF RSCIF SCIF 572
3D78h I2C1STAT1 TXWE — TXBE — RXRE CLRBF — RXBF 569
3D77h I2C1STAT0 BFRE SMA MMA R D — — — 568
3D76h I2C1ERR — BTOIF BCLIF NACKIF — BTOIE BCLIE NACKIE 570
3D75h I2C1CON2 ACNT GCEN FME ABD SDAHT BFRET 565
3D74h I2C1CON1 ACKCNT ACKDT ACKSTAT ACKT — RXO TXU CSD 564
Legend: x = unknown, u = unchanged, — = unimplemented, q = value depends on condition
Note 1: Not present in LF devices.
3C55h -
— Unimplemented —
3C00h
3BFFh DMA1SIRQ SIRQ 246
3BFEh DMA1AIRQ AIRQ 246
3BFDh DMA1CON1 DMODE DSTP SMR SMODE SSTP 239
3BFCh DMA1CON0 EN SIRQEN DGO — — AIRQEN — XIP 238
3BFBh DMA1SSAU — — SSA 241
3BFAh DMA1SSAH SSA 240
3BF9h DMA1SSAL SSA 240
3BF8h DMA1SSZH — — — — SSZ 242
3BF7h DMA1SSZL SSZ 242
3BF6h DMA1SPTRU — — SPTR 242
3BF5h DMA1SPTRH SPTR 241
3BF4h DMA1SPTRL SPTR 241
3BF3h DMA1SCNTH — — — — SCNT 243
3BF2h DMA1SCNTL SCNT 243
3BF1h DMA1DSAH DSA 244
3BF0h DMA1DSAL SSA 243
3BEFh DMA1DSZH — — — — DSZ 245
3BEEh DMA1DSZL DSZ 245
3BEDh DMA1DPTRH DPTR 244
3BECh DMA1DPTRL DPTR 244
3BEBh DMA1DCNTH — — — — DCNT 243
3BEAh DMA1DCNTL DCNT 245
3BE9h DMA1BUF BUF 240
3BE8h -
— Unimplemented —
3BE0h
3BDFh DMA2SIRQ — SIRQ 246
3BDEh DMA2AIRQ — AIRQ 246
3BDDh DMA2CON1 DMODE DSTP SMR SMODE SSTP 239
3BDCh DMA2CON0 EN SIRQEN DGO — — AIRQEN — XIP 238
3BDBh DMA2SSAU — — SSA 241
3BDAh DMA2SSAH SSA 240
3BD9h DMA2SSAL SSA 240
3BD8h DMA2SSZH — — — — SSZ 242
3BD7h DMA2SSZL SSZ 242
3BD6h DMA2SPTRU — — SPTR 242
3BD5h DMA2SPTRH SPTR 241
3BD4h DMA2SPTRL SPTR 241
3BD3h DMA2SCNTH — — — — SCNT 243
3BD2h DMA2SCNTL SCNT 243
3BD1h DMA2DSAH DSA 244
3BD0h DMA2DSAL SSA 243
3BCFh DMA2DSZH — — — — DSZ 245
3BCEh DMA2DSZL DSZ 245
3BCDh DMA2DPTRH DPTR 244
3BCCh DMA2DPTRL DPTR 244
3BCBh DMA2DCNTH — — — — DCNT 243
3BCAh DMA2DCNTL DCNT 245
3BC9h DMA2BUF BUF 240
Legend: x = unknown, u = unchanged, — = unimplemented, q = value depends on condition
Note 1: Not present in LF devices.
3BC8h -
— Unimplemented —
3AEEh
3AEDh CANRXPPS — — — CANRXPPS 264
3AECh — Unimplemented —
3AEBh U2CTSPPS — — — U2CTSPPS 264
3AEAh U2RXPPS — — — U2RXPPS 264
3AE9h — Unimplemented —
3AE8h U1CTSPPS — — — U1CTSPPS 264
3AE7h U1RXPPS — — — U1RXPPS 264
3AE6h I2C2SDAPPS — — — I2C2SDAPPS 264
3AE5h I2C2SCLPPS — — — I2C2SCLPPS 264
3AE4h I2C1SDAPPS — — — I2C1SDAPPS 264
3AE3h I2C1SCLPPS — — — I2C1SCLPPS 264
3AE2h SPI1SSPPS — — — SPI1SSPPS 264
3AE1h SPI1SDIPPS — — — SPI1SDIPPS 264
3AE0h SPI1SCKPPS — — — SPI1SCKPPS 264
3ADFh ADACTPPS — — — ADACTPPS 264
3ADEh CLCIN3PPS — — — CLCIN3PPS 264
3ADDh CLCIN2PPS — — — CLCIN2PPS 264
3ADCh CLCIN1PPS — — — CLCIN1PPS 264
3ADBh CLCIN0PPS — — — CLCIN0PPS 264
3ADAh MD1SRCPPS — — — MD1SRCPPS 264
3AD9h MD1CARHPPS — — — MD1CARHPPS 264
3AD8h MD1CARLPPS — — — MD1CARLPPS 264
3AD7h CWG3INPPS — — — CWG3INPPS 264
3AD6h CWG2INPPS — — — CWG2INPPS 264
3AD5h CWG1INPPS — — — CWG1INPPS 264
3AD4h SMT2SIGPPS — — — SMT2SIGPPS 264
3AD3h SMT2WINPPS — — — SMT2WINPPS 264
3AD2h SMT1SIGPPS — — — SMT1SIGPPS 264
3AD1h SMT1WINPPS — — — SMT1WINPPS 264
3AD0h CCP4PPS — — — CCP4PPS 264
3ACFh CCP3PPS — — — CCP3PPS 264
3ACEh CCP2PPS — — — CCP2PPS 264
3ACDh CCP1PPS — — — CCP1PPS 264
3ACCh T6INPPS — — — T6INPPS 264
3ACBh T4INPPS — — — T4INPPS 264
3ACAh T2INPPS — — — T2INPPS 264
3AC9h T5GPPS — — — T5GPPS 264
3AC8h T5CLKIPPS — — — T5CLKIPPS 264
3AC7h T3GPPS — — — T3GPPS 264
3AC6h T3CLKIPPS — — — T3CLKIPPS 264
3AC5h T1GPPS — — — T1GPPS 264
3AC4h T1CKIPPS — — — T1CKIPPS 264
3AC3h T0CKIPPS — — — T0CKIPPS 264
3AC2h INT2PPS — — — INT2PPS 264
3AC1h INT1PPS — — — INT1PPS 264
3AC0h INT0PPS — — — INT0PPS 264
3ABFh PPSLOCK — — — — — — — PPSLOCKED 268
Legend: x = unknown, u = unchanged, — = unimplemented, q = value depends on condition
Note 1: Not present in LF devices.
3ABEh
- — Unimplemented —
3A88h
3A87h IOCEF — — — — IOCEF3 — — — 272
3A86h IOCEN — — — — IOCEN3 — — — 272
3A85h IOCEP — — — — IOCEP3 — — — 272
3A84h INLVLE — — — — INLVLE3 — — — 259
3A83h — Unimplemented —
3A82h — Unimplemented —
3A81h WPUE — — — — WPUE3 — — — 256
3A80h-
— Unimplemented —
3A6Ch
3A6Bh RC4I2C — SLEW PU — — TH 252
3A6Ah RC3I2C — SLEW PU — — TH 252
3A69h — Unimplemented —
3A68h — Unimplemented —
3A67h IOCCF IOCCF7 IOCCF6 IOCCF5 IOCCF4 IOCCF3 IOCCF2 IOCCF1 IOCCF0 272
3A66h IOCCN IOCCN7 IOCCN6 IOCCN5 IOCCN4 IOCCN3 IOCCN2 IOCCN1 IOCCN0 272
3A65h IOCCP IOCCP7 IOCCP6 IOCCP5 IOCCP4 IOCCP3 IOCCP2 IOCCP1 IOCCP0 272
3A64h INLVLC INLVLC7 INLVLC6 INLVLC5 INLVLC4 INLVLC3 INLVLC2 INLVLC1 INLVLC0 259
3A63h SLRCONC SLRC7 SLRC6 SLRC5 SLRC4 SLRC3 SLRC2 SLRC1 SLRC0 258
3A62h ODCONC ODCC7 ODCC6 ODCC5 ODCC4 ODCC3 ODCC2 ODCC1 ODCC0 257
3A61h WPUC WPUC7 WPUC6 WPUC5 WPUC4 WPUC3 WPUC2 WPUC1 WPUC0 256
3A60h ANSELC ANSELC7 ANSELC6 ANSELC5 ANSELC4 ANSELC3 ANSELC2 ANSELC1 ANSELC0 255
3A5Fh -
— Unimplemented —
3A5Ch
3A5Bh RB2I2C — SLEW PU — — TH 252
3A5Ah RB1I2C — SLEW PU — — TH 252
3A59h — Unimplemented —
3A58h — Unimplemented —
3A57h IOCBF IOCBF7 IOCBF6 IOCBF5 IOCBF4 IOCBF3 IOCBF2 IOCBF1 IOCBF0 272
3A56h IOCBN IOCBN7 IOCBN6 IOCBN5 IOCBN4 IOCBN3 IOCBN2 IOCBN1 IOCBN0 272
3A55h IOCBP IOCBP7 IOCBP6 IOCBP5 IOCBP4 IOCBP3 IOCBP2 IOCBP1 IOCBP0 272
3A54h INLVLB INLVLB7 INLVLB6 INLVLB5 INLVLB4 INLVLB3 INLVLB2 INLVLB1 INLVLB0 259
3A53h SLRCONB SLRB7 SLRB6 SLRB5 SLRB4 SLRB3 SLRB2 SLRB1 SLRB0 258
3A52h ODCONB ODCB7 ODCB6 ODCB5 ODCB4 ODCB3 ODCB2 ODCB1 ODCB0 257
3A51h WPUB WPUB7 WPUB6 WPUB5 WPUB4 WPUB3 WPUB2 WPUB1 WPUB0 256
3A50h ANSELB ANSELB7 ANSELB6 ANSELB5 ANSELB4 ANSELB3 ANSELB2 ANSELB1 ANSELB0 255
3A4Fh -
— Unimplemented —
3A48h
3A47h IOCAF IOCAF7 IOCAF6 IOCAF5 IOCAF4 IOCAF3 IOCAF2 IOCAF1 IOCAF0 272
3A46h IOCAN IOCAN7 IOCAN6 IOCAN5 IOCAN4 IOCAN3 IOCAN2 IOCAN1 IOCAN0 272
3A45h IOCAP IOCAP7 IOCAP6 IOCAP5 IOCAP4 IOCAP3 IOCAP2 IOCAP1 IOCAP0 272
3A44h INLVLA INLVLA7 INLVLA6 INLVLA5 INLVLA4 INLVLA3 INLVLA2 INLVLA1 INLVLA0 259
3A43h SLRCONA SLRA7 SLRA6 SLRA5 SLRA4 SLRA3 SLRA2 SLRA1 SLRA0 258
3A42h ODCONA ODCA7 ODCA6 ODCA5 ODCA4 ODCA3 ODCA2 ODCA1 ODCA0 257
3A41h WPUA WPUA7 WPUA6 WPUA5 WPUA4 WPUA3 WPUA2 WPUA1 WPUA0 256
3A40h ANSELA ANSELA7 ANSELA6 ANSELA5 ANSELA4 ANSELA3 ANSELA2 ANSELA1 ANSELA0 255
3A3Fh -
— Unimplemented —
3A18h
3A17h RC7PPS — — — RC7PPS4 RC7PPS3 RC7PPS2 RC7PPS1 RC7PPS0 266
3A16h RC6PPS — — — RC6PPS4 RC6PPS3 RC6PPS2 RC6PPS1 RC6PPS0 266
Legend: x = unknown, u = unchanged, — = unimplemented, q = value depends on condition
Note 1: Not present in LF devices.
39D7h -
— Unimplemented —
39D2h
39D1h VREGCON(1) — — — — — — VREGPM — 166
39D0h BORCON SBOREN — — — — — — BORRDY 75
39CFh -
— Unimplemented —
39C8h
39C7h PMD7 CANMD — — — — — DMA2MD DMA1MD 282
39C6h PMD6 — SMT2MD SMT1MD CLC4MD CLC3MD CLC2MD CLC1MD DSMMD 281
39C5h PMD5 — — U2MD U1MD — SPI1MD I2C2MD I2C1MD 280
39C4h PMD4 CWG3MD CWG2MD CWG1MD — — — — — 279
39C3h PMD3 PWM8MD PWM7MD PWM6MD PWM5MD CCP4MD CCP3MD CCP2MD CCP1MD 278
39C2h PMD2 — DACMD ADCMD — — CMP2MD CMP1MD ZCDMD 277
39C1h PMD1 NCO1MD TMR6MD TMR5MD TMR4MD TMR3MD TMR2MD TMR1MD TMR0MD 276
39C0h PMD0 SYSCMD FVRMD HLVDMD CRCMD SCANMD NVMMD CLKRMD IOCMD 275
39BFh -
— Unimplemented —
39AAh
39A9h PIR9 — CLC4IF CCP4IF CLC3IF CWG3IF CCP3IF TMR6IF TMR5IF 136
39A8h PIR8 TMR5IF INT2IF CLC2IF CWG2IF CCP2IF TMR4IF TMR3GIF TMR3IF 135
39A7h PIR7 U2IF U2EIF U2TXIF U2RXIF I2C2EIF I2C2IF I2C2TXIF I2C2RXIF 134
39A6h PIR6 DMA2AIF DMA2ORIF DMA2DCNTIF DMA2SCNTIF SMT2PWAIF SMT2PRAIF SMT2IF C2IF 133
39A5h PIR5 IRXIF WAKIF ERRIF TXB2IF/ TXB1IF TXB0IF RXB1IF/ RXB0IF/ 132
TXBnIF RXBnIF FIFOFIF
39A4h PIR4 INT1IF CLC1IF CWG1IF NCO1IF CCP1IF TMR2IF TMR1GIF TMR1IF 131
39A3h PIR3 TMR0IF U1IF U1EIF U1TXIF U1RXIF I2C1EIF I2C1IF I2C1TXIF 130
39A2h PIR2 I2C1RXIF SPI1IF SPI1TXIF SPI1RXIF DMA1AIF DMA1ORIF DMA1DCNTIF DMA1SCNTIF 128
39A1h PIR1 SMT1PWAIF SMT1PRAIF SMT1IF C1IF ADTIF ADIF ZCDIF INT0IF 128
39A0h PIR0 IOCIF CRCIF SCANIF NVMIF CSWIF OSFIF HLVDIF SWIF 127
399Fh -
— Unimplemented —
399Ah
3999h PIE9 — CLC4IE CCP4IE CLC3IE CWG3IE CCP3IE TMR6IE TMR5IE 146
3998h PIE8 TMR5IE INT2IE CLC2IE CWG2IE CCP2IE TMR4IE TMR3GIE TMR3IE 145
3997h PIE7 U2IE U2EIE U2TXIE U2RXIE I2C2EIE I2C2IE I2C2TXIE I2C2RXIE 144
3996h PIE6 DMA2AIE DMA2ORIE DMA2DCNTIE DMA2SCNTIE SMT2PWAIE SMT2PRAIE SMT2IE C2IE 143
3995h PIE5 IRXIE WAKIE ERRIE TXB2IE/TXB- TXB1IE TXB0IE RXB1IE/ RXB0IF/ 142
nIE RXBnIE FIFOFIF
3994h PIE4 INT1IE CLC1IE CWG1IE NCO1IE CCP1IE TMR2IE TMR1GIE TMR1IE 141
3993h PIE3 TMR0IE U1IE U1EIE U1TXIE U1RXIE I2C1EIE I2C1IE I2C1TXIE 140
3992h PIE2 I2C1RXIE SPI1IE SPI1TXIE SPI1RXIE DMA1AIE DMA1ORIE DMA1DCNTIE DMA1SCNTIE 139
3991h PIE1 SMT1PWAIE SMT1PRAIE SMT1IE C1IE ADTIE ADIE ZCDIE INT0IE 138
3990h PIE0 IOCIE CRCIE SCANIE NVMIE CSWIE OSFIE HLVDIE SWIE 137
398Fh -
— Unimplemented —
398Ah
3989h IPR9 — CLC4IP CCP4IP CLC3IP CWG3IP CCP3IP TMR6IP TMR5IP 156
3988h IPR8 TMR5IP INT2IP CLC2IP CWG2IP CCP2IP TMR4IP TMR3GIP TMR3IP 155
3987h IPR7 U2IP U2EIP U2TXIP U2RXIP I2C2EIP I2C2IP I2C2TXIP I2C2RXIP 154
3986h IPR6 DMA2AIP DMA2ORIP DMA2DCNTIP DMA2SCNTIP SMT2PWAIP SMT2PRAIP SMT2IP C2IP 153
3985h IPR5 IRXIP WAKIP ERRIP TXB2IP/TXB- TXB1IP TXB0IP RXB1IP/ RXB0IP/ 152
nIP RXBnIP FIFOFIP
3984h IPR4 INT1IP CLC1IP CWG1IP NCO1IP CCP1IP TMR2IP TMR1GIP TMR1IP 151
3983h IPR3 TMR0IP U1IP U1EIP U1TXIP U1RXIP I2C1EIP I2C1IP I2C1TXIP 150
3982h IPR2 I2C1RXIP SPI1IP SPI1TXIP SPI1RXIP DMA1AIP DMA1ORIP DMA1DCNTIP DMA1SCNTIP 149
3981h IPR1 SMT1PWAIP SMT1PRAIP SMT1IP C1IP ADTIP ADIP ZCDIP INT0IP 148
Legend: x = unknown, u = unchanged, — = unimplemented, q = value depends on condition
Note 1: Not present in LF devices.
3980h IPR0 IOCIP CRCIP SCANIP NVMIP CSWIP OSFIP HLVDIP SWIP 147
397Fh -
— Unimplemented —
397Eh
397Dh SCANTRIG — — — — TSEL 216
397Ch SCANCON0 EN TRIGEN SGO — — MREG BURSTMD BUSY 212
397Bh SCANHADRU — — HADR 214
397Ah SCANHADRH HADR 215
3979h SCANHADRL HADR 215
3978h SCANLADRU — — LADR 213
3977h SCANLADRH LADR 213
3976h SCANLADRL LADR 214
3975h -
— Unimplemented —
396Ah
3969h CRCCON1 DLEN PLEN 208
3968h CRCCON0 EN CRCGO BUSY ACCM — — SHIFTM FULL 208
3967h CRCXORH X15 X14 X13 X12 X11 X10 X9 X8 211
3966h CRCXORL X7 X6 X5 X4 X3 X2 X1 — 211
3965h CRCSHIFTH SHFT15 SHFT14 SHFT13 SHFT12 SHFT11 SHFT10 SHFT9 SHFT8 210
3964h CRCSHIFTL SHFT7 SHFT6 SHFT5 SHFT4 SHFT3 SHFT2 SHFT1 SHFT0 210
3963h CRCACCH ACC15 ACC14 ACC13 ACC12 ACC11 ACC10 ACC9 ACC8 209
3962h CRCACCL ACC7 ACC6 ACC5 ACC4 ACC3 ACC2 ACC1 ACC0 210
3961h CRCDATH DATA15 DATA14 DATA13 DATA12 DATA11 DATA10 DATA9 DATA8 209
3960h CRCDATL DATA7 DATA6 DATA5 DATA4 DATA3 DATA2 DATA1 DATA0 209
395Fh WDTTMR WDTTMR STATE PSCNT 175
395Eh WDTPSH PSCNT 174
395Dh WDTPSL PSCNT 174
395Ch WDTCON1 — WDTCS — WINDOW 173
395Bh WDTCON0 — — WDTPS SEN 172
395Ah -
— Unimplemented —
38A0h
389Fh IVTADU AD 158
389Eh IVTADH AD 158
389Dh IVTADL AD 158
389Ch -
— Unimplemented —
3891h
3890h PRODH_SHAD PRODH 115
388Fh PRODL_SHAD PRODL 115
388Eh FSR2H_SHAD — — FSR2H 115
388Dh FSR2L_SHAD FSR2L 115
388Ch FSR1H_SHAD — — FSR1H 115
388Bh FSR1L_SHAD FSR1L 115
388Ah FSR0H_SHAD — — FSR0H 115
3889h FSR0L_SHAD FSR0L 115
3888h PCLATU_SHAD — — — PCU 115
3887h PCLATH_SHAD PCH 115
3886h BSR_SHAD — — BSR 115
3885h WREG_SHAD WREG 115
3884h STATUS_SHAD — TO PD N OV Z DC C 115
3883h SHADCON — — — — — — — SHADLO 159
3882h BSR_CSHAD — — BSR 47
3881h WREG_CSHAD WREG 47
Legend: x = unknown, u = unchanged, — = unimplemented, q = value depends on condition
Note 1: Not present in LF devices.
3880h STATUS_CSHAD — TO PD N OV Z DC C 47
387Fh
- — Unimplemented —
3800h
37FFh CANCON_RO0 CANCON_RO0 603
37FEh CANSTAT_RO0 CANSTAT_RO0 604
37FDh RXB1D7 RXB1D7 620
37FCh RXB1D6 RXB1D6 620
37FBh RXB1D5 RXB1D5 620
37FAh RXB1D4 RXB1D4 620
37F9h RXB1D3 RXB1D3 620
37F8h RXB1D2 RXB1D2 620
37F7h RXB1D1 RXB1D1 620
37F6h RXB1D0 RXB1D0 620
37F5h RXB1DLC — RXRTR RB1 R0 DLC3 DLC2 DLC1 DLC0 620
37F4h RXB1EIDL EID7 EID6 EID5 EID4 EID3 EID2 EID1 EID0 619
37F3h RXB1EIDH EID15 EID14 EID13 EID12 EID11 EID10 EID9 EID8 619
37F2h RXB1SIDL SID2 SID1 SID0 SRR EXID — EID17 EID16 619
37F1h RXB1SIDH SID10 SID9 SID8 SID7 SID6 SID5 SID4 SID3 618
37F0h RXB1CON RXFUL RXM1 RXM0 — RXRTRRO FILHIT2 FILHIT1 FILHIT0 617
37F0h RXB1CON RXFUL RXM1 RTRRO FILHIT4 FILHIT3 FILHIT2 FILHIT1 FILHIT0 617
37EFh CANCON_RO1 CANCON_RO1 603
37EEh CANSTAT_RO1 CANSTAT_RO1 604
37EDh TXB0D7 TXB0D7 611
37ECh TXB0D6 TXB0D6 611
37EBh TXB0D5 TXB0D5 611
37EAh TXB0D4 TXB0D4 611
37E9h TXB0D3 TXB0D3 611
37E8h TXB0D2 TXB0D2 611
37E7h TXB0D1 TXB0D1 611
37E6h TXB0D0 TXB0D0 611
37E5h TXB0DLC — TXRTR — — DLC3 DLC2 DLC1 DLC0 612
37E4h TXB0EIDL EID7 EID6 EID5 EID4 EID3 EID2 EID1 EID0 611
37E3h TXB0EIDH EID15 EID14 EID13 EID12 EID11 EID10 EID9 EID8 610
37E2h TXB0SIDL SID2 SID1 SID0 — EXIDE — EID17 EID16 610
37E1h TXB0SIDH SID10 SID9 SID8 SID7 SID6 SID5 SID4 SID3 610
37E0h TXB0CON TXBIF TXABT TXLARB TXERR TXREQ — TXPRI1 TXPRI0 609
37DFh CANCON_RO2 CANCON_RO2 603
37DEh CANSTAT_RO2 CANSTAT_RO2 604
37DDh TXB1D7 TXB1D7 611
37DCh TXB1D6 TXB1D6 611
37DBh TXB1D5 TXB1D5 611
37DAh TXB1D4 TXB1D4 611
37D9h TXB1D3 TXB1D3 611
37D8h TXB1D2 TXB1D2 611
37D7h TXB1D1 TXB1D1 611
37D6h TXB1D0 TXB1D0 611
37D5h TXB1DLC — TXRTR — — DLC3 DLC2 DLC1 DLC0 612
37D4h TXB1EIDL EID7 EID6 EID5 EID4 EID3 EID2 EID1 EID0 611
37D3h TXB1EIDH EID15 EID14 EID13 EID12 EID11 EID10 EID9 EID8 610
Legend: x = unknown, u = unchanged, — = unimplemented, q = value depends on condition
Note 1: Not present in LF devices.
37A0h RXF0SIDH SID10 SID9 SID8 SID7 SID6 SID5 SID4 SID3 630
379Fh CANCON_RO4 CANCON_RO4 603
379Eh CANSTAT_RO4 CANSTAT_RO4 604
379Dh B5D7 B5D7 627
379Ch B5D6 B5D6 627
379Bh B5D5 B5D5 627
379Ah B5D4 B5D4 627
3799h B5D3 B5D3 627
3798h B5D2 B5D2 627
3797h B5D1 B5D1 627
3796h B5D0 B5D0 627
3795h B5DLC — RXRTR RB1 RB0 DLC3 DLC2 DLC1 DLC0 628
3795h B5DLC — TXRTR — — DLC3 DLC2 DLC1 DLC0 629
3794h B5EIDL EID7 EID6 EID5 EID4 EID3 EID2 EID1 EID0 626
3793h B5EIDH EID15 EID14 EID13 EID12 EID11 EID10 EID9 EID8 626
3792h B5SIDL SID2 SID1 SID0 SRR EXIDE — EID17 EID16 625
3791h B5SIDH SID10 SID9 SID8 SID7 SID6 SID5 SID4 SID3 624
3790h B5CON RXFUL RXM1 RXRTRRO FILHIT4 FILHIT3 FILHIT2 FILHIT1 FILHIT0 622
3790h B5CON TXBIF TXABT TXLARB TXERR TXREQ RTREN TXPRI1 TXPRI0 623
378Fh CANCON_RO5 CANCON_RO5 603
378Eh CANSTAT_RO5 CANSTAT_RO5 604
378Dh B4D7 B4D7 627
378Ch B4D6 B4D6 627
378Bh B4D5 B4D5 627
378Ah B4D4 B4D4 627
3789h B4D3 B4D3 627
3788h B4D2 B4D2 627
3787h B4D1 B4D1 627
3786h B4D0 B4D0 627
3785h B4DLC — RXRTR RB1 RB0 DLC3 DLC2 DLC1 DLC0 628
3785h B4DLC — TXRTR — — DLC3 DLC2 DLC1 DLC0 629
3784h B4EIDL EID7 EID6 EID5 EID4 EID3 EID2 EID1 EID0 626
3783h B4EIDH EID15 EID14 EID13 EID12 EID11 EID10 EID9 EID8 626
3782h B4SIDL SID2 SID1 SID0 SRR EXIDE — EID17 EID16 625
3781h B4SIDH SID10 SID9 SID8 SID7 SID6 SID5 SID4 SID3 624
3780h B4CON RXFUL RXM1 RXRTRRO FILHIT4 FILHIT3 FILHIT2 FILHIT1 FILHIT0 622
3780h B4CON TXBIF TXABT TXLARB TXERR TXREQ RTREN TXPRI1 TXPRI0 623
377Fh CANCON_RO6 CANCON_RO6 603
377Eh CANSTAT_RO6 CANSTAT_RO6 604
377Dh B3D7 B3D7 627
377Ch B3D6 B3D6 627
377Bh B3D5 B3D5 627
377Ah B3D4 B3D4 627
3779h B3D3 B3D3 627
3778h B3D2 B3D2 627
3777h B3D1 B3D1 627
3776h B3D0 B3D0 627
3775h B3DLC — RXRTR RB1 RB0 DLC3 DLC2 DLC1 DLC0 628
3775h B3DLC — TXRTR — — DLC3 DLC2 DLC1 DLC0 629
3774h B3EIDL EID7 EID6 EID5 EID4 EID3 EID2 EID1 EID0 626
Legend: x = unknown, u = unchanged, — = unimplemented, q = value depends on condition
Note 1: Not present in LF devices.
3773h B3EIDH EID15 EID14 EID13 EID12 EID11 EID10 EID9 EID8 626
3772h B3SIDL SID2 SID1 SID0 SRR EXIDE — EID17 EID16 625
3771h B3SIDH SID10 SID9 SID8 SID7 SID6 SID5 SID4 SID3 624
3770h B3CON RXFUL RXM1 RXRTRRO FILHIT4 FILHIT3 FILHIT2 FILHIT1 FILHIT0 622
3770h B3CON TXBIF TXABT TXLARB TXERR TXREQ RTREN TXPRI1 TXPRI0 623
376Fh CANCON_RO7 CANCON_RO7 603
376Eh CANSTAT_RO7 CANSTAT_RO7 604
376Dh B2D7 B2D7 627
376Ch B2D6 B2D6 627
376Bh B2D5 B2D5 627
376Ah B2D4 B2D4 627
3769h B2D3 B2D3 627
3768h B2D2 B2D2 627
3767h B2D1 B2D1 627
3766h B2D0 B2D0 627
3765h B2DLC — RXRTR RB1 RB0 DLC3 DLC2 DLC1 DLC0 628
3765h B2DLC — TXRTR — — DLC3 DLC2 DLC1 DLC0 629
3764h B2EIDL EID7 EID6 EID5 EID4 EID3 EID2 EID1 EID0 626
3763h B2EIDH EID15 EID14 EID13 EID12 EID11 EID10 EID9 EID8 626
3762h B2SIDL SID2 SID1 SID0 SRR EXIDE — EID17 EID16 625
3761h B2SIDH SID10 SID9 SID8 SID7 SID6 SID5 SID4 SID3 624
3760h B2CON RXFUL RXM1 RXRTRRO FILHIT4 FILHIT3 FILHIT2 FILHIT1 FILHIT0 622
3760h B2CON TXBIF TXABT TXLARB TXERR TXREQ RTREN TXPRI1 TXPRI0 623
375Fh CANCON_RO8 CANCON_RO8 603
375Eh CANSTAT_RO8 CANSTAT_RO8 604
375Dh B1D7 B1D7 627
375Ch B1D6 B1D6 627
375Bh B1D5 B1D5 627
375Ah B1D4 B1D4 627
3759h B1D3 B1D3 627
3758h B1D2 B1D2 627
3757h B1D1 B1D1 627
3756h B1D0 B1D0 627
3755h B1DLC — RXRTR RB1 RB0 DLC3 DLC2 DLC1 DLC0 628
3755h B1DLC — TXRTR — — DLC3 DLC2 DLC1 DLC0 629
3754h B1EIDL EID7 EID6 EID5 EID4 EID3 EID2 EID1 EID0 626
3753h B1EIDH EID15 EID14 EID13 EID12 EID11 EID10 EID9 EID8 626
3752h B1SIDL SID2 SID1 SID0 SRR EXIDE — EID17 EID16 625
3751h B1SIDH SID10 SID9 SID8 SID7 SID6 SID5 SID4 SID3 624
3750h B1CON RXFUL RXM1 RXRTRRO FILHIT4 FILHIT3 FILHIT2 FILHIT1 FILHIT0 622
3750h B1CON TXBIF TXABT TXLARB TXERR TXREQ RTREN TXPRI1 TXPRI0 623
374Fh CANCON_RO9 CANCON_RO9 603
374Eh CANSTAT_RO9 CANSTAT_RO9 604
374Dh B0D7 B0D7 627
374Ch B0D6 B0D6 627
374Bh B0D5 B0D5 627
374Ah B0D4 B0D4 627
3749h B0D3 B0D3 627
3748h B0D2 B0D2 627
3747h B0D1 B0D1 627
Legend: x = unknown, u = unchanged, — = unimplemented, q = value depends on condition
Note 1: Not present in LF devices.
3716h RXF9EIDH EID15 EID14 EID13 EID12 EID11 EID10 EID9 EID8 631
3715h RXF9SIDL SID2 SID1 SID0 — EXIDEN — EID17 EID16 630
3714h RXF9SIDH SID10 SID9 SID8 SID7 SID6 SID5 SID4 SID3 630
3713h RXF8EIDL EID7 EID6 EID5 EID4 EID3 EID2 EID1 EID0 631
3712h RXF8EIDH EID15 EID14 EID13 EID12 EID11 EID10 EID9 EID8 631
3711h RXF8SIDL SID2 SID1 SID0 — EXIDEN — EID17 EID16 630
3710h RXF8SIDH SID10 SID9 SID8 SID7 SID6 SID5 SID4 SID3 630
370Fh RXF7EIDL EID7 EID6 EID5 EID4 EID3 EID2 EID1 EID0 631
370Eh RXF7EIDH EID15 EID14 EID13 EID12 EID11 EID10 EID9 EID8 631
370Dh RXF7SIDL SID2 SID1 SID0 — EXIDEN — EID17 EID16 630
370Ch RXF7SIDH SID10 SID9 SID8 SID7 SID6 SID5 SID4 SID3 630
370Bh RXF6EIDL EID7 EID6 EID5 EID4 EID3 EID2 EID1 EID0 631
370Ah RXF6EIDH EID15 EID14 EID13 EID12 EID11 EID10 EID9 EID8 631
3709h RXF6SIDL SID2 SID1 SID0 — EXIDEN — EID17 EID16 630
3708h RXF6SIDH SID10 SID9 SID8 SID7 SID6 SID5 SID4 SID3 630
3707h RXFCON1 RXF15EN RXF14EN RXF13EN RXF12EN RXF11EN RXF10EN RXF9EN RXF8EN 633
3706h RXFCON0 RXF7EN RXF6EN RXF5EN RXF4EN RXF3EN RXF2EN RXF1EN RXF0EN 633
3705h BRGCON3 WAKDIS WAKFIL — — — SEG2PH2 SEG2PH1 SEG2PH0 642
3704h BRGCON2 SEG2PHTS SAM SEG1PH2 SEG1PH1 SEG1PH0 PRSEG2 PRSEG1 PRSEG0 641
3703h BRGCON1 SJW1 SJW0 BRP5 BRP4 BRP3 BRP2 BRP1 BRP0 640
3702h TXERRCNT TEC7 TEC6 TEC5 TEC4 TEC3 TEC2 TEC1 TEC0 612
3701h RXERRCNT REC7 REC6 REC5 REC4 REC3 REC2 REC1 REC0 621
3700h CIOCON TX1SRC — — — — — — CLKSEL 643
Legend: x = unknown, u = unchanged, — = unimplemented, q = value depends on condition
Note 1: Not present in LF devices.
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 45-6 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 45-7 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 45-7 for each Oscillator mode’s supported frequencies.
PIC18F25/26K83
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 16 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 45-3, POR and POR REARM with Slow Rising VDD.
3: See Table 45-11 for BOR and LPBOR trip point information.
VDD
VPOR
VPORR
SVDD
VSS
NPOR(1)
POR REARM
VSS
TVLOW(3) TPOR(2)
PIC18F25/26K83
Param
Sym. Characteristic Min. Typ† Max. Units Conditions
No.
TH01 JA Thermal Resistance Junction to Ambient 60 C/W 28-pin SPDIP package
80 C/W 28-pin SOIC package
90 C/W 28-pin SSOP package
27.5 C/W 28-pin UQFN 4x4 mm package
27.5 C/W 28-pin QFN 6x6mm package
TH02 JC Thermal Resistance Junction to Case 31.4 C/W 28-pin SPDIP package
24 C/W 28-pin SOIC package
24 C/W 28-pin SSOP package
24 C/W 28-pin UQFN 4x4mm package
24 C/W 28-pin QFN 6x6mm package
TH03 TJMAX Maximum Junction Temperature 150 C
TH04 PD Power Dissipation — W PD = PINTERNAL + PI/O(3)
TH05 PINTERNAL Internal Power Dissipation — W PINTERNAL = IDD x VDD(1)
TH06 PI/O I/O Power Dissipation — W PI/O = (IOL * VOL) + (IOH * (VDD - VOH))
TH07 PDER Derated Power — W PDER = PDMAX (TJ - TA)/JA(2)
Note 1: IDD is current to run the chip alone without driving any load on the output pins.
2: TA = Ambient Temperature, TJ = Junction Temperature
3: See absolute maximum ratings for total power dissipation.
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 Oscillator
OS1 FECL Clock Frequency — — 500 kHz
OS2 TECL_DC Clock Duty Cycle 40 — 60 %
ECM Oscillator
OS3 FECM Clock Frequency — — 4 MHz
OS4 TECM_DC Clock Duty Cycle 40 — 60 %
ECH Oscillator
OS5 FECH Clock Frequency — — 32 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 45.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 45.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.93 1 1.07 MHz
Frequency 1.86 2 2.14 MHz
OS53* FLFOSC Internal LFINTOSC Frequency — 31 — 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 45-6: Precision Calibrated HFINTOSC Frequency Accuracy Over Device VDD and Tempera-
ture.
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.
AD20 TAD ADC Clock Period 1 — 9 s Using FOSC as the ADC clock
source ADOCS = 0
AD21 — 2 — s Using FRC as the ADC clock
source ADOCS = 1
AD22 TCNV Conversion Time(1) — 13+3 TAD — TAD Set of GO/DONE bit to Clear of GO/
DONE bit
AD23 TACQ Acquisition Time — 2 — s
AD24 THCD Sample and Hold Capacitor 3 — — TAD FOSC-based clock source
Disconnect Time FRC-based clock source
*
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: Does not apply for the ADCRC oscillator.
AD24 AD22
Q4
AD20
ADC_clk
ADC Data 9 8 7 6 3 2 1 0
ADIF 1 TCY
GO DONE
Sampling Stopped
Sample AD23
BSF ADCON0, GO
AD133 1 TCY
AD131
Q4
AD130
ADC_clk
ADC Data 9 8 7 6 3 2 1 0
ADIF 1 TCY
GO DONE
Note 1: If the ADC clock source is selected as 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 — — ±40 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 600 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.
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
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
SCL
SP90
SP106
SP107
SP91 SP92
SDA
In
SP110
SP109
SP109
SDA
Out
Param.
Symbol Characteristic Min. Max. Units Conditions
No.
SP100* THIGH Clock high time 100 kHz mode 4.0 — s Device must operate at a
minimum of 1.5 MHz
400 kHz mode 0.6 — s Device must operate at a
minimum of 10 MHz
SSP module 1.5TCY —
SP101* TLOW Clock low time 100 kHz mode 4.7 — s Device must operate at a
minimum of 1.5 MHz
400 kHz mode 1.3 — s Device must operate at a
minimum of 10 MHz
SSP module 1.5TCY —
SP102* TR SDA and SCL rise 100 kHz mode — 1000 ns
time 400 kHz mode 20 + 0.1CB 300 ns CB is specified to be from
10-400 pF
SP103* TF SDA and SCL fall time 100 kHz mode — 250 ns
400 kHz mode 20 + 0.1CB 250 ns CB is specified to be from
10-400 pF
SP106* THD:DAT Data input hold time 100 kHz mode 0 — ns
400 kHz mode 0 0.9 s
SP107* TSU:DAT Data input setup time 100 kHz mode 250 — ns (Note 2)
400 kHz mode 100 — ns
SP109* TAA Output valid from 100 kHz mode — 3500 ns (Note 1)
clock 400 kHz mode — — ns
SP110* TBUF Bus free time 100 kHz mode 4.7 — s Time the bus must be free
400 kHz mode 1.3 — s before a new transmission
can start
SP111 CB Bus capacitive loading — 400 pF
* These parameters are characterized but not tested.
Note 1: As a transmitter, the device must provide this internal minimum delay time to bridge the undefined region (min. 300 ns)
of the falling edge of SCL to avoid unintended generation of Start or Stop conditions.
2: A Fast mode (400 kHz) I2C bus device can be used in a Standard mode (100 kHz) I2C bus system, but the requirement
TSU:DAT 250 ns must then be met. This will automatically be the case if the device does not stretch the low period of
the SCL signal. If such a device does stretch the low period of the SCL signal, it must output the next data bit to the SDA
line TR max. + TSU:DAT = 1000 + 250 = 1250 ns (according to the Standard mode I2C bus specification), before the SCL
line is released.
PIC18F25K83
/SP e3
1526017
XXXXXXXXXXXXXXXXXXXX PIC18F25K83
XXXXXXXXXXXXXXXXXXXX /SO e3
XXXXXXXXXXXXXXXXXXXX 1526017
YYWWNNN
PIC18F26K83
/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 18F26K83
XXXXXXXX /ML e3
YYWWNNN 1526017
526017
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.
/HDG6NLQQ\3ODVWLF'XDO,Q/LQH63±PLO%RG\>63',3@
1RWH 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 >
<"
;( / /B
((! ; /
;% 6## >
8
;%@%( +
;,
;%@%( + >
<"
,
- 3 ? ? /
1RWHV
!"#$%&'($
)"
*+$()$#(+ (%,((( %
-' (.
(
#(
/ )##%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
/HDG3ODVWLF6KULQN6PDOO2XWOLQH66±PP%RG\>6623@
1RWH 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 >
!( B3.
<"
:( ? ?
%%! 6 6## B >
(%'' ? ?
<"
@%( 0 > >
%%! 6@%( 0 / B
<"
;(
5(;( ;
5(
( ; 05
;% 6## ?
5( D D >D
;%@%( + ? />
1RWHV
!"#$%&'($
)"
*+$()$#(+ (%,((( %
)##%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
/HDG3ODVWLF4XDG)ODW1R/HDG3DFNDJH0/±[PP%RG\>4)1@
ZLWKPP&RQWDFW/HQJWK
1RWH 5
()#( $
(
6%
,#*
##(
! 6
' ( (%(
((
477,,,)
)7
6
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.
Note the following details of the code protection feature on Microchip devices:
• Microchip products meet the specification contained in their particular Microchip Data Sheet.
• Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
• Microchip is willing to work with the customer who is concerned about the integrity of their code.
• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
QUALITY MANAGEMENT SYSTEM © 2017, Microchip Technology Incorporated, All Rights Reserved.
ISBN: 978-1-5224-2047-7
CERTIFIED BY DNV
== ISO/TS 16949 ==