PIC18F97J94
PIC18F97J94
PIC18F97J94
LCD (pixels)
USART w/IrDA®
PPS (Lite)
Comparators
8-Bit/16-Bit
SPI w/ DMA
Data SRAM
CCP/ECCP
CTMU
Pins
USB
Program
I2C
(bytes)
(bytes)
Timers
Flash
Device
For other small form-factor package availability and marking information, visit http://www.microchip.com/packaging or
contact your local sales office.
SEG7/RP27/REFO2/PSP7/RD7
SEG5/SDA2/RP25/PSP5/RD5
SEG6/SCL2/RP26/PSP6/RD6
COM0/RP33/REFO1/RE3
LCDBIAS3/RP30/CS/RE2
SEG0/RP20/PSP0/RD0
SEG1/RP21/PSP1/RD1
SEG2/RP22/PSP2/RD2
SEG3/RP23/PSP3/RD3
SEG4/RP24/PSP4/RD4
LCDBIAS0/RP31/RE7
COM1/RP32/RE4
COM2/RP37/RE5
COM3/RP34/RE6
VDD
VSS
64
63
62
61
60
59
58
57
56
55
54
53
52
51
50
49
LCDBIAS2/RP29/WR/RE1 1 48 VLCAP1/RP8/CTED13/INT0/RB0
LCDBIAS1/RP28/RD/RE0 47 VLCAP2/RP9/RB1
2
COM4/SEG28/AN8/RP46/RG0 3 46 SEG9/RP14/CTED1/RB2
COM5/SEG29/AN19/RP39/RG1 4 45 SEG10/RP7/CTED2/RB3
COM6/SEG30/AN18/C3INA/RP42/RG2 5 44 SEG11/RP12/CTED3/RB4
COM7/SEG31/AN17/C3INB/RP43/RG3 6 43 SEG8/RP13/CTED4/RB5
MCLR 7 42 CTED5/PGC/RB6
SEG26/AN16/C3INC/RP44/RTCC/RG4 8 PIC18F6XJ94 41 VSS
VSS 9 40 OSC2/CLKO/RP6/RA6
VCAP 10 39 OSC1/CLKI/RP10/RA7
SEG25/AN5/RP38/RF7 11 38 VDD
SEG24/AN11/C1INA/RP40/RF6 12 37 CTED6/PGD/RB7
SEG23/CVREF/AN10/C1INB/RP35/RF5 13 36 SEG12/RP16/CTED10/RC5
D+/RF4 14 35 SEG16/SDA1/RP17/CTED9/RC4
D-/RF3 15 34 SEG17/SCL1/RP15/CTED8/RC3
SEG20/AN7/CTMUI/C2INB/RP36/RF2 16 33 SEG13/AN9/RP11/CTED7/RC2
19
20
21
24
25
26
27
28
29
30
31
32
17
18
22
23
AVSS
VSS
VBAT
AVDD
VDD
SEG19/AN0/AN1-/RP0/RA0
SEG15/AN4/LVDIN/C1INA/C2INA/C3INA/RP5/RA5
VREF+/AN3/RP3/RA3
SEG21/VREF-/AN2/RP2/RA2
SEG18/AN1/RP1/RA1
SEG14/AN6/RP4/RA4
SOSCI/RC1
SOSCO/SCLKI/PWRLCLK/RC0
SEG27/RP18/UOE/CTED11/RC6
SEG22/RP19/CTED12/RC7
VUSB3V3
AD7/SEG7/RP27/REFO2/PSP7/RD7
AD5/SEG5/SDA2/RP25/PSP5/RD5
AD6/SEG6/SCL2/RP26/PSP6/RD6
AD11/COM0/RP33/REFO1/RE3
AD10/LCDBIAS3/RP30/CS/RE2
AD0/SEG0/RP20/PSP0/RD0
AD1/SEG1/RP21/PSP1/RD1
AD2/SEG2/RP22/PSP2/RD2
AD3/SEG3/RP23/PSP3/RD3
AD4/SEG4/RP24/PSP4/RD4
AD15/LCDBIAS0/RP31/RE7
AD12/COM1/RP32/RE4
AD13/COM2/RP37/RE5
AD14/COM3/RP34/RE6
A17/SEG46/AN22/RH1
A16/SEG47/AN23/RH0
ALE/SEG32/RJ0
OE/SEG33/RJ1
VDD
VSS
80
79
78
77
76
75
74
73
72
71
70
69
68
67
66
65
64
63
62
61
A18/SEG45/AN21/RH2 1 60 WRL/SEG34/RJ2
A19/SEG44/AN20/RH3 2 59 WRH/SEG35/RJ3
AD9/LCDBIAS2/RP29/WR/RE1 3 58 VLCAP1/RP8/CTED13/INT0/RB0
AD8/LCDBIAS1/RP28/RD/RE0 4 57 VLCAP2/RP9/RB1
COM4/SEG28/AN8/RP46/RG0 5 56 SEG9/RP14/CTED1/RB2
COM5/SEG29/AN19/RP39/RG1 6 55 SEG10/RP7/CTED2/RB3
COM6/SEG30/AN18/C3INA/RP42/RG2 7 54 SEG11/RP12/CTED3/RB4
COM7/SEG31/AN17/C3INB/RP43/RG3 8 53 SEG8/RP13/CTED4/RB5
MCLR 9 52 CTED5/PGC/RB6
SEG26/AN16/C3INC/RP44/RTCC/RG4 10 PIC18F8XJ94 51 VSS
VSS 11 50 OSC2/CLKO/RP6/RA6
VCAP 12 49 OSC1/CLKI/RP10/RA7
SEG25/AN5/RP38/RF7 13 48 VDD
SEG24/AN11/C1INA/RP40/RF6 14 47 CTED6/PGD/RB7
SEG23/CVREF/AN10/C1INB/RP35/RF5 15 46 SEG12/RP16/CTED10/RC5
D+/RF4 16 45 SEG16/SDA1/RP17/CTED9/RC4
D-/RF3 17 44 SEG17/SCL1/RP15/CTED8/RC3
SEG20/AN7/C2INB/RP36/RF2 18 43 SEG13/AN9/RP11/CTED7/RC2
SEG43/AN15/RH7 19 42 UB/SEG36/RJ7
SEG42/AN14/C1INC/RH6 20 41 LB/SEG37/RJ6
23
24
25
28
29
30
31
32
33
34
35
36
37
38
21
22
26
27
39
40
VUSB3V3
Vss
AVSS
AVDD
VDD
SEG15/AN4/LVDIN/C1INA/C2INA/C3INA/RP5/RA5
SEG41/AN13/C2IND/RH5
SEG40/AN12/C2INC/RH4
VREF+/AN3/RP3/RA3
SOSCI/RC1
SEG27/RP18/UOE/CTED11/RC6
SEG22/RP19/CTED12/RC7
SEG14/AN6/RP4/RA4
VBAT
SEG21/VREF-/AN2/RP2/RA2
SEG18/AN1/RP1/RA1
SEG19/AN0/AN1-/RP0/RA0
SOSCO/SCLKI/PWRLCLK/RC0
BA0/SEG39/RJ4
CE/SEG38/RJ5
AD7/SEG7/RP27/REFO2/PSP7/RD7
AD5/SEG5/SDA2/RP25/PSP5/RD5
AD6/SEG6/SCL2/RP26/PSP6/RD6
AD10/LCDBIAS3/RP30/CS/RE2
AD11/COM0/RP33/REFO1/RE3
AD0/SEG0/RP20/PSP0/RD0
AD1/SEG1/RP21/PSP1/RD1
AD2/SEG2/RP22/PSP2/RD2
AD3/SEG3/RP23/PSP3/RD3
AD4/SEG4/RP24/PSP4/RD4
AD15/LCDBIAS0/RP31/RE7
AD12/COM1/RP32/RE4
AD13/COM2/RP37/RE5
AD14/COM3/RP34/RE6
A17/SEG46/AN22/RH1
A16/SEG47/AN23/RH0
ALE/SEG32/RJ0
OE/SEG33/RJ1
SEG63/RK7
SEG62/RK6
SEG48/RL0
RG7
RG6
VDD
VSS
95
100
99
98
97
96
94
93
92
91
90
89
88
87
86
85
84
83
82
81
80
79
78
77
76
A18/SEG45/AN21/RH2 1 75 WRL/SEG34/RJ2
A19/SEG44/AN20/RH3 2 74 WRH/SEG35/RJ3
AD9/LCDBIAS2/RP29/WR/RE1 3 73 VLCAP1/RP8/CTED13/INT0/RB0
AD8/LCDBIAS1/RP28/RD/RE0 4 72 VLCAP2/RP9/RB1
VDD 5 71 DDIO1/SEG61/RK5
COM4/SEG28/AN8/RP46/RG0 6 70 SEG9/RP14/CTED1/RB2
COM5/SEG29/AN19/RP39/RG1 7 69 SEG10/RP7/CTED2/RB3
COM6/SEG30/AN18/C3INA/RP42/RG2 8 68 SEG11/RP12/CTED3/RB4
COM7/SEG31/AN17/C3INB/RP43/RG3 9 67 SEG8/RP13/CTED4/RB5
SEG49/RL1 10 66 DDIO0/SEG60/RK4
MCLR 11 65 CTED5/PGC/RB6
SEG26/AN16/C3INC/RP44/RTCC/RG4 12 64 VSS
SEG50/RL2 13
PIC18F9XJ94 63 SEG59/RK3
VSS 14 62 OSC2/CLKO/RP6/RA6
VCAP 15 61 OSC1/CLKI/RP10/RA7
SEG51/RL3 16 60 SEG58/RK2
SEG25/AN5/RP38/RF7 17 59 VDD
SEG24/AN11/C1INA/RP40/RF6 18 58 CTED6/PGD/RB7
SEG23/CVREF/AN10/C1INB/RP35/RF5 19 57 SEG12/RP16/CTED10/RC5
D+/RF4 20 56 SEG16/SDA1/RP17/CTED9/RC4
SEG52/RL4 21 55 SEG57/RK1
D-/RF3 22 54 SEG17/SCL1/RP15/CTED8/RC3
SEG20/AN7/CTMUI/C2INB/RP36/RF2 23 53 SEG13/AN9/RP11/CTED7/RC2
SEG43/AN15/RH7 24 52 UB/SEG36/RJ7
SEG42/AN14/C1INC/RH6 25 51 LB/SEG37/RJ6
26
27
39
40
41
42
43
44
45
46
47
48
49
50
28
29
30
31
32
33
34
35
36
37
38
VBAT
SEG41/AN13/C2IND/RH5
SEG40/AN12/C2INC/RH4
SEG53/RL5
AVSS
VREF+/AN3/RP3/RA3
SEG21/VREF-/AN2/RP2/RA2
VSS
SEG18/AN1/RP1/RA1
SEG19/AN0/AN1-/RP0/RA0
SEG54/RL6
VSS
SEG55/RL7
SOSCI/RC1
SEG56/RK0
SEG27/RP18/UOE/CTED11/RC6
SEG15/AN4/LVDIN/C1INA/C2INA/C3INA/RP5/RA5
SEG14/AN6/RP4/RA4
SEG22/RP19/CTED12/RC7
BA0/SEG39/RJ4
CE/SEG38/RJ5
SOSCO/SCLKI/PWRLCLK/RC0
AVDD
VDD
VUSB3V3
Comparator
PPS-Lite(1)
Interrupt
Pull-up
CTMU
MSSP
REFO
Basic
HLVD
ADC
USB
LCD
PSP
I/O
64-Pin TQFP/QFN
Comparator
PPS-Lite(1)
Interrupt
Pull-up
CTMU
MSSP
REFO
Basic
HLVD
ADC
USB
LCD
PSP
I/O
80-Pin TQFP
Comparator
PPS-Lite(1)
Interrupt
Pull-up
CTMU
MSSP
REFO
Basic
HLVD
EMB
ADC
USB
LCD
PSP
I/O
80-Pin TQFP
Comparator
PPS-Lite(1)
Interrupt
Pull-up
CTMU
MSSP
REFO
Basic
HLVD
EMB
ADC
USB
LCD
PSP
I/O
RF3 17 — — — — D- — — — — — — — Y —
RF4 16 — — — — D+ — — — — — — — Y —
RF5 15 AN10 C1INB/ — — — SEG23 — — — — — RP35 Y —
CVREF
RF6 14 AN11 C1INA — — — SEG24 — — — — — RP40 Y —
RF7 13 AN5 — — — — SEG25 — — — — — RP38 Y —
RG0 5 AN8 — — — — COM4/ — — — — — RP46 Y —
SEG28
RG1 6 AN19 — — — — COM5/ — — — — — RP39 Y —
SEG29
RG2 7 AN18 C3INA — — — COM6/ — — — — — RP42 Y —
SEG30
RG3 8 AN17 C3INB — — — COM7/ — — — — — RP43 Y —
SEG31
RG4 10 AN16 C3INC — — — SEG26 — — — — — RP44 Y —
RG5/ 9 — — — — — — — — — — — — Y MCLR
MCLR
RH0 79 AN23 — — — — SEG47 — — — — A16 — Y —
RH1 80 AN22 — — — — SEG46 — — — — A17 — Y —
RH2 1 AN21 — — — — SEG45 — — — — A18 — Y —
RH3 2 AN20 — — — — SEG44 — — — — A19 — Y —
RH4 22 AN12 C2INC — — — SEG40 — — — — — — Y —
RH5 21 AN13 C2IND — — — SEG41 — — — — — — Y —
RH6 20 AN14 C1INC — — — SEG42 — — — — — — Y —
RH7 19 AN15 — — — — SEG43 — — — — — — Y —
RJ0 62 — — — — — SEG32 — — — — ALE — Y —
RJ1 61 — — — — — SEG33 — — — — OE — Y —
RJ2 60 — — — — — SEG34 — — — — WRL — Y —
RJ3 59 — — — — — SEG35 — — — — WRH — Y —
RJ4 39 — — — — — SEG39 — — — — BA0 — Y —
RJ5 40 — — — — — SEG38 — — — — CE — Y —
RJ6 41 — — — — — SEG37 — — — — LB — Y —
RJ7 42 — — — — — SEG36 — — — — UB — Y —
AVDD 25 AVDD — — — — — — — — — — — — —
AVSS 26 AVSS — — — — — — — — — — — — —
VBAT 24 — — — — — — — — — — — — — VBAT
VCAP/ 12 — — — — — — — — — — — — — VCAP/
VDDCORE VDDCORE
VDD 32, 48, — — — — — — — — — — — — — VDD
71
VSS 11, 31, — — — — — — — — — — — — — VSS
51, 70
VUSB3V3 23 — — — — — — — — — — — — — VUSB3V3
Note 1: The peripheral inputs and outputs that support PPS have no default pins.
100-Pin TQFP
Comparator
PPS-Lite(1)
Interrupt
Pull-up
CTMU
MSSP
REFO
Basic
HLVD
EMB
ADC
USB
LCD
PSP
I/O
100-Pin TQFP
Comparator
PPS-Lite(1)
Interrupt
Pull-up
CTMU
MSSP
REFO
Basic
HLVD
EMB
ADC
USB
LCD
PSP
I/O
100-Pin TQFP
Comparator
PPS-Lite(1)
Interrupt
Pull-up
CTMU
MSSP
REFO
Basic
HLVD
EMB
ADC
USB
LCD
PSP
I/O
RL6 38 — — — — — SEG54 — — — — — — Y —
RL7 41 — — — — — SEG55 — — — — — — Y —
AVDD 31 AVDD — — — — — — — — — — — — —
AVSS 32 AVSS — — — — — — — — — — — — —
VBAT 29 — — — — — — — — — — — — — VBAT
VCAP/ 15 — — — — — — — — — — — — — VCAP/
VDDCORE VDDCORE
VDD 5, 40, — — — — — — — — — — — — — VDD
59, 88
VSS 14, 35, — — — — — — — — — — — — — VSS
39, 64,
87
VUSB3V3 28 — — — — — — — — — — — — — VUSB3V3
Note 1: The peripheral inputs and outputs that support PPS have no default pins.
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.
Data Bus<8>
Table Pointer<21>
PORTA
Data Latch
inc/dec logic 8 8 RA<7:0>(1,2)
Data Memory
(4 Kbytes)
21 PCLATU PCLATH
20 Address Latch
PCU PCH PCL
Program Counter 12 PORTB
Data Address<12>
RB<7:0>(1)
31-Level Stack
Address Latch 4 12 4
BSR FSR0 Access
Program Memory STKPTR Bank
FSR1
FSR2 12
Data Latch PORTC
inc/dec RC<7:0>(1)
8 logic
Table Latch
ROM Latch
Address
Instruction Bus <16> Decode
PORTD
IR RD<7:0>(1)
8
Instruction State Machine
Decode and Control Signals
Control
PRODH PRODL PORTE
RE<7:0>(1)
8 x 8 Multiply
Timing 3
Power-up 8
OSC2/CLKO Generation
OSC1/CLKI Timer
BITOP W
INTRC Oscillator 8 8
Oscillator 8
Start-up Timer
8 MHz PORTF
Oscillator Power-on 8 8
Reset RF<7:2>(1)
Precision ALU<8>
Band Gap Watchdog
Reference Timer
8
BOR and
Voltage HLVD
Regulator
PORTG
RG<4:0>(1)
VDDCORE/VCAP VDD, VSS MCLR
CCP ECCP
4/5/6/7/8/9/10 1/2/3 EUSART1 EUSART2 RTCC MSSP1/2 USB EUSART3 EUSART4
Table Pointer<21>
IR
AD<15:0>, A<19:16>
(Multiplexed with PORTD, PORTF
PORTE and PORTH) 8
Instruction State Machine RF<7:2>(1)
Decode and Control Signals
Control
PRODH PRODL
PORTG
8 x 8 Multiply
Timing 3 RG<4:0>(1)
Power-up 8
OSC2/CLKO Generation
OSC1/CLKI Timer
BITOP W
INTRC Oscillator 8 8
Oscillator 8 PORTH
Start-up Timer
8 MHz RH<7:0>(1)
Oscillator Power-on 8 8
Reset
Precision ALU<8>
Band Gap Watchdog
Reference Timer PORTJ
8
BOR and RJ<7:0>(1)
Voltage
Regulator HLVD
CCP ECCP
4/5/6/7/8/9/10 1/2/3 EUSART1 EUSART2 RTCC MSSP1/2 EUSART4 EUSART3 USB EMB
Table Pointer<21>
Data Latch
inc/dec logic 8 8 USB PORTA
Data Memory
RA<7:0>(1,2)
(4 Kbytes)
21 PCLATU PCLATH
20 Address Latch
PCU PCH PCL PORTB
Program Counter 12
RB<7:0>(1)
Data Address<12>
31-Level Stack
Address Latch 4 12 4
PORTC
BSR FSR0 Access
STKPTR
System Bus Interface
inc/dec PORTD
8 logic
Table Latch RD<7:0>(1)
8 x 8 Multiply PORTG
Timing 3
Power-up 8
OSC2/CLKO Generation RG<4:0>,
Timer
OSC1/CLKI BITOP W RG<7:6>(1)
INTRC Oscillator 8 8
Oscillator 8
Start-up Timer
8 MHz PORTH
Oscillator Power-on 8 8
Reset RH<7:0>(1)
Precision ALU<8>
Band Gap Watchdog
Reference Timer
8
PORTJ
BOR and
Voltage
Regulator HLVD RJ<7:0>(1)
CCP ECCP
4/5/6/7/8/9/10 1/2/3 EUSART1 EUSART2 RTCC MSSP1/2 EUSART4 EUSART3 USB EMB
Legend: TTL = TTL compatible input CMOS = CMOS compatible input or output
ST = Schmitt Trigger input with CMOS levels Analog = Analog input
I = Input O = Output
P = Power OD = Open-Drain (no P diode to VDD)
I2C = I2C/SMBus
SEG19/AN0/AN1-/RP0/RA0 37 30 24
SEG19 O Analog SEG19 output for LCD.
AN0 I Analog Analog Input 0.
AN1- I Analog A/D negative input channel.
RP0 I/O ST/DIG Remappable Peripheral Pin 0 input/output.
RA0 I/O ST/DIG General purpose I/O pin.
SEG18/AN1/RP1/RA1 36 29 23
SEG18 O Analog SEG18 output for LCD.
AN1 I Analog Analog Input 1.
RP1 I/O ST/DIG Remappable Peripheral Pin 1 input/output.
RA1 I/O ST/DIG General purpose I/O pin.
SEG21/VREF-/AN2/RP2/RA2 34 28 22
SEG21 O Analog SEG21 output for LCD.
VREF- I Analog A/D reference voltage (low) input.
AN2 I Analog Analog Input 2.
RP2 I/O ST/DIG Remappable Peripheral Pin 2 input/output.
RA2 I/O ST/DIG General purpose I/O pin.
VREF+/AN3/RP3/RA3 33 27 21
VREF+ I Analog A/D reference voltage (high) input.
AN3 I Analog Analog Input 3.
RP3 I/O ST/DIG Remappable Peripheral Pin 3 input/output.
RA3 I/O ST/DIG General purpose I/O pin.
SEG14/AN6/RP4/RA4 43 34 28
SEG14 O Analog SEG14 output for LCD.
AN6 I Analog Analog Input 6.
RP4 I/O ST/DIG Remappable Peripheral Pin 4 input/output.
RA4 I/O ST/DIG General purpose I/O pin.
SEG15/AN4/LVDIN/C1INA/ 42 33 27
C2INA/C3INA/RP5/RA5
SEG15 O Analog SEG15 output for LCD.
AN4 I Analog Analog Input 4.
LVDIN I Analog High/Low-Voltage Detect (HLVD) input.
C1INA I Analog Comparator 1 Input A.
C2INA I Analog Comparator 2 Input A.
C3INA I Analog Comparator 3 Input A.
RP5 I/O ST/DIG Remappable Peripheral Pin 5 input/output.
RA5 I/O ST/DIG General purpose I/O pin.
Legend: TTL = TTL compatible input CMOS = CMOS compatible input or output
ST = Schmitt Trigger input with CMOS levels Analog = Analog input
I = Input O = Output
P = Power OD = Open-Drain (no P diode to VDD)
I2C = I2C/SMBus
VLCAP1/RP8/CTED13/INT0/RB0 73 58 48
VLCAP1 I Analog LCD Drive Charge Pump Capacitor Input 1.
RP8 I/O ST/DIG Remappable Peripheral Pin 8 input/output.
CTED13 I ST CTMU Edge 13 input.
INT0 I ST External Interrupt 0.
RB0 I/O ST/DIG General purpose I/O pin.
VLCAP2/RP9/RB1 72 57 47
VLCAP2 I Analog LCD Drive Charge Pump Capacitor Input 2.
RP9 I/O ST/DIG Remappable Peripheral Pin 9 input/output.
RB1 I/O ST/DIG General purpose I/O pin.
SEG9/RP14/CTED1/RB2 70 56 46
SEG9 O Analog SEG9 output for LCD.
RP14 I/O ST/DIG Remappable Peripheral Pin 14 input/output.
CTED1 I ST CTMU Edge 1 input.
RB2 I/O ST/DIG General purpose I/O pin.
SEG10/RP7/CTED2/RB3 69 55 45
SEG10 O Analog SEG10 output for LCD.
RP7 I/O ST/DIG Remappable Peripheral Pin 7 input/output.
CTED2 I ST CTMU Edge 2 input.
RB3 I/O ST/DIG General purpose I/O pin.
SEG11/RP12/CTED3/RB4 68 54 44
SEG11 O Analog SEG11 output for LCD.
RP12 I/O ST/DIG Remappable Peripheral Pin 12 input/output.
CTED3 I ST CTMU Edge 3 input.
RB4 I/O ST/DIG General purpose I/O pin.
SEG8/RP13/CTED4/RB5 67 53 43
SEG8 O Analog SEG8 output for LCD.
RP13 I/O ST/DIG Remappable Peripheral Pin 13 input/output.
CTED4 I ST CTMU Edge 4 input.
RB5 I/O ST/DIG General purpose I/O pin.
PGC/CTED5/RB6 65 52 42
PGC I/O ST/DIG In-Circuit Debugger and ICSP™ programming clock pin.
CTED5 I ST CTMU Edge Input.
RB6 I/O ST/DIG General purpose I/O pin.
PGD/CTED6/RB7 58 47 37
PGD I/O ST/DIG In-Circuit Debugger and ICSP™ programming data pin.
CTED6 I ST CTMU Edge 6 input.
RB7 I/O ST/DIG General purpose I/O pin.
Legend: TTL = TTL compatible input CMOS = CMOS compatible input or output
ST = Schmitt Trigger input with CMOS levels Analog = Analog input
I = Input O = Output
P = Power OD = Open-Drain (no P diode to VDD)
I2C = I2C/SMBus
SOSCO/SCLKI/PWRLCLK/RC0 45 36 30
SOSCO O — SOSC oscillator output.
SCLKI I ST Digital SOSC input.
PWRLCLK I ST SOSC input at 50 Hz or 60 Hz only
(RTCCLKSEL<1:0> = 11 or 10).
RC0 I/O ST General purpose Input pin.
SOSCI/RC1 44 35 29
SOSCI I Analog Timer1 oscillator input.
RC1 I/O ST General purpose Input pin.
SEG13/AN9/RP11/CTED7/RC2 53 43 33
SEG13 O Analog SEG13 output for LCD.
AN9 I Analog Analog Input 9.
RP11 I/O ST/DIG Remappable Peripheral Pin 11 input/output.
CTED7 I ST CTMU Edge 7 input.
RC2 I/O ST/DIG General purpose I/O pin.
SEG17/SCL1/RP15/CTED8/RC3 54 44 34
SEG17 O Analog SEG17 output for LCD.
SCL1 I/O I2C I2C clock input/output.
RP15 I/O ST/DIG Remappable Peripheral Pin 15 input/output.
CTED8 I ST CTMU Edge 8 input.
RC3 I/O ST/DIG General purpose I/O pin.
SEG16/SDA1/RP17/CTED9/RC4 56 45 35
SEG16 O Analog SEG16 output for LCD.
SDA1 I/O I2C I2C data input/output.
RP17 I/O ST/DIG Remappable Peripheral Pin 17 input/output.
CTED9 I ST CTMU Edge 9 input.
RC4 I/O ST/DIG General purpose I/O pin.
SEG12/RP16/CTED10/RC5 57 46 36
SEG12 O Analog SEG12 output for LCD.
RP16 I/O ST/DIG Remappable Peripheral Pin 16 input/output.
CTED10 I ST CTMU Edge 10 input.
RC5 I/O ST/DIG General purpose I/O pin.
SEG27/RP18/UOE/CTED11/RC6 47 37 31
SEG27 O Analog SEG27 output for LCD.
RP18 I/O ST/DIG Remappable Peripheral Pin 18 input/output.
UOE/ O DIG External USB transceiver NOE output.
CTED11 I ST CTMU Edge 11 input.
RC6 I/O ST/DIG General purpose I/O pin.
SEG22/RP19/CTED12/RC7 48 38 32
SEG22 O Analog SEG22 output for LCD.
RP19 I/O ST/DIG Remappable Peripheral Pin 19 input/output.
CTED12 I ST CTMU Edge 12 input.
RC7 I/O ST/DIG General purpose I/O pin.
Legend: TTL = TTL compatible input CMOS = CMOS compatible input or output
ST = Schmitt Trigger input with CMOS levels Analog = Analog input
I = Input O = Output
P = Power OD = Open-Drain (no P diode to VDD)
I2C = I2C/SMBus
AD0/SEG0/RP20/PSP0/RD0 90 72 58
AD0 I/O TTL/DIG External Memory Address/Data 0.
SEG0 O Analog SEG0 output for LCD.
RP20 I/O ST/DIG Remappable Peripheral Pin 20 input/output.
PSP0 I/O ST/DIG Parallel Slave Port data.
RD0 I/O ST/DIG General purpose I/O pin.
AD1/SEG1/RP21/PSP1/RD1 86 69 55
AD1 I/O TTL/DIG External Memory Address/Data 1.
SEG1 O Analog SEG1 output for LCD.
RP21 I/O ST/DIG Remappable Peripheral Pin 21 input/output.
PSP1 I/O ST/DIG Parallel Slave Port data.
RD1 I/O ST/DIG General purpose I/O pin.
AD2/SEG2/RP22/PSP2/RD2 84 68 54
AD2 I/O TTL/DIG External Memory Address/Data 2.
SEG2 O Analog SEG2 output for LCD.
RP22 I/O ST/DIG Remappable Peripheral Pin 22 input/output.
PSP2 I/O ST/DIG Parallel Slave Port data.
RD2 I/O ST/DIG General purpose I/O pin.
AD3/SEG3/RP23/PSP3/RD3 83 67 53
AD3 I/O TTL/DIG External Memory Address/Data 3.
SEG3 O Analog SEG3 output for LCD.
RP23 I/O ST/DIG Remappable Peripheral Pin 3 input/output.
PSP3 I/O ST/DIG Parallel Slave Port data.
RD3 I/O ST/DIG General purpose I/O pin.
AD4/SEG4/RP24/PSP4/RD4 82 66 52
AD4 I/O TTL/DIG External Memory Address/Data 4.
SEG4 O Analog SEG4 output for LCD.
RP24 I/O ST/DIG Remappable Peripheral Pin 24 input/output.
PSP4 I/O ST/DIG Parallel Slave Port data.
RD4 I/O ST/DIG General purpose I/O pin.
AD5/SEG5/SDA2/RP25/PSP5/RD5 81 65 51
AD5 I/O TTL/DIG External Memory Address/Data 5.
SEG5 O Analog SEG5 output for LCD.
SDA2 I/O I2C I2C data input/output.
RP25 I/O ST/DIG Remappable Peripheral Pin 25 input/output.
PSP5 I/O ST/DIG Parallel Slave Port data.
RD5 I/O ST/DIG General purpose I/O pin.
AD6/SEG6/SCL2/RP26/PSP6/RD6 79 64 50
AD6 I/O TTL/DIG External Memory Address/Data 6.
SEG6 O Analog SEG6 output for LCD.
SCL2 I/O I2C I2C clock input/output.
RP26 I/O ST/DIG Remappable Peripheral Pin 26 input/output.
PSP6 I/O ST/DIG Parallel Slave Port data.
RD6 I/O ST/DIG General purpose I/O pin.
AD7/SEG7/RP27/REFO2/ 78 63 49
PSP7/RD7
AD7 I/O TTL/DIG External Memory Address/Data 7.
SEG7 O Analog SEG7 output for LCD.
RP27 I/O ST/DIG Remappable Peripheral Pin 27 input/output.
REFO2 O DIG Reference output clock.
PSP7 I/O ST/DIG Parallel Slave Port data
RD7 I/O ST/DIG General purpose I/O pin.
Legend: TTL = TTL compatible input CMOS = CMOS compatible input or output
ST = Schmitt Trigger input with CMOS levels Analog = Analog input
I = Input O = Output
P = Power OD = Open-Drain (no P diode to VDD)
I2C = I2C/SMBus
AD8/LCDBIAS1/RP28/RD/RE0 4 4 2
AD8 I/O TTL/DIG External Memory Address/Data 8.
LCDBIAS1 I Analog BIAS1 input for LCD.
RP28 I/O ST/DIG Remappable Peripheral Pin 28 input/output.
RD I TTL Parallel Slave Port read strobe.
RE0 I/O ST/DIG General purpose I/O pin.
AD9/LCDBIAS2/RP29/WR/RE1 3 3 1
AD9 I/O TTL/DIG External Memory Address/Data 9.
LCDBIAS2 I Analog BIAS2 input for LCD.
RP29 I/O ST/DIG Remappable Peripheral Pin 29 input/output.
WR I TTL Parallel Slave Port write strobe.
RE1 I/O ST/DIG General purpose I/O pin.
AD10/LCDBIAS3/RP30/CS/RE2 98 78 64
AD10 I/O TTL/DIG External Memory Address/Data 10.
LCDBIAS3 I Analog BIAS3 input for LCD.
RP30 I/O ST/DIG Remappable Peripheral Pin 30 input/output.
CS I TTL Parallel Slave Port chip select.
RE2 I/O ST/DIG General purpose I/O pin.
AD11/COM0/RP33/REFO1/RE3 97 77 63
AD11 I/O TTL/DIG External Memory Address/Data 11.
COM0 O Analog COM0 output for LCD.
RP33 I/O ST/DIG Remappable Peripheral Pin 33 input/output.
REFO1 O DIG Reference output clock.
RE3 I/O ST/DIG General purpose I/O pin.
AD12/COM1/RP32/RE4 95 76 62
AD12 I/O TTL/DIG External Memory Address/Data 12.
COM1 O Analog COM1 output for LCD.
RP32 I/O ST/DIG Remappable Peripheral Pin 32 input/output.
RE4 I/O ST/DIG General purpose I/O pin.
AD13/COM2/RP37/RE5 94 75 61
AD13 I/O TTL/DIG External Memory Address/Data 13.
COM2 O Analog COM2 output for LCD.
RP37 I/O ST/DIG Remappable Peripheral Pin 37 input/output.
RE5 I/O ST/DIG General purpose I/O pin.
AD14/COM3/RP34/RE6 93 74 60
AD14 I/O TTL/DIG External Memory Address/Data 14.
COM3 O Analog COM3 output for LCD.
RP34 I/O ST/DIG Remappable Peripheral Pin 34 input/output.
RE6 I/O ST/DIG General purpose I/O pin.
AD15/LCDBIAS0/RP31/RE7 92 73 59
AD15 I/O TTL/DIG External Memory Address/Data 15.
LCDBIAS0 I Analog BIAS0 input for LCD.
RP31 I/O ST/DIG Remappable Peripheral Pin 31 input/output.
RE7 I/O ST/DIG General purpose I/O pin.
Legend: TTL = TTL compatible input CMOS = CMOS compatible input or output
ST = Schmitt Trigger input with CMOS levels Analog = Analog input
I = Input O = Output
P = Power OD = Open-Drain (no P diode to VDD)
I2C = I2C/SMBus
SEG20/AN7/CTMUI/C2INB/RP36/ 23 18 16
RF2
SEG20 O Analog SEG20 output for LCD.
AN7 I Analog Analog Input 7.
CTMUI O — CTMU pulse generator charger for the C2INB comparator input.
C2INB I Analog Comparator 2 Input B.
RP36 I/O ST/DIG Remappable Peripheral Pin 36 input/output.
RF2 I/O ST/DIG General purpose I/O pin.
D-/RF3 22 17 15
D- I/O — USB bus minus line input/output.
RF3 I ST General purpose input pin.
D+/RF4 20 16 14
D+ I/O — USB bus plus line input/output.
RF4 I ST General purpose input pin.
SEG23/CVREF/AN10/C1INB/ 19 15 13
RP35/RF5
SEG23 O Analog SEG23 output for LCD.
CVREF O Analog Comparator reference voltage output.
AN10 I Analog Analog Input 10.
C1INB I Analog Comparator 1 Input B.
RP35 I/O ST/DIG Remappable Peripheral Pin 35 input/output.
RF5 I/O ST/DIG General purpose I/O pin.
SEG24/AN11/C1INA/RP40/RF6 18 14 12
SEG24 O Analog SEG24 output for LCD.
AN11 I Analog Analog Input 11.
C1INA I Analog Comparator 1 Input A.
RP40 I/O ST/DIG Remappable Peripheral Pin 40 input/output.
RF6 I/O ST/DIG General purpose I/O pin.
SEG25/AN5/RP38/RF7 17 13 11
SEG25 O Analog SEG25 output for LCD.
AN5 I Analog Analog Input 5.
RP38 I/O ST/DIG Remappable Peripheral Pin 38 input/output.
RF7 I/O ST/DIG General purpose I/O pin.
Legend: TTL = TTL compatible input CMOS = CMOS compatible input or output
ST = Schmitt Trigger input with CMOS levels Analog = Analog input
I = Input O = Output
P = Power OD = Open-Drain (no P diode to VDD)
I2C = I2C/SMBus
COM4/SEG28/AN8/RP46/RG0 6 5 3
COM4 O Analog COM4 output for LCD.
SEG28 O Analog SEG28 output for LCD.
AN8 I Analog Analog Input 8.
RP46 I/O ST/DIG Remappable Peripheral Pin 46 input/output.
RG0 I/O ST/DIG General purpose I/O pin.
COM5/SEG29/AN19/RP39/RG1 7 6 4
COM5 O Analog COM5 output for LCD.
SEG29 O Analog SEG29 output for LCD.
AN19 I Analog Analog Input 19.
RP39 I/O ST/DIG Remappable Peripheral Pin 39 input/output.
RG1 I/O ST/DIG General purpose I/O pin.
COM6/SEG30/AN18/C3INA/RP42/ 8 7 5
RG2
COM6 O Analog COM6 output for LCD.
SEG30 O Analog SEG30 output for LCD.
AN18 I Analog Analog Input 18.
C3INA I Analog Comparator 3 Input A.
RP42 I/O ST/DIG Remappable Peripheral Pin 42 input/output.
RG2 I/O ST/DIG General purpose I/O pin.
COM7/SEG31/AN17/C3INB/RP43/ 9 8 6
RG3
COM7 O Analog COM7 output for LCD.
SEG31 O Analog SEG31 output for LCD.
AN17 I Analog Analog Input 17.
C3INB I Analog Comparator 3 Input B.
RP43 I/O ST/DIG Remappable Peripheral Pin 43 input/output.
RG3 I/O ST/DIG General purpose I/O pin.
SEG26/AN16/C3INC/RP44/RTCC/ 12 10 8
RG4
SEG26 O Analog SEG26 output for LCD.
AN16 I Analog Analog Input 16.
C3INC I Analog Comparator 3 Input C.
RP44 I/O ST/DIG Remappable Peripheral Pin 44 input/output.
RTCC O — RTCC output.
RG4 I/O ST/DIG General purpose I/O pin.
A16/SEG47/AN23/RH0 99 79
A16 O DIG External Memory Address 16.
SEG47 O Analog SEG47 output for LCD.
AN23 I Analog Analog Input 23.
RH0 I/O ST/DIG General purpose I/O pin.
A17/SEG46/AN22/RH1 100 80
A17 O DIG External Memory Address 17.
SEG46 O Analog SEG46 output for LCD.
AN22 I Analog Analog Input 22.
RH1 I/O ST/DIG General purpose I/O pin.
A18/SEG45/AN21/RH2 1 1
A18 O DIG External Memory Address 18.
SEG45 O Analog SEG45 output for LCD.
AN21 I Analog Analog Input 21.
RH2 I/O ST/DIG General purpose I/O pin.
A19/SEG44/AN20/RH3 2 2
A19 O DIG External Memory Address 19.
SEG44 O Analog SEG44 output for LCD.
AN20 I Analog Analog Input 20.
RH3 I/O ST/DIG General purpose I/O pin.
SEG40/AN12/C2INC/RH4 27 22
SEG40 O Analog SEG40 output for LCD.
AN12 I Analog Analog Input12.
C2INC I Analog Comparator 2 Input C.
RH4 I/O ST/DIG General purpose I/O pin.
SEG41/AN13/C2IND/RH5 26 21
SEG41 O Analog SEG41 output for LCD.
AN13 I Analog Analog Input 13.
C2IND I Analog Comparator 2 Input D.
RH5 I/O ST/DIG General purpose I/O pin.
SEG42/AN14/C1INC/RH6 25 20
SEG42 O Analog SEG42 output for LCD.
AN14 I Analog Analog Input 14.
C1INC I Analog Comparator 1 Input C.
RH6 I/O ST/DIG General purpose I/O pin.
SEG43/AN15/RH7 24 19
SEG43 O Analog SEG43 output for LCD.
AN15 I Analog Analog Input 15.
RH7 I/O ST/DIG General purpose I/O pin.
Legend: TTL = TTL compatible input CMOS = CMOS compatible input or output
ST = Schmitt Trigger input with CMOS levels Analog = Analog input
I = Input O = Output
P = Power OD = Open-Drain (no P diode to VDD)
I2C = I2C/SMBus
ALE/SEG32/RJ0 77 62
ALE O DIG External memory address latch enable.
SEG32 O Analog SEG32 output for LCD.
RJ0 I/O ST/DIG General purpose I/O pin.
OE/SEG33/RJ1 76 61
OE O DIG External memory output enable.
SEG33 O Analog SEG33 output for LCD.
RJ1 I/O ST/DIG General purpose I/O pin.
WRL/SEG34/RJ2 75 60
WRL O DIG External memory write low control.
SEG34 O Analog SEG34 output for LCD.
RJ2 I/O ST/DIG General purpose I/O pin.
WRH/SEG35/RJ3 74 59
WRH O DIG External memory write high control.
SEG35 O Analog SEG35 output for LCD.
RJ3 I/O ST/DIG General purpose I/O pin.
BA0/SEG39/RJ4 49 39
BA0 O DIG External Memory Byte Address 0 control
SEG39 O Analog SEG39 output for LCD.
RJ4 I/O ST/DIG General purpose I/O pin.
CE/SEG38/RJ5 50 40
CE O DIG External memory chip enable control.
SEG38 O Analog SEG38 output for LCD.
RJ5 I/O ST/DIG General purpose I/O pin.
LB/SEG37/RJ6 51 41
LB O DIG External memory low byte control.
SEG37 O Analog SEG37 output for LCD.
RJ6 I/O ST/DIG General purpose I/O pin.
UB/SEG36/RJ7 52 42
UB O DIG External memory high byte control.
SEG36 O Analog SEG36 output for LCD.
RJ7 I/O ST/DIG General purpose I/O pin.
Legend: TTL = TTL compatible input CMOS = CMOS compatible input or output
ST = Schmitt Trigger input with CMOS levels Analog = Analog input
I = Input O = Output
P = Power OD = Open-Drain (no P diode to VDD)
I2C = I2C/SMBus
SEG56/RK0 46
SEG56 O Analog SEG56 output for LCD.
RK0 I/O ST/DIG General purpose I/O pin.
SEG57/RK1 55
SEG57 O Analog SEG57 output for LCD.
RK1 I/O ST/DIG General purpose I/O pin.
SEG58/RK2 60
SEG58 O Analog SEG58 output for LCD.
RK2 I/O ST/DIG General purpose I/O pin.
SEG59/RK3 63
SEG59 O Analog SEG59 output for LCD.
RK3 I/O ST/DIG General purpose I/O pin.
SEG60/RK4 66
SEG60 O Analog SEG60 output for LCD.
RK4 I/O ST/DIG General purpose I/O pin.
SEG61/RK5 71
SEG61 O Analog SEG61 output for LCD.
RK5 I/O ST/DIG General purpose I/O pin.
SEG62/RK6 80
SEG62 O Analog SEG62 output for LCD.
RK6 I/O ST/DIG General purpose I/O pin.
SEG63/RK7 85
SEG63 O Analog SEG63 output for LCD.
RK7 I/O ST/DIG General purpose I/O pin.
Legend: TTL = TTL compatible input CMOS = CMOS compatible input or output
ST = Schmitt Trigger input with CMOS levels Analog = Analog input
I = Input O = Output
P = Power OD = Open-Drain (no P diode to VDD)
I2C = I2C/SMBus
SEG48/RL0 91
SEG48 O Analog SEG48 output for LCD.
RL0 I/O ST/DIG General purpose I/O pin.
SEG49/RL1 10
SEG49 O Analog SEG49 output for LCD.
RL1 I/O ST/DIG General purpose I/O pin.
SEG50/RL2 13
SEG50 O Analog SEG50 output for LCD.
RL2 I/O ST/DIG General purpose I/O pin.
SEG51/RL3 16
SEG51 O Analog SEG51 output for LCD.
RL3 I/O ST/DIG General purpose I/O pin.
SEG52/RL4 21
SEG52 O Analog SEG52 output for LCD.
RL4 I/O ST/DIG General purpose I/O pin.
SEG53/RL5 30
SEG53 O Analog SEG53 output for LCD.
RL5 I/O ST/DIG General purpose I/O pin.
SEG54/RL6 38
SEG54 O Analog SEG54 output for LCD.
RL6 I/O ST/DIG General purpose I/O pin.
SEG55/RL7 41
SEG55 O Analog SEG55 output for LCD.
RL7 I/O ST/DIG General purpose I/O pin.
Legend: TTL = TTL compatible input CMOS = CMOS compatible input or output
ST = Schmitt Trigger input with CMOS levels Analog = Analog input
I = Input O = Output
P = Power OD = Open-Drain (no P diode to VDD)
I2C = I2C/SMBus
VBAT 29 24 18 P —
VUSB3V3 28 23 17 P — USB voltage input pin.
Legend: TTL = TTL compatible input CMOS = CMOS compatible input or output
ST = Schmitt Trigger input with CMOS levels Analog = Analog input
I = Input O = Output
P = Power OD = Open-Drain (no P diode to VDD)
I2C = I2C/SMBus
VDD
VSS
R1 (1)
microcontrollers requires attention to a minimal set of R2
device pin connection before proceeding with MCLR
development. VCAP/VDDCORE
C1
The following pins must always be connected: C7
PIC18FXXJXX
• All VDD and VSS pins
VDD
(see Section 2.2 “Power Supply Pins”) VSS
C6(2) C3(2)
• All AVDD and AVSS pins, regardless of whether or VSS
VDD
not the analog device features are used
AVDD
AVSS
VDD
VSS
(see Section 2.2 “Power Supply Pins”)
• MCLR pin
(see Section 2.3 “Master Clear (MCLR) Pin”)
C5(2) C4(2)
These pins must also be connected if they are being
used in the end application:
• PGC/PGD pins used for In-Circuit Serial Key (all values are recommendations):
Programming™ (ICSP™) and debugging purposes C1 through C6: 0.1 F, 20V ceramic
(see Section 2.5 “ICSP Pins”) C7: 10 F, 6.3V or greater, tantalum or ceramic
• OSC1 and OSC2 pins when an external oscillator R1: 10 kΩ
source is used
R2: 100Ω to 470Ω
(see Section 2.6 “External Oscillator Pins”)
Note 1: See Section 2.4 “Core Voltage Regulator
Additionally, the following pins may be required: (VCAP/VDDCORE)” for explanation of VCAP/
• VREF+/VREF- pins are used when external voltage VDDCORE connections.
reference for analog modules is implemented 2: The example shown is for a PIC18F device
with five VDD/VSS and AVDD/AVSS pairs.
Note: The AVDD and AVSS pins must always be Other devices may have more or less pairs;
connected, regardless of whether any of adjust the number of decoupling capacitors
the analog modules are being used. appropriately.
ESR ()
Capacitors with equivalent specification can be used. 0.1
.
TABLE 2-1: SUITABLE CAPACITOR EQUIVALENTS
Nominal
Make Part # Base Tolerance Rated Voltage Temp. Range
Capacitance
TDK C3216X7R1C106K 10 µF ±10% 16V -55 to 125ºC
TDK C3216X5R1C106K 10 µF ±10% 16V -55 to 85ºC
Panasonic ECJ-3YX1C106K 10 µF ±10% 16V -55 to 125ºC
Panasonic ECJ-4YB1C106K 10 µF ±10% 16V -55 to 85ºC
Murata GRM32DR71C106KA01L 10 µF ±10% 16V -55 to 125ºC
Murata GRM31CR61C106KC31L 10 µF ±10% 16V -55 to 85ºC
PIC18F97J94 Family
8 MHz
Postscaler
FRC OSCCON3<2:0>
Reference Active Clock FRC
from USB Tuning
D+/D- Control
500 kHz
FRCDIV 16
Secondary Oscillator
SOSC
SOSCO
SOSCEN
Enable
SOSCI Oscillator Clock Control Logic
Fail-Safe
Clock
Monitor
WDT, PWRT
TCY
FOSC
FCY
PC PC PC + 2 PC + 4
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 IOLOCK bit cannot be cleared once it has been set, provided that the IOL1WAY (CONFIG5H<0>) = 1.
2: If the user wants to change the clock source, ensure that the FSCM<1:0> bits (CONFIG3L<5:4>) are set
appropriately.
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 default FRC divide-by setting on an 8-bit device corresponds to 1 MIPS operation.
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-6 CPDIV<1:0>: USB System Clock Select bits (postscaler select from 64 MHz clock branch)
00 = Input clock/1
01 = Input clock/2
10 = Input clock/4
11 = Input clock/8
bit 5 PLLEN: PLL Enable bit
1 = PLL is enabled even though it is not requested by the CPU; provides ability to “warm-up” the PLL
and keep it running to avoid the PLL start-up time. This setting will force the PLL and associated
clock source to stay active in Sleep.
0 = PLL is disabled; PLL will be automatically turned on when SRC1 is selected, or when REFO1 or
REFO2 is enabled and using the PLL clock as its source. In either case, the PLL will require a
start-up time.
bit 4-0 Unimplemented: Read as ‘0’
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at all Resets ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
The module provides the ability to select one of the The Reference Clock Output is synchronized with the
following clock sources: Sleep signal to avoid any glitches on its output.
Note 1: This bit has no effect when ROSEL<3:0> = 0000/0001, as the system clock and peripheral clock are
always disabled in Sleep mode on PIC18 devices.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at all Resets ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: The ROSEL register field should not be written while the ACTIVE (REFOxCON<0>) bit is ‘1’; undefined
behavior will result.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at all Resets ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: The RODIV register field should not be written while the ACTIVE (REFOxCON<0>) bit is ‘1’; Undefined
behavior will result.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at all Resets ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: The RODIV register field should not be written while the ACTIVE (REFOxCON<0>) bit is ‘1’; undefined
behavior will result.
The POSCMDx and FOSCx Configuration bits (CON- the internal PLL. The PIC18F operates from the
FIG3L<1:0> and CONFIG2L<2:0>, respectively) select Primary Oscillator whenever the COSCx bits
the operating mode of the Primary Oscillator. The (OSCCON<6:4>) are set to ‘010’ or ‘011’.
POSCMD<1:0> bits select the particular submode to Refer to the “Electrical Characteristics” section in
be used (MS, HS or EC), while the FOSC<2:0> bits the specific device data sheet for further information
determine if the oscillator will be used by itself or with regarding frequency range for each crystal mode.
To Internal Logic
OSC1
C1(3)
XTAL Sleep
RF(2)
OSC2
RS(1)
(3)
C2
PIC18F
Note 1: A series resistor, Rs, may be required for AT strip cut crystals.
2: The internal feedback resistor, RF, is typically in the range of 2 to 10 M
3: See Section 3.6.5 “Determining the Best Values for Oscillator Components”.
VIH
Voltage
VIL
0V
Crystal Start-up Time
Time
FRCDIV
POSC ÷6
0101
÷5 CPDIV<1:0>
Input from ÷4
0100
FRC ÷3
0011 Graphics Clock
0010
4 MHz or ÷2
8 MHz ÷1
0001 ÷2
0000 Graphics Clock
48 MHz Branch Option 2
4 MHz Branch
÷64
÷63 127 Clock Output for
96 MHz 96 MHz Branch 126 Display Interface
...
PLL ... (DISPCLK)
Postsclaer
÷17.50
G1CLKSEL 65
÷17.00
64
...
...
÷1.25 1
0
System Clock
Note: The system clock can be any selected source (Primary, Secondary, FRC or LPRC).
ACTSRC ACTEN
FSUSB_clk 1 Enable
ACT_clk 8 MHz
Active Internal OSC
SOSC_clk 0
Clock
Tuning
Module ACT data sfr data
7 7
Write
OSCTUNE<6:0> OSCTUNE
ACTUD
ACTEN
ACTEN
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
PIC18F97J94 FAMILY
Exit Conditions
Active Systems
Interrupts Resets
RTCC Alarm
VDD Restore
(DS)WDT(3)
Peripherals
Mode Entry
DSGPRx(2)
Data RAM
INT0 Only
Retention
Code Execution
RTCC(1)
MCLR
Core
POR
Resumes
All
All
Run (default) N/A Y Y Y Y Y N/A N/A N/A N/A N/A N/A N/A N/A N/A
Idle Instruction N Y Y Y Y Y Y Y Y Y Y Y N/A Next Instruction
Sleep modes:
Sleep Instruction N N(4) Y Y Y Y Y Y Y Y Y Y N/A Next Instruction
(4)
Retention Instruction + N N Y Y Y Y Y Y Y Y Y Y N/A
Sleep RETEN bit
Deep Sleep modes:
Retention Instruction + N N Y Y Y N Y N Y Y Y Y N/A Next Instruction
Deep Sleep DSEN bit +
RETEN bit
Deep Sleep Instruction + N N N Y Y N Y N Y Y Y Y N/A Reset Vector
DSEN bit
VBAT:
with RTCC Hardware N N N Y Y N N N N N N N Y Reset Vector
w/o RTCC Hardware + N N N N Y N N N N N N N Y
by disabling the
RTCC PMD bit
Note 1: If RTCC is otherwise enabled in firmware.
2: Data retention in the DSGPR0, DSGPR1, DSGPR2 and DSGPR3 registers.
3: Deep Sleep WDT in Deep Sleep modes; WDT in all other modes.
2012-2016 Microchip Technology Inc.
4: Some select peripherals may continue to operate in this mode, using either the LPRC or an external clock source.
PIC18F97J94 FAMILY
4.2 Instruction-Based Power-Saving The instruction-based power-saving modes are exited
Modes as a result of several different hardware triggers. When
the device exits one of these three operating modes, it
PIC18F97J94 Family devices have three instruction- is said to ‘wake-up’. The characteristics of the power-
based power-saving modes; two of these have addi- saving modes are described in the subsequent sec-
tional features that allow for additional tailoring of power tions.
consumption. All three modes are entered through the
execution of the SLEEP instruction. In descending order 4.2.1 INTERRUPTS COINCIDENT WITH
of power consumption, they are: POWER SAVE INSTRUCTIONS
• Idle Mode: The CPU is disabled, but the system Any interrupt that coincides with the execution of a
clock source continues to operate. Peripherals SLEEP instruction will be held off until entry into Sleep,
continue to operate, but can optionally be Idle or Deep Sleep mode is completed. The device will
disabled. then wake-up from the power-managed mode.
• Sleep Modes: The CPU, system clock source and Interrupts that occur during the Deep Sleep unlock
any peripherals that operate on the system clock sequence will interrupt the mandatory unlock sequence
source are disabled. and cause a failure to enter Deep Sleep. For this
• Deep Sleep Modes: The CPU system clock reason, it is recommended to disable all interrupts
source, and all the peripherals except RTCC and during the Deep Sleep unlock sequence.
DSWDT are disabled. This is the lowest power
mode for the device. The power to RAM and 4.2.2 RETENTION REGULATOR
Flash is also disabled. Deep Sleep modes A second on-chip voltage regulator is used for power
represent the lowest power modes available management in Sleep and Deep Sleep modes. This
without removing power from the application. regulator, also known as the retention regulator, sup-
Idle and Sleep modes are entered directly with the plies core logic and other circuits with power at a lower
SLEEP statement. Having IDLEN (OSCCON<7>) set VCORE level, about 1.2V nominal. Running these
prior to the SLEEP statement will put the device into Idle circuits at a lower voltage allows for an additional
mode. For Deep Sleep mode, it is necessary to set the incremental power saving over the normal minimum
DSEN bit (DSCONH<7>). To prevent inadvertent entry VCORE level.
into Deep Sleep mode, and possible loss of data, the In Retention Sleep modes, using the regulator main-
DSEN bit must be written to twice. The write need not tains the entire data RAM and its contents, instead of
be consecutive instructions; however, it is a better just a few protected registers. This allows the device to
practice to write both, one after the other. It is also exit a power-saving mode and resume code execution
recommended to clear the DSCON1 register before as its previous state.
setting the DSEN bit (Example 4-1).
The retention regulator is controlled by the Configuration
Note: SLEEP_MODE and IDLE_MODE are con- bit, RETEN (CONFIG7L<0>), and the SRETEN bit
stants defined in the Assembler Include (RCON4<4>). The RETEN bit makes the retention
file for the selected device. regulator available for software control. By default
(RETEN = 1), the regulator is disabled and the SRETEN
EXAMPLE 4-1: SLEEP ASSEMBLY bit has no effect. Programming RETEN (= 0) allows the
SYNTAX SRETEN bit to control the regulator’s operation, leaving
its use in power-saving modes at the user’s discretion.
clrf DSCON1
Setting the SRETEN bit prior to executing the SLEEP
clrf DSCON1
instruction puts the device into Retention Sleep mode.
bsf DSCON1,7
If the DSEN bit was also unlocked and set prior to the
bsf DSCON1,7
instruction, the device will enter Retention Deep Sleep
sleep
mode.
or
The retention regulator is not available outside of
movlw 0x80 Sleep, Deep Sleep or VBAT modes. Enabling it while
movwf DSCON1 the device is operating in Run or Idle modes does not
movwf DSCON1 allow the device to operate at a lower level of VCORE.
sleep
4.3 Clock Source Considerations TABLE 4-2: BIT SETTINGS FOR ALL
SLEEP MODES
When the device wakes up from either of the Sleep
Retention Regulator
modes, it will restart the same clock source that was DSEN
active when Sleep mode was entered. Wake-up delays Mode RETEN SRETEN
DSCONH<7> State
for the different oscillator modes are shown in Table 4- CONFIG7L<0> RCON4<4>
3 and Table 4-4, respectively. Sleep x 1 x Disabled
If the system clock source is derived from a crystal oscil- x 0 0 Disabled
lator and/or the PLL, the Oscillator Start-up Timer (OST) Retention x 0 1 Enabled
and/or PLL lock times must be applied before the system Sleep
clock source is made available to the device. As an
exception to this rule, no oscillator delays are necessary 4.3.6 WAKE-UP DELAYS
if the system clock source is the Secondary Oscillator The restart delay, associated with waking up from
and it was running while in Sleep mode. Sleep and Retention Sleep modes, parallel each other
in terms of clock start-up times. They differ in the time
4.3.1 SLOW OSCILLATOR START-UP
it takes to switch over from their respective regulators.
The OST and PLL lock times may not have expired The delays for the different oscillator modes are shown
when the power-up delays have expired. in Table 4-3 and Table 4-4, respectively.
To avoid this condition, one can enable Two-Speed
Start-up by the device that will run on FRC until the
clock source is stable. Once the clock source is stable,
the device will switch to the selected clock source.
TABLE 4-4: DELAY TIMES FOR EXITING FROM RETENTION SLEEP MODE
Clock Source Exit Delay Oscillator Delay Notes
EC TRETR + TPM — 1, 2
ECPLL TRETR + TPM TLOCK 1, 2, 4
MS, HS TRETR + TPM TOST 1, 2, 3
MSPLL, HSPLL TRETR + TPM TOST + TLOCK 1, 2, 3, 4
SOSC (Off during Sleep) TRETR + TPM TOST 1, 2, 3
(On during Sleep) TRETR + TPM — 1, 2
FRC, FRCDIV TRETR + TPM TFRC 1, 2, 5
LPRC (Off during Sleep) TRETR + TPM TLPRC 1, 2, 5
(On during Sleep) TRETR + TPM — 1, 2
FRCPLL TRETR + TPM TLOCK 1, 2, 4
Note 1: TRETR = Retention regulator start-up delay.
2: TPM = Start-up delay for program memory stabilization; applicable only when IPEN (RCON<7>) = 0.
3: TOST = Oscillator Start-up Timer; a delay of 1024 oscillator periods before the oscillator clock is released to
the system.
4: TLOCK = PLL lock time.
5: TFRC and TLPRC are RC Oscillator start-up times.
Entering Deep Sleep mode clears the Deep Sleep After waking from Deep Sleep mode, the device per-
Wake-up Source Registers (DSWAKEL and forms a POR. When the device is released from Reset,
DSWAKEH). If enabled, the Real-Time Clock and code execution will begin at the device’s Reset vector.
Calendar (RTCC) continues to operate uninterrupted. The software can determine if the wake-up was caused
When a wake-up event occurs in Deep Sleep mode (by from an exit from Deep Sleep mode by reading the
Reset, RTCC alarm, External Interrupt (INT0) or DPSLP bit (RCON4<2>). If this bit is set, the POR was
DSWDT), the device will exit Deep Sleep mode and re- caused by a Deep Sleep exit. The DPSLP bit must be
arm a Power-on Reset (POR). When the device is manually cleared by the software.
released from Reset, code execution will resume at the The software can determine the wake-up event source
Reset vector. by reading the DSWAKE registers. These registers are
cleared automatically when entering Deep Sleep
4.4.1 RETENTION DEEP SLEEP MODE mode, so software should read these registers after
In Retention Deep Sleep, the retention regulator is exiting Deep Sleep mode or before re-enabling this
enabled, which allows the data RAM to retain data mode.
while all other systems are powered down. This also
allows the device to return to code execution where it 4.4.4 CLOCK SELECTION ON WAKE-UP
left off, instead of going through a POR-like Reset. FROM DEEP SLEEP MODE
As a trade-off, Retention Deep Sleep mode has greater For Deep Sleep mode, the processor will restart with
power consumption than Deep Sleep. However, it the default oscillator source, selected with the FOSCx
offers the lowest level of power consumption of the Configuration bits. On wake-up from Deep Sleep, a
power-saving modes that still allows a direct return to POR is generated internally, hence, the system resets
code execution. to its POR state with the exception of the RCONx,
DSCONH/L and DSGPRx registers.
Retention Deep Sleep is controlled by the SRETEN bit
(RCON4<4>) and the RETEN Configuration bit, as For Retention Deep Sleep, the processor restarts with
described in Section 4.2.2 “Retention Regulator”. the same clock source that was selected before enter-
ing Retention Deep Sleep mode. Wake-up is similar to
that of Sleep and Retention Sleep modes.
4.4.11 WAKE-UP DELAYS Note: The PMSLP bit (RCON4<0>) allows the
The Reset delays associated with wake-up from Deep voltage regulator to be maintained during
Sleep and Retention Deep Sleep modes, in different Sleep modes.
oscillator modes, are provided in Table 4-6 and
Table 4-7, respectively.
TABLE 4-6: DELAY TIMES FOR EXITING FROM DEEP SLEEP MODE
Clock Source Exit Delay Oscillator Delay Notes
EC TDSWU —
ECPLL TDSWU TLOCK 1, 3
MS, HS TDSWU TOST 1, 2
MSPLL, HSPLL TDSWU TOST + TLOCK 1, 2, 3
SOSC (Off during Sleep) TDSWU TOST 1, 2
(On during Sleep) TDSWU — 1
FRC, FRCDIV TDSWU TFRC 1, 4
LPRC (Off during Sleep) TDSWU TLPRC 1, 4
(On during Sleep) TDSWU — 1
FRCPLL TDSWU TFRC + TLOCK 1, 3, 4
Note 1: TDSWU = Deep Sleep wake-up delay.
2: TOST = Oscillator Start-up Timer; a delay of 1024 oscillator periods before the oscillator clock is released to
the system.
3: TLOCK = PLL lock time.
4: TFRC and TLPRC are RC Oscillator start-up times.
Core
VBAT
Power Retention 1.2V DSGPRx
Switch Regulator Registers
VDD
Back-up
Battery Peripherals
VSS
RTCC
Note 1: In order to enter Deep Sleep, DSEN must be written to in two separate operations. The write operations
do not need to be consecutive. Before writing DSEN, the DSCON1 register should be cleared twice.
2: This is the value when VDD is initially applied.
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 be set in software, all bits in DSWAKE must be written to twice. The write operations do not need to be
consecutive.
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
RESET
Instruction
External Reset
MCLRE
MCLR
Idle
Sleep
WDT
Time-out
OST/PWRT
OST 1024 Cycles
Internal Reset
10-Bit Ripple Counter R Q
OSC1
32 s PWRT 1 ms
INTOSC(1) 11-Bit Ripple Counter
Enable PWRT
Enable OST(2)
Note 1: This is the INTOSC source from the internal oscillator block and is separate from the RC Oscillator of the CLKI pin.
2: See Table 5-1 for time-out situations.
Note 1: Brown-out Reset is said to have occurred when BOR is ‘0’ and POR is ‘1’ (assuming that POR was set to
‘1’ by software immediately after a Power-on Reset).
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 VPOR
POR
TCSD
POR Circuit is Initialized at VPOR
TPWRT
(Note 1)
INTERNAL RESET
Time
Note 1: Timer and interval are determined by the initial start-up oscillator configuration; TOSC is for external
oscillator modes, TFRC is for the FRC Oscillator or TLPRC for the internal 31 kHz RC Oscillator.
In PIC18FXXJXX Flash devices, device Configuration All four BOR circuits monitor a voltage and put the
registers (located in the configuration memory space) device in a Reset condition while the voltage is in a
are continuously monitored during operation by compar- specified region. SFRs will reset to the BOR state,
ing their values to complimentary shadow registers. If a including the Deep Sleep semaphore holding registers,
mismatch is detected between the two sets of registers, DSGPR0 and DSGPR1. Upon BOR exit, the device
a CM Reset automatically occurs. These events are remains in Reset until the associated trip point voltage
captured by the CM bit (RCON<5>) being set to ‘0’. is exceeded. Any I/O pins configured as outputs will be
tri-stated. BOR, VDDBOR and DSBOR exit into Run
This bit does not change for any other Reset event. A mode; VBATBOR remains in VBAT mode.
CM Reset behaves similarly to a Master Clear Reset,
RESET instruction, WDT Time-out Reset or Stack Event These features differ by their power mode, monitored
Reset. As with all hard and power Reset events, the voltage source, trip points, control and status. Refer to
device’s Configuration Words are reloaded from the Table 5-1 for the PIC18F97J94 BOR differences.
Flash Configuration Words in program memory as the
device restarts.
TABLE 5-1: BOR FEATURE SUMMARY(1)
Feature Mode Source Trip Points Enable
BOR Run, Idle, Sleep VDDCORE 1.6V (typ) Always Enabled
VDDBOR Run, Idle, Sleep VDD VVDDBOR BOREN (CONFIG1H<0>)
VBATBOR VBAT VBAT VVBATBOR VBTBOR (CONFIG7L<2>)
DSBOR Deep Sleep VDD VDSBOR DSBOREN (CONFIG7L<3>)
Note 1: Refer to Table for details.
VBPOR(4,6)
VDDBOR
VDDPOR
VBAT(4)
DPSLP
EXTR
IDLE
BOR
POR
CM
PC
PD
TO
Conditions
RI
DSPOR:(4) 000000 0 0 0 0 1 0 0 1 1 1 1 1 0
Loss of VDDBAT
VBAT:(4) 000000 1 0 0 0 1 0 0 1 1 1 1 u 1
Loss of VDD While VBAT is Established
VDD POR: 000000 0 0 0 0 1 0 0 1 1 1 1 u u
Loss of VDD
VDD BOR: 000000 u u 0 0 1 0 0 u u 1 u u u
Brown-out of VDD
POR: 000000 0 0 0 0 1 0 0 1 1 u u u u
Loss of VDDCORE
BOR 000000 u u 0 0 1 0 0 1 u u u u u
Brown-out of VDDCORE
Deep Sleep Exit 000000 1 0 0 0 1 0 0 1 1 u u u u
Retention Deep Sleep Exit 000000 1 0 0 0 1 0 0 0 0 u u u u
MCLR Reset 000000 u 1 u u u u u u u u u u u
Operational Mode
MCLR Reset in Idle Mode 000000 u 1 u 0(1) 0(2) 1(2) u u u u u u u
(1) (2)
MCLR Reset in Sleep Mode 000000 u 1 u 0 0 0(2) u u u u u u u
RESET Instruction Reset 000000 u u 1 u u u u u u u u u u
Configuration Mismatch Reset 000000 u u u u u u 1 u u u u u u
WDT Reset 000000 u u u 1 u u u u u u u u u
WDT Reset in Idle Mode PC + 2 u u u 1 1(2) 1(2) u u u u u u u
WDT Reset in Sleep Mode PC + 2 u u u 1 (2) (2) u u u u u u u
0 0
(2) (2)
Interrupt in Idle Mode PC + 2 u u u 0(1) 1 1 u u u u u u u
with GIE = 0
Interrupt in Idle Mode Vector u u u 0(1) 1(2) 1(2) u u u u u u u
with GIE = 1
Interrupt in Sleep Mode PC + 2 u u u 0(1) 0(2) 0(2) u u u u u u u
With GIE = 0
Interrupt in Sleep Mode Vector u u u 0(1) 0(2) 0(2) u u u u u u u
with GIE = 1
CLRWDT Instruction PC + 2 u u u 0(3) 1 u u u u u u u u
IDLE Instruction PC + 2 u u u 0 1 1 u u u u u u u
SLEEP Instruction PC + 2 u u u 0 0 0 u u u u u u u
User Instruction Writes ‘1’ PC + 2 u 1 1 1 0 1 1 1 1 1 1 1 1
User Instruction Writes ‘0’ PC + 2 0 0 0 0 1 0 0 0 0 0 0 0 0
Note 1: The SLEEP instruction clears the WDTO bit.
2: The CLRWDT clears the WDTO bit only when the WDT window feature is disabled or the WDT is in the safe window.
3: This bit is also set, flagging the loss of state retention even though the true POR condition has not occurred.
4: This bit is set in hardware only; it can only be cleared in software.
5: Indicates a VDD POR. Setting the POR bit (RCON<0>) indicates a VCORE POR.
6: This bit is set when the device is originally powered up, even if power is present on VBAT.
Config Words
007FFFh
Config Words
00FFFFh
1FFFFFh
Note: Sizes of memory areas are not to scale. Sizes of program memory areas are enhanced to show detail.
00011
Top-of-Stack 001A34h 00010
000D58h 00001
00000
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
OSC1
Q1
Q2 Internal
Phase
Q3 Clock
Q4
PC PC PC + 2 PC + 4
OSC2/CLKO
(RC mode)
Execute INST (PC – 2)
Fetch INST (PC) Execute INST (PC)
Fetch INST (PC + 2) Execute INST (PC + 2)
Fetch INST (PC + 4)
All instructions are single cycle, except for any program branches. These take two cycles since the fetch instruction
is “flushed” from the pipeline while the new instruction is being fetched and then executed.
6.2.4 TWO-WORD INSTRUCTIONS used by the instruction sequence. If the first word is
skipped, for some reason, and the second word is
The standard PIC18 instruction set has four, two-word
executed by itself, a NOP is executed instead. This is
instructions: CALL, MOVFF, GOTO and LSFR. In all
necessary for cases when the two-word instruction is
cases, the second word of the instructions always has
preceded by a conditional instruction that changes the
‘1111’ as its four Most Significant bits. The other 12 bits
PC. Example 6-4 shows how this works.
are literal data, usually a data memory address.
The use of ‘1111’ in the 4 MSbs of an instruction Note: For information on two-word instructions
specifies a special form of NOP. If the instruction is in the extended instruction set, see
executed in proper sequence, immediately after the Section 6.5 “Program Memory and the
first word, the data in the second word is accessed and Extended Instruction Set”.
Note 1: Addresses, DFAh through F5Fh, are also SFRs, but are not part of the Access RAM. Users must always use
the complete address, or load the proper BSR value, to access these registers.
Bank 3
through
Bank 13
FFh
E00h
00h
Bank 14
F00h FFh
00h
Bank 15
FFFh FFh
Note 1: The Access RAM bit of the instruction can be used to force an override of the selected bank (BSR<3:0>)
to the registers of the Access Bank.
2: The MOVFF instruction embeds the entire 12-bit address in the instruction.
6.3.2 ACCESS BANK Using this “forced” addressing allows the instruction to
operate on a data address in a single cycle without
While the use of the BSR, with an embedded 8-bit
updating the BSR first. For 8-bit addresses of 60h and
address, allows users to address the entire range of data
above, this means that users can evaluate and operate
memory, it also means that the user must ensure that the
on SFRs more efficiently. The Access RAM below 60h
correct bank is selected. If not, data may be read from,
is a good place for data values that the user might need
or written to, the wrong location. This can be disastrous
to access rapidly, such as immediate computational
if a GPR is the intended target of an operation, but an
results or common program variables.
SFR is written to instead. Verifying and/or changing the
BSR for each read or write to data memory can become Access RAM also allows for faster and more code
very inefficient. efficient context saving and switching of variables.
To streamline access for the most commonly used data The mapping of the Access Bank is slightly different
memory locations, the data memory is configured with when the extended instruction set is enabled (XINST
an Access Bank, which allows users to access a Configuration bit = 1). This is discussed in more detail
mapped block of memory without specifying a BSR. in Section 6.6.3 “Mapping the Access Bank in
The Access Bank consists of the first 96 bytes of Indexed Literal Offset Mode”.
memory (00h-5Fh) in Bank 0 and the last 160 bytes of
memory (60h-FFh) in Bank 15. The lower half is known 6.3.3 GENERAL PURPOSE
as the “Access RAM” and is composed of GPRs. The REGISTER FILE
upper half is where the device’s SFRs are mapped. PIC18 devices may have banked memory in the GPR
These two areas are mapped contiguously in the area. This is data RAM which is available for use by all
Access Bank and can be addressed in a linear fashion instructions. GPRs start at the bottom of Bank 0
by an 8-bit address (Figure 6-6). (address 000h) and grow upwards towards the bottom of
The Access Bank is used by core PIC18 instructions the SFR area. GPRs are not initialized by a Power-on
that include the Access RAM bit (the ‘a’ parameter in Reset and are unchanged on all other Resets.
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 is forced to use the Access
Bank address map. In that case, the current value of
the BSR is ignored entirely.
F69h SSP1CON3 ACKTIM PCIE SCIE BOEN SDAHT SBCDE AHEN DHEN
F68h SSP1MSK MSK7 MSK6 MSK5 MSK4 MSK3 MSK2 MSK1 MSK0
F67h BAUDCON1 ABDOVF RCIDL RXDTP TXCKP BRG16 IREN WUE ABDEN
F66h OSCCON2 CLKLOCK IOLOCK LOCK — CF POSCEN SOSCGO —
F65h OSCCON3 — — — — — IRCF2 IRCF1 IRCF0
F64h OSCCON4 CPDIV1 CPDIV0 PLLEN — — — — —
F63h ACTCON ACTEN — ACTSIDL ACTSRC ACTLOCK ACTLOCKPOL ACTORS ACTORSPOL
F62h WPUB WPUB7 WPUB6 WPUB5 WPUB4 WPUB3 WPUB2 WPUB1 WPUB0
F61h PIE6 RC4IE TX4IE RC3IE TX3IE — CMP3IE CMP2IE CMP1IE
F60h DMACON1 SSCON1 SSCON0 TXINC RXINC DUPLEX1 DUPLEX0 DLYINTEN DMAEN
F5Fh RTCCON1 RTCEN — RTCWREN RTCSYNC HALFSEC RTCOE RTCPTR1 RTCPTR0
F5Eh RTCCAL CAL7 CAL6 CAL5 CAL4 CAL3 CAL2 CAL1 CAL0
F5Dh RTCVALH RTCC Value High Register Window Based on RTCPTR<1:0>
F5Ch RTCVALL RTCC Value Low Register Window Based on RTCPTR<1:0>
F5Bh ALRMCFG ALRMEN CHIME AMASK3 AMASK2 AMASK1 AMASK0 ALRMPTR1 ALRMPTR0
F5Ah ALRMRPT ARPT7 ARPT6 ARPT5 ARPT4 ARPT3 ARPT2 ARPT1 ARPT0
F59h ALRMVALH Alarm Value High Register Window Based on APTR<1:0>
F58h ALRMVALL Alarm Value Low Register Window Based on APTR<1:0>
F57h RTCCON2 PWCEN PWCPOL PWCCPRE PWCSPRE RTCCLKSEL1 RTCCLKSEL0 RTCSECSEL1 RTCSECSEL0
F56h IOCP IOCP7 IOCP6 IOCP5 IOCP4 IOCP3 IOCP2 IOCP1 IOCP0
F55h IOCN IOCN7 IOCN6 IOCN5 IOCN4 IOCN3 IOCN2 IOCN1 IOCN0
F54h PADCFG1 RDPU REPU RFPU RGPU RHPU RJPU RKPU RLPU
F53h CM1CON CON COE CPOL EVPOL1 EVPOL0 CREF CCH1 CCH0
F52h ECCP2AS ECCP2ASE ECCP2AS2 ECCP2AS1 ECCP2AS0 PSS2AC1 PSS2AC0 PSS2BD1 PSS2BD0
F51h ECCP2DEL P2RSEN P2DC6 P2DC5 P2DC4 P2DC3 P2DC2 P2DC1 P2DC0
F50h CCPR2H Capture/Compare/PWM Register 1 High Byte
F4Fh CCPR2L Capture/Compare/PWM Register 1 Low Byte
F4Eh CCP2CON P2M1 P2M0 CCP2X CCP2Y CCP2M3 CCP2M2 CCP2M1 CCP2M0
F4Dh ECCP3AS ECCP3ASE ECCP3AS2 ECCP3AS1 ECCP3AS0 PSS3AC1 PSS3AC0 PSS3BD1 PSS3BD0
F4Ch ECCP3DEL P3RSEN P3DC6 P3DC5 P3DC4 P3DC3 P3DC2 P3DC1 P3DC0
F4Bh CCPR3H Capture/Compare/PWM Register 1 High Byte
F4Ah CCPR3L Capture/Compare/PWM Register 1 Low Byte
F49H CCP3CON P3M1 P3M0 CCP3X CCP3Y CCP3M3 CCP3M2 CCP3M1 CCP3M0
F48h CCPR8H Capture/Compare/PWM Register 8 High Byte
F47h CCPR8L Capture/Compare/PWM Register 8 Low Byte
F46h CCP8CON — — CCP8X CCP8Y CCP8M3 CCP8M2 CCP8M1 CCP8M0
F45h CCPR9H Capture/Compare/PWM Register 9 High Byte
F44h CCPR9L Capture/Compare/PWM Register 9 Low Byte
F43h CCP9CON — — CCP9X CCP9Y CCP9M3 CCP9M2 CCP9M1 CCP9M0
F42h CCPR10H Capture/Compare/PWM Register 10 High Byte
F41h CCPR10L Capture/Compare/PWM Register 10 Low Byte
F40h CCP10CON — — CCP10X CCP10Y CCP10M3 CCP10M2 CCP10M1 CCP10M0
F3Fh TMR6 Timer6 Register
F3Eh PR6 Timer6 Period Register
F3Dh T6CON — T6OUTPS3 T6OUTPS2 T6OUTPS1 T6OUTPS0 TMR6ON T6CKPS1 T6CKPS0
F3Ch TMR8 Timer8 Register
F3Bh PR8 Timer8 Period Register
F3Ah T8CON — T8OUTPS3 T8OUTPS2 T8OUTPS1 T8OUTPS0 TMR8ON T8CKPS1 T8CKPS0
F39H SSP2CON3 ACKTIM PCIE SCIE BOEN SDAHT SBCDE AHEN DHEN
F38h CM2CON CON COE CPOL EVPOL1 EVPOL0 CREF CCH1 CCH0
F37h CM3CON CON COE CPOL EVPOL1 EVPOL0 CREF CCH1 CCH0
Legend: — = unimplemented, read as ‘0’.
F36h CCPTMRS0 C3TSEL1 C3TSEL0 C2TSEL2 C2TSEL1 C2TSEL0 C1TSEL2 C1TSEL1 C1TSEL0
F35h CCPTMRS1 C7TSEL1 C7TSEL0 — C6TSEL0 — C5TSEL0 C4TSEL1 C4TSEL0
F34h CCPTMRS2 — — — C10TSEL0 — C9TSEL0 C8TSEL1 C8TSEL0
F33h RCSTA2 SPEN RX9 SREN CREN ADDEN FERR OERR RX9D
F32h TXSTA2 CSRC TX9 TXEN SYNC SENDB BRGH TRMT TX9D
F31h BAUDCON2 ABDOVF RCIDL RXDTP TXCKP BRG16 IREN WUE ABDEN
F30h SPBRGH1 EUSART1 Baud Rate Generator High Byte
F2Fh RCSTA3 SPEN RX9 SREN CREN ADDEN FERR OERR RX9D
F2Eh TXSTA3 CSRC TX9 TXEN SYNC SENDB BRGH TRMT TX9D
F2Dh BAUDCON3 ABDOVF RCIDL RXDTP TXCKP BRG16 IREN WUE ABDEN
F2Ch SPBRGH3 EUSART3 Baud Rate Generator High Byte
F2Bh SPBRG3 EUSART3 Baud Rate Generator
F2Ah RCREG3 EUSART3 Receive Data FIFO
F29H TXREG3 EUSART3 Transmit Data FIFO
F28h DSCONL — — — — — ULPWDIS DSBOR RELEASE
F27h DSCONH DSEN — — — — — — RTCWDIS
F26h DSWAKEL DSFLT BOR DSULP DSWDT DSRTC DSMCLR DSICD DSPOR
F25h DSWAKEH — — — — — — — DSINT0
F24h DSGPR0 Deep Sleep General Purpose Register 0
F23h DSGPR1 Deep Sleep General Purpose Register 1
F22h DSGPR2 Deep Sleep General Purpose Register 2
F21h DSGPR3 Deep Sleep General Purpose Register 3
F20h SPBRGH2 EUSART2 Baud Rate Generator High Byte
F1Fh SPBRG2 EUSART2 Baud Rate Generator
F1Eh RCREG2 Receive Data FIFO
F1Dh TXREG2 Transmit Data FIFO
F1Ch PSTR2CON CMPL1 CMPL0 — STRSYNC STRD STRC STRB STRA
F1Bh PSTR3CON CMPL1 CMPL0 — STRSYNC STRD STRC STRB STRA
F1Ah SSP2STAT SMP CKE D/A P S R/W UA BF
F19h SSP2CON1 WCOL SSPOV SSPEN CKP SSPM3 SSPM2 SSPM1 SSPM0
F18h SSP2CON2 GCEN ACKSTAT ACKDT ACKEN RCEN PEN RSEN SEN
F17h SSP2MSK MSK7 MSK6 MSK5 MSK4 MSK3 MSK2 MSK1 MSK0
F16h TMR5H Timer5 Register High Byte
F15h TMR5L Timer5 Register Low Byte
F14h T5CON TMR5CS1 TMR5CS0 T5CKPS1 T5CKPS0 SOSCEN T5SYNC RD16 TMR5ON
F13h T5GCON TMR5GE T5GPOL T5GTM T5GSPM T5GGO/T5DONE T5GVAL T5GSS1 T5GSS0
F12h CCPR4H Capture/Compare/PWM Register 4 High Byte
F11h CCPR4L Capture/Compare/PWM Register 4 Low Byte
F10h CCP4CON — — DC4B1 DC4B0 CCP4M3 CCP4M2 CCP4M1 CCP4M0
F0Fh CCPR5H Capture/Compare/PWM Register 5 High Byte
F0Eh CCPR5L Capture/Compare/PWM Register 5 Low Byte
F0Dh CCP5CON — — DC5B1 DC5B0 CCP5M3 CCP5M2 CCP5M1 CCP5M0
F0Ch CCPR6H Capture/Compare/PWM Register 6 High Byte
F0Bh CCPR6L Capture/Compare/PWM Register 6 Low Byte
F0Ah CCP6CON — — DC6B1 DC6B0 CCP6M3 CCP6M2 CCP6M1 CCP6M0
F09h CCPR7H Capture/Compare/PWM Register 7 High Byte
F08h CCPR7L Capture/Compare/PWM Register 7 Low Byte
F07h CCP7CON — — DC7B1 DC7B0 CCP7M3 CCP7M2 CCP7M1 CCP7M0
F06h TMR4 Timer4 Register
F05h PR4 Timer4 Period Register
F04h T4CON — T4OUTPS3 T4OUTPS2 T4OUTPS1 T4OUTPS0 TMR4ON T4CKPS1 T4CKPS0
Legend: — = unimplemented, read as ‘0’.
ECFh LCDSE1 SE15 SE14 SE13 SE12 SE11 SE10 SE09 SE08
ECEh LCDSE0 SE07 SE06 SE05 SE04 SE03 SE02 SE01 SE00
ECDh LCDDATA63 S63C7 S62C7 S61C7 S60C7 S59C7 S58C7 S57C7 S56C7
ECCh LCDDATA62 S55C7 S54C7 S53C7 S52C7 S51C7 S50C7 S49C7 S48C7
ECBh LCDDATA61 S47C7 S46C7 S45C7 S44C7 S43C7 S42C7 S41C7 S40C7
ECAh LCDDATA60 S39C7 S38C7 S37C7 S36C7 S35C7 S34C7 S33C7 S32C7
EC9h LCDDATA59 S31C7 S30C7 S29C7 S28C7 S27C7 S26C7 S25C7 S24C7
EC8h LCDDATA58 S23C7 S22C7 S21C7 S20C7 S19C7 S18C7 S17C7 S16C7
EC7h LCDDATA57 S15C7 S14C7 S13C7 S12C7 S11C7 S10C7 S09C7 S08C7
EC6h LCDDATA56 S07C7 S06C7 S05C7 S04C7 S03C7 S02C7 S01C7 S00C7
EC5h LCDDATA55 S63C6 S62C6 S61C6 S60C6 S59C6 S58C6 S57C6 S56C6
EC4h LCDDATA54 S55C6 S54C6 S53C6 S52C6 S51C6 S50C6 S49C6 S48C6
EC3h LCDDATA53 S47C6 S46C6 S45C6 S44C6 S43C6 S42C6 S41C6 S40C6
EC2h LCDDATA52 S39C6 S38C6 S37C6 S36C6 S35C6 S34C6 S33C6 S32C6
EC1h LCDDATA51 S31C6 S30C6 S29C6 S28C6 S27C6 S26C6 S25C6 S24C6
EC0h LCDDATA50 S23C6 S22C6 S21C6 S20C6 S19C6 S18C6 S17C6 S16C6
EBFh LCDDATA49 S15C6 S14C6 S13C6 S12C6 S11C6 S10C6 S09C6 S08C6
EBEh LCDDATA48 S07C6 S06C6 S05C6 S04C6 S03C6 S02C6 S01C6 S00C6
EBDh LCDDATA47 S63C5 S62C5 S61C5 S60C5 S59C5 S58C5 S57C5 S56C5
EBCh LCDDATA46 S55C5 S54C5 S53C5 S52C5 S51C5 S50C5 S49C5 S48C5
EBBh LCDDATA45 S47C5 S46C5 S45C5 S44C5 S43C5 S42C5 S41C5 S40C5
EBAh LCDDATA44 S39C5 S38C5 S37C5 S36C5 S35C5 S34C5 S33C5 S32C5
EB9h LCDDATA43 S31C5 S30C5 S29C5 S28C5 S27C5 S26C5 S25C5 S24C5
EB8h LCDDATA42 S23C5 S22C5 S21C5 S20C5 S19C5 S18C5 S17C5 S16C5
EB7h LCDDATA41 S15C5 S14C5 S13C5 S12C5 S11C5 S10C5 S09C5 S08C5
EB6h LCDDATA40 S07C5 S06C5 S05C5 S04C5 S03C5 S02C5 S01C5 S00C5
EB5h LCDDATA39 S63C4 S62C4 S61C4 S60C4 S59C4 S58C4 S57C4 S56C4
EB4h LCDDATA38 S55C4 S54C4 S53C4 S52C4 S51C4 S50C4 S49C4 S48C4
EB3h LCDDATA37 S47C4 S46C4 S45C4 S44C4 S43C4 S42C4 S41C4 S40C4
EB2h LCDDATA36 S39C4 S38C4 S37C4 S36C4 S35C4 S34C4 S33C4 S32C4
EB1h LCDDATA35 S31C4 S30C4 S29C4 S28C4 S27C4 S26C4 S25C4 S24C4
EB0h LCDDATA34 S23C4 S22C4 S21C4 S20C4 S19C4 S18C4 S17C4 S16C4
EAFh LCDDATA33 S15C4 S14C4 S13C4 S12C4 S11C4 S10C4 S09C4 S08C4
EAEh LCDDATA32 S07C4 S06C4 S05C4 S04C4 S03C4 S02C4 S01C4 S00C4
EADh LCDDATA31 S63C3 S62C3 S61C3 S60C3 S59C3 S58C3 S57C3 S56C3
EACh LCDDATA30 S55C3 S54C3 S53C3 S52C3 S51C3 S50C3 S49C3 S48C3
EABh LCDDATA29 S47C3 S46C3 S45C3 S44C3 S43C3 S42C3 S41C3 S40C3
EAAh LCDDATA28 S39C3 S38C3 S37C3 S36C3 S35C3 S34C3 S33C3 S32C3
EA9h LCDDATA27 S31C3 S30C3 S29C3 S28C3 S27C3 S26C3 S25C3 S24C3
EA8h LCDDATA26 S23C3 S22C3 S21C3 S20C3 S19C3 S18C3 S17C3 S16C3
EA7h LCDDATA25 S15C3 S14C3 S13C3 S12C3 S11C3 S10C3 S09C3 S08C3
EA6h LCDDATA24 S07C3 S06C3 S05C3 S04C3 S03C3 S02C3 S01C3 S00C3
EA5h LCDDATA23 S63C2 S62C2 S61C2 S60C2 S59C2 S58C2 S57C2 S56C2
EA4h LCDDATA22 S55C2 S54C2 S53C2 S52C2 S51C2 S50C2 S49C2 S48C2
EA3h LCDDATA21 S47C2 S46C2 S45C2 S44C2 S43C2 S42C2 S41C2 S40C2
EA2h LCDDATA20 S39C2 S38C2 S37C2 S36C2 S35C2 S34C2 S33C2 S32C2
EA1h LCDDATA19 S31C2 S30C2 S29C2 S28C2 S27C2 S26C2 S25C2 S24C2
EA0h LCDDATA18 S23C2 S22C2 S21C2 S20C2 S19C2 S18C2 S17C2 S16C2
E9Fh LCDDATA17 S15C2 S14C2 S13C2 S12C2 S11C2 S10C2 S09C2 S08C2
E9Eh LCDDATA16 S07C2 S06C2 S05C2 S04C2 S03C2 S02C2 S01C2 S00C2
E9Dh LCDDATA15 S63C1 S62C1 S61C1 S60C1 S59C1 S58C1 S57C1 S56C1
Legend: — = unimplemented, read as ‘0’.
E9Ch LCDDATA14 S55C1 S54C1 S53C1 S52C1 S51C1 S50C1 S49C1 S48C1
E9Bh LCDDATA13 S47C1 S46C1 S45C1 S44C1 S43C1 S42C1 S41C1 S40C1
E9Ah LCDDATA12 S39C1 S38C1 S37C1 S36C1 S35C1 S34C1 S33C1 S32C1
E99h LCDDATA11 S31C1 S30C1 S29C1 S28C1 S27C1 S26C1 S25C1 S24C1
E98h LCDDATA10 S23C1 S22C1 S21C1 S20C1 S19C1 S18C1 S17C1 S16C1
E97h LCDDATA9 S15C1 S14C1 S13C1 S12C1 S11C1 S10C1 S09C1 S08C1
E96h LCDDATA8 S07C1 S06C1 S05C1 S04C1 S03C1 S02C1 S01C1 S00C1
E95h LCDDATA7 S63C0 S62C0 S61C0 S60C0 S59C0 S58C0 S57C0 S56C0
E94h LCDDATA6 S55C0 S54C0 S53C0 S52C0 S51C0 S50C0 S49C0 S48C0
E93h LCDDATA5 S47C0 S46C0 S45C0 S44C0 S43C0 S42C0 S41C0 S40C0
E92h LCDDATA4 S39C0 S38C0 S37C0 S36C0 S35C0 S34C0 S33C0 S32C0
E91h LCDDATA3 S31C0 S30C0 S29C0 S28C0 S27C0 S26C0 S25C0 S24C0
E90h LCDDATA2 S23C0 S22C0 S21C0 S20C0 S19C0 S18C0 S17C0 S16C0
E8Fh LCDDATA1 S15C0 S14C0 S13C0 S12C0 S11C0 S10C0 S09C0 S08C0
E8Eh LCDDATA0 S07C0 S06C0 S05C0 S04C0 S03C0 S02C0 S01C0 S00C0
E8Dh ADCON2H PVCFG1 PVCFG0 NVCFG0 OFFCAL BUFREGEN CSCNA — —
E8Ch ADCON2L BUFS SMPI4 SMPI3 SMPI2 SMPI1 SMPI0 BUFM ALTS
E8Bh ADCON3H ADRC EXTSAM PUMPEN SAMC4 SAMC3 SAMC2 SAMC1 SAMC0
E8Ah ADCON3L ADCS7 ADCS6 ADCS5 ADCS4 ADCS3 ADCS2 ADCS1 ADCS0
E89h ADCON5H ASENA LPENA CTMUREQ — — — ASINTMD1 ASINTMD0
E88h ADCON5L — — — — WM1 WM0 CM1 CM0
E87h ADCHS0H CH0NB2 CH0NB1 CH0NB0 CH0SB4 CH0SB3 CH0SB2 CH0SB1 CH0SB0
E86h ADCHS0L CH0NA2 CH0NA1 CH0NA0 CH0SA4 CH0SA3 CH0SA2 CH0SA1 CH0SA0
E85h ADCSS1H — CSS30 CSS29 CSS28 CSS27 CSS26 CSS25 CSS24
E84h ADCSS1L CSS23 CSS22 CSS21 CSS20 CSS19 CSS18 CSS17 CSS16
E83h ADCSS0H CSS15 CSS14 CSS13 CSS12 CSS11 CSS10 CSS9 CSS8
E82h ADCSS0L CSS7 CSS6 CSS5 CSS4 CSS3 CSS2 CSS1 CSS0
E81h ADCHIT1H — CHH30 CHH29 CHH28 CHH27 CHH26 CHH25 CHH24
E80h ADCHIT1L CHH23 CHH22 CHH21 CHH20 CHH19 CHH18 CHH17 CHH16
E7Fh ADCHIT0H CHH15 CHH14 CHH13 CHH12 CHH11 CHH10 CHH9 CHH8
E7Eh ADCHIT0L CHH7 CHH6 CHH5 CHH4 CHH3 CHH2 CHH1 CHH0
E7Dh ADCTMUEN1H — CTMUEN30 CTMUEN29 CTMUEN28 CTMUEN27 CTMUEN26 CTMUEN25 CTMUEN24
E7Ch ADCTMUEN1L CTMUEN23 CTMUEN22 CTMUEN21 CTMUEN20 CTMUEN19 CTMUEN18 CTMUEN17 CTMUEN16
E7Bh ADCTMUEN0H CTMUEN15 CTMUEN14 CTMUEN13 CTMUEN12 CTMUEN11 CTMUEN10 CTMUEN9 CTMUEN8
E7Ah ADCTMUEN0L CTMUEN7 CTMUEN6 CTMUEN5 CTMUEN4 CTMUEN3 CTMUEN2 CTMUEN1 CTMUEN0
E79h ADCBUF25H A/D Result Register 25 High Byte
E78h ADCBUF25L A/D Result Register 25 Low Byte
E77h ADCBUF24H A/D Result Register 24 High Byte
E76h ADCBUF24L A/D Result Register 24 Low Byte
E75h ADCBUF23H A/D Result Register 23 High Byte
E74h ADCBUF23L A/D Result Register 23 Low Byte
E73h ADCBUF22H A/D Result Register 22 High Byte
E72h ADCBUF22L A/D Result Register 22 Low Byte
E71h ADCBUF21H A/D Result Register 21 High Byte
E70h ADCBUF21L A/D Result Register 21 Low Byte
E6Fh ADCBUF20H A/D Result Register 20 High Byte
E6Eh ADCBUF20L A/D Result Register 20 Low Byte
E6Dh ADCBUF19H A/D Result Register 19 High Byte
E6Ch ADCBUF19L A/D Result Register 19 Low Byte
E6Bh ADCBUF18H A/D Result Register 18 High Byte
E6Ah ADCBUF18L A/D Result Register 18 Low Byte
Legend: — = unimplemented, read as ‘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
Note 1: For borrow, the polarity is reversed. A subtraction is executed by adding the 2’s complement of the second
operand. For rotate (RRF, RLF) instructions, this bit is loaded with either bit 4 or bit 3 of the source register.
2: For borrow, the polarity is reversed. A subtraction is executed by adding the 2’s complement of the second
operand. For rotate (RRF, RLF) instructions, this bit is loaded with either the high or low-order bit of the
source register.
What does not change is just as important. The size of Additionally, byte-oriented and bit-oriented instructions
the data memory space is unchanged, as well as its are not affected if they do not use the Access Bank
linear addressing. The SFR map remains the same. (Access RAM bit = 1), or include a file address of 60h
Core PIC18 instructions can still operate in both Direct or above. Instructions meeting these criteria will
and Indirect Addressing mode. Inherent and literal continue to execute as before. A comparison of the
instructions do not change at all. Indirect Addressing different possible addressing modes when the
with FSR0 and FSR1 also remains unchanged. extended instruction set is enabled is shown in
Figure 6-9.
6.6.1 INDEXED ADDRESSING WITH Those who desire to use byte-oriented or bit-oriented
LITERAL OFFSET instructions in the Indexed Literal Offset mode should
Enabling the PIC18 extended instruction set changes note the changes to assembler syntax for this mode.
the behavior of Indirect Addressing using the FSR2 This is described in more detail in Section 29.2.1
register pair and its associated file operands. Under the “Extended Instruction Syntax”.
proper conditions, instructions that use the Access
Bank – that is, most bit-oriented and byte-oriented
instructions – can invoke a form of Indexed Addressing
using an offset specified in the instruction. This special
addressing mode is known as Indexed Addressing with
Literal Offset or the Indexed Literal Offset mode.
When using the extended instruction set, this
addressing mode requires the following:
• Use of the Access Bank (‘a’ = 0)
• A file address argument that is less than or equal
to 5Fh
Under these conditions, the file address of the
instruction is not interpreted as the lower byte of an
address (used with the BSR in Direct Addressing) or as
an 8-bit address in the Access Bank. Instead, the value
is interpreted as an offset value to an Address Pointer
specified by FSR2. The offset and the contents of FSR2
are added to obtain the target address of the operation.
000h
When a = 0 and f 60h:
The instruction executes in 060h
Direct Forced mode. ‘f’ is Bank 0
interpreted as a location in the 100h
Access RAM between 060h 00h
and FFFh. This is the same as Bank 1 60h
locations, F60h to FFFh through
Bank 14 Valid range
(Bank 15), of data memory. for ‘f’
Locations below 060h are not FFh
F00h Access RAM
available in this addressing
Bank 15
mode.
F40h
SFRs
FFFh
Data Memory
BSR
When a = 1 (all values of f): 000h 00000000
Bank 0
The instruction executes in
060h
Direct mode (also known as
Direct Long mode). ‘f’ is 100h
interpreted as a location in
one of the 16 banks of the data Bank 1 001001da ffffffff
memory space. The bank is through
Bank 14
designated by the Bank Select
Register (BSR). The address
can be in any implemented F00h
bank in the data memory Bank 15
space. F40h
SFRs
FFFh
Data Memory
Example Situation:
ADDWF f, d, a 000h
Not Accessible
FSR2H:FSR2L = 120h 05Fh
Instruction: TBLRD*
Program Memory
(TBLPTR)
Instruction: TBLWT*
Program Memory
Holding Registers
Table Pointer(1) Table Latch (8-bit)
TBLPTRU TBLPTRH TBLPTRL TABLAT
Program Memory
(TBLPTR)
Note 1: The Table Pointer actually points to one of 64 holding registers; the address of which is determined by
TBLPTRL<5:0>. The process for physically writing data to the program memory array is discussed in
Section 7.5 “Writing to Flash Program Memory”.
7.2 Control Registers The WWPROG bit, when set, will allow programming
two bytes per word on the execution of the WR
Several control registers are used in conjunction with command. If this bit is cleared, the WR command will
the TBLRD and TBLWT instructions. These include: result in programming on a block of 64 bytes.
• EECON1 register
The FREE bit, when set, will allow a program memory
• EECON2 register
erase operation. When FREE is set, the erase
• TABLAT register operation is initiated on the next WR command. When
• TBLPTR registers FREE is clear, only writes are enabled.
7.2.1 EECON1 AND EECON2 REGISTERS The WREN bit, when set, will allow a write operation.
On power-up, the WREN bit is clear. The WRERR bit is
The EECON1 register (Register 7-1) is the control
set in hardware when the WR bit is set, and cleared
register for memory accesses. The EECON2 register is
when the internal programming timer expires and the
not a physical register; it is used exclusively in the
write operation is complete.
memory write and erase sequences. Reading
EECON2 will read all ‘0’s. Note: During normal operation, the WRERR is
read as ‘1’. This can indicate that a write
operation was prematurely terminated by
a Reset or a write operation was
attempted improperly.
TABLE 7-1: 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+*
ERASE: TBLPTR<20:10>
Program Memory
TABLAT
Write Register
8 8 8 8
Program Memory
RESTART BUFFER
MOVLW D'64'
MOVWF COUNTER
MOVLW BUFFER_ADDR_HIGH ; point to buffer
MOVWF FSR0H
MOVLW BUFFER_ADDR_LOW
MOVWF FSR0L
FILL_BUFFER
... ; read the new data from I2C, SPI,
; PSP, USART, etc.
WRITE_BUFFER
MOVLW D’64 ; number of bytes in holding register
MOVWF COUNTER
WRITE_BYTE_TO_HREGS
MOVFF POSTINC0, WREG ; get low byte of buffer data
MOVWF TABLAT ; present data to table latch
TBLWT+* ; write data, perform a short write
; to internal TBLWT holding register.
DECFSZ COUNTER ; loop until buffers are full
BRA WRITE_BYTE_TO_HREGS
PROGRAM_MEMORY
BSF EECON1, WREN ; enable write to memory
BCF INTCON, GIE ; disable interrupts
MOVLW 55h
Required MOVWF EECON2 ; write 55h
Sequence MOVLW 0AAh
MOVWF EECON2 ; write 0AAh
BSF EECON1, WR ; start program (CPU stall)
BSF INTCON, GIE ; re-enable interrupts
BCF EECON1, WREN ; disable write to memory
PROGRAM_MEMORY
BSF EECON1, WWPROG ; enable single word write
BSF EECON1, WREN ; enable write to memory
BCF INTCON, GIE ; disable interrupts
MOVLW 55h
Required MOVWF EECON2 ; write 55h
Sequence MOVLW 0AAh
MOVWF EECON2 ; write AAh
BSF EECON1, WR ; start program (CPU stall)
BSF INTCON, GIE ; re-enable interrupts
BCF EECON1, WWPROG ; disable single word write
BCF EECON1, WREN ; disable write to memory
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
TABLE 8-2: ADDRESS AND DATA LINES FOR DIFFERENT ADDRESS AND DATA WIDTHS
Multiplexed Data and Address Only Lines
Ports Available
Data Width Address Width Address Lines (and (and Corresponding
for I/O
Corresponding Ports) Ports)
AD<11:8> PORTE<7:4>,
12-bit
(PORTE<3:0>) All of PORTH
AD<15:8>
16-bit AD<7:0> All of PORTH
8-bit (PORTE<7:0>)
(PORTD<7:0>)
A<19:16>, AD<15:8>
20-bit (PORTH<3:0>, —
PORTE<7:0>)
16-bit AD<15:0> — All of PORTH
16-bit (PORTD<7:0>, A<19:16>
20-bit PORTE<7:0>) —
(PORTH<3:0>)
D<7:0>
A<19:16>(1)
CE
OE
WRH
WRL
Address Bus
Data Bus
Control Lines
Note 1: Upper order address lines are used only for 20-bit address widths.
2: This signal only applies to table writes. See Section 7.1 “Table Reads and Table Writes”.
PIC18F97J94
AD<7:0> A<20:1> JEDEC® Word
373 A<x:0>
EPROM Memory
D<15:0>
D<15:0>
CE OE WR(2)
AD<15:8>
373
ALE
A<19:16>(1)
CE
OE
WRH
Address Bus
Data Bus
Control Lines
Note 1: Upper order address lines are used only for 20-bit address widths.
2: This signal only applies to table writes. See Section 7.1 “Table Reads and Table Writes”.
PIC18F97J94
A<20:1>
AD<7:0> 373 A<x:1> JEDEC® Word
FLASH Memory
D<15:0>
D<15:0>
AD<15:8> 138(3) CE
373 A0
ALE BYTE/WORD OE WR(1)
A<19:16>(2)
OE
WRH
WRL A<20:1>
A<x:1> JEDEC® Word
BA0 SRAM Memory
I/O
D<15:0>
CE D<15:0>
LB LB
UB UB OE WR(1)
Address Bus
Data Bus
Control Lines
Note 1: This signal only applies to table writes. See Section 7.1 “Table Reads and Table Writes”.
2: Upper order address lines are used only for 20-bit address width.
3: Demultiplexing is only required when multiple memory devices are accessed.
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
A<19:16> 0Ch
CE
ALE
OE
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1
CE
ALE
OE
Instruction
Execution INST(PC – 2) SLEEP
D<7:0>
PIC18F97J94
AD<7:0> A<19:0>
373 A<x:1>
ALE D<15:8> A0
D<7:0>
AD<15:8>(1)
CE
(1)
A<19:16> OE WR(2)
BA0
CE
OE
WRL
Address Bus
Data Bus
Control Lines
Note 1: Upper order address bits are only used for 20-bit address width. The upper AD byte is used for all
address widths except 8-bit.
2: This signal only applies to table writes. See Section 7.1 “Table Reads and Table Writes”.
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
A<19:16> 0Ch
AD<15:8> CFh
CE
ALE
OE
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1
BA0
CE
ALE
OE
Instruction
Execution INST(PC – 2) SLEEP
PIR1<7:0>
PIE1<7:0> TMR0IF Wake-up if in
IPR1<7:0> TMR0IE Idle or Sleep modes
TMR0IP
RBIF
PIR2<7,5:0> RBIE
PIE2<7,5:0> RBIP
IPR2<7,5:0> INT0IF
INT0IE
PIR3<7,5> INT1IF
PIE3<7,5> INT1IE Interrupt to CPU
IPR3<7,5> INT1IP Vector to Location
INT2IF
INT2IE 0008h
PIR4<7:0>
PIE4<7:0> INT2IP
IPR4<7:0> INT3IF
INT3IE
INT3IP
GIE/GIEH
PIR5<7:0>
PIE5<7:0>
IPR5<7:0> IPEN
PIR6<7:0>
PIE6<7:0> IPEN
IPR6<7:0> PEIE/GIEL
IPEN
PIR1<7:0>
PIE1<7:0>
IPR1<7:0>
PIR2<7, 5:0>
PIE2<7, 5:0>
IPR2<7, 5:0> Interrupt to CPU
TMR0IF Vector to Location
TMR0IE IPEN
PIR3<7, 5:0> 0018h
PIE3<7, 5:0> TMR0IP
IPR3<7, 5:0>
RBIF
PIR4<7:0> RBIE
PIE4<7:0> RBIP GIE/GIEH
IPR4<7:0> PEIE/GIEL
INT1IF
INT1IE
PIR5<7:0> INT1IP
PIE5<7:0> INT2IF
IPR5<7:0> INT2IE
INT2IP
PIR6<7:0> INT3IF
PIE6<7:0> INT3IE
IPR6<7:0> INT3IP
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: Interrupt flag bits are set when an interrupt condition occurs regardless of the state of its corresponding
enable bit or the Global Interrupt Enable bit. User software should ensure the appropriate interrupt flag bits
are clear prior to enabling an interrupt. This feature allows for software polling.
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: Interrupt flag bits are set when an interrupt condition occurs regardless of the state of its corresponding
enable bit or the Global Interrupt Enable bit. User software should ensure the appropriate interrupt flag bits
are clear prior to enabling an interrupt. This feature allows for software polling.
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
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
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
D Q
WR TRIS
CKx
TRIS Latch Input
Buffer
RD TRIS
Q D
EN
RD PORT
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: If a particular PORT is not available on a package, the corresponding RnPU register bit will be
unimplemented and read back as ‘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
11.1.4 ANALOG AND DIGITAL PORTS Setting these registers makes the corresponding pins
analog and clearing the registers makes the ports
Many of the ports multiplex analog and digital function-
digital. For details on these registers, see Section 22.0
ality, providing a lot of flexibility for hardware designers.
“12-Bit A/D Converter with Threshold Scan”
PIC18FXXJ94 devices can make any analog pin ana-
log or digital, depending on an application’s needs. The
ports’ analog/digital functionality is controlled by the
registers: ANCON1, ANCON2 and ANCON3.
RA0/AN0/AN1-/RP0/ RA0 0 O DIG LATA<0> data output; not affected by analog input.
SEG19 1 I ST PORTA<0> data input; disabled when analog input is enabled.
AN0 1 I ANA A/D Input Channel 0. Default input configuration on POR; does not
affect digital output.
AN1- 1 I ANA Quasi-differential A/D negative input channel.
RP0 x x DIG Reconfigurable Pin 0 for PPS-Lite; TRIS must be set to match
input/output of the module.
SEG19 0 O ANA LCD Segment 19 output; disables all other pin functions.
RA1/AN1/RP1/SEG18 RA1 0 O DIG LATA<1> data output; not affected by analog input.
1 I ST PORTA<1> data input; disabled when analog input is enabled.
AN1 1 I ANA A/D Input Channel 1. Default input configuration on POR; does not
affect digital output.
RP1 x x DIG Reconfigurable Pin 1 for PPS-Lite; TRIS must be set to match
input/output of module.
SEG18 0 O ANA LCD Segment 18 output; disables all other pin functions.
RA2/AN2/VREF-/RP2/ RA2 0 O DIG LATA<2> data output; not affected by analog input.
SEG21 1 I ST PORTA<2> data input; disabled when analog input enabled.
AN2 1 I ANA A/D Input Channel 2. Default input configuration on POR; does not
affect digital output.
VREF- 1 I ANA A/D and Comparator Low Reference Voltage input.
RP2 x x DIG Reconfigurable Pin 2 for PPS-Lite; TRIS must be set to match
input/output of module.
SEG21 0 O ANA LCD Segment 21 output; disables all other pin functions.
Legend: O = Output, I = Input, ANA = Analog Signal, DIG = Digital Output, ST = Schmitt Trigger Buffer Input,
x = Don’t care (TRIS bit does not affect port direction or is overridden for this option).
RA3/AN3/VREF+/RP3 RA3 0 O DIG LATA<3> data output; not affected by analog input.
1 I ST PORTA<3> data input; disabled when analog input is enabled.
AN3 1 I ANA A/D Input Channel 3. Default input configuration on POR; does not
affect digital output.
VREF+ 1 I ANA A/D and Comparator High Reference Voltage input.
RP3 x x DIG Reconfigurable Pin 3 for PPS-Lite; TRIS must be set to match
input/output of module.
RA4/AN6/RP4/SEG14 RA4 0 O DIG LATA<4> data output; not affected by analog input.
1 I ST PORTA<4> data input; disabled when analog input is enabled.
AN6 1 I ANA A/D Input Channel 6. Default input configuration on POR; does not
affect digital output.
RP4 x x DIG Reconfigurable Pin 4 for PPS-Lite; TRIS must be set to match
input/output of module.
SEG14 0 O ANA LCD Segment 14 output; disables all other pin functions.
RA5/AN4/RP5/LVDIN/ RA5 0 O DIG LATA<5> data output; not affected by analog input.
C1INA/C2INA/C3INA/ 1 I ST PORTA<5> data input; disabled when analog input is enabled.
SEG15
AN4 1 I ANA A/D Input Channel 4. Default input configuration on POR; does not
affect digital output.
RP5 x x DIG Reconfigurable Pin 5 for PPS-Lite; TRIS must be set to match
input/output of module.
LVDIN 1 I ANA High/Low-Voltage Detect (HLVD) external trip point input.
C1INA 1 I ANA Comparator 1 Input A.
C2INA 1 I ANA Comparator 2 Input A.
C3INA 1 I ANA Comparator 3 Input A.
SEG15 0 O ANA LCD Segment 15 output; disables all other pin functions.
RA6/RP6/CLKO/OSC2 RA6 0 O DIG LATA<6> data output; disabled when OSC2 Configuration bit is set.
1 I ST PORTA<6> data input; disabled when OSC2 Configuration bit is set.
RP6 x x DIG Reconfigurable Pin 6 for PPS-Lite; TRIS must be set to match
input/output of module.
CLKO x O DIG System cycle clock output (FOSC/4, EC and Internal Oscillator
modes).
OSC2 x O ANA Main oscillator feedback output connection (HS, MS and LP
modes).
RA7/RP10/CLKI/OSC1 RA7 0 O DIG LATA<7> data output; disabled when OSC2 Configuration bit is set.
1 I ST PORTA<7> data input; disabled when OSC2 Configuration bit is set.
RP10 x x DIG Reconfigurable Pin 10 for PPS-Lite; TRIS must be set to match
input/output of module.
CLKI x O DIG Main external clock source input (EC modes).
OSC1 x O ANA Main oscillator input connection (HS, MS and LP modes).
Legend: O = Output, I = Input, ANA = Analog Signal, DIG = Digital Output, ST = Schmitt Trigger Buffer Input,
x = Don’t care (TRIS bit does not affect port direction or is overridden for this option).
RG0/RP46/AN8/ RG0 0 O DIG LATG<0> data output; not affected by analog input.
SEG28/COM4
1 I ST PORTG<0> data input; disabled when analog input is enabled.
RP46 x x DIG Reconfigurable Pin 46 for PPS-Lite; TRIS must be set to match input/
output of module.
AN8 1 I ANA A/D Input Channel 8. Default input configuration on POR; does not
affect digital output.
SEG28 0 O ANA LCD Segment 28 output; disables all other pin functions.
COM4 x O ANA LCD Common 4 output; disables all other outputs.
RG1/RP39/ RG1 0 O DIG LATG<1> data output; not affected by analog input.
AN19/SEG29/
1 I ST PORTG<1> data input; disabled when analog input is enabled.
COM5
RP39 x x DIG Reconfigurable Pin 39 for PPS-Lite; TRIS must be set to match input/
output of module.
AN19 1 I ANA A/D Input Channel 19. Default input configuration on POR; does not
affect digital output.
SEG29 0 O ANA LCD Segment 29 output; disables all other pin functions.
COM5 x O ANA LCD Common 5 output; disables all other outputs.
RG2/RP42/ RG2 0 O DIG LATG<2> data output; not affected by analog input.
C3INA/AN18/ I ST PORTG<2> data input; disabled when analog input is enabled.
1
SEG30/COM6
RP42 x x DIG Reconfigurable Pin 42 for PPS-Lite; TRIS must be set to match input/
output of module.
C3INA 1 I ANA Comparator 3 Input A.
AN18 1 I ANA A/D Input Channel 18. Default input configuration on POR; does not
affect digital output.
SEG30 0 O ANA LCD Segment 30 output; disables all other pin functions.
COM6 x O ANA LCD Common 6 output; disables all other outputs.
Legend: O = Output, I = Input, ANA = Analog Signal, DIG = Digital Output, ST = Schmitt Trigger Buffer Input,
x = Don’t care (TRIS bit does not affect port direction or is overridden for this option).
RG3/RP43/ RG3 0 O DIG LATG<3> data output; not affected by analog input.
C3INB/AN17/ I ST PORTG<3> data input; disabled when analog input is enabled.
1
SEG31/COM7
RP43 x x DIG Reconfigurable Pin 43 for PPS-Lite; TRIS must be set to match input/
output of module.
C3INB 1 I ANA Comparator 3 Input B.
AN17 1 I ANA A/D Input Channel 17. Default input configuration on POR; does not
affect digital output.
SEG31 0 O ANA LCD Segment 31 output; disables all other pin functions.
COM7 x O ANA LCD Common 7 output; disables all other outputs.
RG4/RTCC/ RG4 0 O DIG LATG<4> data output; not affected by analog input.
RP44/C3INC/
1 I ST PORTG<4> data input; disabled when analog input is enabled.
AN16/SEG26
RTCC x O DIG RTCC output.
RP44 x x DIG Reconfigurable Pin 44 for PPS-Lite; TRIS must be set to match input/
output of module.
C3INC 1 I ANA Comparator 3 Input C.
AN16 1 I ANA A/D Input Channel 16. Default input configuration on POR; does not
affect digital output.
SEG26 0 O ANA LCD Segment 26 output; disables all other pin functions.
RG6 RG6 0 O DIG LATG<6> data output.
1 I ST PORTG<6> data input.
RG7 RG7 0 O DIG LATG<7> data output.
1 I ST PORTG<7> data input.
Legend: O = Output, I = Input, ANA = Analog Signal, DIG = Digital Output, ST = Schmitt Trigger Buffer Input,
x = Don’t care (TRIS bit does not affect port direction or is overridden for this option).
RH0/AN23/ RH0 0 O DIG LATH<0> data output; not affected by analog input.
SEG47/A16 1 I ST PORTH<0> data input.
AN23 1 I ANA A/D Input Channel 23. Default input configuration on POR; does not
affect digital output.
SEG47 0 O ANA LCD Segment 47 output; disables all other pin functions.
A16 x O DIG External Memory Bus Address<16> output.
RH1/AN22/ RH1 0 O DIG LATH<1> data output; not affected by analog input.
SEG46/A17 1 I ST PORTH<1> data input.
AN22 1 I ANA A/D Input Channel 22. Default input configuration on POR; does not
affect digital output.
SEG46 0 O ANA LCD Segment 46 output; disables all other pin functions.
A17 x O DIG External Memory Bus Address<17> output.
RH2/AN21/ RH2 0 O DIG LATH<2> data output; not affected by analog input.
SEG45/A18 1 I ST PORTH<2> data input.
AN21 1 I ANA A/D Input Channel 21. Default input configuration on POR; does not
affect digital output.
SEG45 0 O ANA LCD Segment 45 output; disables all other pin functions.
A18 x O DIG External Memory Bus Address<18> output.
RH3/AN20/ RH3 0 O DIG LATH<3> data output; not affected by analog input.
SEG44/A19 1 I ST PORTH<3> data input.
AN20 1 I ANA A/D Input Channel 20. Default input configuration on POR; does not
affect digital output.
SEG44 0 O ANA LCD Segment 44 output; disables all other pin functions.
A19 x O DIG External Memory Bus Address<19> output.
RH4/C2INC/ RH4 0 O DIG LATH<4> data output; not affected by analog input.
AN12/SEG40 1 I ST PORTH<4> data input; disabled when analog input is enabled.
C2INC 1 I ANA Comparator 2 Input C.
AN12 1 I ANA A/D Input Channel 12. Default input configuration on POR; does not
affect digital output.
SEG40 0 O ANA LCD Segment 40 output; disables all other pin functions.
Legend: O = Output, I = Input, ANA = Analog Signal, DIG = Digital Output, ST = Schmitt Trigger Buffer Input,
x = Don’t care (TRIS bit does not affect port direction or is overridden for this option).
RH5/C2IND/ RH5 0 O DIG LATH<5> data output; not affected by analog input.
AN13/SEG41 1 I ST PORTH<5> data input; disabled when analog input is enabled.
C2IND 1 I ANA Comparator 2 Input D.
AN13 1 I ANA A/D Input Channel 13. Default input configuration on POR; does not
affect digital output.
SEG41 0 O ANA LCD Segment 41 output; disables all other pin functions.
RH6/C1INC/ RH6 0 O DIG LATH<6> data output; not affected by analog input.
AN14/SEG42 1 I ST PORTH<6> data input; disabled when analog input is enabled.
C1INC 1 I ANA Comparator 1 Input C.
AN14 1 I ANA A/D Input Channel 14. Default input configuration on POR; does not
affect digital output.
SEG42 0 O ANA LCD Segment 42 output; disables all other pin functions.
RH7/AN15/ RH7 0 O DIG LATH<7> data output; not affected by analog input.
SEG43 1 I ST PORTH<7> data input; disabled when analog input is enabled.
AN15 1 I ANA A/D Input Channel 15. Default input configuration on POR; does not
affect digital output.
SEG43 0 O ANA LCD Segment 43 output; disables all other pin functions.
Legend: O = Output, I = Input, ANA = Analog Signal, DIG = Digital Output, ST = Schmitt Trigger Buffer Input,
x = Don’t care (TRIS bit does not affect port direction or is overridden for this option).
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
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
CS
WR
RD
PORTD<7:0>
IBF
OBF
PSPIF
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
CS
WR
RD
PORTD<7:0>
IBF
OBF
PSPIF
Open-Drain Selection
Peripheral Pin Select Output Multiplexers
Output Function
Select for the Pin
Data Bus D Q
WR TRIS
CK Q
TRIS Latch
D Q
WR LAT/
WR PORT
CK
Data Latch
Read LAT
Read PORT
Peripheral Input
Pin Selection
I/O Pin 0
0
I/O Pin 1
Peripheral Input 1
I/O Pin n
n
RPINR0_1<3:0>
0
RP3
1
RP7
U1RX Input
to Peripheral
2
RP11
A
RP(4n+3)
(2) with this RPn Pin (3) Write this Corresponding Value (2) with this RPn Pin (3) Write this Corresponding Value
RP0 h’0 RP1 h’0
RP4 h’1 RP5 h’1
RP8 h’2 RP9 h’2
RP12 h’3 RP13 h’3
RP16 h’4 RP17 h’4
RP20 h’5 RP21 h’5
RP24 h’6 RP25 h’6
RP28 h’7 RP29 h’7
RP32 h’8 RP33 h’8
RP36 h’9 RP37 h’9
RP40 h’A RP41 h’A
RP44 h’B RP45 h’B
— h’C — h’C
— h’D — h’D
— h’E — h’E
VSS h’F VSS h’F
(2) with this RPn Pin (3) Write this Corresponding Value (2) with this RPn Pin (3) Write this Corresponding Value
RP2 h’0 RP3 h’0
RP6 h’1 RP7 h’1
RP10 h’2 RP11 h’2
RP14 h’3 RP15 h’3
RP18 h’4 RP19 h’4
RP22 h’5 RP23 h’5
RP26 h’6 RP27 h’6
RP30 h’7 RP31 h’7
RP34 h’8 RP35 h’8
RP38 h’9 RP39 h’9
RP42 h’A RP43 h’A
RP46 h’B — h’B
— h’C — h’C
— h’D — h’D
— h’E — h’E
VSS h’F VSS h’F
11.15.3.2 Output Mapping an RPn pin, use the 4-step process, as indicated in
Table 11-14. Choose the RPn pin and the signal; the
In contrast to the inputs, the outputs of the Peripheral
column on the right shows which value to write to the
Pin Select options are mapped on the basis of the pin.
associated RPORx register.
In this case, a bit field associated with a particular pin
dictates the peripheral output to be mapped. The The peripheral outputs that support Peripheral Pin
RPORx registers contain sets of 4-bit fields, with each Selection have no default pins. Since the RPORx reg-
associated with one RPn pin (see Register 11-5). The isters reset to all ‘0’s, the outputs are all disconnected
value of the bit field corresponds to one of the periph- in the device’s default (Reset) state.
erals and that peripheral’s output is mapped to the pin. The list of peripherals for output mapping also includes
Each pin has a limited set of peripherals to choose a null value of b’0000’ because of the mapping
from. technique. This allows unused peripherals to not be
The PPS-Lite peripheral outputs and associated RPn connected to a pin. Not all peripherals are available on
pins have been organized into four groups. It is not all pins. For example, the “SDO2” signal is only avail-
possible to map a peripheral to an RPn pin which is out- able on RP0, RP4, RP8, etc. The “SDO2” signal is not
side of its group. To map a peripheral output signal to available on RP1.
RPORn<3:0>
Output Enable
OC5 Output
22
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
(2) with this Output Signal (3) Write this Corresponding Value (2) with this Output Signal (3) Write this Corresponding Value
Disabled h’0 Disabled h’0
U2BCLK h’1 U1BCLK h’1
U3RX_DT h’2 U3TX_CK h’2
U4RX_DT h’3 U4TX_CK h’3
SDO2 h’4 SDO1 h’4
P1D h’5 P1C h’5
P2D h’6 P2C h’6
P3B h’7 P3C h’7
CTPLS h’8 CCP7 h’8
CCP5 h’9 CCP9 h’9
CCP8 h’A C2OUT h’A
C1OUT h’B Unused h’B
Unused h’C Unused h’C
RVP0 h’D RVP1 h’D
RVP4 h’E RVP5 h’E
Reserved h’F Reserved h’F
(2) with this Output Signal (3) Write this Corresponding Value (2) with this Output Signal (3) Write this Corresponding Value
Disabled h’0 Disabled h’0
U1TX_CK h’1 U1RX_DT h’1
U2RX_DT h’2 U2TX_CK h’2
U3BCLK h’3 SCK1 h’3
U4BCLK h’4 ECCP1/P1A h’4
SCK2 h’5 ECCP2/P2A h’5
P1B h’6 P3D h’6
P2B h’7 MDOUT h’7
ECCP3/P3A h’8 CCP4 h’8
CCP6 h’9 C3OUT h’9
CCP10 h’A Unused h’A
Unused h’B Unused h’B
Unused h’C Unused h’C
RVP2 h’D RVP3 h’D
RVP6 h’E RVP7 h’E
Reserved h’F Reserved h’F
11.15.3.3 I/O Mapping configuration point of view, the user must ensure the
selected configurations are supportable from an
While most peripheral signals are defined as either
electrical point of view.
input or output, some peripheral signals switch
between input and output: UnRX_DT, UnTX_CK, PBIO
11.15.4 CONTROLLING CONFIGURATION
and CCP. Most commonly, these signals are mapped
CHANGES
so that both the input and output map to the same RPn
pin. If desired, the input and output can be mapped to Because peripheral remapping can be changed during
separate pins. For standard peripheral operation, run time, some restrictions on peripheral remapping
ensure that both the input and output mapping are needed to prevent accidental configuration
configurations select the same RPn pin. changes. PIC18FXXJ94 devices include two features
to prevent alterations to the peripheral map:
11.15.3.4 Mapping Limitations • Continuous state monitoring
The control schema of Peripheral Select Pins is not lim- • Configuration bit remapping lock
ited to a small range of fixed peripheral configurations.
There are no mutual or hardware enforced lockouts
between any of the peripheral mapping SFRs. While
such mappings may be technically possible from a
VSS 0000
MDCIN1 0001 MDEN
MDCIN2 0010
REFO1 Clock 0011 EN
Data Signal
ECCP1 0100
ECCP2 0101 Modulator
ECCP3 0110 CARH
CCP4 0111
CCP5 1000
CCP6 1001
CCP7 1010 MDCHPOL
CCP8 1011
CCP9 1100
CCP10 1101
D
System Clock 1110
REFO2 Clock 1111 SYNC
Q 1
MDSRC<3:0>
MDBIT 0000 0
MDMIN 0001
MSSP1 (SDO) 0010
MSSP2 (SDO) 0011 MDCHSYNC
EUSART1 (TXX) 0100
EUSART2 (TXX) 0101
EUSART3 (TXX) 0110 MOD MDOUT
EUSART4 (TXX) 0111
ECCP1 1000 MDOE
ECCP2 1001 MDOPOL Switches Between
ECCP3 1010 PORT Function
CCP4 1011
CCP5 1100 and DSM Output
CCP6 1101
CCP7 1110
CCP8 1111
D
MDCL<3:0> SYNC
Q 1
VSS 0000
MDCIN1 0001
MDCIN2 0010
REFO1 Clock 0011 0
ECCP1 0100
ECCP2 0101 MDCLSYNC
ECCP3 0110 CARL
CCP4 0111
CCP5 1000
CCP6 1001
CCP7 1010
CCP8 1011 MDCLPOL
CCP9 1100
CCP10 1101
System Clock 1110
REFO2 CLOCK 1111
Modulator (MOD)
MDCHSYNC = 1
MDCLSYNC = 0
MDCHSYNC = 1
MDCLSYNC = 1
MDCHSYNC = 0
MDCLSYNC = 0
MDCHSYNC = 0
MDCLSYNC = 1
Modulator (MOD)
MDCHSYNC = 0
MDCLSYNC = 0
Modulator (MOD)
MDCHSYNC = 1
MDCLSYNC = 0
Modulator (MOD)
MDCHSYNC = 0
MDCLSYNC = 1
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: The MDBIT must be selected as the modulation source in the MDCON register for this operation.
2: 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.
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: Narrowed carrier pulse widths or spurs may occur in the signal stream during transitions.
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: Narrowed carrier pulse widths or spurs may occur in the signal stream during transitions.
Data Bus
LCD DATA
64 x 8
LCDDATA63 512
64
LCDDATA62 to
.
. 64
. SEG<63:0>
LCDDATA1 MUX
8 LCDDATA0
Bias
Voltage To I/O Pins
Timing Control
LCDCON 8
LCDPS
LCDSEx
COM<7: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
TABLE 13-2: LCDDATA REGISTERS AND BITS FOR SEGMENT AND COM COMBINATIONS
COM Segments
Lines 0 to 7 8 to 15 16 to 23 24 to 31 32 to 39 40 to 47 48 to 55 56 to 63
COM0
COM1
COM2
COM7
FRC Oscillator
(8 MHZ) ÷8192
÷4 STAT
LCD bias voltages can be generated with internal Depending on the total resistance of the resistor
resistor ladders, internal bias generator or external ladders, the biasing can be classified as low, medium
resistor ladder. or high power.
Table 13-3 shows the total resistance of each of the
ladders. Table 13-3 shows the internal resister ladder
connections. When the internal resistor ladder is
selected, the bias voltage can either be from VDD or
from VDDCORE, depending on the LCDIRS setting. It
can also provide software contrast control (using
LCDCST<2:0>)
.
VVDD
DD
VDDCORE
3x Band Gap
LCDIRS
LCDIRE
LCDCST<2:0>
VLCD3PE
LCDBIAS3
VLCD2PE
LCDBIAS2
VLCD1PE
LCDBIAS1
A Power Mode
B Power Mode
LRLAT<2:0>
LRLAP<1:0> LRLBP<1:0>
There are two power modes, designated as “Mode A” To get additional current in High-Power mode, when
and “Mode B”. Mode A is set by the LRLAP<1:0> bits LRLAP<1:0> (LCDRL<7:6>) = 11, both the medium
and Mode B by the LRLB<1:0> bits. The resistor ladder and high-power resistor ladders are activated.
to use for Modes A and B are selected by the bits, Whenever the LCD module is inactive, LCDA
LRLAP<1:0> and LRLBP<1:0>, respectively. (LCDPS<5>) = 0), the reference ladder will be turned
Each ladder has a matching contrast control ladder, off.
tuned to the nominal resistance of the reference ladder.
This contrast control resistor can be controlled by the
LCDCST<2:0> bits (LCDREF<5:3>). Disabling the
internal reference ladder results in all of the ladders
being disconnected, allowing external voltages to be
supplied.
lcd_32x_clk
cnt<4:0> 'H00 'H01 'H02 'H03 'H04 'H05 'H06 'H07 'H1E 'H1F 'H00 'H01
lcd_clk
LRLAT<2:0> 'H3
Segment Data
LRLAT<2:0>
Power Mode Power Mode A Power Mode B Mode A
VDD 7 Stages
R R R R
Analog
MUX
7
To Top of
Reference Ladder
0
LCDCST<2:0>
3
Internal Reference Contrast Control
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-6 LRLAP<1:0>: LCD Reference Ladder A Time Power Control bits
During Time Interval A:
11 = Internal LCD reference ladder is powered in High-Power mode
10 = Internal LCD reference ladder is powered in Medium Power mode
01 = Internal LCD reference ladder is powered in Low-Power mode
00 = Internal LCD reference ladder is powered down and unconnected
bit 5-4 LRLBP<1:0>: LCD Reference Ladder B Time Power Control bits
During Time Interval B:
11 = Internal LCD reference ladder is powered in High-Power mode
10 = Internal LCD reference ladder is powered in Medium Power mode
01 = Internal LCD reference ladder is powered in Low-Power mode
00 = Internal LCD reference ladder is powered down and unconnected
bit 3 Unimplemented: Read as ‘0’
bit 2-0 LRLAT<2:0>: LCD Reference Ladder A Time Interval Control bits
Sets the number of 32 clock counts when the A Time Interval Power mode is active.
For Type-A Waveforms (WFT = 0):
111 = Internal LCD reference ladder is in A Power mode for 7 clocks and B Power mode for 9 clocks
110 = Internal LCD reference ladder is in A Power mode for 6 clocks and B Power mode for 10 clocks
101 = Internal LCD reference ladder is in A Power mode for 5 clocks and B Power mode for 11 clocks
100 = Internal LCD reference ladder is in A Power mode for 4 clocks and B Power mode for 12 clocks
011 = Internal LCD reference ladder is in A Power mode for 3 clocks and B Power mode for 13 clocks
010 = Internal LCD reference ladder is in A Power mode for 2 clocks and B Power mode for 14 clocks
001 = Internal LCD reference ladder is in A Power mode for 1 clock and B Power mode for 15 clocks
000 = Internal LCD reference ladder is always in B Power mode
For Type-B Waveforms (WFT = 1):
111 = Internal LCD reference ladder is in A Power mode for 7 clocks and B Power mode for 25 clocks
110 = Internal LCD reference ladder is in A Power mode for 6 clocks and B Power mode for 26 clocks
101 = Internal LCD reference ladder is in A Power mode for 5 clocks and B Power mode for 27 clocks
100 = Internal LCD reference ladder is in A Power mode for 4 clocks and B Power mode for 28 clocks
011 = Internal LCD reference ladder is in A Power mode for 3 clocks and B Power mode for 29 clocks
010 = Internal LCD reference ladder is in A Power mode for 2 clocks and B Power mode for 30 clocks
001 = Internal LCD reference ladder is in A Power mode for 1 clock and B Power mode for 31 clocks
000 = Internal LCD reference ladder is always in B Power mode
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
PIC18F97J94
VLCAP1
CFLY
0.47 F(1)
0.47 F(1)
VLCAP2 VDD
LCDBIAS3
C3
0.47 F(1)
C2
LCDBIAS2
C2 0.47 F(1)
0.47 F(1)
C1
LCDBIAS1 0.47 F(1)
C1
0.47 F(1)
C0
LCDBIAS0
C0 0.47 F(1)
0.47 F(1)
Note 1: These values are provided for design guidance only; they should be optimized for the application by the designer
based on the actual LCD specifications.
PIC18F97J94
VDD VDD
LCDBIAS3
10 k(1) 10 k(1)
LCDBIAS2
10 k(1)
LCDBIAS1
10 k(1) 10 k(1)
LCDBIAS0
Bias Type
Bias Level at Pin
1/2 Bias 1/3 Bias
Note 1: These values are provided for design guidance only; they should be optimized for the application by the designer
based on the actual LCD specifications.
PIC18F97J94
(2)
LCDBIAS3
10 k(1) 10 k(1)
LCDBIAS2
10 k(1)
LCDBIAS1
10 k(1) 10 k(1)
LCDBIAS0
Bias Type
Bias Level at Pin
Static 1/2 Bias 1/3 Bias
Note 1: These values are provided for design guidance only; they should be optimized for the application by the
designer based on the actual LCD specifications.
2: A potentiometer for manual contrast adjustment is optional; it may be omitted entirely.
13.9 Segment Enables If the pin is a digital I/O, the corresponding TRIS bit
controls the data direction. Any bit set in the LCDSEx
The LCDSEx registers are used to select the pin function registers overrides any bit settings in the corresponding
for each segment pin. The selection allows each pin to TRIS register.
operate as either an LCD segment driver or a digital only
pin. To configure the pin as a segment pin, the corre- Note: On a Power-on Reset, these pins are
sponding bits in the LCDSEx registers must be set to ‘1’. configured as digital I/O.
V1
COM0
COM0 V0
V1
SEG0
V0
V1
SEG1
V0
SEG7
SEG6
SEG5
SEG4
SEG3
SEG2
SEG1
SEG0
V1
COM0-SEG0 V0
-V1
COM0-SEG1 V0
1 Frame
V2
COM0 V1
V0
COM1
V2
COM0
COM1 V1
V0
V2
SEG0 V1
V0
V2
SEG3
SEG2
SEG1
SEG0
SEG1 V1
V0
V2
V1
COM0-SEG0 V0
-V1
-V2
V2
V1
COM0-SEG1 V0
-V1
-V2
1 Frame
V2
COM0 V1
COM1
V0
COM0
V2
COM1 V1
V0
V2
SEG0
V1
V0
V2
SEG1
SEG3
SEG2
SEG1
SEG0
V1
V0
V2
V1
COM0-SEG0 V0
-V1
-V2
V2
V1
COM0-SEG1 V0
-V1
-V2
2 Frames
V3
V2
COM0
V1
COM1
V0
V3
COM0
V2
COM1
V1
V0
V3
V2
SEG0
V1
V0
V3
V2
SEG1
SEG3
SEG2
SEG1
SEG0
V1
V0
V3
V2
V1
COM0-SEG0 V0
-V1
-V2
-V3
V3
V2
V1
COM0-SEG1 V0
-V1
-V2
1 Frame
-V3
V3
V2
COM0
V1
COM1
V0
V3
COM0
V2
COM1
V1
V0
V3
V2
SEG0
V1
V0
V3
V2
SEG1
SEG3
SEG2
SEG1
SEG0
V1
V0
V3
V2
V1
COM0-SEG0 V0
-V1
-V2
-V3
V3
V2
V1
COM0-SEG1 V0
-V1
-V2
2 Frames
-V3
V2
COM0
V1
V0
COM2 V2
COM1 V1
COM1 V0
COM0
V2
COM2 V1
V0
V2
SEG0
V1
SEG2
V0
SEG2
SEG1
SEG0
V2
SEG1 V1
V0
V2
V1
COM0-SEG0 V0
-V1
-V2
V2
V1
COM0-SEG1 V0
-V1
-V2
1 Frame
V2
COM0
V1
V0
COM2
V2
COM1
V1
COM1
V0
COM0
V2
COM2
V1
V0
V2
SEG0
V1
V0
SEG2
SEG1
SEG0
V2
SEG1
V1
V0
V2
V1
COM0-SEG0 V0
-V1
-V2
V2
V1
COM0-SEG1 V0
-V1
-V2
2 Frames
V3
V2
COM0
V1
V0
COM2 V3
V2
COM1
V1
COM1
V0
COM0
V3
V2
COM2
V1
V0
V3
V2
SEG0
SEG2 V1
V0
SEG2
SEG1
SEG0
V3
V2
SEG1
V1
V0
V3
V2
V1
COM0-SEG0 V0
-V1
-V2
-V3
V3
V2
V1
COM0-SEG1 V0
-V1
-V2
-V3
1 Frame
V3
V2
COM0
V1
V0
COM2 V3
V2
COM1
V1
COM1
V0
COM0
V3
V2
COM2
V1
V0
V3
V2
SEG0
V1
V0
SEG2
SEG1
SEG0
V3
V2
SEG1
V1
V0
V3
V2
V1
COM0-SEG0 V0
-V1
-V2
-V3
V3
V2
V1
COM0-SEG1 V0
-V1
-V2
-V3
2 Frames
COM3
V3
COM2 V2
COM0 V1
V0
V3
COM1 V2
COM1 V1
COM0 V0
V3
V2
COM2 V1
V0
V3
V2
COM3 V1
V0
V3
V2
SEG0 V1
V0
SEG1
SEG0
V3
V2
SEG1 V1
V0
V3
V2
V1
COM0-SEG0 V0
-V1
-V2
-V3
V3
V2
V1
COM0-SEG1 V0
-V1
-V2
-V3
1 Frame
COM3
V3
COM2 V2
COM0 V1
V0
V3
COM1 V2
COM1 V1
COM0 V0
V3
V2
COM2 V1
V0
V3
V2
COM3 V1
V0
V3
V2
SEG0 V1
V0
SEG1
SEG0
V3
V2
SEG1 V1
V0
V3
V2
V1
COM0-SEG0 V0
-V1
-V2
-V3
V3
V2
V1
COM0-SEG1 V0
-V1
-V2
-V3
2 Frames
COM4
V3
V2
COM0 V1
COM3 COM5 V0
COM7 V3
V2
COM2 COM6 COM1 V1
V0
COM1
COM0 V3
V2
COM2 V1
V0
V3
V2
COM7 V1
V0
V3
V2
SEG0 V1
V0
SEG0
V3
V2
V1
V0
COM0-SEG0
-V1
-V2
-V3
V3
V2
V1
V0
COM1-SEG0
-V1
-V2
-V3
COM4
V3
V2
COM0 V1
COM3 COM5
V0
COM7
V3
V2
COM2 COM6 V1
COM1 COM1 V0
COM0 V3
V2
V1
COM2 V0
V3
V2
COM7 V1
V0
V3
V2
SEG0 V1
V0
SEG0
V3
V2
V1
COM0 - SEG0 V0
-V1
-V2
-V3
V3
V2
V1
COM1 - SEG0 V0
-V1
-V2
-V3
V3
V2
COM1 V1
V0
V3
V2
COM2 V1
V0
COM3 V3
V2
V1
V0
2 Frames
TFINT
TFWR Frame
Frame Frame
Boundary Boundary Boundary
V3
V2
V1
COM0 V0
V3
V2
V1
COM1 V0
V3
V2
V1
COM2 V0
V3
V2
V1
SEG0 V0
2 Frames
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/4 0
1
Sync with Set
1 Internal TMR0L TMR0IF
Programmable Clocks on Overflow
T0CKI Pin 0
Prescaler
T0SE (2 TCY Delay)
T0CS 8
3
T0PS<2:0>
8
PSA Internal Data Bus
Note: Upon Reset, Timer0 is enabled in 8-bit mode with clock input from T0CKI max. prescale.
FOSC/4 0
1
Sync with TMR0 Set
1 Internal TMR0L High Byte TMR0IF
T0CKI Pin Programmable 0 Clocks on Overflow
Prescaler 8
T0SE (2 TCY Delay)
T0CS 3 Read TMR0L
T0PS<2:0>
Write TMR0L
PSA
8
8
TMR0H
8
8
Internal Data Bus
Note: Upon Reset, Timer0 is enabled in 8-bit mode with clock input from T0CKI max. prescale.
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 FOSC clock source should not be selected if the timer will be used with the ECCP capture/compare
features.
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
T3GSS<1:0>
T3G 00 T3GSPM
TMR3CS<1:0> T3SYNC
SOSCO/SCLKI OUT(4)
TMRxGE
TxGPOL
TxG_IN
TxCKI
TxGVAL
TMRxGE
TxGPOL
TxGTM
TxG_IN
TxCKI
TxGVAL
TMRxGE
TxGPOL
TxGSPM
Cleared by Hardware on
TxGGO/ Set by Software Falling Edge of TxGVAL
TxDONE
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
TxDONE
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 x = Bit is unknown
4 1:1 to 1:16
TxOUTPS<3:0> Set TMRxIF
Postscaler
2
TxCKPS<1:0> TMRx Output
(to PWM)
TMRx/PRx
Reset Match
1:1, 1:4, 1:16
FOSC/4 TMRx Comparator PRx
Prescaler
8 8
8
Internal Data Bus
ALMTHDY
Compare Registers
ALRMVALx ALWDHR
with Masks
ALMINSEC
Repeat Counter
RTCC Interrupt
RTCC Interrupt Logic
Alarm Pulse
RTCC Pin
RTCOE
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
bit 7-4 YRTEN<3:0>: Binary Coded Decimal Value of Year’s Tens Digit bits
Contains a value from 0 to 9.
bit 3-0 YRONE<3:0>: Binary Coded Decimal Value of Year’s Ones Digit bits
Contains a value from 0 to 9.
REGISTER 17-8: MONTH: MONTH VALUE REGISTER(1) (RTCVALH when RTCPTR<1:0> = 10)
U-0 U-0 U-0 R/W-x R/W-x R/W-x R/W-x R/W-x
— — — MTHTEN0 MTHONE3 MTHONE2 MTHONE1 MTHONE0
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 17-11: HOUR: HOUR VALUE REGISTER(1) (RTCVALL when RTCPTR<1:0> = 01)
U-0 U-0 R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x
— — HRTEN1 HRTEN0 HRONE3 HRONE2 HRONE1 HRONE0
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 17-13: SECOND: SECOND VALUE REGISTER (RTCVALL when RTCPTR<1:0> = 00)
U-0 R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x
— SECTEN2 SECTEN1 SECTEN0 SECONE3 SECONE2 SECONE1 SECONE0
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
Hours
(24-hour format) Minutes Seconds
RTCCON1
Day
Second Hour:Minute Month Year
Day of Week
Note 1: Writing to the lower half of the MINSEC register resets all counters, allowing fraction of a second synchronization;
clock prescaler is held in Reset when RTCEN = 0.
RTCEN bit
ALRMEN bit
RTCC Pin
The Idle mode does not affect the operation of the timer The timer prescaler values can be reset only by writing
or alarm. to the SECONDS register. No device Reset can affect
the prescalers.
17.5 Reset
17.5.1 DEVICE RESET
When a device Reset occurs, the ALRMRPT register is
forced to its Reset state, causing the alarm to be
disabled (if enabled prior to the Reset). If the RTCC
was enabled, it will continue to operate when a basic
device Reset occurs.
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: If the ECCPx pin is configured as an out- EXAMPLE 18-1: CHANGING BETWEEN
put, a write to the port can cause a capture
CAPTURE PRESCALERS
condition.
CLRF CCP1CON ; Turn ECCP module off
MOVLW NEW_CAPT_PS ; Load WREG with the
; new prescaler mode
; value and ECCP ON
MOVWF CCP1CON ; Load CCP1CON with
; this value
TMR3H TMR3L
Set CCP1IF
C1TSEL0
C1TSEL1 TMR3
C1TSEL2 Enable
ECCP1 Pin
Prescaler and CCPR1H CCPR1L
1, 4, 16 Edge Detect
C1TSEL0 TMR1
C1TSEL1 Enable
C1TSEL2
4 TMR1H TMR1L
CCP1CON<3:0>
4
Q1:Q4
0 TMR1H TMR1L
1 TMR3H TMR3L
Compare Output S Q
Comparator Logic
Match
R
TRIS
4 Output Enable
CCPR1H CCPR1L
CCP1CON<3:0>
FIGURE 18-3: EXAMPLE SIMPLIFIED BLOCK DIAGRAM OF THE ENHANCED PWM MODE
CCPRxH (Slave)
PxB Output Pin(3)
Output TRIS(2)
Comparator R Q Controller
PxC Output Pin(3)
TMR2 (1)
S TRIS(2)
Note 1: The 8-bit TMR2 register is concatenated with the 2-bit internal Q clock, or 2 bits of the prescaler, to create the
10-bit time base.
2: The TRIS register value for each PWM output must be configured appropriately.
3: Any pin not used by an Enhanced PWM mode is available for alternate pin functions.
Period
PxA Active
PxD Modulated
PxA Inactive
PxD Inactive
Relationships:
• Period = 4 * TOSC * (PR2 + 1) * (TMR2 Prescale Value)
• Pulse Width = TOSC * (CCPRxL<7:0>:CCPxCON<5:4>) * (TMR2 Prescale Value)
• Delay = 4 * TOSC * (ECCPxDEL<6:0>)
Note 1: Dead-band delay is programmed using the ECCPxDEL register (Section 18.4.6 “Programmable Dead-Band
Delay Mode”).
Pulse PR2 + 1
PxM<1:0> Signal 0
Width
Period
PxA Modulated
Delay(1) Delay(1)
10 (Half-Bridge) PxB Modulated
PxA Active
PxD Modulated
PxA Inactive
PxD Inactive
Relationships:
• Period = 4 * TOSC * (PR2 + 1) * (TMR2 Prescale Value)
• Pulse Width = TOSC * (CCPRxL<7:0>:CCPxCON<5:4>) * (TMR2 Prescale Value)
• Delay = 4 * TOSC * (ECCPxDEL<6:0>)
Note 1: Dead-band delay is programmed using the ECCPxDEL register (Section 18.4.6 “Programmable Dead-Band
Delay Mode”).
FET
Driver +
PxA
-
Load
FET
Driver
+
PxB
-
V+
FET FET
Driver Driver
PxA
Load
FET FET
Driver Driver
PxB
FET QA QC FET
Driver Driver
PxA
Load
PxB
FET FET
Driver Driver
PxC
QB QD
V-
PxD
PxB(2)
PxC(2)
PxD(2)
(1) (1)
Reverse Mode
Period
Pulse Width
PxA(2)
PxB(2)
PxC(2)
PxD(2)
(1) (1)
Note 1: At this time, the TMR2 register is equal to the PR2 register.
2: The output signal is shown as active-high.
PxA (Active-High)
PxB (Active-High)
Pulse Width
PxC (Active-High)
(2)
PxD (Active-High)
Pulse Width
Note 1: The direction bit, PxM1 of the CCPxCON register, is written any time during the PWM cycle.
2: When changing directions, the PxA and PxC signals switch before the end of the current PWM cycle. The
modulated PxB and PxD signals are inactive at this time. The length of this time is: (1/FOSC) • TMR2 Prescale Value.
PxA
PxB
PW
PxC
PxD PW
TON
External Switch C
TOFF
External Switch D
18.4.3 START-UP CONSIDERATIONS pin output drivers. The completion of a full PWM cycle
is indicated by the TMR2IF or TMR4IF bit of the PIR1
When any PWM mode is used, the application
or PIR5 register being set as the second PWM period
hardware must use the proper external pull-up and/or
begins.
pull-down resistors on the PWM output pins.
Note: When the microcontroller is released from 18.4.4 ENHANCED PWM AUTO-
Reset, all of the I/O pins are in the high- SHUTDOWN MODE
impedance state. The external circuits The PWM mode supports an Auto-Shutdown mode that
must keep the power switch devices in the will disable the PWM outputs when an external
OFF state until the microcontroller drives shutdown event occurs. Auto-Shutdown mode places
the I/O pins with the proper signal levels or the PWM output pins into a predetermined state. This
activates the PWM output(s). mode is used to help prevent the PWM from damaging
The CCPxM<1:0> bits of the CCPxCON register allow the application.
the user to choose whether the PWM output signals are The auto-shutdown sources are selected using the
active-high or active-low for each pair of PWM output ECCPxAS<2:0> bits (ECCPxAS<6:4>). A shutdown
pins (PxA/PxC and PxB/PxD). The PWM output event may be generated by:
polarities must be selected before the PWM pin output • A logic ‘0’ on the pin that is assigned the FLT0
drivers are enabled. Changing the polarity configura- input function
tion while the PWM pin output drivers are enabled is
• Comparator C1
not recommended since it may result in damage to the
application circuits. • Comparator C2
• Setting the ECCPxASE bit in firmware
The PxA, PxB, PxC and PxD output latches may not be
in the proper states when the PWM module is A shutdown condition is indicated by the ECCPxASE
initialized. Enabling the PWM pin output drivers, at the (Auto-Shutdown Event Status) bit (ECCPxAS<7>). If
same time as the Enhanced PWM modes, may cause the bit is a ‘0’, the PWM pins are operating normally. If
damage to the application circuit. The Enhanced PWM the bit is a ‘1’, the PWM outputs are in the shutdown
modes must be enabled in the proper Output mode and state.
complete a full PWM cycle before enabling the PWM
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 auto-shutdown condition is a level-based signal, not an edge-based signal. As long as the level is
present, the auto-shutdown will persist.
2: Writing to the ECCPxASE bit is disabled while an auto-shutdown condition persists.
3: Once the auto-shutdown condition has been removed and the PWM restarted (either through firmware or
auto-restart), the PWM signal will always restart at the beginning of the next PWM period.
PWM Period
Shutdown Event
ECCPxASE bit
PWM Activity
Normal PWM
ECCPxASE
Cleared by
Start of Shutdown Shutdown PWM
Firmware
PWM Period Event Occurs Event Clears Resumes
18.4.5 AUTO-RESTART MODE The module will wait until the next PWM period begins,
however, before re-enabling the output pin. This behav-
The Enhanced PWM can be configured to automatically
ior allows the auto-shutdown with auto-restart features
restart the PWM signal once the auto-shutdown condi-
to be used in applications based on current mode of
tion has been removed. Auto-restart is enabled by
PWM control.
setting the PxRSEN bit (ECCPxDEL<7>).
If auto-restart is enabled, the ECCPxASE bit will
remain set as long as the auto-shutdown condition is
active. When the auto-shutdown condition is removed,
the ECCPxASE bit will be cleared via hardware and
normal operation will resume.
PWM Period
Shutdown Event
ECCPxASE bit
PWM Activity
Normal PWM
FET
Driver +
PxA V
-
Load
FET
Driver
+
PxB V
-
V-
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
18.4.7 PULSE STEERING MODE While the PWM Steering mode is active, the
CCPxM<1:0> bits (CCPxCON<1:0>) select the PWM
In Single Output mode, pulse steering allows any of the
output polarity for the Px<D:A> pins.
PWM pins to be the modulated signal. Additionally, the
same PWM signal can simultaneously be available on The PWM auto-shutdown operation also applies to the
multiple pins. PWM Steering mode, as described in Section 18.4.4
“Enhanced PWM Auto-shutdown mode”. An auto-
Once the Single Output mode is selected
shutdown event will only affect pins that have PWM
(CCPxM<3:2> = 11 and PxM<1:0> = 00 of the
outputs enabled.
CCPxCON register), the user firmware can bring out
the same PWM signal to one, two, three or four output
pins by setting the appropriate STR<D:A> bits
(PSTRxCON<3:0>), as provided in Table 18-3.
Note: The associated TRIS bits must be set to
output (‘0’) to enable the pin output driver
in order to see the PWM signal on the pin.
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-6 CMPL<1:0>: Complementary Mode Output Assignment Steering Sync bits
00 =See STR<D:A>
01 =PA and PB are selected as the complementary output pair
10 =PA and PC are selected as the complementary output pair
11 =PA and PD are selected as the complementary output pair
bit 5 Unimplemented: Read as ‘0’
bit 4 STRSYNC: Steering Sync bit
1 = Output steering update occurs on the next PWM period
0 = Output steering update occurs at the beginning of the instruction cycle boundary
bit 3 STRD: Steering Enable bit D
1 = PxD pin has the PWM waveform with polarity control from CCPxM<1:0>
0 = PxD pin is assigned to port pin
bit 2 STRC: Steering Enable bit C
1 = PxC pin has the PWM waveform with polarity control from CCPxM<1:0>
0 = PxC pin is assigned to port pin
bit 1 STRB: Steering Enable bit B
1 = PxB pin has the PWM waveform with polarity control from CCPxM<1:0>
0 = PxB pin is assigned to port pin
bit 0 STRA: Steering Enable bit A
1 = PxA pin has the PWM waveform with polarity control from CCPxM<1:0>
0 = PxA pin is assigned to port pin
Note 1: The PWM Steering mode is available only when the CCPxCON register bits, CCPxM<3:2> = 11 and
PxM<1:0> = 00.
PORT Data
0
TRIS
Note 1: Port outputs are configured as displayed when
the CCPxCON register bits, PxM<1:0> = 00
and CCPxM<3:2> = 11.
2: Single PWM output requires setting at least
one of the STRx bits.
PWM Period
PWM
STRn
P1n = PWM
PWM
STRn
P1n = PWM
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
CCP8
CCP8 CCP9 CCP10
Devices with 32 Kbytes
TMR5H TMR5L
Set CCP5IF
C5TSEL0 TMR5
CCP5 Pin Enable
Prescaler and CCPR5H CCPR5L
1, 4, 16 Edge Detect
TMR1
C5TSEL0 Enable
4 TMR1H TMR1L
CCP5CON<3:0> Set CCP4IF
4
Q1:Q4
4
CCP4CON<3:0>
C4TSEL1 TMR3H TMR3L
C4TSEL0
TMR3
Enable
CCP4 Pin
Prescaler and CCPR4H CCPR4L
1, 4, 16 Edge Detect
TMR1
Enable
C4TSEL0
TMR1H TMR1L
C4TSEL1
Note: This block diagram uses CCP4 and CCP5, and their appropriate timers as an example. For details on all of
the CCP modules and their timer assignments, see Table 19-2 and Table 19-3.
19.2.3 SOFTWARE INTERRUPT Switching from one capture prescaler to another may
generate an interrupt. Doing that will also not clear the
When the Capture mode is changed, a false capture
prescaler counter – meaning the first capture may be
interrupt may be generated. The user should keep the
from a non-zero prescaler.
CCP4IE bit (PIE4<1>) clear to avoid false interrupts
and should clear the flag bit, CCP4IF, following any Example 19-1 shows the recommended method for
such change in operating mode. switching between capture prescalers. This example
also clears the prescaler counter and will not generate
19.2.4 CCP PRESCALER the “false” interrupt.
There are four prescaler settings in Capture mode.
They are specified as part of the operating mode EXAMPLE 19-1: CHANGING BETWEEN
selected by the mode select bits (CCP4M<3:0>). CAPTURE PRESCALERS
Whenever the CCP module is turned off, or the CCP CLRF CCP4CON ; Turn CCP module off
module is not in Capture mode, the prescaler counter MOVLW NEW_CAPT_PS ; Load WREG with the
is cleared. This means that any Reset will clear the ; new prescaler mode
prescaler counter. ; value and CCP ON
MOVWF CCP4CON ; Load CCP4CON with
; this value
Compare Output S Q
Comparator
Match Logic
R
TRIS
4 Output Enable
CCP5CON<3:0>
TMR1H TMR1L 0
TMR5H TMR5L 1
C5TSEL0
0 TMR1H TMR1L
1 TMR3H TMR3L
Special Event Trigger
(Timer1/Timer3 Reset)
C4TSEL1
C4TSEL0
Compare Output S Q
Comparator
Match Logic
R
TRIS
4 Output Enable
CCPR4H CCPR4L
CCP4CON<3:0>
Note: This block diagram uses CCP4 and CCP5 and their appropriate timers as an example. For details on all of
the CCP modules and their timer assignments, see Table 19-2 and Table 19-3.
CCPR4L
EQUATION 19-1: PWM PERIOD
CALCULATION
PWM Period = [(PR2) + 1] • 4 • TOSC •
(TMR2 Prescale Value)
CCPR4H (Slave)
PWM frequency is defined as 1/[PWM period].
Comparator R Q When TMR2 is equal to PR2, the following three events
RC2/CCP4 occur on the next increment cycle:
TMR2 (Note 1) • TMR2 is cleared
S
• The CCP4 pin is set
Comparator TRISC<2> (An exception: If PWM Duty Cycle = 0%, the
Clear Timer, CCP4 pin will not be set)
CCP4 Pin and
Latch D.C. • The PWM duty cycle is latched from CCPR4L into
PR2
CCPR4H
Note: The Timer2 postscalers (see
Note 1: The 8-bit TMR2 value is concatenated with the 2-bit
internal Q clock, or 2 bits of the prescaler, to create the Section 16.0 “Timer2/4/6/8 Modules”)
10-bit time base. are not used in the determination of the
2: CCP4 and its appropriate timers are used as an PWM frequency. The postscaler could be
example. For details on all of the CCP modules and
their timer assignments, see Table 19-2 and Table 19-3. used to have a servo update rate at a dif-
ferent frequency than the PWM output.
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: In Master mode, the overflow bit is not set since each new reception (and transmission) is initiated by
writing to the SSPxBUF register.
2: When enabled, these pins must be properly configured as inputs or outputs.
3: SSPxADD = 0 is not supported.
4: Bit combinations not specifically listed here are either reserved or implemented in I2C mode 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
Note 1: This bit has no effect in Slave modes that Start and Stop condition detection is explicitly listed as enabled.
2: For daisy-chained SPI operation; allows the user to ignore all but the last received byte. SSPOV is still set
when a new byte is received and BF = 1, but hardware continues to write the most recent byte to
SSPxBUF.
SDOx SDIx
SDIx SDOx
Shift Register Shift Register
(SSPxSR) (SSPxSR)
Write to
SSPxBUF
SCKx
(CKP = 0
CKE = 0)
SCKx
(CKP = 1
CKE = 0)
4 Clock
SCKx Modes
(CKP = 0
CKE = 1)
SCKx
(CKP = 1
CKE = 1)
Input
Sample
(SMP = 1)
SSPxIF
Next Q4 Cycle
SSPxSR to after Q2
SSPxBUF
While in Sleep mode, the slave can transmit/receive If the SPI is used in Slave mode with CKE
data. When a byte is received, the device can be set, then the SSx pin control must be
configured to wake-up from Sleep. enabled.
When the SPI module resets, the bit counter is forced
20.3.8 SLAVE SELECT to ‘0’. This can be done by either forcing the SSx pin to
SYNCHRONIZATION a high level or clearing the SSPEN bit.
The SSx pin allows a Synchronous Slave mode. The To emulate two-wire communication, the SDOx pin can
SPI must be in Slave mode with the SSx pin control be connected to the SDIx pin. When the SPI needs to
enabled (SSPxCON1<3:0> = 04h). When the SSx pin operate as a receiver, the SDOx pin can be configured
is low, transmission and reception are enabled and the as an input. This disables transmissions from the
SDOx pin is driven. When the SSx pin goes high, the SDOx. The SDIx can always be left as an input (SDIx
SDOx pin is no longer driven, even if in the middle of a function) since it cannot create a bus conflict.
SSx
SCKx
(CKP = 0
CKE = 0)
SCKx
(CKP = 1
CKE = 0)
Write to
SSPxBUF
SDIx bit 0
(SMP = 0) bit 7 bit 7
Input
Sample
(SMP = 0)
SSPxIF
Interrupt
Flag
Next Q4 Cycle
SSPxSR to after Q2
SSPxBUF
SSx
Optional
SCKx
(CKP = 0
CKE = 0)
SCKx
(CKP = 1
CKE = 0)
Write to
SSPxBUF
SDIx
(SMP = 0) bit 7 bit 0
Input
Sample
(SMP = 0)
SSPxIF
Interrupt
Flag
Next Q4 Cycle
SSPxSR to after Q2
SSPxBUF
SSx
Not Optional
SCKx
(CKP = 0
CKE = 1)
SCKx
(CKP = 1
CKE = 1)
Write to
SSPxBUF
SDIx
(SMP = 0) bit 0
bit 7
Input
Sample
(SMP = 0)
SSPxIF
Interrupt
Flag
Next Q4 Cycle
after Q2
SSPxSR to
SSPxBUF
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-6 SSCON<1:0>: SSDMA Output Control bits (Master modes only)
11 = SSDMA is asserted for the duration of 4 bytes; DLYINTEN is always reset low
01 = SSDMA is asserted for the duration of 2 bytes; DLYINTEN is always reset low
10 = SSDMA is asserted for the duration of 1 byte; DLYINTEN is always reset low
00 = SSDMA is not controlled by the DMA module; DLYINTEN bit is software programmable
bit 5 TXINC: Transmit Address Increment Enable bit
Allows the transmit address to increment as the transfer progresses.
1 = The transmit address is to be incremented from the initial value of TXADDR<11:0>
0 = The transmit address is always set to the initial value of TXADDR<11:0>
bit 4 RXINC: Receive Address Increment Enable bit
Allows the receive address to increment as the transfer progresses.
1 = The received address is to be incremented from the initial value of RXADDR<11:0>
0 = The received address is always set to the initial value of RXADDR<11:0>
bit 3-2 DUPLEX<1:0>: Transmit/Receive Operating Mode Select bits
10 = SPI DMA operates in Full-Duplex mode, data is simultaneously transmitted and received
01 = DMA operates in Half-Duplex mode, data is transmitted only
00 = DMA operates in Half-Duplex mode, data is received only
bit 1 DLYINTEN: Delay Interrupt Enable bit
Enables the interrupt to be invoked after the number of TCY cycles, specified in DLYCYC<3:0>, has
elapsed from the latest completed transfer.
1 = The interrupt is enabled, SSCON<1:0> must be set to ‘00’
0 = The interrupt is disabled
bit 0 DMAEN: DMA Operation Start/Stop bit
This bit is set by the users’ software to start the DMA operation. It is reset back to zero by the DMA
engine when the DMA operation is completed or aborted.
1 = DMA is in session
0 = DMA is not in session
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
20.4.5 INTERRUPTS
The SPI DMA module alters the behavior of the
SSP1IF interrupt flag. In normal non-DMA modes, the
SSP1IF is set once after every single byte is transmit-
ted/received through the MSSP1 module. When
MSSP1 is used with the SPI DMA module, the SSP1IF
interrupt flag will be set according to the user-selected
INTLVL<3:0> value specified in the DMACON2
register. The SSP1IF interrupt condition will also be
generated once the SPI DMA transaction has fully
completed and the DMAEN bit has been cleared by
hardware.
The SSP1IF flag becomes set once the DMA byte count
value indicates that the specified INTLVLx has been
reached. For example, if DMACON2<3:0> = 0101
(16 bytes remaining), the SSP1IF interrupt flag will
become set once DMABC reaches 00Fh. If user
firmware then clears the SSP1IF interrupt flag, the flag
will not be set again by the hardware until after all bytes
have been fully transmitted and the DMA transaction is
complete.
Note: User firmware may modify the INTLVLx
bits while a DMA transaction is in progress
(DMAEN = 1). If an INTLVLx value is
selected which is higher than the actual
remaining number of bytes (indicated by
DMABC + 1), the SSP1IF interrupt flag
will immediately become set.
For example, if DMABC = 00Fh (implying 16 bytes are
remaining) and user firmware writes ‘1111’ to
INTLVL<3:0> (interrupt when 576 bytes are remaining),
the SSP1IF interrupt flag will immediately become set.
If user firmware clears this interrupt flag, a new inter-
rupt condition will not be generated until either: user
firmware again writes INTLVLx with an interrupt level
higher than the actual remaining level, or the DMA
transaction completes and the DMAEN bit is cleared.
Note: If the INTLVLx bits are modified while a
DMA transaction is in progress, care
should be taken to avoid inadvertently
changing the DLYCYC<3:0> value.
InitSPIPins:
movlb 0x0E ;Select bank 14, for access to ODCON1 register
bcf ODCON1, SSP1_OD ;Let’s not use open drain outputs in this example
bcf LATA, RA3 ;Initialize our (to be) SCK1 pin low (idle).
bcf LATA, RA1 ;Initialize our (to be) SDO1 pin to an idle state
bcf TRISA, RA1 ;Make SDO1 output, and drive low
bcf TRISA, RA3 ;Make SCK1 output, and drive low (idle state)
bsf TRISA, RA0 ;SDI2 is an input, make sure it is tri-stated
InitMSSP2:
clrf SSP1STAT ;CKE = 0, SMP = 0 (sampled at middle of bit)
movlw b'00000000' ;CKP = 0, SPI Master mode, Fosc/4
movwf SSP1CON1 ;MSSP2 initialized
bsf SSP1CON1, SSPEN ;Enable the MSSP2 module
InitSPIDMA:
movlw b'00111010' ;Full duplex, RX/TXINC enabled, no SSCON
movwf DMACON1 ;DLYINTEN is set, so DLYCYC3:DLYCYC0 = 1111
movlw b'11110000' ;Minimum delay between bytes, interrupt
movwf DMACON2 ;only once when the transaction is complete
PrepareTransfer:
movlw HIGH(DestBuf) ;Get high byte of DestBuf address (0x05)
movwf RXADDRH ;Load upper four bits of the RXADDR register
movlw LOW(DestBuf) ;Get low byte of the DestBuf address (0x00)
movwf RXADDRL ;Load lower eight bits of the RXADDR register
movlw 0x01 ;Lets move 0x200 (512) bytes in one DMA xfer
movwf DMABCH ;Load the upper two bits of DMABC register
movlw 0xFF ;Actual bytes transferred is (DMABC + 1), so
movwf DMABCL ;we load 0x01FF into DMABC to xfer 0x200 bytes
BeginXfer:
bsf DMACON1, DMAEN ;The SPI DMA module will now begin transferring
;the data taken from SrcBuf, and will store
;received bytes into DestBuf.
Addr Match
SSPxMSK holds the slave address mask value when
Match Detect
the module is configured for 7-Bit Address Masking
Address Mask mode. While it is a separate register, it shares the same
SFR address as SSPxADD; it is only accessible when
the SSPM<3:0> bits are specifically set to permit
SSPxADD reg
access. Additional details are provided in
Section 20.5.4.3 “7-Bit Address Masking Mode”.
In receive operations, SSPxSR and SSPxBUF
Start and Set, Reset
Stop bit Detect S, P bits together, create a double-buffered receiver. When
(SSPxSTAT reg) SSPxSR receives a complete byte, it is transferred to
SSPxBUF and the SSPxIF interrupt is set.
Note: Only port I/O names are used in this diagram During transmission, the SSPxBUF is not double-
for the sake of brevity. Refer to the text for a buffered. A write to SSPxBUF will write to both
full list of multiplexed functions. SSPxBUF and SSPxSR.
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 enabled, the SDAx and SCLx pins must be configured as inputs.
2: Bit combinations not specifically listed here are either reserved or implemented in SPI mode only.
3: When SSPM<3:0> = 1001, any reads or writes to the SSPxADD SFR address actually accesses the
SSPxMSK register.
4: This mode is only available when 7-Bit Address Masking mode is selected (MSSPMSK Configuration bit
is ‘1’).
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 value that will be transmitted when the user initiates an Acknowledge sequence at the end of a
receive.
2: If the I2C module is active, these bits may not be set (no spooling) and the SSPxBUF may not be written
(or writes to the SSPxBUF are disabled).
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: This bit has no effect in Slave modes that Start and Stop condition detection is explicitly listed as enabled.
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: If the I2C module is active, this bit may not be set (no spooling) and the SSPxBUF may not be written (or
writes to the SSPxBUF are disabled).
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: This bit has no effect in Slave modes that Start and Stop condition detection is explicitly listed as enabled.
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: This register shares the same SFR address as SSPxADD and is only addressable in select MSSPx
operating modes. See Section 20.5.4.3 “7-Bit Address Masking Mode” for more details.
2: MSK0 is not used as a mask bit in 7-bit addressing.
PIC18F97J94 FAMILY
Receiving Address R/W = 0 Receiving Data ACK Receiving Data ACK
SDAx A7 A6 A5 A4 A3 A2 A1 ACK D7 D6 D5 D4 D3 D2 D1 D0 D7 D6 D5 D4 D3 D2 D1 D0
SCLx 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S P
BF (SSPxSTAT<0>)
Cleared in software
SSPxBUF is read
SSPOV (SSPxCON1<6>)
SSPOV is set
because SSPxBUF is
still full. ACK is not sent.
CKP (SSPxCON<4>)
(CKP does not reset to ‘0’ when SEN = 0)
2012-2016 Microchip Technology Inc.
FIGURE 20-9: I2C SLAVE MODE TIMING WITH SEN = 0 AND MSK<5:1> = 01011 (RECEPTION, 7-BIT ADDRESS)
2012-2016 Microchip Technology Inc.
SCLx 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S P
BF (SSPxSTAT<0>)
Cleared in software
SSPxBUF is read
SSPOV (SSPxCON1<6>)
SSPOV is set
because SSPxBUF is
still full. ACK is not sent.
PIC18F97J94 FAMILY
CKP (SSPxCON<4>)
(CKP does not reset to ‘0’ when SEN = 0)
Note 1: x = Don’t care (i.e., address bit can either be a ‘1’ or a ‘0’).
2: In this example, an address equal to A7.A6.A5.X.A3.X.X will be Acknowledged and cause
an interrupt.
DS30000575C-page 381
FIGURE 20-10: I2C SLAVE MODE TIMING (TRANSMISSION, 7-BIT ADDRESS)
DS30000575C-page 382
PIC18F97J94 FAMILY
Receiving Address R/W = 1 Transmitting Data Transmitting Data
ACK ACK
SDAx A7 A6 A5 A4 A3 A2 A1 ACK D7 D6 D5 D4 D3 D2 D1 D0 D7 D6 D5 D4 D3 D2 D1 D0
SCLx 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S
Data in SCLx held low P
sampled while CPU
responds to SSPxIF
BF (SSPxSTAT<0>)
Cleared in software Cleared in software
From SSPxIF ISR From SSPxIF ISR
SSPxBUF is written in software SSPxBUF is written in software
Clear by reading
CKP (SSPxCON<4>)
Receive First Byte of Address Receive Second Byte of Address Receive Data Byte Receive Data Byte
R/W = 0 ACK
SCLx 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S P
Bus master
terminates
SSPxIF (PIR1<3> or PIR3<7>) transfer
BF (SSPxSTAT<0>)
SSPOV is set
because SSPxBUF is
still full. ACK is not sent.
UA (SSPxSTAT<1>)
PIC18F97J94 FAMILY
UA is set indicating that Cleared by hardware Cleared by hardware when
the SSPxADD needs to be when SSPxADD is updated SSPxADD is updated with high
updated with low byte of address byte of address
Note 1: x = Don’t care (i.e., address bit can either be a ‘1’ or a ‘0’).
2: In this example, an address equal to A9.A8.A7.A6.A5.X.A3.A2.X.X will be Acknowledged
and cause an interrupt.
3: Note that the Most Significant bits of the address are not affected by the bit masking.
DS30000575C-page 383
FIGURE 20-12: I2C SLAVE MODE TIMING WITH SEN = 0 (RECEPTION, 10-BIT ADDRESS)
DS30000575C-page 384
PIC18F97J94 FAMILY
Clock is held low until Clock is held low until
update of SSPxADD has update of SSPxADD has
taken place taken place
Receive First Byte of Address Receive Second Byte of Address Receive Data Byte Receive Data Byte
R/W = 0 ACK
SCLx 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S P
Bus master
terminates
SSPxIF (PIR1<3> or PIR3<7>) transfer
BF (SSPxSTAT<0>)
SSPOV is set
because SSPxBUF is
still full. ACK is not sent.
UA (SSPxSTAT<1>)
Bus master
terminates
Clock is held low until Clock is held low until transfer
update of SSPxADD has update of SSPxADD has Clock is held low until
taken place taken place CKP is set to ‘1’
R/W = 0
Receive First Byte of Address Receive Second Byte of Address Receive First Byte of Address R/W = 1 Transmitting Data Byte ACK
SDAx 1 1 1 1 0 A9 A8 ACK A7 A6 A5 A4 A3 A2 A1 A0 ACK 1 1 1 1 0 A9 A8 ACK D7 D6 D5 D4 D3 D2 D1 D0
SCLx 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S Sr P
BF (SSPxSTAT<0>)
PIC18F97J94 FAMILY
UA is set indicating that
SSPxADD needs to be
updated
CKP (SSPxCON1<4>)
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
SDAx DX DX – 1
SCLx
Master Device
CKP Asserts Clock
Master Device
Deasserts Clock
WR
SSPxCON1
PIC18F97J94 FAMILY
Clock is not held low
because buffer full bit is
clear prior to falling edge Clock is held low until Clock is not held low
of 9th clock CKP is set to ‘1’ because ACK = 1
SCLx 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S P
BF (SSPxSTAT<0>)
Cleared in software
SSPxBUF is read
SSPOV (SSPxCON1<6>)
SSPOV is set
because SSPxBUF is
still full. ACK is not sent.
CKP (SSPxCON<4>)
CKP
If BF is cleared written
prior to the falling to ‘1’ in
edge of the 9th clock, software
CKP will not be reset BF is set after falling
to ‘0’ and no clock edge of the 9th clock,
stretching will occur CKP is reset to ‘0’ and
2012-2016 Microchip Technology Inc.
SCLx 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S P
BF (SSPxSTAT<0>)
SSPxBUF is written with Dummy read of SSPxBUF Dummy read of SSPxBUF
contents of SSPxSR to clear BF flag to clear BF flag
SSPOV (SSPxCON1<6>)
SSPOV is set
because SSPxBUF is
still full. ACK is not sent.
UA (SSPxSTAT<1>)
PIC18F97J94 FAMILY
UA is set indicating that Cleared by hardware when Cleared by hardware when
the SSPxADD needs to be SSPxADD is updated with low SSPxADD is updated with high
updated byte of address after falling edge byte of address after falling edge
of ninth clock of ninth clock
Note: An update of the SSPxADD register before the falling edge of the
ninth clock will have no effect on UA and UA will remain set.
DS30000575C-page 389
PIC18F97J94 FAMILY
20.5.8 GENERAL CALL ADDRESS If the general call address matches, the SSPxSR is
SUPPORT transferred to the SSPxBUF, the BF flag bit is set
(eighth bit), and on the falling edge of the ninth bit (ACK
The addressing procedure for the I2C bus is such that
bit), the SSPxIF interrupt flag bit is set.
the first byte after the Start condition usually
determines which device will be the slave addressed by When the interrupt is serviced, the source for the
the master. The exception is the general call address interrupt can be checked by reading the contents of the
which can address all devices. When this address is SSPxBUF. The value can be used to determine if the
used, all devices should, in theory, respond with an address was device-specific or a general call address.
Acknowledge. In 10-Bit Addressing mode, the SSPxADD is required to
The general call address is one of eight addresses be updated for the second half of the address to match
reserved for specific purposes by the I2C protocol. It and the UA bit is set (SSPxSTAT<1>). If the general call
consists of all ‘0’s with R/W = 0. address is sampled when the GCEN bit is set, while the
slave is configured in 10-Bit Addressing mode, then the
The general call address is recognized when the
second half of the address is not necessary, the UA bit
General Call Enable bit, GCEN, is enabled (SSPx-
will not be set and the slave will begin receiving data
CON2<7> set). Following a Start bit detect, eight bits
after the Acknowledge (Figure 20-17).
are shifted into the SSPxSR and the address is
compared against the SSPxADD. It is also compared to
the general call address and fixed in hardware.
SCLx
1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S
SSPxIF
BF (SSPxSTAT<0>)
Cleared in Software
SSPxBUF is Read
SSPOV (SSPxCON1<6>) ‘0’
GCEN (SSPxCON2<7>)
‘1’
Internal SSPM<3:0>
Data Bus SSPxADD<6:0>
Read Write
SSPxBUF Baud
Rate
Generator
SDAx Shift
Clock Arbitrate/WCOL Detect
SDAx In Clock
SSPxSR
(hold off clock source)
MSb LSb
Receive Enable
Acknowledge
Generate
SCLx
SSPM<3:0> SSPxADD<6:0>
SDAx DX DX – 1
BRG Decrements on
Q2 and Q4 Cycles
BRG
03h 02h 01h 00h (hold off) 03h 02h
Value
SCLx
TBRG
S
Sr = Repeated Start
PIC18F97J94 FAMILY
Write SSPxCON2<0> (SEN = 1), ACKSTAT in
Start condition begins SSPxCON2 = 1
From slave, clear ACKSTAT bit (SSPxCON2<6>)
SEN = 0
Transmitting Data or Second Half
Transmit Address to Slave R/W = 0
of 10-bit Address ACK
SDAx A7 A6 A5 A4 A3 A2 A1 ACK = 0 D7 D6 D5 D4 D3 D2 D1 D0
BF (SSPxSTAT<0>)
PEN
R/W
2012-2016 Microchip Technology Inc.
FIGURE 20-24: I 2C MASTER MODE WAVEFORM (RECEPTION, 7-BIT ADDRESS)
2012-2016 Microchip Technology Inc.
Write to SSPxCON2<4>
to start Acknowledge sequence,
SDAx = ACKDT (SSPxCON2<5>) = 0
Write to SSPxCON2<0> (SEN = 1),
begin Start condition ACK from master, Set ACKEN, start Acknowledge sequence,
Master configured as a receiver SDAx = ACKDT = 0 SDAx = ACKDT = 1
SEN = 0 by programming SSPxCON2<3> (RCEN = 1)
PEN bit = 1
Write to SSPxBUF occurs here, RCEN cleared RCEN = 1, start RCEN cleared
ACK from Slave next receive automatically written here
start XMIT automatically
Transmit Address to Slave R/W = 1 Receiving Data from Slave Receiving Data from Slave
SDAx A7 A6 A5 A4 A3 A2 A1 ACK D7 D6 D5 D4 D3 D2 D1 D0 ACK D7 D6 D5 D4 D3 D2 D1 D0 ACK
Bus master
ACK is not sent terminates
transfer
1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
SCLx S P
Data shifted in on falling edge of CLK Set SSPxIF at end
of receive Set SSPxIF interrupt
Set SSPxIF interrupt at end of Acknowledge
Set SSPxIF interrupt sequence
at end of receive at end of Acknowledge
SSPxIF sequence
Set P bit
Cleared in software Cleared in software Cleared in software Cleared in software (SSPxSTAT<4>)
Cleared in
SDAx = 0, SCLx = 1, software and SSPxIF
while CPU
responds to SSPxIF
BF
PIC18F97J94 FAMILY
(SSPxSTAT<0>) Last bit is shifted into SSPxSR and
contents are unloaded into SSPxBUF
SSPOV
ACKEN
DS30000575C-page 399
PIC18F97J94 FAMILY
20.5.15 ACKNOWLEDGE SEQUENCE 20.5.16 STOP CONDITION TIMING
TIMING A Stop bit is asserted on the SDAx pin at the end of a
An Acknowledge sequence is enabled by setting the receive/transmit by setting the Stop Sequence Enable
Acknowledge Sequence Enable bit, ACKEN (SSPx- bit, PEN (SSPxCON2<2>). At the end of a receive/
CON2<4>). When this bit is set, the SCLx pin is pulled low transmit, the SCLx line is held low after the falling edge
and the contents of the Acknowledge data bit are pre- of the ninth clock. When the PEN bit is set, the master
sented on the SDAx pin. If the user wishes to generate an will assert the SDAx line low. When the SDAx line is
Acknowledge, then the ACKDT bit should be cleared. If sampled low, the Baud Rate Generator is reloaded and
not, the user should set the ACKDT bit before starting an counts down to 0. When the Baud Rate Generator
Acknowledge sequence. The Baud Rate Generator then times out, the SCLx pin will be brought high and one
counts for one rollover period (TBRG) and the SCLx pin is TBRG (Baud Rate Generator rollover count) later, the
deasserted (pulled high). When the SCLx pin is sampled SDAx pin will be deasserted. When the SDAx pin is
high (clock arbitration), the Baud Rate Generator counts sampled high while SCLx is high, the P bit
for TBRG; the SCLx pin is then pulled low. Following this, (SSPxSTAT<4>) is set. A TBRG later, the PEN bit is
the ACKEN bit is automatically cleared, the Baud Rate cleared and the SSPxIF bit is set (Figure 20-26).
Generator is turned off and the MSSPx module then goes
into an inactive state (Figure 20-25). 20.5.16.1 WCOL Status Flag
If the user writes the SSPxBUF when a Stop sequence
20.5.15.1 WCOL Status Flag is in progress, then the WCOL bit is set and the
If the user writes the SSPxBUF when an Acknowledge contents of the buffer are unchanged (the write doesn’t
sequence is in progress, then WCOL is set and the occur).
contents of the buffer are unchanged (the write doesn’t
occur).
SCLx 8 9
SSPxIF
Cleared in
SSPxIF Set at Software
the End of Receive Cleared in
Software SSPxIF Set at the End
of Acknowledge Sequence
Note: TBRG = one Baud Rate Generator period.
TBRG
SCLx
SDAx ACK
P
TBRG TBRG TBRG
SCLx Brought High After TBRG
SDAx is Asserted Low Before Rising Edge of Clock
to Set up Stop Condition
SDAx
BCLxIF
SDAx
SCLx
Set SEN, Enable Start SEN Cleared Automatically Because of Bus Collision,
Condition if SDAx = 1, SCLx = 1 MSSPx module Reset into Idle State
SEN
SDAx Sampled Low Before
Start Condition, Set BCLxIF,
S bit and SSPxIF Set Because
BCLxIF SDAx = 0, SCLx = 1
SSPxIF and BCLxIF are
Cleared in Software
SSPxIF
TBRG TBRG
SDAx
FIGURE 20-30: BRG RESET DUE TO SDAx ARBITRATION DURING START CONDITION
SDAx = 0, SCLx = 1
Set S Set SSPxIF
Less than TBRG
TBRG
SCLx S
SCLx Pulled Low After BRG
Time-out
SEN
Set SEN, Enable Start
Sequence if SDAx = 1, SCLx = 1
BCLxIF ‘0’
SSPxIF
SDAx = 0, SCLx = 1, Interrupts Cleared
Set SSPxIF in Software
SDAx
SCLx
RSEN
BCLxIF
Cleared in Software
S ‘0’
SSPxIF ‘0’
TBRG TBRG
SDAx
SCLx
S ‘0’
SSPxIF
PEN
BCLxIF
P ‘0’
SSPxIF ‘0’
SDAx
SCLx goes Low Before SDAx goes High,
Assert SDAx
Set BCLxIF
SCLx
PEN
BCLxIF
P ‘0’
SSPxIF ‘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
Note 1: This feature is only available in Asynchronous mode with the 16x clock preset. The 16x clock is present for
both the x16 and x64 BRG configurations.
Note 1: This feature is only available in Asynchronous mode with the 16x clock preset. The 16x clock is present for
both the x16 and x64 BRG configurations.
0.3 — — — — — — — — — — — —
1.2 — — — 1.221 1.73 255 1.202 0.16 129 1.201 -0.16 103
2.4 2.441 1.73 255 2.404 0.16 129 2.404 0.16 64 2.403 -0.16 51
9.6 9.615 0.16 64 9.766 1.73 31 9.766 1.73 15 9.615 -0.16 12
19.2 19.531 1.73 31 19.531 1.73 15 19.531 1.73 7 — — —
57.6 56.818 -1.36 10 62.500 8.51 4 52.083 -9.58 2 — — —
115.2 125.000 8.51 4 104.167 -9.58 2 78.125 -32.18 1 — — —
0.3 — — — — — — — — — — — —
1.2 — — — — — — — — — — — —
2.4 — — — — — — 2.441 1.73 255 2.403 -0.16 207
9.6 9.766 1.73 255 9.615 0.16 129 9.615 0.16 64 9.615 -0.16 51
19.2 19.231 0.16 129 19.231 0.16 64 19.531 1.73 31 19.230 -0.16 25
57.6 58.140 0.94 42 56.818 -1.36 21 56.818 -1.36 10 55.555 3.55 8
115.2 113.636 -1.36 21 113.636 -1.36 10 125.000 8.51 4 — — —
0.3 0.300 0.00 8332 0.300 0.02 4165 0.300 0.02 2082 0.300 -0.04 1665
1.2 1.200 0.02 2082 1.200 -0.03 1041 1.200 -0.03 520 1.201 -0.16 415
2.4 2.402 0.06 1040 2.399 -0.03 520 2.404 0.16 259 2.403 -0.16 207
9.6 9.615 0.16 259 9.615 0.16 129 9.615 0.16 64 9.615 -0.16 51
19.2 19.231 0.16 129 19.231 0.16 64 19.531 1.73 31 19.230 -0.16 25
57.6 58.140 0.94 42 56.818 -1.36 21 56.818 -1.36 10 55.555 3.55 8
115.2 113.636 -1.36 21 113.636 -1.36 10 125.000 8.51 4 — — —
0.3 0.300 0.04 832 0.300 -0.16 415 0.300 -0.16 207
1.2 1.202 0.16 207 1.201 -0.16 103 1.201 -0.16 51
2.4 2.404 0.16 103 2.403 -0.16 51 2.403 -0.16 25
9.6 9.615 0.16 25 9.615 -0.16 12 — — —
19.2 19.231 0.16 12 — — — — — —
57.6 62.500 8.51 3 — — — — — —
115.2 125.000 8.51 1 — — — — — —
0.3 0.300 0.00 33332 0.300 0.00 16665 0.300 0.00 8332 0.300 -0.01 6665
1.2 1.200 0.00 8332 1.200 0.02 4165 1.200 0.02 2082 1.200 -0.04 1665
2.4 2.400 0.02 4165 2.400 0.02 2082 2.402 0.06 1040 2.400 -0.04 832
9.6 9.606 0.06 1040 9.596 -0.03 520 9.615 0.16 259 9.615 -0.16 207
19.2 19.193 -0.03 520 19.231 0.16 259 19.231 0.16 129 19.230 -0.16 103
57.6 57.803 0.35 172 57.471 -0.22 86 58.140 0.94 42 57.142 0.79 34
115.2 114.943 -0.22 86 116.279 0.94 42 113.636 -1.36 21 117.647 -2.12 16
0.3 0.300 0.01 3332 0.300 -0.04 1665 0.300 -0.04 832
1.2 1.200 0.04 832 1.201 -0.16 415 1.201 -0.16 207
2.4 2.404 0.16 415 2.403 -0.16 207 2.403 -0.16 103
9.6 9.615 0.16 103 9.615 -0.16 51 9.615 -0.16 25
19.2 19.231 0.16 51 19.230 -0.16 25 19.230 -0.16 12
57.6 58.824 2.12 16 55.555 3.55 8 — — —
115.2 111.111 -3.55 8 — — — — — —
BRG Clock
RCxIF bit
(Interrupt)
Read
RCREGx
Note: The ABD sequence requires the EUSARTx module to be configured in Asynchronous mode and WUE = 0.
BRG Clock
ABDEN bit
ABDOVF bit
FFFFh
BRG Value XXXXh 0000h 0000h
TRMT SPEN
BRG16 SPBRGHx SPBRGx
TX9
Baud Rate Generator TX9D
Write to TXREGx
Word 1
BRG Output
(Shift Clock)
TXx (pin)
Start bit bit 0 bit 1 bit 7/8 Stop bit
Word 1
TXxIF bit
(Transmit Buffer 1 TCY
Reg. Empty Flag)
Word 1
TRMT bit
Transmit Shift Reg
(Transmit Shift
Reg. Empty Flag)
Write to TXREGx
Word 1 Word 2
BRG Output
(Shift Clock)
TXx (pin)
Start bit bit 0 bit 1 bit 7/8 Stop bit Start bit bit 0
RX9
SPEN
8
RCxIF
(Interrupt Flag)
OERR bit
CREN
Note: This timing diagram shows three words appearing on the RXx input. The RCREGx (Receive Buffer) is read after the third word,
causing the OERR (Overrun) bit to be set.
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
OSC1
Bit Set by User Auto-Cleared
WUE bit(1)
RXx/DTx Line
RCxIF
Cleared due to User Read of RCREGx
Note 1: The EUSARTx remains in Idle while the WUE bit is set.
RXx/DTx Line
Note 1
RCxIF
Cleared due to User Read of RCREGx
SLEEP Command Executed Sleep Ends
Note 1: If the wake-up event requires long oscillator warm-up time, the auto-clear of the WUE bit can occur before the oscillator is ready. This
sequence should not depend on the presence of Q clocks.
2: The EUSARTx remains in Idle while the WUE bit is set.
Write to TXREGx
Dummy Write
BRG Output
(Shift Clock)
Break
TXxIF bit
(Transmit Buffer
Reg. Empty Flag)
TRMT bit
(Transmit Shift
Reg. Empty Flag)
SENDB sampled here Auto-Cleared
SENDB bit
(Transmit Shift
Reg. Empty Flag)
TX1/CK1 Pin
(TXCKP = 1)
Write to
TxREG1 Reg
Write Word 1 Write Word 2
Tx1IF bit
(Interrupt Flag)
TRMT bit
Note: Sync Master mode, SPBRGx = 0, continuous transmission of two 8-bit words. This example is equally applicable to EUSART2 (TX2/CK2
and RX2/DT2).
TX1/CK1 Pin
Write to
TXREG1 reg
TX1IF bit
TRMT bit
TXEN bit
Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
RX1/DT1 Pin bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7
TX1/CK1 Pin
(TXCKP = 0)
TX1/CK1 Pin
(TXCKP = 1)
Write to bit,
SREN
SREN bit
CREN bit ‘0’ ‘0’
RC1IF bit
(Interrupt)
Read
RCREG1
Note: Timing diagram demonstrates Sync Master mode with bit, SREN = 1, and bit, BRGH = 0. This example is equally applicable to EUSART2
(TX2/CK2 and RX2/DT2).
a) The first word will immediately transfer to the 1. Enable the Master Synchronous Serial Port by
TSR register and transmit. setting bits, SYNC and SPEN, and clearing bit,
CSRC.
b) The second word will remain in the TXREGx
register. 2. If interrupts are desired, set enable bit, RCxIE.
c) Flag bit, TXxIF, will not be set. 3. If 9-bit reception is desired, set bit, RX9.
d) When the first word has been shifted out of TSR, 4. To enable reception, set enable bit, CREN.
the TXREGx register will transfer the second word 5. Flag bit, RCxIF, will be set when reception is
to the TSR and flag bit, TXxIF, will now be set. complete. An interrupt will be generated if
e) If enable bit, TXxIE, is set, the interrupt will wake enable bit, RCxIE, was set.
the chip from Sleep. If the global interrupt is 6. Read the RCSTAx register to get the 9th bit (if
enabled, the program will branch to the interrupt enabled) and determine if any error occurred
vector. during reception.
To set up a Synchronous Slave Transmission: 7. Read the 8-bit received data by reading the
RCREGx register.
1. Enable the synchronous slave serial port by
8. If any error occurred, clear the error by clearing
setting bits, SYNC and SPEN, and clearing bit,
bit, CREN.
CSRC.
9. If using interrupts, ensure that the GIE and PEIE
2. Clear bits, CREN and SREN.
bits in the INTCON register (INTCON<7:6>) are
3. If interrupts are desired, set enable bit, TXxIE. set.
4. If 9-bit transmission is desired, set bit, TX9.
5. Enable the transmission by setting enable bit,
TXEN.
6. If 9-bit transmission is selected, the ninth bit
should be loaded in bit, TX9D.
7. Start transmission by loading data to the
TXREGx register.
8. If using interrupts, ensure that the GIE and PEIE
bits in the INTCON register (INTCON<7:6>) are
set.
16x or 4x Clock
BCLK @ BRG = 0
BCLK @ BRG = 1
BCLK @ BRG = 2
BCLK @ BRG = 3
BCLK @ BRG = 4
BCLK @ BRG = 5
(BRG + 1)
[INT(BRG + 1)/2]
BCLK @ BRG = n
Note: The BCLK has 50% duty cycle only for odd BRG values. This is due to having all BCLK edges synchronous to the
rising edge of the 16x/4x clock.
TXx Data
TXx (tx_out)
TXx Data
TXx (tx_out)
TXx Data
Start of Start of
8th Period 11th Period
TXx (tx_out)
RXx (rx_in)
RXx (rx_in)
16 Periods 16 Periods
RXx (rx_in)
VR Select
8
VREF+
VR-
VREF-
Comparator
VINH
VR- VR+
S/H DAC
AN0 VINL
AN1
12-Bit SAR Conversion Logic
AN2
AN3
AN6 ADCBUF0:
MUX A
ADCBUFn
AN7
ADCON1H/L
VINL ADCON2H/L
ADCON3H/L
ADCON5H/L
AN(n-1) ADCHS0H/L
ADCHIT1H/L
ANn(1) ADCHIT0H/L
ADCSS0H/L
VBG
VINH ADCSS1H/L
MUX B
VBG/2 ADCTMUEN0H/L
VBG/6 ADCTMUEN1H/L
VDDCORE VINL
AVDD
AVSS
Sample Control
CTMU Control Logic Conversion Control
VBAT/2
Input MUX Control
Pin Config. Control
CTMU Temp
Note 1: AN16 through AN23 are implemented on 80-pin and 100-pin devices 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
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: These bits are only applicable when the buffer is used in FIFO mode (BUFREGEN = 0). In addition, BUFS
is only used when BUFM = 1.
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 ADCS<7:0>: A/D Conversion Clock Select bits ((ADCS<7:0> + 1) 2/Fosc) = TAD
11111111
= Reserved
01000000
00111111= 64·2/Fosc = TAD
00000001= 2·2/Fosc = TAD
00000000= 2/Fosc = TAD
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: These input channels do not have corresponding memory mapped result buffers.
2: These channels are implemented in 80-pin and 100-pin devices only.
3: For accurately sampling the band gap set SMPI bits in ADCON2L register to 0, so that the ADC samples
the band gap only once on every trigger. When the band gap is sampled multiple times, a large capacitive
load is connected to the output of the band gap multiple times, which could cause the output to become
unstable for a while and an overshoot or undershoot could be sampled.
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 input channels do not have corresponding memory mapped result buffers.
2: These channels are implemented in 80-pin and 100-pin devices 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
REGISTER 22-15: ADCHIT1L: A/D SCAN COMPARE HIT REGISTER 1 LOW (LOW WORD)
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
CHH23 CHH22 CHH21 CHH20 CHH19 CHH18 CHH17 CHH16
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 22-16: ADCHIT0H: A/D SCAN COMPARE HIT REGISTER 0 HIGH (HIGH WORD)
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
CHH15 CHH14 CHH13 CHH12 CHH11 CHH10 CHH9 CHH8
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 22-17: ADCHIT0L: A/D SCAN COMPARE HIT REGISTER 0 LOW (LOW WORD)
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
CHH7 CHH6 CHH5 CHH4 CHH3 CHH2 CHH1 CHH0
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 22-19: ADCSS1L: A/D INPUT SCAN SELECT REGISTER 1 LOW (LOW WORD)
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
CSS23 CSS22 CSS21 CSS20 CSS19 CSS18 CSS17 CSS16
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 22-21: ADCSS0L: A/D INPUT SCAN SELECT REGISTER 0 LOW (LOW WORD)
R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
CSS7 CSS6 CSS5 CSS4 CSS3 CSS2 CSS1 CSS0
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 1: The actual number of channels available depends on which channels are implemented on a specific
device; refer to the device data sheet for details. Unimplemented channels are read as ‘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
Note 1: The actual number of channels available depends on which channels are implemented on a specific
device; refer to the device data sheet for details. Unimplemented channels are read as ‘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
Note 1: The actual number of channels available depends on which channels are implemented on a specific
device; refer to the device data sheet for details. Unimplemented channels are read as ‘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
Note 1: The actual number of channels available depends on which channels are implemented on a specific
device; refer to the device data sheet for details. Unimplemented channels are read as ‘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: In Automatic Sampling modes, Extended Sampling Time is added to the sequence when the value for the
Auto-Sampling Time is greater than 0. Otherwise, sampling ends and conversion starts whenever the SAMP bit is
cleared.
Device Reset
SAMP = 0
DONE = 1
INACTIVE
SAMP = 1 CONVERT
SAMPLE HW SAMP = 0
DONE = x
ASAM = 1 and DONE 0 →
1 DONE = 0
The following steps should be followed for performing 22.3.1 SELECTING THE RESOLUTION
an A/D conversion:
The MODE12 bit (ADCON1H<3>) controls output
1. Configure the A/D module: resolution. Setting this bit selects 12-bit resolution.
- Select the output resolution (if configurable)
- Select the voltage reference source to match 22.3.2 SELECTING THE VOLTAGE
the expected range on analog inputs REFERENCE SOURCE
- Select the analog conversion clock to match The voltage references for A/D conversions are
the desired data rate with a processor clock selected using the PVCFG<1:0> and NVCFG0 control
- Determine how sampling will occur bits (ADCON2H<7:5>). The upper voltage reference
- Set the multiplexer input assignments (VR+) may be AVDD, the external VREF+ or an internal
band gap reference voltage. The lower voltage
- Select the desired sample/conversion
reference (VR-) may be AVSS or the VREF- input pin.
sequence
The available options vary between device families.
- Select the output data format
The external voltage reference pins may be shared
- Select the output value destination
with the AN2 and AN3 inputs on low pin count devices.
- Select the number of readings per interrupt The A/D Converter can still perform conversions on
these pins when they are shared with the VREF+ and
VREF- input pins.
A/D CLK
TSAMP TCONV
SAMP
DONE
ADC1BUF0
A/D CLK
TSAMP TCONV TSAMP TCONV
TAD0 TAD0
SAMP
ADC1BUF0
BSF AD1CON1, ASAM BCF AD1CON1, SAMP BCF AD1CON1, SAMP Instruction Execution
A/D CLK
TSAMP TCONV
SAMP
DONE
ADC1BUF0
A/D CLK
TSAMP TCONV TSAMP TCONV
SAMP
Reset by
DONE Software
ADC1BUF0
ADC1BUF1
22.5.2.2 Sample Time Considerations Using 22.5.3.1 External Int0 Pin Trigger
Clocked Conversion Trigger And When SSRC<3:0> = 0001, the A/D conversion is
Automatic Sampling triggered by an active transition on the INT0 pin. The
The user must ensure the sampling time satisfies the pin may be programmed for either a rising edge input
sampling requirements, as outlined in Section 22.9 “A/ or a falling edge input.
D Sampling Requirements”. Assuming that the mod-
ule is set for automatic sampling and using a clocked 22.5.3.2 Special Event Trigger
conversion trigger, the sampling interval is specified by When SSRC<3:0> = 0010, the A/D is triggered by a
the SAMCx bits. Special Event Trigger. Refer to CCP and ECCP section
for more information about Special Event Triggers.
22.5.3 EVENT TRIGGER CONVERSION
START 22.5.3.3 Synchronizing A/D Operations To
It is often desirable to synchronize the end of sampling Internal Or External Events
and the start of conversion with some other time event. The modes where an external event trigger pulse ends
Depending on the device family, the A/D module has up sampling and starts conversion may be used in combi-
to 16 sources available to use as a conversion trigger nation with auto-sampling (ASAM = 1) to cause the A/
event. The event trigger is selected by the SSRC<3:0> D to synchronize the sample conversion events to the
bits (ADCON1L<7:4>). trigger pulse source. For example, in Figure 22-9,
As noted, the available event triggers vary between where SSRC<3:0> = 0010 and ASAM = 1, the A/D will
device families. Refer to the specific device data sheet always end sampling and start conversions synchro-
for specific information. The examples that follow nously with the timer compare trigger event. The A/D
represent trigger sources that are implemented in most will have a sample conversion rate that corresponds to
devices. Note that the SSRCx bit assignments may the timer comparison event rate.
vary in some devices.
TSMP = Trigger Pulse Interval (TSEQ) – Conversion Time (TCONV) = TSEQ – TCONV
Conversion Trigger
A/D CLK
TSAMP TCONV
SAMP
ADC1BUF0
Conversion Trigger
A/D CLK
TSAMP TCONV TSAMP TCONV
SAMP
Reset by
DONE Software
ADC1BUF0
ADC1BUF1
RAM Contents: d11 d10 d09 d08 d07 d06 d05 d04 d03 d02 d01 d00
Read to Bus:
Integer 0 0 0 0 d11 d10 d09 d08 d07 d06 d05 d04 d03 d02 d01 d00
Signed Integer d11 d11 d11 d11 d11 d10 d09 d08 d07 d06 d05 d04 d03 d02 d01 d00
Fractional (1.15) d11 d10 d09 d08 d07 d06 d05 d04 d03 d02 d01 d00 0 0 0 0
Signed Fractional (1.15) d11 d10 d09 d08 d07 d06 d05 d04 d03 d02 d01 d00 0 0 0 0
4095/4096 1111 1111 1111 0000 1111 1111 1111 4095 0000 0111 1111 1111 2047
4094/4096 1111 1111 1110 0000 1111 1111 1110 4094 0000 0111 1111 1110 2046
2049/4096 1000 0000 0001 0000 1000 0000 0001 2049 0000 0000 0000 0001 1
2048/4096 1000 0000 0000 0000 1000 0000 0000 2048 0000 0000 0000 0000 0
2047/4096 0111 1111 1111 0000 0111 1111 1111 2047 1111 1111 1111 1111 -1
1/4096 0000 0000 0001 0000 0000 0000 0001 1 1111 1000 0000 0001 -2047
0/4096 0000 0000 0000 0000 0000 0000 0000 0 1111 1000 0000 0000 -2048
4095/4096 1111 1111 1111 1111 1111 1111 0000 0.999 0111 1111 1111 0000 0.499
4094/4096 1111 1111 1110 1111 1111 1110 0000 0.998 0111 1111 1110 0000 0.498
2049/4096 1000 0000 0001 1000 0000 0001 0000 0.501 0000 0000 0001 0000 0.001
2048/4096 1000 0000 0000 1000 0000 0000 0000 0.500 0000 0000 0000 0000 0.000
2047/4096 0111 1111 1111 0111 1111 1111 0000 0.499 1111 1111 1111 0000 -0.001
1/4096 0000 0000 0001 0000 0000 0001 0000 0.001 1000 0000 0001 0000 -0.499
0/4096 0000 0000 0000 0000 0000 0000 0000 0.000 1000 0000 0000 0000 -0.500
RAM Contents: d09 d08 d07 d06 d05 d04 d03 d02 d01 d00
Read to Bus:
Integer 0 0 0 0 0 0 d09 d08 d07 d06 d05 d04 d03 d02 d01 d00
Signed Integer d09 d09 d09 d09 d09 d09 d09 d08 d07 d06 d05 d04 d03 d02 d01 d00
Fractional (1.15) d09 d08 d07 d06 d05 d04 d03 d02 d01 d00 0 0 0 0 0 0
Signed Fractional (1.15) d09 d08 d07 d06 d05 d04 d03 d02 d01 d00 0 0 0 0 0 0
1023/1024 11 1111 1111 0000 0011 1111 1111 1023 0000 0001 1111 1111 511
1022/1024 11 1111 1110 0000 0011 1111 1110 1022 0000 0001 1111 1110 510
513/1024 10 0000 0001 0000 0010 0000 0001 513 0000 0000 0000 0001 1
512/1024 10 0000 0000 0000 0010 0000 0000 512 0000 0000 0000 0000 0
511/1024 01 1111 1111 0000 0001 1111 1111 511 1111 1111 1111 1111 -1
1/1024 00 0000 0001 0000 0000 0000 0001 1 1111 1110 0000 0001 -511
0/1024 00 0000 0000 0000 0000 0000 0000 0 1111 1110 0000 0000 -512
1023/1024 11 1111 1111 1111 1111 1100 0000 0.999 0111 1111 1100 0000 0.499
1022/1024 11 1111 1110 1111 1111 1000 0000 0.998 0111 1111 1000 0000 0.498
513/1024 10 0000 0001 1000 0000 0100 0000 0.501 0000 0000 0100 0000 0.001
512/1024 10 0000 0000 1000 0000 0000 0000 0.500 0000 0000 0000 0000 0.000
511/1024 01 1111 1111 0111 1111 1100 0000 0.499 1111 1111 1100 0000 -0.001
1/1024 00 0000 0001 0000 0000 0100 0000 0.001 1000 0000 0100 0000 -0.499
0/1024 00 0000 0000 0000 0000 0000 0000 0.000 1000 0000 0000 0000 -0.500
AD1CHITL AD1CHITL
15 14 13 12 11 10 9 8 15 14 13 12 11 10 9 8
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
AD1CHITL AD1CHITL
15 14 13 12 11 10 9 8 15 14 13 12 11 10 9 8
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
AD1CHITL AD1CHITL
15 14 13 12 11 10 9 8 15 14 13 12 11 10 9 8
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
AD1CHITL AD1CHITL
15 14 13 12 11 10 9 8 15 14 13 12 11 10 9 8
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
Conversion
Trigger
TSAMP TSAMP TSAMP TSAMP
A/D CLK
TCONV TCONV TCONV TCONV
ASAM
SAMP
DONE
ADC1BUF0
ADC1BUF1
ADC1BUFE
ADC1BUFF
AD1IF
Operational Sequence:
1. Sample MUX A Input AN0; Convert and Write to Buffer 0h.
2. Sample MUX A Input AN0; Convert and Write to Buffer 1h.
3. Sample MUX A Input AN0; Convert and Write to Buffer 2h.
4. Sample MUX A Input AN0; Convert and Write to Buffer 3h.
5. Sample MUX A Input AN0; Convert and Write to Buffer 4h.
6. Sample MUX A Input AN0; Convert and Write to Buffer 5h.
7. Sample MUX A Input AN0; Convert and Write to Buffer 6h.
8. Sample MUX A Input AN0; Convert and Write to Buffer 7h.
9. Sample MUX A Input AN0; Convert and Write to Buffer 8h.
10. Sample MUX A Input AN0; Convert and Write to Buffer 9h.
11. Sample MUX A Input AN0; Convert and Write to Buffer Ah.
12. Sample MUX A Input AN0; Convert and Write to Buffer Bh.
13. Sample MUX A Input AN0; Convert and Write to Buffer Ch.
14. Sample MUX A Input AN0; Convert and Write to Buffer Dh.
15. Sample MUX A Input AN0; Convert and Write to Buffer Eh.
16. Sample MUX A Input AN0; Convert and Write to Buffer Fh.
17. Set AD1IF Flag (and generate interrupt, if enabled).
18. Repeat (1-16) After Return from Interrupt.
Conversion
Trigger
TSAMP TSAMP TSAMP TSAMP
A/D CLK
TCONV TCONV TCONV TCONV
ASAM
SAMP
DONE
ADC1BUF0
ADC1BUF1
ADC1BUFE
ADC1BUFF
AD1IF
Operational Sequence:
1. Sample MUX A Input AN0; Convert and Write to Buffer 0h.
2. Sample MUX A Input AN1; Convert and Write to Buffer 1h.
3. Sample MUX A Input AN2; Convert and Write to Buffer 2h.
4. Sample MUX A Input AN3; Convert and Write to Buffer 3h.
5. Sample MUX A Input AN4; Convert and Write to Buffer 4h.
6. Sample MUX A Input AN5; Convert and Write to Buffer 5h.
7. Sample MUX A Input AN6; Convert and Write to Buffer 6h.
8. Sample MUX A Input AN7; Convert and Write to Buffer 7h.
9. Sample MUX A Input AN8; Convert and Write to Buffer 8h.
10. Sample MUX A Input AN9; Convert and Write to Buffer 9h.
11. Sample MUX A Input AN10; Convert and Write to Buffer Ah.
12. Sample MUX A Input AN11; Convert and Write to Buffer Bh.
13. Sample MUX A Input AN12; Convert and Write to Buffer Ch.
14. Sample MUX A Input AN13; Convert and Write to Buffer Dh.
15. Sample MUX A Input AN14; Convert and Write to Buffer Eh.
16. Sample MUX A Input AN15; Convert and Write to Buffer Fh.
17. Set AD1IF Flag (and generate interrupt, if enabled).
18. Repeat (1-16) after Return from Interrupt.
FIGURE 22-18: CONVERTING A SINGLE CHANNEL, ONCE PER INTERRUPT, USING DUAL,
8-WORD BUFFERS
Conversion
Trigger
TSAMP TSAMP TSAMP
A/D CLK
SAMP
BUFS
ADC1BUF0
ADC1BUF8
AD1IF
BSET AD1CON1, #ASAM BCLR IFS0, #AD1IF BCLR IFS0, #AD1IF Instruction Execution
Operational Sequence:
1. Sample MUX A Input, AN3; Convert and Write to Buffer 0h.
2. Set AD1IF Flag (and generate interrupt, if enabled); Write Access Automatically
Switches to Alternate Buffer.
3. Sample MUX A Input, AN3; Convert and Write to Buffer 8h.
4. Set AD1IF Flag (and generate interrupt, if enabled); Write Access Automatically
Switches to Alternate Buffer.
5. Repeat (1-4).
Conversion
Trigger TSAMP TSAMP TSAMP TSAMP TSAMP
A/D CLK
TCONVTCONV TCONVTCONV TCONVTCONV TCONVTCONV TCONVTCONV
Analog
AN1 AN15 AN15 AN1 AN15
Input
ASAM
SAMP
Cleared
DONE in Software
BUFS
ADC1BUF0
ADC1BUF1
ADC1BUF2
ADC1BUF3
ADC1BUF4
ADC1BUF5
ADC1BUF6
ADC1BUF7
ADC1BUF8
ADC1BUF9
ADC1BUFA
ADC1BUFB
AD1IF
Cleared by Software
Operational Sequence:
1. Sample MUX A Input AN1; Convert and Write to Buffer 0h.
2. Sample MUX B Input AN15; Convert and Write to Buffer 1h.
3. Sample MUX A Input AN1; Convert and Write to Buffer 2h.
4. Sample MUX B Input AN15; Convert and Write to Buffer 3h.
5. Sample MUX A Input AN1; Convert and Write to Buffer 4h.
6. Sample MUX B Input AN15; Convert and Write to Buffer 5h.
7. Sample MUX A Input AN1; Convert and Write to Buffer 6h.
8. Sample MUX B Input AN15; Convert and Write to Buffer 7h.
9. Set AD1IF Flag (and generate interrupt, if enabled); Write Access Automatically
Switches to Alternate Buffer.
10. Repeat (1-9); Resume Writing to Buffer with Buffer 8h (first address of alternate buffer).
CPIN CHOLD
VA ILEAKAGE = 4.4 pF
500 nA
VSS
Note: CPIN value depends on device package and is not tested. The effect of the CPIN is negligible if Rs 5 k.
The transfer functions of the A/D Converter, in 12-bit • The first code transition occurs when the input
and 10-bit resolution, are shown in Figure 22-21 and voltage is ((VR+) - (VR-))/4096 or 1.0 LSb.
Figure 22-22, respectively. In both cases, the differ- • The '0000 0000 0001' code is centered at VR-
ence of the input voltages, (VINH - VINL), is compared + (1.5 * ((VR+) - (VR-)) / 4096).
to the reference, ((VR+) - (VR-)). • The '0010 0000 0000' code is centered at
VREFL + (2048.5 * ((VR+) - (VR-)) /4096).
• An input voltage less than VR- + (((VR-) - (VR-)) /
4096) converts as '0000 0000 0000'.
• An input voltage greater than (VR-) + (4096
((VR+) - (VR-))/4096) converts as '1111 1111
1111'.
Output Code
(Binary (Decimal))
VR+
0
VR-
VR+ – VR-
(VINH – VINL)
4096
4096
4096
Voltage Level
VR- +
VR- +
VR- +
Output Code
(Binary (Decimal))
VR+
0
VR-
VR+ – VR-
(VINH – VINL)
1024
1024
1024
Voltage Level
VR- +
VR- +
VR- +
22.11 Operation During Sleep and Idle 22.11.2 CPU SLEEP MODE WITH RC A/D
Modes CLOCK
Sleep and Idle modes are useful for minimizing conver- The A/D module can operate during Sleep mode if the
sion noise because the digital activity of the CPU, A/D clock source is set to the internal A/D RC oscillator
buses and other peripherals is minimized. (ADRC = 1). This eliminates digital switching noise
from the conversion. When the conversion is
22.11.1 CPU SLEEP MODE WITHOUT RC A/ completed, the DONE bit will be set and the result is
D CLOCK loaded into the A/D Result Buffer n, ADCBUFn.
When the device enters Sleep mode, all clock sources If the A/D interrupt is enabled (ADIE = 1), the device will
to the module are shut down and stay at logic '0'. wake-up from Sleep when the A/D interrupt occurs.
Program execution will resume at the A/D Interrupt
If Sleep occurs in the middle of a conversion, the Service Routine (ISR). After the ISR completes execu-
conversion is aborted unless the A/D is clocked from its tion will continue from the instruction after the SLEEP
internal RC clock generator. The converter will not instruction that placed the device in Sleep mode.
resume a partially completed conversion on exiting
from Sleep mode. If the A/D interrupt is not enabled, the A/D module will
then be turned off, although the ADON bit will remain
Register contents are not affected by the device set.
entering or leaving Sleep mode.
CCH<1:0> CxOUT
(CMSTAT<2:0>)
CxINB 0
CxINC 1
Interrupt
CMPxIF
C2INB/C2IND(1) 2 Logic
VBG 3
EVPOL<1:0>
CREF COE
VIN- CxOUT
Polarity
CxINA 0
VIN+ Cx Logic
CVREF 1
CON CPOL
Note 1: Comparator 1 and Comparator 3 use C2INB as an input to the inverted terminal. Comparator 2 uses C2IND as an
input to the inverted terminal.
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 CMPxIF is automatically set any time this mode is selected and must be cleared by the application
after the initial configuration.
2: Comparator 1 and Comparator 3 use C2INB as an input to the inverting terminal. Comparator 2 uses
C2IND as an input to the inverting terminal.
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
VIN-
VIN+
Output
VDD
RS RIC
Comparator
<10 k AIN Input
CPIN ILEAKAGE
VA ±100 nA
5 pF
VSS
VIN-
VIN+ Cx
Off (Read as ‘0’) CxOUT
Pin
Comparator CxINB > CxINA Compare Comparator CxINC > CxINA Compare
CON = 1, CREF = 0, CCH<1:0> = 00 CON = 1, CREF = 0, CCH<1:0> = 01
COE COE
VIN- VIN-
CxINB CxINC
VIN+ Cx VIN+ Cx
CxINA CxOUT CxINA CxOUT
Pin Pin
Comparator C2IND/C2INB > CxINA Compare Comparator VBG > CxINA Compare
CON = 1, CREF = 0, CCH<1:0> = 10 CON = 1, CREF = 0, CCH<1:0> = 11
COE COE
C2IND/ VIN- VIN-
C2INB VBG
VIN+
Cx VIN+ Cx
CxINA CxOUT CxINA CxOUT
Pin Pin
Comparator CxINB > CVREF Compare Comparator CxINC > CVREF Compare
CON = 1, CREF = 1, CCH<1:0> = 00 CON = 1, CREF = 1, CCH<1:0> = 01
COE COE
VIN- VIN-
CxINB CxINC
VIN+ Cx VIN+ Cx
CVREF CxOUT CVREF CxOUT
Pin Pin
Comparator C2IND/C2INB > CVREF Compare Comparator VBG > CVREF Compare
CON = 1, CREF = 1, CCH<1:0> = 10 CON = 1, CREF = 1, CCH<1:0> = 11
COE COE
C2IND/ VIN- VIN-
C2INB VBG
VIN+ Cx VIN+ Cx
CVREF CxOUT CVREF
CxOUT
Pin Pin
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
CVRSS = 1
VREF+
AVDD
CVRSS = 0 8R
CVR<4:0>
CVREN R
R
32-to-1 MUX
32 Steps
CVREF
R
R
CVRSS = 1
VREF-
CVRSS = 0
PIC18F97J94
CVREF
Module R(1) RF5
+
Voltage CVREF Output
–
Reference
Output
Impedance
Note 1: R is dependent upon the Comparator Voltage Reference bits, CVRCONH<4:0>, CVRCONL<5:4> and
CVRCONL<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
Externally Generated
Trip Point
VDD
HLVDEN VDIRMAG
HLVDIN
Set
16-to-1 MUX
HLVDIF
HLVDEN
Internal Voltage
Reference
BOREN
1.2V Typical
VDD
VHLVD
HLVDIF
Enable HLVD
TIRVST
IRVST
HLVDIF Cleared in Software
Internal Reference is Stable
CASE 2:
VDD
VHLVD
HLVDIF
Enable HLVD
TIRVST
IRVST
Internal Reference is Stable HLVDIF Cleared in Software
VHLVD
VDD
HLVDIF
Enable HLVD
IRVST TIRVST
HLVDIF Cleared in Software
Internal Reference is Stable
CASE 2:
VHLVD
VDD
HLVDIF
Enable HLVD
IRVST TIRVST
HLVDIF Cleared in Software
Internal Reference is Stable
HLVDIF Cleared in Software,
HLVDIF Remains Set since HLVD Condition still Exists
VA
VB
Voltage
TA TB
Time
Legend: VA = HLVD trip point
VB = Minimum valid device
operating voltage
CTMUCONH:CTMUCONL
EDGEN CTMUCON1
EDGSEQEN
ITRIM<5:0> TGEN
EDG1SEL<1:0>
EDG1POL IRNG<1:0> IDISSEN
EDG2SEL<1:0> EDG1STAT CTTRIG
EDG2POL EDG2STAT Current Source
CTED1 Edge
CTMU
Control Control A/D Trigger
CTED2 Logic Current Logic
Control
CCP2
Pulse CTPLS
CCP1 Generator
A/D Converter Comparator 2
Input
Comparator 2 Output
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
A/D
Trigger
A/D Converter
ANx
A/D
RCAL MUX
/**************************************************************************/
//Setup AD converter;
/**************************************************************************/
TRISBbits.TRISB0=0;
TRISAbits.TRISA2=1; //set channel 2 as an input
ANCON1bits.ANSEL2=1; // Configured AN2 as an analog channel
ADCON1Hbits.FORM=0b00; // Result format 1= Right justified
ADCON1Lbits.SSRC=0b0111;
ADCON3Hbits.SAMC=0b00111; // Acquisition time 7 = 20TAD 2 = 4TAD 1=2TAD
ADCON3Lbits.ADCS=0x3F; // Clock conversion bits 6= FOSC/64 2=FOSC/32
// ADCON1
ADCON2Hbits.PVCFG=0b00; // Vref+ = AVdd
ADCON2Hbits.NVCFG0=0; // Vref- = AVss
ADCHS0Lbits.CHONA=0b000;
ADCHS0Lbits.CHOSA=0b00010; // Select ADC channel
ADCON1Hbits.ADON=1; // Turn on ADC
int main(void)
{
int i;
int j = 0; //index for loop
unsigned int Vread = 0;
double VTot = 0;
float Vavg=0, Vcal=0, CTMUISrc = 0; //float values stored for calcs
Where:
• I is known from the current source measurement
step
• t is a fixed delay
• V is measured by performing an A/D conversion
int main(void)
{
int i;
int j = 0; //index for loop
unsigned int Vread = 0;
float CTMUISrc, CTMUCap, Vavg, VTot, Vcal;
int main(void)
{
unsigned int Vread; //storage for reading
unsigned int switchState;
int i;
FIGURE 26-3: CTMU TYPICAL CONNECTIONS AND INTERNAL CONFIGURATION FOR TIME
MEASUREMENT
PIC18F97J94
CTMU
CTED1 EDG1
Current Source
CTED2 EDG2
A/D Voltage
A/D Converter
ANX
CAD
CEXT
kT IF CTMU
VF =
q
(
1n 1 –
IS ) Current Source
26.7.2 IMPLEMENTATION
IF A/D
To implement this theory, all that is needed is to
connect a regular junction diode to one of the micro-
VF
controller’s A/D pins (Figure 26-2). The A/D channel
multiplexer is shared by the CTMU and the A/D.
EXAMPLE 26-5: CTMU ROUTINE FOR TEMPERATURE MEASUREMENT USING INTERNAL DIODE
// Initialize CTMU
CTMUICON = 0x03;
CTMUCONbits.CTMUEN = 1;
CTMUCON3bits.EDG1STAT = 1;
Note: The temperature diode is not calibrated or standardized; the user must calibrate the diode to their application.
PIC18F97J94
External 3.3V
Supply
VUSB3V3 Optional
P External
Pull-ups(1)
FSEN P
UPUEN
Internal Pull-ups (Full (Low
UTRDIS Speed) Speed)
Transceiver
USB Bus
USB Clock from the FS
D+
Oscillator Module
D-
USB
SIE
3.8-Kbyte
USB RAM
Note 1: The internal pull-up resistors should be disabled (UPUEN = 0) if external pull-up resistors are used.
Note 1: Make sure the USB clock source is correctly configured before setting this bit.
2: There should be at least four cycles of delay between the setting and PPBRST.
Prior to communicating over USB, the module’s In order to achieve optimum USB signal quality, the D+
associated internal and/or external hardware must be and D- traces between the microcontroller and USB
configured. Most of the configuration is performed with connector (or cable) should be less than 19 cm long.
the UCFG register (Register 27-2).The UFCG register Both traces should be equal in length and they should
contains most of the bits that control the system-level be routed parallel to each other. Ideally, these traces
behavior of the USB module. These include: should be designed to have a characteristic impedance
matching that of the USB cable.
• Bus Speed (full speed versus low speed)
• On-Chip Pull-up Resistor Enable
• On-Chip Transceiver Enable
• Ping-Pong Buffer Usage
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 UPUEN, UTRDIS and FSEN bits should never be changed while the USB module is enabled. These
values must be preconfigured prior to enabling the module.
2: This bit is only valid when the on-chip transceiver is active (UTRDIS = 0); otherwise, it is ignored.
3: If UTRDIS is set, the UOE signal will be active, independent of the UOEMON bit setting.
VUSB3V3
1.5 k
D+
D-
Data Bus
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: This bit is only valid for endpoints with available Even and Odd BD registers.
REGISTER 27-4: UEPn: USB ENDPOINT n CONTROL REGISTER (UEP0 THROUGH UEP15)
U-0 U-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
— — — EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL
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 1: This bit must be initialized by the user to the desired value prior to enabling the USB module.
2: This bit is ignored unless DTSEN = 1.
3: If these bits are set, USB communication may not work. Hence, these bits should always be maintained as ‘0’.
Available
as
Available
Data RAM EP15 IN Odd
as
Data RAM Descriptor
DF7h
Available
as
Data RAM
EP15 IN Odd
Descriptor
DFFh DFFh DFFh DFFh
Maximum Memory Maximum Memory Maximum Memory Maximum Memory
Used: 128 bytes Used: 132 bytes Used: 256 bytes Used: 248 bytes
Maximum BDs: 32 Maximum BDs: 33 Maximum BDs: 64 Maximum BDs: 62
(BD0 to BD31) (BD0 to BD32) (BD0 to BD63) (BD0 to BD61)
Mode 3
Mode 0 Mode 1 Mode 2
Endpoint (Ping-Pong on All Other
(No Ping-Pong) (Ping-Pong on EP0 OUT) (Ping-Pong on All EPs)
EPs, except EP0)
SOFIF
SOFIE
BTSEF
BTSEE TRNIF USBIF
TRNIE
BTOEF
BTOEE
IDLEIF
IDLEIE
DFN8EF
DFN8EE UERRIF
CRC16EF UERRIE
CRC16EE
STALLIF
CRC5EF
STALLIE
CRC5EE
PIDEF
PIDEE ACTVIF
ACTVIE
URSTIF
URSTIE
Control Transfer(1)
1 ms Frame
Note 1: The control transfer shown here is only an example showing events that can occur for every transaction. Typical
control transfers will spread across multiple frames.
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: Once an Idle state is detected, the user may want to place the USB module in Suspend mode.
2: Clearing this bit will cause the USTAT FIFO to advance (valid only for IN, OUT and SETUP tokens).
3: This bit is typically unmasked only following the detection of a UIDLE interrupt event.
4: Only error conditions enabled through the UEIE register will set this bit. This bit is a Status bit only and
cannot be set or cleared by the user.
C:
UCONbits.SUSPND = 0;
while (UIRbits.ACTVIF) { UIRbits.ACTVIF = 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 27-10: UEIE: USB ERROR INTERRUPT ENABLE REGISTER (BANKED F37h)
R/W-0 U-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
BTSEE — — BTOEE DFN8EE CRC16EE CRC5EE PIDEE
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
100 k
VUSB3V3
Legend: VUSB3V3 – Voltage applied to the VUSB3V3 pin in volts (should be 3.0V to 3.6V).
PZERO – Percentage (in decimal) of the IN traffic bits sent by the PIC® MCU that are a value of ‘0’.
PIN – Percentage (in decimal) of total bus bandwidth that is used for IN traffic.
LCABLE – Length (in meters) of the USB cable. The “USB 2.0 Specification” requires that full-speed
applications use cables no longer than 5m.
IPULLUP – Current which the nominal, 1.5 k pull-up resistor (when enabled) must supply to the USB
cable. On the host or hub end of the USB cable, 15 k nominal resistors (14.25 k to 24.8 k) are
present which pull both the D+ and D- lines to ground. During bus Idle conditions (such as between
packets or during USB Suspend mode), this results in up to 218 A of quiescent current drawn at 3.3V.
IPULLUP is also dependant on bus traffic conditions and can be as high as 2.2 mA when the USB bandwidth
is fully utilized (either IN or OUT traffic) for data that drives the lines to the “K” state most of the time.
Device
Configuration
Interface Interface
Note 1: The CONFIG2L bits can only be programmed indirectly by programming the Flash Configuration Word.
2: The CONFIG2L is reset to ‘1’ only on VDD Reset; it is reloaded with the programmed value at any device
Reset.
3: Although CONFIG2L is reset to ‘1’ only on VDD Reset, these values are not used until after the actual con-
figuration values are read out and stored in the register bits. Therefore, for these bits, the Reset value has
no effect on the operation of the system.
4: Unlike other Configuration registers, the CLKOEN holding register is reset to a ‘0’ on any VDD Reset. This
prevents the CLKO pin from driving until the actual configuration values are read out and stored in the
register.
bit 7-4 Unimplemented: Program the corresponding Flash Configuration bit to ‘1’
bit 3-0 PLLDIV<3:0>: Frequency Multiplier Select bits(3)
Divider must be selected so as to not exceed 64 MHz output.
1111 = No PLL used; PLLEN bit is not available to user
1110 = 8x PLL is selected
1101 = 6x PLL is selected
1100 = 4x PLL is selected
1011 = Reserved; do not use
1010 = Reserved; do not use
1001 = Reserved; do not use
1000 = Reserved; do not use
0111 = 96 MHz PLL is selected; oscillator divided by 12 (48 MHz input)
0110 = 96 MHz PLL is selected; oscillator divided by 8 (32 MHz input)
0101 = 96 MHz PLL is selected; oscillator divided by 6 (24 MHz input)
0100 = 96 MHz PLL is selected; oscillator divided by 5 (20 MHz input)
0011 = 96 MHz PLL is selected; oscillator divided by 4 (16 MHz input)
0010 = 96 MHz PLL is selected; oscillator divided by 3 (12 MHz input)
0001 = 96 MHz PLL is selected; oscillator divided by 2 (8 MHz input)
0000 = 96 MHz PLL is selected; no divide – oscillator is used directly (4 MHz input)
Note 1: The CONFIG2H bits can only be programmed indirectly by programming the Flash Configuration Word.
2: The CONFIG2H is reset to ‘1’ only on VDD Reset; it is reloaded with the programmed value at any device
Reset.
3: If USB functionality is used, then this field must be set to ‘0xxx’ (i.e., 96 MHz PLL is selected).
Note 1: The CONFIG3L bits can only be programmed indirectly by programming the Flash Configuration Word.
2: The CONFIG3L is reset to ‘1’ only on VDD Reset; it is reloaded with the programmed value at any device
Reset.
bit 7-0 WPFP<7:0>: Write-Protect Program Flash Pages bits (valid when WPDIS = 0)
When WPEND = 0:
Write/erase protect Flash memory pages, starting at Page 0 and ending with Page WPFP<7:0>.
When WPEND = 1:
Write/erase protect Flash memory pages, starting at Page WPFP<7:0> and ending with the last page
in user Flash.
bit 7-3 Unimplemented: Program the corresponding Flash Configuration bit to ‘1’
bit 2 WPCFG: Write/Erase Protect Last Page in User Flash bit
1 = Write/erase protection of last page is disabled, regardless of the WPFP<7:0> setting
0 = Write/erase protection of last page is enabled, regardless of the WPFP<7:0> setting
bit 1 WPEND: Write Protection End Page bit
This bit is valid when WPDIS = 0.
When WPEND = 0:
Write/erase protect Flash Memory pages, starting at Page 0 and ending with Page WPFP<7:0>.
When WPEND = 1:
Write/erase protect Flash memory pages, starting at Page WPFP<7:0> and ending with the last page
in user Flash.
bit 0 WPDIS: Write-Protect Disable bit
1 = WPFP<7:0>, WPEND and WPCFG bits are ignored
0 = WPFP<7:0>, WPEND and WPCFG bits are enabled; write-protect is active
bit 7-4 Unimplemented: Program the corresponding Flash Configuration bit to ‘1’
bit 3 MSSPMSK1: MSSP1 7-Bit Address Masking Mode Enable bit
1 = 7-Bit Address Masking mode enable
0 = 5-Bit Address Masking mode enable
bit 2 MSSPMSK2: MSSP2 7-Bit Address Masking Mode Enable bit
1 = 7-Bit Address Masking mode enable
0 = 5-Bit Address Masking mode enable
bit 1 LS48MHZ: Low-Speed USB Clock Selection bit
1 = 48 MHz system clock is expected; divide-by-8 generates low-speed USB clock
0 = 24 MHz system clock is expected; divide-by-4 generates low-speed USB clock
bit 0 IOL1WAY: IOLOCK Bit One-Way Set Enable bit
1 = The IOLOCK bit can only be set once (provided an unlocking sequence is executed); this prevents
any possible future RP register changes
0 = The IOLOCK bit can be set and cleared as needed (provided an unlocking sequence is executed)
bit 7-4 Unimplemented: Program the corresponding Flash Configuration bit to ‘1’
bit 3 WPSA: WDT Prescaler bit
1 = WDT prescaler ratio of 1:128
0 = WDT prescaler ratio of 1:32
bit 2 WINDIS: Windowed Watchdog Timer Disable bit
1 = Standard WDT is selected; windowed WDT is disabled
0 = Windowed WDT is enabled when executing a CLRWDT instruction while the WDT is disabled in
hardware
bit 1-0 WDTEN<1:0>: Watchdog Timer Enable bits
11 = WDT is enabled in hardware
10 = WDT is controlled with the SWDTEN bit setting
01 = WDT is enabled only while device is active and disabled in Sleep; SWDTEN bit is disabled
00 = WDT is disabled in hardware; SWDTEN bit is disabled
bit 7-3 DSWDTPS<4:0>: Deep Sleep Watchdog Timer Postscale Select bits
The DS WDT prescaler is 32; this creates an approximate base time unit of 1 ms.
11111 = 1:2^36 (25.7 days)
11110 = 1:2^35 (12.8 days)
11101 = 1:2^34 (6.4 days)
11100 = 1:2^33 (77.0 hours)
11011 = 1:2^32 (38.5 hours)
11010 = 1:2^31 (19.2 hours)
11001 = 1:2^30 (9.6 hours)
11000 = 1:2^29 (4.8 hours)
10111 = 1:2^28 (2.4 hours)
10110 = 1:2^27 (72.2 minutes)
10101 = 1:2^26 (36.1 minutes)
10100 = 1:2^25 (18.0 minutes)
10011 = 1:2^24 (9.0 minutes)
10010 = 1:2^23 (4.5 minutes)
10001 = 1:2^22 (135.3s)
10000 = 1:2^21 (67.7s)
01111 = 1:2^20 (33.825s)
01110 = 1:2^19 (16.912s)
01101 = 1:2^18 (8.456s)
01100 = 1:2^17 (4.228s)
01011 = 1:65536 (2.114s)
01010 = 1:32768 (1.057s)
01001 = 1:16384 (528.5 ms)
01000 = 1:8192 (264.3 ms)
00111 = 1:4096 (132.1 ms)
00110 = 1:2048 (66.1 ms)
00101 = 1:1024 (33 ms)
00100 = 1:512 (16.5 ms)
00011 = 1:256 (8.3 ms)
00010 = 1:128 (4.1 ms)
00001 = 1:64 (2.1 ms)
00000 = 1:32 (1 ms)
bit 2-0 Unimplemented: Read as ‘1’
bit 7-4 Unimplemented: Program the corresponding Flash Configuration bit to ‘1’
bit 3-2 Unimplemented: Read as ‘1’
bit 1 DSWDTOSC: DSWDT Reference Clock Select bit
1 = DSWDT uses INTOSC/LPRC as the reference clock
0 = DSWDT uses T1OSC/SOSC as the reference clock
bit 0 DSWDTEN: Deep Sleep Watchdog Timer Enable bit
1 = DSWDT is enabled
0 = DSWDT is disabled
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
WDT Enabled,
SWDTEN Disabled
WDT Controlled with
SWDTEN bit Setting
WDT Enabled only while
Device Active, Disabled
WDT Disabled in Hardware,
SWDTEN Disabled
WDTPS<3:0> 4
Sleep
INTOSC Source
Legend:
HS = Hardware Settable bit
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
OSC1
TOST(1) TPLL(1)
1 2 n-1 n
PLL Clock
Output
Clock
Transition(2)
CPU Clock
Peripheral
Clock
Program
Counter PC PC + 2 PC + 4 PC + 6
Note 1: TOST = 1024 TOSC; TPLL = 2 ms (approx). These intervals are not shown to scale.
2: Clock transition typically occurs within 2-4 TOSC.
Sample Clock
Device Oscillator
Clock Failure
Output
CM Output
(Q)
Failure
Detected
OSCFIF
Note: The device clock is normally at a much higher frequency than the sample clock. The relative frequencies in this
example have been chosen for clarity.
Literal operations
15 8 7 0
OPCODE k (literal) MOVLW 7Fh
Control operations
CALL, GOTO and Branch operations
15 8 7 0
OPCODE n<7:0> (literal) GOTO Label
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
BYTE-ORIENTED OPERATIONS
ADDWF f, d, a Add WREG and f 1 0010 01da ffff ffff C, DC, Z, OV, N 1, 2
ADDWFC f, d, a Add WREG and Carry bit to f 1 0010 00da ffff ffff C, DC, Z, OV, N 1, 2
ANDWF f, d, a AND WREG with f 1 0001 01da ffff ffff Z, N 1, 2
CLRF f, a Clear f 1 0110 101a ffff ffff Z 2
COMF f, d, a Complement f 1 0001 11da ffff ffff Z, N 1, 2
CPFSEQ f, a Compare f with WREG, Skip = 1 (2 or 3) 0110 001a ffff ffff None 4
CPFSGT f, a Compare f with WREG, Skip > 1 (2 or 3) 0110 010a ffff ffff None 4
CPFSLT f, a Compare f with WREG, Skip < 1 (2 or 3) 0110 000a ffff ffff None 1, 2
DECF f, d, a Decrement f 1 0000 01da ffff ffff C, DC, Z, OV, N 1, 2, 3, 4
DECFSZ f, d, a Decrement f, Skip if 0 1 (2 or 3) 0010 11da ffff ffff None 1, 2, 3, 4
DCFSNZ f, d, a Decrement f, Skip if Not 0 1 (2 or 3) 0100 11da ffff ffff None 1, 2
INCF f, d, a Increment f 1 0010 10da ffff ffff C, DC, Z, OV, N 1, 2, 3, 4
INCFSZ f, d, a Increment f, Skip if 0 1 (2 or 3) 0011 11da ffff ffff None 4
INFSNZ f, d, a Increment f, Skip if Not 0 1 (2 or 3) 0100 10da ffff ffff None 1, 2
IORWF f, d, a Inclusive OR WREG with f 1 0001 00da ffff ffff Z, N 1, 2
MOVF f, d, a Move f 1 0101 00da ffff ffff Z, N 1
MOVFF fs, fd Move fs (source) to 1st word 2 1100 ffff ffff ffff None
fd (destination) 2nd word 1111 ffff ffff ffff
MOVWF f, a Move WREG to f 1 0110 111a ffff ffff None
MULWF f, a Multiply WREG with f 1 0000 001a ffff ffff None 1, 2
NEGF f, a Negate f 1 0110 110a ffff ffff C, DC, Z, OV, N
RLCF f, d, a Rotate Left f through Carry 1 0011 01da ffff ffff C, Z, N 1, 2
RLNCF f, d, a Rotate Left f (No Carry) 1 0100 01da ffff ffff Z, N
RRCF f, d, a Rotate Right f through Carry 1 0011 00da ffff ffff C, Z, N
RRNCF f, d, a Rotate Right f (No Carry) 1 0100 00da ffff ffff Z, N
SETF f, a Set f 1 0110 100a ffff ffff None 1, 2
SUBFWB f, d, a Subtract f from WREG with 1 0101 01da ffff ffff C, DC, Z, OV, N
Borrow
SUBWF f, d, a Subtract WREG from f 1 0101 11da ffff ffff C, DC, Z, OV, N 1, 2
SUBWFB f, d, a Subtract WREG from f with 1 0101 10da ffff ffff C, DC, Z, OV, N
Borrow
SWAPF f, d, a Swap Nibbles in f 1 0011 10da ffff ffff None 4
TSTFSZ f, a Test f, Skip if 0 1 (2 or 3) 0110 011a ffff ffff None 1, 2
XORWF f, d, a Exclusive OR WREG with f 1 0001 10da ffff ffff Z, N
Note 1: When a PORT register is modified as a function of itself (e.g., MOVF PORTB, 1, 0), the value used will be
that value present on the pins themselves. For example, if the data latch is ‘1’ for a pin configured as input
and is driven low by an external device, the data will be written back with a ‘0’.
2: If this instruction is executed on the TMR0 register (and where applicable, d = 1), the prescaler will be
cleared if assigned.
3: If the Program Counter (PC) is modified or a conditional test is true, the instruction requires two cycles. The
second cycle is executed as a NOP.
4: Some instructions are two-word instructions. The second word of these instructions will be executed 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.
BIT-ORIENTED OPERATIONS
BCF f, b, a Bit Clear f 1 1001 bbba ffff ffff None 1, 2
BSF f, b, a Bit Set f 1 1000 bbba ffff ffff None 1, 2
BTFSC f, b, a Bit Test f, Skip if Clear 1 (2 or 3) 1011 bbba ffff ffff None 3, 4
BTFSS f, b, a Bit Test f, Skip if Set 1 (2 or 3) 1010 bbba ffff ffff None 3, 4
BTG f, b, a Bit Toggle f 1 0111 bbba ffff ffff None 1, 2
CONTROL OPERATIONS
BC n Branch if Carry 1 (2) 1110 0010 nnnn nnnn None
BN n Branch if Negative 1 (2) 1110 0110 nnnn nnnn None
BNC n Branch if Not Carry 1 (2) 1110 0011 nnnn nnnn None
BNN n Branch if Not Negative 1 (2) 1110 0111 nnnn nnnn None
BNOV n Branch if Not Overflow 1 (2) 1110 0101 nnnn nnnn None
BNZ n Branch if Not Zero 1 (2) 1110 0001 nnnn nnnn None
BOV n Branch if Overflow 1 (2) 1110 0100 nnnn nnnn None
BRA n Branch Unconditionally 2 1101 0nnn nnnn nnnn None
BZ n Branch if Zero 1 (2) 1110 0000 nnnn nnnn None
CALL n, s Call Subroutine 1st word 2 1110 110s kkkk kkkk None
2nd word 1111 kkkk kkkk kkkk
CLRWDT — Clear Watchdog Timer 1 0000 0000 0000 0100 TO, PD
DAW — Decimal Adjust WREG 1 0000 0000 0000 0111 C
GOTO n Go to Address 1st word 2 1110 1111 kkkk kkkk None
2nd word 1111 kkkk kkkk kkkk
NOP — No Operation 1 0000 0000 0000 0000 None
NOP — No Operation 1 1111 xxxx xxxx xxxx None 4
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
RCALL n Relative Call 2 1101 1nnn nnnn nnnn None
RESET Software Device Reset 1 0000 0000 1111 1111 All
RETFIE s Return from Interrupt Enable 2 0000 0000 0001 000s GIE/GIEH,
PEIE/GIEL
RETLW k Return with Literal in WREG 2 0000 1100 kkkk kkkk None
RETURN s Return from Subroutine 2 0000 0000 0001 001s None
SLEEP — Go into Standby mode 1 0000 0000 0000 0011 TO, PD
Note 1: When a PORT register is modified as a function of itself (e.g., MOVF PORTB, 1, 0), the value used will be
that value present on the pins themselves. For example, if the data latch is ‘1’ for a pin configured as input
and is driven low by an external device, the data will be written back with a ‘0’.
2: If this instruction is executed on the TMR0 register (and where applicable, d = 1), the prescaler will be
cleared if assigned.
3: If the Program Counter (PC) is modified or a conditional test is true, the instruction requires two cycles. The
second cycle is executed as a NOP.
4: Some instructions are two-word instructions. The second word of these instructions will be executed 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.
LITERAL OPERATIONS
ADDLW k Add Literal and WREG 1 0000 1111 kkkk kkkk C, DC, Z, OV, N
ANDLW k AND Literal with WREG 1 0000 1011 kkkk kkkk Z, N
IORLW k Inclusive OR Literal with WREG 1 0000 1001 kkkk kkkk Z, N
LFSR f, k Move literal (12-bit) 2nd word 2 1110 1110 00ff kkkk None
to FSR(f) 1st word 1111 0000 kkkk kkkk
MOVLB k Move Literal to BSR<3:0> 1 0000 0001 0000 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 OPERATIONS
TBLRD* Table Read 2 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 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: When a PORT register is modified as a function of itself (e.g., MOVF PORTB, 1, 0), the value used will be
that value present on the pins themselves. For example, if the data latch is ‘1’ for a pin configured as input
and is driven low by an external device, the data will be written back with a ‘0’.
2: If this instruction is executed on the TMR0 register (and where applicable, d = 1), the prescaler will be
cleared if assigned.
3: If the Program Counter (PC) is modified or a conditional test is true, the instruction requires two cycles. The
second cycle is executed as a NOP.
4: Some instructions are two-word instructions. The second word of these instructions will be executed 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.
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).
Words: 1
Cycles: 1
Q Cycle Activity:
Q1 Q2 Q3 Q4
Decode Read Process Write to
register ‘f’ Data destination
Cycles: 1 No No No No
operation operation operation operation
Q Cycle Activity:
If No Jump:
Q1 Q2 Q3 Q4
Q1 Q2 Q3 Q4
Decode Read Process Write to
Decode Read literal Process No
register ‘f’ Data destination
‘n’ Data operation
BTFSC Bit Test File, Skip if Clear BTFSS Bit Test File, Skip if Set
Words: 1 Q1 Q2 Q3 Q4
Decode Read literal Process Write to PC
Cycles: 1
‘n’ Data
Q Cycle Activity: No No No No
Q1 Q2 Q3 Q4 operation operation operation operation
Decode Read Process Write If No Jump:
register ‘f’ Data register ‘f’ Q1 Q2 Q3 Q4
Decode Read literal Process No
Example: BTG PORTC, 4, 0 ‘n’ Data operation
Before Instruction:
PORTC = 0111 0101 [75h] Example: HERE BOV Jump
After Instruction:
Before Instruction
PORTC = 0110 0101 [65h]
PC = address (HERE)
After Instruction
If Overflow = 1;
PC = address (Jump)
If Overflow = 0;
PC = address (HERE + 2)
Words: 1
Example: CLRWDT
Cycles: 1
Before Instruction
Q Cycle Activity:
WDT Counter = ?
Q1 Q2 Q3 Q4 After Instruction
Decode Read Process Write WDT Counter = 00h
register ‘f’ Data register ‘f’ WDT Postscaler = 0
TO = 1
PD = 1
Example: CLRF FLAG_REG,1
Before Instruction
FLAG_REG = 5Ah
After Instruction
FLAG_REG = 00h
CPFSGT Compare f with W, Skip if f > W CPFSLT Compare f with W, Skip if f < W
Syntax: CPFSGT f {,a} Syntax: CPFSLT f {,a}
Operands: 0 f 255 Operands: 0 f 255
a [0,1] a [0,1]
Operation: (f) –W),
Operation: (f) –W),
skip if (f) > (W)
skip if (f) < (W)
(unsigned comparison)
(unsigned comparison)
Status Affected: None
Status Affected: None
Encoding: 0110 010a ffff ffff
Encoding: 0110 000a ffff ffff
Description: Compares the contents of data memory
location ‘f’ to the contents of the W by Description: Compares the contents of data memory
performing an unsigned subtraction. location ‘f’ to the contents of W by
performing an unsigned subtraction.
If the contents of ‘f’ are greater than the
contents of WREG, then the fetched If the contents of ‘f’ are less than the
instruction is discarded and a NOP is contents of W, then the fetched
executed instead, making this a 2-cycle instruction is discarded and a NOP is
instruction. executed instead, making this a 2-cycle
instruction.
If ‘a’ is ‘0’, the Access Bank is selected.
If ‘a’ is ‘1’, the BSR is used to select the If ‘a’ is ‘0’, the Access Bank is selected.
GPR bank. 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 Words: 1
in Indexed Literal Offset Addressing Cycles: 1(2)
mode whenever f 95 (5Fh). See Note: 3 cycles if skip and followed
Section 29.2.3 “Byte-Oriented and by a 2-word instruction.
Bit-Oriented Instructions in Indexed
Q Cycle Activity:
Literal Offset Mode” for details.
Q1 Q2 Q3 Q4
Words: 1
Decode Read Process No
Cycles: 1(2) register ‘f’ Data operation
Note: 3 cycles if skip and followed
If skip:
by a 2-word instruction.
Q1 Q2 Q3 Q4
Q Cycle Activity:
No No No No
Q1 Q2 Q3 Q4
operation operation operation operation
Decode Read Process No
register ‘f’ Data operation If skip and followed by 2-word instruction:
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 No No No No
If skip and followed by 2-word instruction: operation operation operation operation
Q1 Q2 Q3 Q4
No No No No Example: HERE CPFSLT REG, 1
operation operation operation operation NLESS :
No No No No LESS :
operation operation operation operation Before Instruction
PC = Address (HERE)
Example: HERE CPFSGT REG, 0 W = ?
NGREATER : After Instruction
GREATER : If REG < W;
Before Instruction PC = Address (LESS)
If REG W;
PC = Address (HERE) PC = Address (NLESS)
W = ?
After Instruction
If REG W;
PC = Address (GREATER)
If REG W;
PC = Address (NGREATER)
Description: DAW adjusts the 8-bit value in W, If ‘a’ is ‘0’ and the extended instruction
resulting from the earlier addition of two set is enabled, this instruction operates
variables (each in packed BCD format) in Indexed Literal Offset Addressing
and produces a correct packed BCD mode whenever f 95 (5Fh). See
result. Section 29.2.3 “Byte-Oriented and
Bit-Oriented Instructions in Indexed
Words: 1
Literal Offset Mode” for details.
Cycles: 1
Words: 1
Q Cycle Activity: Cycles: 1
Q1 Q2 Q3 Q4
Q Cycle Activity:
Decode Read Process Write
register W Data W Q1 Q2 Q3 Q4
Decode Read Process Write to
Example 1: DAW register ‘f’ Data destination
Before Instruction
W = A5h Example: DECF CNT, 1, 0
C = 0 Before Instruction
DC = 0
CNT = 01h
After Instruction Z = 0
W = 05h After Instruction
C = 1
DC = 0 CNT = 00h
Z = 1
Example 2:
Before Instruction
W = CEh
C = 0
DC = 0
After Instruction
W = 34h
C = 1
DC = 0
Decode Read literal Process Write If ‘a’ is ‘0’, the Access Bank is selected.
‘k’ MSB Data literal ‘k’ If ‘a’ is ‘1’, the BSR is used to select the
MSB to GPR bank.
FSRfH If ‘a’ is ‘0’ and the extended instruction
Decode Read literal Process Write literal set is enabled, this instruction operates
‘k’ LSB Data ‘k’ to FSRfL in Indexed Literal Offset Addressing
mode whenever f 95 (5Fh). See
Section 29.2.3 “Byte-Oriented and
Example: LFSR 2, 3ABh
Bit-Oriented Instructions in Indexed
After Instruction Literal Offset Mode” for details.
FSR2H = 03h
FSR2L = ABh Words: 1
Cycles: 1
Q Cycle Activity:
Q1 Q2 Q3 Q4
Decode Read Process Write
register ‘f’ Data W
POP Pop Top of Return Stack PUSH Push Top of Return Stack
RLNCF Rotate Left f (No Carry) RRCF Rotate Right f through Carry
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
ADDFSR Add Literal to FSR ADDULNK Add Literal to FSR2 and Return
Syntax: ADDFSR f, k Syntax: ADDULNK k
Operands: 0 k 63 Operands: 0 k 63
f [ 0, 1, 2 ] Operation: FSR2 + k FSR2,
Operation: FSR(f) + k FSR(f) (TOS) PC
Status Affected: None Status Affected: None
Encoding: 1110 1000 ffkk kkkk Encoding: 1110 1000 11kk kkkk
Description: The 6-bit literal ‘k’ is added to the Description: The 6-bit literal ‘k’ is added to the
contents of the FSR specified by ‘f’. contents of FSR2. A RETURN is then
Words: 1 executed by loading the PC with the
TOS.
Cycles: 1
Q Cycle Activity: The instruction takes two cycles to
execute; a NOP is performed during
Q1 Q2 Q3 Q4
the second cycle.
Decode Read Process Write to
literal ‘k’ Data FSR This may be thought of as a special
case of the ADDFSR instruction,
where f = 3 (binary ‘11’); it operates
Example: ADDFSR 2, 23h only on FSR2.
Words: 1
Before Instruction
FSR2 = 03FFh Cycles: 2
After Instruction Q Cycle Activity:
FSR2 = 0422h 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 format then becomes: {label} instruction argument(s).
MOVSS Move Indexed to Indexed PUSHL Store Literal at FSR2, Decrement FSR2
Syntax: MOVSS [zs], [zd] Syntax: PUSHL k
Operands: 0 zs 127 Operands: 0k 255
0 zd 127
Operation: k (FSR2),
Operation: ((FSR2) + zs) ((FSR2) + zd) FSR2 – 1 FSR2
Status Affected: None
Status Affected: None
Encoding:
Encoding: 1111 1010 kkkk kkkk
1st word (source) 1110 1011 1zzz zzzzs
2nd word (dest.) 1111 xxxx xzzz zzzzd Description: The 8-bit literal ‘k’ is written to the data
Description The contents of the source register are memory address specified by FSR2.
FSR2 is decremented by 1 after the
moved to the destination register. The
addresses of the source and destination operation.
registers are determined by adding the This instruction allows users to push
7-bit literal offsets, ‘zs’ or ‘zd’, values onto a software stack.
respectively, to the value of FSR2. Both
Words: 1
registers can be located anywhere in
the 4096-byte data memory space Cycles: 1
(000h to FFFh). Q Cycle Activity:
The MOVSS instruction cannot use the Q1 Q2 Q3 Q4
PCL, TOSU, TOSH or TOSL as the Decode Read ‘k’ Process Write to
destination register. data destination
If the resultant source address points to
an Indirect Addressing register, the
value returned will be 00h. If the Example: PUSHL 08h
resultant destination address points to Before Instruction
an Indirect Addressing register, the FSR2H:FSR2L = 01ECh
instruction will execute as a NOP. Memory (01ECh) = 00h
Words: 2
After Instruction
Cycles: 2 FSR2H:FSR2L = 01EBh
Q Cycle Activity: Memory (01ECh) = 08h
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
SUBFSR Subtract Literal from FSR SUBULNK Subtract Literal from FSR2 and Return
Syntax: SUBFSR f, k Syntax: SUBULNK k
Operands: 0 k 63 Operands: 0 k 63
f [ 0, 1, 2 ] Operation: FSR2 – k FSR2,
Operation: FSRf – k FSRf (TOS) PC
Status Affected: None Status Affected: None
Encoding: 1110 1001 ffkk kkkk Encoding: 1110 1001 11kk kkkk
Description: The 6-bit literal ‘k’ is subtracted from Description: The 6-bit literal ‘k’ is subtracted from the
the contents of the FSR specified contents of the FSR2. A RETURN is then
by ‘f’. executed by loading the PC with the
TOS.
Words: 1
Cycles: 1 The instruction takes two cycles to
execute; a NOP is performed during the
Q Cycle Activity:
second cycle.
Q1 Q2 Q3 Q4
This may be thought of as a special case
Decode Read Process Write to
of the SUBFSR instruction, where f = 3
register ‘f’ Data destination
(binary ‘11’); it operates only on FSR2.
Words: 1
Example: SUBFSR 2, 23h Cycles: 2
Before Instruction Q Cycle Activity:
FSR2 = 03FFh Q1 Q2 Q3 Q4
After Instruction Decode Read Process Write to
FSR2 = 03DCh register ‘f’ Data destination
No No No No
Operation Operation Operation Operation
4V
3.75V
3.6V
3.25V
PIC18F97J94 Family
3V
Voltage (VDD)
2.5V
2V
4 MHz 64 MHz
Frequency
Note 1: When the USB module is enabled, VUSB3V3 and VDD should be connected together and provided
3.0V-3.6V. When the USB module is not enabled, VUSB3V3 and VDD should still be connected
together.
2: VCAP (nominal on-chip regulator output voltage) = 1.8V.
Param
Symbol Characteristic Min. Typ. Max. Units Conditions
No.
D001 VDD Supply Voltage 2.0 — 3.6 V
D001C AVDD Analog Supply Voltage VDD – — VDD + V
0.3 0.3
D001D AVSS Analog Ground Poten- VSS – 0.3 — VSS + 0.3 V
tial
D001E VUSB3V3 USB Supply Voltage 3 3.3 3.6 V USB module enabled(3)
D002 VDR RAM Data Retention 1.2 — — V
Voltage(1)
D003 VPOR VDD/VBAT Start Voltage — — 0.7 V See Section 5.2 “Power-on
to Ensure Internal Reset (POR)” for details
Power-on Reset Signal
D004 SVDD VDD/VBAT Rise Rate 0.05 — — V/ms See Section 5.2 “Power-on
to Ensure Internal Reset (POR)” for details
Power-on Reset Signal
D005 BVDD Brown-out Reset
Voltage 1.8 1.88 1.95 V
BORV = 1(2) 2.0 2.05 2.20 V
BORV = 0
D006 VVDDBOR 1.4V 2.0 V
D007 VVBATBOR 1.4V 1.95 V
D008 VDSBOR 1.8
Note 1: This is the limit to which VDD can be lowered in Sleep mode, or during a device Reset, without losing RAM data.
2: The device will operate normally until Brown-out Reset occurs, even though VDD may be below VDDMIN.
3: VUSB3V3 should be connected to VDD.
Param
Typ.(1) Max. Units Conditions
No.
Module Differential Currents (∆IWDT, ∆IBOR, ∆IHLVD, ∆IDSBOR, ∆IDSWDT, ∆IOSCB, ∆IADRC, ∆ILCD, ∆IUSB)
D020 (∆IWDT) Watchdog Timer 0.4 1 µA -40°C to +85°C VDD = 2.0V
0.4 1 µA -40°C to +85°C VDD = 3.3V
D021 (∆IBOR) Brown-out Reset 4 8 µA -40°C to +85°C VDD = 2.0V
High-Power BOR
5 9 µA -40°C to +85°C VDD = 3.3V
D022 (∆IHLVD) High/Low-Voltage 4 8 µA -40°C to +85°C VDD = 2.0V
Detect 5 9 µA -40°C to +85°C VDD = 3.3V
D023 (∆IDSBOR) Deep Sleep BOR 135 480 nA -40°C to +85°C VDD = 2.0V
∆Deep Sleep BOR(2)
to 3.3V
D024 (∆IDSWDT) Deep Sleep 290 480 nA -40°C to +85°C VDD = 2.0V
∆Deep Sleep WDT(2)
Watchdog Timer to 3.3V
D025 (∆IOSCB) Real-Time Clock/ 0.38 1 µA -40°C to +85°C VDD = 2.0V
Sleep mode 32.768 kHz,
Calendar with Tim- 0.55 1 µA -40°C to +85°C VDD = 3.3V T1OSCEN = 1, LPT1OSC = 0
er1 Oscillator
D027 (∆ILCD) LCD Module 0.6 4 µA -40°C to +85°C VDD = 3.3V ∆LCD External/Internal,
1/8 MUX, 1/3 Bias(2,3)
6 30 µA -40°C to +85°C VDD = 2.0V ∆LCD Charge Pump,
7 40 µA -40°C to +85°C VDD = 3.3V 1/8 MUX, 1/3 Bias(2,4)
D028 (∆IADRC) A/D with RC 330 500 µA -40°C to +85°C VDD = 2.0V
385 500 µA -40°C to +85°C VDD = 3.3V
D028 (∆IUSB) USB Module 1 2 mA -40°C to +85°C VDD and USB enabled, no cable con-
VUSB3V3 = 3.3V nected; traffic makes a large dif-
ference(5)
Note 1: Data in the Typical column is at 3.3V, 25°C unless otherwise stated. Parameters are for design guidance only and are not
tested.
2: Incremental current while the module is enabled and running.
3: LCD is enabled and running, no glass is connected; the resistor ladder current is not included.
4: LCD is enabled and running, no glass is connected.
5: This is the module differential current when the USB module is enabled and clocked at 48 MHz, but with no USB cable
attached. When the USB cable is attached, or data is being transmitted, the current consumption may be much higher (see
Section 27.6.4 “USB Transceiver Current Consumption”). During USB Suspend mode (USBEN = 1, SUSPND = 1, bus in
Idle state), the USB module current will be dominated by the D+ or D- pull-up resistor. The integrated pull-up resistors use
“resistor switching” according to the resistor_ecn supplement to the “USB 2.0 Specification” and therefore, may be as low as
900Ω during Idle conditions.
Param
Sym. Characteristic Min. Typ. Max. Units Conditions
No.
VBT Operating Voltage 2.0 — 3.6 V Battery connected to VBAT pin
VBTADC VBAT A/D Monitoring 1.6 — 3.6 V A/D monitoring the VBAT pin using
Voltage Specification(1) the internal A/D channel
Note 1: Measure A/D value using the A/D represented by the equation (Measured Voltage = ((VBAT/2)/VDD) * 1024) for
10-bit A/D; Measured Voltage = ((VBAT/2)/VDD) * 4096) for 12-bit A/D.
Param
Sym. Characteristic Min. Max. Units Conditions
No.
Param
Sym. Characteristics Min. Typ. Max. Units Comments
No.
D300 VIOFF Input Offset Voltage — ±5.0 40 mV
D301 VICM Input Common-Mode Voltage 0 — AVDD V
D302 CMRR Common-Mode Rejection Ratio 55 — — dB
D303 TRESP Response Time(1) — 150 400 ns
D304 TMC2OV Comparator Mode Change to — — 10 s
Output Valid*
Note 1: Response time is measured with one comparator input at (AVDD – 1.5)/2, while the other input transitions
from VSS to VDD.
Param
Sym. Characteristics Min. Typ. Max. Units Comments
No.
D310 VRES Resolution VDD/32 — VDD/32 LSb
D311 VRAA Absolute Accuracy — — 3/4 LSb
D312 VRUR Unit Resistor Value (R) — 2k —
D313 TSET Settling Time(1) — — 10 s
Note 1: Settling time measured while CVRR = 1 and CVR<3:0> transitions from ‘0000’ to ‘1111’.
Param
Sym. Characteristics Min. Typ. Max. Units Comments
No.
VRGOUT Regulator Output Voltage — 1.8 — V
CEFC External Filter Capacitor Value 4.7 10 — F Capacitor must be
low-ESR, a low series
resistance (< 5)
Param
Sym. Characteristics Min. Typ. Max. Units Comments
No.
D313 VUSB3V3 USB Voltage 3 — 3.6 V Voltage on VUSB3V3 pin
must be in this range for
proper USB operation
D314 IIL Input Leakage on Pin — — ±1 µA VSS < VPIN < VDD pin at
high-impedance
D318 VDIFS Differential Input Sensitivity — — 0.2 V The difference between D+
and D- must exceed this
value while VCM is met
D319 VCM Differential Common-Mode 0.8 — 2.5 V
Range
D320 ZOUT Driver Output Impedance(1) 28 — 44 Ω
D321 VOL Voltage Output Low 0 — 0.3 V 1.5 kΩ load connected to
3.6V
D322 VOH Voltage Output High 2.8 — 3.6 V 1.5 kΩ load connected to
ground
Note 1: The D+ and D- signal lines have built-in impedance matching resistors. No external resistors, capacitors
or magnetic components are necessary on the D+/D- signal paths between the PIC18F97J94 family
device and a USB cable.
VDD/2
RL
CL Pin CL
Pin
VSS VSS
RL = 464
CL = 50 pF for all pins except OSC2/CLKO/RA6
and including D and E outputs as ports
CL = 20 pF for OSC2/CLKO/RA6
Q4 Q1 Q2 Q3 Q4 Q1
OSC1
1 3 3 4 4
2
CLKO
TABLE 30-20: 4/6/8x PLL CLOCK TIMING SPECIFICATIONS (VDD = 2.0V TO 3.6V)(1)
Param
Sym. Characteristic Min. Typ. Max. Units Conditions
No.
F10 FOSC Oscillator Frequency Range 4 — 16 MHz VDD = 2.0-3.6V,
-40°C to +85°C
F11 FSYS On-Chip VCO System Frequency 16 — 64 MHz VDD = 2.0-3.6V,
-40°C to +85°C
F12 trc PLL Start-up Time (Lock Time) — — 2 ms
F13 CLK CLKOUT Stability (Jitter) -2 — +2 %
Note 1: These specifications are for x96 PLL or x8 PLL.
TABLE 30-21: 96 MHZ PLL CLOCK TIMING SPECIFICATIONS (VDD = 2.0V TO 3.6V)
Sym. Characteristic Min. Typ. Max. Units Conditions
FPLLIN PLL Input Frequency Range (after prescaling) 3.94 4 4.06 MHz VDD = 2.0-3.6V,
-40°C to +85°C
FSYS On-Chip VCO System Frequency — 96 — MHz VDD = 2.0-3.6V,
-40°C to +85°C
trc PLL Start-up Time (Lock Time) — — 200 µs
CLK CLKOUT Stability (Jitter) -0.25 — +0.25 %
Param
Characteristics Min. Typ. Max. Units Conditions
No.
OA1 FRC Accuracy @ Freq = 8 MHz, 4 MHz, 2 MHz, 1 MHz, 500 kHz, 250 kHz, 125 kHz, 31.25 kHz(1)
-0.5 — +0.5 % +25°C VDD = 3.0-3.6V
-1.5 — +1.5 % -40°C to +85°C VDD = 2.0-3.6V
OA2 LPRC Accuracy @ Freq = 31 kHz
-20 — 20 % -40°C to +85°C VDD = 2.0-3.6V
Note 1: Frequency is calibrated at +25°C. OSCTUNE register can be used to compensate for temperature drift.
OSC1
10 11
CLKO
13 12
14 19 18
16
I/O Pin
(Input)
17 15
20, 21
Q1 Q2 Q3 Q4 Q1 Q2
OSC1
167
166
150
151 161
162
153
162A
155 154 163
BA0
170
ALE 170A
168
CE
OE
Q1 Q2 Q3 Q4 Q1 Q2
OSC1
167
ALE 168
164
169
171
CE
171A
OE
165
Operating Conditions: 2.0V < VCC < 3.6V, -40°C < TA < +125°C unless otherwise stated.
VDD
MCLR
30
Internal
POR
33
PWRT
Time-out 32
Oscillator
Time-out
Internal
Reset
Watchdog
Timer
Reset
31
34 34
I/O pins
Enable Internal
Reference Voltage
Internal Reference
Voltage Stable 36
TABLE 30-26: RESET, WATCHDOG TIMER, OSCILLATOR START-UP TIMER, POWER-UP TIMER
AND BROWN-OUT RESET REQUIREMENTS
Param.
Symbol Characteristic Min. Typ. Max. Units Conditions
No.
VHLVD
VHLVD
HLVDIF
TxCKI
40 41
42
SOSCO/SCLKI
45 46
47 48
TMR0 or
TMR1
CCPx
(Capture Mode)
50 51
52
CCPx
(Compare or PWM Mode)
53 54
SCKx
(CKPx = 0)
78 79
SCKx
(CKPx = 1)
79 78
80
75, 76
74
73
81
SCKx
(CKPx = 0)
79
73
SCKx
(CKPx = 1)
80
78
75, 76
74
SSx
70
SCKx
(CKPx = 0) 83
71 72
78 79
SCKx
(CKP = 1)
79 78
80
75, 76 77
TABLE 30-32: EXAMPLE SPI MODE REQUIREMENTS (SLAVE MODE TIMING, CKE = 0)
Param.
Symbol Characteristic Min. Max. Units Conditions
No.
70
SCKx
83
(CKPx = 0)
71 72
SCKx
(CKPx = 1)
80
75, 76 77
SDIx
MSb In bit 6 - - - - 1 LSb In
74
Note: Refer to Figure 30-2 for load conditions.
SCLx
91 93
90 92
SDAx
Start Stop
Condition Condition
91 92
SDAx
In
110
109 109
SDAx
Out
91 THD:STA Start Condition Hold Time 100 kHz mode 4.0 — s After this period, the first clock
400 kHz mode 0.6 — s pulse is generated
SCLx
91 93
90 92
SDAx
Start Stop
Condition Condition
SDAx
Out
TXx/CKx
pin
121 121
RXx/DTx
pin
120
122
Note: Refer to Figure 30-2 for load conditions.
TXx/CKx
pin 125
RXx/DTx
pin
126
TCY (Note 1)
ADIF
GO DONE
SAMPLING STOPPED
SAMPLE
Note 1: If the A/D clock source is selected as RC, a time of TCY is added before the A/D clock starts. This allows the SLEEP instruction to
be executed.
2: This is a minimal RC delay (typically 100 ns), which also disconnects the holding capacitor from the analog input.
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
PIN 1 PIN 1
XXXXXXXXXXX PIC18F67J94
XXXXXXXXXXX -I/PT e3
XXXXXXXXXXX
YYWWNNN 1210017
XXXXXXXXXX PIC18F67J94
XXXXXXXXXX -I/PT e3
XXXXXXXXXX
YYWWNNN 1210017
XXXXXXXXXXXX PIC18F87J94
XXXXXXXXXXXX I/PT e3
XXXXXXXXXXXX
YYWWNNN 1210017
XXXXXXXXXXXX PIC18F97J94
XXXXXXXXXXXX I/PT e3
XXXXXXXXXXXX
YYWWNNN 1210017
XXXXXXXXXXXX PIC18F97J94
XXXXXXXXXXXX I/PF e3
XXXXXXXXXXXX
YYWWNNN 1210017
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
64-Lead Plastic Thin Quad Flatpack (PT)-10x10x1 mm Body, 2.00 mm Footprint [TQFP]
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
D
D1
D1/2
D
NOTE 2
E1/2
A B
E1 E
A A
SEE DETAIL 1
N
4X N/4 TIPS
0.20 C A-B D 1 3
2
4X
NOTE 1
0.20 H A-B D
TOP VIEW
A2
A
C 0.05
SEATING
PLANE
64 X b A1
0.08 C 0.08 C A-B D
e
SIDE VIEW
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
E
L T
(L1) X=A—B OR D
SECTION A-A X
e/2
DETAIL 1
Units MILLIMETERS
Dimension Limits MIN NOM MAX
Number of Leads N 64
Lead Pitch e 0.50 BSC
Overall Height A - - 1.20
Molded Package Thickness A2 0.95 1.00 1.05
Standoff A1 0.05 - 0.15
Foot Length L 0.45 0.60 0.75
Footprint L1 1.00 REF
Foot Angle I 0° 3.5° 7°
Overall Width E 12.00 BSC
Overall Length D 12.00 BSC
Molded Package Width E1 10.00 BSC
Molded Package Length D1 10.00 BSC
Lead Thickness c 0.09 - 0.20
Lead Width b 0.17 0.22 0.27
Mold Draft Angle Top D 11° 12° 13°
Notes: Mold Draft Angle Bottom E 11° 12° 13°
1. Pin 1 visual index feature may vary, but must be located within the hatched area.
2. Chamfers at corners are optional; size may vary.
3. Dimensions D1 and E1 do not include mold flash or protrusions. Mold flash or
protrusions shall not exceed 0.25mm per side.
4. Dimensioning and tolerancing per ASME Y14.5M
BSC: Basic Dimension. Theoretically exact value shown without tolerances.
REF: Reference Dimension, usually without tolerance, for information purposes only.
Microchip Technology Drawing C04-085C Sheet 2 of 2
64-Lead Plastic Thin Quad Flatpack (PT)-10x10x1 mm Body, 2.00 mm Footprint [TQFP]
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
C1
C2
Y1
X1
Units MILLIMETERS
Dimension Limits MIN NOM MAX
Contact Pitch E 0.50 BSC
Contact Pad Spacing C1 11.40
Contact Pad Spacing C2 11.40
Contact Pad Width (X28) X1 0.30
Contact Pad Length (X28) Y1 1.50
Distance Between Pads G 0.20
Notes:
1. Dimensioning and tolerancing per ASME Y14.5M
BSC: Basic Dimension. Theoretically exact value shown without tolerances.
Microchip Technology Drawing C04-2085B Sheet 1 of 1
D
D1
E
e
E1
b N
NOTE 1
12 3 NOTE 2 α
A
c
φ
β A2
A1
L L1
8QLWV 0,//,0(7(56
'LPHQVLRQ/LPLWV 0,1 120 0$;
1XPEHURI/HDGV 1
/HDG3LWFK H %6&
2YHUDOO+HLJKW $ ± ±
0ROGHG3DFNDJH7KLFNQHVV $
6WDQGRII $ ±
)RRW/HQJWK /
)RRWSULQW / 5()
)RRW$QJOH
2YHUDOO:LGWK ( %6&
2YHUDOO/HQJWK ' %6&
0ROGHG3DFNDJH:LGWK ( %6&
0ROGHG3DFNDJH/HQJWK ' %6&
/HDG7KLFNQHVV F ±
/HDG:LGWK E
0ROG'UDIW$QJOH7RS
0ROG'UDIW$QJOH%RWWRP
1RWHV
3LQYLVXDOLQGH[IHDWXUHPD\YDU\EXWPXVWEHORFDWHGZLWKLQWKHKDWFKHGDUHD
&KDPIHUVDWFRUQHUVDUHRSWLRQDOVL]HPD\YDU\
'LPHQVLRQV'DQG(GRQRWLQFOXGHPROGIODVKRUSURWUXVLRQV0ROGIODVKRUSURWUXVLRQVVKDOOQRWH[FHHGPPSHUVLGH
'LPHQVLRQLQJDQGWROHUDQFLQJSHU$60(<0
%6& %DVLF'LPHQVLRQ7KHRUHWLFDOO\H[DFWYDOXHVKRZQZLWKRXWWROHUDQFHV
5() 5HIHUHQFH'LPHQVLRQXVXDOO\ZLWKRXWWROHUDQFHIRULQIRUPDWLRQSXUSRVHVRQO\
0LFURFKLS 7HFKQRORJ\ 'UDZLQJ &%
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
/HDG3ODVWLF7KLQ4XDG)ODWSDFN 37 ±[[PP%RG\PP>74)3@
1RWH )RUWKHPRVWFXUUHQWSDFNDJHGUDZLQJVSOHDVHVHHWKH0LFURFKLS3DFNDJLQJ6SHFLILFDWLRQORFDWHGDW
KWWSZZZPLFURFKLSFRPSDFNDJLQJ
D
D1
e
E
E1
N
b
1 23 NOTE 2
NOTE 1 α
c
A
φ A1
β L L1 A2
8QLWV 0,//,0(7(56
'LPHQVLRQ/LPLWV 0,1 120 0$;
1XPEHURI/HDGV 1
/HDG3LWFK H %6&
2YHUDOO+HLJKW $ ± ±
0ROGHG3DFNDJH7KLFNQHVV $
6WDQGRII $ ±
)RRW/HQJWK /
)RRWSULQW / 5()
)RRW$QJOH
2YHUDOO:LGWK ( %6&
2YHUDOO/HQJWK ' %6&
0ROGHG3DFNDJH:LGWK ( %6&
0ROGHG3DFNDJH/HQJWK ' %6&
/HDG7KLFNQHVV F ±
/HDG:LGWK E
0ROG'UDIW$QJOH7RS
0ROG'UDIW$QJOH%RWWRP
1RWHV
3LQYLVXDOLQGH[IHDWXUHPD\YDU\EXWPXVWEHORFDWHGZLWKLQWKHKDWFKHGDUHD
&KDPIHUVDWFRUQHUVDUHRSWLRQDOVL]HPD\YDU\
'LPHQVLRQV'DQG(GRQRWLQFOXGHPROGIODVKRUSURWUXVLRQV0ROGIODVKRUSURWUXVLRQVVKDOOQRWH[FHHGPPSHUVLGH
'LPHQVLRQLQJDQGWROHUDQFLQJSHU$60(<0
%6& %DVLF'LPHQVLRQ7KHRUHWLFDOO\H[DFWYDOXHVKRZQZLWKRXWWROHUDQFHV
5() 5HIHUHQFH'LPHQVLRQXVXDOO\ZLWKRXWWROHUDQFHIRULQIRUPDWLRQSXUSRVHVRQO\
0LFURFKLS 7HFKQRORJ\ 'UDZLQJ &%
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
/HDG3ODVWLF7KLQ4XDG)ODWSDFN 3) ±[[PP%RG\PP>74)3@
1RWH )RUWKHPRVWFXUUHQWSDFNDJHGUDZLQJVSOHDVHVHHWKH0LFURFKLS3DFNDJLQJ6SHFLILFDWLRQORFDWHGDW
KWWSZZZPLFURFKLSFRPSDFNDJLQJ
D
D1
e E1
N
α
NOTE 1 1 23 NOTE 2 A
c φ A2
β A1
L L1
8QLWV 0,//,0(7(56
'LPHQVLRQ/LPLWV 0,1 120 0$;
1XPEHURI/HDGV 1
/HDG3LWFK H %6&
2YHUDOO+HLJKW $ ± ±
0ROGHG3DFNDJH7KLFNQHVV $
6WDQGRII $ ±
)RRW/HQJWK /
)RRWSULQW / 5()
)RRW$QJOH
2YHUDOO:LGWK ( %6&
2YHUDOO/HQJWK ' %6&
0ROGHG3DFNDJH:LGWK ( %6&
0ROGHG3DFNDJH/HQJWK ' %6&
/HDG7KLFNQHVV F ±
/HDG:LGWK E
0ROG'UDIW$QJOH7RS
0ROG'UDIW$QJOH%RWWRP
1RWHV
3LQYLVXDOLQGH[IHDWXUHPD\YDU\EXWPXVWEHORFDWHGZLWKLQWKHKDWFKHGDUHD
&KDPIHUVDWFRUQHUVDUHRSWLRQDOVL]HPD\YDU\
'LPHQVLRQV'DQG(GRQRWLQFOXGHPROGIODVKRUSURWUXVLRQV0ROGIODVKRUSURWUXVLRQVVKDOOQRWH[FHHGPPSHUVLGH
'LPHQVLRQLQJDQGWROHUDQFLQJSHU$60(<0
%6& %DVLF'LPHQVLRQ7KHRUHWLFDOO\H[DFWYDOXHVKRZQZLWKRXWWROHUDQFHV
5() 5HIHUHQFH'LPHQVLRQXVXDOO\ZLWKRXWWROHUDQFHIRULQIRUPDWLRQSXUSRVHVRQO\
0LFURFKLS 7HFKQRORJ\ 'UDZLQJ &%
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
Revision B (08/2016)
Updated data sheet to new format. Added corrections
as per PIC18F97J94 Family Silicon Errata and Data
Sheet Clarifications (DS8000551D), as follows:
Updated Table 1; Added Table 2, Table 3 and Table 4;
Updated Tables 1-4, 3-3, 6-2, 11-3, 11-6, 22-1; Added
Table 30-18; Updated Register 4-8; Added Register 22-
26; Updated Figures 11-7 and 22-1; Updated Examples
11-6, 22-1 and 22-2; Updated Equation 22-1. Update
Packaging Information chapter. Other corrections.
Revision C (08/2016)
Remove Preliminary status from data sheet.
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.