PIC18F97J60
PIC18F97J60
PIC18F97J60
Data Sheet
64/80/100-Pin, High-Performance,
1-Mbit Flash Microcontrollers
with Ethernet
DS39762F
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 Microchips 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 Microchips 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.
Trademarks
The Microchip name and logo, the Microchip logo, dsPIC,
KEELOQ, KEELOQ logo, MPLAB, PIC, PICmicro, PICSTART,
PIC32 logo, rfPIC and UNI/O are registered trademarks of
Microchip Technology Incorporated in the U.S.A. and other
countries.
FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor,
MXDEV, MXLAB, SEEVAL and The Embedded Control
Solutions Company are registered trademarks of Microchip
Technology Incorporated in the U.S.A.
Analog-for-the-Digital Age, Application Maestro, CodeGuard,
dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN,
ECONOMONITOR, FanSense, HI-TIDE, In-Circuit Serial
Programming, ICSP, Mindi, MiWi, MPASM, MPLAB Certified
logo, MPLIB, MPLINK, mTouch, Omniscient Code
Generation, PICC, PICC-18, PICDEM, PICDEM.net, PICkit,
PICtail, REAL ICE, rfLAB, Select Mode, Total Endurance,
TSHARC, UniWinDriver, WiperLock and ZENA are
trademarks of Microchip Technology Incorporated in the
U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated
in the U.S.A.
All other trademarks mentioned herein are property of their
respective companies.
2011, Microchip Technology Incorporated, Printed in the
U.S.A., All Rights Reserved.
Printed on recycled paper.
ISBN: 978-1-61341-069-1
Microchip received ISO/TS-16949:2002 certification for its worldwide
headquarters, design and wafer fabrication facilities in Chandler and
Tempe, Arizona; Gresham, Oregon and design centers in California
and India. The Companys quality system processes and procedures
are for its PIC MCUs and dsPIC DSCs, KEELOQ code hopping
devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchips quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.
DS39762F-page 2
PIC18F97J60 FAMILY
64/80/100-Pin High-Performance,
1-Mbit Flash Microcontrollers with Ethernet
Ethernet Features:
Peripheral Highlights:
DS39762F-page 3
Comparators
PIC18F66J60
64K
3808
8192
39
11
2/3
2/3
PIC18F66J65
96K
3808
8192
39
11
2/3
2/3
PIC18F67J60
128K
3808
8192
39
11
2/3
2/3
PIC18F86J60
64K
3808
8192
55
15
2/3
2/3
PIC18F86J65
96K
3808
8192
55
15
2/3
2/3
PIC18F87J60
128K
3808
8192
55
15
2/3
2/3
PIC18F96J60
64K
3808
8192
70
16
2/3
2/3
PIC18F96J65
96K
3808
8192
70
16
2/3
2/3
PIC18F97J60
128K
3808
8192
70
16
2/3
2/3
Device
SRAM
Flash
Data
Program
Memory Memory
(bytes)
(bytes)
DS39762F-page 4
MSSP
Ethernet
TX/RX
Buffer
(bytes)
I/O
10-Bit
A/D (ch)
CCP/
ECCP
SPI
Master
I2C
Timers
PSP
8/16-Bit
External
Memory Bus
EUSART
PIC18F97J60 FAMILY
PIC18F97J60 FAMILY
VDDTX
TPOUT-
TPOUT+
VSSTX
RBIAS
VDDPLL
VSSPLL
VSS
VDD
RD2/CCP4/P3D
RD0/P1B
RE5/P1C
RE4/P3B
RE3/P3C
RE2/P2B
64-Pin TQFP
RD1/ECCP3/P3A
Pin Diagrams
64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49
RE1/P2C
48
RE0/P2D
RB0/INT0/FLT0
RB1/INT1
RB2/INT2
3
4
5
47
46
45
RB3/INT3
MCLR
RG4/CCP5/P1D
VSS
VDDCORE/VCAP
RF7/SS1
7
8
9
RF4/AN9
10
11
12
13
14
RF3/AN8
RF2/AN7/C1OUT
15
16
RF6/AN11
RF5/AN10/CVREF
44
43
42
41
40
PIC18F66J60
PIC18F66J65
PIC18F67J60
39
38
37
36
35
34
33
VDDRX
TPIN+
TPINVSSRX
RB4/KBI0
RB5/KBI1
RB6/KBI2/PGC
VSS
OSC2/CLKO
OSC1/CLKI
VDD
RB7/KBI3/PGD
RC5/SDO1
RC4/SDI1/SDA1
RC3/SCK1/SCL1
RC2/ECCP1/P1A
RC7/RX1/DT1
RC6/TX1/CK1
RC0/T1OSO/T13CKI
RA4/T0CKI
RC1/T1OSI/ECCP2/P2A
RA5/AN4
VDD
VSS
RA0/LEDA/AN0
RA1/LEDB/AN1
RA2/AN2/VREF-
RA3/AN3/VREF+
AVSS
AVDD
ENVREG
RF1/AN6/C2OUT
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
DS39762F-page 5
PIC18F97J60 FAMILY
Pin Diagrams (Continued)
VDDTX
TPOUT+
TPOUT-
VSSTX
RBIAS
VDDPLL
VSSPLL
RD2
RD1
VSS
VDD
RE7/ECCP2(1)/P2A(1)
RD0
RE6/P1B(2)
RE5/P1C(2)
RE4/P3B(2)
RE3/P3C(2)
RE2/P2B
RH0
RH1
80-Pin TQFP
80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61
RH2
60
VDDRX
RH3
RE1/P2C
RE0/P2D
3
4
5
6
7
59
58
57
56
55
TPIN+
TPINVSSRX
RG0/ECCP3/P3A
RG1/TX2/CK2
RB4/KBI0
RB5/KBI1
RB6/KBI2/PGC
VSS
OSC2/CLKO
OSC1/CLKI
VDD
RB7/KBI3/PGD
RC5/SDO1
RB0/INT0/FLT0
RB1/INT1
RB2/INT2
RB3/INT3
MCLR
RG4/CCP5/P1D
VSS
VDDCORE/VCAP
RF7/SS1
RF6/AN11
RF5/AN10/CVREF
RF4/AN9
RF3/AN8
RF2/AN7/C1OUT
8
9
10
11
12
13
14
15
16
RH7/AN15/P1B(2)
17
18
19
RH6/AN14/P1C(2)
20
54
53
52
51
50
PIC18F86J60
PIC18F86J65
PIC18F87J60
49
48
47
46
45
44
43
42
41
RC4/SDI1/SDA1
RC3/SCK1/SCL1
RC2/ECCP1/P1A
RG2/RX2/DT2
RG3/CCP4/P3D
DS39762F-page 6
RJ5
RJ4
RC7/RX1/DT1
RC6/TX1/CK1
RC1/T1OSI/ECCP2(1)/P2A(1)
RC0/T1OSO/T13CKI
RA4/T0CKI
RA5/AN4
VDD
VSS
RA0/LEDA/AN0
RA1/LEDB/AN1
RA2/AN2/VREF-
RA3/AN3/VREF+
AVSS
AVDD
ENVREG
RF1/AN6/C2OUT
RH5/AN13/P3B(2)
Note 1:
2:
RH4/AN12/P3C(2)
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
The ECCP2/P2A pin placement depends on the CCP2MX Configuration bit setting.
P1B, P1C, P3B and P3C pin placement depends on the ECCPMX Configuration bit setting.
PIC18F97J60 FAMILY
Pin Diagrams (Continued)
100
99
98
97
96
95
94
93
92
91
90
89
88
87
86
85
84
83
82
81
80
79
78
77
76
RH1/A17
RH0/A16
RE2/AD10/CS/P2B
RE3/AD11/P3C(2)
RE4/AD12/P3B(2)
RE5/AD13/P1C(2)
RE6/AD14/P1B(2)
RE7/AD15/ECCP2(1)/P2A(1)
RD0/AD0/PSP0
RD1/AD1/PSP1
RD2/AD2/PSP2
RD3/AD3/PSP3
RD4/AD4/PSP4/SDO2
RD5/AD5/PSP5/SDI2/SDA2
VDD
VSS
RD6/AD6/PSP6/SCK2/SCL2
RD7/AD7/PSP7/SS2
VSSPLL
VDDPLL
RBIAS
VSSTX
TPOUT+
TPOUTVDDTX
100-Pin TQFP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
PIC18F96J60
PIC18F96J65
PIC18F97J60
75
74
73
72
71
70
69
68
67
66
65
64
63
62
61
60
59
58
57
56
55
54
53
52
51
VDDRX
TPIN+
TPINVSSRX
RG0/ECCP3/P3A
RG1/TX2/CK2
RB4/KBI0
RB5/KBI1
RB6/KBI2/PGC
RJ2/WRL
VSS
OSC2/CLKO
OSC1/CLKI
VDD
RJ3/WRH
VSS
VDD
RJ6/LB
RB7/KBI3/PGD
RC5/SDO1
RC4/SDI1/SDA1
RC3/SCK1/SCL1
RC2/ECCP1/P1A
RG2/RX2/DT2
RG3/CCP4/P3D
Note 1:
2:
RC1/T1OSI/ECCP2(1)/P2A(1)
RC0/T1OSO/T13CKI
RC6/TX1/CK1
RC7/RX1/DT1
RJ4/BA0
RJ5/CE
RJ0/ALE
RJ1/OE
RH5/AN13/P3B(2)
RH4/AN12/P3C(2)
RF1/AN6/C2OUT
ENVREG
AVDD
AVSS
RA3/AN3/VREF+
RA2/AN2/VREFRA1/LEDB/AN1
RA0/LEDA/AN0
VSS
VDD
RG7
RJ7/UB
VSS
RA5/AN4
RA4/T0CKI
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
RH2/A18
RH3/A19
RE1/AD9/WR/P2C
RE0/AD8/RD/P2D
RB0/INT0/FLT0
RB1/INT1
RB2/INT2
RB3/INT3/ECCP2(1)/P2A(1)
NC
RG6
RG5
RF0/AN5
MCLR
RG4/CCP5/P1D
VSS
VDDCORE/VCAP
VDD
RF7/SS1
RF6/AN11
RF5/AN10/CVREF
RF4/AN9
RF3/AN8
RF2/AN7/C1OUT
RH7/AN15/P1B(2)
RH6/AN14/P1C(2)
The ECCP2/P2A pin placement depends on the CCP2MX Configuration bit and Processor mode settings.
P1B, P1C, P3B and P3C pin placement depends on the ECCPMX Configuration bit setting.
DS39762F-page 7
PIC18F97J60 FAMILY
Table of Contents
1.0 Device Overview ........................................................................................................................................................................ 11
2.0 Guidelines for Getting Started with PIC18FJ Microcontrollers ................................................................................................... 43
3.0 Oscillator Configurations ............................................................................................................................................................ 49
4.0 Power-Managed Modes ............................................................................................................................................................. 55
5.0 Reset .......................................................................................................................................................................................... 63
6.0 Memory Organization ................................................................................................................................................................. 77
7.0 Flash Program Memory ............................................................................................................................................................ 105
8.0 External Memory Bus ............................................................................................................................................................... 115
9.0 8 x 8 Hardware Multiplier.......................................................................................................................................................... 127
10.0 Interrupts .................................................................................................................................................................................. 129
11.0 I/O Ports ................................................................................................................................................................................... 145
12.0 Timer0 Module ......................................................................................................................................................................... 171
13.0 Timer1 Module ......................................................................................................................................................................... 175
14.0 Timer2 Module ......................................................................................................................................................................... 180
15.0 Timer3 Module ......................................................................................................................................................................... 183
16.0 Timer4 Module ......................................................................................................................................................................... 187
17.0 Capture/Compare/PWM (CCP) Modules ................................................................................................................................. 189
18.0 Enhanced Capture/Compare/PWM (ECCP) Modules .............................................................................................................. 197
19.0 Ethernet Module ....................................................................................................................................................................... 217
20.0 Master Synchronous Serial Port (MSSP) Module .................................................................................................................... 269
21.0 Enhanced Universal Synchronous Asynchronous Receiver Transmitter (EUSART) ............................................................... 315
22.0 10-Bit Analog-to-Digital Converter (A/D) Module ..................................................................................................................... 339
23.0 Comparator Module.................................................................................................................................................................. 349
24.0 Comparator Voltage Reference Module ................................................................................................................................... 355
25.0 Special Features of the CPU .................................................................................................................................................... 359
26.0 Instruction Set Summary .......................................................................................................................................................... 375
27.0 Development Support............................................................................................................................................................... 425
28.0 Electrical Characteristics .......................................................................................................................................................... 429
29.0 Packaging Information.............................................................................................................................................................. 465
Appendix A: Revision History............................................................................................................................................................. 475
Appendix B: Device Differences......................................................................................................................................................... 476
Index .................................................................................................................................................................................................. 477
The Microchip Web Site ..................................................................................................................................................................... 489
Customer Change Notification Service .............................................................................................................................................. 489
Customer Support .............................................................................................................................................................................. 489
Reader Response .............................................................................................................................................................................. 490
Product Identification System............................................................................................................................................................. 491
DS39762F-page 8
PIC18F97J60 FAMILY
TO OUR VALUED CUSTOMERS
It is our intention to provide our valued customers with the best documentation possible to ensure successful use of your Microchip
products. To this end, we will continue to improve our publications to better suit your needs. Our publications will be refined and
enhanced as new volumes and updates are introduced.
If you have any questions or comments regarding this publication, please contact the Marketing Communications Department via
E-mail at [email protected] or fax the Reader Response Form in the back of this data sheet to (480) 792-4150. We
welcome your feedback.
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:
Microchips Worldwide Web site; http://www.microchip.com
Your local Microchip sales office (see last page)
When contacting a sales office, please specify which device, revision of silicon and data sheet (include literature number) you are
using.
DS39762F-page 9
PIC18F97J60 FAMILY
NOTES:
DS39762F-page 10
PIC18F97J60 FAMILY
1.0
DEVICE OVERVIEW
PIC18F87J60
PIC18F66J65
PIC18F96J60
PIC18F67J60
PIC18F96J65
PIC18F86J60
PIC18F97J60
PIC18F86J65
This family introduces a new line of low-voltage devices
with the foremost traditional advantage of all PIC18
microcontrollers namely, high computational performance and a rich feature set at an extremely
competitive price point. These features make the
PIC18F97J60 family a logical choice for many
high-performance applications where cost is a primary
consideration.
1.1
1.1.1
Core Features
OSCILLATOR OPTIONS AND
FEATURES
1.1.2
EXPANDED MEMORY
1.1.3
1.1.4
1.1.5
EASY MIGRATION
DS39762F-page 11
PIC18F97J60 FAMILY
1.2
DS39762F-page 12
1.3
2.
3.
4.
PIC18F97J60 FAMILY
TABLE 1-1:
Operating Frequency
Program Memory (Bytes)
Program Memory (Instructions)
PIC18F66J60
PIC18F66J65
PIC18F67J60
DC 41.667 MHz
DC 41.667 MHz
DC 41.667 MHz
64K
96K
128K
32764
49148
65532
3808
Interrupt Sources
26
I/O Ports
Ports A, B, C, D, E, F, G
I/O Pins
39
Timers
Capture/Compare/PWM Modules
Serial Communications
Yes
No
No
11 Input Channels
POR, BOR, RESET Instruction, Stack Full,
Stack Underflow, MCLR , WDT (PWRT, OST)
75 Instructions, 83 with Extended Instruction Set Enabled
Packages
TABLE 1-2:
64-Pin TQFP
Operating Frequency
Program Memory (Bytes)
Program Memory (Instructions)
Data Memory (Bytes)
Interrupt Sources
PIC18F86J60
PIC18F86J65
PIC18F87J60
DC 41.667 MHz
DC 41.667 MHz
DC 41.667 MHz
64K
96K
128K
32764
49148
65532
3808
27
I/O Ports
Ports A, B, C, D, E, F, G, H, J
I/O Pins
55
Timers
Capture/Compare/PWM Modules
Serial Communications
Yes
No
No
15 Input Channels
POR, BOR, RESET Instruction, Stack Full,
Stack Underflow, MCLR , WDT (PWRT, OST)
75 Instructions, 83 with Extended Instruction Set Enabled
80-Pin TQFP
DS39762F-page 13
PIC18F97J60 FAMILY
TABLE 1-3:
Operating Frequency
Program Memory (Bytes)
Program Memory (Instructions)
Data Memory (Bytes)
Interrupt Sources
PIC18F96J60
PIC18F96J65
PIC18F97J60
DC 41.667 MHz
DC 41.667 MHz
DC 41.667 MHz
64K
96K
128K
32764
49148
65532
3808
29
I/O Ports
Ports A, B, C, D, E, F, G, H, J
I/O Pins
70
Timers
Capture/Compare/PWM Modules
Serial Communications
Ethernet Communications (10Base-T)
Yes
Yes
DS39762F-page 14
16 Input Channels
POR, BOR, RESET Instruction, Stack Full,
Stack Underflow, MCLR , WDT (PWRT, OST)
75 Instructions, 83 with Extended Instruction Set Enabled
100-Pin TQFP
PIC18F97J60 FAMILY
FIGURE 1-1:
Table Pointer<21>
20
Address Latch
12
Data Address<12>
31 Level Stack
4
BSR
Address Latch
STKPTR
Program Memory
(64, 96, 128 Kbytes)
PORTB
RB0:RB7(1)
4
Access
Bank
12
FSR0
FSR1
FSR2
12
Data Latch
8
RA0:RA5(1)
Data Memory
(3808 Bytes)
PCLATU PCLATH
21
PORTA
Data Latch
inc/dec logic
PORTC
RC0:RC7(1)
inc/dec
logic
Table Latch
Address
Decode
ROM Latch
PORTD
IR
RD0:RD2(1)
Instruction
Decode and
Control
OSC2/CLKO
OSC1/CLKI
INTRC
Oscillator
ENVREG
PRODH PRODL
3
Power-up
Timer
Timing
Generation
State Machine
Control Signals
Precision
Band Gap
Reference
Watchdog
Timer
Voltage
Regulator
Brown-out
Reset(2)
8
W
8
8
Power-on
Reset
RE0:RE5(1)
8 x 8 Multiply
BITOP
Oscillator
Start-up Timer
PORTE
PORTF
RF1:RF7(1)
ALU<8>
8
PORTG
RG4(1)
VDDCORE/VCAP
Note
VDD, VSS
MCLR
ADC
10-Bit
Timer0
Timer1
Timer2
Timer3
Timer4
Comparators
ECCP1
ECCP2
ECCP3
CCP4
CCP5
MSSP1
EUSART1
1:
2:
Ethernet
DS39762F-page 15
PIC18F97J60 FAMILY
FIGURE 1-2:
Table Pointer<21>
20
Address Latch
4
BSR
STKPTR
12
FSR0
FSR1
FSR2
RB0:RB7(1)
4
Access
Bank
PORTC
RC0:RC7(1)
12
Data Latch
8
PORTB
12
Data Address<12>
Address Latch
Program Memory
(64, 96, 128 Kbytes)
RA0:RA5(1)
Data Memory
(3808 Bytes)
PCLATU PCLATH
21
PORTA
Data Latch
inc/dec logic
inc/dec
logic
Table Latch
PORTD
RD0:RD2(1)
Address
Decode
ROM Latch
PORTE
IR
RE0:RE7(1)
8
Instruction
Decode &
Control
OSC2/CLKO
OSC1/CLKI
ENVREG
Power-on
Reset
8
W
PORTG
RG0:RG4(1)
8
ALU<8>
Watchdog
Timer
PORTH
Brown-out
Reset(2)
Voltage
Regulator
RF1:RF7(1)
8 x 8 Multiply
BITOP
8
Oscillator
Start-up Timer
Precision
Band Gap
Reference
PORTF
PRODH PRODL
Power-up
Timer
Timing
Generation
INTRC
Oscillator
State Machine
Control Signals
RH0:RH7(1)
PORTJ
VDDCORE/VCAP
ECCP1
Note
VDD, VSS
RJ4:RJ5(1)
MCLR
ADC
10-Bit
Timer0
Timer1
Timer2
Timer3
Timer4
Comparators
ECCP2
ECCP3
CCP4
CCP5
EUSART1
EUSART2
MSSP1
1:
2:
DS39762F-page 16
Ethernet
PIC18F97J60 FAMILY
FIGURE 1-3:
Address Latch
31 Level Stack
STKPTR
PORTB
12
Data Address<12>
4
Address Latch
Program Memory
(64, 96, 128 Kbytes)
RA0:RA5(1)
Data Memory
(3808 Bytes)
PCLATU PCLATH
20
PORTA
Data Latch
12
BSR
RB0:RB7(1)
PORTC
Access
Bank
FSR0
FSR1
FSR2
RC0:RC7(1)
12
Data Latch
inc/dec
logic
8
Table Latch
PORTD
RD0:RD7(1)
Address
Decode
ROM Latch
PORTE
IR
RE0:RE7(1)
AD15:AD0, A19:A16
(Multiplexed with PORTD,
PORTE and PORTH)
State Machine
Control Signals
OSC2/CLKO
OSC1/CLKI
Timing
Generation
INTRC
Oscillator
ENVREG
Power-up
Timer
Voltage
Regulator
Brown-out
Reset(2)
8
W
PORTG
RG0:RG7(1)
8
ALU<8>
Power-on
Reset
Watchdog
Timer
RF0:RF7(1)
8 x 8 Multiply
BITOP
8
Oscillator
Start-up Timer
Precision
Band Gap
Reference
PORTF
PRODH PRODL
Instruction
Decode &
Control
PORTH
RH0:RH7(1)
PORTJ
RJ0:RJ7(1)
VDDCORE/VCAP
VDD, VSS
MCLR
ADC
10-Bit
Timer0
Timer1
Timer2
Timer3
Timer4
ECCP1
ECCP2
ECCP3
CCP4
CCP5
EUSART1
Note
Comparators
EUSART2
1:
2:
MSSP1
MSSP2
Ethernet
DS39762F-page 17
PIC18F97J60 FAMILY
TABLE 1-4:
Pin
Type
Buffer
Type
MCLR
ST
OSC1/CLKI
OSC1
39
Pin Name
CLKI
OSC2/CLKO
OSC2
40
CLKO
Description
RA0/LEDA/AN0
RA0
LEDA
AN0
24
RA1/LEDB/AN1
RA1
LEDB
AN1
23
RA2/AN2/VREFRA2
AN2
VREF-
22
RA3/AN3/VREF+
RA3
AN3
VREF+
21
RA4/T0CKI
RA4
T0CKI
28
RA5/AN4
RA5
AN4
27
Legend:
TTL
ST
I
P
=
=
=
=
DS39762F-page 18
I/O
O
I
TTL
Analog
Digital I/O.
Ethernet LEDA indicator output.
Analog Input 0.
I/O
O
I
TTL
Analog
Digital I/O.
Ethernet LEDB indicator output.
Analog Input 1.
I/O
I
I
TTL
Analog
Analog
Digital I/O.
Analog Input 2.
A/D reference voltage (low) input.
I/O
I
I
TTL
Analog
Analog
Digital I/O.
Analog Input 3.
A/D reference voltage (high) input.
I/O
I
ST
ST
I/O
I
TTL
Analog
Digital I/O.
Timer0 external clock input.
Digital I/O.
Analog Input 4.
CMOS
Analog
O
OD
=
=
=
=
PIC18F97J60 FAMILY
TABLE 1-4:
Pin Name
TQFP
Pin
Type
Buffer
Type
Description
PORTB is a bidirectional I/O port. PORTB can be software
programmed for internal weak pull-ups on all inputs.
RB0/INT0/FLT0
RB0
INT0
FLT0
RB1/INT1
RB1
INT1
RB2/INT2
RB2
INT2
RB3/INT3
RB3
INT3
RB4/KBI0
RB4
KBI0
44
RB5/KBI1
RB5
KBI1
43
RB6/KBI2/PGC
RB6
KBI2
PGC
42
RB7/KBI3/PGD
RB7
KBI3
PGD
37
Legend:
TTL
ST
I
P
=
=
=
=
I/O
I
I
TTL
ST
ST
Digital I/O.
External Interrupt 0.
Enhanced PWM Fault input (ECCP modules); enabled
in software.
I/O
I
TTL
ST
Digital I/O.
External Interrupt 1.
I/O
I
TTL
ST
Digital I/O.
External Interrupt 2.
I/O
I
TTL
ST
Digital I/O.
External Interrupt 3.
I/O
I
TTL
TTL
Digital I/O.
Interrupt-on-change pin.
I/O
I
TTL
TTL
Digital I/O.
Interrupt-on-change pin.
I/O
I
I/O
TTL
TTL
ST
Digital I/O.
Interrupt-on-change pin.
In-Circuit Debugger and ICSP programming clock pin.
I/O
I
I/O
TTL
TTL
ST
Digital I/O.
Interrupt-on-change pin.
In-Circuit Debugger and ICSP programming data pin.
CMOS
Analog
O
OD
=
=
=
=
DS39762F-page 19
PIC18F97J60 FAMILY
TABLE 1-4:
Pin Name
TQFP
Pin
Type
Buffer
Type
Description
PORTC is a bidirectional I/O port.
RC0/T1OSO/T13CKI
RC0
T1OSO
T13CKI
30
RC1/T1OSI/ECCP2/P2A
RC1
T1OSI
ECCP2
P2A
29
RC2/ECCP1/P1A
RC2
ECCP1
P1A
33
RC3/SCK1/SCL1
RC3
SCK1
SCL1
34
RC4/SDI1/SDA1
RC4
SDI1
SDA1
35
RC5/SDO1
RC5
SDO1
36
RC6/TX1/CK1
RC6
TX1
CK1
31
RC7/RX1/DT1
RC7
RX1
DT1
32
Legend:
TTL
ST
I
P
=
=
=
=
DS39762F-page 20
I/O
O
I
ST
ST
I/O
I
I/O
O
ST
CMOS
ST
Digital I/O.
Timer1 oscillator input.
Capture 2 input/Compare 2 output/PWM2 output.
ECCP2 PWM Output A.
I/O
I/O
O
ST
ST
Digital I/O.
Capture 1 input/Compare 1 output/PWM1 output.
ECCP1 PWM Output A.
I/O
I/O
I/O
ST
ST
ST
Digital I/O.
Synchronous serial clock input/output for SPI mode.
Synchronous serial clock input/output for I2C mode.
I/O
I
I/O
ST
ST
ST
Digital I/O.
SPI data in.
I2C data I/O.
I/O
O
ST
Digital I/O.
SPI data out.
I/O
O
I/O
ST
ST
Digital I/O.
EUSART1 asynchronous transmit.
EUSART1 synchronous clock (see related RX1/DT1 pin).
I/O
I
I/O
ST
ST
ST
Digital I/O.
EUSART1 asynchronous receive.
EUSART1 synchronous data (see related TX1/CK1 pin).
Digital I/O.
Timer1 oscillator output.
Timer1/Timer3 external clock input.
CMOS
Analog
O
OD
=
=
=
=
PIC18F97J60 FAMILY
TABLE 1-4:
Pin Name
TQFP
Pin
Type
Buffer
Type
Description
PORTD is a bidirectional I/O port.
RD0/P1B
RD0
P1B
60
RD1/ECCP3/P3A
RD1
ECCP3
P3A
59
RD2/CCP4/P3D
RD2
CCP4
P3D
58
Legend:
TTL
ST
I
P
=
=
=
=
I/O
O
ST
Digital I/O.
ECCP1 PWM Output B.
I/O
I/O
O
ST
ST
Digital I/O.
Capture 3 input/Compare 3 output/PWM3 output.
ECCP3 PWM Output A.
I/O
I/O
O
ST
ST
Digital I/O.
Capture 4 input/Compare 4 output/PWM4 output.
CCP4 PWM Output D.
CMOS
Analog
O
OD
=
=
=
=
DS39762F-page 21
PIC18F97J60 FAMILY
TABLE 1-4:
Pin Name
TQFP
Pin
Type
Buffer
Type
Description
PORTE is a bidirectional I/O port.
RE0/P2D
RE0
P2D
RE1/P2C
RE1
P2C
RE2/P2B
RE2
P2B
64
RE3/P3C
RE3
P3C
63
RE4/P3B
RE4
P3B
62
RE5/P1C
RE5
P1C
61
Legend:
TTL
ST
I
P
=
=
=
=
DS39762F-page 22
I/O
O
ST
Digital I/O.
ECCP2 PWM Output D.
I/O
O
ST
Digital I/O.
ECCP2 PWM Output C.
I/O
O
ST
Digital I/O.
ECCP2 PWM Output B.
I/O
O
ST
Digital I/O.
ECCP3 PWM Output C.
I/O
O
ST
Digital I/O.
ECCP3 PWM Output B.
I/O
O
ST
Digital I/O.
ECCP1 PWM Output C.
CMOS
Analog
O
OD
=
=
=
=
PIC18F97J60 FAMILY
TABLE 1-4:
Pin Name
TQFP
Pin
Type
Buffer
Type
Description
PORTF is a bidirectional I/O port.
RF1/AN6/C2OUT
RF1
AN6
C2OUT
17
RF2/AN7/C1OUT
RF2
AN7
C1OUT
16
RF3/AN8
RF3
AN8
15
RF4/AN9
RF4
AN9
14
RF5/AN10/CVREF
RF5
AN10
CVREF
13
RF6/AN11
RF6
AN11
12
RF7/SS1
RF7
SS1
11
Legend:
TTL
ST
I
P
=
=
=
=
I/O
I
O
ST
Analog
Digital I/O.
Analog Input 6.
Comparator 2 output.
I/O
I
O
ST
Analog
Digital I/O.
Analog Input 7.
Comparator 1 output.
I/O
I
ST
Analog
Digital I/O.
Analog Input 8.
I/O
I
ST
Analog
Digital I/O.
Analog Input 9.
I/O
I
O
ST
Analog
Digital I/O.
Analog Input 10.
Comparator reference voltage output.
I/O
I
ST
Analog
Digital I/O.
Analog Input 11.
I/O
I
ST
TTL
Digital I/O.
SPI slave select input.
CMOS
Analog
O
OD
=
=
=
=
DS39762F-page 23
PIC18F97J60 FAMILY
TABLE 1-4:
Pin Name
TQFP
Pin
Type
Buffer
Type
Description
PORTG is a bidirectional I/O port.
RG4/CCP5/P1D
RG4
CCP5
P1D
I/O
I/O
O
ST
ST
Digital I/O.
Capture 5 input/Compare 5 output/PWM5 output.
ECCP1 PWM Output D.
VSS
9, 25, 41, 56
VDD
26, 38, 57
AVSS
20
AVDD
19
ENVREG
18
ST
VDDCORE/VCAP
VDDCORE
10
P
VCAP
VSSPLL
55
VDDPLL
54
VSSTX
52
VDDTX
49
VSSRX
45
VDDRX
48
RBIAS
53
TPOUT+
51
TPOUT-
50
TPIN+
47
46
TPINLegend:
TTL
ST
I
P
=
=
=
=
DS39762F-page 24
Analog Bias current for Ethernet PHY. Must be tied to VSS via a resistor;
see Section 19.0 Ethernet Module for specification.
CMOS
Analog
O
OD
=
=
=
=
PIC18F97J60 FAMILY
TABLE 1-5:
Pin
Type
Buffer
Type
MCLR
ST
OSC1/CLKI
OSC1
49
Pin Name
CLKI
OSC2/CLKO
OSC2
50
CLKO
Description
RA0/LEDA/AN0
RA0
LEDA
AN0
30
RA1/LEDB/AN1
RA1
LEDB
AN1
29
RA2/AN2/VREFRA2
AN2
VREF-
28
RA3/AN3/VREF+
RA3
AN3
VREF+
27
RA4/T0CKI
RA4
T0CKI
34
RA5/AN4
RA5
AN4
33
Legend:
Note 1:
2:
3:
4:
I/O
O
I
TTL
Analog
Digital I/O.
Ethernet LEDA indicator output.
Analog Input 0.
I/O
O
I
TTL
Analog
Digital I/O.
Ethernet LEDB indicator output.
Analog Input 1.
I/O
I
I
TTL
Analog
Analog
Digital I/O.
Analog Input 2.
A/D reference voltage (low) input.
I/O
I
I
TTL
Analog
Analog
Digital I/O.
Analog Input 3.
A/D reference voltage (high) input.
I/O
I
ST
ST
I/O
I
TTL
Analog
Digital I/O.
Timer0 external clock input.
Digital I/O.
Analog Input 4.
DS39762F-page 25
PIC18F97J60 FAMILY
TABLE 1-5:
Pin Name
TQFP
Pin
Type
Buffer
Type
Description
PORTB is a bidirectional I/O port. PORTB can be software
programmed for internal weak pull-ups on all inputs.
RB0/INT0/FLT0
RB0
INT0
FLT0
RB1/INT1
RB1
INT1
RB2/INT2
RB2
INT2
RB3/INT3
RB3
INT3
RB4/KBI0
RB4
KBI0
54
RB5/KBI1
RB5
KBI1
53
RB6/KBI2/PGC
RB6
KBI2
PGC
52
RB7/KBI3/PGD
RB7
KBI3
PGD
47
Legend:
Note 1:
2:
3:
4:
I/O
I
I
TTL
ST
ST
Digital I/O.
External Interrupt 0.
Enhanced PWM Fault input (ECCP modules); enabled
in software.
I/O
I
TTL
ST
Digital I/O.
External Interrupt 1.
I/O
I
TTL
ST
Digital I/O.
External Interrupt 2.
I/O
I
TTL
ST
Digital I/O.
External Interrupt 3.
I/O
I
TTL
TTL
Digital I/O.
Interrupt-on-change pin.
I/O
I
TTL
TTL
Digital I/O.
Interrupt-on-change pin.
I/O
I
I/O
TTL
TTL
ST
Digital I/O.
Interrupt-on-change pin.
In-Circuit Debugger and ICSP programming clock pin.
I/O
I
I/O
TTL
TTL
ST
Digital I/O.
Interrupt-on-change pin.
In-Circuit Debugger and ICSP programming data pin.
DS39762F-page 26
PIC18F97J60 FAMILY
TABLE 1-5:
Pin Name
TQFP
Pin
Type
Buffer
Type
Description
PORTC is a bidirectional I/O port.
RC0/T1OSO/T13CKI
RC0
T1OSO
T13CKI
36
RC1/T1OSI/ECCP2/P2A
RC1
T1OSI
ECCP2(1)
P2A(1)
35
RC2/ECCP1/P1A
RC2
ECCP1
P1A
43
RC3/SCK1/SCL1
RC3
SCK1
SCL1
44
RC4/SDI1/SDA1
RC4
SDI1
SDA1
45
RC5/SDO1
RC5
SDO1
46
RC6/TX1/CK1
RC6
TX1
CK1
37
RC7/RX1/DT1
RC7
RX1
DT1
38
Legend:
Note 1:
2:
3:
4:
I/O
O
I
ST
ST
Digital I/O.
Timer1 oscillator output.
Timer1/Timer3 external clock input.
I/O
I
I/O
O
ST
CMOS
ST
Digital I/O.
Timer1 oscillator input.
Capture 2 input/Compare 2 output/PWM2 output.
ECCP2 PWM Output A.
I/O
I/O
O
ST
ST
Digital I/O.
Capture 1 input/Compare 1 output/PWM1 output.
ECCP1 PWM Output A.
I/O
I/O
I/O
ST
ST
ST
Digital I/O.
Synchronous serial clock input/output for SPI mode.
Synchronous serial clock input/output for I2C mode.
I/O
I
I/O
ST
ST
ST
Digital I/O.
SPI data in.
I2C data I/O.
I/O
O
ST
Digital I/O.
SPI data out.
I/O
O
I/O
ST
ST
Digital I/O.
EUSART1 asynchronous transmit.
EUSART1 synchronous clock (see related RX1/DT1 pin).
I/O
I
I/O
ST
ST
ST
Digital I/O.
EUSART1 asynchronous receive.
EUSART1 synchronous data (see related TX1/CK1 pin).
DS39762F-page 27
PIC18F97J60 FAMILY
TABLE 1-5:
Pin Name
TQFP
Pin
Type
Buffer
Type
Description
PORTD is a bidirectional I/O port.
RD0
72
I/O
ST
Digital I/O.
RD1
69
I/O
ST
Digital I/O.
RD2
68
I/O
ST
Digital I/O.
PORTE is a bidirectional I/O port.
RE0/P2D
RE0
P2D
RE1/P2C
RE1
P2C
RE2/P2B
RE2
P2B
78
RE3/P3C
RE3
P3C(2)
77
RE4/P3B
RE4
P3B(2)
76
RE5/P1C
RE5
P1C(2)
75
RE6/P1B
RE6
P1B(2)
74
RE7/ECCP2/P2A
RE7
ECCP2(3)
P2A(3)
73
Legend:
Note 1:
2:
3:
4:
I/O
O
ST
Digital I/O.
ECCP2 PWM Output D.
I/O
O
ST
Digital I/O.
ECCP2 PWM Output C.
I/O
O
ST
Digital I/O.
ECCP2 PWM Output B.
I/O
O
ST
Digital I/O.
ECCP3 PWM Output C.
I/O
O
ST
Digital I/O.
ECCP3 PWM Output B.
I/O
O
ST
Digital I/O.
ECCP1 PWM Output C.
I/O
O
ST
Digital I/O.
ECCP1 PWM Output B.
I/O
I/O
O
ST
ST
Digital I/O.
Capture 2 input/Compare 2 output/PWM2 output.
ECCP2 PWM Output A.
DS39762F-page 28
PIC18F97J60 FAMILY
TABLE 1-5:
Pin Name
TQFP
Pin
Type
Buffer
Type
Description
PORTF is a bidirectional I/O port.
RF1/AN6/C2OUT
RF1
AN6
C2OUT
23
RF2/AN7/C1OUT
RF2
AN7
C1OUT
18
RF3/AN8
RF3
AN8
17
RF4/AN9
RF4
AN9
16
RF5/AN10/CVREF
RF5
AN10
CVREF
15
RF6/AN11
RF6
AN11
14
RF7/SS1
RF7
SS1
13
Legend:
Note 1:
2:
3:
4:
I/O
I
O
ST
Analog
Digital I/O.
Analog Input 6.
Comparator 2 output.
I/O
I
O
ST
Analog
Digital I/O.
Analog Input 7.
Comparator 1 output.
I/O
I
ST
Analog
Digital I/O.
Analog Input 8.
I/O
I
ST
Analog
Digital I/O.
Analog Input 9.
I/O
I
O
ST
Analog
Digital I/O.
Analog Input 10.
Comparator reference voltage output.
I/O
I
ST
Analog
Digital I/O.
Analog Input 11.
I/O
I
ST
TTL
Digital I/O.
SPI slave select input.
DS39762F-page 29
PIC18F97J60 FAMILY
TABLE 1-5:
Pin Name
TQFP
Pin
Type
Buffer
Type
Description
PORTG is a bidirectional I/O port.
RG0/ECCP3/P3A
RG0
ECCP3
P3A
56
RG1/TX2/CK2
RG1
TX2
CK2
55
RG2/RX2/DT2
RG2
RX2
DT2
42
RG3/CCP4/P3D
RG3
CCP4
P3D
41
RG4/CCP5/P1D
RG4
CCP5
P1D
10
Legend:
Note 1:
2:
3:
4:
I/O
I/O
O
ST
ST
Digital I/O.
Capture 3 input/Compare 3 output/PWM3 output.
ECCP3 PWM Output A.
I/O
O
I/O
ST
ST
Digital I/O.
EUSART2 asynchronous transmit.
EUSART2 synchronous clock (see related RX2/DT2 pin).
I/O
I
I/O
ST
ST
ST
Digital I/O.
EUSART2 asynchronous receive.
EUSART2 synchronous data (see related TX2/CK2 pin).
I/O
I/O
O
ST
ST
Digital I/O.
Capture 4 input/Compare 4 output/PWM4 output.
ECCP3 PWM Output D.
I/O
I/O
O
ST
ST
Digital I/O.
Capture 5 input/Compare 5 output/PWM5 output.
ECCP1 PWM Output D.
DS39762F-page 30
PIC18F97J60 FAMILY
TABLE 1-5:
Pin Name
TQFP
Pin
Type
Buffer
Type
Description
PORTH is a bidirectional I/O port.
RH0
79
I/O
ST
Digital I/O.
RH1
80
I/O
ST
Digital I/O.
RH2
I/O
ST
Digital I/O.
RH3
I/O
ST
Digital I/O.
RH4/AN12/P3C
RH4
AN12
P3C(4)
22
I/O
I
O
ST
Analog
Digital I/O.
Analog Input 12.
ECCP3 PWM Output C.
RH5/AN13/P3B
RH5
AN13
P3B(4)
21
I/O
I
O
ST
Analog
Digital I/O.
Analog Input 13.
ECCP3 PWM Output B.
RH6/AN14/P1C
RH6
AN14
P1C(4)
20
I/O
I
O
ST
Analog
Digital I/O.
Analog Input 14.
ECCP1 PWM Output C.
RH7/AN15/P1B
RH7
AN15
P1B(4)
19
I/O
I
O
ST
Analog
Digital I/O.
Analog Input 15.
ECCP1 PWM Output B.
Legend:
Note 1:
2:
3:
4:
DS39762F-page 31
PIC18F97J60 FAMILY
TABLE 1-5:
Pin Name
TQFP
Pin
Type
Buffer
Type
Description
PORTJ is a bidirectional I/O port.
RJ4
39
I/O
ST
RJ5
40
I/O
ST
VSS
VDD
32, 48, 71
AVSS
26
AVDD
25
ENVREG
24
ST
VDDCORE/VCAP
VDDCORE
12
P
VCAP
Digital I/O.
Digital I/O
VSSPLL
67
VDDPLL
66
VSSTX
64
VDDTX
61
VSSRX
57
VDDRX
60
RBIAS
65
TPOUT+
63
TPOUT-
62
TPIN+
59
58
TPINLegend:
Note 1:
2:
3:
4:
Analog Bias current for Ethernet PHY. Must be tied to VSS via a resistor;
see Section 19.0 Ethernet Module for specification.
DS39762F-page 32
PIC18F97J60 FAMILY
TABLE 1-6:
Pin
Type
Buffer
Type
MCLR
13
ST
OSC1/CLKI
OSC1
63
Pin Name
CLKI
OSC2/CLKO
OSC2
64
CLKO
Description
RA0/LEDA/AN0
RA0
LEDA
AN0
35
RA1/LEDB/AN1
RA1
LEDB
AN1
34
RA2/AN2/VREFRA2
AN2
VREF-
33
RA3/AN3/VREF+
RA3
AN3
VREF+
32
RA4/T0CKI
RA4
T0CKI
42
RA5/AN4
RA5
AN4
41
Legend:
Note 1:
2:
3:
4:
5:
I/O
O
I
TTL
Analog
Digital I/O.
Ethernet LEDA indicator output.
Analog Input 0.
I/O
O
I
TTL
Analog
Digital I/O.
Ethernet LEDB indicator output.
Analog Input 1.
I/O
I
I
TTL
Analog
Analog
Digital I/O.
Analog Input 2.
A/D reference voltage (low) input.
I/O
I
I
TTL
Analog
Analog
Digital I/O.
Analog Input 3.
A/D reference voltage (high) input.
I/O
I
ST
ST
I/O
I
TTL
Analog
Digital I/O.
Timer0 external clock input.
Digital I/O.
Analog Input 4.
DS39762F-page 33
PIC18F97J60 FAMILY
TABLE 1-6:
Pin Name
TQFP
Pin
Type
Buffer
Type
Description
PORTB is a bidirectional I/O port. PORTB can be software
programmed for internal weak pull-ups on all inputs.
RB0/INT0/FLT0
RB0
INT0
FLT0
RB1/INT1
RB1
INT1
RB2/INT2
RB2
INT2
RB3/INT3/ECCP2/P2A
RB3
INT3
ECCP2(1)
P2A(1)
RB4/KBI0
RB4
KBI0
69
RB5/KBI1
RB5
KBI1
68
RB6/KBI2/PGC
RB6
KBI2
PGC
67
RB7/KBI3/PGD
RB7
KBI3
PGD
57
Legend:
Note 1:
2:
3:
4:
5:
I/O
I
I
TTL
ST
ST
Digital I/O.
External Interrupt 0.
Enhanced PWM Fault input (ECCP modules); enabled
in software.
I/O
I
TTL
ST
Digital I/O.
External Interrupt 1.
I/O
I
TTL
ST
Digital I/O.
External Interrupt 2.
I/O
I
I/O
O
TTL
ST
ST
Digital I/O.
External Interrupt 3.
Capture 2 input/Compare 2 output/PWM2 output.
ECCP2 PWM Output A.
I/O
I
TTL
TTL
Digital I/O.
Interrupt-on-change pin.
I/O
I
TTL
TTL
Digital I/O.
Interrupt-on-change pin.
I/O
I
I/O
TTL
TTL
ST
Digital I/O.
Interrupt-on-change pin.
In-Circuit Debugger and ICSP programming clock pin.
I/O
I
I/O
TTL
TTL
ST
Digital I/O.
Interrupt-on-change pin.
In-Circuit Debugger and ICSP programming data pin.
DS39762F-page 34
PIC18F97J60 FAMILY
TABLE 1-6:
Pin Name
TQFP
Pin
Type
Buffer
Type
Description
PORTC is a bidirectional I/O port.
RC0/T1OSO/T13CKI
RC0
T1OSO
T13CKI
44
RC1/T1OSI/ECCP2/P2A
RC1
T1OSI
ECCP2(2)
P2A(2)
43
RC2/ECCP1/P1A
RC2
ECCP1
P1A
53
RC3/SCK1/SCL1
RC3
SCK1
SCL1
54
RC4/SDI1/SDA1
RC4
SDI1
SDA1
55
RC5/SDO1
RC5
SDO1
56
RC6/TX1/CK1
RC6
TX1
CK1
45
RC7/RX1/DT1
RC7
RX1
DT1
46
Legend:
Note 1:
2:
3:
4:
5:
I/O
O
I
ST
ST
Digital I/O.
Timer1 oscillator output.
Timer1/Timer3 external clock input.
I/O
I
I/O
O
ST
CMOS
ST
Digital I/O.
Timer1 oscillator input.
Capture 2 input/Compare 2 output/PWM2 output.
ECCP2 PWM Output A.
I/O
I/O
O
ST
ST
Digital I/O.
Capture 1 input/Compare 1 output/PWM1 output.
ECCP1 PWM Output A.
I/O
I/O
I/O
ST
ST
ST
Digital I/O.
Synchronous serial clock input/output for SPI mode.
Synchronous serial clock input/output for I2C mode.
I/O
I
I/O
ST
ST
ST
Digital I/O.
SPI data in.
I2C data I/O.
I/O
O
ST
Digital I/O.
SPI data out.
I/O
O
I/O
ST
ST
Digital I/O.
EUSART1 asynchronous transmit.
EUSART1 synchronous clock (see related RX1/DT1 pin).
I/O
I
I/O
ST
ST
ST
Digital I/O.
EUSART1 asynchronous receive.
EUSART1 synchronous data (see related TX1/CK1 pin).
DS39762F-page 35
PIC18F97J60 FAMILY
TABLE 1-6:
Pin Name
TQFP
Pin
Type
Buffer
Type
Description
PORTD is a bidirectional I/O port.
RD0/AD0/PSP0
RD0
AD0
PSP0
92
RD1/AD1/PSP1
RD1
AD1
PSP1
91
RD2/AD2/PSP2
RD2
AD2
PSP2
90
RD3/AD3/PSP3
RD3
AD3
PSP3
89
RD4/AD4/PSP4/SDO2
RD4
AD4
PSP4
SDO2
88
RD5/AD5/PSP5/
SDI2/SDA2
RD5
AD5
PSP5
SDI2
SDA2
87
RD6/AD6/PSP6/
SCK2/SCL2
RD6
AD6
PSP6
SCK2
SCL2
84
RD7/AD7/PSP7/SS2
RD7
AD7
PSP7
SS2
83
Legend:
Note 1:
2:
3:
4:
5:
I/O
I/O
I/O
ST
TTL
TTL
Digital I/O.
External Memory Address/Data 0.
Parallel Slave Port data.
I/O
I/O
I/O
ST
TTL
TTL
Digital I/O.
External Memory Address/Data 1.
Parallel Slave Port data.
I/O
I/O
I/O
ST
TTL
TTL
Digital I/O.
External Memory Address/Data 2.
Parallel Slave Port data.
I/O
I/O
I/O
ST
TTL
TTL
Digital I/O.
External Memory Address/Data 3.
Parallel Slave Port data.
I/O
I/O
I/O
O
ST
TTL
TTL
Digital I/O.
External Memory Address/Data 4.
Parallel Slave Port data.
SPI data out.
I/O
I/O
I/O
I
I/O
ST
TTL
TTL
ST
ST
Digital I/O.
External Memory Address/Data 5.
Parallel Slave Port data.
SPI data in.
I2C data I/O.
I/O
I/O
I/O
I/O
I/O
ST
TTL
TTL
ST
ST
Digital I/O.
External Memory Address/Data 6.
Parallel Slave Port data.
Synchronous serial clock input/output for SPI mode.
Synchronous serial clock input/output for I2C mode.
I/O
I/O
I/O
I
ST
TTL
TTL
TTL
Digital I/O.
External Memory Address/Data 7.
Parallel Slave Port data.
SPI slave select input.
DS39762F-page 36
PIC18F97J60 FAMILY
TABLE 1-6:
Pin Name
TQFP
Pin
Type
Buffer
Type
Description
PORTE is a bidirectional I/O port.
RE0/AD8/RD/P2D
RE0
AD8
RD
P2D
RE1/AD9/WR/P2C
RE1
AD9
WR
P2C
RE2/AD10/CS/P2B
RE2
AD10
CS
P2B
98
RE3/AD11/P3C
RE3
AD11
P3C(3)
97
RE4/AD12/P3B
RE4
AD12
P3B(3)
96
RE5/AD13/P1C
RE5
AD13
P1C(3)
95
RE6/AD14/P1B
RE6
AD14
P1B(3)
94
RE7/AD15/ECCP2/P2A
RE7
AD15
ECCP2(4)
P2A(4)
93
Legend:
Note 1:
2:
3:
4:
5:
I/O
I/O
I
O
ST
TTL
TTL
Digital I/O.
External Memory Address/Data 8.
Read control for Parallel Slave Port.
ECCP2 PWM Output D.
I/O
I/O
I
O
ST
TTL
TTL
Digital I/O.
External Memory Address/Data 9.
Write control for Parallel Slave Port.
ECCP2 PWM Output C.
I/O
I/O
I
O
ST
TTL
TTL
Digital I/O.
External Memory Address/Data 10.
Chip select control for Parallel Slave Port.
ECCP2 PWM Output B.
I/O
I/O
O
ST
TTL
Digital I/O.
External Memory Address/Data 11.
ECCP3 PWM Output C.
I/O
I/O
O
ST
TTL
Digital I/O.
External Memory Address/Data 12.
ECCP3 PWM Output B.
I/O
I/O
O
ST
TTL
Digital I/O.
External Memory Address/Data 13.
ECCP1 PWM Output C.
I/O
I/O
O
ST
TTL
Digital I/O.
External Memory Address/Data 14.
ECCP1 PWM Output B.
I/O
I/O
I/O
O
ST
TTL
ST
Digital I/O.
External Memory Address/Data 15.
Capture 2 input/Compare 2 output/PWM2 output.
ECCP2 PWM Output A.
DS39762F-page 37
PIC18F97J60 FAMILY
TABLE 1-6:
Pin Name
TQFP
Pin
Type
Buffer
Type
Description
PORTF is a bidirectional I/O port.
RF0/AN5
RF0
AN5
12
RF1/AN6/C2OUT
RF1
AN6
C2OUT
28
RF2/AN7/C1OUT
RF2
AN7
C1OUT
23
RF3/AN8
RF3
AN8
22
RF4/AN9
RF4
AN9
21
RF5/AN10/CVREF
RF5
AN10
CVREF
20
RF6/AN11
RF6
AN11
19
RF7/SS1
RF7
SS1
18
Legend:
Note 1:
2:
3:
4:
5:
I/O
I
ST
Analog
Digital I/O.
Analog Input 5.
I/O
I
O
ST
Analog
Digital I/O.
Analog Input 6.
Comparator 2 output.
I/O
I
O
ST
Analog
Digital I/O.
Analog Input 7.
Comparator 1 output.
I/O
I
ST
Analog
Digital I/O.
Analog Input 8.
I/O
I
ST
Analog
Digital I/O.
Analog Input 9.
I/O
I
O
ST
Analog
Digital I/O.
Analog Input 10.
Comparator reference voltage output.
I/O
I
ST
Analog
Digital I/O.
Analog Input 11.
I/O
I
ST
TTL
Digital I/O.
SPI slave select input.
DS39762F-page 38
PIC18F97J60 FAMILY
TABLE 1-6:
Pin Name
TQFP
Pin
Type
Buffer
Type
Description
PORTG is a bidirectional I/O port.
RG0/ECCP3/P3A
RG0
ECCP3
P3A
71
RG1/TX2/CK2
RG1
TX2
CK2
70
RG2/RX2/DT2
RG2
RX2
DT2
52
RG3/CCP4/P3D
RG3
CCP4
P3D
51
RG4/CCP5/P1D
RG4
CCP5
P1D
14
I/O
I/O
O
ST
ST
Digital I/O.
Capture 3 input/Compare 3 output/PWM3 output.
ECCP3 PWM Output A.
I/O
O
I/O
ST
ST
Digital I/O.
EUSART2 asynchronous transmit.
EUSART2 synchronous clock (see related RX2/DT2 pin).
I/O
I
I/O
ST
ST
ST
Digital I/O.
EUSART2 asynchronous receive.
EUSART2 synchronous data (see related TX2/CK2 pin).
I/O
I/O
O
ST
ST
Digital I/O.
Capture 4 input/Compare 4 output/PWM4 output.
ECCP3 PWM Output D.
I/O
I/O
O
ST
ST
Digital I/O.
Capture 5 input/Compare 5 output/PWM5 output.
ECCP1 PWM Output D.
RG5
11
I/O
ST
Digital I/O.
RG6
10
I/O
ST
Digital I/O.
RG7
38
I/O
ST
Digital I/O.
Legend:
Note 1:
2:
3:
4:
5:
DS39762F-page 39
PIC18F97J60 FAMILY
TABLE 1-6:
Pin Name
TQFP
Pin
Type
Buffer
Type
Description
PORTH is a bidirectional I/O port.
RH0/A16
RH0
A16
99
RH1/A17
RH1
A17
100
RH2/A18
RH2
A18
RH3/A19
RH3
A19
RH4/AN12/P3C
RH4
AN12
P3C(5)
27
RH5/AN13/P3B
RH5
AN13
P3B(5)
26
RH6/AN14/P1C
RH6
AN14
P1C(5)
25
RH7/AN15/P1B
RH7
AN15
P1B(5)
24
Legend:
Note 1:
2:
3:
4:
5:
I/O
O
ST
Digital I/O.
External Memory Address 16.
I/O
O
ST
Digital I/O.
External Memory Address 17.
I/O
O
ST
Digital I/O.
External Memory Address 18.
I/O
O
ST
Digital I/O.
External Memory Address 19.
I/O
I
O
ST
Analog
Digital I/O.
Analog Input 12.
ECCP3 PWM Output C.
I/O
I
O
ST
Analog
Digital I/O.
Analog Input 13.
ECCP3 PWM Output B.
I/O
I
O
ST
Analog
Digital I/O.
Analog Input 14.
ECCP1 PWM Output C.
I/O
I
O
ST
Analog
Digital I/O.
Analog Input 15.
ECCP1 PWM Output B.
DS39762F-page 40
PIC18F97J60 FAMILY
TABLE 1-6:
Pin Name
TQFP
Pin
Type
Buffer
Type
Description
PORTJ is a bidirectional I/O port.
RJ0/ALE
RJ0
ALE
49
RJ1/OE
RJ1
OE
50
RJ2/WRL
RJ2
WRL
66
RJ3/WRH
RJ3
WRH
61
RJ4/BA0
RJ4
BA0
47
RJ5/CE
RJ5
CE
48
RJ6/LB
RJ6
LB
58
RJ7/UB
RJ7
UB
39
Legend:
Note 1:
2:
3:
4:
5:
I/O
O
ST
Digital I/O.
External memory address latch enable.
I/O
O
ST
Digital I/O.
External memory output enable.
I/O
O
ST
Digital I/O.
External memory write low control.
I/O
O
ST
Digital I/O.
External memory write high control.
I/O
O
ST
Digital I/O.
External Memory Byte Address 0 control.
I/O
O
ST
Digital I/O
External memory chip enable control.
I/O
O
ST
Digital I/O.
External memory low byte control.
I/O
O
ST
Digital I/O.
External memory high byte control.
DS39762F-page 41
PIC18F97J60 FAMILY
TABLE 1-6:
Pin
Type
Buffer
Type
NC
No connect.
VSS
VDD
AVSS
31
AVDD
30
ENVREG
29
ST
VDDCORE/VCAP
VDDCORE
16
P
Pin Name
VCAP
Description
VSSPLL
82
VDDPLL
81
VSSTX
79
VDDTX
76
VSSRX
72
VDDRX
75
RBIAS
80
TPOUT+
78
TPOUT-
77
TPIN+
74
73
TPINLegend:
Note 1:
2:
3:
4:
5:
Analog Bias current for Ethernet PHY. Must be tied to VSS via a resistor;
see Section 19.0 Ethernet Module for specification.
DS39762F-page 42
PIC18F97J60 FAMILY
2.0
FIGURE 2-1:
RECOMMENDED
MINIMUM CONNECTIONS
C2(2)
VCAP/VDDCORE
C1
VSS
VDD
VDD
VSS
C3(2)
C6(2)
C5(2)
C4(2)
R1: 10 k
Note:
C7
PIC18FXXJXX
(1) (1)
ENVREG
MCLR
VSS
VDD
R2
VSS
R1
VDD
VDD
AVSS
AVDD
2.1
2:
DS39762F-page 43
PIC18F97J60 FAMILY
2.2
2.2.1
2.2.2
TANK CAPACITORS
DS39762F-page 44
2.3
FIGURE 2-2:
VDD
R1
R2
JP
MCLR
PIC18FXXJXX
C1
Note 1:
R1 10 k is recommended. A suggested
starting value is 10 k. Ensure that the
MCLR pin VIH and VIL specifications are met.
2:
PIC18F97J60 FAMILY
2.4
FIGURE 2-3:
10
ESR ()
0.1
0.01
0.001
0.01
Note:
0.1
1
10
100
Frequency (MHz)
1000 10,000
TABLE 2-1:
Make
Part #
Nominal
Capacitance
Base Tolerance
Rated Voltage
Temp. Range
TDK
C3216X7R1C106K
10 F
10%
16V
-55 to 125C
TDK
C3216X5R1C106K
10 F
10%
16V
-55 to 85C
Panasonic
ECJ-3YX1C106K
10 F
10%
16V
-55 to 125C
Panasonic
ECJ-4YB1C106K
10 F
10%
16V
-55 to 85C
Murata
GRM32DR71C106KA01L
10 F
10%
16V
-55 to 125C
Murata
GRM31CR61C106KC31L
10 F
10%
16V
-55 to 85C
DS39762F-page 45
PIC18F97J60 FAMILY
CONSIDERATIONS FOR CERAMIC
CAPACITORS
FIGURE 2-4:
2.4.1
10
0
-10
16V Capacitor
-20
-30
-40
10V Capacitor
-50
-60
-70
6.3V Capacitor
-80
0
10
11
12
13
14
15
16
17
2.5
ICSP Pins
The PGC and PGD pins are used for In-Circuit Serial
Programming (ICSP) and debugging purposes. It
is recommended to keep the trace length between the
ICSP connector and the ICSP pins on the device as
short as possible. If the ICSP connector is expected to
experience an ESD event, a series resistor is recommended, with the value in the range of a few tens of
ohms, not to exceed 100.
Pull-up resistors, series diodes, and capacitors on the
PGC and PGD pins are not recommended as they will
interfere with the programmer/debugger communications to the device. If such discrete components are an
application requirement, they should be removed from
the circuit during programming and debugging. Alternatively, refer to the AC/DC characteristics and timing
requirements information in the respective device
Flash programming specification for information on
capacitive loading limits, and pin input voltage high
(VIH) and input low (VIL) requirements.
For device emulation, ensure that the Communication
Channel Select (i.e., PGCx/PGDx pins), programmed
into the device, matches the physical connections for
the ICSP to the Microchip debugger/emulator tool.
For more information on available Microchip
development tools connection requirements, refer to
Section 27.0 Development Support.
DS39762F-page 46
PIC18F97J60 FAMILY
2.6
FIGURE 2-5:
2.7
Unused I/Os
Primary Oscillator
Crystal
DEVICE PINS
Primary
Oscillator
OSC1
C1
OSC2
GND
C2
`
T1OSO
T1OS I
Timer1 Oscillator
Crystal
SUGGESTED PLACEMENT
OF THE OSCILLATOR
CIRCUIT
T1 Oscillator: C1
T1 Oscillator: C2
GND
C1
OSCI
DEVICE PINS
DS39762F-page 47
PIC18F97J60 FAMILY
NOTES:
DS39762F-page 48
PIC18F97J60 FAMILY
3.0
3.1
OSCILLATOR
CONFIGURATIONS
3.2
Overview
1.
2.
HS
HSPLL
3.
4.
EC
ECPLL
5.
INTRC
Oscillator Types
3.2.1
High-Speed Crystal/Resonator
High-Speed Crystal/Resonator
with Software PLL Control
External Clock with FOSC/4 Output
External Clock with Software PLL
Control
Internal 31 kHz Oscillator
OSCILLATOR CONTROL
FIGURE 3-1:
Primary Oscillator
Ethernet Clock
OSC2
OSC1
PLL
Prescaler
5x PLL
T1OSO
T1OSI
Clock
Control
PLL
Postscaler
FOSC<2:0>
OSCCON<1:0>
Secondary Oscillator
T1OSCEN
Enable
Oscillator
OSCTUNE<7:5>(1)
PLL/Prescaler/Postscaler
T1OSC
INTRC
Source
MUX
Sleep
Peripherals
CPU
Internal Oscillator
IDLEN
WDT, PWRT, FSCM
and Two-Speed Start-up
Clock Source Option
for Other Modules
Note 1:
See Table 3-2 for OSCTUNE register configurations and their corresponding frequencies.
DS39762F-page 49
PIC18F97J60 FAMILY
3.3
Crystal Oscillator/Ceramic
Resonators (HS Modes)
Note 1: Higher capacitance increases the stability of the oscillator but also increases the
start-up time.
2: Since each crystal has its own characteristics, the user should consult the crystal
manufacturer for appropriate values of
external components.
FIGURE 3-2:
CRYSTAL OSCILLATOR
OPERATION (HS OR
HSPLL CONFIGURATION)
C1(1)
OSC1
XTAL
C2(1)
To
Internal
Logic
RF(3)
Sleep
OSC2
Note 1:
RS(2)
PIC18FXXJ6X
3:
TABLE 3-1:
HS
3.4
The EC and ECPLL Oscillator modes require an external clock source to be connected to the OSC1 pin.
There is no oscillator start-up time required after a
Power-on Reset or after an exit from Sleep mode.
In the EC Oscillator mode, the oscillator frequency,
divided by 4, is available on the OSC2 pin. This signal
may be used for test purposes or to synchronize other
logic. Figure 3-3 shows the pin connections for the EC
Oscillator mode.
2:
Osc Type
FIGURE 3-3:
C2
33 pF
33 pF
OSC1/CLKI
Clock from
Ext. System
PIC18FXXJ6X
FOSC/4
EXTERNAL CLOCK
INPUT OPERATION
(EC CONFIGURATION)
OSC2/CLKO
FIGURE 3-4:
EXTERNAL CLOCK
INPUT OPERATION
(HS CONFIGURATION)
OSC1
Clock from
Ext. System
PIC18FXXJ6X
(HS Mode)
Open
OSC2
DS39762F-page 50
PIC18F97J60 FAMILY
3.5
3.6
REGISTER 3-1:
3.6.1
PLL BLOCK
To accommodate a range of applications and microcontroller clock speeds, a separate PLL block is
incorporated into the clock system. It consists of three
components:
A configurable prescaler (1:2 or 1:3)
A 5x PLL frequency multiplier
A configurable postscaler (1:1, 1:2, or 1:3)
The operation of the PLL blocks components is
controlled by the OSCTUNE register (Register 3-1).
The use of the PLL blocks prescaler and postscaler,
with or without the PLL itself, provides a range of
system clock frequencies to choose from, including the
unaltered 25 MHz of the primary oscillator. The full
range of possible oscillator configurations compatible
with Ethernet operation is shown in Table 3-2.
R/W-0
R/W-0
R/W-0
R/W-0
U-0
U-0
U-0
U-0
PPST1
PLLEN(1)
PPST0
PPRE
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
bit 3-0
Unimplemented: Read as 0
Note 1:
x = Bit is unknown
Available only for ECPLL and HSPLL oscillator configurations; otherwise, this bit is unavailable and is read
as 0.
DS39762F-page 51
PIC18F97J60 FAMILY
TABLE 3-2:
5x PLL
PLL Prescaler
PLL Postscaler
PLL Block
Configuration
(OSCTUNE<7:4>)
Clock Frequency
(MHz)
Disabled
x101
(Note 1)
1111
31.2500
0111
20.8333
2
Enabled
Disabled
Disabled
x100
41.6667
1110
20.8333
0110
13.8889
Disabled(2)
Disabled
x00x
25 (Default)
1011
6.2500
0011
4.1667
1010
4.1667
0010
2.7778
2
3
3.7
DS39762F-page 52
PIC18F97J60 FAMILY
3.7.1
REGISTER 3-2:
R/W-0
IDLEN
U-0
U-0
R-q
U-0
R/W-0
R/W-0
OSTS(1)
SCS1
SCS0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6-4
Unimplemented: Read as 0
bit 3
bit 2
Unimplemented: Read as 0
bit 1-0
Note 1:
DS39762F-page 53
PIC18F97J60 FAMILY
3.7.1.1
3.7.2
OSCILLATOR TRANSITIONS
3.8
3.9
Power-up Delays
TABLE 3-3:
Oscillator Mode
OSC1 Pin
OSC2 Pin
EC, ECPLL
HS, HSPLL
Note:
See Table 5-2 in Section 5.0 Reset for time-outs due to Sleep and MCLR Reset.
DS39762F-page 54
PIC18F97J60 FAMILY
4.0
4.1.1
POWER-MANAGED MODES
CLOCK SOURCES
Run mode
Idle mode
Sleep mode
4.1.2
4.1
TABLE 4-1:
ENTERING POWER-MANAGED
MODES
POWER-MANAGED MODES
OSCCON<7,1:0>
Mode
Module Clocking
Available Clock and Oscillator Source
IDLEN(1)
SCS<1:0>
CPU
Peripherals
N/A
Off
Off
PRI_RUN
N/A
10
Clocked
Clocked
SEC_RUN
N/A
01
Clocked
Clocked
RC_RUN
N/A
11
Clocked
Clocked
Internal Oscillator
PRI_IDLE
10
Off
Clocked
SEC_IDLE
01
Off
Clocked
RC_IDLE
11
Off
Clocked
Internal Oscillator
Sleep
Note 1:
DS39762F-page 55
PIC18F97J60 FAMILY
4.1.3
4.1.4
4.2
Run Modes
4.2.1
4.2.2
SEC_RUN MODE
PRI_RUN MODE
The PRI_RUN mode is the normal, full-power execution mode of the microcontroller. This is also the default
mode upon a device Reset unless Two-Speed Start-up
is enabled (see Section 25.4 Two-Speed Start-up
for details). In this mode, the OSTS bit is set. (see
Section 3.7.1 Oscillator Control Register).
DS39762F-page 56
PIC18F97J60 FAMILY
FIGURE 4-1:
T1OSI
Q2
1
n-1
Q3
Q4
Q1
Q2
Q3
Clock Transition
OSC1
CPU
Clock
Peripheral
Clock
Program
Counter
PC
FIGURE 4-2:
PC + 2
PC + 4
Q2
Q3
Q4
Q1
Q2 Q3 Q4 Q1 Q2 Q3
T1OSI
OSC1
TOST(1)
TPLL(1)
1
PLL Clock
Output
n-1 n
Clock
Transition
CPU Clock
Peripheral
Clock
Program
Counter
SCS<1:0> bits Changed
PC + 2
PC
PC + 4
Note 1: TOST = 1024 TOSC; TPLL = 2 ms (approx). These intervals are not shown to scale.
DS39762F-page 57
PIC18F97J60 FAMILY
4.2.3
RC_RUN MODE
FIGURE 4-3:
INTRC
Q2
1
n-1
Q3
Q4
Q1
Q2
Q3
Clock Transition
OSC1
CPU
Clock
Peripheral
Clock
Program
Counter
PC
FIGURE 4-4:
PC + 2
PC + 4
Q2
Q3
Q4
Q2 Q3 Q4 Q1 Q2 Q3
Q1
INTRC
OSC1
TOST(1)
TPLL(1)
1
PLL Clock
Output
n-1 n
Clock
Transition
CPU Clock
Peripheral
Clock
Program
Counter
SCS<1:0> bits Changed
PC
PC + 2
PC + 4
Note 1: TOST = 1024 TOSC; TPLL = 2 ms (approx). These intervals are not shown to scale.
DS39762F-page 58
PIC18F97J60 FAMILY
4.3
Sleep Mode
4.4
Idle Modes
Entering the Sleep mode from any other mode does not
require a clock switch. This is because no clocks are
needed once the controller has entered Sleep. If the
WDT is selected, the INTRC source will continue to
operate. If the Timer1 oscillator is enabled, it will also
continue to run.
FIGURE 4-5:
Q1 Q2 Q3 Q4 Q1
OSC1
CPU
Clock
Peripheral
Clock
Sleep
Program
Counter
PC
FIGURE 4-6:
PC + 2
Q1
OSC1
PLL Clock
Output
TOST(1)
TPLL(1)
CPU Clock
Peripheral
Clock
Program
Counter
PC
Wake Event
PC + 2
PC + 4
PC + 6
Note 1: TOST = 1024 TOSC; TPLL = 2 ms (approx). These intervals are not shown to scale.
DS39762F-page 59
PIC18F97J60 FAMILY
4.4.1
PRI_IDLE MODE
4.4.2
FIGURE 4-7:
SEC_IDLE MODE
Note:
Q4
Q3
Q2
Q1
OSC1
CPU Clock
Peripheral
Clock
Program
Counter
FIGURE 4-8:
PC
PC + 2
Q2
Q3
Q4
OSC1
TCSD
CPU Clock
Peripheral
Clock
Program
Counter
PC
Wake Event
DS39762F-page 60
PIC18F97J60 FAMILY
4.4.3
RC_IDLE MODE
In RC_IDLE mode, the CPU is disabled but the peripherals continue to be clocked from the internal oscillator.
This mode allows for controllable power conservation
during Idle periods.
From RC_RUN mode, RC_IDLE mode is entered by
setting the IDLEN bit and executing a SLEEP instruction.
If the device is in another Run mode, first set IDLEN,
then clear the SCS bits and execute SLEEP. When the
clock source is switched to the INTRC, the primary
oscillator is shut down and the OSTS bit is cleared.
When a wake event occurs, the peripherals continue to
be clocked from the INTRC. After a delay of TCSD
following the wake event, the CPU begins executing
code being clocked by the INTRC. The IDLEN and
SCS bits are not affected by the wake-up. The INTRC
source will continue to run if either the WDT or the
Fail-Safe Clock Monitor is enabled.
4.5
4.5.1
EXIT BY INTERRUPT
4.5.2
4.5.3
EXIT BY RESET
4.5.4
DS39762F-page 61
PIC18F97J60 FAMILY
NOTES:
DS39762F-page 62
PIC18F97J60 FAMILY
5.0
RESET
FIGURE 5-1:
5.1
RCON Register
External Reset
MCLR
( )_IDLE
Sleep
WDT
Time-out
VDD Rise
Detect
VDD
POR Pulse
Brown-out
Reset(1)
S
PWRT
32 s
PWRT
INTRC
Note 1:
66 ms
Chip_Reset
The ENVREG pin must be tied high to enable Brown-out Reset. The Brown-out Reset is provided by the on-chip
voltage regulator when there is insufficient source voltage to maintain regulation.
DS39762F-page 63
PIC18F97J60 FAMILY
REGISTER 5-1:
R/W-0
U-0
R/W-1
R/W-1
R-1
R-1
R/W-0
R/W-0
IPEN
CM
RI
TO
PD
POR
BOR
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
Unimplemented: Read as 0
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
Note 1: It is recommended that the POR bit be set after a Power-on Reset has been detected so that subsequent
Power-on Resets may be detected.
2: If the on-chip voltage regulator is disabled, BOR remains 0 at all times. See Section 5.4.1 Detecting
BOR for more information.
3: 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).
DS39762F-page 64
PIC18F97J60 FAMILY
5.2
FIGURE 5-2:
5.3
D(1)
5.4
MCLR
PIC18FXXJ6X
Note 1:
2:
3:
R(2)
R1(3)
VDD
VDD
EXTERNAL POWER-ON
RESET CIRCUIT (FOR
SLOW VDD POWER-UP)
5.4.1
DETECTING BOR
5.5
DS39762F-page 65
PIC18F97J60 FAMILY
A CM Reset behaves similarly to a Master Clear Reset,
RESET instruction, WDT time-out or Stack Event Reset.
As with all hard and power Reset events, the device
Configuration Words are reloaded from the Flash Configuration Words in program memory as the device
restarts.
5.6
FIGURE 5-3:
5.6.1
TIME-OUT SEQUENCE
TIME-OUT SEQUENCE ON POWER-UP (MCLR TIED TO VDD, VDD RISE < TPWRT)
VDD
MCLR
INTERNAL POR
TPWRT
PWRT TIME-OUT
INTERNAL RESET
FIGURE 5-4:
VDD
MCLR
INTERNAL POR
TPWRT
PWRT TIME-OUT
INTERNAL RESET
DS39762F-page 66
PIC18F97J60 FAMILY
FIGURE 5-5:
VDD
MCLR
INTERNAL POR
TPWRT
PWRT TIME-OUT
INTERNAL RESET
FIGURE 5-6:
SLOW RISE TIME (MCLR TIED TO VDD, VDD RISE > TPWRT)
3.3V
VDD
0V
1V
MCLR
INTERNAL POR
TPWRT
PWRT TIME-OUT
INTERNAL RESET
DS39762F-page 67
PIC18F97J60 FAMILY
5.7
TABLE 5-1:
Condition
Program
Counter(1)
RCON Register
STKPTR Register
CM
RI
TO
PD
POR
BOR
STKFUL
STKUNF
Power-on Reset
0000h
RESET Instruction
0000h
Brown-out Reset
0000h
0000h
0000h
0000h
0000h
0000h
0000h
0000h
0000h
PC + 2
PC + 2
Legend: u = unchanged
Note 1: When the wake-up is due to an interrupt, and the GIEH or GIEL bit is set, the PC is loaded with the interrupt
vector (0008h or 0018h).
DS39762F-page 68
PIC18F97J60 FAMILY
TABLE 5-2:
Register
Applicable Devices
Power-on Reset,
Brown-out Reset
MCLR Reset,
WDT Reset,
RESET Instruction,
Stack Resets,
CM Reset
TOSU
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---0 0000
---0 0000
---0 uuuu(1)
TOSH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu(1)
TOSL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu(1)
STKPTR
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
00-0 0000
uu-0 0000
uu-u uuuu(1)
PCLATU
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---0 0000
---0 0000
---u uuuu
PCLATH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
PCL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
PC + 2(2)
TBLPTRU
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
--00 0000
--00 0000
--uu uuuu
TBLPTRH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
TBLPTRL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
TABLAT
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
PRODH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
PRODL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
INTCON
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 000x
0000 000u
uuuu uuuu(3)
INTCON2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
1111 1111
1111 1111
uuuu uuuu(3)
INTCON3
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
1100 0000
1100 0000
uuuu uuuu(3)
INDF0
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
N/A
N/A
N/A
POSTINC0
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
N/A
N/A
N/A
POSTDEC0
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
N/A
N/A
N/A
PREINC0
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
N/A
N/A
N/A
PLUSW0
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
N/A
N/A
N/A
FSR0H
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---- xxxx
---- uuuu
---- uuuu
FSR0L
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
WREG
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
INDF1
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
N/A
N/A
N/A
POSTINC1
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
N/A
N/A
N/A
POSTDEC1
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
N/A
N/A
N/A
PREINC1
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
N/A
N/A
N/A
PLUSW1
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
N/A
N/A
N/A
FSR1H
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---- xxxx
---- uuuu
---- uuuu
FSR1L
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
BSR
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---- 0000
---- 0000
---- uuuu
INDF2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
N/A
N/A
N/A
POSTINC2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
N/A
N/A
N/A
POSTDEC2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
N/A
N/A
N/A
PREINC2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
N/A
N/A
N/A
PLUSW2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
N/A
N/A
N/A
FSR2H
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---- xxxx
---- uuuu
---- uuuu
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
FSR2L
Legend:
Note 1:
2:
3:
4:
DS39762F-page 69
PIC18F97J60 FAMILY
TABLE 5-2:
Register
Applicable Devices
Power-on Reset,
Brown-out Reset
MCLR Reset,
WDT Reset,
RESET Instruction,
Stack Resets,
CM Reset
STATUS
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---x xxxx
---u uuuu
---u uuuu
TMR0H
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
TMR0L
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
T0CON
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
1111 1111
1111 1111
uuuu uuuu
OSCCON
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0--- q-00
0--- q-00
u--- q-uu
ECON1
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 00--
0000 00--
uuuu uu--
WDTCON
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---- ---0
---- ---0
---- ---u
(4)
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0-q1 1100
0-uq qquu
u-uu qquu
TMR1H
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
TMR1L
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
T1CON
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
u0uu uuuu
uuuu uuuu
TMR2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
PR2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
1111 1111
1111 1111
1111 1111
T2CON
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
-000 0000
-000 0000
-uuu uuuu
SSP1BUF
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
SSP1ADD
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
SSP1STAT
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
SSP1CON1
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
SSP1CON2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
ADRESH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
ADRESL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
ADCON0
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0-00 0000
0-00 0000
u-uu uuuu
ADCON1
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
--00 0000
--00 0000
--uu uuuu
RCON
ADCON2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0-00 0000
0-00 0000
u-uu uuuu
CCPR1H
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
CCPR1L
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
CCP1CON
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
CCPR2H
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
CCPR2L
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
CCP2CON
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
CCPR3H
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
CCPR3L
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
CCP3CON
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
ECCP1AS
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
CVRCON
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
CMCON
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0111
0000 0111
uuuu uuuu
TMR3H
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
TMR3L
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
Legend:
Note 1:
2:
3:
4:
DS39762F-page 70
PIC18F97J60 FAMILY
TABLE 5-2:
Register
Applicable Devices
Power-on Reset,
Brown-out Reset
MCLR Reset,
WDT Reset,
RESET Instruction,
Stack Resets,
CM Reset
T3CON
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
uuuu uuuu
uuuu uuuu
PSPCON
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 ----
0000 ----
uuuu ----
SPBRG1
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
RCREG1
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
TXREG1
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
TXSTA1
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0010
0000 0010
uuuu uuuu
RCSTA1
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 000x
0000 000x
uuuu uuuu
EECON2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---- ----
---- ----
---- ----
EECON1
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---0 x00-
---0 x00-
---u uuu-
IPR3
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
1111 1111
1111 1111
uuuu uuuu
PIR3
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu(3)
PIE3
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
IPR2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
1111 1-11
1111 1-11
uuuu u-uu
PIR2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0-00
0000 0-00
uuuu u-uu(3)
PIE2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0-00
0000 0-00
uuuu u-uu
IPR1
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
1111 1111
1111 1111
uuuu uuuu
PIR1
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu(3)
PIE1
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
MEMCON
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0-00 --00
0-00 --00
u-uu --uu
OSCTUNE
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 ----
0000 ----
uuuu ----
TRISJ
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
--11 ----
--11 ----
--uu ----
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
1111 1111
1111 1111
uuuu uuuu
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
1111 1111
1111 1111
uuuu uuuu
---u ----
TRISH
TRISG
TRISF
TRISE
TRISD
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---1 ----
---1 ----
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---1 1111
---1 1111
---u uuuu
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
1111 1111
1111 1111
uuuu uuuu
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
1111 111-
1111 111-
uuuu uuu-
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
1111 1111
1111 1111
uuuu uuuu
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
--11 1111
--11 1111
--uu uuuu
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
1111 1111
1111 1111
uuuu uuuu
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---- -111
---- -111
---- -uuu
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
1111 1111
1111 1111
uuuu uuuu
TRISC
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
1111 1111
1111 1111
uuuu uuuu
TRISB
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
1111 1111
1111 1111
uuuu uuuu
TRISA
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
--11 1111
--11 1111
--uu uuuu
LATJ
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
--xx ----
--uu ----
--uu ----
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
LATH
Legend:
Note 1:
2:
3:
4:
DS39762F-page 71
PIC18F97J60 FAMILY
TABLE 5-2:
Register
LATG
LATF
Applicable Devices
Power-on Reset,
Brown-out Reset
MCLR Reset,
WDT Reset,
RESET Instruction,
Stack Resets,
CM Reset
---u ----
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---x ----
---u ----
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---x xxxx
---u uuuu
---u uuuu
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxx-
uuuu uuu-
uuuu uuu-
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
--xx xxxx
--uu uuuu
--uu uuuu
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---- -xxx
---- -uuu
---- -uuu
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
LATC
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
LATB
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
LATA
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
00xx xxxx
00uu uuuu
uuuu uuuu
PORTJ
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
--xx ----
--uu ----
--uu ----
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
PORTH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
PORTG
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---x ----
---u ----
---u ----
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---x xxxx
---u uuuu
---u uuuu
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
111x xxxx
111u uuuu
uuuu uuuu
PORTF
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
x000 000-
x000 000-
uuuu uuu-
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
x000 000-
x000 000-
uuuu uuu-
PORTE
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
--xx xxxx
--uu uuuu
--uu uuuu
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
PORTD
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---- -xxx
---- -uuu
---- -uuu
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
PORTC
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
PORTB
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
PORTA
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0-0x 0000
0-0u 0000
u-uu uuuu
LATE
LATD
SPBRGH1
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
BAUDCON1
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0100 0-00
0100 0-00
uuuu u-uu
SPBRGH2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
BAUDCON2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0100 0-00
0100 0-00
uuuu u-uu
ERDPTH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---0 1010
---0 1010
---u uuuu
ERDPTL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
1111 0101
1111 0101
uuuu uuuu
ECCP1DEL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
TMR4
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
PR4
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
1111 1111
1111 1111
1111 1111
T4CON
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
-000 0000
-000 0000
-uuu uuuu
CCPR4H
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
CCPR4L
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
Legend:
Note 1:
2:
3:
4:
DS39762F-page 72
PIC18F97J60 FAMILY
TABLE 5-2:
Register
Applicable Devices
Power-on Reset,
Brown-out Reset
MCLR Reset,
WDT Reset,
RESET Instruction,
Stack Resets,
CM Reset
CCP4CON
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
--00 0000
--00 0000
--uu uuuu
CCPR5H
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
CCPR5L
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
CCP5CON
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
--00 0000
--00 0000
--uu uuuu
SPBRG2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
RCREG2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
TXREG2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
TXSTA2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0010
0000 0010
uuuu uuuu
RCSTA2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 000x
0000 000x
uuuu uuuu
ECCP3AS
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
ECCP3DEL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
ECCP2AS
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
ECCP2DEL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
SSP2BUF
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
SSP2ADD
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
SSP2STAT
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
SSP2CON1
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
SSP2CON2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EDATA
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
xxxx xxxx
uuuu uuuu
uuuu uuuu
EIR
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
-000 0-00
-000 0-00
-uuu u-uu
ECON2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
100- ----
100- ----
uuu- ----
ESTAT
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
-0-0 -000
-0-0 -000
-u-u -uuu
EIE
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
-000 0-00
-000 0-00
-uuu u-uu
EDMACSH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EDMACSL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EDMADSTH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---0 0000
---0 0000
---u uuuu
EDMADSTL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EDMANDH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---0 0000
---0 0000
---u uuuu
EDMANDL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EDMASTH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---0 0000
---0 0000
---u uuuu
EDMASTL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
ERXWRPTH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---0 0000
---0 0000
---u uuuu
ERXWRPTL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
ERXRDPTH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---0 0101
---0 0101
---u uuuu
ERXRDPTL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
1111 1010
1111 1010
uuuu uuuu
ERXNDH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---1 1111
---1 1111
---u uuuu
ERXNDL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
1111 1111
1111 1111
uuuu uuuu
ERXSTH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---0 0101
---0 0101
---u uuuu
ERXSTL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
1111 1010
1111 1010
uuuu uuuu
Legend:
Note 1:
2:
3:
4:
DS39762F-page 73
PIC18F97J60 FAMILY
TABLE 5-2:
Register
Applicable Devices
Power-on Reset,
Brown-out Reset
MCLR Reset,
WDT Reset,
RESET Instruction,
Stack Resets,
CM Reset
ETXNDH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---0 0000
---0 0000
---u uuuu
ETXNDL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
ETXSTH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---0 0000
---0 0000
---u uuuu
ETXSTL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EWRPTH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---0 0000
---0 0000
---u uuuu
EWRPTL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EPKTCNT
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
ERXFCON
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
1010 0001
1010 0001
uuuu uuuu
EPMOH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---0 0000
---0 0000
---u uuuu
EPMOL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EPMCSH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EPMCSL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EPMM7
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EPMM6
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EPMM5
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EPMM4
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EPMM3
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EPMM2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EPMM1
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EPMM0
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EHT7
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EHT6
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EHT5
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EHT4
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EHT3
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EHT2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EHT1
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EHT0
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
MIRDH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
MIRDL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
MIWRH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
MIWRL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
MIREGADR
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---0 0000
---0 0000
---u uuuu
MICMD
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---- --00
---- --00
---- --uu
MAMXFLH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0110
0000 0110
uuuu uuuu
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
MAMXFLL
Legend:
Note 1:
2:
3:
4:
DS39762F-page 74
PIC18F97J60 FAMILY
TABLE 5-2:
Register
Applicable Devices
Power-on Reset,
Brown-out Reset
MCLR Reset,
WDT Reset,
RESET Instruction,
Stack Resets,
CM Reset
MAIPGH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
-000 0000
-000 0000
-uuu uuuu
MAIPGL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
-000 0000
-000 0000
-uuu uuuu
MABBIPG
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
-000 0000
-000 0000
-uuu uuuu
MACON4
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
-000 --00
-000 --00
-uuu --uu
MACON3
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
MACON1
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---0 0000
---0 0000
---u uuuu
EPAUSH
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0001 0000
0001 0000
000u uuuu
EPAUSL
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
EFLOCON
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---- -000
---- -000
---- -uuu
MISTAT
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
---- 0000
---- 0000
---- uuuu
MAADR2
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
MAADR1
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
MAADR4
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
MAADR3
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
MAADR6
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
PIC18F6XJ6X
PIC18F8XJ6X
PIC18F9XJ6X
0000 0000
0000 0000
uuuu uuuu
MAADR5
Legend:
Note 1:
2:
3:
4:
DS39762F-page 75
PIC18F97J60 FAMILY
NOTES:
DS39762F-page 76
PIC18F97J60 FAMILY
MEMORY ORGANIZATION
FIGURE 6-1:
6.1
21
Stack Level 1
Stack Level 31
PIC18FX6J60
PIC18FX6J65
PIC18FX7J60
On-Chip
Memory
On-Chip
Memory
On-Chip
Memory
Config. Words
00FFFFh
Config. Words
017FFFh
Config. Words
Unimplemented
Read as 0
000000h
Unimplemented
Read as 0
01FFFFh
6.0
Unimplemented
Read as 0
1FFFFFh
Note:
Sizes of memory areas are not to scale. Sizes of program memory areas are enhanced to show detail.
DS39762F-page 77
PIC18F97J60 FAMILY
6.1.1
6.1.2
FIGURE 6-2:
Reset Vector
0000h
0008h
0018h
TABLE 6-1:
Device
FLASH CONFIGURATION
WORDS FOR PIC18F97J60
FAMILY DEVICES
Program
Memory
(Kbytes)
Configuration
Word Addresses
64
FFF8h to FFFFh
96
17FF8h to
17FFFh
128
1FFF8h to
1FFFFh
PIC18F66J60
On-Chip
Program Memory
PIC18F86J60
PIC18F96J60
PIC18F66J65
PIC18F86J65
PIC18F96J65
(Top of Memory-7)
(Top of Memory)
PIC18F67J60
PIC18F87J60
PIC18F97J60
Read as 0
1FFFFFh
Legend:
DS39762F-page 78
PIC18F97J60 FAMILY
6.1.3
PIC18F9XJ60/9XJ65 PROGRAM
MEMORY MODES
REGISTER 6-1:
R/WO-1
R/WO-1
R/WO-1
R/WO-1
R/WO-1
U-0
U-0
U-0
WAIT(1)
BW(1)
EMB1(1)
EMB0(1)
EASHFT(1)
bit 7
bit 0
Legend:
R = Readable bit
WO = Write-Once bit
0 = Bit is cleared
bit 7
bit 6
bit 5-4
bit 3
bit 2-0
Unimplemented: Read as 0
Note 1:
DS39762F-page 79
PIC18F97J60 FAMILY
6.1.4
EXTENDED MICROCONTROLLER
MODE AND ADDRESS SHIFTING
FIGURE 6-3:
Microcontroller Mode(1)
On-Chip
Memory
Space
External
Memory
Space
On-Chip
Memory
Space
No
Access
Note 1:
2:
000000h
(Top of Memory)
(Top of Memory) + 1
External
Memory
(Top of Memory)
(Top of Memory) + 1
External
Memory
Mapped
to
External
Memory
Space
Mapped
to
External
Memory
Space
1FFFFFh
(Top of Memory)
1FFFFFh
1FFFFFh
1FFFFFh
Legend:
On-Chip
Memory
Space
On-Chip
Program
Memory
On-Chip
Program
Memory
(Top of Memory)
(Top of Memory) + 1
Reads
0s
External
Memory
Space
000000h
000000h
On-Chip
Program
Memory
(Top of Memory) represents upper boundary of on-chip program memory space (see Figure 6-1 for device-specific
values). Shaded areas represent unimplemented or inaccessible areas depending on the mode.
This mode is the only available mode on 64-pin and 80-pin devices and the default on 100-pin devices.
These modes are only available in 100-pin devices.
TABLE 6-2:
Operating Mode
Execution
From
Table Read
From
Table Write
To
Execution
From
Table Read
From
Table Write
To
Microcontroller
Yes
Yes
Yes
No Access
No Access
No Access
Extended Microcontroller
Yes
Yes
Yes
Yes
Yes
Yes
DS39762F-page 80
PIC18F97J60 FAMILY
6.1.5
PROGRAM COUNTER
6.1.6
FIGURE 6-4:
6.1.6.1
Top-of-Stack Access
Only the top of the return address stack (TOS) is readable and writable. A set of three registers,
TOSU:TOSH:TOSL, holds the contents of the stack
location pointed to by the STKPTR register
(Figure 6-4). This allows users to implement a software
stack if necessary. After a CALL, RCALL or interrupt
(and ADDULNK and SUBULNK instructions if the
extended instruction set is enabled), the software can
read
the
pushed
value
by
reading
the
TOSU:TOSH:TOSL registers. These values can be
placed on a user-defined software stack. At return time,
the software can return these values to
TOSU:TOSH:TOSL and do a return.
The user must disable the Global Interrupt Enable bits
while accessing the stack to prevent inadvertent stack
corruption.
Top-of-Stack Registers
TOSU
00h
TOSH
1Ah
TOSL
34h
Top-of-Stack
11111
11110
11101
001A34h
000D58h
STKPTR<4:0>
00010
00011
00010
00001
00000
DS39762F-page 81
PIC18F97J60 FAMILY
6.1.6.2
Note:
6.1.6.3
REGISTER 6-2:
R/C-0
R/C-0
U-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
STKFUL(1)
STKUNF(1)
SP4
SP3
SP2
SP1
SP0
bit 7
bit 0
Legend:
C = Clearable bit
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
Unimplemented: Read as 0
bit 4-0
Note 1:
x = Bit is unknown
DS39762F-page 82
PIC18F97J60 FAMILY
6.1.6.4
6.1.7
6.1.8
6.1.8.1
Computed GOTO
EXAMPLE 6-2:
EXAMPLE 6-1:
CALL
SUB1, FAST
SUB1
ORG
TABLE
6.1.8.2
MOVF
CALL
nn00h
ADDWF
RETLW
RETLW
RETLW
.
.
.
Table Reads
in
DS39762F-page 83
PIC18F97J60 FAMILY
6.2
6.2.2
6.2.1
CLOCKING SCHEME
FIGURE 6-5:
INSTRUCTION FLOW/PIPELINING
CLOCK/INSTRUCTION CYCLE
Q1
Q2
Q3
Q4
Q1
Q2
Q3
Q4
Q2
Q1
Q3
Q4
OSC1
Q1
Q2
Internal
Phase
Clock
Q3
Q4
PC
PC
PC + 2
PC + 4
OSC2/CLKO
(RC mode)
Execute INST (PC 2)
Fetch INST (PC)
EXAMPLE 6-3:
1. MOVLW 55h
4. BSF
TCY1
Fetch 1
Execute 1
2. MOVWF PORTB
3. BRA
SUB_1
PORTA, BIT3 (Forced NOP)
Fetch 2
TCY2
TCY3
TCY4
TCY5
Execute 2
Fetch 3
Execute 3
Fetch 4
Flush (NOP)
Fetch SUB_1 Execute SUB_1
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.
DS39762F-page 84
PIC18F97J60 FAMILY
6.2.3
INSTRUCTIONS IN PROGRAM
MEMORY
The program memory is addressed in bytes. Instructions are stored as two bytes or four bytes in program
memory. The Least Significant Byte (LSB) of an
instruction word is always stored in a program memory
location with an even address (LSb = 0). To maintain
alignment with instruction boundaries, the PC increments in steps of 2 and the LSb will always read 0 (see
Section 6.1.5 Program Counter).
Figure 6-6 shows an example of how instruction words
are stored in the program memory.
FIGURE 6-6:
6.2.4
Instruction 1:
Instruction 2:
MOVLW
GOTO
055h
0006h
Instruction 3:
MOVFF
123h, 456h
TWO-WORD INSTRUCTIONS
EXAMPLE 6-4:
LSB = 1
LSB = 0
0Fh
EFh
F0h
C1h
F4h
55h
03h
00h
23h
56h
Word Address
000000h
000002h
000004h
000006h
000008h
00000Ah
00000Ch
00000Eh
000010h
000012h
000014h
TWO-WORD INSTRUCTIONS
CASE 1:
Object Code
Source Code
TSTFSZ
REG1
; is RAM location 0?
MOVFF
REG1, REG2
ADDWF
REG3
; continue code
CASE 2:
Object Code
Source Code
TSTFSZ
REG1
; is RAM location 0?
MOVFF
REG1, REG2
REG3
; continue code
DS39762F-page 85
PIC18F97J60 FAMILY
6.3
Note:
6.3.1
DS39762F-page 86
PIC18F97J60 FAMILY
FIGURE 6-7:
BSR<3:0>
= 0000
= 0001
= 0010
= 0011
= 0100
= 0101
= 0110
= 0111
= 1000
= 1001
= 1010
= 1011
= 1100
= 1101
= 1110
= 1111
Bank 0
FFh
00h
Bank 1
Access RAM
GPR
GPR
1FFh
200h
FFh
00h
Bank 2
GPR
FFh
00h
Bank 3
2FFh
300h
Bank 4
3FFh
400h
GPR
FFh
00h
4FFh
500h
GPR
Bank 5
FFh
00h
5FFh
600h
GPR
Bank 6
FFh
00h
6FFh
700h
GPR
Bank 7
FFh
00h
FFh
00h
Bank 9
7FFh
800h
FFh
00h
Bank 10
GPR
GPR
FFh
00h
GPR
FFh
00h
Bank 12
FFh
00h
Bank 13
FFh
00h
Bank 14
GPR
GPR
GPR
FFh
00h
Ethernet SFR
FFh
SFR
Bank 15
GPR
Access Bank
Access RAM Low
GPR
Bank 8
GPR
FFh
00h
Bank 11
000h
05Fh
060h
0FFh
100h
00h
5Fh
Access RAM High 60h
(SFRs)
FFh
8FFh
900h
9FFh
A00h
AFFh
B00h
BFFh
C00h
CFFh
D00h
DFFh
E00h
E7Fh
E80h
EFFh
F00h
F5Fh
F60h
FFFh
DS39762F-page 87
PIC18F97J60 FAMILY
FIGURE 6-8:
7
0
0
0
Bank Select(2)
000h
Data Memory
Bank 0
100h
Bank 1
200h
300h
Bank 2
00h
FFh
00h
11
From Opcode(2)
11
11
11
11
0
1
FFh
00h
FFh
00h
Bank 3
through
Bank 13
E00h
Bank 14
F00h
FFFh
Note 1:
2:
6.3.2
Bank 15
FFh
00h
FFh
The Access RAM bit of the instruction can be used to force an override of the selected bank (BSR3:BSR0)
to the registers of the Access Bank.
The MOVFF instruction embeds the entire 12-bit address in the instruction.
ACCESS BANK
DS39762F-page 88
FFh
00h
6.3.3
GENERAL PURPOSE
REGISTER FILE
PIC18F97J60 FAMILY
6.3.4
TABLE 6-3:
Address
Name
Address
FFFh
TOSU
FDFh
Name
FFEh
TOSH
FDEh POSTINC2(1)
FBEh
FFDh
TOSL
FDDh POSTDEC2(1)
FBDh
FFCh
STKPTR
FDCh
PREINC2(1)
FBCh
FFBh
PCLATU
FDBh
PLUSW2(1)
FBBh
INDF2(1)
Address
FBFh
Name
Address
Name
Address
F9Fh
IPR1
F7Fh
SPBRGH1
CCPR1L
F9Eh
PIR1
F7Eh
BAUDCON1
CCP1CON
F9Dh
PIE1
F7Dh
SPBRGH2
CCPR2H
F9Ch
MEMCON(4)
F7Ch
BAUDCON2
CCPR2L
F9Bh
OSCTUNE
F7Bh
ERDPTH
F7Ah
ERDPTL
F79h
ECCP1DEL
CCPR1H
FFAh
PCLATH
FDAh
FSR2H
FBAh
CCP2CON
F9Ah
TRISJ(3)
FF9h
PCL
FD9h
FSR2L
FB9h
CCPR3H
F99h
TRISH(3)
Name
FF8h
TBLPTRU
FD8h
STATUS
FB8h
CCPR3L
F98h
TRISG
F78h
TMR4
FF7h
TBLPTRH
FD7h
TMR0H
FB7h
CCP3CON
F97h
TRISF
F77h
PR4
FF6h
TBLPTRL
FD6h
TMR0L
FB6h
ECCP1AS
F96h
TRISE
F76h
T4CON
FF5h
TABLAT
FD5h
T0CON
FB5h
CVRCON
F95h
TRISD
F75h
CCPR4H
FF4h
PRODH
FD4h
(2)
FB4h
CMCON
F94h
TRISC
F74h
CCPR4L
FF3h
PRODL
FD3h
OSCCON
FB3h
TMR3H
F93h
TRISB
F73h
CCP4CON
FF2h
INTCON
FD2h
ECON1
FB2h
TMR3L
F92h
TRISA
F72h
CCPR5H
FF1h
INTCON2
FD1h
WDTCON
FB1h
T3CON
F91h
LATJ(3)
F71h
CCPR5L
FF0h
INTCON3
FD0h
RCON
FB0h
PSPCON
F90h
LATH(3)
F70h
CCP5CON
FEFh
INDF0(1)
FCFh
TMR1H
FAFh
SPBRG1
F8Fh
LATG
F6Fh
SPBRG2
(1)
FCEh
TMR1L
FAEh
RCREG1
F8Eh
LATF
F6Eh
RCREG2
FEDh POSTDEC0(1)
FCDh
T1CON
FADh
TXREG1
F8Dh
LATE
F6Dh
TXREG2
FEEh POSTINC0
FECh
PREINC0(1)
FCCh
TMR2
FACh
TXSTA1
F8Ch
LATD
F6Ch
TXSTA2
FEBh
PLUSW0(1)
FCBh
PR2
FABh
RCSTA1
F8Bh
LATC
F6Bh
RCSTA2
FEAh
FSR0H
FCAh
T2CON
FAAh
(2)
F8Ah
LATB
F6Ah
ECCP3AS
FE9h
FSR0L
FC9h
SSP1BUF
FA9h
(2)
F89h
LATA
F69h
ECCP3DEL
FE8h
WREG
FC8h
SSP1ADD
FA8h
(2)
F88h
PORTJ(3)
F68h
ECCP2AS
F87h
PORTH(3)
F67h
ECCP2DEL
FE7h
INDF1
(1)
FC7h
SSP1STAT
FA7h
EECON2
(1)
POSTINC1(1)
FC6h
SSP1CON1
FA6h
EECON1
F86h
PORTG
F66h
SSP2BUF
FE5h POSTDEC1(1)
FC5h
SSP1CON2
FA5h
IPR3
F85h
PORTF
F65h
SSP2ADD
FE6h
FE4h
PREINC1(1)
FC4h
ADRESH
FA4h
PIR3
F84h
PORTE
F64h
SSP2STAT
FE3h
PLUSW1(1)
FC3h
ADRESL
FA3h
PIE3
F83h
PORTD
F63h
SSP2CON1
FE2h
FSR1H
FC2h
ADCON0
FA2h
IPR2
F82h
PORTC
F62h
SSP2CON2
FE1h
FSR1L
FC1h
ADCON1
FA1h
PIR2
F81h
PORTB
F61h
EDATA
FE0h
BSR
FC0h
ADCON2
FA0h
PIE2
F80h
PORTA
F60h
EIR
Note 1:
2:
3:
4:
DS39762F-page 89
PIC18F97J60 FAMILY
6.3.5
ETHERNET SFRs
Note:
TABLE 6-4:
Address
Name
EFFh
(1)
Address
Name
(1)
E9Fh
(1)
EBEh
(1)
E9Eh
(1)
EBDh
(1)
E9Dh
(1)
EBCh
(1)
E9Ch
(1)
EBBh
(1)
E9Bh
(1)
EBAh
(1)
E9Ah
(1)
MIRDH
E99h
EPAUSH
EDEh
EFDh
ESTAT
EDDh
(1)
EDCh
(1)
Name
EBFh
ECON2
(1)
Address
EFEh
EFCh
Name
EDFh
(1)
(1)
Address
EFBh
EIE
EDBh
(1)
EFAh
(1)
EDAh
(1)
EF9h
(2)
ED9h
EPKTCNT
EB9h
EF8h
(2)
ED8h
ERXFCON
EB8h
MIRDL
E98h
EPAUSL
EF7h
EDMACSH
ED7h
(1)
EB7h
MIWRH
E97h
EFLOCON
EF6h
EDMACSL
ED6h
(1)
EB6h
MIWRL
E96h
(2)
EF5h
EDMADSTH
ED5h
EPMOH
EB5h
(1)
E95h
(2)
EF4h
EDMADSTL
ED4h
EPMOL
EB4h
MIREGADR
E94h
(2)
ED3h
(2)
EB3h
(2)
E93h
(2)
(2)
EB2h
MICMD
E92h
(2)
EB1h
(1)
E91h
(2)
EB0h
(1)
E90h
(2)
EAFh
(2)
E8Fh
(2)
(1)
E8Eh
(2)
EF3h
EDMANDH
EF2h
EDMANDL
ED2h
EF1h
EDMASTH
ED1h
EF0h
EEFh
EDMASTL
ERXWRPTH
ED0h
ECFh
EPMCSH
EPMCSL
EPMM7
EEEh
ERXWRPTL
ECEh
EPMM6
EAEh
EEDh
ERXRDPTH
ECDh
EPMM5
EADh
(1)
E8Dh
(2)
(1)
E8Ch
(2)
EECh
ERXRDPTL
ECCh
EPMM4
EACh
EEBh
ERXNDH
ECBh
EPMM3
EABh
MAMXFLH
E8Bh
(2)
EEAh
ERXNDL
ECAh
EPMM2
EAAh
MAMXFLL
E8Ah
MISTAT
EE9h
ERXSTH
EC9h
EPMM1
EA9h
(1)
E89h
(1)
(1)
E88h
(1)
EE8h
ERXSTL
EC8h
EPMM0
EA8h
EE7h
ETXNDH
EC7h
EHT7
EA7h
MAIPGH
E87h
(1)
EE6h
ETXNDL
EC6h
EHT6
EA6h
MAIPGL
E86h
(1)
EE5h
ETXSTH
EC5h
EHT5
EA5h
(2)
E85h
MAADR2
EE4h
ETXSTL
EC4h
EHT4
EA4h
MABBIPG
E84h
MAADR1
EE3h
EWRPTH
EC3h
EHT3
EA3h
MACON4
E83h
MAADR4
EE2h
EWRPTL
EC2h
EHT2
EA2h
MACON3
E82h
MAADR3
EE1h
(1)
EC1h
EHT1
EA1h
(1)
E81h
MAADR6
EE0h
(1)
EC0h
EHT0
EA0h
MACON1
E80h
MAADR5
Note 1:
2:
DS39762F-page 90
PIC18F97J60 FAMILY
TABLE 6-5:
File Name
TOSU
Bit 6
Bit 5
Bit 4
TOSL
STKPTR
STKFUL(1)
STKUNF(1)
PCLATU
bit 21(2)
PCL
TBLPTRU
bit 21
Bit 2
Bit 1
Bit 0
TOSH
PCLATH
Bit 3
SP4
SP3
SP2
SP1
SP0
Values on Details on
POR, BOR
Page:
---0 0000
69, 81
0000 0000
69, 81
0000 0000
69, 81
00-0 0000
69, 82
---0 0000
69, 81
0000 0000
69, 81
0000 0000
69, 81
--00 0000
69, 108
TBLPTRH
0000 0000
69, 108
TBLPTRL
0000 0000
69, 108
TABLAT
0000 0000
69, 108
PRODH
xxxx xxxx
69, 127
PRODL
INTCON
RBIF
xxxx xxxx
69, 127
0000 000x
69, 131
GIE/GIEH
PEIE/GIEL
TMR0IE
INT0IE
RBIE
TMR0IF
INT0IF
INTCON2
RBPU
INTEDG0
INTEDG1
INTEDG2
INTEDG3
TMR0IP
INT3IP
RBIP
1111 1111
69, 132
INTCON3
INT2IP
INT1IP
INT3IE
INT2IE
INT1IE
INT3IF
INT2IF
INT1IF
1100 0000
69, 133
INDF0
Uses contents of FSR0 to address data memory value of FSR0 not changed (not a physical register)
N/A
69, 99
POSTINC0
Uses contents of FSR0 to address data memory value of FSR0 post-incremented (not a physical register)
N/A
69, 100
POSTDEC0
Uses contents of FSR0 to address data memory value of FSR0 post-decremented (not a physical register)
N/A
69, 100
PREINC0
Uses contents of FSR0 to address data memory value of FSR0 pre-incremented (not a physical register)
N/A
69, 100
PLUSW0
Uses contents of FSR0 to address data memory value of FSR0 pre-incremented (not a physical register)
value of FSR0 offset by W
N/A
69, 100
FSR0H
---- xxxx
69, 99
FSR0L
xxxx xxxx
69, 100
WREG
Working Register
xxxx xxxx
69
INDF1
Uses contents of FSR1 to address data memory value of FSR1 not changed (not a physical register)
N/A
69, 99
POSTINC1
Uses contents of FSR1 to address data memory value of FSR1 post-incremented (not a physical register)
N/A
69, 100
POSTDEC1
Uses contents of FSR1 to address data memory value of FSR1 post-decremented (not a physical register)
N/A
69, 100
PREINC1
Uses contents of FSR1 to address data memory value of FSR1 pre-incremented (not a physical register)
N/A
69, 100
PLUSW1
Uses contents of FSR1 to address data memory value of FSR1 pre-incremented (not a physical register)
value of FSR1 offset by W
N/A
69, 100
FSR1H
FSR1L
BSR
---- xxxx
69, 99
xxxx xxxx
69, 99
---- 0000
69, 99
INDF2
Uses contents of FSR2 to address data memory value of FSR2 not changed (not a physical register)
N/A
69, 99
POSTINC2
Uses contents of FSR2 to address data memory value of FSR2 post-incremented (not a physical register)
N/A
69, 100
POSTDEC2
Uses contents of FSR2 to address data memory value of FSR2 post-decremented (not a physical register)
N/A
69, 100
PREINC2
Uses contents of FSR2 to address data memory value of FSR2 pre-incremented (not a physical register)
N/A
69, 100
PLUSW2
Uses contents of FSR2 to address data memory value of FSR2 pre-incremented (not a physical register)
value of FSR2 offset by W
N/A
69, 100
FSR2H
FSR2L
---- xxxx
69, 99
xxxx xxxx
69, 99
Legend: x = unknown; u = unchanged; - = unimplemented, read as 0; q = value depends on condition; r = reserved bit, do not modify. Shaded cells
are unimplemented, read as 0.
Note 1: Bit 7 and bit 6 are cleared by user software or by a POR.
2: Bit 21 of the PC is only available in Serial Programming modes.
3: Reset value is 0 when Two-Speed Start-up is enabled and 1 if disabled.
4: Alternate names and definitions for these bits when the MSSP module is operating in I2C Slave mode.
5: These bits and/or registers are only available in 100-pin devices; otherwise, they are unimplemented and read as 0. Reset values shown
apply only to 100-pin devices.
6: These bits and/or registers are only available in 80-pin and 100-pin devices. In 64-pin devices, they are unimplemented and read as 0. Reset
values are shown for 100-pin devices.
7: In Microcontroller mode, the bits in this register are unwritable and read as 0.
8: PLLEN is only available when either ECPLL or HSPLL Oscillator mode is selected; otherwise, read as 0.
9: Implemented in 100-pin devices in Microcontroller mode only.
DS39762F-page 91
PIC18F97J60 FAMILY
TABLE 6-5:
File Name
STATUS
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
OV
DC
TMR0H
TMR0L
T0CON
TMR0ON
T08BIT
T0CS
T0SE
PSA
OSCCON
IDLEN
ECON1
TXRST
RXRST
DMAST
CSUMEN
IPEN
CM
RI
TO
WDTCON
RCON
Values on Details on
POR, BOR
Page:
---x xxxx
70, 97
0000 0000
70, 171
xxxx xxxx
70, 171
1111 1111
70, 171
T0PS2
T0PS1
T0PS0
OSTS(3)
SCS1
SCS0
0--- q-00
70, 53
TXRTS
RXEN
0000 00--
70, 227
SWDTEN
--- ---0
70, 368
PD
POR
BOR
TMR1H
xxxx xxxx
70, 175
TMR1L
xxxx xxxx
70, 175
T1CON
RD16
T1RUN
TMR2
Timer2 Register
PR2
T2CON
T2OUTPS3
T1CKPS1
T2OUTPS2
T1CKPS0
T2OUTPS1
T1OSCEN
T2OUTPS0
T1SYNC
TMR2ON
TMR1CS
T2CKPS1
TMR1ON
T2CKPS0
SSP1BUF
SSP1ADD
MSSP1 Address Register (I2C Slave mode), MSSP1 Baud Rate Reload Register (I2C Master mode)
0000 0000
70, 175
0000 0000
70, 180
1111 1111
70, 180
-000 0000
70, 180
xxxx xxxx
70, 279
0000 0000
70, 279
SSP1STAT
SMP
CKE
D/A
R/W
UA
BF
0000 0000
70, 270,
280
SSP1CON1
WCOL
SSPOV
SSPEN
CKP
SSPM3
SSPM2
SSPM1
SSPM0
0000 0000
70, 271,
281
0000 0000
70, 282
SSP1CON2
GCEN
ACKSTAT
ACKDT
ACKEN
RCEN
PEN
RSEN
SEN
GCEN
ACKSTAT
ADMSK5(4)
ADMSK4(4)
ADMSK3(4)
ADMSK2(4)
ADMSK1(4)
SEN
ADRESH
xxxx xxxx
70, 347
ADRESL
xxxx xxxx
70, 347
ADCON0
ADCAL
CHS3
CHS2
CHS1
CHS0
GO/DONE
ADON
0-00 0000
70, 339
ADCON1
VCFG1
VCFG0
PCFG3
PCFG2
PCFG1
PCFG0
--00 0000
70, 340
ADFM
ACQT2
ACQT1
ACQT0
ADCS2
ADCS1
ADCS0
ADCON2
CCPR1H
CCPR1L
CCP1CON
P1M1
P1M0
DC1B1
DC1B0
CCP1M3
CCP1M2
CCP1M1
CCP1M0
0-00 0000
70, 341
xxxx xxxx
70, 193
xxxx xxxx
70, 193
0000 0000
70, 198
CCPR2H
xxxx xxxx
70, 193
CCPR2L
xxxx xxxx
70, 193
CCP2CON
P2M1
P2M0
DC2B1
DC2B0
CCPR3H
CCPR3L
CCP3CON
ECCP1AS
CVRCON
CMCON
P3M1
P3M0
ECCP1ASE ECCP1AS2
CCP2M3
CCP2M2
CCP2M1
CCP2M0
DC3B1
DC3B0
CCP3M3
CCP3M2
CCP3M1
CCP3M0
0000 0000
70, 198
xxxx xxxx
70, 193
xxxx xxxx
70, 193
0000 0000
70, 198
ECCP1AS1
ECCP1AS0
PSS1AC1
PSS1AC0
PSS1BD1
PSS1BD0
0000 0000
70, 212
CVREN
CVROE
CVRR
CVRSS
CVR3
CVR2
CVR1
CVR0
0000 0000
70, 355
C2OUT
C1OUT
C2INV
C1INV
CIS
CM2
CM1
CM0
0000 0111
70, 349
TMR3H
xxxx xxxx
70, 183
TMR3L
xxxx xxxx
70, 183
Legend: x = unknown; u = unchanged; - = unimplemented, read as 0; q = value depends on condition; r = reserved bit, do not modify. Shaded cells
are unimplemented, read as 0.
Note 1: Bit 7 and bit 6 are cleared by user software or by a POR.
2: Bit 21 of the PC is only available in Serial Programming modes.
3: Reset value is 0 when Two-Speed Start-up is enabled and 1 if disabled.
4: Alternate names and definitions for these bits when the MSSP module is operating in I2C Slave mode.
5: These bits and/or registers are only available in 100-pin devices; otherwise, they are unimplemented and read as 0. Reset values shown
apply only to 100-pin devices.
6: These bits and/or registers are only available in 80-pin and 100-pin devices. In 64-pin devices, they are unimplemented and read as 0. Reset
values are shown for 100-pin devices.
7: In Microcontroller mode, the bits in this register are unwritable and read as 0.
8: PLLEN is only available when either ECPLL or HSPLL Oscillator mode is selected; otherwise, read as 0.
9: Implemented in 100-pin devices in Microcontroller mode only.
DS39762F-page 92
PIC18F97J60 FAMILY
TABLE 6-5:
File Name
T3CON
PSPCON(5)
SPBRG1
Bit 6
Bit 5
RD16
T3CCP2
IBF
OBF
Values on Details on
POR, BOR
Page:
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
T3CKPS1
T3CKPS0
T3CCP1
T3SYNC
TMR3CS
TMR3ON
0000 0000
IBOV
PSPMODE
0000 ----
71, 169
0000 0000
71, 320
71, 183
RCREG1
0000 0000
71, 327
TXREG1
xxxx xxxx
71, 329
TXSTA1
CSRC
TX9
TXEN
SYNC
SENDB
BRGH
TRMT
TX9D
0000 0010
71, 320
RCSTA1
SPEN
RX9
SREN
CREN
ADDEN
FERR
OERR
RX9D
0000 000x
71, 320
---- ----
71, 106
EECON2
EECON1
FREE
WRERR
WREN
WR
---0 x00-
71, 107
IPR3
SSP2IP(5)
BCL2IP(5)
RC2IP(6)
TX2IP(6)
TMR4IP
CCP5IP
CCP4IP
CCP3IP
1111 1111
71, 142
PIR3
SSP2IF(5)
BCL2IF(5)
RC2IF(6)
TX2IF(6)
TMR4IF
CCP5IF
CCP4IF
CCP3IF
0000 0000
71, 136
PIE3
SSP2IE(5)
(5)
(6)
TX2IE(6)
TMR4IE
CCP5IE
CCP4IE
CCP3IE
0000 0000
71, 139
IPR2
OSCFIP
CMIP
ETHIP
BCL1IP
TMR3IP
CCP2IP
1111 1-11
71, 141
PIR2
OSCFIF
CMIF
ETHIF
BCL1IF
TMR3IF
CCP2IF
0000 0-00
71, 135
PIE2
OSCFIE
CMIE
ETHIE
BCL1IE
TMR3IE
CCP2IE
0000 0-00
71, 138
IPR1
PSPIP(9)
ADIP
RC1IP
TX1IP
SSP1IP
CCP1IP
TMR2IP
TMR1IP
1111 1111
71, 140
PIR1
PSPIF(9)
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
0000 0000
71, 134
PIE1
BCL2IE
RC2IE
PSPIE(9)
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
0000 0000
71, 137
MEMCON(5,7)
EBDIS
WAIT1
WAIT0
WM1
WM0
0-00 --00
71, 116
OSCTUNE
PPST1
PLLEN(8)
PPST0
PPRE
0000 ----
71, 51
TRISJ(6)
TRISJ7(5)
TRISJ6(5)
TRISJ5(6)
TRISJ4(6)
TRISJ3(5)
TRISJ2(5)
TRISJ1(5)
TRISJ0(5)
1111 1111
71, 167
TRISH(6)
TRISH7(6)
TRISH6(6)
TRISH5(6)
TRISH4(6)
TRISH3(6)
TRISH2(6)
TRISH1(6)
TRISH0(6)
1111 1111
71, 165
TRISG
TRISG7(5)
TRISG6(5)
TRISG5(5)
TRISG4
TRISG3(6)
TRISG2(6)
TRISG1(6)
TRISG0(6)
1111 1111
71, 163
TRISF
TRISF7
TRISF6
TRISF5
TRISF4
TRISF3
TRISF2
TRISF1
TRISF0(5)
1111 1111
71, 161
TRISE
TRISE7(6)
TRISE6(6)
TRISE5
TRISE4
TRISE3
TRISE2
TRISE1
TRISE0
1111 1111
71, 159
TRISD
TRISD7(5)
TRISD6(5)
TRISD5(5)
TRISD4(5)
TRISD3(5)
TRISD2
TRISD1
TRISD0
1111 1111
71, 156
TRISC
TRISC7
TRISC6
TRISC5
TRISC4
TRISC3
TRISC2
TRISC1
TRISC0
1111 1111
71, 153
TRISB
TRISB7
TRISB6
TRISB5
TRISB4
TRISB3
TRISB2
TRISB1
TRISB0
1111 1111
71, 150
TRISA
TRISA5
TRISA4
TRISA3
TRISA2
TRISA1
TRISA0
--11 1111
71, 147
LATJ(6)
LATJ7(5)
LATJ6(5)
LATJ5(6)
LATJ4(6)
LATJ3(5)
LATJ2(5)
LATJ1(5)
LATJ0(5)
xxxx xxxx
71, 167
LATH(6)
LATH7(6)
LATH6(6)
LATH5(6)
LATH4(6)
LATH3(6)
LATH2(6)
LATH1(6)
LATH0(6)
xxxx xxxx
71, 165
LATG
LATG7(5)
LATG6(5)
LATG5(5)
LATG4
LATG3(6)
LATG2(6)
LATG1(6)
LATG0(6)
xxxx xxxx
72, 163
LATF
LATF7
LATF6
LATF5
LATF4
LATF3
LATF2
LATF1
LATF0(5)
xxxx xxxx
72, 161
LATE
LATE7(6)
LATE6(6)
LATE5
LATE4
LATE3
LATE2
LATE1
LATE0
xxxx xxxx
72, 159
LATD
LATD7(5)
LATD6(5)
LATD5(5)
LATD4(5)
LATD3(5)
LATD2
LATD1
LATD0
xxxx xxxx
72, 156
LATC
LATC7
LATC6
LATC5
LATC4
LATC3
LATC2
LATC1
LATC0
xxxx xxxx
72, 153
LATB
LATB7
LATB6
LATB5
LATB4
LATB3
LATB2
LATB1
LATB0
xxxx xxxx
72, 150
LATA
RDPU
REPU
LATA5
LATA4
LATA3
LATA2
LATA1
LATA0
00xx xxxx
72, 147
PORTJ(6)
RJ7(5)
RJ6(5)
RJ5(6)
RJ4(6)
RJ3(5)
RJ2(5)
RJ1(5)
RJ0(5)
xxxx xxxx
72, 167
PORTH(6)
RH7(6)
RH6(6)
RH5(6)
RH4(6)
RH3(6)
RH2(6)
RH1(6)
RH0(6)
0000 xxxx
72, 165
PORTG
RG7(5)
RG6(5)
RG5(5)
RG4
RG3(6)
RG2(6)
RG1(6)
RG0(6)
111x xxxx
72, 163
Legend: x = unknown; u = unchanged; - = unimplemented, read as 0; q = value depends on condition; r = reserved bit, do not modify. Shaded cells
are unimplemented, read as 0.
Note 1: Bit 7 and bit 6 are cleared by user software or by a POR.
2: Bit 21 of the PC is only available in Serial Programming modes.
3: Reset value is 0 when Two-Speed Start-up is enabled and 1 if disabled.
4: Alternate names and definitions for these bits when the MSSP module is operating in I2C Slave mode.
5: These bits and/or registers are only available in 100-pin devices; otherwise, they are unimplemented and read as 0. Reset values shown
apply only to 100-pin devices.
6: These bits and/or registers are only available in 80-pin and 100-pin devices. In 64-pin devices, they are unimplemented and read as 0. Reset
values are shown for 100-pin devices.
7: In Microcontroller mode, the bits in this register are unwritable and read as 0.
8: PLLEN is only available when either ECPLL or HSPLL Oscillator mode is selected; otherwise, read as 0.
9: Implemented in 100-pin devices in Microcontroller mode only.
DS39762F-page 93
PIC18F97J60 FAMILY
TABLE 6-5:
File Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
PORTF
RF7
RF6
RF5
RF4
RF3
RF2
RF1
RF0(5)
0000 0000
72, 161
PORTE
RE7(6)
RE6
RE5
RE4
RE3
RE2
RE1
RE0
xxxx xxxx
72, 159
PORTD
RD7(5)
RD6(5)
RD5(5)
RD4(5)
RD3(5)
RD2
RD1
RD0
xxxx xxxx
72, 156
PORTC
RC7
RC6
RC5
RC4
RC3
RC2
RC1
RC0
xxxx xxxx
72, 153
PORTB
RB7
RB6
RB5
RB4
RB3
RB2
RB1
RB0
xxxx xxxx
72, 150
PORTA
RJPU(6)
RA5
RA4
RA3
RA2
RA1
RA0
0-0x 0000
72, 147
0000 0000
72, 320
SPBRGH1
BAUDCON1
SPBRGH2
BAUDCON2
ERDPTH
ERDPTL
ECCP1DEL
(6)
RCIDL
ABDOVF
RCIDL
RXDTP
TXCKP
P1RSEN
P1DC6
Timer4 Register
PR4
TXCKP
T4OUTPS3
P1DC5
T4OUTPS2
T4OUTPS1
CCPR4L
DC4B1
DC4B0
CCPR5H
CCPR5L
SPBRG2
BRG16
P1DC4
CCP5CON
WUE
ABDEN
WUE
ABDEN
CCPR4H
CCP4CON
BRG16
TMR4
T4CON
RXDTP
DC5B1
DC5B0
P1DC3
T4OUTPS0
CCP4M3
CCP5M3
P1DC2
TMR4ON
CCP4M2
CCP5M2
P1DC1
T4CKPS1
CCP4M1
CCP5M1
P1DC0
T4CKPS0
CCP4M0
CCP5M0
0100 0-00
72, 318
0000 0000
72, 320
0100 0-00
72, 318
---0 0101
72, 223
1111 1010
72, 223
0000 0000
72, 211
0000 0000
72, 187
1111 1111
72, 187
-000 0000
72, 187
xxxx xxxx
72, 193
xxxx xxxx
72, 193
--00 0000
73, 189
xxxx xxxx
73, 193
xxxx xxxx
73, 193
--00 0000
73, 189
0000 0000
73, 320
RCREG2
0000 0000
73, 327
TXREG2
0000 0000
73, 329
TXSTA2
CSRC
TX9
TXEN
SYNC
SENDB
BRGH
TRMT
TX9D
0000 0010
73, 316
RCSTA2
SPEN
RX9
SREN
CREN
ADDEN
FERR
OERR
RX9D
0000 000x
73, 317
ECCP3AS1
ECCP3AS0
PSS3AC1
PSS3AC0
PSS3BD1
PSS3BD0
0000 0000
73, 212
P3DC5
P3DC4
P3DC3
P3DC2
P3DC1
P3DC0
0000 0000
73, 211
ECCP2AS1
ECCP2AS0
PSS2AC1
PSS2AC0
PSS2BD1
PSS2BD0
0000 0000
73, 212
P2DC5
P2DC4
P2DC3
P2DC2
P2DC1
P2DC0
ECCP3AS
ECCP3DEL
ECCP2AS
ECCP2DEL
ECCP3ASE ECCP3AS2
P3RSEN
P3DC6
ECCP2ASE ECCP2AS2
P2RSEN
P2DC6
SSP2BUF
SSP2ADD
MSSP2 Address Register (I2C Slave mode), MSSP2 Baud Rate Reload Register (I2C Master mode)
0000 0000
73, 211
xxxx xxxx
73, 279
0000 0000
73, 279
SSP2STAT
SMP
CKE
D/A
R/W
UA
BF
0000 0000
73, 270
SSP2CON1
WCOL
SSPOV
SSPEN
CKP
SSPM3
SSPM2
SSPM1
SSPM0
0000 0000
73, 271,
281
0000 0000
73, 282
xxxx xxxx
73, 223
SSP2CON2
EDATA
EIR
ECON2
GCEN
ACKSTAT
ACKDT
ACKEN
RCEN
PEN
RSEN
SEN
GCEN
ACKSTAT
ADMSK5(4)
ADMSK4(4)
ADMSK3(4)
ADMSK2(4)
ADMSK1(4)
SEN
PKTIF
DMAIF
LINKIF
TXIF
TXERIF
RXERIF
-000 0-00
73, 241
AUTOINC
PKTDEC
ETHEN
100- ----
73, 228
Legend: x = unknown; u = unchanged; - = unimplemented, read as 0; q = value depends on condition; r = reserved bit, do not modify. Shaded cells
are unimplemented, read as 0.
Note 1: Bit 7 and bit 6 are cleared by user software or by a POR.
2: Bit 21 of the PC is only available in Serial Programming modes.
3: Reset value is 0 when Two-Speed Start-up is enabled and 1 if disabled.
4: Alternate names and definitions for these bits when the MSSP module is operating in I2C Slave mode.
5: These bits and/or registers are only available in 100-pin devices; otherwise, they are unimplemented and read as 0. Reset values shown
apply only to 100-pin devices.
6: These bits and/or registers are only available in 80-pin and 100-pin devices. In 64-pin devices, they are unimplemented and read as 0. Reset
values are shown for 100-pin devices.
7: In Microcontroller mode, the bits in this register are unwritable and read as 0.
8: PLLEN is only available when either ECPLL or HSPLL Oscillator mode is selected; otherwise, read as 0.
9: Implemented in 100-pin devices in Microcontroller mode only.
DS39762F-page 94
PIC18F97J60 FAMILY
TABLE 6-5:
File Name
Bit 6
Bit 5
ESTAT
BUFER
EIE
PKTIE
DMAIE
EDMACSH
EDMACSL
EDMADSTH
EDMADSTL
EDMANDH
EDMANDL
EDMASTH
EDMASTL
ERXWRPTH
ERXWRPTL
ERXRDPTH
ERXRDPTL
ERXNDH
ERXNDL
ERXSTH
ERXSTL
ETXNDH
ETXNDL
ETXSTH
ETXSTL
EWRPTH
Bit 1
Bit 0
RXBUSY
TXABRT
PHYRDY
-0-0 -000
LINKIE
TXIE
TXERIE
RXERIE
-000 0-00
73, 240
0000 0000
73, 265
0000 0000
73, 265
EPKTCNT
EPMOH
Bit 2
UCEN
ANDOR
CRCEN
Values on Details on
POR, BOR
Page:
Bit 3
EWRPTL
ERXFCON
Bit 4
PMEN
MPEN
HTEN
MCEN
BCEN
73, 228
---0 0000
73, 265
0000 0000
73, 265
---0 0000
73, 265
0000 0000
73, 265
---0 0000
73, 265
0000 0000
73, 265
---0 0000
73, 225
0000 0000
73, 225
---0 0101
73, 225
1111 1010
73, 225
---1 1111
73, 225
1111 1111
73, 225
---0 0101
73, 225
1111 1010
73, 225
---0 0000
74, 226
0000 0000
74, 226
---0 0000
74, 226
0000 0000
74, 226
---0 0000
74, 223
0000 0000
74, 223
0000 0000
74, 252
1010 0001
74, 260
---0 0000
74, 263
0000 0000
74, 263
EPMOL
EPMCSH
0000 0000
74, 263
EPMCSL
0000 0000
74, 263
EPMM7
0000 0000
74, 263
EPMM6
0000 0000
74, 263
EPMM5
0000 0000
74, 263
EPMM4
0000 0000
74, 263
EPMM3
0000 0000
74, 263
EPMM2
0000 0000
74, 263
EPMM1
0000 0000
74, 263
EPMM0
0000 0000
74, 263
Legend: x = unknown; u = unchanged; - = unimplemented, read as 0; q = value depends on condition; r = reserved bit, do not modify. Shaded cells
are unimplemented, read as 0.
Note 1: Bit 7 and bit 6 are cleared by user software or by a POR.
2: Bit 21 of the PC is only available in Serial Programming modes.
3: Reset value is 0 when Two-Speed Start-up is enabled and 1 if disabled.
4: Alternate names and definitions for these bits when the MSSP module is operating in I2C Slave mode.
5: These bits and/or registers are only available in 100-pin devices; otherwise, they are unimplemented and read as 0. Reset values shown
apply only to 100-pin devices.
6: These bits and/or registers are only available in 80-pin and 100-pin devices. In 64-pin devices, they are unimplemented and read as 0. Reset
values are shown for 100-pin devices.
7: In Microcontroller mode, the bits in this register are unwritable and read as 0.
8: PLLEN is only available when either ECPLL or HSPLL Oscillator mode is selected; otherwise, read as 0.
9: Implemented in 100-pin devices in Microcontroller mode only.
DS39762F-page 95
PIC18F97J60 FAMILY
TABLE 6-5:
File Name
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Values on Details on
POR, BOR
Page:
EHT7
0000 0000
74, 259
EHT6
0000 0000
74, 259
EHT5
0000 0000
74, 259
EHT4
0000 0000
74, 259
EHT3
0000 0000
74, 259
EHT2
0000 0000
74, 259
EHT1
0000 0000
74, 259
EHT0
0000 0000
74, 259
MIRDH
0000 0000
74, 232
MIRDL
0000 0000
74, 232
MIWRH
0000 0000
74, 232
MIWRL
0000 0000
74, 232
---0 0000
74, 232
MIREGADR
MICMD
MIISCAN
MIIRD
---- --00
74, 231
MAMXFLH
0000 0110
74, 245
MAMXFLL
0000 0000
74, 245
MAIPGH
-000 0000
75, 245
MAIPGL
-000 0000
75, 245
MABBIPG
BBIPG6
BBIPG5
BBIPG4
BBIPG3
BBIPG2
BBIPG1
BBIPG0
-000 0000
75, 246
MACON4
DEFER
-000 --00
75, 231
MACON3
PADCFG2
PADCFG1
PADCFG0
TXCRCEN
PHDREN
HFRMEN
FRMLNEN
FULDPX
0000 0000
75, 230
TXPAUS
RXPAUS
PASSALL
MARXEN
MACON1
EPAUSH
EPAUSL
---0 0000
75, 229
0001 0000
75, 258
0000 0000
75, 258
EFLOCON
FCEN1
FCEN0
---- -000
75, 258
MISTAT
NVALID
SCAN
BUSY
---- 0000
75, 232
MAADR2
0000 0000
75, 245
MAADR1
0000 0000
75, 245
MAADR4
0000 0000
75, 245
MAADR3
0000 0000
75, 245
MAADR6
0000 0000
75, 245
MAADR5
0000 0000
75, 245
Legend: x = unknown; u = unchanged; - = unimplemented, read as 0; q = value depends on condition; r = reserved bit, do not modify. Shaded cells
are unimplemented, read as 0.
Note 1: Bit 7 and bit 6 are cleared by user software or by a POR.
2: Bit 21 of the PC is only available in Serial Programming modes.
3: Reset value is 0 when Two-Speed Start-up is enabled and 1 if disabled.
4: Alternate names and definitions for these bits when the MSSP module is operating in I2C Slave mode.
5: These bits and/or registers are only available in 100-pin devices; otherwise, they are unimplemented and read as 0. Reset values shown
apply only to 100-pin devices.
6: These bits and/or registers are only available in 80-pin and 100-pin devices. In 64-pin devices, they are unimplemented and read as 0. Reset
values are shown for 100-pin devices.
7: In Microcontroller mode, the bits in this register are unwritable and read as 0.
8: PLLEN is only available when either ECPLL or HSPLL Oscillator mode is selected; otherwise, read as 0.
9: Implemented in 100-pin devices in Microcontroller mode only.
DS39762F-page 96
PIC18F97J60 FAMILY
6.3.6
STATUS REGISTER
REGISTER 6-3:
register then reads back as 000u u1uu. It is recommended, therefore, that only BCF, BSF, SWAPF, MOVFF
and MOVWF instructions are used to alter the STATUS
register because these instructions do not affect the Z,
C, DC, OV or N bits in the STATUS register.
For other instructions not affecting any Status bits, see
the instruction set summaries in Table 26-2 and
Table 26-3.
Note:
STATUS REGISTER
U-0
U-0
U-0
R/W-x
R/W-x
R/W-x
R/W-x
R/W-x
OV
DC(1)
C(2)
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7-5
Unimplemented: Read as 0
bit 4
N: Negative bit
This bit is used for signed arithmetic (2s complement). It indicates whether the result was negative
(ALU MSb = 1).
1 = Result was negative
0 = Result was positive
bit 3
bit 2
Z: Zero bit
1 = The result of an arithmetic or logic operation is zero
0 = The result of an arithmetic or logic operation is non-zero
bit 1
bit 0
C: Carry/Borrow bit(2)
For ADDWF, ADDLW, SUBLW and SUBWF instructions:
1 = A carry-out from the Most Significant bit of the result occurred
0 = No carry-out from the Most Significant bit of the result occurred
Note 1:
2:
For Borrow, the polarity is reversed. A subtraction is executed by adding the 2s 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.
For Borrow, the polarity is reversed. A subtraction is executed by adding the 2s 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.
DS39762F-page 97
PIC18F97J60 FAMILY
6.4
Note:
6.4.1
6.4.2
DIRECT ADDRESSING
DS39762F-page 98
6.4.3
INDIRECT ADDRESSING
EXAMPLE 6-5:
LFSRFSR0, 100h;
CLRFPOSTINC0; Clear INDF
; register then
; inc pointer
BTFSSFSR0H, 1; All done with
; Bank1?
BRA NEXT
; NO, clear next
CONTINUE
; YES, continue
NEXT
PIC18F97J60 FAMILY
6.4.3.1
FIGURE 6-9:
INDIRECT ADDRESSING
000h
Bank 0
ADDWF, INDF1, 1
100h
Bank 1
200h
300h
FSR1H:FSR1L
7
x x x x 1 1 1 1
Bank 2
1 1 0 0 1 1 0 0
Bank 3
through
Bank 13
E00h
Bank 14
F00h
FFFh
Bank 15
Data Memory
DS39762F-page 99
PIC18F97J60 FAMILY
6.4.3.2
6.4.3.3
DS39762F-page 100
6.5
6.6
PIC18F97J60 FAMILY
6.6.1
6.6.2
INSTRUCTIONS AFFECTED BY
INDEXED LITERAL OFFSET MODE
DS39762F-page 101
PIC18F97J60 FAMILY
FIGURE 6-10:
000h
060h
Bank 0
100h
00h
Bank 1
through
Bank 14
60h
Valid Range
for f
FFh
F00h
Access RAM
Bank 15
F40h
SFRs
FFFh
Data Memory
000h
Bank 0
060h
100h
001001da ffffffff
Bank 1
through
Bank 14
FSR2H
FSR2L
F00h
Bank 15
F40h
SFRs
FFFh
Data Memory
BSR
00000000
000h
Bank 0
060h
100h
Bank 1
through
Bank 14
001001da ffffffff
F00h
Bank 15
F40h
SFRs
FFFh
Data Memory
DS39762F-page 102
PIC18F97J60 FAMILY
6.6.3
FIGURE 6-11:
Remapping of the Access Bank applies only to operations using the Indexed Literal Offset mode. Operations
that use the BSR (Access RAM bit is 1) will continue
to use Direct Addressing as before. Any indirect or
indexed operation that explicitly uses any of the indirect
file operands (including FSR2) will continue to operate
as standard Indirect Addressing. Any instruction that
uses the Access Bank, but includes a register address
of greater than 05Fh, will use Direct Addressing and
the normal Access Bank map.
6.6.4
Example Situation:
ADDWF f, d, a
FSR2H:FSR2L = 120h
000h
05Fh
100h
120h
17Fh
Bank 0
200h
Window
Bank 1
00h
Bank 1 Window
5Fh
60h
Not Accessible
Bank 2
through
Bank 14
SFRs
FFh
Access Bank
F00h
Bank 15
F60h
FFFh
SFRs
Data Memory
DS39762F-page 103
PIC18F97J60 FAMILY
NOTES:
DS39762F-page 104
PIC18F97J60 FAMILY
7.0
7.1
FIGURE 7-1:
Program Memory
Table Pointer(1)
TBLPTRU
TBLPTRH
TBLPTRL
Program Memory
(TBLPTR)
Note 1:
DS39762F-page 105
PIC18F97J60 FAMILY
FIGURE 7-2:
TBLPTRU
TBLPTRH
TABLAT
Program Memory
(TBLPTR)
Note 1:
7.2
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.
Control Registers
EECON1 register
EECON2 register
TABLAT register
TBLPTR registers
7.2.1
DS39762F-page 106
PIC18F97J60 FAMILY
REGISTER 7-1:
U-0
U-0
U-0
R/W-0
R/W-x
R/W-0
R/S-0
U-0
FREE
WRERR
WREN
WR
bit 7
bit 0
Legend:
S = Settable bit
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7-5
Unimplemented: Read as 0
bit 4
bit 3
bit 2
bit 1
bit 0
Unimplemented: Read as 0
DS39762F-page 107
PIC18F97J60 FAMILY
7.2.2
7.2.4
7.2.3
TABLE 7-1:
Example
TBLRD*
TBLWT*
TBLRD*+
TBLWT*+
TBLRD*TBLWT*-
TBLRD+*
TBLWT+*
FIGURE 7-3:
21
16
15
TBLPTRH
TBLPTRL
Table Erase
TBLPTR<20:10>
Table Write
TBLPTR<20:6>
DS39762F-page 108
PIC18F97J60 FAMILY
7.3
FIGURE 7-4:
Program Memory
TBLPTR = xxxxx0
TBLPTR = xxxxx1
Instruction Register
(IR)
EXAMPLE 7-1:
FETCH
TBLRD
TABLAT
Read Register
MOVLW
MOVWF
MOVLW
MOVWF
MOVLW
MOVWF
CODE_ADDR_UPPER
TBLPTRU
CODE_ADDR_HIGH
TBLPTRH
CODE_ADDR_LOW
TBLPTRL
READ_WORD
TBLRD*+
MOVF
MOVWF
TBLRD*+
MOVFW
MOVF
TABLAT, W
WORD_EVEN
TABLAT, W
WORD_ODD
DS39762F-page 109
PIC18F97J60 FAMILY
7.4
EXAMPLE 7-2:
7.4.1
3.
4.
5.
6.
7.
8.
CODE_ADDR_UPPER
TBLPTRU
CODE_ADDR_HIGH
TBLPTRH
CODE_ADDR_LOW
TBLPTRL
BSF
BSF
BCF
MOVLW
MOVWF
MOVLW
MOVWF
BSF
BSF
EECON1,
EECON1,
INTCON,
55h
EECON2
0AAh
EECON2
EECON1,
INTCON,
ERASE_ROW
Required
Sequence
DS39762F-page 110
WREN
FREE
GIE
; write 55h
WR
GIE
; write 0AAh
; start erase (CPU stall)
; re-enable interrupts
PIC18F97J60 FAMILY
7.5
2: To maintain the endurance of the program memory cells, each Flash byte
should not be programmed more than
one time between erase operations.
Before attempting to modify the contents
of the target cell a second time, a Row
Erase of the target row, or a Bulk Erase of
the entire memory, must be performed.
FIGURE 7-5:
8
TBLPTR = xxxxx0
TBLPTR = xxxxx1
Holding Register
TBLPTR = xxxx3F
TBLPTR = xxxxx2
Holding Register
Holding Register
Holding Register
Program Memory
7.5.1
2.
3.
4.
5.
6.
7.
8.
9.
10.
DS39762F-page 111
PIC18F97J60 FAMILY
EXAMPLE 7-3:
CODE_ADDR_UPPER
TBLPTRU
CODE_ADDR_HIGH
TBLPTRH
CODE_ADDR_LOW
TBLPTRL
BSF
BSF
BCF
MOVLW
MOVWF
MOVLW
MOVWF
BSF
BSF
MOVLW
MOVWF
EECON1, WREN
EECON1, FREE
INTCON, GIE
55h
EECON2
0AAh
EECON2
EECON1, WR
INTCON, GIE
D'16'
WRITE_COUNTER
MOVLW
MOVWF
MOVLW
MOVWF
MOVLW
MOVWF
D'64'
COUNTER
BUFFER_ADDR_HIGH
FSR0H
BUFFER_ADDR_LOW
FSR0L
ERASE_BLOCK
; write 55h
; write 0AAh
; start erase (CPU stall)
; re-enable interrupts
; Need to write 16 blocks of 64 to write
; one erase block of 1024
RESTART_BUFFER
; point to buffer
FILL_BUFFER
...
WRITE_BUFFER
MOVLW
MOVWF
WRITE_BYTE_TO_HREGS
MOVFF
MOVWF
TBLWT+*
D64
COUNTER
POSTINC0, WREG
TABLAT
;
;
;
;
DECFSZ COUNTER
;
BRA
WRITE_BYTE_TO_HREGS
PROGRAM_MEMORY
Required
Sequence
BSF
BCF
MOVLW
MOVWF
MOVLW
MOVWF
BSF
BSF
BCF
EECON1,
INTCON,
55h
EECON2
0AAh
EECON2
EECON1,
INTCON,
EECON1,
WREN
GIE
; write 55h
WR
GIE
WREN
DECFSZ WRITE_COUNTER
BRA
RESTART_BUFFER
DS39762F-page 112
;
;
;
;
write 0AAh
start program (CPU stall)
re-enable interrupts
disable write to memory
PIC18F97J60 FAMILY
7.5.2
WRITE VERIFY
7.5.4
7.5.3
UNEXPECTED TERMINATION OF
WRITE OPERATION
TABLE 7-2:
PROTECTION AGAINST
SPURIOUS WRITES
7.6
Name
Bit 7
Bit 6
Bit 5
TBLPTRU
bit 21
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
69
69
69
TABLAT
69
INTCON
EECON2
EECON1
INT0IE
FREE
RBIE
WRERR
TMR0IF
INT0IF
RBIF
69
71
WREN
WR
71
Legend: = unimplemented, read as 0. Shaded cells are not used during Flash/EEPROM access.
DS39762F-page 113
PIC18F97J60 FAMILY
NOTES:
DS39762F-page 114
PIC18F97J60 FAMILY
8.0
Note:
TABLE 8-1:
Name
Bit
RD0/AD0
PORTD
RD1/AD1
PORTD
RD2/AD2
PORTD
RD3/AD3
PORTD
RD4/AD4
PORTD
RD5/AD5
PORTD
RD6/AD6
PORTD
RD7/AD7
PORTD
RE0/AD8
PORTE
RE1/AD9
PORTE
RE2/AD10
PORTE
RE3/AD11
PORTE
RE4/AD12
PORTE
RE5/AD13
PORTE
RE6/AD14
PORTE
RE7/AD15
PORTE
RH0/A16
PORTH
Address Bit 16
RH1/A17
PORTH
Address Bit 17
RH2/A18
PORTH
Address Bit 18
RH3/A19
PORTH
Address Bit 19
RJ0/ALE
PORTJ
RJ1/OE
PORTJ
RJ2/WRL
PORTJ
RJ3/WRH
PORTJ
RJ4/BA0
PORTJ
RJ5/CE
PORTJ
RJ6/LB
PORTJ
RJ7/UB
PORTJ
Note:
For the sake of clarity, only I/O port and external bus assignments are shown here. One or more additional
multiplexed features may be available in some pins.
DS39762F-page 115
PIC18F97J60 FAMILY
8.1
REGISTER 8-1:
R/W-0
U-0
R/W-0
R/W-0
U-0
U-0
R/W-0
R/W-0
EBDIS
WAIT1
WAIT0
WM1
WM0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
Unimplemented: Read as 0
bit 5-4
WAIT<1:0>: Table Reads and Writes Bus Cycle Wait Count bits
11 = Table reads and writes will wait 0 TCY
10 = Table reads and writes will wait 1 TCY
01 = Table reads and writes will wait 2 TCY
00 = Table reads and writes will wait 3 TCY
bit 3-2
Unimplemented: Read as 0
bit 1-0
WM<1:0>: TBLWT Operation with 16-Bit Data Bus Width Select bits
1x = Word Write mode: WRH is active when TABLAT is written to and TBLPTR contains an odd
address. When TBLPTR contains an even address, writing to TABLAT loads a holding latch with
the value written.
01 = Byte Select mode: TABLAT data is copied on both MSB and LSB; WRH and (UB or LB)
will activate
00 = Byte Write mode: TABLAT data is copied on both MSB and LSB; WRH or WRL will activate
DS39762F-page 116
PIC18F97J60 FAMILY
8.2
8.2.1
The PIC18F97J60 family of devices can be independently configured for different address and data widths
on the same memory bus. Both address and data
widths are set by Configuration bits in the CONFIG3L
register. As Configuration bits, this means that these
options can only be configured by programming the
device and are not controllable in software.
The BW bit selects an 8-bit or 16-bit data bus width.
Setting this bit (default) selects a data width of 16 bits.
The EMB<1:0> bits determine both the program
memory operating mode and the address bus width. The
available options are 20-bit, 16-bit and 12-bit, as well as
the default Microcontroller mode (external bus disabled).
Selecting a 16-bit or 12-bit width makes a corresponding
number of high-order lines available for I/O functions.
These pins are no longer affected by the setting of the
EBDIS bit. For example, selecting a 16-Bit Addressing
mode (EMB<1:0> = 01) disables A<19:16> and allows
the PORTH<3:0> bits to function without interruptions
from the bus. Using the smaller address widths allows
users to tailor the memory bus to the size of the external
memory space for a particular design, while freeing up
pins for dedicated I/O operation.
Because the EMB bits have the effect of disabling pins for
memory bus operations, it is important to always select
an address width at least equal to the data width. If a
12-bit address width is used with a 16-bit data width, the
upper four bits of data will not be available in the bus.
All combinations of address and data widths require
multiplexing of address and data information on the
same lines. The address and data multiplexing, as well
as I/O ports made available by the use of smaller
address widths, are summarized in Table 8-2.
TABLE 8-2:
Data Width
8.2.2
ADDRESS AND DATA LINES FOR DIFFERENT ADDRESS AND DATA WIDTHS
Address Width
16-bit
AD<7:0>
(PORTD<7:0>)
20-bit
16-bit
16-bit
21-BIT ADDRESSING
12-bit
8-bit
20-bit
AD<15:0>
(PORTD<7:0>,
PORTE<7:0>)
Ports Available
for I/O
AD<11:8>
(PORTE<3:0>)
PORTE<7:4>,
All of PORTH
AD<15:8>
(PORTE<7:0>)
All of PORTH
A<19:16>, AD<15:8>
(PORTH<3:0>,
PORTE<7:0>)
All of PORTH
A<19:16>
(PORTH<3:0>)
DS39762F-page 117
PIC18F97J60 FAMILY
8.3
Wait States
8.4
8.5
DS39762F-page 118
8.6
PIC18F97J60 FAMILY
8.6.1
FIGURE 8-1:
PIC18F97J60
AD<7:0>
(MSB)
373
A<19:0>
D<15:8>
(LSB)
A<x:0>
A<x:0>
D<7:0>
D<7:0>
CE
AD<15:8>
373
OE
D<7:0>
CE
WR
(2)
OE
WR(2)
ALE
A<19:16>(1)
CE
OE
WRH
WRL
Address Bus
Data Bus
Control Lines
Note 1:
2:
The upper order address lines are used only for 20-bit address widths.
This signal only applies to table writes. See Section 7.1 Table Reads and Table Writes.
DS39762F-page 119
PIC18F97J60 FAMILY
8.6.2
FIGURE 8-2:
PIC18F97J60
AD<7:0>
373
A<20:1>
A<x:0>
D<15:0>
JEDEC Word
EPROM Memory
D<15:0>
CE
AD<15:8>
OE
WR(2)
373
ALE
A<19:16>(1)
CE
OE
WRH
Address Bus
Data Bus
Control Lines
Note 1:
2:
DS39762F-page 120
The upper order address lines are used only for 20-bit address widths.
This signal only applies to table writes. See Section 7.1 Table Reads and Table Writes.
PIC18F97J60 FAMILY
8.6.3
FIGURE 8-3:
PIC18F97J60
AD<7:0>
373
A<20:1>
A<x:1>
JEDEC Word
FLASH Memory
D<15:0>
AD<15:8>
138(3)
373
CE
A0
BYTE/WORD
ALE
D<15:0>
OE WR(1)
A<19:16>(2)
OE
WRH
A<20:1>
A<x:1>
BA0
JEDEC Word
SRAM Memory
I/O
LB
UB
CE
D<15:0>
CE
LB
UB
D<15:0>
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:
The upper order address lines are used only for 20-bit address width.
3:
DS39762F-page 121
PIC18F97J60 FAMILY
8.6.4
FIGURE 8-4:
Q2
Q3
Q4
Q1
Q2
Q3
Q4
Q1
Q2
A<19:16>
Q3
Q4
Q1
Q2
Q3
Q4
0Ch
CF33h
AD<15:0>
9256h
CE
ALE
OE
Memory
Cycle
Opcode Fetch
TBLRD*
from 000100h
Opcode Fetch
MOVLW 55h
from 000102h
TBLRD 92h
from 199E67h
Opcode Fetch
ADDLW 55h
from 000104h
Instruction
Execution
INST(PC 2)
TBLRD Cycle 1
TBLRD Cycle 2
MOVLW
FIGURE 8-5:
Q2
A<19:16>
AD<15:0>
Q3
Q4
Q1
Q2
00h
3AAAh
Q3
Q4
Q1
00h
0003h
3AABh
0E55h
CE
ALE
OE
Memory
Cycle
Opcode Fetch
SLEEP
from 007554h
Opcode Fetch
MOVLW 55h
from 007556h
Instruction
Execution
INST(PC 2)
SLEEP
DS39762F-page 122
PIC18F97J60 FAMILY
8.7
FIGURE 8-6:
373
A<19:0>
A<x:1>
A0
D<15:8>
D<7:0>
AD<15:8>(1)
CE
A<19:16>(1)
OE
WR(2)
BA0
CE
OE
WRL
Address Bus
Data Bus
Control Lines
Note 1:
2:
The upper order address bits are used only for 20-bit address width. The upper AD byte is used
for all address widths except 8-bit.
This signal only applies to table writes. See Section 7.1 Table Reads and Table Writes.
DS39762F-page 123
PIC18F97J60 FAMILY
8.7.1
FIGURE 8-7:
Q2
Q3
Q4
Q1
Q2
Q3
Q4
Q1
Q2
Q3
Q4
Q1
Q2
Q3
Q4
0Ch
A<19:16>
CFh
AD<15:8>
AD<7:0>
92h
33h
CE
ALE
OE
Memory
Cycle
Opcode Fetch
TBLRD*
from 000100h
Opcode Fetch
MOVLW 55h
from 000102h
TBLRD 92h
from 199E67h
Opcode Fetch
ADDLW 55h
from 000104h
Instruction
Execution
INST(PC 2)
TBLRD Cycle 1
TBLRD Cycle 2
MOVLW
FIGURE 8-8:
Q2
A<19:16>
Q4
Q1
Q2
3Ah
AAh
00h
Q3
Q4
Q1
00h
00h
AD<15:8>
AD<7:0>
Q3
3Ah
03h
ABh
0Eh
55h
BA0
CE
ALE
OE
Memory
Cycle
Opcode Fetch
SLEEP
from 007554h
Opcode Fetch
MOVLW 55h
from 007556h
Instruction
Execution
INST(PC 2)
SLEEP
DS39762F-page 124
PIC18F97J60 FAMILY
8.8
Operation in Power-Managed
Modes
DS39762F-page 125
PIC18F97J60 FAMILY
NOTES:
DS39762F-page 126
PIC18F97J60 FAMILY
9.0
8 x 8 HARDWARE MULTIPLIER
9.1
Introduction
EXAMPLE 9-1:
MOVF
MULWF
ARG1, W
ARG2
EXAMPLE 9-2:
9.2
8 x 8 UNSIGNED
MULTIPLY ROUTINE
;
; ARG1 * ARG2 ->
; PRODH:PRODL
8 x 8 SIGNED MULTIPLY
ROUTINE
MOVF
MULWF
ARG1, W
ARG2
BTFSC
SUBWF
ARG2, SB
PRODH, F
MOVF
BTFSC
SUBWF
ARG2, W
ARG1, SB
PRODH, F
;
;
;
;
;
Operation
TABLE 9-1:
Routine
8 x 8 unsigned
8 x 8 signed
16 x 16 unsigned
16 x 16 signed
Multiply Method
Without hardware multiply
Program
Memory
(Words)
Cycles
(Max)
@ 40 MHz
@ 10 MHz
@ 4 MHz
13
69
6.9 s
27.6 s
69 s
Time
Hardware multiply
100 ns
400 ns
1 s
33
91
9.1 s
36.4 s
91 s
Hardware multiply
600 ns
2.4 s
6 s
21
242
24.2 s
96.8 s
242 s
Hardware multiply
28
28
2.8 s
11.2 s
28 s
52
254
25.4 s
102.6 s
254 s
Hardware multiply
35
40
4.0 s
16.0 s
40 s
DS39762F-page 127
PIC18F97J60 FAMILY
Example 9-3 shows the sequence to do a 16 x 16
unsigned multiplication. Equation 9-1 shows the
algorithm that is used. The 32-bit result is stored in four
registers (RES3:RES0).
EQUATION 9-1:
RES3:RES0
=
=
EXAMPLE 9-3:
16 x 16 UNSIGNED
MULTIPLICATION
ALGORITHM
ARG1H:ARG1L ARG2H:ARG2L
(ARG1H ARG2H 216) +
(ARG1H ARG2L 28) +
(ARG1L ARG2H 28) +
(ARG1L ARG2L)
EQUATION 9-2:
EXAMPLE 9-4:
16 x 16 UNSIGNED
MULTIPLY ROUTINE
MOVF
MULWF
ARG1L, W
ARG2L
MOVFF
MOVFF
PRODH, RES1
PRODL, RES0
MOVF
MULWF
ARG1H, W
ARG2H
MOVFF
MOVFF
PRODH, RES3
PRODL, RES2
MOVF
MULWF
ARG1L, W
ARG2H
MOVF
ADDWF
MOVF
ADDWFC
CLRF
ADDWFC
PRODL, W
RES1, F
PRODH, W
RES2, F
WREG
RES3, F
MOVF
MULWF
ARG1H, W
ARG2L
MOVF
ADDWF
MOVF
ADDWFC
CLRF
ADDWFC
PRODL, W
RES1, F
PRODH, W
RES2, F
WREG
RES3, F
; ARG1L * ARG2L->
; PRODH:PRODL
;
;
ARG1L * ARG2H->
PRODH:PRODL
Add cross
products
ARG1H * ARG2L->
PRODH:PRODL
Add cross
products
DS39762F-page 128
ARG1L, W
ARG2L
MOVFF
MOVFF
PRODH, RES1
PRODL, RES0
MOVF
MULWF
ARG1H, W
ARG2H
MOVFF
MOVFF
PRODH, RES3
PRODL, RES2
MOVF
MULWF
ARG1L, W
ARG2H
MOVF
ADDWF
MOVF
ADDWFC
CLRF
ADDWFC
PRODL, W
RES1, F
PRODH, W
RES2, F
WREG
RES3, F
MOVF
MULWF
ARG1H, W
ARG2L
MOVF
ADDWF
MOVF
ADDWFC
CLRF
ADDWFC
PRODL, W
RES1, F
PRODH, W
RES2, F
WREG
RES3, F
BTFSS
BRA
MOVF
SUBWF
MOVF
SUBWFB
ARG2H, 7
SIGN_ARG1
ARG1L, W
RES2
ARG1H, W
RES3
; ARG2H:ARG2L neg?
; no, check ARG1
;
;
;
ARG1H, 7
CONT_CODE
ARG2L, W
RES2
ARG2H, W
RES3
; ARG1H:ARG1L neg?
; no, done
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
MOVF
MULWF
;
;
;
;
;
;
;
;
;
16 x 16 SIGNED
MULTIPLY ROUTINE
;
; ARG1H * ARG2H->
; PRODH:PRODL
;
;
16 x 16 SIGNED
MULTIPLICATION
ALGORITHM
;
;
;
;
;
;
;
;
;
;
SIGN_ARG1
BTFSS
BRA
MOVF
SUBWF
MOVF
SUBWFB
;
CONT_CODE
:
PIC18F97J60 FAMILY
10.0
INTERRUPTS
RCON
INTCON
INTCON2
INTCON3
PIR1, PIR2, PIR3
PIE1, PIE2, PIE3
IPR1, IPR2, IPR3
DS39762F-page 129
PIC18F97J60 FAMILY
FIGURE 10-1:
PIR1<7:0>
PIE1<7:0>
IPR1<7:0>
PIR2<7:5,3,1:0>
PIE2<7:5,3,1:0>
IPR2<7:5,3,1:0>
Wake-up if in
Idle or Sleep modes
TMR0IF
TMR0IE
TMR0IP
RBIF
RBIE
RBIP
INT0IF
INT0IE
INT1IF
INT1IE
INT1IP
INT2IF
INT2IE
INT2IP
INT3IF
INT3IE
INT3IP
Interrupt to CPU
Vector to Location
0008h
GIE/GIEH
IPEN
IPEN
PEIE/GIEL
PIR3<7:0>
PIE3<7:0>
IPR3<7:0>
IPEN
PIR1<7:0>
PIE1<7:0>
IPR1<7:0>
PIR2<7:5,3,1:0>
PIE2<7:5,3,1:0>
IPR2<7:5,3,1:0>
PIR3<7:0>
PIE3<7:0>
IPR3<7:0>
TMR0IF
TMR0IE
TMR0IP
RBIF
RBIE
RBIP
INT1IF
INT1IE
INT1IP
INT2IF
INT2IE
INT2IP
INT3IF
INT3IE
INT3IP
DS39762F-page 130
Interrupt to CPU
Vector to Location
0018h
IPEN
GIE/GIEH
PEIE/GIEL
PIC18F97J60 FAMILY
10.1
INTCON Registers
Note:
REGISTER 10-1:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-x
GIE/GIEH
PEIE/GIEL
TMR0IE
INT0IE
RBIE
TMR0IF
INT0IF
RBIF(1)
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
Note 1:
A mismatch condition will continue to set this bit. Reading PORTB will end the mismatch condition and
allow the bit to be cleared.
DS39762F-page 131
PIC18F97J60 FAMILY
REGISTER 10-2:
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
RBPU
INTEDG0
INTEDG1
INTEDG2
INTEDG3
TMR0IP
INT3IP
RBIP
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
Note:
x = Bit is unknown
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.
DS39762F-page 132
PIC18F97J60 FAMILY
REGISTER 10-3:
R/W-1
R/W-1
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
INT2IP
INT1IP
INT3IE
INT2IE
INT1IE
INT3IF
INT2IF
INT1IF
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
Note:
x = Bit is unknown
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.
DS39762F-page 133
PIC18F97J60 FAMILY
10.2
PIR Registers
The PIR registers contain the individual flag bits for the
peripheral interrupts. Due to the number of peripheral
interrupt sources, there are three Peripheral Interrupt
Request (Flag) registers (PIR1, PIR2, PIR3).
REGISTER 10-4:
R/W-0
R/W-0
R-0
R-0
R/W-0
R/W-0
R/W-0
R/W-0
PSPIF(1)
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
Note 1:
DS39762F-page 134
PIC18F97J60 FAMILY
REGISTER 10-5:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
U-0
R/W-0
R/W-0
OSCFIF
CMIF
ETHIF
BCL1IF
TMR3IF
CCP2IF
bit 7
bit 0
Legend:
r = Reserved bit
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
bit 4
Reserved: Maintain as 0
bit 3
bit 2
Unimplemented: Read as 0
bit 1
bit 0
DS39762F-page 135
PIC18F97J60 FAMILY
REGISTER 10-6:
R/W-0
SSP2IF
(1)
R-0
R-0
R/W-0
R/W-0
R/W-0
R/W-0
BCL2IF(1)
RC2IF(2)
TX2IF(2)
TMR4IF
CCP5IF
CCP4IF
CCP3IF
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
Note 1:
2:
DS39762F-page 136
PIC18F97J60 FAMILY
10.3
PIE Registers
REGISTER 10-7:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
PSPIE(1)
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
Note 1:
x = Bit is unknown
DS39762F-page 137
PIC18F97J60 FAMILY
REGISTER 10-8:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
U-0
R/W-0
R/W-0
OSCFIE
CMIE
ETHIE
BCL1IE
TMR3IE
CCP2IE
bit 7
bit 0
Legend:
r = Reserved bit
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
Reserved: Maintain as 0
bit 3
bit 2
Unimplemented: Read as 0
bit 1
bit 0
DS39762F-page 138
x = Bit is unknown
PIC18F97J60 FAMILY
REGISTER 10-9:
R/W-0
R/W-0
R-0
R-0
R/W-0
R/W-0
R/W-0
R/W-0
SSP2IE(1)
BCL2IE(1)
RC2IE(2)
TX2IE(2)
TMR4IE
CCP5IE
CCP4IE
CCP3IE
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
Note 1:
2:
x = Bit is unknown
DS39762F-page 139
PIC18F97J60 FAMILY
10.4
IPR Registers
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
PSPIP(1)
ADIP
RC1IP
TX1IP
SSP1IP
CCP1IP
TMR2IP
TMR1IP
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
x = Bit is unknown
1 = High priority
0 = Low priority
bit 3
bit 2
bit 1
bit 0
Note 1:
DS39762F-page 140
PIC18F97J60 FAMILY
REGISTER 10-11: IPR2: PERIPHERAL INTERRUPT PRIORITY REGISTER 2
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
U-0
R/W-1
R/W-1
OSCFIP
CMIP
ETHIP
BCL1IP
TMR3IP
CCP2IP
bit 7
bit 0
Legend:
r = Reserved bit
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
Reserved: Maintain as 1
bit 3
bit 2
Unimplemented: Read as 0
bit 1
bit 0
x = Bit is unknown
DS39762F-page 141
PIC18F97J60 FAMILY
REGISTER 10-12: IPR3: PERIPHERAL INTERRUPT PRIORITY REGISTER 3
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
SSP2IP(1)
BCL2IP(1)
RC2IP(2)
TX2IP(2)
TMR4IP
CCP5IP
CCP4IP
CCP3IP
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
x = Bit is unknown
1 = High priority
0 = Low priority
bit 3
bit 2
bit 1
bit 0
Note 1:
2:
DS39762F-page 142
PIC18F97J60 FAMILY
10.5
RCON Register
U-0
R/W-1
R/W-1
R-1
R-1
R/W-0
R/W-0
IPEN
CM
RI
TO
PD
POR
BOR
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
Unimplemented: Read as 0
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
x = Bit is unknown
DS39762F-page 143
PIC18F97J60 FAMILY
10.6
10.7
TMR0 Interrupt
10.8
EXAMPLE 10-1:
MOVWF
MOVFF
MOVFF
;
; USER
;
MOVFF
MOVF
MOVFF
PORTB Interrupt-on-Change
10.9
W_TEMP
STATUS, STATUS_TEMP
BSR, BSR_TEMP
ISR CODE
BSR_TEMP, BSR
W_TEMP, W
STATUS_TEMP, STATUS
DS39762F-page 144
; Restore BSR
; Restore WREG
; Restore STATUS
PIC18F97J60 FAMILY
11.0
I/O PORTS
11.1
FIGURE 11-1:
11.1.1
TABLE 11-1:
Port
PORTA(1)
Description
(2)
PORTF
PORTG(2)
PORTH(3)
RD LAT
Data
Bus
WR LAT
or PORT
PORTD(2)
High
PORTE
D
PORTJ(3)
I/O Pin
CK
PORTB
PORTC
Data Latch
WR TRIS
Medium
Note 1:
2:
CK
TRIS Latch
Input
Buffer
3:
RD TRIS
ENEN
RD PORT
DS39762F-page 145
PIC18F97J60 FAMILY
11.1.2
TABLE 11-2:
Port or Pin
Tolerated
Input
PORTA<5,3:0>
VDD
5.5V
PORTF<6:1>(1)
Description
PORTH<7:4>(2)
PORTA<4>
PORTB<7:0>
PORTC<7:0>
PORTD<7:0>(1)
PORTE<7:0>
PORTF<7>
PORTG<7:0>(1)
PORTH<3:0>(2)
PORTJ<7:0>(2)
Note 1:
2:
11.2
EXAMPLE 11-1:
CLRF
CLRF
MOVLW
MOVWF
MOVWF
MOVWF
MOVLW
MOVWF
PORTA
;
;
;
LATA
;
;
;
07h
;
ADCON1 ;
07h
;
CMCON
;
0CFh
;
;
;
TRISA
;
;
INITIALIZING PORTA
Initialize PORTA by
clearing output
data latches
Alternate method
to clear output
data latches
Configure A/D
for digital inputs
Configure comparators
for digital input
Value used to
initialize data
direction
Set RA<3:0> as inputs
RA<5:4> as outputs
DS39762F-page 146
PIC18F97J60 FAMILY
TABLE 11-3:
PORTA FUNCTIONS
Pin Name
Function
RA0/LEDA/AN0
RA0
RA1/LEDB/AN1
RA2/AN2/VREF-
RA3/AN3/VREF+
RA4/T0CKI
RA5/AN4
TRIS
Setting
I/O
DIG
TTL
LEDA
DIG
AN0
ANA
RA1
DIG
TTL
LEDB
DIG
AN1
ANA
RA2
DIG
TTL
AN2
ANA
VREF-
ANA
RA3
DIG
TTL
AN3
ANA
VREF+
ANA
RA4
DIG
ST
T0CKI
ST
RA5
DIG
TTL
ANA
O = Output, I = Input, ANA = Analog Signal, DIG = Digital Output, ST = Schmitt Buffer Input, TTL = TTL Buffer Input,
x = Dont care (TRIS bit does not affect port direction or is overridden for this option).
TABLE 11-4:
Name
Description
AN4
Legend:
I/O
Type
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values on
Page:
RJPU(1)
RA5
RA4
RA3
RA2
RA1
RA0
72
LATA
RDPU
REPU
LATA5
LATA4
LATA3
LATA2
LATA1
LATA0
72
TRISA
TRISA5
TRISA4
TRISA3
TRISA2
TRISA1
TRISA0
71
ADCON1
VCFG1
VCFG0
PCFG3
PCFG2
PCFG1
PCFG0
70
PORTA
DS39762F-page 147
PIC18F97J60 FAMILY
11.3
EXAMPLE 11-2:
CLRF
PORTB
CLRF
LATB
MOVLW
0CFh
MOVWF
TRISB
INITIALIZING PORTB
;
;
;
;
;
;
;
;
;
;
;
;
Initialize PORTB by
clearing output
data latches
Alternate method
to clear output
data latches
Value used to
initialize data
direction
Set RB<3:0> as inputs
RB<5:4> as outputs
RB<7:6> as inputs
DS39762F-page 148
b)
PIC18F97J60 FAMILY
TABLE 11-5:
PORTB FUNCTIONS
Pin Name
Function
TRIS
Setting
I/O
I/O
Type
RB0/INT0/FLT0
RB0
DIG
TTL
ST
INT0
RB1/INT1
RB2/INT2
RB3/INT3/
ECCP2/P2A
RB4/KBI0
RB5/KBI1
RB6/KBI2/PGC
RB7/KBI3/PGD
Legend:
Note 1:
2:
Description
FLT0
ST
RB1
DIG
TTL
INT1
ST
RB2
DIG
TTL
INT2
ST
RB3
DIG
TTL
INT3
ST
ECCP2(1)
DIG
ECCP2 compare output and PWM output; takes priority over port data.
ST
P2A(1)
DIG
RB4
DIG
TTL
KBI0
TTL
Interrupt-on-pin change.
RB5
DIG
TTL
KBI1
TTL
Interrupt-on-pin change.
RB6
DIG
TTL
KBI2
TTL
Interrupt-on-pin change.
PGC
ST
Serial execution (ICSP) clock input for ICSP and ICD operation.(2)
RB7
DIG
TTL
KBI3
TTL
Interrupt-on-pin change.
PGD
DIG
ST
O = Output, I = Input, DIG = Digital Output, ST = Schmitt Buffer Input, TTL = TTL Buffer Input,
x = Dont care (TRIS bit does not affect port direction or is overridden for this option).
Alternate assignment for ECCP2/P2A when the CCP2MX Configuration bit is cleared (100-pin devices in Extended
Microcontroller mode). Default assignment is RC1.
All other pin functions are disabled when ICSP or ICD is enabled.
DS39762F-page 149
PIC18F97J60 FAMILY
TABLE 11-6:
Name
PORTB
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
RB7
RB6
RB5
RB4
RB3
RB2
RB1
RB0
72
LATB
LATB7
LATB6
LATB5
LATB4
LATB3
LATB2
LATB1
LATB0
72
TRISB
TRISB7
TRISB6
TRISB5
TRISB4
TRISB3
TRISB2
TRISB1
TRISB0
71
TMR0IE
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
69
INT3IP
RBIP
69
INT2IF
INT1IF
69
INTCON
GIE/GIEH PEIE/GIEL
INTCON2
RBPU
INTCON3
INT2IP
INT1IP
INT3IE
INT2IE
INT1IE
INT3IF
DS39762F-page 150
PIC18F97J60 FAMILY
11.4
Note:
EXAMPLE 11-3:
CLRF
PORTC
CLRF
LATC
MOVLW
0CFh
MOVWF
TRISC
INITIALIZING PORTC
;
;
;
;
;
;
;
;
;
;
;
;
Initialize PORTC by
clearing output
data latches
Alternate method
to clear output
data latches
Value used to
initialize data
direction
Set RC<3:0> as inputs
RC<5:4> as outputs
RC<7:6> as inputs
DS39762F-page 151
PIC18F97J60 FAMILY
TABLE 11-7:
Pin Name
RC0/T1OSO/
T13CKI
RC1/T1OSI/
ECCP2/P2A
PORTC FUNCTIONS
Function
TRIS
Setting
I/O
I/O
Type
RC0
DIG
ST
T1OSO
ANA
T13CKI
ST
RC1
DIG
ST
T1OSI
ANA
ECCP2(1)
DIG
ECCP2 compare output and PWM output; takes priority over port data.
ST
DIG
DIG
P2A
RC2/ECCP1/
P1A
RC3/SCK1/
SCL1
(1)
RC2
ST
DIG
ECCP1 compare output and PWM output; takes priority over port data.
ST
P1A
DIG
RC3
DIG
ST
DIG
SPI clock output (MSSP1 module); takes priority over port data.
ST
DIG
I2C clock output (MSSP1 module); takes priority over port data.
ST
I2C clock input (MSSP1 module); input type depends on module setting.
DIG
ST
Legend:
Note 1:
SDI1
ST
SDA1
DIG
I2C data output (MSSP1 module); takes priority over port data.
ST
I2C data input (MSSP1 module); input type depends on module setting.
DIG
ST
SDO1
DIG
SPI data output (MSSP1 module); takes priority over port data.
RC6
DIG
ST
TX1
DIG
Synchronous serial data output (EUSART1 module); takes priority over port data.
CK1
DIG
RC5
RC7/RX1/DT1
RC4
RC6/TX1/CK1
SCL1
RC5/SDO1
ECCP1
SCK1
RC4/SDI1/
SDA1
Description
ST
RC7
DIG
ST
RX1
ST
DT1
DIG
ST
O = Output, I = Input, ANA = Analog Signal, DIG = Digital Output, ST = Schmitt Buffer Input,
x = Dont care (TRIS bit does not affect port direction or is overridden for this option).
Default assignment for ECCP2/P2A when CCP2MX Configuration bit is set.
DS39762F-page 152
PIC18F97J60 FAMILY
TABLE 11-8:
Name
PORTC
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
RC7
RC6
RC5
RC4
RC3
RC2
RC1
RC0
72
LATC
LATC7
LATC6
LATC5
LATC4
LATC3
LATC2
LATC1
LATC0
72
TRISC
TRISC7
TRISC6
TRISC5
TRISC4
TRISC3
TRISC2
TRISC1
TRISC0
71
DS39762F-page 153
PIC18F97J60 FAMILY
11.5
DS39762F-page 154
EXAMPLE 11-4:
CLRF
PORTD
CLRF
LATD
MOVLW
0CFh
MOVWF
TRISD
INITIALIZING PORTD
;
;
;
;
;
;
;
;
;
;
;
;
Initialize PORTD by
clearing output
data latches
Alternate method
to clear output
data latches
Value used to
initialize data
direction
Set RD<3:0> as inputs
RD<5:4> as outputs
RD<7:6> as inputs
PIC18F97J60 FAMILY
TABLE 11-9:
PORTD FUNCTIONS
Pin Name
Function
TRIS
Setting
I/O
I/O
Type
RD0/AD0/PSP0
(RD0/P1B)
RD0
DIG
ST
DIG
TTL
DIG
PSP read output data (LATD<0>); takes priority over port data.
TTL
P1B(3)
DIG
RD1
DIG
ST
DIG
TTL
DIG
PSP read output data (LATD<1>); takes priority over port data.
TTL
DIG
ECCP3 compare and PWM output; takes priority over port data.
AD0(1)
PSP0(1)
RD1/AD1/PSP1
(RD1/ECCP3/
P3A)
AD1(1)
PSP1
(1)
ECCP3(3)
RD2/AD2/PSP2
(RD2/CCP4/
P3D)
ST
P3A(3)
DIG
RD2
DIG
ST
DIG
TTL
DIG
PSP read output data (LATD<2>); takes priority over port data.
TTL
DIG
CCP4 compare output and PWM output; takes priority over port data.
ST
P3D(3)
DIG
RD3(1)
DIG
AD2(1)
PSP2(1)
CCP4(3)
RD3/AD3/
PSP3(1)
AD3(1)
PSP3(1)
RD4/AD4/
PSP4/SDO2(1)
RD4(1)
AD4(1)
PSP4
(1)
SDO2(1)
Legend:
Note 1:
2:
3:
Description
ST
DIG
TTL
DIG
PSP read output data (LATD<3>); takes priority over port data.
TTL
DIG
ST
DIG
TTL
DIG
PSP read output data (LATD<4>); takes priority over port data.
TTL
DIG
SPI data output (MSSP2 module); takes priority over port data.
O = Output, I = Input, DIG = Digital Output, ST = Schmitt Buffer Input, TTL = TTL Buffer Input,
x = Dont care (TRIS bit does not affect port direction or is overridden for this option).
These features or port pins are implemented only on 100-pin devices.
External memory interface I/O takes priority over all other digital and PSP I/O.
These features are implemented on this pin only on 64-pin devices; for all other devices, they are multiplexed with
RE6/RH7 (P1B), RG0 (ECCP3/P3A) or RG3 (CCP4/P3D).
DS39762F-page 155
PIC18F97J60 FAMILY
TABLE 11-9:
Pin Name
RD5/AD5/
PSP5/SDI2/
SDA2(1)
TRIS
Setting
I/O
I/O
Type
RD5(1)
DIG
AD5(1)
PSP5(1)
RD6/AD6/
PSP6/SCK2/
SCL2(1)
ST
DIG
TTL
DIG
PSP read output data (LATD<5>); takes priority over port data.
TTL
ST
SDA2(1)
DIG
I2C data output (MSSP2 module); takes priority over port data.
ST
DIG
ST
DIG-3
TTL
DIG
PSP read output data (LATD<6>); takes priority over port data.
TTL
DIG
SPI clock output (MSSP2 module); takes priority over port data.
ST
DIG
I2C clock output (MSSP2 module); takes priority over port data.
ST
DIG
ST
DIG
TTL
DIG
PSP read output data (LATD<7>); takes priority over port data.
TTL
TTL
RD6(1)
AD6(1)
(1)
SCL2(1)
RD7(1)
AD7(1)
PSP7
(1)
SS2(1)
Note 1:
2:
3:
SCK2(1)
Legend:
SDI2(1)
PSP6
RD7/AD7/
PSP7/SS2(1)
Description
O = Output, I = Input, DIG = Digital Output, ST = Schmitt Buffer Input, TTL = TTL Buffer Input,
x = Dont care (TRIS bit does not affect port direction or is overridden for this option).
These features or port pins are implemented only on 100-pin devices.
External memory interface I/O takes priority over all other digital and PSP I/O.
These features are implemented on this pin only on 64-pin devices; for all other devices, they are multiplexed with
RE6/RH7 (P1B), RG0 (ECCP3/P3A) or RG3 (CCP4/P3D).
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
RD7(1)
RD6(1)
RD5(1)
RD4(1)
RD3(1)
RD2
RD1
RD0
72
LATD
LATD7(1)
TRISD
LATA
RDPU
(1)
LATD6
REPU
(1)
LATD5
LATA5
(1)
LATD4
LATA4
(1)
LATD3
LATA3
LATD2
LATD1
LATD0
72
TRISD2
TRISD1
TRISD0
71
LATA2
LATA1
LATA0
72
DS39762F-page 156
PIC18F97J60 FAMILY
11.6
EXAMPLE 11-5:
CLRF
PORTE
CLRF
LATE
MOVLW
03h
MOVWF
TRISE
INITIALIZING PORTE
;
;
;
;
;
;
;
;
;
;
;
Initialize PORTE by
clearing output
data latches
Alternate method
to clear output
data latches
Value used to
initialize data
direction
Set RE<1:0> as inputs
RE<7:2> as outputs
DS39762F-page 157
PIC18F97J60 FAMILY
TABLE 11-11:
Pin Name
PORTE FUNCTIONS
Function
TRIS
Setting
I/O
I/O
Type
RE0
DIG
RE0/AD8/RD/
P2D
AD8(1)
RE1/AD9/WR/
P2C
ST
DIG
TTL
TTL
P2D
DIG
RE1
DIG
ST
DIG
TTL
TTL
P2C
DIG
RE2
DIG
ST
AD10(1)
DIG
TTL
RE3/AD11/
P3C
CS(6)
TTL
P2B
DIG
RE3
DIG
ST
DIG
AD11(1)
TTL
P3C(3)
DIG
RE4
DIG
ST
AD12(1)
DIG
TTL
DIG
ECCP3 Enhanced PWM output, channel B; takes priority over port and
PSP data. May be configured for tri-state during Enhanced PWM
shutdown events.
RE4/AD12/
P3B
P3B(3)
6:
WR(6)
RE2/AD10/CS/
P2B
Note 1:
2:
3:
4:
5:
RD(6)
AD9(1)
Legend:
Description
O = Output, I = Input, DIG = Digital Output, ST = Schmitt Buffer Input, TTL = TTL Buffer Input,
x = Dont care (TRIS bit does not affect port direction or is overridden for this option).
EMB functions are implemented on 100-pin devices only.
External memory interface I/O takes priority over all other digital and PSP I/O.
Default assignments for P1B/P1C and P3B/P3C when ECCPMX Configuration bit is set (80-pin and 100-pin devices).
Unimplemented on 64-pin devices.
Alternate assignment for ECCP2/P2A when CCP2MX Configuration bit is cleared (80-pin and 100-pin devices in
Microcontroller mode).
Unimplemented on 64-pin and 80-pin devices.
DS39762F-page 158
PIC18F97J60 FAMILY
TABLE 11-11:
Pin Name
RE5/AD13/
P1C
TRIS
Setting
I/O
I/O
Type
RE5
DIG
ST
DIG
TTL
P1C(3)
DIG
RE6
DIG
ST
DIG
TTL
DIG
DIG
ST
DIG
TTL
DIG
AD13(1)
RE6/AD14/
P1B(4)
AD14(1)
(3)
P1B
RE7/AD15/
ECCP2/P2A(4)
RE7
AD15(1)
ECCP2
(5)
P2A(5)
Legend:
Note 1:
2:
3:
4:
5:
6:
Description
ST
DIG
O = Output, I = Input, DIG = Digital Output, ST = Schmitt Buffer Input, TTL = TTL Buffer Input,
x = Dont care (TRIS bit does not affect port direction or is overridden for this option).
EMB functions are implemented on 100-pin devices only.
External memory interface I/O takes priority over all other digital and PSP I/O.
Default assignments for P1B/P1C and P3B/P3C when ECCPMX Configuration bit is set (80-pin and 100-pin devices).
Unimplemented on 64-pin devices.
Alternate assignment for ECCP2/P2A when CCP2MX Configuration bit is cleared (80-pin and 100-pin devices in
Microcontroller mode).
Unimplemented on 64-pin and 80-pin devices.
Bit 7
Bit 6
RE7(1)
RE6(1)
RE5
RE4
RE3
RE2
LATE7(1)
LATE6(1)
LATE5
LATE4
LATE3
LATE2
TRISE6(1)
TRISE5
TRISE4
TRISE3
TRISE2
REPU
LATA5
LATA4
LATA3
LATA2
TRISE7
(1)
RDPU
Bit 5
Bit 4
Bit 3
Bit 2
Bit 0
Reset
Values
on Page:
RE1
RE0
72
LATE1
LATE0
72
TRISE1
TRISE0
71
LATA1
LATA0
72
Bit 1
DS39762F-page 159
PIC18F97J60 FAMILY
11.7
DS39762F-page 160
EXAMPLE 11-6:
CLRF
CLRF
MOVLW
MOVWF
MOVLW
MOVWF
MOVLW
MOVWF
PORTF
;
;
;
LATF
;
;
;
07h
;
CMCON
;
0Fh
;
ADCON1 ;
0CEh
;
;
;
TRISF
;
;
;
INITIALIZING PORTF
Initialize PORTF by
clearing output
data latches
Alternate method
to clear output
data latches
Turn off comparators
Set PORTF as digital I/O
Value used to
initialize data
direction
Set RF3:RF1 as inputs
RF5:RF4 as outputs
RF7:RF6 as inputs
PIC18F97J60 FAMILY
TABLE 11-13: PORTF FUNCTIONS
Pin Name Function
RF0/AN5(1)
RF1/AN6/
C2OUT
RF2/AN7/
C1OUT
RF3/AN8
RF4/AN9
RF5/AN10/
CVREF
RF6/AN11
RF7/SS1
TRIS
Setting
I/O
I/O
Type
DIG
ST
RF0(1)
AN5(1)
ANA
RF1
DIG
ST
AN6
ANA
C2OUT
DIG
RF2
DIG
Note 1:
ST
AN7
ANA
C1OUT
TTL
RF3
DIG
ST
AN8
ANA
RF4
DIG
ST
AN9
ANA
A/D Input Channel 9 and Comparator C2- input. Default input configuration on POR;
does not affect digital output.
RF5
DIG
LATF<5> data output; not affected by analog input. Disabled when CVREF
output is enabled.
ST
PORTF<5> data input; disabled when analog input is enabled. Disabled when CVREF
output is enabled.
AN10
ANA
A/D Input Channel 10 and Comparator C1+ input. Default input configuration on POR.
CVREF
ANA
Comparator voltage reference output. Enabling this feature disables digital I/O.
RF6
DIG
ST
AN11
ANA
A/D Input Channel 11 and Comparator C1- input. Default input configuration on POR;
does not affect digital output.
RF7
DIG
ST
TTL
SS1
Legend:
Description
O = Output, I = Input, ANA = Analog Signal, DIG = Digital Output, ST = Schmitt Buffer Input, TTL = TTL Buffer Input,
x = Dont care (TRIS bit does not affect port direction or is overridden for this option).
Implemented on 100-pin devices only.
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
RF7
RF6
RF5
RF4
RF3
RF2
RF1
RF0(1)
72
LATF7
LATF6
LATF5
LATF4
LATF3
LATF2
LATF1
LATF0(1)
72
TRISF7
TRISF6
TRISF5
TRISF4
TRISF3
TRISF2
TRISF1
VCFG1
VCFG0
PCFG3
PCFG2
PCFG1
TRISF0
(1)
71
PCFG0
70
CMCON
C2OUT
C1OUT
C2INV
C1INV
CIS
CM2
CM1
CM0
70
CVRCON
CVREN
CVROE
CVRR
CVRSS
CVR3
CVR2
CVR1
CVR0
70
DS39762F-page 161
PIC18F97J60 FAMILY
11.8
DS39762F-page 162
EXAMPLE 11-7:
CLRF
PORTG
CLRF
LATG
MOVLW
04h
MOVWF
TRISG
INITIALIZING PORTG
;
;
;
;
;
;
;
;
;
;
;
;
Initialize PORTG by
clearing output
data latches
Alternate method
to clear output
data latches
Value used to
initialize data
direction
Set RG1:RG0 as outputs
RG2 as input
RG4:RG3 as inputs
PIC18F97J60 FAMILY
TABLE 11-15: PORTG FUNCTIONS
Pin Name
Function
TRIS
Setting
I/O
I/O
Type
RG0/ECCP3/
P3A(1)
RG0(1)
DIG
ST
DIG
ECCP3 compare and PWM output; takes priority over port data.
ECCP3(1)
RG1/TX2/
CK2(1)
RG2/RX2/
DT2(1)
ST
P3A(1)
DIG
ECCP3 Enhanced PWM output, Channel A; takes priority over port and PSP
data. May be configured for tri-state during Enhanced PWM shutdown events.
RG1(1)
DIG
ST
TX2(1)
DIG
Synchronous serial data output (EUSART2 module); takes priority over port data.
CK2(1)
DIG
Synchronous serial data input (EUSART2 module). User must configure as an input.
Synchronous serial clock input (EUSART2 module).
RG2(1)
RX2(1)
DT2(1)
RG3/CCP4/
P3D(1)
RG6(2)
RG7(2)
Legend:
Note 1:
2:
ST
DIG
ST
ST
DIG
Synchronous serial data output (EUSART2 module); takes priority over port data.
ST
Synchronous serial data input (EUSART2 module). User must configure as an input.
DIG
ST
DIG
CCP4 compare output and PWM output; takes priority over port data.
ST
P3D(1)
DIG
ECCP3 Enhanced PWM output, Channel D; takes priority over port and PSP
data. May be configured for tri-state during Enhanced PWM shutdown events.
RG4
DIG
ST
DIG
CCP5 compare output and PWM output; takes priority over port data.
RG3(1)
CCP5
RG5(2)
CCP4(1)
RG4/CCP5/
P1D
Description
ST
P1D
DIG
ECCP1 Enhanced PWM output, Channel D; takes priority over port and PSP
data. May be configured for tri-state during Enhanced PWM shutdown events.
RG5(2)
DIG
ST
DIG
ST
DIG
ST
RG6(2)
RG7(2)
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values on
Page:
RG7(1)
RG6(1)
RG5(1)
RG4
RG3(2)
RG2(2)
RG1(2)
RG0(2)
72
LATG
LATG7
LATG6(1)
LATG5(1)
LATG4
LATG3(2)
LATG2(2)
LATG1(2)
LATG0(2)
72
TRISG
TRISG4
71
Name
PORTG
Note 1:
2:
(1)
DS39762F-page 163
PIC18F97J60 FAMILY
11.9
Note:
DS39762F-page 164
EXAMPLE 11-8:
CLRF
PORTH
CLRF
LATH
MOVLW
MOVWF
MOVLW
0Fh
ADCON1
0CFh
MOVWF
TRISH
INITIALIZING PORTH
;
;
;
;
;
;
;
;
;
;
;
;
;
;
Initialize PORTH by
clearing output
data latches
Alternate method
to clear output
data latches
Configure PORTH as
digital I/O
Value used to
initialize data
direction
Set RH3:RH0 as inputs
RH5:RH4 as outputs
RH7:RH6 as inputs
PIC18F97J60 FAMILY
TABLE 11-17: PORTH FUNCTIONS
Pin Name
RH0/A16
RH1/A17
RH2/A18
RH3/A19
RH4/AN12/P3C
Function
TRIS
Setting
I/O
I/O
Type
RH0
DIG
ST
A16(1)
DIG
External memory interface, Address Line 16. Takes priority over port data.
RH1
DIG
ST
DIG
External memory interface, Address Line 17. Takes priority over port data.
RH2
DIG
ST
A18(1)
DIG
External memory interface, Address Line 18. Takes priority over port data.
RH3
DIG
ST
A19(1)
DIG
External memory interface, Address Line 19. Takes priority over port data.
RH4
DIG
ST
ANA
A/D Input Channel 12. Default input configuration on POR; does not affect
digital output.
P3C(2)
DIG
ECCP3 Enhanced PWM output, Channel C; takes priority over port and PSP
data. May be configured for tri-state during Enhanced PWM shutdown events.
RH5
DIG
ST
ANA
A/D Input Channel 13. Default input configuration on POR; does not affect
digital output.
AN13
RH6/AN14/P1C
P3B(2)
DIG
ECCP3 Enhanced PWM output, Channel B; takes priority over port and PSP
data. May be configured for tri-state during Enhanced PWM shutdown events.
RH6
DIG
ST
ANA
A/D Input Channel 14. Default input configuration on POR; does not affect
digital output.
AN14
RH7/AN15/P1B
P1C(2)
DIG
ECCP1 Enhanced PWM output, Channel C; takes priority over port and PSP
data. May be configured for tri-state during Enhanced PWM shutdown events.
RH7
DIG
ST
ANA
A/D Input Channel 15. Default input configuration on POR; does not affect
digital output.
DIG
ECCP1 Enhanced PWM output, Channel B; takes priority over port and PSP
data. May be configured for tri-state during Enhanced PWM shutdown events.
AN15
P1B(2)
Legend:
Note 1:
2:
A17(1)
AN12
RH5/AN13/P3B
Description
O = Output, I = Input, ANA = Analog Signal, DIG = Digital Output, ST = Schmitt Buffer Input,
x = Dont care (TRIS bit does not affect port direction or is overridden for this option).
Unimplemented on 80-pin devices.
Alternate assignments for P1B/P1C and P3B/P3C when ECCPMX Configuration bit is cleared (80-pin and 100-pin
devices only). Default assignments are PORTE<6:3>.
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
RH7
RH6
RH5
RH4
RH3
RH2
RH1
RH0
72
LATH
LATH7
LATH6
LATH5
LATH4
LATH3
LATH2
LATH1
LATH0
71
TRISH
TRISH7
TRISH6
TRISH5
TRISH4
TRISH3
TRISH2
TRISH1
TRISH0
71
DS39762F-page 165
PIC18F97J60 FAMILY
11.10 PORTJ, TRISJ and
LATJ Registers
Note:
EXAMPLE 11-9:
CLRF
PORTJ
CLRF
LATJ
MOVLW
0CFh
MOVWF
TRISJ
INITIALIZING PORTJ
;
;
;
;
;
;
;
;
;
;
;
;
Initialize PORTG by
clearing output
data latches
Alternate method
to clear output
data latches
Value used to
initialize data
direction
Set RJ3:RJ0 as inputs
RJ5:RJ4 as output
RJ7:RJ6 as inputs
DS39762F-page 166
PIC18F97J60 FAMILY
TABLE 11-19: PORTJ FUNCTIONS
Pin Name
RJ0/ALE(1)
RJ1/OE(1)
RJ2/WRL(1)
RJ3/WRH(1)
RJ4/BA0
RJ5/CE
RJ6/LB(1)
RJ7/UB(1)
Function
TRIS
Setting
I/O
I/O
Type
RJ0(1)
DIG
ST
ALE(1)
DIG
RJ1(1)
DIG
ST
OE(1)
DIG
RJ2(1)
DIG
ST
WRL(1)
DIG
External memory bus write low byte control; takes priority over
digital I/O.
RJ3(1)
DIG
ST
WRH(1)
DIG
External memory interface write high byte control output; takes priority
over digital I/O.
RJ4
DIG
ST
BA0(2)
DIG
RJ5
DIG
ST
CE(2)
DIG
RJ6(1)
DIG
ST
LB(1)
DIG
RJ7(1)
DIG
UB(1)
Legend:
Note 1:
2:
Description
ST
DIG
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
RJ7(1)
RJ6(1)
RJ5
RJ4
RJ3(1)
RJ2(1)
RJ1(1)
RJ0(1)
72
LATJ
LATJ7(1)
LATJ6(1)
LATJ5
LATJ4
LATJ3(1)
LATJ2(1)
LATJ1(1)
LATJ0(1)
71
TRISJ
TRISJ7(1) TRISJ6(1)
TRISJ5
TRISJ4
71
RA5
RA4
Name
PORTJ
PORTA
RJPU
RA3
RA2
RA1
RA0
72
DS39762F-page 167
PIC18F97J60 FAMILY
11.11 Parallel Slave Port (PSP)
Note:
FIGURE 11-2:
The PSP can directly interface to an 8-bit microprocessor data bus. The external microprocessor can
read or write the PORTD latch as an 8-bit latch. Setting
bit, PSPMODE, enables port pin, RE0/AD8/RD/P2D, to
be the RD input, RE1/AD9//WR/P2C to be the WR
input and RE2/AD10//CS/P2B to be the CS (Chip
Select) input. For this functionality, the corresponding
data direction bits of the TRISE register (TRISE<2:0>)
must be configured as inputs (set).
A write to the PSP occurs when both the CS and WR
lines are first detected low and ends when either are
detected high. The PSPIF and IBF flag bits are both set
when the write ends.
A read from the PSP occurs when both the CS and RD
lines are first detected low. The data in PORTD is read
out and the OBF bit is set. If the user writes new data
to PORTD to set OBF, the data is immediately read out;
however, the OBF bit is not set.
When either the CS or RD lines is detected high, the
PORTD pins return to the input state and the PSPIF bit
is set. User applications should wait for PSPIF to be set
before servicing the PSP. When this happens, the IBF
and OBF bits can be polled and the appropriate action
taken.
Data Bus
WR LATD
or PORTD
RDx
Pin
CK
Data Latch
Q
RD PORTD
TTL
D
ENEN
TRIS Latch
RD LATD
Read
TTL
RD
Chip Select
TTL
CS
Write
TTL
WR
DS39762F-page 168
PIC18F97J60 FAMILY
REGISTER 11-1:
R-0
R-0
R/W-0
R/W-0
U-0
U-0
U-0
U-0
IBF
OBF
IBOV
PSPMODE
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
bit 4
bit 3-0
Unimplemented: Read as 0
FIGURE 11-3:
Q2
Q3
Q4
Q1
Q2
Q3
Q4
Q1
Q2
Q3
Q4
CS
WR
RD
PORTD<7:0>
IBF
OBF
PSPIF
DS39762F-page 169
PIC18F97J60 FAMILY
FIGURE 11-4:
Q2
Q3
Q4
Q1
Q2
Q3
Q4
Q1
Q2
Q3
Q4
CS
WR
RD
PORTD<7:0>
IBF
OBF
PSPIF
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
RD7
RD6
RD5
RD4
RD3
RD2
RD1
RD0
72
LATD
LATD7
LATD6
LATD5
LATD4
LATD3
LATD2
LATD1
LATD0
72
TRISD
TRISD7
TRISD6
TRISD5
TRISD4
TRISD3
TRISD2
TRISD1
TRISD0
71
PORTE
RE7
RE6
RE5
RE4
RE3
RE2
RE1
RE0
72
LATE
LATE7
LATE6
LATE5
LATE4
LATE3
LATE2
LATE1
LATE0
72
TRISE
TRISE7
TRISE6
TRISE5
TRISE4
TRISE3
TRISE2
TRISE1
TRISE0
71
IBF
OBF
IBOV
PSPMODE
71
TMR0IE
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
69
PSPCON
INTCON
GIE/GIEH PEIE/GIEL
PIR1
PSPIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
71
PIE1
PSPIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
71
IPR1
PSPIP
ADIP
RC1IP
TX1IP
SSP1IP
CCP1IP
TMR2IP
TMR1IP
71
Legend: = unimplemented, read as 0. Shaded cells are not used by the Parallel Slave Port.
DS39762F-page 170
PIC18F97J60 FAMILY
12.0
TIMER0 MODULE
REGISTER 12-1:
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
R/W-1
TMR0ON
T08BIT
T0CS
T0SE
PSA
T0PS2
T0PS1
T0PS0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2-0
DS39762F-page 171
PIC18F97J60 FAMILY
12.1
Timer0 Operation
FIGURE 12-1:
12.2
0
1
1
Programmable
Prescaler
T0CKI pin
T0SE
T0CS
Sync with
Internal
Clocks
(2 TCY Delay)
T0PS<2:0>
PSA
Note:
Set
TMR0IF
on Overflow
TMR0L
Upon Reset, Timer0 is enabled in 8-bit mode with clock input from T0CKI max. prescale.
FIGURE 12-2:
FOSC/4
T0CKI pin
T0SE
T0CS
Programmable
Prescaler
Sync with
Internal
Clocks
TMR0
High Byte
TMR0L
Set
TMR0IF
on Overflow
(2 TCY Delay)
Read TMR0L
T0PS<2:0>
Write TMR0L
PSA
TMR0H
8
8
Internal Data Bus
Note:
Upon Reset, Timer0 is enabled in 8-bit mode with clock input from T0CKI max. prescale.
DS39762F-page 172
PIC18F97J60 FAMILY
12.3
12.3.1
Prescaler
TABLE 12-1:
Name
12.4
Timer0 Interrupt
Bit 6
Bit 5
TMR0L
TMR0H
INTCON
INTCON2
SWITCHING PRESCALER
ASSIGNMENT
RBPU
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
70
70
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
69
TMR0IP
INT3IP
RBIP
69
T0CON
TMR0ON
T08BIT
T0CS
T0SE
PSA
T0PS2
T0PS1
T0PS0
70
TRISA
TRISA5
TRISA4
TRISA3
TRISA2
TRISA1
TRISA0
71
DS39762F-page 173
PIC18F97J60 FAMILY
NOTES:
DS39762F-page 174
PIC18F97J60 FAMILY
13.0
TIMER1 MODULE
REGISTER 13-1:
R/W-0
RD16
T1RUN
R/W-0
T1CKPS1
R/W-0
T1CKPS0
R/W-0
T1OSCEN
R/W-0
R/W-0
R/W-0
T1SYNC
TMR1CS
TMR1ON
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5-4
bit 3
bit 2
bit 1
bit 0
DS39762F-page 175
PIC18F97J60 FAMILY
13.1
Timer1 Operation
FIGURE 13-1:
T1OSO/T13CKI
1
FOSC/4
Internal
Clock
T1OSI
T1OSCEN(1)
Synchronize
Prescaler
1, 2, 4, 8
Detect
0
2
Sleep Input
TMR1CS
Timer1
On/Off
T1CKPS<1:0>
T1SYNC
TMR1ON
Clear TMR1
(ECCPx Special Event Trigger)
Set
TMR1IF
on Overflow
TMR1
High Byte
TMR1L
Note 1: When enable bit, T1OSCEN, is cleared, the inverter and feedback resistor are turned off to eliminate power drain.
FIGURE 13-2:
Timer1 Oscillator
1
T1OSO/T13CKI
1
FOSC/4
Internal
Clock
T1OSI
T1OSCEN(1)
T1CKPS<1:0>
T1SYNC
TMR1ON
Synchronize
Detect
Prescaler
1, 2, 4, 8
0
2
Sleep Input
TMR1CS
Clear TMR1
(ECCPx Special Event Trigger)
Timer1
On/Off
TMR1
High Byte
TMR1L
Set
TMR1IF
on Overflow
Read TMR1L
Write TMR1L
8
TMR1H
8
8
Internal Data Bus
Note 1: When enable bit, T1OSCEN, is cleared, the inverter and feedback resistor are turned off to eliminate power drain.
DS39762F-page 176
PIC18F97J60 FAMILY
13.2
TABLE 13-1:
Oscillator
Type
Freq.
C1
C2
LP
32 kHz
27 pF(1)
27 pF(1)
13.3
FIGURE 13-3:
EXTERNAL
COMPONENTS FOR THE
TIMER1 OSCILLATOR
C1
27 pF
PIC18F97J60
T1OSI
XTAL
32.768 kHz
T1OSO
C2
27 pF
Note:
13.3.1
Timer1 Oscillator
CAPACITOR SELECTION
FOR THE TIMER1
OSCILLATOR(2,3,4)
USING TIMER1 AS A
CLOCK SOURCE
13.3.2
DS39762F-page 177
PIC18F97J60 FAMILY
If a high-speed circuit must be located near the oscillator (such as the ECCP1 pin in Output Compare or PWM
mode, or the primary oscillator using the OSC2 pin), a
grounded guard ring around the oscillator circuit, as
shown in Figure 13-4, may be helpful when used on a
single-sided PCB or in addition to a ground plane.
FIGURE 13-4:
OSCILLATOR CIRCUIT
WITH GROUNDED
GUARD RING
VDD
VSS
OSC1
OSC2
RC0
RC1
RC2
Note: Not drawn to scale.
13.4
Timer1 Interrupt
13.5
DS39762F-page 178
13.6
13.7
Considerations in Asynchronous
Counter Mode
PIC18F97J60 FAMILY
EXAMPLE 13-1:
RTCinit
MOVLW
MOVWF
CLRF
MOVLW
MOVWF
CLRF
CLRF
MOVLW
MOVWF
BSF
RETURN
80h
;
TMR1H
;
TMR1L
b00001111 ;
T1CON
;
secs
;
mins
;
.12
hours
PIE1, TMR1IE ;
RTCisr
BTFSC
BRA
BTFSS
BRA
BSF
BCF
INCF
MOVLW
CPFSGT
RETURN
CLRF
INCF
MOVLW
CPFSGT
RETURN
CLRF
INCF
MOVLW
CPFSGT
RETURN
CLRF
RETURN
TABLE 13-2:
Name
INTCON
;
;
TMR1L,0
;
$-2
;
TMR1L,0
;
$-2
;
;
;
TMR1H, 7
;
PIR1, TMR1IF ;
secs, F
;
.59
;
secs
;
secs
;
mins, F
;
.59
;
mins
;
mins
;
hours, F
;
.23
;
hours
;
hours
;
;
Bit 6
GIE/GIEH PEIE/GIEL
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
TMR0IE
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
69
PIR1
PSPIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
71
PIE1
PSPIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
71
IPR1
PSPIP
ADIP
RC1IP
TX1IP
SSP1IP
CCP1IP
TMR2IP
TMR1IP
71
TMR1L
70
TMR1H
70
T1CON
RD16
T1RUN
TMR1CS
TMR1ON
70
DS39762F-page 179
PIC18F97J60 FAMILY
14.0
TIMER2 MODULE
14.1
Timer2 Operation
REGISTER 14-1:
U-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
T2OUTPS3
T2OUTPS2
T2OUTPS1
T2OUTPS0
TMR2ON
T2CKPS1
T2CKPS0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
Unimplemented: Read as 0
bit 6-3
bit 2
bit 1-0
DS39762F-page 180
x = Bit is unknown
PIC18F97J60 FAMILY
14.2
Timer2 Interrupt
14.3
Timer2 Output
FIGURE 14-1:
T2OUTPS<3:0>
T2CKPS<1:0>
TMR2 Output
(to PWM or MSSPx)
TMR2/PR2
Match
Reset
TMR2
Comparator
Name
PR2
8
TABLE 14-1:
Set TMR2IF
FOSC/4
1:1 to 1:16
Postscaler
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
TMR0IE
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
69
PIR1
PSPIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
71
PIE1
PSPIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
71
IPR1
PSPIP
ADIP
RC1IP
TX1IP
SSP1IP
CCP1IP
TMR2IP
TMR1IP
71
TMR2
T2CON
PR2
Timer2 Register
70
T2CKPS1 T2CKPS0
70
70
Legend: = unimplemented, read as 0. Shaded cells are not used by the Timer2 module.
DS39762F-page 181
PIC18F97J60 FAMILY
NOTES:
DS39762F-page 182
PIC18F97J60 FAMILY
15.0
TIMER3 MODULE
REGISTER 15-1:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
RD16
T3CCP2
T3CKPS1
T3CKPS0
T3CCP1
T3SYNC
TMR3CS
TMR3ON
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6,3
bit 5-4
bit 2
bit 1
bit 0
DS39762F-page 183
PIC18F97J60 FAMILY
15.1
Timer3 Operation
FIGURE 15-1:
As
with
Timer1,
the
RC1/T1OSI
and
RC0/T1OSO/T13CKI pins become inputs when the
Timer1 oscillator is enabled. This means the values of
TRISC<1:0> are ignored and the pins are read as 0.
T1OSO/T13CKI
1
FOSC/4
Internal
Clock
T1OSI
T1OSCEN(1)
Synchronize
Detect
Prescaler
1, 2, 4, 8
0
2
Sleep Input
TMR3CS
Timer3
On/Off
T3CKPS<1:0>
T3SYNC
TMR3ON
Clear TMR3
Set
TMR3IF
on Overflow
TMR3
High Byte
TMR3L
Note 1: When enable bit, T1OSCEN, is cleared, the inverter and feedback resistor are turned off to eliminate power drain.
FIGURE 15-2:
Timer1 Oscillator
1
T1OSO/T13CKI
1
FOSC/4
Internal
Clock
T1OSI
(1)
T1OSCEN
T3CKPS<1:0>
T3SYNC
TMR3ON
Synchronize
Detect
Prescaler
1, 2, 4, 8
0
2
Sleep Input
TMR3CS
Clear TMR3
Timer3
On/Off
Set
TMR3IF
on Overflow
TMR3
High Byte
TMR3L
Read TMR1L
Write TMR1L
8
TMR3H
8
8
Internal Data Bus
Note 1: When enable bit, T1OSCEN, is cleared, the inverter and feedback resistor are turned off to eliminate power drain.
DS39762F-page 184
PIC18F97J60 FAMILY
15.2
15.4
Timer3 Interrupt
15.3
15.5
TABLE 15-1:
Name
INTCON
Bit 6
GIE/GIEH PEIE/GIEL
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
TMR0IE
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
69
PIR2
OSCFIF
CMIF
ETHIF
BCL1IF
TMR3IF
CCP2IF
71
PIE2
OSCFIE
CMIE
ETHIE
BCL1IE
TMR3IE
CCP2IE
71
IPR2
OSCFIP
CMIP
ETHIP
BCL1IP
TMR3IP
CCP2IP
71
TMR3L
70
TMR3H
70
T1CON
RD16
T1RUN
TMR1CS
TMR1ON
70
T3CON
RD16
T3CCP2
T3CKPS1 T3CKPS0
TMR3CS
TMR3ON
71
T3CCP1
T3SYNC
Legend: = unimplemented, read as 0, r = reserved. Shaded cells are not used by the Timer3 module.
DS39762F-page 185
PIC18F97J60 FAMILY
NOTES:
DS39762F-page 186
PIC18F97J60 FAMILY
16.0
TIMER4 MODULE
16.1
Timer4 Operation
REGISTER 16-1:
U-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
T4OUTPS3
T4OUTPS2
T4OUTPS1
T4OUTPS0
TMR4ON
T4CKPS1
T4CKPS0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
Unimplemented: Read as 0
bit 6-3
bit 2
bit 1-0
x = Bit is unknown
DS39762F-page 187
PIC18F97J60 FAMILY
16.2
Timer4 Interrupt
16.3
FIGURE 16-1:
Output of TMR4
T4OUTPS<3:0>
Set TMR4IF
T4CKPS<1:0>
TMR4 Output
(to PWM)
TMR4/PR4
Match
Reset
FOSC/4
1:1 to 1:16
Postscaler
TMR4
PR4
Comparator
TABLE 16-1:
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
TMR0IE
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
69
IPR3
SSP2IP
BCL2IP
RC2IP
TX2IP
TMR4IP
CCP5IP
CCP4IP
CCP3IP
71
PIR3
SSP2IF
BCL2IF
RC2IF
TX2IF
TMR4IF
CCP5IF
CCP4IF
CCP3IF
71
SSP2IE
BCL2IE
RC2IE
TX2IE
TMR4IE
CCP5IE
CCP4IE
CCP3IE
71
PIE3
TMR4
T4CON
PR4
Timer4 Register
72
72
72
Legend: = unimplemented, read as 0. Shaded cells are not used by the Timer4 module.
DS39762F-page 188
PIC18F97J60 FAMILY
17.0
register. For the sake of clarity, all CCPx module operation in the following sections is described with respect
to CCP4, but is equally applicable to CCP5.
CAPTURE/COMPARE/PWM
(CCP) MODULES
REGISTER 17-1:
Capture and Compare operations described in this chapter apply to all standard and Enhanced CCPx modules.
The operations of PWM mode, described in Section 17.4
PWM Mode, apply to CCP4 and CCP5 only.
Note: Throughout this section and Section 18.0
Enhanced Capture/Compare/PWM (ECCP)
Modules, references to register and bit
names that may be associated with a specific
CCP module are referred to generically by the
use of x or y in place of the specific module
number. Thus, CCPxCON might refer to the
control register for ECCP1, ECCP2, ECCP3,
CCP4 or CCP5.
U-0
U-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
DCxB1
DCxB0
CCPxM3
CCPxM2
CCPxM1
CCPxM0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7-6
Unimplemented: Read as 0
bit 5-4
bit 3-0
DS39762F-page 189
PIC18F97J60 FAMILY
17.1
17.1.1
17.1.2
TABLE 17-1:
CCPx/ECCPx Mode
Timer Resource
Capture
Compare
PWM
Timer1 or Timer3
Timer1 or Timer3
Timer2 or Timer4
FIGURE 17-1:
T3CCP<2:1> = 00
T3CCP<2:1> = 01
T3CCP<2:1> = 10
T3CCP<2:1> = 11
TMR1
TMR1
TMR1
TMR1
TMR3
TMR3
ECCP1
ECCP1
TMR3
TMR3
ECCP1
ECCP1
ECCP2
ECCP2
ECCP2
ECCP2
ECCP3
ECCP3
ECCP3
ECCP3
CCP4
CCP4
CCP4
CCP4
CCP5
CCP5
CCP5
CCP5
TMR2
TMR4
DS39762F-page 190
TMR2
TMR4
TMR2
TMR4
TMR2
TMR4
PIC18F97J60 FAMILY
17.2
17.2.3
Capture Mode
17.2.4
17.2.2
If RG4/CCP5/P1D is configured as an
output, a write to the port can cause a
capture condition.
EXAMPLE 17-1:
CLRF
MOVLW
FIGURE 17-2:
CCPx PRESCALER
17.2.1
SOFTWARE INTERRUPT
MOVWF
CHANGING BETWEEN
CAPTURE PRESCALERS
(CCP5 SHOWN)
CCP5CON
; Turn CCP module off
NEW_CAPT_PS ; Load WREG with the
; new prescaler mode
; value and CCP ON
CCP5CON
; Load CCP5CON with
; this value
Set CCP4IF
T3CCP2
CCP4 Pin
Prescaler
1, 4, 16
and
Edge Detect
CCP4CON<3:0>
Q1:Q4
CCP5CON<3:0>
4
4
Set CCP5IF
CCPR4L
TMR1
Enable
TMR1H
TMR1L
TMR3H
TMR3L
4
T3CCP1
T3CCP2
CCP5 Pin
Prescaler
1, 4, 16
TMR3
Enable
CCPR4H
T3CCP2
TMR3L
and
Edge Detect
TMR3
Enable
CCPR5H
CCPR5L
TMR1
Enable
T3CCP2
T3CCP1
TMR1H
TMR1L
DS39762F-page 191
PIC18F97J60 FAMILY
17.3
Compare Mode
Note:
17.3.2
FIGURE 17-3:
17.3.1
17.3.3
Set CCP4IF
CCPR4L
CCP4 Pin
Comparator
Output
Logic
Compare
Match
R
TRIS
Output Enable
4
CCP4CON<3:0>
0
TMR1H
TMR1L
TMR3H
TMR3L
T3CCP1
T3CCP2
Set CCP5IF
Comparator
CCPR5H
CCPR5L
Compare
Match
CCP5 Pin
Output
Logic
4
R
TRIS
Output Enable
CCP5CON<3:0>
DS39762F-page 192
PIC18F97J60 FAMILY
TABLE 17-2:
Name
INTCON
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
69
RCON
IPEN
CM
RI
TO
PD
POR
BOR
70
PIR1
PSPIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
71
PIE1
PSPIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
71
IPR1
PSPIP
ADIP
RC1IP
TX1IP
SSP1IP
CCP1IP
TMR2IP
TMR1IP
71
PIR2
OSCFIF
CMIF
ETHIF
BCL1IF
TMR3IF
CCP2IF
71
PIE2
OSCFIE
CMIE
ETHIE
BCL1IE
TMR3IE
CCP2IE
71
IPR2
OSCFIP
CMIP
ETHIP
BCL1IP
TMR3IP
CCP2IP
71
PIR3
SSP2IF
BCL2IF
RC2IF
TX2IF
TMR4IF
CCP5IF
CCP4IF
CCP3IF
71
PIE3
SSP2IE
BCL2IE
RC2IE
TX2IE
TMR4IE
CCP5IE
CCP4IE
CCP3IE
71
IPR3
SSP2IP
BCL2IP
RC2IP
TX2IP
TMR4IP
CCP5IP
CCP4IP
CCP3IP
71
TRISG4
TRISG3(1)
TRISG2
TRISG1
TRISG0
71
TRISG
TRISG7
TRISG6
TRISG5
TMR1L
70
TMR1H
70
T1CON
RD16
T1RUN
TMR3H
TMR3L
T3CON
RD16
TMR1CS TMR1ON
70
70
70
T3CCP1
T3SYNC
TMR3CS TMR3ON
71
CCPR4L
72
CCPR4H
72
CCPR5L
73
CCPR5H
73
CCP4CON
DC4B1
DC4B0
CCP4M3
CCP4M2
CCP4M1
CCP4M0
73
CCP5CON
DC5B1
DC5B0
CCP5M3
CCP5M2
CCP5M1
CCP5M0
73
Legend: = unimplemented, read as 0, r = reserved. Shaded cells are not used by Capture/Compare, Timer1 or
Timer3.
Note 1: This bit is only available in 80-pin and 100-pin devices; otherwise, it is unimplemented and reads as 0.
DS39762F-page 193
PIC18F97J60 FAMILY
17.4
17.4.1
PWM Mode
Note:
FIGURE 17-4:
EQUATION 17-1:
PWM Period = [(PR2) + 1] 4 TOSC
(TMR2 Prescale Value)
PWM frequency is defined as 1/[PWM period].
When TMR2 (TMR4) is equal to PR2 (PR4), the
following three events occur on the next increment
cycle:
TMR2 (TMR4) is cleared
The CCPx pin is set (exception: if PWM duty
cycle = 0%, the CCPx pin will not be set)
The PWM duty cycle is latched from CCPRxL into
CCPRxH
Note:
0
CCPxCON<5:4>
CCPRxL
Latch
Duty Cycle
(1)
CCPRxH
Comparator
Reset
CCPx
Pin
TMRx
TMRx = PRx
Match
17.4.2
2 LSbs Latched
From Q clocks
Comparator
PRx
TRIS
Output Enable
Note 1: The two LSbs of the Duty Cycle register are held by a
2-bit latch that is part of the modules hardware. It is
physically separate from the CCPRx registers.
FIGURE 17-5:
PWM OUTPUT
PWM PERIOD
EQUATION 17-2:
PWM Duty Cycle = (CCPRXL:CCPXCON<5:4>)
TOSC (TMRx Prescale Value)
CCPRxL and CCPxCON<5:4> can be written to at any
time, but the duty cycle value is not latched into
CCPRxH until after a match between PR2 (PR4) and
TMR2 (TMR4) occurs (i.e., the period is complete). In
PWM mode, CCPRxH is a read-only register.
Period
Duty Cycle
TMR2 (TMR4) = PR2 (PR4)
TMR2 (TMR4) = Duty Cycle
TMR2 (TMR4) = PR2 (TMR4)
DS39762F-page 194
PIC18F97J60 FAMILY
The CCPRxH register and a 2-bit internal latch are
used to double-buffer the PWM duty cycle. This
double-buffering is essential for glitchless PWM
operation.
When the CCPRxH and 2-bit latch match TMR2
(TMR4), concatenated with an internal 2-bit Q clock or
2 bits of the TMR2 (TMR4) prescaler, the CCPx pin is
cleared.
The maximum PWM resolution (bits) for a given PWM
frequency is given by Equation 17-3:
17.4.3
EQUATION 17-3:
FOSC
log FPWM
PWM Resolution (max) =
log(2)
Note:
5.
bits
TABLE 17-3:
PWM Frequency
Timer Prescaler (1, 4, 16)
PR2 Value
Maximum Resolution (bits)
2.44 kHz
9.77 kHz
39.06 kHz
156.25 kHz
312.50 kHz
416.67 kHz
16
FFh
FFh
FFh
3Fh
1Fh
17h
10
10
10
6.58
DS39762F-page 195
PIC18F97J60 FAMILY
TABLE 17-4:
Name
INTCON
Bit 6
GIE/GIEH PEIE/GIEL
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
TMR0IE
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
69
IPEN
CM
RI
TO
PD
POR
BOR
70
PIR1
PSPIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
71
PIE1
PSPIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
71
IPR1
PSPIP
ADIP
RC1IP
TX1IP
SSP1IP
CCP1IP
TMR2IP
TMR1IP
71
RCON
PIR3
SSP2IF
BCL2IF
RC2IF
TX2IF
TMR4IF
CCP5IF
CCP4IF
CCP3IF
71
PIE3
SSP2IE
BCL2IE
RC2IE
TX2IE
TMR4IE
CCP5IE
CCP4IE
CCP3IE
71
IPR3
SSP2IP
BCL2IP
RC2IP
TX2IP
TMR4IP
CCP5IP
CCP4IP
CCP3IP
71
TRISG
TRISG7
TRISG6
TRISG5
TRISG4
TRISG3(1)
TRISG2
TRISG1
TRISG0
71
TMR2
Timer2 Register
70
PR2
70
T2CON
70
TMR4
Timer4 Register
72
PR4
72
T4CON
72
CCPR4L
72
CCPR4H
72
CCPR5L
73
CCPR5H
73
CCP4CON
DC4B1
DC4B0
CCP4M3
73
CCP5CON
DC5B1
DC5B0
CCP5M3
73
Legend: = unimplemented, read as 0. Shaded cells are not used by PWM, Timer2 or Timer4.
Note 1: This bit is only available in 80-pin and 100-pin devices; otherwise, it is unimplemented and reads as 0.
DS39762F-page 196
PIC18F97J60 FAMILY
18.0
ENHANCED
CAPTURE/COMPARE/PWM
(ECCP) MODULES
DS39762F-page 197
PIC18F97J60 FAMILY
REGISTER 18-1:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
PxM1
PxM0
DCxB1
DCxB0
CCPxM3
CCPxM2
CCPxM1
CCPxM0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7-6
bit 5-4
bit 3-0
Note 1:
Implemented only for ECCP1 and ECCP2; same as 1010 for ECCP3.
DS39762F-page 198
PIC18F97J60 FAMILY
18.1
18.1.1
18.1.2
18.1.3
18.1.4
DS39762F-page 199
PIC18F97J60 FAMILY
TABLE 18-1:
ECCP Mode
RC2
RD0 or
RE6(1)
RE5
RG4
RH7(2)
RH6(2)
00xx 11xx
ECCP1
RD0/RE6
RE5
RG4/CCP5
RH7/AN15
RH6/AN14
Dual PWM
10xx 11xx
P1A
P1B
RE5
RG4/CCP5
RH7/AN15
RH6/AN14
Quad PWM
x1xx 11xx
P1A
P1B
P1C
P1D
RH7/AN15
RH6/AN14
00xx 11xx
ECCP1
RD0/RE6
RE5/AD13
RG4/CCP5
RH7/AN15
RH6/AN14
Dual PWM
10xx 11xx
P1A
RD0/RE6
RE5/AD13
RG4/CCP5
P1B
RH6/AN14
Quad PWM(3)
x1xx 11xx
P1A
RD0/RE6
RE5/AD13
P1D
P1B
P1C
100-Pin Devices, ECCPMX = 1, Extended Microcontroller mode with 16-Bit or 20-Bit Address Width:
Compatible CCP
Legend:
Note 1:
2:
3:
00xx 11xx
ECCP1
RD0/RE6
RE5/AD13
RG4/CCP5
RH7/AN15
RH6/AN14
x = Dont care. Shaded cells indicate pin assignments not used by ECCP1 in a given mode.
P1B is multiplexed with RD0 in 64-pin devices, and RE6 on 80-pin and 100-pin devices.
These pin options are not available in 64-pin devices.
With ECCP1 in Quad PWM mode, the CCP5 pins output is overridden by P1D; otherwise, CCP5 is fully
operational.
TABLE 18-2:
ECCP Mode
CCP2CON
Configuration
Compatible CCP
00xx 11xx
RB3/INT3
ECCP2
RE7
RE2
Dual PWM
10xx 11xx
RB3/INT3
P2A
RE7
Quad PWM
x1xx 11xx
RB3/INT3
P2A
RE7
Compatible CCP
00xx 11xx
RB3/INT3
RC1/T1OS1
ECCP2
RE2
Dual PWM
10xx 11xx
RB3/INT3
RC1/T1OS1
P2A
P2B
RE1
RE0
Quad PWM
x1xx 11xx
RB3/INT3
RC1/T1OS1
P2A
P2B
P2C
P2D
RB3
RC1
RE7
RE2
RE1
RE0
RE1
RE0
P2B
RE1
RE0
P2B
P2C
P2D
RE1
RE0
00xx 11xx
ECCP2
RC1/T1OS1
RE7/AD15
RE2/CS
RE1/WR
RE0/RD
Dual PWM
10xx 11xx
P2A
RC1/T1OS1
RE7/AD15
P2B
RE1/WR
RE0/RD
Quad PWM
x1xx 11xx
P2A
RC1/T1OS1
RE7/AD15
P2B
P2C
P2D
Legend: x = Dont care. Shaded cells indicate pin assignments not used by ECCP2 in a given mode.
DS39762F-page 200
PIC18F97J60 FAMILY
TABLE 18-3:
ECCP Mode
RD1 or
RG0(1)
RE4
RE3
RD2 or
RG3(1)
RH5(2)
RH4(2)
00xx 11xx
ECCP3
RE4
RE3
RD2/RG3
RH5/AN13
RH4/AN12
Dual PWM
10xx 11xx
P3A
P3B
RE3
RD2/RG3
RH5/AN13
RH4/AN12
Quad PWM
x1xx 11xx
P3A
P3B
P3C
P3D
RH5/AN13
RH4/AN12
00xx 11xx
ECCP3
RE6/AD14
RE5/AD13
RD2/RG3
RH5/AN13
RH4/AN12
Dual PWM
10xx 11xx
P3A
RE6/AD14
RE5/AD13
RD2/RG3
P3B
RH4/AN12
Quad PWM(3)
x1xx 11xx
P3A
RE6/AD14
RE5/AD13
P3D
P3B
P3C
00xx 11xx
ECCP3
RE4/AD12
RE3/AD11
RD2/RG3
RH5/AN13
RH4/AN12
Dual PWM
10xx 11xx
P3A
P3B
RE3/AD11
RD2/RG3
RH5/AN13
RH4/AN12
100-Pin Devices, ECCPMX = 1, Extended Microcontroller mode with 16-Bit or 20-Bit Address Width:
Compatible CCP
Legend:
Note 1:
2:
3:
00xx 11xx
ECCP3
RE6/AD14
RE5/AD13
RD2/RG3
RH5/AN13
RH4/AN12
x = Dont care. Shaded cells indicate pin assignments not used by ECCP3 in a given mode.
ECCP3/P3A and CCP4/P3D are multiplexed with RD1 and RD2 in 64-pin devices, and RG0 and RG3 in 80-pin
and 100-pin devices.
These pin options are not available in 64-pin devices.
With ECCP3 in Quad PWM mode, the CCP4 pins output is overridden by P3D; otherwise, CCP4 is fully
operational.
DS39762F-page 201
PIC18F97J60 FAMILY
18.2
18.2.1
DS39762F-page 202
18.3
PIC18F97J60 FAMILY
18.4
FIGURE 18-1:
18.4.1
PWM PERIOD
EQUATION 18-1:
PWM Period = [(PR2) + 1] 4 TOSC
(TMR2 Prescale Value)
PWM frequency is defined as 1/[PWM period]. When
TMR2 is equal to PR2, the following three events occur
on the next increment cycle:
TMR2 is cleared
The ECCP1 pin is set (if PWM duty cycle = 0%,
the ECCP1 pin will not be set)
The PWM duty cycle is copied from CCPR1L into
CCPR1H
Note:
CCP1CON<5:4>
CCP1M<3:0>
4
P1M1<1:0>
2
CCPR1L
ECCP1/P1A
ECCP1/P1A
TRISx<x>
CCPR1H (Slave)
P1B
R
Comparator
Output
Controller
P1B
TRISx<x>
P1C
TMR2
(Note 1)
P1D
Comparator
PR2
P1C
TRISx<x>
Clear Timer,
set ECCP1 pin and
latch D.C.
P1D
TRISx<x>
ECCP1DEL
Note: The 8-bit timer TMR2 register is concatenated with the 2-bit internal Q clock, or 2 bits of the prescaler, to create the 10-bit
time base.
DS39762F-page 203
PIC18F97J60 FAMILY
18.4.2
Note:
18.4.3
EQUATION 18-2:
Single Output
Half-Bridge Output
Full-Bridge Output, Forward mode
Full-Bridge Output, Reverse mode
EQUATION 18-3:
log FOSC
FPWM
PWM Resolution (max) =
log(2)
TABLE 18-4:
) bits
PWM Frequency
Timer Prescaler (1, 4, 16)
PR2 Value
Maximum Resolution (bits)
DS39762F-page 204
2.44 kHz
9.77 kHz
39.06 kHz
156.25 kHz
312.50 kHz
416.67 kHz
16
FFh
FFh
FFh
3Fh
1Fh
17h
10
10
10
6.58
PIC18F97J60 FAMILY
FIGURE 18-2:
CCP1CON<7:6>
SIGNAL
PR2 + 1
Duty
Cycle
Period
00 (Single Output)
P1A Modulated
Delay(1)
Delay(1)
P1A Modulated
10
(Half-Bridge)
P1B Modulated
P1A Active
01
(Full-Bridge,
Forward)
P1B Inactive
P1C Inactive
P1D Modulated
P1A Inactive
11
(Full-Bridge,
Reverse)
P1B Modulated
P1C Active
P1D Inactive
Relationships:
Period = 4 * TOSC * (PR2 + 1) * (TMR2 Prescale Value)
Duty Cycle = TOSC * (CCPR1L<7:0>:CCP1CON<5:4>) * (TMR2 Prescale Value)
Delay = 4 * TOSC * (ECCP1DEL<6:0>)
Note 1: Dead-band delay is programmed using the ECCP1DEL register (Section 18.4.6 Programmable
Dead-Band Delay).
DS39762F-page 205
PIC18F97J60 FAMILY
FIGURE 18-3:
CCP1CON<7:6>
SIGNAL
Duty
Cycle
PR2 + 1
Period
00
(Single Output)
P1A Modulated
P1A Modulated
10
(Half-Bridge)
P1B Modulated
Delay(1)
Delay(1)
P1A Active
01
(Full-Bridge,
Forward)
P1B Inactive
P1C Inactive
P1D Modulated
P1A Inactive
11
(Full-Bridge,
Reverse)
P1B Modulated
P1C Active
P1D Inactive
Relationships:
Period = 4 * TOSC * (PR2 + 1) * (TMR2 Prescale Value)
Duty Cycle = TOSC * (CCPR1L<7:0>:CCP1CON<5:4>) * (TMR2 Prescale Value)
Delay = 4 * TOSC * (ECCP1DEL<6:0>)
Note 1: Dead-band delay is programmed using the ECCP1DEL register (Section 18.4.6 Programmable
Dead-Band Delay).
DS39762F-page 206
PIC18F97J60 FAMILY
18.4.4
HALF-BRIDGE MODE
FIGURE 18-4:
HALF-BRIDGE PWM
OUTPUT
Period
Period
Duty Cycle
P1A(2)
td
td
P1B(2)
(1)
(1)
(1)
FIGURE 18-5:
FET
Driver
+
V
-
P1A
Load
FET
Driver
+
V
-
P1B
V-
FET
Driver
FET
Driver
P1A
FET
Driver
Load
FET
Driver
P1B
V-
DS39762F-page 207
PIC18F97J60 FAMILY
18.4.5
FULL-BRIDGE MODE
FIGURE 18-6:
Forward Mode
Period
P1A(2)
Duty Cycle
P1B(2)
P1C(2)
P1D(2)
(1)
(1)
Reverse Mode
Period
Duty Cycle
P1A(2)
P1B(2)
P1C(2)
P1D(2)
(1)
(1)
Note 1: At this time, the TMR2 register is equal to the PR2 register.
Note 2: Output signal is shown as active-high.
DS39762F-page 208
PIC18F97J60 FAMILY
FIGURE 18-7:
PIC18F97J60
FET
Driver
QC
QA
FET
Driver
P1A
Load
P1B
FET
Driver
P1C
FET
Driver
QD
QB
VP1D
18.4.5.1
1.
2.
Figure 18-9 shows an example where the PWM direction changes from forward to reverse at a near 100%
duty cycle. At time, t1, the outputs, P1A and P1D,
become inactive, while output, P1C, becomes active. In
this example, since the turn-off time of the power
devices is longer than the turn-on time, a shoot-through
current may flow through power devices, QC and QD
(see Figure 18-7), for the duration of t. The same
phenomenon will occur to power devices, QA and QB,
for PWM direction change from reverse to forward.
If changing PWM direction at high duty cycle is required
for an application, one of the following requirements
must be met:
1.
2.
DS39762F-page 209
PIC18F97J60 FAMILY
FIGURE 18-8:
SIGNAL
Period
P1A (Active-High)
P1B (Active-High)
DC
P1C (Active-High)
(Note 2)
P1D (Active-High)
DC
Note 1: The direction bit in the ECCP1 Control register (CCP1CON<7>) is written at any time during the PWM cycle.
2: When changing directions, the P1A and P1C signals switch before the end of the current PWM cycle at intervals
of 4 TOSC, 16 TOSC or 64 TOSC, depending on the Timer2 prescaler value. The modulated P1B and P1D signals
are inactive at this time.
FIGURE 18-9:
t1
Reverse Period
P1A(1)
P1B(1)
DC
P1C(1)
P1D(1)
DC
tON(2)
t = tOFF tON(2,3)
DS39762F-page 210
PIC18F97J60 FAMILY
18.4.6
PROGRAMMABLE DEAD-BAND
DELAY
18.4.7
ENHANCED PWM
AUTO-SHUTDOWN
REGISTER 18-2:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
P1RSEN
P1DC6
P1DC5
P1DC4
P1DC3
P1DC2
P1DC1
P1DC0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6-0
DS39762F-page 211
PIC18F97J60 FAMILY
REGISTER 18-3:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
ECCP1ASE
ECCP1AS2
ECCP1AS1
ECCP1AS0
PSS1AC1
PSS1AC0
PSS1BD1
PSS1BD0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6-4
bit 3-2
bit 1-0
DS39762F-page 212
PIC18F97J60 FAMILY
18.4.7.1
18.4.8
FIGURE 18-10:
START-UP CONSIDERATIONS
Shutdown Event
ECCP1ASE bit
PWM Activity
Normal PWM
Start of
PWM Period
FIGURE 18-11:
Shutdown
Shutdown
Event Occurs Event Clears
PWM
Resumes
Shutdown Event
ECCP1ASE bit
PWM Activity
Normal PWM
Start of
PWM Period
ECCP1ASE
Cleared by
Shutdown
Shutdown Firmware PWM
Event Occurs Event Clears
Resumes
DS39762F-page 213
PIC18F97J60 FAMILY
18.4.9
2.
3.
4.
5.
6.
7.
DS39762F-page 214
8.
18.4.10
EFFECTS OF A RESET
PIC18F97J60 FAMILY
TABLE 18-5:
Name
INTCON
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
GIE/GIEH
PEIE/GIEL
TMR0IE
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
69
RCON
IPEN
CM
RI
TO
PD
POR
BOR
70
PIR1
PSPIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
71
PIE1
PSPIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
71
IPR1
PSPIP
ADIP
RC1IP
TX1IP
SSP1IP
CCP1IP
TMR2IP
TMR1IP
71
PIR2
OSCFIF
CMIF
ETHIF
BCL1IF
TMR3IF
CCP2IF
71
PIE2
OSCFIE
CMIE
ETHIE
BCL1IE
TMR3IE
CCP2IE
71
IPR2
OSCFIP
CMIP
ETHIP
BCL1IP
TMR3IP
CCP2IP
71
PIR3
SSP2IF
BCL2IF
RC2IF
TX2IF
TMR4IF
CCP5IF
CCP4IF
CCP3IF
71
PIE3
SSP2IE
BCL2IE
RC2IE
TX2IE
TMR4IE
CCP5IE
CCP4IE
CCP3IE
71
IPR3
SSP2IP
BCL2IP
RC2IP
TX2IP
TMR4IP
CCP5IP
CCP4IP
CCP3IP
71
TRISB
TRISB7
TRISB6
TRISB5
TRISB4
TRISB3
TRISB2
TRISB1
TRISB0
71
TRISC
TRISC7
TRISC6
TRISC5
TRISC4
TRISC3
TRISC2
TRISC1
TRISC0
71
71
(1)
TRISD
TRISD7
TRISD6
TRISD5
TRISD4
TRISD3
TRISD2
TRISD1
TRISD0
TRISE
TRISE7(2)
TRISE6(2)
TRISE5
TRISE4
TRISE3
TRISE2
TRISE1
TRISE0
71
TRISG
TRISG7
TRISG6
TRISG5
TRISG4
TRISG3(2)
TRISG2
TRISG1
TRISG0(2)
71
TRISH(2)
TRISH7
TRISH6
TRISH5
TRISH4
TRISH3
TRISH2
TRISH1
TRISH0
71
TMR1L
TMR1H
T1CON
T1RUN
70
T1OSCEN
T1SYNC
TMR1CS
TMR1ON
70
TMR2ON
T2CKPS1
T2CKPS0
70
RD16
TMR2
70
T1CKPS1
T1CKPS0
Timer2 Register
T2CON
70
PR2
70
TMR3L
70
TMR3H
T3CON
TMR4
T3CCP2
70
T3CKPS1
T3CKPS0
T3CCP1
T3SYNC
TMR3CS
TMR3ON
Timer4 Register
T4CON
71
72
TMR4ON
T4CKPS1
T4CKPS0
72
PR4
72
CCPRxL(3)
70
CCPRxH(3)
70
CCPxCON(3)
ECCPxAS(3)
ECCPxDEL(3)
Legend:
Note 1:
2:
3:
PxM1
PxM0
DCxB1
DCxB0
PxDC6
PxDC5
PxDC4
CCPxM3
CCPxM2
CCPxM1
CCPxM0
70
PSSXAC1
PSSXAC0
PSSXBD1
PSSXBD0
70, 73
PxDC3
PxDC2
PxDC1
PxDC0
73
= unimplemented, read as 0, r = reserved. Shaded cells are not used during ECCPx operation.
Applicable in 64-pin devices only.
Registers and/or specific bits are unimplemented in 64-pin devices.
Generic term for all of the identical registers of this name for all Enhanced CCPx modules, where x identifies the individual
module (ECCP1, ECCP2 or ECCP3). Bit assignments and Reset values for all registers of the same generic name are
identical.
DS39762F-page 215
PIC18F97J60 FAMILY
NOTES:
DS39762F-page 216
PIC18F97J60 FAMILY
19.0
ETHERNET MODULE
2.
3.
4.
5.
FIGURE 19-1:
8-Kbyte
Ethernet RAM
Buffer
PHY
Arbiter
ch0
RXF (Filter)
MII
Interface
ch1
ch0
ch2
TX
TPOUT+
TPOUT-
DMA and
IP Checksum
TPIN+
TX
ch1
RX
TXBM
Ethernet
Buffer
Addresses
Flow Control
Ethernet
Data
MIIM
Interface
TPIN-
RBIAS
Host Interface
Ethernet
Buffer Pointers
EDATA
Ethernet
Control
MIRD/MIWR
MIREGADR
Microcontroller SFRs
LEDA/LEDB Control
DS39762F-page 217
PIC18F97J60 FAMILY
19.1
19.1.1
19.1.2
LED CONFIGURATION
DS39762F-page 218
TABLE 19-1:
Stretch Length
TNSTRCH (normal)
40
TMSTRCH (medium)
70
TLSTRCH (long)
140
19.1.3
OSCILLATOR REQUIREMENTS
19.1.3.1
Start-up Timer
PIC18F97J60 FAMILY
MAGNETICS, TERMINATION AND
OTHER EXTERNAL COMPONENTS
PIC18FXXJ6X
120(1)
C1
OSC1
25 MHz
TPOUTTPIN+
C2
120(1)
56pF(1)
5%
(3)
49.9, 1%
49.9, 1%
1:1 CT
CMC(2)
49.9, 1%
OSC2
49.9, 1%
0.1 F
1:1 CT
TPIN-
LEDA
0.1 F(1)
LEDB RBIAS
2.26 k, 1%
6
7
75(1,4)
56pF(1)
5%
(3)
RJ-45
CMC(2)
75(1, 4)
TPOUT+
3.3V
75(1,4)
FIGURE 19-2:
75(1,4)
19.1.4
1 nF, 2 kV(1)
Note
1:
These components are installed for EMI reduction purposes. See Section 19.1.5 for more information.
2:
Recommended insertion point for Common-Mode Chokes (CMCs) if required for EMI reduction.
3:
See Section 3.3 Crystal Oscillator/Ceramic Resonators (HS Modes) for recommended values.
4:
Power over Ethernet applications require capacitors in series with these resistors.
DS39762F-page 219
PIC18F97J60 FAMILY
19.1.5
DS39762F-page 220
Often, the use of 5-core magnetics, or magnetics involving a center tapped inductor or auto-transformer on the
TX path, is also desirable for EMI emissions reasons.
19.1.6
AUTOMATIC RX POLARITY
DETECTION AND CORRECTION
10Base-T Ethernet signaling is performed on the Ethernet cable as a differentially encoded Manchester data
stream. This signaling is polarized; therefore, it is
required that the RX+ Ethernet signal on the Ethernet
cable reach the TPIN+ pin, and the RX- Ethernet signal
reach the TPIN- pin. Connecting RX+ to TPIN- and RXto TPIN+ (by way of Ethernet isolation transformers)
will cause the PIC18F97J60 family Ethernet module to
successfully link with the remote partner. However, all
receive data will be corrupted by the polarity mismatch
and will be internally discarded by the PHY as if it were
noise on the wire.
Higher speed 100Base-TX and 1000Base-T Ethernet
technologies uses different signaling schemes. They
use Multi-Level Transition 3 (MLT3) and Five-Level
Pulse Amplitude Modulation (PAM5) encoding on the
wire, respectively. These encodings are non-polarized.
Therefore, swapping the differential wires will have no
impact on the Ethernet controller's ability to
communicate with the remote node.
A limited number of modern 3rd party 10/100 and
10/100/1000 rated Ethernet devices (switches, routers
and end devices) connect their TX+ and TX- signals to the
incorrect pins on their RJ-45 Ethernet jack. These devices
are not IEEE Standard 802.3 compliant. However,
because 100Base-TX and 1000Base-T communications
continue to work without correct polarization, some 3rd
party vendors mistakenly release their products to
production without catching these polarization errors.
Due to these circumstances, current revisions of the
Ethernet controller in the PIC18F97J60 family of
devices are not compatible with a limited number of 3rd
party Ethernet devices. The PIC18FXXJXX devices will
link up with the partner and the PHY RX activity LED (if
enabled) will blink whenever a packet is transmitted to
the PIC18FXXJXX device. However, no packets will be
successfully received and written in the Ethernet
SRAM buffer when the polarity is incorrect. To eliminate
this problem, and obtain maximum interoperability with
3rd party devices, it is possible to externally add an RX
polarity swapping circuit to PIC18F97J60 family
applications. Figure 19-3 demonstrates the use of bus
switches to facilitate the swapping of the RX signals.
In Figure 19-3, a general purpose output pin is used to
select the polarity of the RX signals. When the select line
is held low, the A ports of the switches will connect with
the B0 ports, leaving the B1 ports disconnected. This will
allow the TPIN+ pin to be connected to Pin 3 of the
RJ-45 jack while TPIN- is connected to Pin 6. These
connections accommodate the IEEE Standard 802.3
specified polarity.
PIC18F97J60 FAMILY
When the select line is raised high, the A ports of the
switches will connect with the B1 ports, leaving the B0
ports disconnected. This will swap the RX polarity and
route the TPIN+ pin to the signal on RJ-45 Jack Pin 6.
TPIN- will connect to RJ-45 Pin 3. This swapped polarity can correct an incorrectly wired signal generated at
the remote link partner or in the intermediate cabling.
FIGURE 19-3:
PIC18FXXJ6X
GPIO
TPIN+
TX
RX
0.1 F
4x
75 ohm
1
2
3
6
5
4
NC7SB3157
+3.3V
NC7SB3157
49.9
49.9
TPIN-
6
5
4
+3.3V
1000 pF 2kV
100K
DS39762F-page 221
PIC18F97J60 FAMILY
19.2
FIGURE 19-4:
Microcontroller SFRs
Ethernet Module
Ethernet Buffer
EDATA
ERDPT(H:L)
EWRPT(H:L)
ETXST(H:L)
ETXND(H:L)
ERXST(H:L)
ERXND(H:L)
ERXRDPT(H:L)
ERXWRPT(H:L)
1FFFh
Buffer Address
PHY Registers
PHY Register Data (In/Out)
MIRD(H:L)
MIWR(H:L)
MIREGADR
Note:
0000h
Ethernet Data
00h
1Fh
Microcontroller SFRs are not shown in the order of their placement in the data memory space. Memory areas are
not shown to scale.
DS39762F-page 222
PIC18F97J60 FAMILY
19.2.1
19.2.1.1
EDATA,
EDATA,
EDATA,
INDF0,
F
F
EDATA
EDATA; (FSR0 = F61h)
EDATA, W
EDATA, W
INDF0, EDATA; (FSR0 != F61h)
EDATA
EDATA
EDATA
DS39762F-page 223
PIC18F97J60 FAMILY
FIGURE 19-5:
0000h
AAh
Transmit
Buffer
Receive
Buffer
(Circular FIFO)
DS39762F-page 224
55h
1FFFh
PIC18F97J60 FAMILY
19.2.1.2
Receive Buffer
FIGURE 19-6:
ERXRDPT:
Sets boundary that Internal
Write Pointer cannot advance
beyond. Prevents Internal
Write Pointer from moving
into Packet 1s data space.
ERDPT:
Data being read
out to application.
ERXND
PB
Unused Buffer
(may contain old data)
Packet 1
(being processed
by application)
PB
Packet 4
(currently being
received)
Packet 2
ERXWRPT:
Shows the end of
the last complete
received packet.
Packet 3
PB
PB
Direction of reading and writing data
(lower to higher buffer addresses).
DS39762F-page 225
PIC18F97J60 FAMILY
19.2.1.3
Transmit Buffer
19.2.1.4
The Ethernet buffer is clocked at one-half of the microcontroller clock rate. Varying amounts of memory
access bandwidth are available depending on the clock
speed. The total bandwidth available, in bytes per second, is equal to twice the instruction rate (2 * FCY or
FOSC/2). For example, at a system clock speed of
41.667 MHz, the total available memory bandwidth that
is available is 20.834 Mbyte/s. At an Ethernet signaling
rate of 10 Mbit/s, the Ethernet RX engine requires
1.25 Mbyte/s of buffer memory bandwidth to operate
without causing an overrun. If Full-Duplex mode is
used, an additional 1.25 Mbyte/s is required to allow for
simultaneous RX and TX activity.
Because of the finite available memory bandwidth, a
three-channel arbiter is used to allocate bandwidth
between the RX engine, the TX and DMA engines, and
the microcontrollers CPU (i.e., the application access-
TABLE 19-2:
19.2.1.5
FOSC
(MHz)
FCY
(MHz)
41.667
Application Restrictions
to Prevent Underrun/Overrun
Total
After RX
After TX
10.42
20.83
19.58
18.33
31.250
7.81
15.63
14.38
13.13
25.000
6.25
12.50
11.25
10.00
20.833
5.21
10.42
9.17
7.92
13.889
3.47
6.94
5.69
4.44
12.500
3.13
6.25
5.00
3.75
8.333
2.08
4.17
2.92
1.67
6.250
1.56
3.13
1.88
0.63
4.167
1.04
2.08
0.83
<0
2.778
0.69
1.39
0.14
<0
DS39762F-page 226
PIC18F97J60 FAMILY
19.2.2
ECON1
EDATA
EIR
The Ethernet Buffer Read Pointer Pair (ERDPTH
and ERDPTL)
REGISTER 19-1:
19.2.3
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
U-0
U-0
TXRST
RXRST
DMAST
CSUMEN
TXRTS
RXEN
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1-0
Unimplemented: Read as 0
DS39762F-page 227
PIC18F97J60 FAMILY
REGISTER 19-2:
R/W-1
R/W-0(1)
R/W-0
U-0
U-0
U-0
U-0
U-0
AUTOINC
PKTDEC
ETHEN
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
bit 4-0
Unimplemented: Read as 0
Note 1:
REGISTER 19-3:
U-0
R/C-0
U-0
R/C-0
U-0
R-0
R/C-0
R-0
BUFER
RXBUSY
TXABRT
PHYRDY
bit 7
bit 0
Legend:
r = Reserved bit
R = Readable bit
C = Clearable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
Unimplemented: Read as 0
bit 6
bit 5
Unimplemented: Read as 0
bit 4
Reserved: Write as 0
bit 3
Unimplemented: Read as 0
bit 2
bit 1
bit 0
DS39762F-page 228
PIC18F97J60 FAMILY
19.2.4
REGISTER 19-4:
U-0
U-0
U-0
R-0
R/W-0
R/W-0
R/W-0
R/W-0
TXPAUS
RXPAUS
PASSALL
MARXEN
bit 7
bit 0
Legend:
r = Reserved bit
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7-5
Unimplemented: Read as 0
bit 4
bit 3
bit 2
bit 1
bit 0
DS39762F-page 229
PIC18F97J60 FAMILY
REGISTER 19-5:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
PADCFG2
PADCFG1
PADCFG0
TXCRCEN
PHDREN
HFRMEN
FRMLNEN
FULDPX
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7-5
bit 4
bit 3
bit 2
bit 1
bit 0
DS39762F-page 230
PIC18F97J60 FAMILY
REGISTER 19-6:
U-0
R/W-0
R/W-0
R/W-0
U-0
U-0
R-0
R-0
DEFER
bit 7
bit 0
Legend:
r = Reserved bit
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
Unimplemented: Read as 0
bit 6
bit 5-4
Reserved: Maintain as 0
bit 3-2
Unimplemented: Read as 0
bit 1-0
Reserved: Maintain as 0
REGISTER 19-7:
U-0
U-0
U-0
U-0
U-0
U-0
R/W-0
R/W-0
MIISCAN
MIIRD
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7-2
Unimplemented: Read as 0
bit 1
bit 0
DS39762F-page 231
PIC18F97J60 FAMILY
REGISTER 19-8:
U-0
U-0
U-0
U-0
R-0
R-0
R-0
R-0
NVALID
SCAN
BUSY
bit 7
bit 0
Legend:
r = Reserved bit
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7-4
Unimplemented: Read as 0
bit 3
bit 2
bit 1
bit 0
19.2.5
PHY REGISTERS
19.2.5.1
19.2.5.2
PHSTAT Registers
DS39762F-page 232
PIC18F97J60 FAMILY
To read from a PHY register:
1.
2.
3.
4.
5.
DS39762F-page 233
Addr
Name
Bit 15
Bit 14
Bit 13
Bit 12
Bit 11
Bit 10
Bit 9
Bit 8
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset Values
00h
PHCON1
PDPXMD
01h
PHSTAT1
LLSTAT
10h
PHCON2
FRCLNK
HDLDIS
RXAPDIS
11h
PHSTAT2
LSTAT
12h
PHIE
PLNKIE
PGEIE
13h
PHIR
PLNKIF
PGIF
14h
PHLCON
LFRQ1
LFRQ0
STRCH
Legend: x = unknown, u = unchanged, - = unimplemented, read as 0, r = reserved, do not modify. Shaded cells are unimplemented, read as 0.
PIC18F97J60 FAMILY
DS39762F-page 234
TABLE 19-3:
PIC18F97J60 FAMILY
REGISTER 19-9:
R/W-0
R/W-0
U-0
U-0
R/W-0
R/W-0
U-0
R/W-0
PDPXMD
bit 15
bit 8
R/W-0
U-0
U-0
U-0
U-0
U-0
U-0
U-0
bit 7
bit 0
Legend:
r = Reserved bit
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 15-14
Reserved: Write as 0
bit 13-12
Unimplemented: Read as 0
bit 11-10
Reserved: Write as 0
bit 9
Unimplemented: Read as 0
bit 8
bit 7
Reserved: Maintain as 0
bit 6-0
Unimplemented: Read as 0
U-0
U-0
R-1
R-1
U-0
U-0
U-0
bit 15
bit 8
U-0
U-0
U-0
U-0
U-0
R/LL-0
R/LH-0
U-0
LLSTAT
bit 7
bit 0
Legend:
1 = Bit is set
r = Reserved bit
R = Read-only bit
0 = Bit is cleared
-n = Value at POR
bit 15-13
Unimplemented: Read as 0
bit 12-11
Reserved: Read as 1
bit 10-3
Unimplemented: Read as 0
bit 2
bit 1
bit 0
Unimplemented: Read as 0
DS39762F-page 235
PIC18F97J60 FAMILY
REGISTER 19-11: PHCON2: PHY CONTROL REGISTER 2
U-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
FRCLNK
HDLDIS
bit 15
bit 8
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
RXAPDIS
bit 7
bit 0
Legend:
r = Reserved bit
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 15
Unimplemented: Read as 0
bit 14
bit 13-9
Reserved: Write as 0
bit 8
bit 7-5
Reserved: Write as 0
bit 4
bit 3-0
Reserved: Write as 0
Note:
Improper Ethernet operation may result if HDLDIS or RXAPDIS is cleared, which is the Reset default.
Always initialize these bits set before using the Ethernet module.
DS39762F-page 236
PIC18F97J60 FAMILY
REGISTER 19-12: PHSTAT2: PHYSICAL LAYER STATUS REGISTER 2
U-0
U-0
R-0
R-0
R-0
R-0
R-x
U-0
TXSTAT
RXSTAT
COLSTAT
LSTAT
bit 15
bit 8
U-0
U-0
R-0
U-0
U-0
U-0
U-0
U-0
bit 7
bit 0
Legend:
r = Reserved bit
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 15-14
Unimplemented: Read as 0
bit 13
bit 12
bit 11
bit 10
bit 9
bit 8-6
Unimplemented: Read as 0
bit 5
bit 4-0
Unimplemented: Read as 0
DS39762F-page 237
PIC18F97J60 FAMILY
REGISTER 19-13: PHLCON: PHY MODULE LED CONTROL REGISTER
R/W-0
R/W-0
R/W-1
R/W-1
R/W-0
R/W-1
R/W-0
R/W-0
LACFG3
LACFG2
LACFG1
LACFG0
bit 15
bit 8
R/W-0
R/W-0
R/W-1
R/W-0
R/W-0
R/W-0
R/W-1
R/W-x
LBCFG3
LBCFG2
LBCFG1
LBCFG0
LFRQ1
LFRQ0
STRCH
bit 7
bit 0
Legend:
r = Reserved bit
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 15-14
x = Bit is unknown
Reserved: Write as 0
bit 13-12
Reserved: Write as 1
bit 11-8
bit 7-4
bit 3-2
LFRQ<1:0>: LED Pulse Stretch Time Configuration bits (see Table 19-1)
11 = Reserved
10 = Stretch LED events by TLSTRCH
01 = Stretch LED events by TMSTRCH
00 = Stretch LED events by TNSTRCH
bit 1
bit 0
Reserved: Write as 0
DS39762F-page 238
PIC18F97J60 FAMILY
19.3
Ethernet Interrupts
Note:
FIGURE 19-7:
19.3.1
PLNKIF
PLNKIE
PGIF
PGEIE
DMAIE
LINKIF
LINKIE
Set ETHIF
TXIF
TXIE
TXERIF
ETHIE
TXERIE
RXERIF
RXERIE
DS39762F-page 239
PIC18F97J60 FAMILY
REGISTER 19-14: EIE: ETHERNET INTERRUPT ENABLE REGISTER
U-0
R/W-0
R/W-0
R/W-0
R/W-0
U-0
R/W-0
R/W-0
PKTIE
DMAIE
LINKIE
TXIE
TXERIE
RXERIE
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
Unimplemented: Read as 0
bit 6
bit 5
bit 4
bit 3
bit 2
Unimplemented: Read as 0
bit 1
bit 0
DS39762F-page 240
x = Bit is unknown
PIC18F97J60 FAMILY
REGISTER 19-15: EIR: ETHERNET INTERRUPT REQUEST (FLAG) REGISTER
U-0
R-0
R/C-0
R-0
R/C-0
U-0
R/C-0
R/C-0
PKTIF
DMAIF
LINKIF
TXIF
TXERIF
RXERIF
bit 7
bit 0
Legend:
R = Readable bit
C = Clearable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
Unimplemented: Read as 0
bit 6
bit 5
bit 4
bit 3
bit 2
Unimplemented: Read as 0
bit 1
bit 0
DS39762F-page 241
PIC18F97J60 FAMILY
REGISTER 19-16: PHIE: PHY INTERRUPT ENABLE REGISTER
R-0
R-0
R-0
R-0
R-0
R-0
R-0
R-0
bit 15
bit 8
R-0
R-0
R/W-0
R/W-0
R-0
R-0
R/W-0
R/W-0
PLNKIE
PGEIE
bit 7
bit 0
Legend:
r = Reserved bit
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 15-6
bit 5
Reserved: Maintain as 0
bit 4
bit 3-2
bit 1
bit 0
Reserved: Maintain as 0
x = Bit is unknown
R-x
R-x
R-x
R-x
R-x
R-x
R-x
bit 15
bit 8
R-x
R-x
R-0
R/SC-0
R-0
R/SC-0
R-x
R-0
PLNKIF
PGIF
bit 7
bit 0
Legend:
r = Reserved bit
R = Readable bit
SC = Self-Clearable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 15-6
bit 5
Reserved: Read as 0
bit 4
bit 3
Reserved: Read as 0
bit 2
bit 1
bit 0
Reserved: Read as 0
DS39762F-page 242
PIC18F97J60 FAMILY
19.3.1.1
4.
3.
19.3.1.2
5.
19.3.1.3
DS39762F-page 243
PIC18F97J60 FAMILY
19.3.1.4
19.3.1.5
19.3.2
DS39762F-page 244
19.3.1.6
2.
3.
4.
PIC18F97J60 FAMILY
19.4
Module Initialization
19.4.1
RECEIVE BUFFER
19.4.4
If the initialization procedure is being executed immediately after enabling the module (setting the ETHEN bit
to 1), the PHYRDY bit should be polled to make
certain that enough time (1 ms) has elapsed before
proceeding to modify the PHY registers. For more
information on the PHY start-up timer, see
Section 19.1.3.1 Start-up Timer.
19.4.5
19.4.2
1.
2.
19.4.3
3.
4.
5.
TRANSMISSION BUFFER
RECEIVE FILTERS
6.
7.
8.
DS39762F-page 245
PIC18F97J60 FAMILY
REGISTER 19-18: MABBIPG: MAC BACK-TO-BACK INTER-PACKET GAP REGISTER
U-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
BBIPG6
BBIPG5
BBIPG4
BBIPG3
BBIPG2
BBIPG1
BBIPG0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
Unimplemented: Read as 0
bit 6-0
19.4.6
19.4.7
3.
4.
DS39762F-page 246
PIC18F97J60 FAMILY
19.5
19.5.1
PACKET FORMAT
FIGURE 19-8:
19.5.1.1
Preamble/Start-of-Frame Delimiter
Field
Comments
Preamble
SFD
Start-of-Frame Delimiter
(filtered out by the module)
DA
Destination Address,
such as Multicast, Broadcast or Unicast
SA
Source Address
Type/Length
Used in the
Calculation
of the FCS
Data
Packet Payload
(with optional padding)
46-1500
Padding
4
Note 1:
FCS(1)
The FCS is transmitted starting with bit 31 and ending with bit 0.
DS39762F-page 247
PIC18F97J60 FAMILY
19.5.1.2
Destination Address
19.5.1.3
Source Address
19.5.1.4
Type/Length
DS39762F-page 248
19.5.1.5
Data
19.5.1.6
Padding
19.5.1.7
CRC
PIC18F97J60 FAMILY
19.5.2
TRANSMITTING PACKETS
FIGURE 19-9:
PHUGEEN
PPADN
bit 7
PCRCEN
POVERRIDE
bit 0
bit 7-4
Unimplemented: Read as 0
bit 3
bit 2
bit 1
bit 0
DS39762F-page 249
PIC18F97J60 FAMILY
An example of how the entire assembled transmit
packet looks in memory is shown in Figure 19-10. To
construct and transmit a packet in this fashion:
1.
2.
3.
4.
5.
FIGURE 19-10:
Buffer Pointers
Address
Memory
ETXST = 0120h
0120h
0Eh
0121h
data[1]
data[2]
0122h
ETXND = 0156h
0156h
0157h
0158h
0159h
015Ah
015Bh
015Ch
015Dh
015Eh
DS39762F-page 250
Description
Control
Data Packet
Destination Address,
Source Address,
Type/Length and Data
Status Vector
Status Vector
Written by the Hardware
data[m]
tsv[7:0]
tsv[15:8]
tsv[23:16]
tsv[31:24]
tsv[39:32]
tsv[47:40]
tsv[55:48]
PHUGEEN, PPADN,
PCRCEN and POVERRIDE
PIC18F97J60 FAMILY
TABLE 19-4:
Bit
55-52
Description
Zero
51
50
Backpressure Applied
49
The frame transmitted was a control frame with a valid pause opcode.
48
Total bytes transmitted on the wire for the current packet, including all
bytes from collided attempts.
31
Transmit Underrun
30
Transmit Giant
Byte count for frame was greater than the MAMXFL registers.
29
28
Packet was aborted after the number of collisions exceeded 15, the
retransmission maximum.
27
Packet was deferred in excess of 24,287 bit times (2.4287 ms), due to a
continuously occupied medium.
26
Packet was deferred for at least one attempt, but less than an
excessive defer.
25
Transmit Broadcast
24
Transmit Multicast
23
Transmit Done
22
Indicates that frame type/length field was larger than 1500 bytes
(type field).
21
Indicates that the frame length field value in the packet does not match
the actual data byte length and is not a type field. The FRMLNEN bit
(MACON3<1>) must be set to get this error.
20
The attached CRC in the packet did not match the internally generated
CRC.
19-16
15-0
47-32
DS39762F-page 251
PIC18F97J60 FAMILY
19.5.3
RECEIVING PACKETS
2.
3.
FIGURE 19-11:
19.5.3.1
Memory
Description
Packet N 1
5Eh
10h
rsv[7:0]
rsv[15:8]
rsv[23:16]
rsv[30:24]
data[1]
data[2]
Low Byte
High Byte
status[7:0]
status[15:8]
status[23:16]
status[31:24]
Packet N
1059h
105Ah
105Bh
105Ch
105Dh
105Eh
Packet N + 1
DS39762F-page 252
data[m-3]
data[m-2]
data[m-1]
data[m]
crc[31:24]
crc[23:16]
crc[15:8]
crc[7:0]
PIC18F97J60 FAMILY
TABLE 19-5:
Bit
Field
Description
31
Zero
30
29
28
27
26
Dribble Nibble
Indicates that after the end of this packet, an additional 1 to 7 bits were
received. The extra bits were thrown away.
25
24
23
Received OK
Indicates that the packet had a valid CRC and no symbol errors.
22
Indicates that frame type/length field was larger than 1500 bytes
(type field).
21
Indicates that frame length field value in the packet does not match the
actual data byte length.
20
CRC Error
Indicates that the frame CRC field value does not match the CRC
calculated by the MAC.
19
Reserved
18
17
Reserved
16
Indicates a packet over 50,000 bit times occurred or that a packet was
dropped since the last receive.
15-0
19.5.3.2
Indicates that at some time since the last receive, a carrier event was
detected. The carrier event is not associated with this packet. A carrier
event is activity on the receive channel that does not result in a packet
receive attempt being made.
EQUATION 19-1:
DS39762F-page 253
PIC18F97J60 FAMILY
19.5.3.3
19.5.3.4
EQUATION 19-2:
Note:
DS39762F-page 254
PIC18F97J60 FAMILY
TABLE 19-6:
Register
Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
EIE
PKTIE
DMAIE
LINKIE
TXIE
TXERIE
RXERIE
73
EIR
PKTIF
DMAIF
LINKIF
TXIF
TXERIF
RXERIF
73
ESTAT
BUFER
RXBUSY
TXABRT
PHYRDY
73
TXRST
RXRST
DMAST
CSUMEN
TXRTS
RXEN
70
ECON1
ETXSTL
ETXSTH
ETXNDL
74
74
ETXNDH
MACON1
MACON3
MACON4
74
74
TXPAUS
RXPAUS
PASSALL
MARXEN
75
PHDREN
HFRMEN
FRMLNEN
FULDPX
75
DEFER
75
BBIPG6
BBIPG5
BBIPG4
BBIPG3
BBIPG2
BBIPG1
BBIPG0
75
MABBIPG
MAIPGL
75
MAIPGH
75
MAMXFLL
74
MAMXFLH
74
Legend:
TABLE 19-7:
Register
Name
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values on
Page:
EIE
PKTIE
DMAIE
LINKIE
TXIE
TXERIE
RXERIE
73
EIR
PKTIF
DMAIF
LINKIF
TXIF
TXERIF
RXERIF
73
ESTAT
BUFER
RXBUSY
TXABRT
PHYRDY
73
ECON2
AUTOINC
PKTDEC
ETHEN
73
ECON1
TXRST
RXRST
DMAST
CSUMEN
TXRTS
RXEN
70
ERXSTL
ERXSTH
ERXNDL
74
74
ERXNDH
74
74
UCEN
ANDOR
CRCEN
73
MPEN
HTEN
MCEN
BCEN
TXPAUS
RXPAUS
PASSALL
MARXEN
75
PHDREN
HFRMEN FRMLNEN
FULDPX
75
73
74
74
MACON3
MAMXFLL
74
74
MAMXFLH
Legend:
DS39762F-page 255
PIC18F97J60 FAMILY
19.6
19.6.1
HALF-DUPLEX OPERATION
19.6.2
FULL-DUPLEX OPERATION
DS39762F-page 256
PIC18F97J60 FAMILY
19.7
Flow Control
The Ethernet module implements hardware flow control for both Full and Half-Duplex modes. The operation
of this feature differs depending on which mode is
being used.
19.7.1
HALF-DUPLEX MODE
used to initialize an internal timer. The timer will automatically decrement every 512 bit times, or 51.2 s.
While the timer is counting down, reception of packets
is still enabled. If new pause frames arrive, the timer will
be re-initialized with the new pause timer value. When
the timer reaches zero, or was sent a frame with a zero
pause timer value, the MAC that received the pause
frame will resume transmitting any pending packets. To
prevent a pause frame from stopping all traffic on the
entire network, Ethernet switches and routers do not
propagate pause control frames in Full-Duplex mode.
The pause operation only applies to the direct recipient.
A sample network is shown in Figure 19-12. If
Computer A were to be transmitting too much data to
the microcontroller-based application in Full-Duplex
mode, the Ethernet module could transmit a pause
control frame to stop the data which is being sent to it.
The Ethernet switch would take the pause frame and
stop sending data to the application. If Computer A
continues to send data, the Ethernet switch will buffer
the data so it can be transmitted later when its pause
timer expires. If the Ethernet switch begins to run out of
buffer space, it will likely transmit a pause control frame
of its own to Computer A.
If, for some reason the Ethernet switch does not generate a pause control frame of its own, or one of the
nodes does not properly handle the pause frame it
receives, then packets will inevitably be dropped. In
any event, any communication between Computer A
and Computer B will always be completely unaffected.
FIGURE 19-12:
SAMPLE FULL-DUPLEX
NETWORK
19.7.2
FULL-DUPLEX MODE
DS39762F-page 257
PIC18F97J60 FAMILY
To enable flow control in Full-Duplex mode, set the
TXPAUS and RXPAUS bits in the MACON1 register.
Then, at any time that the receiver buffer is running out
of space, set the Flow Control Enable bits, FCEN<1:0>
(EFLOCON<1:0>). The module will automatically finish
transmitting anything that was in progress and then
send a valid pause frame, loaded with the selected
pause timer value. Depending on the mode selected,
the application may need to eventually clear Flow
Control mode by again writing to the FCEN bits.
U-0
U-0
U-0
U-0
R-0
R/W-0
R/W-0
FCEN1
FCEN0
bit 7
bit 0
Legend:
r = Reserved bit
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7-3
Unimplemented: Read as 0
bit 2
bit 1-0
TABLE 19-8:
Register
Name
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values on
Page:
70
TXRST
RXRST
DMAST
CSUMEN
TXRTS
RXEN
MACON1
TXPAUS
RXPAUS
MABBIPG
BBIPG6
BBIPG5
BBIPG4
BBIPG3
BBIPG2
BBIPG1
BBIPG0
75
EFLOCON
FCEN1
FCEN0
75
ECON1
PASSALL MARXEN
75
EPAUSL
75
EPAUSH
75
DS39762F-page 258
PIC18F97J60 FAMILY
19.8
Receive Filters
19.8.4
Unicast
Multicast
Broadcast
Pattern Match
Magic Packet
Hash Table
19.8.1
UNICAST FILTER
19.8.2
MULTICAST FILTER
19.8.3
BROADCAST FILTER
TABLE 19-9:
Register
EHT0
EHT1
EHT2
EHT3
EHT4
EHT5
EHT6
EHT7
07
0F
17
1F
27
2F
37
3F
06
0E
16
1E
26
2E
36
3E
05
0D
15
1D
25
2D
35
3D
04
0C
14
1C
24
2C
34
3C
03
0B
13
1B
23
2B
33
3B
02
0A
12
1A
22
2A
32
3A
01
09
11
19
21
29
31
39
00
08
10
18
20
28
30
38
EXAMPLE 19-1:
DS39762F-page 259
PIC18F97J60 FAMILY
REGISTER 19-20: ERXFCON: ETHERNET RECEIVE FILTER CONTROL REGISTER
R/W-1
R/W-0
R/W-1
R/W-0
R/W-0
R/W-0
R/W-0
R/W-1
UCEN
ANDOR
CRCEN
PMEN
MPEN
HTEN
MCEN
BCEN
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
DS39762F-page 260
PIC18F97J60 FAMILY
FIGURE 19-13:
UCEN, PMEN,
MPEN, HTEN,
MCEN and BCEN
all clear?
Yes
No
UCEN set?
Yes
No
PMEN set?
Unicast
packet?
Yes
No
Pattern
matches?
No
Yes
No
Yes
CRCEN set?
Yes
CRCEN valid?
Yes
Accept Packet
No
No
Reject Packet
MPEN set?
Yes
No
HTEN set?
Yes
Hash table
bit set?
Yes
No
Yes
No
BCEN set?
Yes
No
No
MCEN set?
Magic Packet
for us?
Multicast
destination?
Yes
No
Yes
No
Broadcast
destination?
Yes
No
DS39762F-page 261
PIC18F97J60 FAMILY
FIGURE 19-14:
UCEN set?
Yes
No
Unicast
packet?
No
Yes
PMEN set?
Yes
No
Pattern
Matches?
No
Yes
MPEN set?
Yes
Magic Packet
for us?
No
No
Yes
HTEN set?
Yes
No
Hash Table
bit set?
No
Yes
MCEN set?
Yes
Multicast
destination?
No
No
Yes
BCEN set?
Yes
Broadcast
destination?
No
No
Yes
No
CRCEN set?
Yes
CRC valid?
No
Yes
Accept Packet
DS39762F-page 262
Reject Packet
PIC18F97J60 FAMILY
19.8.5
FIGURE 19-15:
Input Configuration:
EMPOH:EPMOL = 0006h
EPMM7:EPMM0 = 0000000000001F0Ah
EPMCSH:EPMCSL = 563Fh
Field
DA
SA
Type/Length
Data
FCS
Received
Data
11 22 33 44 55 66 77 88 99 AA BB CC 00 5A
09 0A 0B 0C 0D . . . 40 . . . FE 45 23 01
Byte #
0 1 2 3 4 5
14 15 16 17 18 . . . 70 . . .
6 7 8 9 10 11
12 13
Values Used for Checksum Computation = {88h, AAh, 09h, 0Ah, 0Bh, 0Ch, 0Dh, 00h}
(00h padding byte added by hardware)
Note:
Received data is shown in hexadecimal. Byte numbers are shown in decimal format.
DS39762F-page 263
PIC18F97J60 FAMILY
19.8.6
FIGURE 19-16:
Received
Data
00 11 22 33 44 55
77 88 99 AA BB CC
00 FE
09 0A 0B 0C 0D 0E
FF FF FF FF FF 00
Field
Comments
DA
SA
Type/Length
Header
FF FF FF FF FF FF
00 11 22 33 44 55
00 11 22 33 44 55
00 11 22 33 44 55
00 11 22 33 44 55
00 11 22 33 44 55
00 11 22 33 44 55
00 11 22 33 44 55
00 11 22 33 44 55
00 11 22 33 44 55
Magic
Packet
Pattern
16 Repeats of the
Destination MAC Address
Footer
00 11 22 33 44 55
00 11 22 33 44 55
00 11 22 33 44 55
00 11 22 33 44 55
00 11 22 33 44 55
00 11 22 33 44 55
00 11 22 33 44 55
19 1A 1B 1C 1D 1E
EF 54 32 10
DS39762F-page 264
FCS
PIC18F97J60 FAMILY
19.9
19.9.1
COPYING MEMORY
DS39762F-page 265
PIC18F97J60 FAMILY
19.9.2
CHECKSUM CALCULATIONS
To calculate a checksum:
1.
2.
3.
Reset
Values on
Page
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
EIE
PKTIE
DMAIE
LINKIE
TXIE
TXERIE
RXERIE
73
EIR
PKTIF
DMAIF
LINKIF
TXIF
TXERIF
RXERIF
73
TXRST
RXRST
DMAST
CSUMEN
TXRTS
RXEN
70
ECON1
ERXNDL
ERXNDH
EDMASTL
73
73
73
EDMADSTH
73
73
EDMANDH
EDMADSTL
EDMASTH
EDMANDL
73
73
73
EDMACSL
73
EDMACSH
73
DS39762F-page 266
PIC18F97J60 FAMILY
19.10 Module Resets
19.10.2
19.10.1
MICROCONTROLLER RESETS
19.10.3
DS39762F-page 267
PIC18F97J60 FAMILY
NOTES:
DS39762F-page 268
PIC18F97J60 FAMILY
20.0
20.1
MASTER SYNCHRONOUS
SERIAL PORT (MSSP)
MODULE
Master SSP (MSSP) Module
Overview
20.3
SPI Mode
FIGURE 20-1:
Internal
Data Bus
20.2
Read
SDIx
SSPxSR reg
SDOx
SSx
Shift
Clock
bit 0
SSx Control
Enable
Edge
Select
Note:
Write
SSPxBUF reg
Control Registers
2
Clock Select
SSPM<3:0>
SCKx
SMP:CKE 4
2
Edge
Select
(TMR22Output)
Prescaler TOSC
4, 16, 64
DS39762F-page 269
PIC18F97J60 FAMILY
20.3.1
REGISTERS
REGISTER 20-1:
R/W-0
SMP
R-0
R-0
R-0
R-0
R-0
R-0
(1)
D/A
R/W
UA
BF
CKE
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
bit 4
P: Stop bit
Used in I2C mode only. This bit is cleared when the MSSP module is disabled, SSPEN is cleared.
bit 3
S: Start bit
Used in I2C mode only.
bit 2
bit 1
bit 0
Note 1:
DS39762F-page 270
PIC18F97J60 FAMILY
REGISTER 20-2:
R/W-0
WCOL
SSPOV
(1)
R/W-0
(2)
SSPEN
R/W-0
CKP
R/W-0
SSPM3
(3)
R/W-0
SSPM2
(3)
R/W-0
SSPM1
(3)
R/W-0
SSPM0(3)
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
bit 4
bit 3-0
Note 1:
2:
3:
In Master mode, the overflow bit is not set since each new reception (and transmission) is initiated by
writing to the SSPxBUF register.
When this bit is enabled, these pins must be properly configured as input or output.
Bit combinations not specifically listed here are either reserved or implemented in I2C mode only.
DS39762F-page 271
PIC18F97J60 FAMILY
20.3.2
OPERATION
EXAMPLE 20-1:
LOOP
BTFSS
BRA
MOVF
SSP1STAT, BF
LOOP
SSP1BUF, W
MOVWF
RXDATA
MOVF
MOVWF
TXDATA, W
SSP1BUF
DS39762F-page 272
PIC18F97J60 FAMILY
20.3.3
FIGURE 20-2:
20.3.4
TYPICAL CONNECTION
SDIx
SDIx
Shift Register
(SSPxSR)
MSb
LSb
Shift Register
(SSPxSR)
MSb
SCKx
PROCESSOR 1
SDOx
Serial Clock
LSb
SCKx
PROCESSOR 2
DS39762F-page 273
PIC18F97J60 FAMILY
20.3.5
MASTER MODE
FIGURE 20-3:
Write to
SSPxBUF
SCKx
(CKP = 0
CKE = 0)
SCKx
(CKP = 1
CKE = 0)
4 Clock
Modes
SCKx
(CKP = 0
CKE = 1)
SCKx
(CKP = 1
CKE = 1)
SDOx
(CKE = 0)
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
SDOx
(CKE = 1)
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
SDIx
(SMP = 0)
bit 0
bit 7
Input
Sample
(SMP = 0)
SDIx
(SMP = 1)
bit 7
bit 0
Input
Sample
(SMP = 1)
SSPxIF
SSPxSR to
SSPxBUF
DS39762F-page 274
Next Q4 Cycle
after Q2
PIC18F97J60 FAMILY
20.3.6
SLAVE MODE
20.3.7
SLAVE SELECT
SYNCHRONIZATION
FIGURE 20-4:
SDOx pin is driven. When the SSx pin goes high, the
SDOx pin is no longer driven, even if in the middle of a
transmitted byte, and becomes a floating output.
External pull-up/pull-down resistors may be desirable
depending on the application.
Note 1: When the SPI is in Slave mode with SSx pin
control enabled (SSPxCON1<3:0> = 0100),
the SPI module will reset if the SSx pin is set
to VDD.
2: If the SPI is used in Slave mode with CKE
set, then the SSx pin control must be
enabled.
When the SPI module resets, the bit counter is forced
to 0. This can be done by either forcing the SSx pin to
a high level or clearing the SSPEN bit.
To emulate two-wire communication, the SDOx pin can
be connected to the SDIx pin. When the SPI needs to
operate as a receiver, the SDOx pin can be configured
as an input. This disables transmissions from the
SDOx. The SDIx can always be left as an input (SDIx
function) since it cannot create a bus conflict.
SSx
SCKx
(CKP = 0
CKE = 0)
SCKx
(CKP = 1
CKE = 0)
Write to
SSPxBUF
SDOx
SDIx
(SMP = 0)
bit 7
bit 6
bit 7
bit 0
bit 0
bit 7
bit 7
Input
Sample
(SMP = 0)
SSPxIF
Interrupt
Flag
SSPxSR to
SSPxBUF
Next Q4 Cycle
after Q2
DS39762F-page 275
PIC18F97J60 FAMILY
FIGURE 20-5:
SSx
Optional
SCKx
(CKP = 0
CKE = 0)
SCKx
(CKP = 1
CKE = 0)
Write to
SSPxBUF
SDOx
SDIx
(SMP = 0)
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
bit 0
bit 7
Input
Sample
(SMP = 0)
SSPxIF
Interrupt
Flag
Next Q4 Cycle
after Q2
SSPxSR to
SSPxBUF
FIGURE 20-6:
SSx
Not Optional
SCKx
(CKP = 0
CKE = 1)
SCKx
(CKP = 1
CKE = 1)
Write to
SSPxBUF
SDOx
SDIx
(SMP = 0)
bit 7
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
bit 0
Input
Sample
(SMP = 0)
SSPxIF
Interrupt
Flag
SSPxSR to
SSPxBUF
DS39762F-page 276
Next Q4 Cycle
after Q2
PIC18F97J60 FAMILY
20.3.8
OPERATION IN POWER-MANAGED
MODES
20.3.10
TABLE 20-1:
20.3.9
CKP
CKE
0, 0
0, 1
1, 0
1, 1
20.3.11
EFFECTS OF A RESET
DS39762F-page 277
PIC18F97J60 FAMILY
TABLE 20-2:
Name
INTCON
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
69
PIR1
PSPIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
71
PIE1
PSPIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
71
IPR1
PSPIP
ADIP
RC1IP
TX1IP
SSP1IP
CCP1IP
TMR2IP
TMR1IP
71
PIR3
SSP2IF(1)
BCL2IF
RC2IF
TX2IF
TMR4IF
CCP5IF
CCP4IF
CCP3IF
71
PIE3
SSP2IE(1)
BCL2IE
RC2IE
TX2IE
TMR4IE
CCP5IE
CCP4IE
CCP3IE
71
IPR3
SSP2IP(1)
BCL2IP
RC2IP
TX2IP
TMR4IP
CCP5IP
CCP4IP
CCP3IP
71
TRISC
TRISC7
TRISC6
TRISC5
TRISC4
TRISC3
TRISC2
TRISC1
TRISC0
71
TRISD
TRISD7(1)
TRISD3
TRISD2
TRISD1
TRISD0
71
TRISF3
TRISF2
TRISF1
TRISF0
TRISF
SSP1BUF
TRISF7
(1)
TRISD6
TRISF6
TRISD5
(1)
TRISF5
TRISD4
(1)
TRISF4
71
70
SSP1CON1
WCOL
SSPOV
SSPEN
CKP
SSPM3
SSPM2
SSPM1
SSPM0
70
SSP1STAT
SMP
CKE
D/A
R/W
UA
BF
70
SSP2BUF
73
SSP2CON1
WCOL
SSPOV
SSPEN
CKP
SSPM3
SSPM2
SSPM1
SSPM0
73
SSP2STAT
SMP
CKE
D/A
R/W
UA
BF
73
Legend: Shaded cells are not used by the MSSP module in SPI mode.
Note 1: These bits are only available in 100-pin devices; otherwise, they are unimplemented and read as 0.
DS39762F-page 278
PIC18F97J60 FAMILY
20.4
I2C Mode
20.4.1
FIGURE 20-7:
Read
Write
SSPxBUF reg
SCLx
SDAx
SSPxSR reg
LSb
Match Detect
Addr Match
SSPxADD reg
Address Mask
Start and
Stop bit Detect
Shift
Clock
MSb
REGISTERS
Set, Reset
S, P bits
(SSPxSTAT reg)
DS39762F-page 279
PIC18F97J60 FAMILY
REGISTER 20-3:
R/W-0
SMP
CKE
R-0
R-0
R-0
D/A
(1)
(1)
R-0
R/W
(2,3)
R-0
R-0
UA
BF
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
bit 4
P: Stop bit(1)
1 = Indicates that a Stop bit has been detected last
0 = Stop bit was not detected last
bit 3
S: Start bit(1)
1 = Indicates that a Start bit has been detected last
0 = Start bit was not detected last
bit 2
bit 1
bit 0
Note 1:
2:
3:
DS39762F-page 280
PIC18F97J60 FAMILY
REGISTER 20-4:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
WCOL
SSPOV
SSPEN
CKP
SSPM3
SSPM2
SSPM1
SSPM0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
bit 4
bit 3-0
Note 1:
2:
When enabled, the SDAx and SCLx pins must be configured as inputs.
Bit combinations not specifically listed here are either reserved or implemented in SPI mode only.
DS39762F-page 281
PIC18F97J60 FAMILY
REGISTER 20-5:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
GCEN
ACKSTAT
ACKDT(1)
ACKEN(2)
RCEN(2)
PEN(2)
RSEN(2)
SEN(2)
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
Note 1:
2:
Value that will be transmitted when the user initiates an Acknowledge sequence at the end of a receive.
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).
DS39762F-page 282
PIC18F97J60 FAMILY
REGISTER 20-6:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
GCEN
ACKSTAT
ADMSK5
ADMSK4
ADMSK3
ADMSK2
ADMSK1
SEN(1)
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5-2
bit 1
bit 0
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).
DS39762F-page 283
PIC18F97J60 FAMILY
20.4.2
OPERATION
I C Master mode,
clock = (FOSC/4) x (SSPxADD + 1)
I 2C Slave mode (7-bit addressing)
I 2C Slave mode (10-bit addressing)
I 2C Slave mode (7-bit addressing) with Start and
Stop bit interrupts enabled
I 2C Slave mode (10-bit addressing) with Start and
Stop bit interrupts enabled
I 2C Firmware Controlled Master mode,
slave is Idle
Selection of any I 2C mode, with the SSPEN bit set,
forces the SCLx and SDAx pins to be open-drain,
provided these pins are programmed to inputs by
setting the appropriate TRISC or TRISD bits. To ensure
proper operation of the module, pull-up resistors must
be provided externally to the SCLx and SDAx pins.
20.4.3
SLAVE MODE
20.4.3.1
1.
2.
3.
5.
6.
DS39762F-page 284
Addressing
4.
7.
8.
9.
PIC18F97J60 FAMILY
20.4.3.2
Address Masking
EXAMPLE 20-2:
Least
7-Bit Addressing:
SSPxADD<7:1> = A0h (1010000) (SSPxADD<0> is assumed to be 0)
ADMSK<5:1>
= 00111
Addresses Acknowledged: A0h, A2h, A4h, A6h, A8h, AAh, ACh, AEh
10-Bit Addressing:
SSPxADD<7:0> = A0h (10100000) (the two MSb of the address are ignored in this example since they are
not affected by masking)
ADMSK<5:1>
= 00111
Addresses Acknowledged: A0h, A1h, A2h, A3h, A4h, A5h, A6h, A7h, A8h, A9h, AAh, ABh, ACh, ADh, AEh, AFh
DS39762F-page 285
PIC18F97J60 FAMILY
20.4.3.3
Reception
20.4.3.4
Transmission
When the R/W bit of the incoming address byte is set and
an address match occurs, the R/W bit of the SSPxSTAT
register is set. The received address is loaded into the
SSPxBUF register. The ACK pulse will be sent on the
ninth bit and pin RC3 or RD6 is held low, regardless of
SEN (see Section 20.4.4 Clock Stretching for more
details). By stretching the clock, the master will be unable
to assert another clock pulse until the slave is done
preparing the transmit data. The transmit data must be
loaded into the SSPxBUF register which also loads the
SSPxSR register. Then, pin, RC3 or RD6, should be
enabled by setting bit, CKP (SSPxCON1<4>). The eight
data bits are shifted out on the falling edge of the SCLx
input. This ensures that the SDAx signal is valid during
the SCLx high time (Figure 20-10).
The ACK pulse from the master-receiver is latched on
the rising edge of the ninth SCLx input pulse. If the SDAx
line is high (not ACK), then the data transfer is complete.
In this case, when the ACK is latched by the slave, the
slave logic is reset (resets SSPxSTAT register) and the
slave monitors for another occurrence of the Start bit. If
the SDAx line was low (ACK), the next transmit data
must be loaded into the SSPxBUF register. Again, pin,
RC3 or RD6, must be enabled by setting bit, CKP.
An MSSP interrupt is generated for each data transfer
byte. The SSPxIF bit must be cleared in software and
the SSPxSTAT register is used to determine the status
of the byte. The SSPxIF bit is set on the falling edge of
the ninth clock pulse.
DS39762F-page 286
CKP
A4
A3
Receiving Address
A5
A2
SSPOV (SSPxCON1<6>)
BF (SSPxSTAT<0>)
SCLx
SDAx
A6
A1
ACK
R/W = 0
D7
D4
D3
Receiving Data
D5
Cleared in software
SSPxBUF is read
D6
D2
D1
D0
ACK
D7
D6
D4
D3
Receiving Data
D5
D2
D1
D0
Bus master
terminates
transfer
SSPOV is set
because SSPxBUF is
still full. ACK is not sent.
ACK
FIGURE 20-8:
A7
PIC18F97J60 FAMILY
DS39762F-page 287
DS39762F-page 288
A6
Note
CKP
A3
Receiving Address
A5
D4
D3
Receiving Data
D5
Cleared in software
SSPxBUF is read
D6
D2
D1
D0
In this example, an address equal to A7.A6.A5.X.A3.X.X will be Acknowledged and cause an interrupt.
D7
ACK
R/W = 0
2:
1:
SSPOV (SSPxCON1<6>)
BF (SSPxSTAT<0>)
SCLx
A7
ACK
D7
D6
D4
D3
Receiving Data
D5
D2
D1
D0
Bus master
terminates
transfer
SSPOV is set
because SSPxBUF is
still full. ACK is not sent.
ACK
FIGURE 20-9:
SDAx
PIC18F97J60 FAMILY
I2C SLAVE MODE TIMING WITH SEN = 0 AND ADMSK<5:1> = 01011
(RECEPTION, 7-BIT ADDRESS)
Data in
sampled
A6
CKP
BF (SSPxSTAT<0>)
A4
A3
A2
Receiving Address
A5
A7
A1
R/W = 0
ACK
D3
D2
Transmitting Data
D4
Cleared in software
D5
D6
D7
D1
D0
ACK
D7
D4
D3
Cleared in software
D5
D2
D6
D0
ACK
D1
Transmitting Data
FIGURE 20-10:
SCLx
SDAx
PIC18F97J60 FAMILY
DS39762F-page 289
DS39762F-page 290
A8
UA (SSPxSTAT<1>)
SSPOV (SSPxCON1<6>)
A9
Cleared in software
BF (SSPxSTAT<0>)
CKP
SCLx
ACK
R/W = 0
A7
A4
A3
A2
A0 ACK
Cleared by hardware
when SSPxADD is updated
with low byte of address
A1
Cleared in software
A5
A6
D7
6
7
D1
Cleared in software
D3 D2
D6 D5 D4
9
1
D3
D2
Cleared in software
D0 ACK D7 D6 D5 D4
D1 D0
P
Bus master
terminates
transfer
SSPOV is set
because SSPxBUF is
still full. ACK is not sent.
ACK
FIGURE 20-11:
SDAx
PIC18F97J60 FAMILY
I2C SLAVE MODE TIMING WITH SEN = 0 (RECEPTION, 10-BIT ADDRESS)
Note
A8
A9
A3
A2
Cleared in software
A5
5
6
Cleared in software
9
1
D3 D2
Cleared in software
D5 D4
D3 D2
Note that the Most Significant bits of the address are not affected by the bit masking.
D6 D5 D4
3:
D7
In this example, an address equal to A9.A8.A7.A6.A5.X.A3.A2.X.X will be Acknowledged and cause an interrupt.
Cleared by hardware
when SSPxADD is updated
with low byte of address
A6
ACK
1:
A7
2:
UA (SSPxSTAT<1>)
SSPOV (SSPxCON1<6>)
BF (SSPxSTAT<0>)
CKP
Cleared in software
SCLx
ACK
R/W = 0
D1 D0
P
Bus master
terminates
transfer
SSPOV is set
because SSPxBUF is
still full. ACK is not sent.
ACK
FIGURE 20-12:
SDAx
PIC18F97J60 FAMILY
DS39762F-page 291
DS39762F-page 292
CKP (SSPxCON1<4>)
UA (SSPxSTAT<1>)
BF (SSPxSTAT<0>)
A9 A8
SCLx
ACK
R/W = 0
Cleared in software
A6 A5 A4 A3 A2 A1 A0
A7
ACK
Cleared in software
ACK
R/W = 1
Cleared in software
Completion of
data transmission
clears BF flag
ACK
D7 D6 D5 D4 D3 D2 D1 D0
Write of SSPxBUF
BF flag is clear
initiates transmit
at the end of the
third address sequence
A9 A8
Sr
FIGURE 20-13:
SDAx
Bus master
terminates
transfer
PIC18F97J60 FAMILY
I2C SLAVE MODE TIMING (TRANSMISSION, 10-BIT ADDRESS)
PIC18F97J60 FAMILY
20.4.4
CLOCK STRETCHING
20.4.4.1
20.4.4.2
20.4.4.3
20.4.4.4
DS39762F-page 293
PIC18F97J60 FAMILY
20.4.4.5
FIGURE 20-14:
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 1
DX
SCLx
CKP
Master device
asserts clock
Master device
deasserts clock
WR
SSPxCON1
DS39762F-page 294
A6
CKP
SSPOV (SSPxCON1<6>)
BF (SSPxSTAT<0>)
SCLx
A7
A4
A3
A2
Receiving Address
A5
A1
ACK
R/W = 0
D4
D3
Receiving Data
D5
Cleared in software
D6
If BF is cleared
prior to the falling
edge of the 9th clock,
CKP will not be reset
to 0 and no clock
stretching will occur
SSPxBUF is read
D7
D2
D1
ACK
D7
D0
D4
D3
Receiving Data
D5
CKP
written
to 1 in
software
D6
D2
D1
D0
Bus master
terminates
transfer
SSPOV is set
because SSPxBUF is
still full. ACK is not sent.
ACK
FIGURE 20-15:
SDAx
PIC18F97J60 FAMILY
DS39762F-page 295
DS39762F-page 296
UA (SSPxSTAT<1>)
SSPOV (SSPxCON1<6>)
BF (SSPxSTAT<0>)
CKP
A9 A8
Cleared in software
SCLx
ACK
R/W = 0
A7
A4
A3
A2
Cleared in software
A5
A1
A0
A6
ACK
Cleared in software
D3 D2
8
1
D2
Cleared in software
CKP written to 1
in software
D3
ACK
D1 D0
D7 D6 D5 D4
ACK
Bus master
terminates
transfer
SSPOV is set
because SSPxBUF is
still full. ACK is not sent.
D1 D0
FIGURE 20-16:
SDAx
PIC18F97J60 FAMILY
I2C SLAVE MODE TIMING WITH SEN = 1 (RECEPTION, 10-BIT ADDRESS)
PIC18F97J60 FAMILY
20.4.5
FIGURE 20-17:
SCLx
S
Receiving Data
R/W = 0
SDAx
ACK D7
ACK
D6
D5
D4
D3
D2
D1
D0
SSPxIF
BF (SSPxSTAT<0>)
Cleared in software
SSPxBUF is read
SSPOV (SSPxCON1<6>)
GCEN (SSPxCON2<7>)
1
DS39762F-page 297
PIC18F97J60 FAMILY
MASTER MODE
Note:
FIGURE 20-18:
Start Condition
Stop Condition
Data Transfer Byte Transmitted/Received
Acknowledge Transmit
Repeated Start
SSPM<3:0>
SSPxADD<6:0>
Write
SSPxBUF
SDAx
Baud
Rate
Generator
Shift
Clock
SDAx In
SCLx In
Bus Collision
DS39762F-page 298
LSb
Clock Cntl
SCLx
Receive Enable
SSPxSR
MSb
20.4.6
PIC18F97J60 FAMILY
20.4.6.1
DS39762F-page 299
PIC18F97J60 FAMILY
20.4.7
BAUD RATE
20.4.7.1
Once the given operation is complete (i.e., transmission of the last data bit is followed by ACK), the internal
clock will automatically stop counting and the SCLx pin
will remain in its last state.
Table 20-3 demonstrates clock rates based on
instruction cycles and the BRG value loaded into
SSPxADD.
FIGURE 20-19:
SSPM<3:0>
SCLx
SSPxADD<6:0>
Reload
Reload
Control
CLKO
TABLE 20-3:
Note 1:
FOSC/4
BRG Value
FSCL
(2 Rollovers of BRG)
41.667 MHz
19h
400 kHz(1)
41.667 MHz
67h
100 kHz
31.25 MHz
13h
400 kHz(1)
31.25 MHz
4Dh
100 kHz
20.833 MHz
09h
400 kHz(1)
20.833 MHz
33h
100 kHz
The I2C interface does not conform to the 400 kHz I2C specification (which applies to rates greater than
100 kHz) in all details, but may be used with care where higher rates are required by the application.
DS39762F-page 300
PIC18F97J60 FAMILY
20.4.7.2
Clock Arbitration
FIGURE 20-20:
SDAx
DX
SCLx deasserted but slave holds
SCLx low (clock arbitration)
SCLx
BRG decrements on
Q2 and Q4 cycles
BRG
Value
03h
BRG
Reload
02h
01h
03h
02h
DS39762F-page 301
PIC18F97J60 FAMILY
I2C MASTER MODE START
CONDITION TIMING
Note:
20.4.8.1
20.4.8
FIGURE 20-21:
SDAx
2nd bit
TBRG
SCLx
TBRG
S
DS39762F-page 302
PIC18F97J60 FAMILY
20.4.9
20.4.9.1
FIGURE 20-22:
SDAx = 1,
SCLx = 1
Write to SSPxCON2 occurs here: SDAx = 1,
SCLx (no change)
TBRG
TBRG
1st bit
SDAx
RSEN bit set by hardware
on falling edge of ninth clock,
end of Xmit
SCLx
TBRG
Sr = Repeated Start
DS39762F-page 303
PIC18F97J60 FAMILY
20.4.10
20.4.10.1
BF Status Flag
20.4.10.2
20.4.10.3
20.4.11
20.4.11.1
BF Status Flag
20.4.11.2
20.4.11.3
DS39762F-page 304
R/W
PEN
SEN
BF (SSPxSTAT<0>)
SSPxIF
SCLx
SDAx
A6
A5
A4
A3
A2
A1
Cleared in software
SSPxBUF written
D7
1
SCLx held low
while CPU
responds to SSPxIF
ACK = 0
R/W = 0
A7
D5
D4
D3
D2
D1
D0
D6
ACKSTAT in
SSPxCON2 = 1
Cleared in software
ACK
FIGURE 20-23:
SEN = 0
PIC18F97J60 FAMILY
DS39762F-page 305
DS39762F-page 306
ACKEN
SSPOV
BF
(SSPxSTAT<0>)
SDAx = 0, SCLx = 1
while CPU
responds to SSPxIF
SSPxIF
SCLx
SDAx
A7
4
5
Cleared in software
A6 A5 A4 A3 A2
A1
R/W = 1
ACK
D0
ACK
5
6
Cleared in software
D7 D6 D5 D4 D3 D2 D1
Cleared in
software
ACK
P
Set SSPxIF interrupt
at end of Acknowledge sequence
Bus master
terminates
transfer
Set P bit
(SSPxSTAT<4>)
and SSPxIF
PEN bit = 1
written here
D0
RCEN cleared
automatically
RCEN = 1, start
next receive
Cleared in software
Cleared in software
D7 D6 D5 D4 D3 D2 D1
RCEN cleared
automatically
FIGURE 20-24:
SEN = 0
Write to SSPxBUF occurs here,
ACK from Slave
start XMIT
Write to SSPxCON2<4>
to start Acknowledge sequence
SDAx = ACKDT (SSPxCON2<5>) = 0
PIC18F97J60 FAMILY
I 2C MASTER MODE WAVEFORM (RECEPTION, 7-BIT ADDRESS)
PIC18F97J60 FAMILY
20.4.12
ACKNOWLEDGE SEQUENCE
TIMING
20.4.13
20.4.12.1
20.4.13.1
FIGURE 20-25:
D0
SCLx
TBRG
SSPxIF
Cleared in
software
SSPxIF set at
the end of receive
Cleared in
software
SSPxIF set at the end
of Acknowledge sequence
FIGURE 20-26:
Write to SSPxCON2,
set PEN
Falling edge of
9th clock
SCLx
SDAx
ACK
P
TBRG
TBRG
TBRG
DS39762F-page 307
PIC18F97J60 FAMILY
20.4.14
SLEEP OPERATION
20.4.17
20.4.15
EFFECTS OF A RESET
20.4.16
MULTI-MASTER MODE
Address Transfer
Data Transfer
A Start Condition
A Repeated Start Condition
An Acknowledge Condition
Multi-Master mode support is achieved by bus arbitration. When the master outputs address/data bits onto
the SDAx pin, arbitration takes place when the master
outputs a 1 on SDAx, by letting SDAx float high and
another master asserts a 0. When the SCLx pin floats
high, data should be stable. If the expected data on
SDAx is a 1 and the data sampled on the SDAx
pin = 0, then a bus collision has taken place. The
master will set the Bus Collision Interrupt Flag, BCLxIF
and reset the I2C port to its Idle state (Figure 20-27).
If a transmit was in progress when the bus collision
occurred, the transmission is halted, the BF flag is
cleared, the SDAx and SCLx lines are deasserted and
the SSPxBUF can be written to. When the user services
the bus collision Interrupt Service Routine and if the I2C
bus is free, the user can resume communication by
asserting a Start condition.
If a Start, Repeated Start, Stop or Acknowledge condition
was in progress when the bus collision occurred, the
condition is aborted, the SDAx and SCLx lines are
deasserted and the respective control bits in the
SSPxCON2 register are cleared. When the user services
the bus collision Interrupt Service Routine and if the I2C
bus is free, the user can resume communication by
asserting a Start condition.
The master will continue to monitor the SDAx and SCLx
pins. If a Stop condition occurs, the SSPxIF bit will be set.
A write to the SSPxBUF will start the transmission of
data at the first data bit regardless of where the
transmitter left off when the bus collision occurred.
In Multi-Master mode, the interrupt generation on the
detection of Start and Stop conditions allows the determination of when the bus is free. Control of the I2C bus
can be taken when the P bit is set in the SSPxSTAT
register, or the bus is Idle and the S and P bits are
cleared.
FIGURE 20-27:
SDAx
SCLx
BCLxIF
DS39762F-page 308
PIC18F97J60 FAMILY
20.4.17.1
FIGURE 20-28:
The reason that bus collision is not a factor during a Start condition is that no two
bus masters can assert a Start condition
at the exact same time. Therefore, one
master will always assert SDAx before the
other. This condition does not cause a bus
collision because the two masters must be
allowed to arbitrate the first address
following the Start condition. If the address
is the same, arbitration must be allowed to
continue into the data portion, Repeated
Start or Stop conditions.
SDAx
SCLx
Set SEN, enable Start
condition if SDAx = 1, SCLx = 1
SEN
BCLxIF
SSPxIF
SSPxIF and BCLxIF are
cleared in software
DS39762F-page 309
PIC18F97J60 FAMILY
FIGURE 20-29:
TBRG
SDAx
Set SEN, enable Start
sequence if SDAx = 1, SCLx = 1
SCLx
SEN
SCLx = 0 before BRG time-out,
bus collision occurs. Set BCLxIF.
BCLxIF
Interrupt cleared
in software
S
SSPxIF
FIGURE 20-30:
SDAx
SCLx
Set SSPxIF
TBRG
S
SCLx pulled low after BRG
time-out
SEN
BCLxIF
SSPxIF
SDAx = 0, SCLx = 1,
set SSPxIF
DS39762F-page 310
Interrupts cleared
in software
PIC18F97J60 FAMILY
20.4.17.2
If, at the end of the BRG time-out, both SCLx and SDAx
are still high, the SDAx pin is driven low and the BRG
is reloaded and begins counting. At the end of the
count, regardless of the status of the SCLx pin, the
SCLx pin is driven low and the Repeated Start
condition is complete.
FIGURE 20-31:
SDAx
SCLx
SSPxIF
FIGURE 20-32:
TBRG
SDAx
SCLx
BCLxIF
RSEN
S
SSPxIF
DS39762F-page 311
PIC18F97J60 FAMILY
20.4.17.3
b)
FIGURE 20-33:
TBRG
SDAx sampled
low after TBRG,
set BCLxIF
TBRG
SDAx
SDAx asserted low
SCLx
PEN
BCLxIF
P
SSPxIF
FIGURE 20-34:
TBRG
TBRG
SDAx
Assert SDAx
SCLx
PEN
BCLxIF
P
SSPxIF
DS39762F-page 312
PIC18F97J60 FAMILY
TABLE 20-4:
Name
INTCON
Bit 6
GIE/GIEH PEIE/GIEL
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
TMR0IE
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
69
PIR1
PSPIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
71
PIE1
PSPIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
71
71
IPR1
PSPIP
ADIP
RC1IP
TX1IP
SSP1IP
CCP1IP
TMR2IP
TMR1IP
PIR2
OSCFIF
CMIF
ETHIF
BCL1IF
TMR3IF
CCP2IF
71
PIE2
OSCFIE
CMIE
ETHIE
BCL1IE
TMR3IE
CCP2IE
71
IPR2
OSCFIP
CMIP
ETHIP
BCL1IP
TMR3IP
CCP2IP
71
PIR3
SSP2IF(1)
BCL2IF(1)
RC2IF
TX2IF
TMR4IF
CCP5IF
CCP4IF
CCP3IF
71
PIE3
SSP2IE(1)
BCL2IE
(1)
RC2IE
TX2IE
TMR4IE
CCP5IE
CCP4IE
CCP3IE
71
IPR3
SSP2IP(1)
BCL2IP(1)
RC2IP
TX2IP
TMR4IP
CCP5IP
CCP4IP
CCP3IP
71
TRISC7
TRISC6
TRISC5
TRISC4
TRISC3
TRISC2
TRISC1
TRISC0
71
TRISD4
TRISD3
TRISD2
TRISD1
TRISC
TRISD7
TRISD5
(1)
TRISD0
71
SSP1BUF
70
SSP1ADD
MSSP1 Address Register (I2C Slave mode), MSSP1 Baud Rate Reload Register (I2C Master mode)
73
TRISD
TRISD6
(1)
SSP1CON1
WCOL
SSPOV
SSPEN
CKP
SSPM3
SSPM2
SSPM1
SSPM0
70
SSP1CON2
GCEN
ACKSTAT
ACKDT
ACKEN
RCEN
PEN
RSEN
SEN
70
GCEN
ACKSTAT
ADMSK5(2)
ADMSK4(2)
ADMSK3(2)
ADMSK2(2)
ADMSK1(2)
SEN
70
SMP
CKE
D/A
R/W
UA
BF
70
SSP1STAT
SSP2BUF
70
SSP2ADD
MSSP2 Address Register (I2C Slave mode), MSSP2 Baud Rate Reload Register (I2C Master mode)
73
SSP2CON1
WCOL
SSPOV
SSPEN
CKP
SSPM3
SSPM2
SSPM1
SSPM0
SSP2CON2
GCEN
ACKSTAT
ACKDT
ACKEN
RCEN
PEN
RSEN
SEN
73
GCEN
SEN
73
BF
73
SSP2STAT
Legend:
Note 1:
2:
SMP
CKE
D/A
R/W
UA
73
= unimplemented, read as 0, r = reserved. Shaded cells are not used by the MSSP module in I2C mode.
These bits are only available in 100-pin devices; otherwise, they are unimplemented and read as 0.
Alternate bit definitions in I2C Slave mode.
DS39762F-page 313
PIC18F97J60 FAMILY
NOTES:
DS39762F-page 314
PIC18F97J60 FAMILY
21.0
ENHANCED UNIVERSAL
SYNCHRONOUS
ASYNCHRONOUS RECEIVER
TRANSMITTER (EUSART)
DS39762F-page 315
PIC18F97J60 FAMILY
REGISTER 21-1:
R/W-0
CSRC
R/W-0
R/W-0
R/W-0
R/W-0
R-1
R/W-0
TX9
TXEN(1)
SYNC
SENDB
BRGH
TRMT
TX9D
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
Note 1:
DS39762F-page 316
PIC18F97J60 FAMILY
REGISTER 21-2:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R-0
R-0
R-x
SPEN
RX9
SREN
CREN
ADDEN
FERR
OERR
RX9D
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
bit 1
bit 0
DS39762F-page 317
PIC18F97J60 FAMILY
REGISTER 21-3:
R/W-0
R-1
R/W-0
R/W-0
R/W-0
U-0
R/W-0
R/W-0
ABDOVF
RCIDL
RXDTP
TXCKP
BRG16
WUE
ABDEN
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2
Unimplemented: Read as 0
bit 1
bit 0
DS39762F-page 318
PIC18F97J60 FAMILY
21.1
TABLE 21-1:
21.1.1
OPERATION IN POWER-MANAGED
MODES
21.1.2
SAMPLING
Configuration Bits
BRG/EUSARTx Mode
8-bit/Asynchronous
FOSC/[64 (n + 1)]
SYNC
BRG16
BRGH
8-bit/Asynchronous
16-bit/Asynchronous
16-bit/Asynchronous
8-bit/Synchronous
16-bit/Synchronous
FOSC/[16 (n + 1)]
FOSC/[4 (n + 1)]
DS39762F-page 319
PIC18F97J60 FAMILY
EQUATION 21-1:
For a device with FOSC of 16 MHz, desired baud rate of 9600, Asynchronous mode, 8-bit BRG:
Desired Baud Rate = FOSC/(64 ([SPBRGHx:SPBRGx] + 1))
Solving for SPBRGHx:SPBRGx:
X = ((FOSC/Desired Baud Rate)/64) 1
= ((16000000/9600)/64) 1
= [25.042] = 25
Calculated Baud Rate=16000000/(64 (25 + 1))
= 9615
Error
= (Calculated Baud Rate Desired Baud Rate)/Desired Baud Rate
= (9615 9600)/9600 = 0.16%
TABLE 21-2:
Name
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset Values
on Page:
TXSTAx
CSRC
TX9
TXEN
SYNC
SENDB
BRGH
TRMT
TX9D
71
RCSTAx
SPEN
RX9
SREN
CREN
ADDEN
FERR
OERR
RX9D
71
RCIDL
RXDTP
TXCKP
BRG16
WUE
ABDEN
72
BAUDCONx ABDOVF
SPBRGHx
72
SPBRGx
72
Legend: = unimplemented, read as 0. Shaded cells are not used by the BRG.
DS39762F-page 320
PIC18F97J60 FAMILY
TABLE 21-3:
BAUD
RATE
(K)
%
Error
SPBRG
Actual
Value
Rate (K)
(decimal)
%
Error
SPBRG
Actual
Value
Rate (K)
(decimal)
%
Error
SPBRG
Actual
Value
Rate (K)
(decimal)
%
Error
SPBRG
Value
(decimal)
0.3
1.2
1.271
5.96
255
135
2.4
2.543
5.96
255
2.405
0.22
202
2.396
-0.15
162
2.393
-0.27
9.6
9.574
-0.27
67
9.574
-0.27
50
9.527
-0.76
40
9.574
-0.27
33
19.2
19.148
-0.27
33
19.531
1.73
24
19.531
1.73
19
19.147
-0.27
16
57.6
59.186
2.75
10
61.035
5.96
55.804
-3.12
54.253
-5.81
115.2
108.508
-5.81
122.070
5.96
130.208
13.03
108.505
-5.81
%
Error
SPBRG
Actual
Value
Rate (K)
(decimal)
%
Error
SPBRG
Actual
Value
Rate (K)
(decimal)
%
Error
SPBRG
Value
(decimal)
0.3
0.300
0.01
216
1.2
1.198
-0.08
180
1.206
0.47
80
1.206
0.48
53
2.4
2.411
0.47
89
2.382
-0.76
40
2.411
0.48
26
9.6
9.435
-1.71
22
9.766
1.73
9.301
-3.11
19.2
19.279
2.75
10
19.531
1.73
21.703
13.04
57.6
54.254
-5.81
48.828
-15.23
65.109
13.04
115.2
108.508
-5.81
97.656
-15.23
65.109
-43.48
0.3
1.2
%
Error
SPBRG
Actual
Value
Rate (K)
(decimal)
%
Error
SPBRG
Actual
Value
Rate (K)
(decimal)
%
Error
SPBRG
Actual
Value
Rate (K)
(decimal)
%
Error
SPBRG
Value
(decimal)
2.4
9.6
10.172
5.96
255
9.621
0.22
202
9.586
-0.15
162
9.573
-0.27
135
19.2
19.148
-0.27
135
19.148
-0.27
101
19.290
0.47
80
19.147
-0.27
67
57.6
57.871
0.47
44
57.445
-0.27
33
57.870
0.47
26
56.611
-1.72
22
115.2
113.226
-1.71
22
114.890
-0.27
16
111.607
-3.12
13
118.369
2.75
10
0.3
1.2
%
Error
SPBRG
Actual
Value
Rate (K)
(decimal)
%
Error
SPBRG
Actual
Value
Rate (K)
(decimal)
%
Error
SPBRG
Value
(decimal)
1.200
0.01
216
108
2.4
2.396
-0.15
162
2.389
-0.44
9.6
9.645
0.47
89
9.527
-0.76
40
9.645
0.48
26
19.2
19.290
0.47
44
19.531
1.73
19
18.603
-3.11
13
57.6
57.871
0.47
14
55.804
-3.12
52.088
-9.57
115.2
108.508
-5.81
130.208.
13.03
130.219
13.04
DS39762F-page 321
PIC18F97J60 FAMILY
TABLE 21-3:
BAUD
RATE
(K)
SPBRG
Actual
Value
Rate (K)
(decimal)
SPBRG
Actual
Value
Rate (K)
(decimal)
SPBRG
Actual
Value
Rate (K)
(decimal)
%
Error
SPBRG
Value
(decimal)
0.300
0.00
4339
1.200
0.00
1084
650
2.398
-0.09
542
-0.15
162
9.574
-0.27
135
0.47
80
19.148
-0.27
67
Actual
Rate (K)
%
Error
0.3
0.300
0.00
8680
0.300
0.00
6509
0.300
0.01
5207
1.2
1.200
0.01
2169
1.200
-0.02
1627
1.200
0.01
1301
2.4
2.400
0.01
1084
2.399
-0.02
813
2.400
0.01
9.6
9.609
0.10
270
9.621
0.22
202
9.586
19.2
19.148
-0.27
135
19.148
-0.27
101
19.290
%
Error
%
Error
57.6
57.871
0.47
44
57.444
-0.27
33
57.870
0.47
26
56.611
-1.72
22
115.2
113.226
-1.71
22
114.890
-0.27
16
111.607
-3.12
13
118.369
2.75
10
SPBRG
Actual
Value
Rate (K)
(decimal)
SPBRG
Actual
Value
Rate (K)
(decimal)
SPBRG
Value
(decimal)
Actual
Rate (K)
%
Error
0.3
0.300
-0.02
2893
0.300
0.01
1301
0.300
0.01
867
1.2
1.201
0.05
722
1.198
-0.15
325
1.200
0.01
216
2.4
2.398
-0.08
361
2.396
-0.15
162
2.389
-0.44
108
9.6
9.645
0.47
89
9.527
-0.76
40
9.646
0.48
26
19.2
19.290
0.47
44
19.531
1.73
19
18.603
-3.11
13
57.6
57.871
0.47
14
55.804
-3.12
52.088
-9.57
115.2
108.508
-5.81
130.208
13.03
130.218
13.04
%
Error
%
Error
SPBRG
Actual
Value
Rate (K)
(decimal)
SPBRG
Actual
Value
Rate (K)
(decimal)
SPBRG
Actual
Value
Rate (K)
(decimal)
Actual
Rate (K)
%
Error
0.3
0.300
0.00
34722
0.300
0.00
26041
0.300
0.00
20832
1.2
1.200
0.00
8680
1.200
0.01
6509
1.200
0.01
5207
%
Error
%
Error
%
Error
SPBRG
Value
(decimal)
0.300
0.00
17360
1.200
0.00
4339
2169
2.4
2.400
0.01
4339
2.400
0.01
3254
2.400
0.01
2603
2.400
0.00
9.6
9.601
0.01
1084
9.598
-0.02
813
9.601
0.01
650
9.592
-0.09
542
19.2
19.184
-0.08
542
19.195
-0.02
406
19.172
-0.15
325
19.219
0.10
270
57.6
57.551
-0.08
180
57.445
-0.27
135
57.339
-0.45
108
57.869
0.47
89
115.2
115.742
0.47
89
114.890
-0.27
67
115.741
0.47
53
115.739
0.47
44
%
Error
SPBRG
Actual
Value
Rate (K)
(decimal)
%
Error
SPBRG
Actual
Value
Rate (K)
(decimal)
%
Error
SPBRG
Value
(decimal)
0.3
0.300
0.00
11573
0.300
0.01
5207
0.300
-0.01
3472
1.2
1.200
-0.02
2893
1.200
0.01
1301
1.200
0.01
867
2.4
2.400
-0.02
1446
2.400
0.01
650
2.400
0.01
433
9.6
9.592
-0.08
361
9.586
-0.15
162
9.557
-0.44
108
19.2
19.184
-0.08
180
19.290
0.47
80
19.292
0.48
53
57.6
57.870
0.47
59
57.870
0.47
26
57.875
0.48
17
115.2
115.742
0.47
29
111.607
-3.12
13
115.750
0.48
DS39762F-page 322
PIC18F97J60 FAMILY
21.1.3
TABLE 21-4:
BRG COUNTER
CLOCK RATES
BRG16
BRGH
FOSC/512
FOSC/128
FOSC/128
FOSC/32
Note:
21.1.3.1
DS39762F-page 323
PIC18F97J60 FAMILY
FIGURE 21-1:
BRG Value
0000h
001Ch
Start
RXx pin
Edge #1
Bit 1
Bit 0
Edge #2
Bit 3
Bit 2
Edge #3
Bit 5
Bit 4
Edge #4
Bit 7
Bit 6
Edge #5
Stop Bit
BRG Clock
Auto-Cleared
Set by User
ABDEN bit
RCxIF bit
(Interrupt)
Read
RCREGx
SPBRGx
XXXXh
1Ch
SPBRGHx
XXXXh
00h
Note: The ABD sequence requires the EUSARTx module to be configured in Asynchronous mode and WUE = 0.
FIGURE 21-2:
BRG Clock
ABDEN bit
RXx pin
Start
Bit 0
ABDOVF bit
FFFFh
BRG Value
DS39762F-page 324
XXXXh
0000h
0000h
PIC18F97J60 FAMILY
21.2
21.2.1
EUSARTx ASYNCHRONOUS
TRANSMITTER
2.
3.
4.
5.
6.
7.
8.
9.
DS39762F-page 325
PIC18F97J60 FAMILY
FIGURE 21-3:
TXREGx Register
TXxIE
8
MSb
LSb
(8)
Pin Buffer
and Control
TSR Register
TXx pin
Interrupt
TXEN
BRG16
SPBRGHx
SPBRGx
TX9
FIGURE 21-4:
TX9D
Write to TXREGx
BRG Output
(Shift Clock)
Word 1
TXx (pin)
Start bit
bit 0
bit 1
bit 7/8
Stop bit
Word 1
TXxIF bit
(Transmit Buffer
Reg. Empty Flag)
TRMT bit
(Transmit Shift
Reg. Empty Flag)
FIGURE 21-5:
1 TCY
Word 1
Transmit Shift Reg
Write to TXREGx
BRG Output
(Shift Clock)
Word 1
TXx (pin)
TXxIF bit
(Interrupt Reg. Flag)
TRMT bit
(Transmit Shift
Reg. Empty Flag)
Word 2
Start bit
bit 0
1 TCY
bit 1
bit 7/8
Stop bit
Start bit
bit 0
Word 2
Word 1
1 TCY
Word 1
Transmit Shift Reg.
Word 2
Transmit Shift Reg.
DS39762F-page 326
PIC18F97J60 FAMILY
TABLE 21-5:
Name
INTCON
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
69
PIR1
PSPIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
71
PIE1
PSPIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
71
IPR1
PSPIP
ADIP
RC1IP
TX1IP
SSP1IP
CCP1IP
TMR2IP
TMR1IP
71
PIR3
SSP2IF
BCL2IF
RC2IF
TX2IF(1)
TMR4IF
CCP5IF
CCP4IF
CCP3IF
71
PIE3
SSP2IE
BCL2IE
RC2IE
TX2IE(1)
TMR4IE
CCP5IE
CCP4IE
CCP3IE
71
IPR3
SSP2IP
BCL2IP
RC2IP
TX2IP(1)
TMR4IP
CCP5IP
CCP4IP
CCP3IP
71
SPEN
RX9
SREN
CREN
ADDEN
FERR
OERR
RX9D
71
RCSTAx
TXREGx
TXSTAx
BAUDCONx
71
CSRC
TX9
TXEN
SYNC
SENDB
BRGH
TRMT
TX9D
71
ABDOVF
RCIDL
RXDTP
TXCKP
BRG16
WUE
ABDEN
72
SPBRGHx
72
SPBRGx
72
Legend: = unimplemented locations read as 0. Shaded cells are not used for asynchronous transmission.
Note 1: These bits are only available in 80-pin and 100-pin devices; otherwise, they are unimplemented and read
as 0.
DS39762F-page 327
PIC18F97J60 FAMILY
21.2.2
EUSARTx ASYNCHRONOUS
RECEIVER
DS39762F-page 328
21.2.3
PIC18F97J60 FAMILY
FIGURE 21-6:
FERR
OERR
SPBRGHx
64
or
16
or
4
SPBRGx
RSR Register
MSb
Stop
(8)
LSb
1
Start
RX9
Pin Buffer
and Control
Data
Recovery
RXx
RX9D
RCREGx Register
FIFO
RXDTP SPEN
8
Interrupt
FIGURE 21-7:
Data Bus
RCxIF
RCxIE
RXx (pin)
bit 0
bit 1
Start
bit
bit 0
Word 1
RCREGx
Read Rcv
Buffer Reg
RCREGx
bit 7/8
Stop
bit
Start
bit
bit 7/8
Stop
bit
Word 2
RCREGx
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 Error) bit to be set.
TABLE 21-6:
Name
INTCON
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset Values
on Page:
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
69
PIR1
PSPIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
71
PIE1
PSPIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
71
IPR1
PSPIP
ADIP
RC1IP
TX1IP
SSP1IP
CCP1IP
TMR2IP
TMR1IP
71
PIR3
SSP2IF
BCL2IF
RC2IF(1)
TX2IF
TMR4IF
CCP5IF
CCP4IF
CCP3IF
71
PIE3
SSP2IE
BCL2IE
RC2IE(1)
TX2IE
TMR4IE
CCP5IE
CCP4IE
CCP3IE
71
IPR3
SSP2IP
BCL2IP
RC2IP(1)
TX2IP
TMR4IP
CCP5IP
CCP4IP
CCP3IP
71
SPEN
RX9
SREN
CREN
ADDEN
FERR
OERR
RX9D
71
RCSTAx
RCREGx
TXSTAx
BAUDCONx ABDOVF
71
TX9
TXEN
SYNC
SENDB
BRGH
TRMT
TX9D
71
RCIDL
RXDTP
TXCKP
BRG16
WUE
ABDEN
72
SPBRGHx
72
SPBRGx
72
Legend: = unimplemented locations read as 0. Shaded cells are not used for asynchronous reception.
Note 1: These bits are only available in 80-pin and 100-pin devices; otherwise, they are unimplemented and read as 0.
DS39762F-page 329
PIC18F97J60 FAMILY
21.2.4
21.2.4.1
21.2.4.2
DS39762F-page 330
PIC18F97J60 FAMILY
FIGURE 21-8:
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
Auto-Cleared
WUE bit(1)
RXx/DTx Line
RCxIF
Note 1: The EUSARTx remains in Idle while the WUE bit is set.
FIGURE 21-9:
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
WUE bit(2)
Auto-Cleared
RXx/DTx Line
Note 1
RCxIF
SLEEP Command Executed
Note 1:
2:
Sleep Ends
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.
The EUSARTx remains in Idle while the WUE bit is set.
DS39762F-page 331
PIC18F97J60 FAMILY
21.2.5
21.2.5.1
FIGURE 21-10:
1.
2.
3.
4.
5.
21.2.6
Write to TXREGx
Dummy Write
BRG Output
(Shift Clock)
TXx (pin)
Start bit
bit 0
bit 1
bit 11
Stop bit
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)
DS39762F-page 332
PIC18F97J60 FAMILY
21.3
EUSARTx Synchronous
Master Mode
21.3.1
2.
3.
4.
5.
6.
EUSARTx SYNCHRONOUS
MASTER TRANSMISSION
FIGURE 21-11:
7.
8.
SYNCHRONOUS TRANSMISSION
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
RC7/RX1/DT1
bit 0
bit 1
Word 1
RC6/TX1/CK1 pin
(TXCKP = 0)
bit 2
Q3 Q4 Q1 Q2 Q3 Q4 Q1Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
bit 7
bit 0
bit 1
bit 7
Word 2
RC6/TX1/CK1 pin
(TXCKP = 1)
Write to
TXREG1 Reg
Write Word 1
Write Word 2
TX1IF bit
(Interrupt Flag)
TRMT bit
TXEN bit
Note:
Sync Master mode, SPBRG1 = 0; continuous transmission of two 8-bit words. This example is equally applicable to EUSART2
(RG1/TX2/CK2 and RG2/RX2/DT2).
DS39762F-page 333
PIC18F97J60 FAMILY
FIGURE 21-12:
RC7/RX1/DT1 pin
bit 0
bit 1
bit 2
bit 6
bit 7
RC6/TX1/CK1 pin
Write to
TXREG1 reg
TX1IF bit
TRMT bit
TXEN bit
Note: This example is equally applicable to EUSART2 (RG1/TX2/CK2 and RG2/RX2/DT2).
TABLE 21-7:
Name
INTCON
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
69
PIR1
PSPIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
71
PIE1
PSPIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
71
IPR1
PSPIP
ADIP
RC1IP
TX1IP
SSP1IP
CCP1IP
TMR2IP
TMR1IP
71
PIR3
SSP2IF
BCL2IF
RC2IF
TX2IF(1)
TMR4IF
CCP5IF
CCP4IF
CCP3IF
71
PIE3
SSP2IE
BCL2IE
RC2IE
TX2IE(1)
TMR4IE
CCP5IE
CCP4IE
CCP3IE
71
IPR3
SSP2IP
BCL2IP
RC2IP
TX2IP(1)
TMR4IP
CCP5IP
CCP4IP
CCP3IP
71
SPEN
RX9
SREN
CREN
ADDEN
FERR
OERR
RX9D
71
RCSTAx
TXREGx
TXSTAx
BAUDCONx ABDOVF
71
TX9
TXEN
SYNC
SENDB
BRGH
TRMT
TX9D
71
RCIDL
RXDTP
TXCKP
BRG16
WUE
ABDEN
72
SPBRGHx
72
SPBRGx
72
Legend: = unimplemented, read as 0. Shaded cells are not used for synchronous master transmission.
Note 1: These bits are only available in 80-pin and 100-pin devices; otherwise, they are unimplemented and read as 0.
DS39762F-page 334
PIC18F97J60 FAMILY
21.3.2
EUSARTx SYNCHRONOUS
MASTER RECEPTION
4.
2.
3.
FIGURE 21-13:
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
RC7/RX1/DT1
pin
bit 0
bit 1
bit 2
bit 3
bit 4
bit 5
bit 6
bit 7
RC6/TX1/CK1 pin
(TXCKP = 0)
RC6/TX1/CK1 pin
(TXCKP = 1)
Write to
SREN bit
SREN bit
CREN bit 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
(RG1/TX2/CK2 and RG2/RX2/DT2).
DS39762F-page 335
PIC18F97J60 FAMILY
TABLE 21-8:
Name
INTCON
Bit 6
GIE/GIEH PEIE/GIEL
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
TMR0IE
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
69
PIR1
PSPIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
71
PIE1
PSPIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
71
IPR1
PSPIP
ADIP
RC1IP
TX1IP
SSP1IP
CCP1IP
TMR2IP
TMR1IP
71
PIR3
SSP2IF
BCL2IF
RC2IF(1)
TX2IF
TMR4IF
CCP5IF
CCP4IF
CCP3IF
71
(1)
TX2IE
TMR4IE
CCP5IE
CCP4IE
CCP3IE
71
TX2IP
TMR4IP
CCP5IP
CCP4IP
CCP3IP
71
CREN
ADDEN
FERR
OERR
RX9D
71
PIE3
SSP2IE
BCL2IE
RC2IE
IPR3
SSP2IP
BCL2IP
RC2IP(1)
RCSTAx
RCREGx
TXSTAx
SPEN
RX9
SREN
BAUDCONx ABDOVF
71
TX9
TXEN
SYNC
SENDB
BRGH
TRMT
TX9D
71
RCIDL
RXDTP
TXCKP
BRG16
WUE
ABDEN
72
SPBRGHx
72
SPBRGx
72
Legend: = unimplemented, read as 0. Shaded cells are not used for synchronous master reception.
Note 1: These bits are only available in 80-pin and 100-pin devices; otherwise, they are unimplemented and read as 0.
DS39762F-page 336
PIC18F97J60 FAMILY
21.4
EUSARTx Synchronous
Slave Mode
1.
2.
3.
21.4.1
EUSARTx SYNCHRONOUS
SLAVE TRANSMISSION
4.
5.
6.
7.
8.
a)
b)
c)
d)
e)
TABLE 21-9:
Name
INTCON
9.
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
69
PIR1
PSPIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
71
PIE1
PSPIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
71
IPR1
PSPIP
ADIP
RC1IP
TX1IP
SSP1IP
CCP1IP
TMR2IP
TMR1IP
71
PIR3
SSP2IF
BCL2IF
RC2IF
TX2IF(1)
TMR4IF
CCP5IF
CCP4IF
CCP3IF
71
PIE3
SSP2IE
BCL2IE
RC2IE
TX2IE(1)
TMR4IE
CCP5IE
CCP4IE
CCP3IE
71
(1)
IPR3
RCSTAx
TXREGx
TXSTAx
SSP2IP
BCL2IP
RC2IP
SPEN
RX9
SREN
TX2IP
TMR4IP
CCP5IP
CCP4IP
CCP3IP
71
CREN
ADDEN
FERR
OERR
RX9D
71
BAUDCONx ABDOVF
71
TX9
TXEN
SYNC
SENDB
BRGH
TRMT
TX9D
71
RCIDL
RXDTP
TXCKP
BRG16
WUE
ABDEN
72
SPBRGHx
72
SPBRGx
72
Legend: = unimplemented, read as 0. Shaded cells are not used for synchronous slave transmission.
Note 1: These bits are only available in 80-pin and 100-pin devices; otherwise, they are unimplemented and read as 0.
DS39762F-page 337
PIC18F97J60 FAMILY
21.4.2
Bit 7
Bit 6
Bit 5
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
69
PIR1
PSPIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
71
PIE1
PSPIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
71
IPR1
PSPIP
ADIP
RC1IP
TX1IP
SSP1IP
CCP1IP
TMR2IP
TMR1IP
71
TX2IF
TMR4IF
CCP5IF
CCP4IF
CCP3IF
71
TX2IE
TMR4IE
CCP5IE
CCP4IE
CCP3IE
71
INTCON
Bit 4
PIR3
SSP2IF
BCL2IF
RC2IF(1)
PIE3
SSP2IE
BCL2IE
RC2IE(1)
SSP2IP
BCL2IP
RC2IP(1)
TX2IP
TMR4IP
CCP5IP
CCP4IP
CCP3IP
71
SPEN
RX9
SREN
CREN
ADDEN
FERR
OERR
RX9D
71
IPR3
RCSTAx
RCREGx
TXSTAx
BAUDCONx ABDOVF
71
TX9
TXEN
SYNC
SENDB
BRGH
TRMT
TX9D
71
RCIDL
RXDTP
TXCKP
BRG16
WUE
ABDEN
72
SPBRGHx
72
SPBRGx
72
Legend: = unimplemented, read as 0. Shaded cells are not used for synchronous slave reception.
Note 1: These bits are only available in 80-pin and 100-pin devices; otherwise, they are unimplemented and read as 0.
DS39762F-page 338
PIC18F97J60 FAMILY
22.0
10-BIT ANALOG-TO-DIGITAL
CONVERTER (A/D) MODULE
REGISTER 22-1:
R/W-0
U-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
ADCAL
CHS3
CHS2
CHS1
CHS0
GO/DONE
ADON
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
Unimplemented: Read as 0
bit 5-2
bit 1
bit 0
Note 1:
2:
3:
x = Bit is unknown
DS39762F-page 339
PIC18F97J60 FAMILY
REGISTER 22-2:
U-0
U-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
VCFG1
VCFG0
PCFG3
PCFG2
PCFG1
PCFG0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
PCFG<3:0>
AN8
AN7
AN6
AN5(2)
AN4
AN3
AN2
AN1(3)
AN0(3)
bit 3-0
AN10
AN11
bit 4
AN12(1)
AN13(1)
bit 5
AN14(1)
Unimplemented: Read as 0
AN15(1)
bit 7-6
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
A
D
D
D
D
D
D
D
D
D
D
D
D
D
D
D
A
D
D
D
D
D
D
D
D
D
D
D
D
D
D
D
A
A
D
D
D
D
D
D
D
D
D
D
D
D
D
D
A
A
A
D
D
D
D
D
D
D
D
D
D
D
D
D
A
A
A
A
D
D
D
D
D
D
D
D
D
D
D
D
A
A
A
A
A
D
D
D
D
D
D
D
D
D
D
D
A
A
A
A
A
A
D
D
D
D
D
D
D
D
D
D
A
A
A
A
A
A
A
D
D
D
D
D
D
D
D
D
A
A
A
A
A
A
A
A
D
D
D
D
D
D
D
D
A
A
A
A
A
A
A
A
A
D
D
D
D
D
D
D
A
A
A
A
A
A
A
A
A
A
D
D
D
D
D
D
A
A
A
A
A
A
A
A
A
A
A
D
D
D
D
D
A
A
A
A
A
A
A
A
A
A
A
A
D
D
D
D
A
A
A
A
A
A
A
A
A
A
A
A
A
D
D
D
A
A
A
A
A
A
A
A
A
A
A
A
A
A
D
D
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
D
A = Analog input
Note 1:
2:
3:
x = Bit is unknown
D = Digital I/O
AN12 through AN15 are available in 80-pin and 100-pin devices only.
AN5 is available in 100-pin devices only.
AN0 and AN1 can also operate as Ethernet LED outputs in either Analog or Digital I/O modes.
DS39762F-page 340
PIC18F97J60 FAMILY
REGISTER 22-3:
R/W-0
U-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
ADFM
ACQT2
ACQT1
ACQT0
ADCS2
ADCS1
ADCS0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
Unimplemented: Read as 0
bit 5-3
bit 2-0
Note 1:
x = Bit is unknown
If the A/D FRC clock source is selected, a delay of one TCY (instruction cycle) is added before the A/D
clock starts. This allows the SLEEP instruction to be executed before starting a conversion.
DS39762F-page 341
PIC18F97J60 FAMILY
The analog reference voltage is software selectable to
either the devices positive and negative supply voltage
(AVDD and AVSS), or the voltage level on the
RA3/AN3/VREF+ and RA2/AN2/VREF- pins.
the A/D conversion. When the A/D conversion is complete, the result is loaded into the ADRESH:ADRESL
register pair, the GO/DONE bit (ADCON0<1>) is
cleared and the A/D Interrupt Flag bit, ADIF, is set.
The output of the sample and hold is the input into the
converter, which generates the result via successive
approximation.
FIGURE 22-1:
AN14(1)
1101
AN13(1)
1100
AN12(1)
1011
AN11
1010
1001
1000
0111
0110
0101
0100
VAIN
0011
(Input Voltage)
10-Bit
A/D
Converter
0010
0001
VCFG<1:0>
0000
VDD
Reference
Voltage
AN15(1)
AN10
AN9
AN8
AN7
AN6
AN5(2)
AN4
AN3
AN2
AN1
AN0
VREF+
VREFVSS
Note 1:
2:
DS39762F-page 342
PIC18F97J60 FAMILY
After the A/D module has been configured as desired,
the selected channel must be acquired before the
conversion is started. The analog input channels must
have their corresponding TRIS bits selected as inputs.
To determine acquisition time, see Section 22.1 A/D
Acquisition Requirements. After this acquisition
time has elapsed, the A/D conversion can be started.
An acquisition time can be programmed to occur
between setting the GO/DONE bit and the actual start
of the conversion.
2.
3.
4.
5.
FIGURE 22-2:
6.
7.
RS
VAIN
Sampling
Switch
VT = 0.6V
ANx
RIC 1k
CPIN
5 pF
VT = 0.6V
SS
RSS
ILEAKAGE
100 nA
CHOLD = 25 pF
VSS
Legend:
CPIN
= Input Capacitance
= Threshold Voltage
VT
ILEAKAGE = Leakage Current at the pin due to
various junctions
= Interconnect Resistance
RIC
= Sampling Switch
SS
= Sample/Hold Capacitance (from DAC)
CHOLD
RSS
= Sampling Switch Resistance
VDD
1
2
3
4
Sampling Switch (k
DS39762F-page 343
PIC18F97J60 FAMILY
22.1
EQUATION 22-1:
CHOLD
Rs
Conversion Error
VDD
Temperature
=
=
=
=
25 pF
2.5 k
1/2 LSb
3V Rss = 2 k
85C (system max.)
ACQUISITION TIME
TAMP + TC + TCOFF
EQUATION 22-2:
VHOLD
or
TC
Note:
TACQ
EQUATION 22-3:
TACQ
TAMP + TC + TCOFF
TAMP
0.2 s
TCOFF
Temperature coefficient is only required for temperatures > 25C. Below 25C, TCOFF = 0 ms.
TC
TACQ
0.2 s + 1 s + 1.2 s
2.4 s
DS39762F-page 344
PIC18F97J60 FAMILY
22.2
22.3
2 TOSC
4 TOSC
8 TOSC
16 TOSC
32 TOSC
64 TOSC
Internal RC Oscillator
TABLE 22-1:
ADCS<2:0>
Maximum
Device
Frequency
2 TOSC
000
2.86 MHz
4 TOSC
100
5.71 MHz
8 TOSC
001
11.43 MHz
16 TOSC
101
22.86 MHz
32 TOSC
010
41.67 MHz
64 TOSC
110
41.67 MHz
RC(2)
x11
1.00 MHz(1)
Note 1:
2:
22.4
DS39762F-page 345
PIC18F97J60 FAMILY
22.5
A/D Conversions
22.6
FIGURE 22-3:
TCY TAD TAD1 TAD2 TAD3 TAD4 TAD5 TAD6 TAD7 TAD8 TAD9 TAD10 TAD11
b4
b1
b0
b6
b7
b2
b9
b8
b3
b5
Conversion starts
Holding capacitor is disconnected from analog input (typically 100 ns)
Set GO/DONE bit
Next Q4: ADRESH/ADRESL is loaded, GO/DONE bit is cleared,
ADIF bit is set, holding capacitor is connected to analog input.
FIGURE 22-4:
TACQT Cycles
1
Automatic
Acquisition
Time
TAD Cycles
4
10
11
b8
b7
b6
b5
b4
b3
b2
b1
b0
Conversion starts
(Holding capacitor is disconnected)
DS39762F-page 346
2
b9
PIC18F97J60 FAMILY
22.7
22.8
Operation in Power-Managed
Modes
TABLE 22-2:
Name
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
TMR0IE
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
69
PIR1
PSPIF
ADIF
RC1IF
TX1IF
SSP1IF
CCP1IF
TMR2IF
TMR1IF
71
PIE1
PSPIE
ADIE
RC1IE
TX1IE
SSP1IE
CCP1IE
TMR2IE
TMR1IE
71
IPR1
PSPIP
ADIP
RC1IP
TX1IP
SSP1IP
CCP1IP
TMR2IP
TMR1IP
71
INTCON
GIE/GIEH PEIE/GIEL
PIR2
OSCFIF
CMIF
ETHIF
BCL1IF
TMR3IF
CCP2IF
71
PIE2
OSCFIE
CMIE
ETHIE
BCL1IE
TMR3IE
CCP2IE
71
IPR2
OSCFIP
CMIP
ETHIP
BCL1IP
TMR3IP
CCP2IP
71
ADRESH
70
ADRESL
70
ADCON0
ADCAL
CHS3
CHS3
CHS1
CHS0
GO/DONE
ADON
70
ADCON1
VCFG1
VCFG0
PCFG3
PCFG2
PCFG1
PCFG0
70
ADCON2
ADFM
ACQT2
ACQT1
ACQT0
ADCS2
ADCS1
ADCS0
70
CCP2CON
P2M1
P2M0
DC2B1
DC2B0
CCP2M3
CCP2M2
CCP2M1
CCP2M0
70
PORTA
RJPU
RA5
RA4
RA3
RA2
RA1
RA0
72
TRISA
TRISA5
TRISA4
TRISA3
TRISA2
TRISA1
TRISA0
71
PORTF
RF7
RF6
RF5
RF4
RF3
RF2
RF1
TRISF
TRISF7
TRISF6
TRISF5
TRISF4
TRISF3
TRISF2
TRISF1
RF0
(1)
72
TRISF0(1)
71
PORTH(2)
RH7
RH6
RH5
RH4
RH3
RH2
RH1
RH0
72
TRISH(2)
TRISH7
TRISH6
TRISH5
TRISH4
TRISH3
TRISH2
TRISH1
TRISH0
71
Legend: = unimplemented, read as 0, r = reserved. Shaded cells are not used for A/D conversion.
Note 1: Implemented in 100-pin devices only.
2: This register is not implemented in 64-pin devices.
DS39762F-page 347
PIC18F97J60 FAMILY
NOTES:
DS39762F-page 348
PIC18F97J60 FAMILY
23.0
COMPARATOR MODULE
REGISTER 23-1:
R-0
R-0
R/W-0
R/W-0
R/W-0
R/W-1
R/W-1
R/W-1
C2OUT
C1OUT
C2INV
C1INV
CIS
CM2
CM1
CM0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4
bit 3
bit 2-0
x = Bit is unknown
DS39762F-page 349
PIC18F97J60 FAMILY
23.1
Comparator Configuration
There are eight modes of operation for the comparators, shown in Figure 23-1. Bits CM<2:0> of the
CMCON register are used to select these modes. The
TRISF register controls the data direction of the
comparator pins for each mode. If the Comparator
FIGURE 23-1:
RF5/AN10/ A
CVREF
RF4/AN9
RF3/AN8
VINVIN+
VIN-
VIN+
C1
Off (Read as 0)
C2
Off (Read as 0)
VIN+
VIN-
VIN+
RF3/AN8
RF6/AN11
VIN-
RF5/AN10/
CVREF
VIN+
RF4/AN9
VIN-
VIN+
RF3/AN8
C1
Off (Read as 0)
C2
Off (Read as 0)
VIN-
RF5/AN10/ A
CVREF
RF4/AN9
Note:
RF6/AN11
VIN-
C1
C1OUT
VIN+
RF5/AN10/ A
CVREF
RF2/AN7/C1OUT*
C2
C2OUT
RF4/AN9
VIN-
RF3/AN8
VIN+
C1
C1OUT
C2
C2OUT
RF1/AN6/C2OUT*
Two Common Reference Comparators
CM<2:0> = 100
RF6/AN11
VIN-
RF5/AN10/ A
CVREF
VIN+
VIN-
VIN+
RF4/AN9
RF3/AN8
C1
C1OUT
C2
C2OUT
A
RF5/AN10/
CVREF
RF2/AN7/C1OUT*
RF4/AN9
RF3/AN8
VINVIN+
VIN-
VIN+
C1
C1OUT
C2
C2OUT
RF1/AN6/C2OUT*
One Independent Comparator with Output
CM<2:0> = 001
A
VIN-
RF5/AN10/ A
CVREF
VIN+
RF6/AN11
C1
C1OUT
RF2/AN7/C1OUT*
RF4/AN9
VIN-
RF3/AN8
VIN+
C2
Off (Read as 0)
RF5/AN10/
CVREF
RF4/AN9
RF3/AN8
CIS = 0
CIS = 1
VIN-
CIS = 0
CIS = 1
VIN-
VIN+
VIN+
C1
C1OUT
C2
C2OUT
CVREF
DS39762F-page 350
PIC18F97J60 FAMILY
23.2
23.3.2
Comparator Operation
23.3
Comparator Reference
FIGURE 23-2:
SINGLE COMPARATOR
VIN+
VIN-
Output
VINVIN+
Output
23.3.1
23.4
23.5
Comparator Outputs
DS39762F-page 351
PIC18F97J60 FAMILY
To CxOUT
pin
Port Pins
MULTIPLEX
FIGURE 23-3:
Bus
Data
CxINV
Read CMCON
EN
EN
CL
From
Other
Comparator
Reset
23.6
Comparator Interrupts
Set
CMIF
bit
23.7
Comparator Operation
During Sleep
23.8
Effects of a Reset
DS39762F-page 352
PIC18F97J60 FAMILY
23.9
FIGURE 23-4:
RS < 10k
AIN
CPIN
5 pF
VA
VT = 0.6V
RIC
Comparator
Input
ILEAKAGE
500 nA
VSS
Legend:
TABLE 23-1:
Name
INTCON
CPIN
VT
ILEAKAGE
RIC
RS
VA
=
=
=
=
=
=
Input Capacitance
Threshold Voltage
Leakage Current at the pin due to various junctions
Interconnect Resistance
Source Impedance
Analog Voltage
Bit 6
GIE/GIEH PEIE/GIEL
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
TMR0IE
INT0IE
RBIE
TMR0IF
INT0IF
RBIF
69
PIR2
OSCFIF
CMIF
ETHIF
BCL1IF
TMR3IF
CCP2IF
71
PIE2
OSCFIE
CMIE
ETHIE
BCL1IE
TMR3IE
CCP2IE
71
IPR2
OSCFIP
CMIP
ETHIP
BCL1IP
TMR3IP
CCP2IP
71
CMCON
C2OUT
C1OUT
C2INV
C1INV
CIS
CM2
CM1
CM0
70
CVRCON
CVREN
CVROE
CVRR
CVRSS
CVR3
CVR2
CVR1
CVR0
70
PORTF
RF7
RF6
RF5
RF4
RF3
RF2
RF1
RF0
72
TRISF
TRISF7
TRISF6
TRISF5
TRISF4
TRISF3
TRISF2
TRISF1
TRISF0
71
Legend: = unimplemented, read as 0, r = reserved. Shaded cells are not used by the comparator module.
DS39762F-page 353
PIC18F97J60 FAMILY
NOTES:
DS39762F-page 354
PIC18F97J60 FAMILY
24.0
COMPARATOR VOLTAGE
REFERENCE MODULE
24.1
REGISTER 24-1:
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
R/W-0
CVREN
CVROE(1)
CVRR
CVRSS
CVR3
CVR2
CVR1
CVR0
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
bit 4
bit 3-0
Note 1:
DS39762F-page 355
PIC18F97J60 FAMILY
FIGURE 24-1:
CVRSS = 1
8R
CVRSS = 0
CVR<3:0>
R
CVREN
R
R
16-to-1 MUX
R
16 Steps
CVREF
R
R
CVRR
VREF-
8R
CVRSS = 1
CVRSS = 0
24.2
24.3
24.4
Effects of a Reset
24.5
Connection Considerations
DS39762F-page 356
PIC18F97J60 FAMILY
FIGURE 24-2:
Note 1:
TABLE 24-1:
Name
CVRCON
R(1)
Voltage
Reference
Output
Impedance
RF5
CVREF Output
R is dependent upon the comparator voltage reference configuration bits, CVRCON<5> and CVRCON<3:0>.
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Reset
Values
on Page:
CVREN
CVROE
CVRR
CVRSS
CVR3
CVR2
CVR1
CVR0
70
CMCON
C2OUT
C1OUT
C2INV
C1INV
CIS
CM2
CM1
CM0
70
TRISF
TRISF7
TRISF6
TRISF5
TRISF4
TRISF3
TRISF2
TRISF1
TRISF0
71
Legend: = unimplemented, read as 0. Shaded cells are not used with the comparator voltage reference module.
DS39762F-page 357
PIC18F97J60 FAMILY
NOTES:
DS39762F-page 358
PIC18F97J60 FAMILY
25.0
25.1
Configuration Bits
25.1.1
CONSIDERATIONS FOR
CONFIGURING THE PIC18F97J60
FAMILY DEVICES
Devices of the PIC18F97J60 family do not use persistent memory registers to store configuration information.
The configuration bytes are implemented as volatile
memory which means that configuration data must be
programmed each time the device is powered up.
Configuration data is stored in the four words at the top
of the on-chip program memory space, known as the
Flash Configuration Words, which are located in the
program memory space, as shown in Table 6-1. The
Configuration Words are stored in the same order
shown in Table 25-1, with CONFIG1L at the lowest
address and CONFIG3H at the highest. The data is
automatically loaded in the proper Configuration
registers during device power-up.
When creating applications for these devices, users
should always specifically allocate the location of the
Flash Configuration Word for configuration data. This is
to make certain that program code is not stored in this
address when the code is compiled.
The volatile memory cells used for the Configuration
bits always reset to 1 on Power-on Resets. For all
other types of Reset events, the previously programmed values are maintained and used without
reloading from program memory.
The four Most Significant bits of CONFIG1H,
CONFIG2H and CONFIG3H, in program memory,
should also be 1111. This makes these Configuration
Words appear to be NOP instructions in the remote
event that their locations are ever executed by
accident. Since Configuration bits are not implemented
in the corresponding locations, writing 1s to these
locations has no effect on device operation.
To prevent inadvertent configuration changes during
code execution, all programmable Configuration bits
are write-once. After a bit is initially programmed during
a power cycle, it cannot be written to again. Changing
a device configuration requires that power to the device
be cycled.
DS39762F-page 359
PIC18F97J60 FAMILY
TABLE 25-1:
File Name
300000h
CONFIG1L
Default/
Unprogrammed
Value(1)
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
DEBUG
XINST
STVREN
WDTEN
110- ---1
(2)
(2)
(2)
(2)
(3)
300001h
CONFIG1H
CP0
---- 01--
300002h
CONFIG2L
IESO
FCMEN
FOSC2
FOSC1
FOSC0
11-- -111
300003h
CONFIG2H
(2)
(2)
(2)
(2)
WDTPS3
WDTPS2
WDTPS1
WDTPS0
---- 1111
300004h
CONFIG3L
WAIT(4)
BW(4)
EMB1(4)
1111 1---
300005h
CONFIG3H
(2)
(2)
(2)
(2)
3FFFFEh DEVID1
DEV2
DEV1
DEV0
REV4
REV3
REV2
REV1
REV0
xxxx xxxx(6)
3FFFFFh DEVID2
DEV10
DEV9
DEV8
DEV7
DEV6
DEV5
DEV4
DEV3
xxxx xxxx(6)
Legend:
Note 1:
2:
3:
4:
5:
6:
EMB0(4) EASHFT(4)
DS39762F-page 360
PIC18F97J60 FAMILY
REGISTER 25-1:
R/WO-1
R/WO-1
R/WO-0
U-0
U-0
U-0
U-0
R/WO-1
DEBUG
XINST
STVREN
WDTEN
bit 7
bit 0
Legend:
R = Readable bit
WO = Write-Once bit
0 = Bit is cleared
bit 7
bit 6
bit 5
bit 4-1
Unimplemented: Read as 0
bit 0
REGISTER 25-2:
U-0
U-0
U-0
U-0
U-0(1)
R/WO-1
U-0
U-0
(2)
(2)
(2)
(2)
CP0
bit 7
bit 0
Legend:
R = Readable bit
WO = Write-Once bit
Unimplemented: Read as 0
bit 2
bit 1-0
Unimplemented: Read as 0
Note 1:
2:
0 = Bit is cleared
DS39762F-page 361
PIC18F97J60 FAMILY
REGISTER 25-3:
R/WO-1
R/WO-1
U-0
U-0
U-0
R/WO-1
R/WO-1
R/WO-1
IESO
FCMEN
FOSC2
FOSC1
FOSC0
bit 7
bit 0
Legend:
R = Readable bit
WO = Write-Once bit
0 = Bit is cleared
bit 7
bit 6
bit 5-3
Unimplemented: Read as 0
bit 2
bit 1-0
DS39762F-page 362
PIC18F97J60 FAMILY
REGISTER 25-4:
U-0
U-0
U-0
U-0
R/WO-1
R/WO-1
R/WO-1
R/WO-1
(1)
(1)
(1)
(1)
WDTPS3
WDTPS2
WDTPS1
WDTPS0
bit 7
bit 0
Legend:
R = Readable bit
WO = Write-Once bit
bit 7-4
Unimplemented: Read as 0
bit 3-0
Note 1:
0 = Bit is cleared
The value of these bits in program memory should always be 1. This ensures that the location is
executed as a NOP if it is accidentally executed.
DS39762F-page 363
PIC18F97J60 FAMILY
REGISTER 25-5:
R/WO-1
R/WO-1
(1)
BW
WAIT
(1)
R/WO-1
R/WO-1
(1)
(1)
EMB1
EMB0
R/WO-1
EASHFT
(1)
U-0
U-0
U-0
bit 7
bit 0
Legend:
R = Readable bit
WO = Write-Once bit
0 = Bit is cleared
bit 7
bit 6
bit 5-4
bit 3
bit 2-0
Unimplemented: Read as 0
Note 1:
DS39762F-page 364
PIC18F97J60 FAMILY
REGISTER 25-6:
U-0
U-0
U-0
U-0
(1)
(1)
(1)
(1)
U-0
R/WO-1
ETHLED
R/WO-1
ECCPMX
(2)
R/WO-1
CCP2MX(2)
bit 7
bit 0
Legend:
R = Readable bit
WO = Write-Once bit
0 = Bit is cleared
bit 7-3
Unimplemented: Read as 0
bit 2
bit 1
bit 0
Note 1:
2:
The value of these bits in program memory should always be 1. This ensures that the location is
executed as a NOP if it is accidentally executed.
Implemented in 80-pin and 100-pin devices only.
DS39762F-page 365
PIC18F97J60 FAMILY
REGISTER 25-7:
DEV2
DEV1
DEV0
REV4
REV3
REV2
REV1
REV0
bit 7
bit 0
Legend:
R = Read-only bit
P = Programmable bit
bit 7-5
bit 4-0
REGISTER 25-8:
DEV10
DEV9
DEV8
DEV7
DEV6
DEV5
DEV4
DEV3
bit 7
bit 0
Legend:
R = Read-only bit
P = Programmable bit
DS39762F-page 366
DEV<10:3>
(DEVID2<7:0>)
DEV<2:0>
(DEVID1<7:5>)
Device
0001 1000
000
PIC18F66J60
0001 1111
000
PIC18F66J65
0001 1111
001
PIC18F67J60
0001 1000
001
PIC18F86J60
0001 1111
010
PIC18F86J65
0001 1111
011
PIC18F87J60
0001 1000
010
PIC18F96J60
0001 1111
100
PIC18F96J65
0001 1111
101
PIC18F97J60
PIC18F97J60 FAMILY
25.2
FIGURE 25-1:
SWDTEN
25.2.1
CONTROL REGISTER
INTRC Control
WDT Counter
INTRC Oscillator
Wake-up from
Power-Managed
Modes
128
Programmable Postscaler
1:1 to 1:32,768
CLRWDT
All Device Resets
Reset
WDT
Reset
WDT
WDTPS<3:0>
Sleep
DS39762F-page 367
PIC18F97J60 FAMILY
REGISTER 25-9:
U-0
U-0
U-0
U-0
U-0
U-0
U-0
R/W-0
SWDTEN(1)
bit 7
bit 0
Legend:
R = Readable bit
W = Writable bit
-n = Value at POR
1 = Bit is set
0 = Bit is cleared
bit 7-1
Unimplemented: Read as 0
bit 0
Note 1:
TABLE 25-2:
Name
RCON
WDTCON
x = Bit is unknown
Reset Values
on Page:
POR
BOR
70
SWDTEN
70
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
IPEN
CM
RI
TO
PD
Legend: = unimplemented, read as 0. Shaded cells are not used by the Watchdog Timer.
DS39762F-page 368
PIC18F97J60 FAMILY
25.3
25.3.1
FIGURE 25-2:
(VDD = VDDCORE)
2.5V(1)
PIC18FXXJ6X
VDD
25.3.2
POWER-UP REQUIREMENTS
VSS
ENVREG
VDDCORE/VCAP
VSS
Note 1:
DS39762F-page 369
PIC18F97J60 FAMILY
25.4
Two-Speed Start-up
25.4.1
FIGURE 25-3:
Q2
Q3
Q4
Q2 Q3 Q4 Q1 Q2 Q3
Q1
INTRC
OSC1
TOST(1)
TPLL(1)
1
PLL Clock
Output
n-1 n
Clock
Transition
CPU Clock
Peripheral
Clock
Program
Counter
PC
DS39762F-page 370
PC + 2
PC + 4
PC + 6
TOST = 1024 TOSC; TPLL = 2 ms (approx). These intervals are not shown to scale.
PIC18F97J60 FAMILY
25.5
FIGURE 25-4:
Peripheral
Clock
INTRC
Source
64
(32 s)
488 Hz
(2.048 ms)
The FSCM will detect failures of the primary or secondary clock sources only. If the internal oscillator block
fails, no failure would be detected, nor would any action
be possible.
25.5.1
25.5.2
Clock
Failure
Detected
DS39762F-page 371
PIC18F97J60 FAMILY
FIGURE 25-5:
Sample Clock
Oscillator
Failure
Device
Clock
Output
CM Output
(Q)
Failure
Detected
OSCFIF
CM Test
Note:
25.5.3
CM Test
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.
FSCM INTERRUPTS IN
POWER-MANAGED MODES
25.5.4
CM Test
DS39762F-page 372
The same logic that prevents false oscillator failure interrupts on POR, or wake from
Sleep, will also prevent the detection of
the oscillators failure to start at all following these events. This can be avoided by
monitoring the OSTS bit and using a
timing routine to determine if the oscillator
is taking too long to start. Even so, no
oscillator failure interrupt will be flagged.
PIC18F97J60 FAMILY
25.6
25.6.1
CONFIGURATION REGISTER
PROTECTION
25.7
25.8
In-Circuit Debugger
TABLE 25-3:
DEBUGGER RESOURCES
I/O pins:
RB6, RB7
Stack:
2 levels
Program Memory:
512 bytes
Data Memory:
10 bytes
DS39762F-page 373
PIC18F97J60 FAMILY
NOTES:
DS39762F-page 374
PIC18F97J60 FAMILY
26.0
26.1
Byte-oriented operations
Bit-oriented operations
Literal operations
Control operations
The file register designator f specifies which file register is to be used by the instruction. The destination
designator d specifies where the result of the
operation is to be placed. If d is zero, the result is
placed in the WREG register. If d is one, the result is
placed in the file register specified in the instruction.
All bit-oriented instructions have three operands:
1.
2.
3.
DS39762F-page 375
PIC18F97J60 FAMILY
TABLE 26-1:
Field
Description
bbb
BSR
C, DC, Z, OV, N
dest
Destination: either the WREG register or the specified register file location.
8-bit Register file address (00h to FFh), or 2-bit FSR designator (0h to 3h).
fs
12-bit Register file address (000h to FFFh). This is the source address.
fd
12-bit Register file address (000h to FFFh). This is the destination address.
GIE
Literal field, constant data or label (may be either an 8-bit, 12-bit or a 20-bit value).
label
Label name.
mm
The mode of the TBLPTR register for the table read and table write instructions.
Only used with table read and table write instructions:
*+
*-
+*
n
The relative address (2s complement number) for relative branch instructions or the direct address for
Call/Branch and Return instructions.
PC
Program Counter.
PCL
PCH
PCLATH
PCLATU
PD
Power-Down bit.
PRODH
PRODL
TBLPTR
TABLAT
TO
Time-out bit.
TOS
Top-of-Stack.
Unused or Unchanged.
WDT
Watchdog Timer.
WREG
Dont care (0 or 1). The assembler will generate code with x = 0. It is the recommended form of use for
compatibility with all Microchip software tools.
zs
zd
{
Optional argument.
[text]
(text)
[expr]<n>
Assigned to.
< >
italics
DS39762F-page 376
PIC18F97J60 FAMILY
FIGURE 26-1:
10
OPCODE
Example Instruction
8 7
f (FILE #)
ADDWF MYREG, W, B
12 11
OPCODE
15
f (Source FILE #)
12 11
f (Destination FILE #)
1111
12 11
9 8 7
OPCODE b (BIT #) a
f (FILE #)
OPCODE
k (literal)
MOVLW 7Fh
8 7
OPCODE
15
n<7:0> (literal)
12 11
GOTO Label
0
n<19:8> (literal)
1111
8 7
S
OPCODE
15
0
n<7:0> (literal)
12 11
CALL MYFUNC
0
n<19:8> (literal)
1111
S = Fast bit
15
11 10
OPCODE
15
0
n<10:0> (literal)
8 7
OPCODE
BRA MYFUNC
0
n<7:0> (literal)
BC MYFUNC
DS39762F-page 377
PIC18F97J60 FAMILY
TABLE 26-2:
Mnemonic,
Operands
Cycles
MSb
LSb
Status
Affected
Notes
BYTE-ORIENTED OPERATIONS
ADDWF
ADDWFC
ANDWF
CLRF
COMF
CPFSEQ
CPFSGT
CPFSLT
DECF
DECFSZ
DCFSNZ
INCF
INCFSZ
INFSNZ
IORWF
MOVF
MOVFF
f, d, a
f, d, a
f, d, a
f, a
f, d, a
f, a
f, a
f, a
f, d, a
f, d, a
f, d, a
f, d, a
f, d, a
f, d, a
f, d, a
f, d, a
fs, fd
MOVWF
MULWF
NEGF
RLCF
RLNCF
RRCF
RRNCF
SETF
SUBFWB
f, a
f, a
f, a
f, d, a
f, d, a
f, d, a
f, d, a
f, a
f, d, a
f, d, a
SUBWF
SUBWFB f, d, a
1
1
1
1
1
1 (2 or 3)
1 (2 or 3)
1 (2 or 3)
1
1 (2 or 3)
1 (2 or 3)
1
1 (2 or 3)
1 (2 or 3)
1
1
2
C, DC, Z, OV, N
C, DC, Z, OV, N
Z, N
Z
Z, N
None
None
None
C, DC, Z, OV, N
None
None
C, DC, Z, OV, N
None
None
Z, N
Z, N
None
1, 2
1, 2
1,2
2
1, 2
4
4
1, 2
1, 2, 3, 4
1, 2, 3, 4
1, 2
1, 2, 3, 4
4
1, 2
1, 2
1
1
1
1
1
1
1
1
1
1
0010
0010
0001
0110
0001
0110
0110
0110
0000
0010
0100
0010
0011
0100
0001
0101
1100
1111
0110
0000
0110
0011
0100
0011
0100
0110
0101
01da
00da
01da
101a
11da
001a
010a
000a
01da
11da
11da
10da
11da
10da
00da
00da
ffff
ffff
111a
001a
110a
01da
01da
00da
00da
100a
01da
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
1
1
0101
0101
11da
10da
ffff
ffff
1
1 (2 or 3)
1
0011
0110
0001
10da
011a
10da
ffff
ffff
ffff
ffff None
ffff None
ffff Z, N
None
None
1, 2
C, DC, Z, OV, N
C, Z, N
1, 2
Z, N
C, Z, N
Z, N
None
1, 2
C, DC, Z, OV, N
4
1, 2
SWAPF
TSTFSZ
XORWF
f, d, a
f, a
f, d, a
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 an input and is
driven low by an external device, the data will be written back with a 0.
If this instruction is executed on the TMR0 register (and, where applicable, d = 1), the prescaler will be cleared if
assigned.
If Program Counter (PC) is modified or a conditional test is true, the instruction requires two cycles. The second
cycle is executed as a NOP.
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.
2:
3:
4:
DS39762F-page 378
PIC18F97J60 FAMILY
TABLE 26-2:
Mnemonic,
Operands
Description
Cycles
MSb
LSb
Status
Affected
Notes
BIT-ORIENTED OPERATIONS
BCF
BSF
BTFSC
BTFSS
BTG
f, b, a
f, b, a
f, b, a
f, b, a
f, b, a
Bit Clear f
Bit Set f
Bit Test f, Skip if Clear
Bit Test f, Skip if Set
Bit Toggle f
1
1
1 (2 or 3)
1 (2 or 3)
1
1001
1000
1011
1010
0111
bbba
bbba
bbba
bbba
bbba
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
ffff
None
None
None
None
None
1 (2)
1 (2)
1 (2)
1 (2)
1 (2)
1 (2)
1 (2)
2
1 (2)
2
0010
0110
0011
0111
0101
0001
0100
0nnn
0000
110s
kkkk
0000
0000
1111
kkkk
0000
xxxx
0000
0000
1nnn
0000
0000
nnnn
nnnn
nnnn
nnnn
nnnn
nnnn
nnnn
nnnn
nnnn
kkkk
kkkk
0000
0000
kkkk
kkkk
0000
xxxx
0000
0000
nnnn
1111
0001
nnnn
nnnn
nnnn
nnnn
nnnn
nnnn
nnnn
nnnn
nnnn
kkkk
kkkk
0100
0111
kkkk
kkkk
0000
xxxx
0110
0101
nnnn
1111
000s
None
None
None
None
None
None
None
None
None
None
1
1
1
1
2
1
2
1110
1110
1110
1110
1110
1110
1110
1101
1110
1110
1111
0000
0000
1110
1111
0000
1111
0000
0000
1101
0000
0000
2
2
1
0000
0000
0000
1100
0000
0000
kkkk
0001
0000
1, 2
1, 2
3, 4
3, 4
1, 2
CONTROL OPERATIONS
BC
BN
BNC
BNN
BNOV
BNZ
BOV
BRA
BZ
CALL
n
n
n
n
n
n
n
n
n
n, s
NOP
NOP
POP
PUSH
RCALL
RESET
RETFIE
n
s
Branch if Carry
Branch if Negative
Branch if Not Carry
Branch if Not Negative
Branch if Not Overflow
Branch if Not Zero
Branch if Overflow
Branch Unconditionally
Branch if Zero
Call Subroutine 1st word
2nd word
Clear Watchdog Timer
Decimal Adjust WREG
Go to Address 1st word
2nd word
No Operation
No Operation
Pop Top of Return Stack (TOS)
Push Top of Return Stack (TOS)
Relative Call
Software Device Reset
Return from Interrupt Enable
RETLW
RETURN
SLEEP
k
s
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 an input and is
driven low by an external device, the data will be written back with a 0.
If this instruction is executed on the TMR0 register (and, where applicable, d = 1), the prescaler will be cleared if
assigned.
If Program Counter (PC) is modified or a conditional test is true, the instruction requires two cycles. The second
cycle is executed as a NOP.
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.
CLRWDT
DAW
GOTO
n
2:
3:
4:
1
1
2
TO, PD
C
None
None
None
None
None
None
All
GIE/GIEH,
PEIE/GIEL
kkkk None
001s None
0011 TO, PD
DS39762F-page 379
PIC18F97J60 FAMILY
TABLE 26-2:
Mnemonic,
Operands
Description
Cycles
MSb
LSb
Status
Affected
Notes
LITERAL OPERATIONS
ADDLW
ANDLW
IORLW
LFSR
k
k
k
f, k
MOVLB
MOVLW
MULLW
RETLW
SUBLW
XORLW
k
k
k
k
k
k
1
1
1
2
1
1
1
2
1
1
0000
0000
0000
1110
1111
0000
0000
0000
0000
0000
0000
1111
1011
1001
1110
0000
0001
1110
1101
1100
1000
1010
kkkk
kkkk
kkkk
00ff
kkkk
0000
kkkk
kkkk
kkkk
kkkk
kkkk
kkkk
kkkk
kkkk
kkkk
kkkk
kkkk
kkkk
kkkk
kkkk
kkkk
kkkk
C, DC, Z, OV, N
Z, N
Z, N
None
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
1000
1001
1010
1011
1100
1101
1110
1111
None
None
None
None
None
None
None
None
None
None
None
None
C, DC, Z, OV, N
Z, N
2:
3:
4:
Table Read
2
Table Read with Post-Increment
Table Read with Post-Decrement
Table Read with Pre-Increment
Table Write
2
Table Write with Post-Increment
Table Write with Post-Decrement
Table Write with Pre-Increment
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 an input and is
driven low by an external device, the data will be written back with a 0.
If this instruction is executed on the TMR0 register (and, where applicable, d = 1), the prescaler will be cleared if
assigned.
If Program Counter (PC) is modified or a conditional test is true, the instruction requires two cycles. The second
cycle is executed as a NOP.
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.
DS39762F-page 380
PIC18F97J60 FAMILY
26.1.1
ADDLW
ADD Literal to W
ADDWF
ADD W to f
Syntax:
ADDLW
Syntax:
ADDWF
Operands:
0 f 255
d [0,1]
a [0,1]
Operation:
Status Affected:
N, OV, C, DC, Z
Operands:
0 k 255
Operation:
(W) + k W
Status Affected:
N, OV, C, DC, Z
Encoding:
0000
1111
kkkk
kkkk
Description:
Words:
Cycles:
Encoding:
0010
Description:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
literal k
Process
Data
Write to
W
Example:
ADDLW
01da
ffff
ffff
15h
Before Instruction
W
= 10h
After Instruction
W =
25h
f {,d {,a}}
Words:
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write to
destination
Example:
ADDWF
Before Instruction
W
=
REG
=
After Instruction
W
=
REG
=
Note:
REG, 0, 0
17h
0C2h
0D9h
0C2h
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).
DS39762F-page 381
PIC18F97J60 FAMILY
ADDWFC
ANDLW
Syntax:
ADDWFC
Syntax:
ANDLW
Operands:
0 f 255
d [0,1]
a [0,1]
f {,d {,a}}
Operation:
Status Affected:
N,OV, C, DC, Z
Encoding:
0010
Description:
00da
ffff
Words:
Cycles:
Operands:
0 k 255
Operation:
(W) .AND. k W
Status Affected:
N, Z
Encoding:
ffff
0000
1011
kkkk
kkkk
Description:
Words:
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read literal
k
Process
Data
Write to
W
Example:
ANDLW
Before Instruction
W
=
After Instruction
W
=
05Fh
A3h
03h
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write to
destination
Example:
ADDWFC
Before Instruction
Carry bit =
REG
=
W
=
After Instruction
Carry bit =
REG
=
W
=
DS39762F-page 382
REG, 0, 1
1
02h
4Dh
0
02h
50h
PIC18F97J60 FAMILY
ANDWF
AND W with f
BC
Branch if Carry
Syntax:
ANDWF
Syntax:
BC
Operands:
0 f 255
d [0,1]
a [0,1]
f {,d {,a}}
Operation:
Status Affected:
N, Z
Encoding:
0001
Description:
Operands:
-128 n 127
Operation:
if Carry bit is 1,
(PC) + 2 + 2n PC
Status Affected:
None
Encoding:
01da
ffff
ffff
1110
Description:
Words:
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write to
destination
Example:
ANDWF
Before Instruction
W
=
REG
=
After Instruction
W
=
REG
=
REG, 0, 0
17h
C2h
02h
C2h
0010
nnnn
nnnn
Words:
Cycles:
1(2)
Q Cycle Activity:
If Jump:
Q1
Q2
Q3
Q4
Decode
Read literal
n
Process
Data
Write to
PC
No
operation
No
operation
No
operation
No
operation
If No Jump:
Q1
Q2
Q3
Q4
Decode
Read literal
n
Process
Data
No
operation
Example:
HERE
Before Instruction
PC
After Instruction
If Carry
PC
If Carry
PC
BC
address (HERE)
=
=
=
=
1;
address (HERE + 12)
0;
address (HERE + 2)
DS39762F-page 383
PIC18F97J60 FAMILY
BCF
Bit Clear f
BN
Branch if Negative
Syntax:
BCF
Syntax:
BN
Operands:
0 f 255
0b7
a [0,1]
f, b {,a}
Operation:
0 f<b>
Status Affected:
None
Encoding:
1001
Description:
Operands:
-128 n 127
Operation:
if Negative bit is 1,
(PC) + 2 + 2n PC
Status Affected:
None
Encoding:
bbba
ffff
ffff
1110
Description:
Words:
Cycles:
1
Q1
Q2
Q3
Q4
Read
register f
Process
Data
Write
register f
Example:
BCF
Before Instruction
FLAG_REG = C7h
After Instruction
FLAG_REG = 47h
DS39762F-page 384
FLAG_REG,
7, 0
0110
nnnn
nnnn
Words:
Cycles:
1(2)
Q Cycle Activity:
If Jump:
Q1
Q2
Q3
Q4
Decode
Read literal
n
Process
Data
Write to
PC
No
operation
No
operation
No
operation
No
operation
Q Cycle Activity:
Decode
If No Jump:
Q1
Q2
Q3
Q4
Decode
Read literal
n
Process
Data
No
operation
Example:
HERE
Before Instruction
PC
After Instruction
If Negative
PC
If Negative
PC
BN
Jump
address (HERE)
=
=
=
=
1;
address (Jump)
0;
address (HERE + 2)
PIC18F97J60 FAMILY
BNC
BNN
Syntax:
BNC
Syntax:
BNN
Operands:
-128 n 127
Operands:
-128 n 127
Operation:
if Carry bit is 0,
(PC) + 2 + 2n PC
Operation:
if Negative bit is 0,
(PC) + 2 + 2n PC
Status Affected:
None
Status Affected:
None
Encoding:
1110
Description:
0011
nnnn
nnnn
Encoding:
1110
Description:
nnnn
nnnn
Words:
Words:
Cycles:
1(2)
Cycles:
1(2)
Q Cycle Activity:
If Jump:
0111
Q Cycle Activity:
If Jump:
Q1
Q2
Q3
Q4
Q1
Q2
Q3
Q4
Decode
Read literal
n
Process
Data
Write to
PC
Decode
Read literal
n
Process
Data
Write to
PC
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
Q1
Q2
Q3
Q4
Q1
Q2
Q3
Q4
Decode
Read literal
n
Process
Data
No
operation
Decode
Read literal
n
Process
Data
No
operation
If No Jump:
Example:
If No Jump:
HERE
Before Instruction
PC
After Instruction
If Carry
PC
If Carry
PC
BNC
Jump
address (HERE)
=
=
=
=
0;
address (Jump)
1;
address (HERE + 2)
Example:
HERE
Before Instruction
PC
After Instruction
If Negative
PC
If Negative
PC
BNN
Jump
address (HERE)
=
=
=
=
0;
address (Jump)
1;
address (HERE + 2)
DS39762F-page 385
PIC18F97J60 FAMILY
BNOV
BNZ
Syntax:
BNOV
Syntax:
BNZ
Operands:
-128 n 127
Operands:
-128 n 127
Operation:
if Overflow bit is 0,
(PC) + 2 + 2n PC
Operation:
if Zero bit is 0,
(PC) + 2 + 2n PC
Status Affected:
None
Status Affected:
None
Encoding:
1110
Description:
0101
nnnn
nnnn
Encoding:
1110
Description:
nnnn
nnnn
Words:
Words:
Cycles:
1(2)
Cycles:
1(2)
Q Cycle Activity:
If Jump:
0001
Q Cycle Activity:
If Jump:
Q1
Q2
Q3
Q4
Q1
Q2
Q3
Q4
Decode
Read literal
n
Process
Data
Write to
PC
Decode
Read literal
n
Process
Data
Write to
PC
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
Q1
Q2
Q3
Q4
Q1
Q2
Q3
Q4
Decode
Read literal
n
Process
Data
No
operation
Decode
Read literal
n
Process
Data
No
operation
If No Jump:
If No Jump:
Example:
HERE
Before Instruction
PC
After Instruction
If Overflow
PC
If Overflow
PC
DS39762F-page 386
BNOV Jump
address (HERE)
=
=
=
=
0;
address (Jump)
1;
address (HERE + 2)
Example:
HERE
Before Instruction
PC
After Instruction
If Zero
PC
If Zero
PC
BNZ
Jump
address (HERE)
=
=
=
=
0;
address (Jump)
1;
address (HERE + 2)
PIC18F97J60 FAMILY
BRA
Unconditional Branch
BSF
Bit Set f
Syntax:
BRA
Syntax:
BSF
Operands:
-1024 n 1023
Operands:
Operation:
(PC) + 2 + 2n PC
Status Affected:
None
0 f 255
0b7
a [0,1]
Operation:
1 f<b>
Status Affected:
None
Encoding:
1101
Description:
0nnn
nnnn
nnnn
Words:
Cycles:
Encoding:
1000
Description:
Q1
Q2
Q3
Q4
Read literal
n
Process
Data
Write to
PC
No
operation
No
operation
No
operation
No
operation
Example:
bbba
ffff
ffff
Q Cycle Activity:
Decode
f, b {,a}
Words:
Cycles:
Q Cycle Activity:
HERE
Before Instruction
PC
After Instruction
PC
BRA
Jump
address (HERE)
address (Jump)
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write
register f
Example:
BSF
Before Instruction
FLAG_REG
After Instruction
FLAG_REG
FLAG_REG, 7, 1
0Ah
8Ah
DS39762F-page 387
PIC18F97J60 FAMILY
BTFSC
BTFSS
Syntax:
BTFSC f, b {,a}
Syntax:
BTFSS f, b {,a}
Operands:
0 f 255
0b7
a [0,1]
Operands:
0 f 255
0b<7
a [0,1]
Operation:
skip if (f<b>) = 0
Operation:
skip if (f<b>) = 1
Status Affected:
None
Status Affected:
None
Encoding:
1011
Description:
bbba
ffff
ffff
Encoding:
1010
Description:
bbba
ffff
ffff
Words:
Words:
Cycles:
1(2)
Note:
Cycles:
1(2)
Note:
Q Cycle Activity:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
No
operation
Decode
Read
register f
Process
Data
No
operation
Q1
Q2
Q3
Q4
Q1
Q2
Q3
Q4
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
If skip:
If skip:
Q1
Q2
Q3
Q4
Q1
Q2
Q3
Q4
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
Example:
HERE
FALSE
TRUE
Before Instruction
PC
After Instruction
If FLAG<1>
PC
If FLAG<1>
PC
DS39762F-page 388
BTFSC
:
:
FLAG, 1, 0
address (HERE)
=
=
=
=
0;
address (TRUE)
1;
address (FALSE)
Example:
HERE
FALSE
TRUE
Before Instruction
PC
After Instruction
If FLAG<1>
PC
If FLAG<1>
PC
BTFSS
:
:
FLAG, 1, 0
address (HERE)
=
=
=
=
0;
address (FALSE)
1;
address (TRUE)
PIC18F97J60 FAMILY
BTG
Bit Toggle f
BOV
Branch if Overflow
Syntax:
BTG f, b {,a}
Syntax:
BOV
Operands:
0 f 255
0b<7
a [0,1]
Operands:
-128 n 127
Operation:
if Overflow bit is 1,
(PC) + 2 + 2n PC
Status Affected:
None
Operation:
(f<b>) f<b>
Status Affected:
None
Encoding:
0111
Description:
Encoding:
bbba
ffff
ffff
1110
Description:
Words:
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write
register f
Example:
BTG
PORTC,
Words:
Cycles:
nnnn
nnnn
1(2)
Q Cycle Activity:
If Jump:
Q1
Q2
Q3
Q4
Decode
Read literal
n
Process
Data
Write to PC
No
operation
No
operation
No
operation
No
operation
If No Jump:
Q1
Q2
Q3
Q4
Decode
Read literal
n
Process
Data
No
operation
4, 0
Before Instruction:
PORTC =
0111 0101 [75h]
After Instruction:
PORTC =
0110 0101 [65h]
0100
Example:
HERE
Before Instruction
PC
After Instruction
If Overflow
PC
If Overflow
PC
BOV
Jump
address (HERE)
=
=
=
=
1;
address (Jump)
0;
address (HERE + 2)
DS39762F-page 389
PIC18F97J60 FAMILY
BZ
Branch if Zero
CALL
Subroutine Call
Syntax:
BZ
Syntax:
CALL k {,s}
Operands:
-128 n 127
Operands:
Operation:
if Zero bit is 1,
(PC) + 2 + 2n PC
0 k 1048575
s [0,1]
Operation:
Status Affected:
None
(PC) + 4 TOS,
k PC<20:1>;
if s = 1,
(W) WS,
(STATUS) STATUSS,
(BSR) BSRS
Status Affected:
None
Encoding:
1110
Description:
0000
nnnn
nnnn
Words:
Cycles:
1(2)
Encoding:
1st word (k<7:0>)
2nd word(k<19:8>)
Q1
Q2
Q3
Q4
Read literal
n
Process
Data
Write to
PC
No
operation
No
operation
No
operation
No
operation
Q1
Q2
Q3
Q4
Decode
Read literal
n
Process
Data
No
operation
If No Jump:
Example:
HERE
Before Instruction
PC
After Instruction
If Zero
PC
If Zero
PC
DS39762F-page 390
BZ
Jump
address (HERE)
=
=
=
=
1;
address (Jump)
0;
address (HERE + 2)
k7kkk
kkkk
110s
k19kkk
kkkk0
kkkk8
Description:
Words:
Cycles:
Q Cycle Activity:
If Jump:
Decode
1110
1111
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read literal
k<7:0>,
Push PC to
stack
Read literal
k<19:8>,
Write to PC
No
operation
No
operation
No
operation
No
operation
Example:
HERE
Before Instruction
PC
=
After Instruction
PC
=
TOS
=
WS
=
BSRS
=
STATUSS =
CALL
THERE,1
address (HERE)
address (THERE)
address (HERE + 4)
W
BSR
STATUS
PIC18F97J60 FAMILY
CLRF
Clear f
Syntax:
CLRF
Operands:
0 f 255
a [0,1]
f {,a}
Operation:
000h f,
1Z
Status Affected:
Encoding:
0110
Description:
101a
ffff
ffff
CLRWDT
Syntax:
CLRWDT
Operands:
None
Operation:
000h WDT,
000h WDT postscaler,
1 TO,
1 PD
Status Affected:
TO, PD
Encoding:
0000
Words:
Cycles:
1
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write
register f
Example:
CLRF
Before Instruction
FLAG_REG
After Instruction
FLAG_REG
FLAG_REG,1
5Ah
00h
0100
Words:
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
No
operation
Process
Data
No
operation
Example:
Q Cycle Activity:
0000
0000
Description:
CLRWDT
Before Instruction
WDT Counter
After Instruction
WDT Counter
WDT Postscaler
TO
PD
=
=
=
=
00h
0
1
1
DS39762F-page 391
PIC18F97J60 FAMILY
COMF
Complement f
CPFSEQ
Syntax:
COMF
Syntax:
CPFSEQ
Operands:
0 f 255
a [0,1]
Operation:
(f) (W),
skip if (f) = (W)
(unsigned comparison)
Status Affected:
None
f {,d {,a}}
Operands:
0 f 255
d [0,1]
a [0,1]
Operation:
(f) dest
Status Affected:
N, Z
Encoding:
0001
Description:
11da
ffff
ffff
Encoding:
Description:
Cycles:
Q Cycle Activity:
Q1
Decode
Q2
Read
register f
Example:
COMF
Before Instruction
REG
=
After Instruction
REG
=
W
=
13h
13h
ECh
Q3
Process
Data
REG, 0, 0
ffff
ffff
Q4
Words:
Write to
destination
Cycles:
1(2)
Note: 3 cycles if skip and followed
by a 2-word instruction.
Q Cycle Activity:
Q1
Decode
Q2
Read
register f
Q3
Process
Data
Q4
No
operation
If skip:
Q1
Q2
Q3
No
No
No
operation
operation
operation
If skip and followed by 2-word instruction:
Q1
Q2
Q3
No
No
No
operation
operation
operation
No
No
No
operation
operation
operation
Example:
HERE
NEQUAL
EQUAL
Before Instruction
PC Address
W
REG
After Instruction
If REG
PC
If REG
PC
DS39762F-page 392
001a
Words:
0110
f {,a}
Q4
No
operation
Q4
No
operation
No
operation
CPFSEQ REG, 0
:
:
=
=
=
HERE
?
?
=
=
W;
Address (EQUAL)
W;
Address (NEQUAL)
PIC18F97J60 FAMILY
CPFSGT
CPFSLT
Syntax:
CPFSGT
Syntax:
CPFSLT
Operands:
0 f 255
a [0,1]
Operands:
0 f 255
a [0,1]
Operation:
(f) W),
skip if (f) > (W)
(unsigned comparison)
Operation:
(f) W),
skip if (f) < (W)
(unsigned comparison)
Status Affected:
None
Status Affected:
None
Encoding:
Description:
0110
f {,a}
010a
ffff
ffff
Encoding:
0110
Description:
Words:
Cycles:
1(2)
Note:
Q Cycle Activity:
Q1
Decode
Q2
Read
register f
Q3
Process
Data
Q4
No
operation
Example:
HERE
NGREATER
GREATER
Before Instruction
PC
W
After Instruction
If REG
PC
If REG
PC
Q4
No
operation
Q4
No
operation
No
operation
CPFSGT REG, 0
:
:
=
=
Address (HERE)
?
W;
Address (GREATER)
W;
Address (NGREATER)
ffff
ffff
Cycles:
1(2)
Note: 3 cycles if skip and followed
by a 2-word instruction.
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
No
operation
If skip:
Q1
Q2
Q3
Q4
No
operation
No
operation
No
operation
No
operation
Q2
Q3
Q4
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
If skip:
Q1
Q2
Q3
No
No
No
operation
operation
operation
If skip and followed by 2-word instruction:
Q1
Q2
Q3
No
No
No
operation
operation
operation
No
No
No
operation
operation
operation
000a
f {,a}
Example:
HERE
NLESS
LESS
Before Instruction
PC
W
After Instruction
If REG
PC
If REG
PC
CPFSLT REG, 1
:
:
=
=
Address (HERE)
?
<
=
W;
Address (LESS)
W;
Address (NLESS)
DS39762F-page 393
PIC18F97J60 FAMILY
DAW
DECF
Decrement f
Syntax:
DAW
Syntax:
Operands:
None
Operands:
Operation:
0 f 255
d [0,1]
a [0,1]
Operation:
(f) 1 dest
Status Affected:
C, DC, N, OV, Z
Encoding:
0000
Description:
Encoding:
0000
0000
0000
Words:
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register W
Process
Data
Write
W
Example 1:
DAW
Before Instruction
W
=
C
=
DC
=
After Instruction
W
=
C
=
DC
=
A5h
0
0
05h
1
0
Example 2:
Before Instruction
W
=
C
=
DC
=
After Instruction
W
=
C
=
DC
=
DS39762F-page 394
ffff
ffff
0111
Description:
01da
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write to
destination
Example:
DECF
Before Instruction
CNT
=
Z
=
After Instruction
CNT
=
Z
=
CNT,
1, 0
01h
0
00h
1
CEh
0
0
34h
1
0
PIC18F97J60 FAMILY
DECFSZ
Decrement f, Skip if 0
DCFSNZ
Syntax:
Syntax:
DCFSNZ
Operands:
0 f 255
d [0,1]
a [0,1]
Operands:
0 f 255
d [0,1]
a [0,1]
Operation:
(f) 1 dest,
skip if result = 0
Operation:
(f) 1 dest,
skip if result 0
Status Affected:
None
Status Affected:
None
Encoding:
0010
Description:
11da
ffff
ffff
Encoding:
0100
Description:
Cycles:
1(2)
Note: 3 cycles if skip and followed
by a 2-word instruction.
Q1
Q2
Q3
Q4
Read
register f
Process
Data
Write to
destination
Q1
Q2
Q3
Q4
No
operation
No
operation
No
operation
No
operation
Words:
Cycles:
1(2)
Note:
Q1
Q2
Q3
Q4
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
DECFSZ
GOTO
CNT, 1, 1
LOOP
Example:
HERE
CONTINUE
Before Instruction
PC
=
After Instruction
CNT
=
If CNT
=
PC =
If CNT
PC =
Address (HERE)
CNT 1
0;
Address (CONTINUE)
0;
Address (HERE + 2)
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write to
destination
If skip:
ffff
Q Cycle Activity:
Decode
ffff
11da
Words:
f {,d {,a}}
If skip:
Q1
Q2
Q3
Q4
No
operation
No
operation
No
operation
No
operation
Q2
Q3
Q4
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
Example:
HERE
ZERO
NZERO
Before Instruction
TEMP
After Instruction
TEMP
If TEMP
PC
If TEMP
PC
DCFSNZ
:
:
TEMP, 1, 0
=
=
=
TEMP 1,
0;
Address (ZERO)
0;
Address (NZERO)
DS39762F-page 395
PIC18F97J60 FAMILY
GOTO
Unconditional Branch
INCF
Increment f
Syntax:
GOTO k
Syntax:
INCF
Operands:
0 k 1048575
Operands:
Operation:
k PC<20:1>
Status Affected:
None
0 f 255
d [0,1]
a [0,1]
Operation:
(f) + 1 dest
Status Affected:
C, DC, N, OV, Z
Encoding:
1st word (k<7:0>)
2nd word(k<19:8>)
1110
1111
1111
k19kkk
k7kkk
kkkk
kkkk0
kkkk8
Description:
Words:
Cycles:
Encoding:
0010
Description:
Q1
Q2
Q3
Q4
Read literal
k<7:0>,
No
operation
Read literal
k<19:8>,
Write to PC
No
operation
No
operation
No
operation
No
operation
Example:
GOTO THERE
After Instruction
PC =
Address (THERE)
ffff
ffff
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write to
destination
Example:
INCF
Before Instruction
CNT
=
Z
=
C
=
DC
=
After Instruction
CNT
=
Z
=
C
=
DC
=
DS39762F-page 396
10da
Q Cycle Activity:
Decode
f {,d {,a}}
CNT, 1, 0
FFh
0
?
?
00h
1
1
1
PIC18F97J60 FAMILY
INCFSZ
Increment f, Skip if 0
INFSNZ
Syntax:
INCFSZ
Syntax:
INFSNZ
0 f 255
d [0,1]
a [0,1]
f {,d {,a}}
Operands:
0 f 255
d [0,1]
a [0,1]
Operands:
Operation:
(f) + 1 dest,
skip if result = 0
Operation:
(f) + 1 dest,
skip if result 0
Status Affected:
None
Status Affected:
None
Encoding:
0011
Description:
11da
ffff
ffff
Encoding:
0100
Description:
10da
ffff
ffff
Words:
Words:
Cycles:
1(2)
Note:
Cycles:
1(2)
Note: 3 cycles if skip and followed
by a 2-word instruction.
Q Cycle Activity:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write to
destination
Decode
Read
register f
Process
Data
Write to
destination
Q1
Q2
Q3
Q4
Q1
Q2
Q3
Q4
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
If skip:
If skip:
Q1
Q2
Q3
Q4
Q1
Q2
Q3
Q4
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
Example:
HERE
NZERO
ZERO
Before Instruction
PC
=
After Instruction
CNT
=
If CNT
=
PC
=
If CNT
PC
=
INCFSZ
:
:
Address (HERE)
CNT + 1
0;
Address (ZERO)
0;
Address (NZERO)
CNT, 1, 0
Example:
HERE
ZERO
NZERO
Before Instruction
PC
=
After Instruction
REG
=
If REG
PC
=
If REG
=
PC
=
INFSNZ
REG, 1, 0
Address (HERE)
REG + 1
0;
Address (NZERO)
0;
Address (ZERO)
DS39762F-page 397
PIC18F97J60 FAMILY
IORLW
IORWF
Inclusive OR W with f
Syntax:
IORLW k
Syntax:
IORWF
Operands:
0 k 255
Operands:
Operation:
(W) .OR. k W
Status Affected:
N, Z
0 f 255
d [0,1]
a [0,1]
Operation:
Status Affected:
N, Z
Encoding:
0000
1001
kkkk
kkkk
Description:
Words:
Cycles:
Encoding:
0001
Description:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
literal k
Process
Data
Write to
W
Example:
IORLW
Before Instruction
W
=
After Instruction
W
=
00da
ffff
ffff
35h
9Ah
BFh
f {,d {,a}}
Words:
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write to
destination
Example:
IORWF
Before Instruction
RESULT =
W
=
After Instruction
RESULT =
W
=
DS39762F-page 398
RESULT, 0, 1
13h
91h
13h
93h
PIC18F97J60 FAMILY
LFSR
Load FSR
MOVF
Move f
Syntax:
LFSR f, k
Syntax:
MOVF
Operands:
0f2
0 k 4095
Operands:
Operation:
k FSRf
0 f 255
d [0,1]
a [0,1]
Status Affected:
None
Operation:
f dest
Status Affected:
N, Z
Encoding:
1110
1111
1110
0000
00ff
k7kkk
k11kkk
kkkk
Description:
Words:
Cycles:
Encoding:
0101
Description:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read literal
k MSB
Process
Data
Write
literal k
MSB to
FSRfH
Decode
Read literal
k LSB
Process
Data
Write literal
k to FSRfL
Example:
After Instruction
FSR2H
FSR2L
03h
ABh
00da
ffff
ffff
LFSR 2, 3ABh
=
=
f {,d {,a}}
Words:
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write
W
Example:
MOVF
Before Instruction
REG
W
After Instruction
REG
W
REG, 0, 0
=
=
22h
FFh
=
=
22h
22h
DS39762F-page 399
PIC18F97J60 FAMILY
MOVFF
Move f to f
MOVLB
Syntax:
MOVFF fs,fd
Syntax:
MOVLW k
Operands:
0 fs 4095
0 fd 4095
Operands:
0 k 255
Operation:
k BSR
Status Affected:
None
Operation:
(fs) fd
Status Affected:
None
Encoding:
1st word (source)
2nd word (destin.)
Encoding:
1100
1111
Description:
ffff
ffff
ffff
ffff
ffffs
ffffd
Words:
Cycles:
0000
0001
kkkk
kkkk
Description:
Words:
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
literal k
Process
Data
Write literal
k to BSR
MOVLB
Example:
Before Instruction
BSR Register =
After Instruction
BSR Register =
02h
05h
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register f
(src)
Process
Data
No
operation
Decode
No
operation
No
operation
Write
register f
(dest)
No dummy
read
Example:
MOVFF
Before Instruction
REG1
REG2
After Instruction
REG1
REG2
DS39762F-page 400
REG1, REG2
=
=
33h
11h
=
=
33h
33h
PIC18F97J60 FAMILY
MOVLW
Move Literal to W
MOVWF
Move W to f
Syntax:
MOVLW k
Syntax:
MOVWF
Operands:
0 k 255
Operands:
Operation:
kW
0 f 255
a [0,1]
Status Affected:
None
Encoding:
0000
Description:
1110
kkkk
kkkk
Words:
Cycles:
Operation:
(W) f
Status Affected:
None
Encoding:
0110
Description:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
literal k
Process
Data
Write to
W
Example:
After Instruction
W
=
MOVLW
f {,a}
111a
ffff
ffff
5Ah
5Ah
Words:
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write
register f
Example:
MOVWF
Before Instruction
W
=
REG
=
After Instruction
W
=
REG
=
REG, 0
4Fh
FFh
4Fh
4Fh
DS39762F-page 401
PIC18F97J60 FAMILY
MULLW
MULWF
Syntax:
MULLW
Syntax:
MULWF
Operands:
0 k 255
Operands:
Operation:
(W) x k PRODH:PRODL
0 f 255
a [0,1]
Status Affected:
None
Operation:
Status Affected:
None
Encoding:
0000
Description:
1101
kkkk
kkkk
Multiply W with f
Encoding:
0000
Description:
W is unchanged.
None of the Status flags are affected.
Cycles:
1
Q1
Q2
Q3
Q4
Read
literal k
Process
Data
Write
registers
PRODH:
PRODL
MULLW
0C4h
=
=
=
E2h
?
?
=
=
=
E2h
ADh
08h
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write
registers
PRODH:
PRODL
Example:
Before Instruction
W
REG
PRODH
PRODL
After Instruction
W
REG
PRODH
PRODL
DS39762F-page 402
ffff
Decode
Before Instruction
W
PRODH
PRODL
After Instruction
W
PRODH
PRODL
ffff
Q Cycle Activity:
Example:
001a
f {,a}
MULWF
REG, 1
=
=
=
=
C4h
B5h
?
?
=
=
=
=
C4h
B5h
8Ah
94h
PIC18F97J60 FAMILY
NEGF
Negate f
Syntax:
NEGF
Operands:
0 f 255
a [0,1]
f {,a}
Operation:
(f) + 1 f
Status Affected:
N, OV, C, DC, Z
Encoding:
0110
Description:
110a
ffff
Syntax:
NOP
Operands:
None
Operation:
No operation
Status Affected:
None
0000
1111
ffff
Cycles:
No Operation
Encoding:
Words:
NOP
0000
xxxx
Description:
No operation.
Words:
Cycles:
0000
xxxx
0000
xxxx
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
No
operation
No
operation
No
operation
Example:
None.
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write
register f
Example:
NEGF
Before Instruction
REG
=
After Instruction
REG
=
REG, 1
DS39762F-page 403
PIC18F97J60 FAMILY
POP
PUSH
Syntax:
POP
Syntax:
PUSH
Operands:
None
Operands:
None
Operation:
Operation:
(PC + 2) TOS
Status Affected:
None
Status Affected:
None
Encoding:
0000
0000
0000
0110
Encoding:
0000
0000
0000
0101
Description:
Description:
Words:
Words:
Cycles:
Cycles:
Q Cycle Activity:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
No
operation
POP TOS
value
No
operation
POP
GOTO
NEW
Example:
Q2
Q3
Q4
PUSH
PC + 2 onto
return stack
No
operation
No
operation
Example:
Before Instruction
TOS
Stack (1 level down)
=
=
0031A2h
014332h
After Instruction
TOS
PC
=
=
014332h
NEW
DS39762F-page 404
Q1
Decode
PUSH
Before Instruction
TOS
PC
=
=
345Ah
0124h
After Instruction
PC
TOS
Stack (1 level down)
=
=
=
0126h
0126h
345Ah
PIC18F97J60 FAMILY
RCALL
Relative Call
RESET
Reset
Syntax:
RCALL
Syntax:
RESET
Operands:
-1024 n 1023
Operands:
None
Operation:
(PC) + 2 TOS,
(PC) + 2 + 2n PC
Operation:
Status Affected:
None
Status Affected:
All
Encoding:
1101
Description:
1nnn
nnnn
nnnn
Words:
Cycles:
Encoding:
0000
Q1
Q2
Q3
Q4
Decode
Read literal
n
Process
Data
Write to PC
No
operation
No
operation
1111
1111
Words:
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Start
reset
No
operation
No
operation
Example:
Q Cycle Activity:
0000
Description:
After Instruction
Registers =
Flags*
=
RESET
Reset Value
Reset Value
PUSH PC
to stack
No
operation
Example:
No
operation
HERE
RCALL Jump
Before Instruction
PC =
Address (HERE)
After Instruction
PC =
Address (Jump)
TOS =
Address (HERE + 2)
DS39762F-page 405
PIC18F97J60 FAMILY
RETFIE
RETLW
Return Literal to W
Syntax:
RETFIE {s}
Syntax:
RETLW k
Operands:
s [0,1]
Operands:
0 k 255
Operation:
(TOS) PC,
1 GIE/GIEH or PEIE/GIEL;
if s = 1,
(WS) W,
(STATUSS) STATUS,
(BSRS) BSR,
PCLATU, PCLATH are unchanged
Operation:
k W,
(TOS) PC,
PCLATU, PCLATH are unchanged
Status Affected:
None
Status Affected:
0000
0000
0001
Cycles:
Q Cycle Activity:
Q2
Q3
Q4
Decode
No
operation
No
operation
POP PC
from stack
Set GIEH or
GIEL
No
operation
RETFIE
After Interrupt
PC
W
BSR
STATUS
GIE/GIEH, PEIE/GIEL
DS39762F-page 406
kkkk
kkkk
Words:
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
literal k
Process
Data
POP PC
from stack,
write to W
No
operation
No
operation
No
operation
No
operation
Example:
Q1
Example:
1100
Description:
000s
Words:
No
operation
0000
GIE/GIEH, PEIE/GIEL.
Encoding:
Description:
Encoding:
No
operation
No
operation
1
=
=
=
=
=
TOS
WS
BSRS
STATUSS
1
CALL TABLE ;
;
;
;
:
TABLE
ADDWF PCL ;
RETLW k0
;
RETLW k1
;
:
:
RETLW kn
;
Before Instruction
W
=
After Instruction
W
=
W contains table
offset value
W now has
table value
W = offset
Begin table
End of table
07h
value of kn
PIC18F97J60 FAMILY
RETURN
RLCF
Syntax:
RETURN {s}
Syntax:
RLCF
Operands:
s [0,1]
Operands:
Operation:
(TOS) PC;
if s = 1,
(WS) W,
(STATUSS) STATUS,
(BSRS) BSR,
PCLATU, PCLATH are unchanged
0 f 255
d [0,1]
a [0,1]
Operation:
Status Affected:
C, N, Z
Status Affected:
None
Encoding:
0000
Description:
Encoding:
0000
0001
001s
0011
Description:
Words:
Cycles:
2
Q1
Q2
Q3
Q4
No
operation
Process
Data
POP PC
from stack
No
operation
No
operation
No
operation
No
operation
01da
ffff
ffff
Q Cycle Activity:
Decode
f {,d {,a}}
register f
C
Words:
Cycles:
Q Cycle Activity:
Example:
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write to
destination
RETURN
After Instruction:
PC = TOS
Example:
Before Instruction
REG
=
C
=
After Instruction
REG
=
W
=
C
=
RLCF
REG, 0, 0
1110 0110
0
1110 0110
1100 1100
1
DS39762F-page 407
PIC18F97J60 FAMILY
RLNCF
RRCF
Syntax:
RLNCF
Syntax:
RRCF
Operands:
0 f 255
d [0,1]
a [0,1]
Operands:
0 f 255
d [0,1]
a [0,1]
Operation:
Operation:
Status Affected:
N, Z
Status Affected:
C, N, Z
Encoding:
0100
Description:
f {,d {,a}}
01da
ffff
ffff
Encoding:
0011
Description:
1
1
Q1
Decode
Q2
Read
register f
Example:
Before Instruction
REG
=
After Instruction
REG
=
DS39762F-page 408
RLNCF
Q3
Process
Data
Q4
Write to
destination
Words:
Cycles:
register f
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write to
destination
REG, 1, 0
1010 1011
0101 0111
ffff
Q Cycle Activity:
ffff
register f
Cycles:
00da
Words:
f {,d {,a}}
Example:
RRCF
Before Instruction
REG
=
C
=
After Instruction
REG
=
W
=
C
=
REG, 0, 0
1110 0110
0
1110 0110
0111 0011
0
PIC18F97J60 FAMILY
RRNCF
SETF
Set f
Syntax:
RRNCF
Syntax:
SETF
Operands:
0 f 255
d [0,1]
a [0,1]
Operands:
0 f 255
a [0,1]
Operation:
Status Affected:
N, Z
Encoding:
0100
Description:
f {,d {,a}}
00da
Operation:
FFh f
Status Affected:
None
Encoding:
ffff
ffff
0110
Description:
register f
Words:
Cycles:
1
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write to
destination
Example 1:
RRNCF
Before Instruction
REG
=
After Instruction
REG
=
Example 2:
ffff
Words:
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write
register f
SETF
Before Instruction
REG
After Instruction
REG
REG,1
5Ah
FFh
REG, 1, 0
1101 0111
1110 1011
RRNCF
Before Instruction
W
=
REG
=
After Instruction
W
=
REG
=
ffff
Example:
Q Cycle Activity:
100a
f {,a}
REG, 0, 0
?
1101 0111
1110 1011
1101 0111
DS39762F-page 409
PIC18F97J60 FAMILY
SLEEP
SUBFWB
Syntax:
SLEEP
Syntax:
SUBFWB
Operands:
None
Operands:
Operation:
00h WDT,
0 WDT postscaler,
1 TO,
0 PD
0 f 255
d [0,1]
a [0,1]
Operation:
Status Affected:
N, OV, C, DC, Z
Status Affected:
TO, PD
Encoding:
0000
Description:
Encoding:
0000
0000
0011
0101
Description:
Words:
Cycles:
1
Q1
Q2
Q3
Q4
No
operation
Process
Data
Go to
Sleep
Example:
SLEEP
Before Instruction
TO =
?
?
PD =
After Instruction
1
TO =
PD =
0
If WDT causes wake-up, this bit is cleared.
DS39762F-page 410
01da
ffff
ffff
Q Cycle Activity:
Decode
f {,d {,a}}
Words:
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write to
destination
SUBFWB
REG, 1, 0
Example 1:
Before Instruction
REG
=
3
W
=
2
C
=
1
After Instruction
REG
=
FF
W
=
2
C
=
0
Z
=
0
N
=
1 ; result is negative
SUBFWB
REG, 0, 0
Example 2:
Before Instruction
REG
=
2
W
=
5
C
=
1
After Instruction
REG
=
2
W
=
3
C
=
1
Z
=
0
N
=
0 ; result is positive
SUBFWB
REG, 1, 0
Example 3:
Before Instruction
REG
=
1
W
=
2
C
=
0
After Instruction
REG
=
0
W
=
2
C
=
1
Z
=
1 ; result is zero
N
=
0
PIC18F97J60 FAMILY
SUBLW
SUBWF
Subtract W from f
Syntax:
SUBLW k
Syntax:
SUBWF
Operands:
0 k 255
Operands:
Operation:
k (W) W
Status Affected:
N, OV, C, DC, Z
0 f 255
d [0,1]
a [0,1]
Operation:
Status Affected:
N, OV, C, DC, Z
Encoding:
0000
1000
kkkk
kkkk
Description:
Words:
Cycles:
Encoding:
0101
Description:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
literal k
Process
Data
Write to
W
Example 1:
Before Instruction
W
=
C
=
After Instruction
W
=
C
=
Z
=
N
=
Example 2:
Before Instruction
W
=
C
=
After Instruction
W
=
C
=
Z
=
N
=
Example 3:
Before Instruction
W
=
C
=
After Instruction
W
=
C
=
Z
=
N
=
SUBLW
SUBLW
; result is positive
02h
?
00h
1
1
0
SUBLW
; result is zero
02h
03h
?
FFh
0
0
1
; (2s complement)
; result is negative
ffff
Words:
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write to
destination
SUBWF
REG, 1, 0
Example 1:
Before Instruction
REG
=
W
=
C
=
After Instruction
REG
=
W
=
C
=
Z
=
N
=
Example 2:
Before Instruction
REG
=
W
=
C
=
After Instruction
REG
=
W
=
C
=
Z
=
N
=
Example 3:
Before Instruction
REG
=
W
=
C
=
After Instruction
REG
=
W
=
C
=
Z
=
N
=
ffff
02h
02h
11da
01h
?
01h
1
0
0
f {,d {,a}}
3
2
?
1
2
1
0
0
; result is positive
SUBWF
REG, 0, 0
2
2
?
2
0
1
1
0
SUBWF
; result is zero
REG, 1, 0
1
2
?
FFh ;(2s complement)
2
0
; result is negative
0
1
DS39762F-page 411
PIC18F97J60 FAMILY
SUBWFB
SWAPF
Swap f
Syntax:
SUBWFB
Syntax:
Operands:
0 f 255
d [0,1]
a [0,1]
Operands:
0 f 255
d [0,1]
a [0,1]
Operation:
Operation:
Status Affected:
N, OV, C, DC, Z
(f<3:0>) dest<7:4>,
(f<7:4>) dest<3:0>
Status Affected:
None
Encoding:
0101
Description:
f {,d {,a}}
10da
ffff
ffff
Encoding:
0011
Description:
Cycles:
Q Cycle Activity:
Q1
Decode
Q2
Read
register f
Example 1:
SUBWFB
Before Instruction
REG
=
W
=
C
=
After Instruction
REG
=
W
=
C
=
Z
=
N
=
Example 2:
Q4
Write to
destination
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write to
destination
REG, 1, 0
19h
0Dh
1
(0001 1001)
(0000 1101)
0Ch
0Dh
1
0
0
(0000 1011)
(0000 1101)
ffff
Example:
SWAPF
Before Instruction
REG
=
After Instruction
REG
=
REG, 1, 0
53h
35h
; result is positive
SUBWFB REG, 0, 0
Before Instruction
REG
=
W
=
C
=
After Instruction
REG
=
W
=
C
=
Z
=
N
=
Example 3:
1Bh
1Ah
0
(0001 1011)
(0001 1010)
1Bh
00h
1
1
0
(0001 1011)
SUBWFB
Before Instruction
REG
=
W
=
C
=
After Instruction
REG
=
W
C
Z
N
Q3
Process
Data
ffff
10da
=
=
=
=
DS39762F-page 412
; result is zero
REG, 1, 0
03h
0Eh
1
(0000 0011)
(0000 1101)
F5h
(1111 0100)
; [2s comp]
(0000 1101)
0Eh
0
0
1
; result is negative
PIC18F97J60 FAMILY
TBLRD
Table Read
TBLRD
Syntax:
Example 1:
TBLRD
Operands:
None
Operation:
if TBLRD*,
(Prog Mem (TBLPTR)) TABLAT;
TBLPTR No Change
if TBLRD*+,
(Prog Mem (TBLPTR)) TABLAT;
(TBLPTR) + 1 TBLPTR
if TBLRD*-,
(Prog Mem (TBLPTR)) TABLAT;
(TBLPTR) 1 TBLPTR
if TBLRD +*,
(TBLPTR) + 1 TBLPTR;
(Prog Mem (TBLPTR)) TABLAT
Before Instruction
TABLAT
TBLPTR
MEMORY(00A356h)
After Instruction
TABLAT
TBLPTR
Example 2:
Description:
0000
0000
0000
TBLRD
Before Instruction
TABLAT
TBLPTR
MEMORY(01A357h)
MEMORY(01A358h)
After Instruction
TABLAT
TBLPTR
*+ ;
=
=
=
55h
00A356h
34h
=
=
34h
00A357h
+* ;
=
=
=
=
AAh
01A357h
12h
34h
=
=
34h
01A358h
10nn
nn=0 *
=1 *+
=2 *=3 +*
Words:
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
No
operation
No
operation
No
operation
No
operation
No operation
(Read Program
Memory)
No
operation
No operation
(Write
TABLAT)
DS39762F-page 413
PIC18F97J60 FAMILY
TBLWT
Table Write
TBLWT
Syntax:
Example 1:
TBLWT*+;
Operands:
None
Operation:
if TBLWT*,
(TABLAT) Holding Register;
TBLPTR No Change
if TBLWT*+,
(TABLAT) Holding Register;
(TBLPTR) + 1 TBLPTR
if TBLWT*-,
(TABLAT) Holding Register;
(TBLPTR) 1 TBLPTR
if TBLWT+*,
(TBLPTR) + 1 TBLPTR;
(TABLAT) Holding Register
Status Affected:
Example 2:
None
Encoding:
Description:
Before Instruction
TABLAT
=
55h
TBLPTR
=
00A356h
HOLDING REGISTER
(00A356h)
=
FFh
After Instructions (table write completion)
TABLAT
=
55h
TBLPTR
=
00A357h
HOLDING REGISTER
(00A356h)
=
55h
0000
0000
0000
11nn
nn=0 *
=1 *+
=2 *=3 +*
TBLWT +*;
Before Instruction
TABLAT
=
34h
TBLPTR
=
01389Ah
HOLDING REGISTER
(01389Ah)
=
FFh
HOLDING REGISTER
(01389Bh)
=
FFh
After Instruction (table write completion)
TABLAT
=
34h
TBLPTR
=
01389Bh
HOLDING REGISTER
(01389Ah)
=
FFh
HOLDING REGISTER
(01389Bh)
=
34h
no change
post-increment
post-decrement
pre-increment
Words:
Cycles:
Q Cycle Activity:
Q1
Decode
Q2
Q3
Q4
No
No
No
operation operation operation
No
No
No
No
operation operation operation operation
(Read
(Write to
TABLAT)
Holding
Register)
DS39762F-page 414
PIC18F97J60 FAMILY
TSTFSZ
Test f, Skip if 0
XORLW
Syntax:
TSTFSZ f {,a}
Syntax:
XORLW k
Operands:
0 f 255
a [0,1]
Operands:
0 k 255
Operation:
(W) .XOR. k W
Status Affected:
N, Z
Operation:
skip if f = 0
Status Affected:
None
Encoding:
Encoding:
0110
Description:
011a
ffff
ffff
Words:
Cycles:
1(2)
Note: 3 cycles if skip and followed
by a 2-word instruction.
0000
1010
kkkk
kkkk
Description:
Words:
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
literal k
Process
Data
Write to
W
Example:
Before Instruction
W
=
After Instruction
W
=
XORLW
0AFh
B5h
1Ah
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
No
operation
If skip:
Q1
Q2
Q3
Q4
No
operation
No
operation
No
operation
No
operation
Q2
Q3
Q4
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
No
operation
Example:
HERE
NZERO
ZERO
Before Instruction
PC
After Instruction
If CNT
PC
If CNT
PC
TSTFSZ
:
:
CNT, 1
Address (HERE)
=
=
00h,
Address (ZERO)
00h,
Address (NZERO)
DS39762F-page 415
PIC18F97J60 FAMILY
XORWF
Exclusive OR W with f
Syntax:
XORWF
Operands:
0 f 255
d [0,1]
a [0,1]
Operation:
Status Affected:
N, Z
Encoding:
0001
Description:
f {,d {,a}}
10da
ffff
ffff
Words:
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write to
destination
Example:
XORWF
Before Instruction
REG
=
W
=
After Instruction
REG
=
W
=
DS39762F-page 416
REG, 1, 0
AFh
B5h
1Ah
B5h
PIC18F97J60 FAMILY
26.2
A summary of the instructions in the extended instruction set is provided in Table 26-3. Detailed descriptions
are provided in Section 26.2.2 Extended Instruction
Set. The opcode field descriptions in Table 26-1 (page
376) apply to both the standard and extended PIC18
instruction sets.
Note:
26.2.1
Most of the extended instructions use indexed arguments, using one of the File Select Registers and some
offset to specify a source or destination register. When
an argument for an instruction serves as part of
Indexed Addressing, it is enclosed in square brackets
([ ]). This is done to indicate that the argument is used
as an index or offset. The MPASM Assembler will
flag an error if it determines that an index or offset value
is not bracketed.
TABLE 26-3:
Note:
Mnemonic,
Operands
ADDFSR
ADDULNK
CALLW
MOVSF
f, k
k
MOVSS
zs, zd
PUSHL
SUBFSR
SUBULNK
f, k
k
zs, fd
Description
Cycles
MSb
1
2
2
2
LSb
Status
Affected
1000
1000
0000
1011
ffff
1011
xxxx
1010
ffkk
11kk
0001
0zzz
ffff
1zzz
xzzz
kkkk
kkkk
kkkk
0100
zzzz
ffff
zzzz
zzzz
kkkk
None
None
None
None
1110
1110
0000
1110
1111
1110
1111
1110
1
2
1110
1110
1001
1001
ffkk
11kk
kkkk
kkkk
None
None
None
None
DS39762F-page 417
PIC18F97J60 FAMILY
26.2.2
ADDFSR
ADDULNK
Syntax:
ADDFSR f, k
Syntax:
ADDULNK k
Operands:
0 k 63
f [ 0, 1, 2 ]
Operands:
0 k 63
Operation:
FSR(f) + k FSR(f)
Status Affected:
None
Encoding:
1110
FSR2 + k FSR2,
Operation:
(TOS) PC
Status Affected:
1000
ffkk
kkkk
Description:
Words:
Cycles:
None
Encoding:
1110
Description:
Q2
Q3
Q4
Decode
Read
literal k
Process
Data
Write to
FSR
Example:
After Instruction
FSR2
=
03FFh
Words:
Cycles:
Q Cycle Activity:
0422h
Q1
Q2
Q3
Q4
Decode
Read
literal k
Process
Data
Write to
FSR
No
Operation
No
Operation
No
Operation
No
Operation
Example:
Note:
kkkk
ADDFSR 2, 23h
Before Instruction
FSR2
=
11kk
Q Cycle Activity:
Q1
1000
ADDULNK 23h
Before Instruction
FSR2
=
PC
=
03FFh
0100h
After Instruction
FSR2
=
PC
=
0422h
(TOS)
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).
DS39762F-page 418
PIC18F97J60 FAMILY
CALLW
MOVSF
Move Indexed to f
Syntax:
CALLW
Syntax:
MOVSF [zs], fd
Operands:
None
Operands:
Operation:
(PC + 2) TOS,
(W) PCL,
(PCLATH) PCH,
(PCLATU) PCU
0 zs 127
0 fd 4095
Operation:
((FSR2) + zs) fd
Status Affected:
None
Status Affected:
None
Encoding:
0000
Description
0000
0001
0100
Encoding:
1st word (source)
2nd word (destin.)
Description:
Cycles:
2
Q1
Q2
Q3
Q4
Read
WREG
Push PC to
stack
No
operation
No
operation
No
operation
No
operation
No
operation
Before Instruction
PC
=
PCLATH =
PCLATU =
W
=
After Instruction
PC
=
TOS
=
PCLATH =
PCLATU =
W
=
Words:
Cycles:
Q Cycle Activity:
CALLW
Decode
address (HERE)
10h
00h
06h
001006h
address (HERE + 2)
10h
00h
06h
zzzzs
ffffd
Decode
HERE
0zzz
ffff
Q1
Example:
1011
ffff
Q Cycle Activity:
Decode
1110
1111
Q2
Q3
Determine
Determine
source addr source addr
No
operation
No
operation
No dummy
read
Example:
MOVSF
Before Instruction
FSR2
Contents
of 85h
REG2
After Instruction
FSR2
Contents
of 85h
REG2
Q4
Read
source reg
Write
register f
(dest)
[05h], REG2
80h
=
=
33h
11h
80h
=
=
33h
33h
DS39762F-page 419
PIC18F97J60 FAMILY
MOVSS
PUSHL
Syntax:
Syntax:
PUSHL k
Operands:
0 zs 127
0 zd 127
Operands:
0k 255
Operation:
k (FSR2),
FSR2 1 FSR2
Status Affected:
None
Operation:
Status Affected:
None
Encoding:
1st word (source)
2nd word (dest.)
1110
1111
Description
1011
xxxx
1zzz
xzzz
zzzzs
zzzzd
Words:
Cycles:
Q Cycle Activity:
Q1
Decode
Decode
Q2
Q3
Determine
Determine
source addr source addr
Determine
dest addr
Example:
1110
Description:
1010
kkkk
kkkk
Words:
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read k
Process
data
Write to
destination
Example:
PUSHL 08h
Before Instruction
FSR2H:FSR2L
Memory (01ECh)
=
=
01ECh
00h
After Instruction
FSR2H:FSR2L
Memory (01ECh)
=
=
01EBh
08h
Q4
Read
source reg
Write
to dest reg
Before Instruction
FSR2
Contents
of 85h
Contents
of 86h
After Instruction
FSR2
Contents
of 85h
Contents
of 86h
DS39762F-page 420
Determine
dest addr
Encoding:
80h
33h
11h
80h
33h
33h
PIC18F97J60 FAMILY
SUBFSR
SUBULNK
Syntax:
SUBFSR f, k
Syntax:
SUBULNK k
Operands:
0 k 63
Operands:
0 k 63
f [ 0, 1, 2 ]
Operation:
Operation:
FSRf k FSRf
FSR2 k FSR2,
(TOS) PC
Status Affected:
None
Status Affected:
None
Encoding:
1110
1001
ffkk
kkkk
Description:
Words:
Cycles:
Encoding:
1110
Description:
Q1
Q2
Q3
Q4
Read
register f
Process
Data
Write to
destination
Example:
Before Instruction
FSR2
=
After Instruction
FSR2
=
SUBFSR 2, 23h
1001
11kk
kkkk
Q Cycle Activity:
Decode
Cycles:
Q Cycle Activity:
03FFh
03DCh
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write to
destination
No
Operation
No
Operation
No
Operation
No
Operation
Example:
SUBULNK 23h
Before Instruction
FSR2
=
PC
=
03FFh
0100h
After Instruction
FSR2
=
PC
=
03DCh
(TOS)
DS39762F-page 421
PIC18F97J60 FAMILY
26.2.3
Note:
BYTE-ORIENTED AND
BIT-ORIENTED INSTRUCTIONS IN
INDEXED LITERAL OFFSET MODE
Enabling the PIC18 instruction set extension may cause legacy applications to
behave erratically or fail entirely.
DS39762F-page 422
26.2.3.1
26.2.4
CONSIDERATIONS WHEN
ENABLING THE EXTENDED
INSTRUCTION SET
It is important to note that the extensions to the instruction set may not be beneficial to all users. In particular,
users who are not writing code that uses a software
stack may not benefit from using the extensions to the
instruction set.
Additionally, the Indexed Literal Offset Addressing
mode may create issues with legacy applications
written to the PIC18 assembler. This is because
instructions in the legacy code may attempt to address
registers in the Access Bank below 5Fh. Since these
addresses are interpreted as literal offsets to FSR2
when the instruction set extension is enabled, the
application may read or write to the wrong data
addresses.
When porting an application to the PIC18F97J60 family, it is very important to consider the type of code. A
large, reentrant application that is written in C and
would benefit from efficient compilation will do well
when using the instruction set extensions. Legacy
applications that heavily use the Access Bank will most
likely not benefit from using the extended instruction
set.
PIC18F97J60 FAMILY
ADD W to Indexed
(Indexed Literal Offset mode)
BSF
Syntax:
ADDWF
Syntax:
BSF [k], b
Operands:
0 k 95
d [0,1]
Operands:
0 f 95
0b7
Operation:
Operation:
1 ((FSR2) + k)<b>
Status Affected:
N, OV, C, DC, Z
Status Affected:
None
ADDWF
Encoding:
[k] {,d}
0010
Description:
01d0
kkkk
kkkk
Words:
Cycles:
Encoding:
1000
bbb0
kkkk
kkkk
Description:
Words:
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register f
Process
Data
Write to
destination
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read k
Process
Data
Write to
destination
Example:
ADDWF
Before Instruction
W
OFST
FSR2
Contents
of 0A2Ch
After Instruction
W
Contents
of 0A2Ch
[OFST] ,0
Example:
BSF
Before Instruction
FLAG_OFST
FSR2
Contents
of 0A0Ah
After Instruction
Contents
of 0A0Ah
[FLAG_OFST], 7
=
=
0Ah
0A00h
55h
D5h
=
=
=
17h
2Ch
0A00h
20h
37h
SETF
Set Indexed
(Indexed Literal Offset mode)
20h
Syntax:
SETF [k]
Operands:
0 k 95
Operation:
FFh ((FSR2) + k)
Status Affected:
None
Encoding:
0110
1000
kkkk
kkkk
Description:
Words:
Cycles:
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read k
Process
Data
Write
register
Example:
SETF
Before Instruction
OFST
FSR2
Contents
of 0A2Ch
After Instruction
Contents
of 0A2Ch
[OFST]
=
=
2Ch
0A00h
00h
FFh
DS39762F-page 423
PIC18F97J60 FAMILY
26.2.5
DS39762F-page 424
PIC18F97J60 FAMILY
27.0
DEVELOPMENT SUPPORT
27.1
DS39762F-page 425
PIC18F97J60 FAMILY
27.2
27.3
27.4
MPASM Assembler
27.5
27.6
DS39762F-page 426
PIC18F97J60 FAMILY
27.7
27.8
27.9
MPLAB ICD 3 In-Circuit Debugger System is Microchip's most cost effective high-speed hardware
debugger/programmer for Microchip Flash Digital Signal Controller (DSC) and microcontroller (MCU)
devices. It debugs and programs PIC Flash microcontrollers and dsPIC DSCs with the powerful, yet easyto-use graphical user interface of MPLAB Integrated
Development Environment (IDE).
The MPLAB ICD 3 In-Circuit Debugger probe is connected to the design engineer's PC using a high-speed
USB 2.0 interface and is connected to the target with a
connector compatible with the MPLAB ICD 2 or MPLAB
REAL ICE systems (RJ-11). MPLAB ICD 3 supports all
MPLAB ICD 2 headers.
DS39762F-page 427
PIC18F97J60 FAMILY
27.11 PICkit 2 Development
Programmer/Debugger and
PICkit 2 Debug Express
27.13 Demonstration/Development
Boards, Evaluation Kits, and
Starter Kits
DS39762F-page 428
PIC18F97J60 FAMILY
28.0
ELECTRICAL CHARACTERISTICS
NOTICE: Stresses above those listed under Absolute Maximum Ratings may cause permanent damage to the
device. This is a stress rating only and functional operation of the device at those or any other conditions above those
indicated in the operation listings of this specification is not implied. Exposure to maximum rating conditions for
extended periods may affect device reliability.
DS39762F-page 429
PIC18F97J60 FAMILY
FIGURE 28-1:
4.0V
3.6V
3.5V
Voltage (VDD)(1)
PIC18F6XJ6X/8XJ6X/9XJ6X
3.0V
2.7V
2.5V
2.0V
Frequency
41.6667 MHz
When the on-chip regulator is enabled, its BOR circuit will automatically trigger a device Reset
before VDD reaches a level at which full-speed operation is not possible.
Note 1:
FIGURE 28-2:
3.00V
Voltage (VDDCORE)(1)
2.75V
2.7V
2.50V
PIC18F6XJ6X/8XJ6X/9XJ6X
2.35V
2.25V
2.00V
41.6667 MHz
4 MHz
Frequency
For frequencies between 4 MHz and 41.6667 MHz, FMAX = (107.619 MHz/V) * (VDDCORE 2V) + 4 MHz.
Note 1:
When the on-chip voltage regulator is disabled, VDD and VDDCORE must be maintained so that
VDDCOREVDD3.6V.
DS39762F-page 430
PIC18F97J60 FAMILY
28.1
DC Characteristics:
PIC18F97J60 Family
(Industrial)
Param
No.
Symbol
D001
VDD
D001B
Supply Voltage
Min
Typ
Max
Units
VDDCORE
2.7
3.1
3.6
3.6
3.6
V
V
V
2.0
2.7
D001C
AVDD
VDD 0.3
VDD + 0.3
D002
VDR
1.5
D003
VPOR
0.7
D004
SVDD
0.05
D005
BOR
Brown-out Reset
2.35
2.4
2.7
Note 1:
Conditions
ENVREG tied to VSS
ENVREG tied to VDD
Ethernet module enabled
(ECON2<5> = 1)
This is the limit to which VDD can be lowered in Sleep mode, or during a device Reset, without losing RAM
data.
DS39762F-page 431
PIC18F97J60 FAMILY
28.2
DC Characteristics:
PIC18F97J60 Family
(Industrial)
Param
No.
Device
Typ
Max
Units
Conditions
19.0
69.0
-40C
21.0
69.0
+25C
45.0
149.0
+85C
26.0
104.0
-40C
29.0
104.0
+25C
60.0
184.0
+85C
40.0
203.0
-40C
44.0
203.0
+25C
105.0
209.0
+85C
All devices
All devices
Note 1:
2:
3:
4:
5:
6:
VDD = 2.0V,
VDDCORE = 2.0V(4)
(Sleep mode)
VDD = 2.5V,
VDDCORE = 2.5V(4)
(Sleep mode)
VDD = 3.3V(5)
(Sleep mode)
The power-down current in Sleep mode does not depend on the oscillator type. Power-down current is measured with
the part in Sleep mode, with all I/O pins in high-impedance state and tied to VDD or VSS, and all features that add delta
current disabled (such as WDT, Timer1 oscillator, etc.).
The supply current is mainly a function of operating voltage, frequency and mode. Other factors, such as I/O pin loading
and switching rate, oscillator type and circuit, internal code execution pattern and temperature, also have an impact on
the current consumption.
The test conditions for all IDD measurements in active operation mode are:
OSC1 = external square wave, from rail-to-rail; all I/O pins tri-stated, pulled to VDD;
MCLR = VDD; WDT enabled/disabled as specified.
Standard, low-cost 32 kHz crystals have an operating temperature range of -10C to +70C. Extended temperature
crystals are available at a much higher cost.
Voltage regulator disabled (ENVREG = 0, tied to VSS).
Voltage regulator enabled (ENVREG = 1, tied to VDD).
For IETH, the specified current includes current sunk through TPOUT+ and TPOUT-. LEDA and LEDB are disabled for
all testing.
DS39762F-page 432
PIC18F97J60 FAMILY
28.2
DC Characteristics:
PIC18F97J60 Family
(Industrial)
Param
No.
Device
Typ
Max
Units
Conditions
12.0
34.0
-40C
12.0
34.0
+25C
74.0
108.0
+85C
20.0
45.0
-40C
20.0
45.0
+25C
+85C
All devices
82.0
126.0
168.0
-40C
105.0
168.0
+25C
182.0
246.0
+85C
All devices
All devices
All devices
Note 1:
2:
3:
4:
5:
6:
8.0
32.0
-40C
8.0
32.0
+25C
62.0
98.0
+85C
12.0
35.0
-40C
12.0
35.0
+25C
70.0
95.0
+85C
90.0
152.0
-40C
90.0
152.0
+25C
170.0
225.0
+85C
VDD = 2.0V,
VDDCORE = 2.0V(4)
VDD = 2.5V,
VDDCORE = 2.5V(4)
FOSC = 31 kHz
(RC_RUN mode,
Internal Oscillator Source)
VDD = 3.3V(5)
VDD = 2.0V,
VDDCORE = 2.0V(4)
VDD = 2.5V,
VDDCORE = 2.5V(4)
FOSC = 31 kHz
(RC_IDLE mode,
Internal Oscillator Source)
VDD = 3.3V(5)
The power-down current in Sleep mode does not depend on the oscillator type. Power-down current is measured with
the part in Sleep mode, with all I/O pins in high-impedance state and tied to VDD or VSS, and all features that add delta
current disabled (such as WDT, Timer1 oscillator, etc.).
The supply current is mainly a function of operating voltage, frequency and mode. Other factors, such as I/O pin loading
and switching rate, oscillator type and circuit, internal code execution pattern and temperature, also have an impact on
the current consumption.
The test conditions for all IDD measurements in active operation mode are:
OSC1 = external square wave, from rail-to-rail; all I/O pins tri-stated, pulled to VDD;
MCLR = VDD; WDT enabled/disabled as specified.
Standard, low-cost 32 kHz crystals have an operating temperature range of -10C to +70C. Extended temperature
crystals are available at a much higher cost.
Voltage regulator disabled (ENVREG = 0, tied to VSS).
Voltage regulator enabled (ENVREG = 1, tied to VDD).
For IETH, the specified current includes current sunk through TPOUT+ and TPOUT-. LEDA and LEDB are disabled for
all testing.
DS39762F-page 433
PIC18F97J60 FAMILY
28.2
DC Characteristics:
PIC18F97J60 Family
(Industrial)
Param
No.
Device
Typ
Max
Units
Conditions
0.8
1.5
mA
-40C
0.8
1.5
mA
+25C
0.9
1.7
mA
+85C
1.1
1.8
mA
-40C
1.1
1.8
mA
+25C
1.2
2.0
mA
+85C
2.1
3.4
mA
-40C
2.0
3.4
mA
+25C
2.1
3.4
mA
+85C
All devices
All devices
All devices
All devices
All devices
All devices
Note 1:
2:
3:
4:
5:
6:
9.2
14.5
mA
-40C
9.0
14.5
mA
+25C
9.2
14.5
mA
+85C
13.0
18.4
mA
-40C
12.4
18.4
mA
+25C
13.0
18.4
mA
+85C
13.4
19.8
mA
-40C
13.0
19.8
mA
+25C
13.4
19.8
mA
+85C
14.5
21.6
mA
-40C
14.4
21.6
mA
+25C
14.5
21.6
mA
+85C
VDD = 2.0V,
VDDCORE = 2.0V(4)
VDD = 2.5V,
VDDCORE = 2.5V(4)
FOSC = 1 MHZ
(PRI_RUN mode,
EC oscillator)
VDD = 3.3V(5)
VDD = 2.5V,
VDDCORE = 2.5V(4)
VDD = 3.3V(5)
VDD = 2.5V,
VDDCORE = 2.5V(4)
FOSC = 25 MHz
(PRI_RUN mode,
EC oscillator)
VDD = 3.3V(5)
The power-down current in Sleep mode does not depend on the oscillator type. Power-down current is measured with
the part in Sleep mode, with all I/O pins in high-impedance state and tied to VDD or VSS, and all features that add delta
current disabled (such as WDT, Timer1 oscillator, etc.).
The supply current is mainly a function of operating voltage, frequency and mode. Other factors, such as I/O pin loading
and switching rate, oscillator type and circuit, internal code execution pattern and temperature, also have an impact on
the current consumption.
The test conditions for all IDD measurements in active operation mode are:
OSC1 = external square wave, from rail-to-rail; all I/O pins tri-stated, pulled to VDD;
MCLR = VDD; WDT enabled/disabled as specified.
Standard, low-cost 32 kHz crystals have an operating temperature range of -10C to +70C. Extended temperature
crystals are available at a much higher cost.
Voltage regulator disabled (ENVREG = 0, tied to VSS).
Voltage regulator enabled (ENVREG = 1, tied to VDD).
For IETH, the specified current includes current sunk through TPOUT+ and TPOUT-. LEDA and LEDB are disabled for
all testing.
DS39762F-page 434
PIC18F97J60 FAMILY
28.2
DC Characteristics:
PIC18F97J60 Family
(Industrial)
Param
No.
Device
Typ
Max
Units
Conditions
2.8
5.2
mA
-40C
2.5
5.2
mA
+25C
2.8
5.2
mA
+85C
All devices
All devices
All devices
All devices
All devices
All devices
All devices
Note 1:
2:
3:
4:
5:
6:
3.6
6.4
mA
-40C
3.3
6.4
mA
+25C
3.6
6.4
mA
+85C
6.4
11.0
mA
-40C
6.0
11.0
mA
+25C
6.4
11.0
mA
+85C
7.8
12.5
mA
-40C
7.4
12.5
mA
+25C
7.8
12.5
mA
+85C
9.2
14.5
mA
-40C
9.0
14.5
mA
+25C
9.2
14.5
mA
+85C
13.0
18.4
mA
-40C
12.4
18.4
mA
+25C
13.0
18.4
mA
+85C
13.4
19.8
mA
-40C
13.0
19.8
mA
+25C
13.4
19.8
mA
+85C
14.5
21.6
mA
-40C
14.4
21.6
mA
+25C
14.5
21.6
mA
+85C
VDD = 2.5V,
VDDCORE = 2.5V(4)
FOSC = 25 MHZ,
2.7778 MHz internal
(PRI_RUN HS mode)
VDD = 3.3V(5)
VDD = 2.5V,
VDDCORE = 2.5V(4)
FOSC = 25 MHZ,
13.8889 MHz internal
(PRI_RUN HSPLL mode)
VDD = 3.3V(5)
VDD = 2.5V,
VDDCORE = 2.5V(4)
FOSC = 25 MHZ,
25 MHz internal
(PRI_RUN HS mode)
VDD = 3.3V(5)
VDD = 2.5V,
VDDCORE = 2.5V(4)
FOSC = 25 MHZ,
41.6667 MHz internal
(PRI_RUN HSPLL mode)
VDD = 3.3V(5)
The power-down current in Sleep mode does not depend on the oscillator type. Power-down current is measured with
the part in Sleep mode, with all I/O pins in high-impedance state and tied to VDD or VSS, and all features that add delta
current disabled (such as WDT, Timer1 oscillator, etc.).
The supply current is mainly a function of operating voltage, frequency and mode. Other factors, such as I/O pin loading
and switching rate, oscillator type and circuit, internal code execution pattern and temperature, also have an impact on
the current consumption.
The test conditions for all IDD measurements in active operation mode are:
OSC1 = external square wave, from rail-to-rail; all I/O pins tri-stated, pulled to VDD;
MCLR = VDD; WDT enabled/disabled as specified.
Standard, low-cost 32 kHz crystals have an operating temperature range of -10C to +70C. Extended temperature
crystals are available at a much higher cost.
Voltage regulator disabled (ENVREG = 0, tied to VSS).
Voltage regulator enabled (ENVREG = 1, tied to VDD).
For IETH, the specified current includes current sunk through TPOUT+ and TPOUT-. LEDA and LEDB are disabled for
all testing.
DS39762F-page 435
PIC18F97J60 FAMILY
28.2
DC Characteristics:
PIC18F97J60 Family
(Industrial)
Param
No.
Device
Typ
Max
Units
Conditions
0.5
1.1
mA
-40C
0.5
1.1
mA
+25C
0.6
1.2
mA
+85C
0.9
1.4
mA
-40C
0.9
1.4
mA
+25C
1.0
1.5
mA
+85C
1.9
2.6
mA
-40C
1.8
2.6
mA
+25C
1.9
2.6
mA
+85C
All devices
All devices
All devices
All devices
All devices
All devices
Note 1:
2:
3:
4:
5:
6:
5.9
9.5
mA
-40C
5.6
9.5
mA
+25C
5.9
9.5
mA
+85C
7.5
13.2
mA
-40C
7.2
13.2
mA
+25C
7.5
13.2
mA
+85C
8.6
14.0
mA
-40C
8.0
14.0
mA
+25C
8.6
14.0
mA
+85C
9.8
16.0
mA
-40C
9.4
16.0
mA
+25C
9.8
16.0
mA
+85C
VDD = 2.0V,
VDDCORE = 2.0V(4)
VDD = 2.5V,
VDDCORE = 2.5V(4)
FOSC = 1 MHz
(PRI_IDLE mode,
EC oscillator)
VDD = 3.3V(5)
VDD = 2.5V,
VDDCORE = 2.5V(4)
FOSC = 25 MHZ
(PRI_IDLE mode,
EC oscillator)
VDD = 3.3V(5)
VDD = 2.5V,
VDDCORE = 2.5V(4)
VDD = 3.3V(5)
The power-down current in Sleep mode does not depend on the oscillator type. Power-down current is measured with
the part in Sleep mode, with all I/O pins in high-impedance state and tied to VDD or VSS, and all features that add delta
current disabled (such as WDT, Timer1 oscillator, etc.).
The supply current is mainly a function of operating voltage, frequency and mode. Other factors, such as I/O pin loading
and switching rate, oscillator type and circuit, internal code execution pattern and temperature, also have an impact on
the current consumption.
The test conditions for all IDD measurements in active operation mode are:
OSC1 = external square wave, from rail-to-rail; all I/O pins tri-stated, pulled to VDD;
MCLR = VDD; WDT enabled/disabled as specified.
Standard, low-cost 32 kHz crystals have an operating temperature range of -10C to +70C. Extended temperature
crystals are available at a much higher cost.
Voltage regulator disabled (ENVREG = 0, tied to VSS).
Voltage regulator enabled (ENVREG = 1, tied to VDD).
For IETH, the specified current includes current sunk through TPOUT+ and TPOUT-. LEDA and LEDB are disabled for
all testing.
DS39762F-page 436
PIC18F97J60 FAMILY
28.2
DC Characteristics:
PIC18F97J60 Family
(Industrial)
Param
No.
Device
Typ
Max
Units
Conditions
22.0
45.0
-10C
22.0
45.0
+25C
78.0
114.0
+70C
27.0
52.0
-10C
27.0
52.0
+25C
+70C
All devices
92.0
135.0
168.0
-10C
106.0
168.0
+25C
188.0
246.0
+70C
All devices
All devices
All devices
Note 1:
2:
3:
4:
5:
6:
18.0
37.0
-10C
18.0
37.0
+25C
75.0
105.0
+70C
21.0
40.0
-10C
21.0
40.0
+25C
84.0
98.0
+70C
94.0
152.0
-10C
94.0
152.0
+25C
182.0
225.0
+70C
VDD = 2.0V,
VDDCORE = 2.0V(4)
VDD = 2.5V,
VDDCORE = 2.5V(4)
FOSC = 32 kHz(3)
(SEC_RUN mode,
Timer1 as clock)
VDD = 3.3V(5)
VDD = 2.0V,
VDDCORE = 2.0V(4)
VDD = 2.5V,
VDDCORE = 2.5V(4)
FOSC = 32 kHz(3)
(SEC_IDLE mode,
Timer1 as clock)
VDD = 3.3V(5)
The power-down current in Sleep mode does not depend on the oscillator type. Power-down current is measured with
the part in Sleep mode, with all I/O pins in high-impedance state and tied to VDD or VSS, and all features that add delta
current disabled (such as WDT, Timer1 oscillator, etc.).
The supply current is mainly a function of operating voltage, frequency and mode. Other factors, such as I/O pin loading
and switching rate, oscillator type and circuit, internal code execution pattern and temperature, also have an impact on
the current consumption.
The test conditions for all IDD measurements in active operation mode are:
OSC1 = external square wave, from rail-to-rail; all I/O pins tri-stated, pulled to VDD;
MCLR = VDD; WDT enabled/disabled as specified.
Standard, low-cost 32 kHz crystals have an operating temperature range of -10C to +70C. Extended temperature
crystals are available at a much higher cost.
Voltage regulator disabled (ENVREG = 0, tied to VSS).
Voltage regulator enabled (ENVREG = 1, tied to VDD).
For IETH, the specified current includes current sunk through TPOUT+ and TPOUT-. LEDA and LEDB are disabled for
all testing.
DS39762F-page 437
PIC18F97J60 FAMILY
28.2
DC Characteristics:
PIC18F97J60 Family
(Industrial)
Param
No.
D022
(IWDT)
Device
D027
IETH(6)
4:
5:
6:
Units
Conditions
VDD = 2.0V,
VDDCORE = 2.0V(4)
7.0
19.0
8.0
A
A
A
+25C
+85C
-40C
3.0
14.0
5.0
5.0
19.0
12.0
8.0
22.0
12.0
12.0
30.0
20.0
A
A
A
A
A
A
+25C
+85C
-40C
+25C
+85C
-40C
12.0
24.0
13.0
20.0
36.0
21.0
A
A
A
+25C
+85C
-40C
13.0
26.0
14.0
14.0
29.0
21.0
38.0
25.0
25.0
40.0
A
A
A
A
A
+25C
+85C
-40C
+25C
+85C
1.2
10.0
-40C to +85C
VDD = 2.0V,
VDDCORE = 2.0V(4)
1.2
10.0
-40C to +85C
VDD = 2.5V,
VDDCORE = 2.5V(4)
1.2
Ethernet Module 130.0
11.0
156.0
A
mA
-40C to +85C
-40C to +85C
180.0
214.0
mA
-40C to +85C
A/D Converter
3:
Max
2.4
12.0
3.0
Timer1 Oscillator
D026
(IAD)
2:
Typ
D025
(IOSCB)
Note 1:
VDD = 2.5V,
VDDCORE = 2.5V(4)
VDD = 3.3V(5)
VDD = 2.0V,
VDDCORE = 2.0V(4)
32 kHz on Timer1(3)
VDD = 2.5V,
VDDCORE = 2.5V(4)
32 kHz on Timer1(3)
VDD = 3.3V(5)
32 kHz on Timer1(3)
VDD = 3.3V(5)
VDD = 3.3V(5)
No transmit activity
Transmission in progress
The power-down current in Sleep mode does not depend on the oscillator type. Power-down current is measured with
the part in Sleep mode, with all I/O pins in high-impedance state and tied to VDD or VSS, and all features that add delta
current disabled (such as WDT, Timer1 oscillator, etc.).
The supply current is mainly a function of operating voltage, frequency and mode. Other factors, such as I/O pin loading
and switching rate, oscillator type and circuit, internal code execution pattern and temperature, also have an impact on
the current consumption.
The test conditions for all IDD measurements in active operation mode are:
OSC1 = external square wave, from rail-to-rail; all I/O pins tri-stated, pulled to VDD;
MCLR = VDD; WDT enabled/disabled as specified.
Standard, low-cost 32 kHz crystals have an operating temperature range of -10C to +70C. Extended temperature
crystals are available at a much higher cost.
Voltage regulator disabled (ENVREG = 0, tied to VSS).
Voltage regulator enabled (ENVREG = 1, tied to VDD).
For IETH, the specified current includes current sunk through TPOUT+ and TPOUT-. LEDA and LEDB are disabled for
all testing.
DS39762F-page 438
PIC18F97J60 FAMILY
28.3
DC CHARACTERISTICS
Param
Symbol
No.
VIL
Characteristic
Min
Max
Units
Conditions
D030
D031
VSS
0.15VDD
VDD <2.7V
VSS
0.8
VSS
0.2 VDD
D032
MCLR
VSS
0.2 VDD
D033
OSC1
VSS
0.3 VDD
D033A
OSC1
VSS
0.2 VDD
EC mode
D034
T13CKI
VSS
0.3
VDD
0.8 VDD
VDD
5.5
VIH
D040
D041
0.8 VDD
5.5
D042
MCLR
0.8 VDD
VDD
D043
OSC1
0.7 VDD
VDD
D043A
OSC1
0.8 VDD
VDD
EC mode
1.6
VDD
D044
T13CKI
IIL
D060
I/O Ports
D061
MCLR
OSC1
80
400
D063
D070
Note 1:
IPU
IPURB
DS39762F-page 439
PIC18F97J60 FAMILY
28.3
DC CHARACTERISTICS
Param
Symbol
No.
VOL
D080
Characteristic
Min
Max
Units
Conditions
PORTD, PORTE,
PORTJ
0.4
PORTA<5:2>, PORTF,
PORTG, PORTH
0.4
PORTA<1:0>, PORTB,
PORTC
0.4
0.4
PORTD, PORTE,
PORTJ
2.4
PORTA<5:2>, PORTF,
PORTG, PORTH
2.4
PORTA<1:0>, PORTB,
PORTC
2.4
2.4
15
pF
In HS mode when
external clock is used to
drive OSC1
D083
OSC2/CLKO
(EC, ECPLL modes)
VOH
D090
D092
OSC2/CLKO
(EC, ECPLL modes)
D101
CIO
50
pF
D102
CB
SCLx, SDAx
400
pF
I2C specification
Note 1:
DS39762F-page 440
PIC18F97J60 FAMILY
TABLE 28-1:
DC CHARACTERISTICS
Param
No.
Sym
Characteristic
Min
Typ
Max
Units
Conditions
EP
Cell Endurance
100
1K
D131
VPR
VMIN
3.6
2.70
2.35
3.6
2.7
V
V
2.8
ms
20
10
mA
D132B VPEW
D133A TIW
D134
D135
IDDP
Data in Typ column is at 3.3V, 25C unless otherwise stated. These parameters are for design guidance
only and are not tested.
DS39762F-page 441
PIC18F97J60 FAMILY
TABLE 28-2:
COMPARATOR SPECIFICATIONS
Operating Conditions: 3.0V VDD 3.6V, -40C TA +85C (unless otherwise stated)
Param
No.
Sym
Characteristics
Min
Typ
Max
Units
D300
VIOFF
5.0
25
mV
D301
VICM
AVDD 1.5
D302
CMRR
55
dB
300
TRESP
Response Time(1)*
150
400
ns
301
TMC2OV
10
*
Note 1:
Comments
TABLE 28-3:
Operating Conditions: 3.0V VDD 3.6V, -40C TA +85C (unless otherwise stated)
Param
No.
Sym
Characteristics
Min
Typ
Max
Units
VDD/24
VDD/32
LSb
VRES
Resolution
D311
VRAA
Absolute Accuracy
1/2
LSb
D312
VRUR
2k
TSET
Time(1)
10
D310
310
Note 1:
Settling
Comments
Settling time measured while CVRR = 1 and CVR<3:0> transitions from 0000 to 1111.
TABLE 28-4:
Sym
Characteristics
Min
Typ
Max
Units
VRGOUT
2.5
CF
10
DS39762F-page 442
Comments
PIC18F97J60 FAMILY
28.4
28.4.1
AC (Timing) Characteristics
TIMING PARAMETER SYMBOLOGY
3. TCC:ST
4. Ts
Time
osc
rd
rw
sc
ss
t0
t1
wr
OSC1
RD
RD or WR
SCKx
SSx
T0CKI
T13CKI
WR
P
R
V
Z
Period
Rise
Valid
High-Impedance
High
Low
High
Low
SU
Setup
STO
Stop condition
DS39762F-page 443
PIC18F97J60 FAMILY
28.4.2
TIMING CONDITIONS
TABLE 28-5:
AC CHARACTERISTICS
FIGURE 28-3:
Load Condition 1
VDD/2
RL
CL
Pin
CL
Pin
VSS
VSS
RL = 464
DS39762F-page 444
CL = 50 pF
CL = 15 pF
for OSC2/CLKO
PIC18F97J60 FAMILY
28.4.3
FIGURE 28-4:
Q1
Q2
Q3
Q4
Q1
OSC1
1
CLKO
TABLE 28-6:
Param.
No.
1A
Symbol
FOSC
Characteristic
Min
Max
Units
DC
41.6667
MHz
TOSC
EC Oscillator mode
25
MHz
HS Oscillator mode
24
ns
EC Oscillator mode
Oscillator Period(1)
Oscillator Frequency
1
(1)
Conditions
40
167
ns
HS Oscillator mode
TCY
96
ns
TOSL,
TOSH
10
ns
EC Oscillator mode
TOSR,
TOSF
7.5
ns
EC Oscillator mode
50
ppm
5
Note 1:
Instruction cycle period (TCY) equals four times the input oscillator time base period for all configurations
except PLL. All specified values are based on characterization data for that particular oscillator type under
standard operating conditions with the device executing code. Exceeding these specified limits may result
in an unstable oscillator operation and/or higher than expected current consumption. All devices are tested
to operate at min. values with an external clock applied to the OSC1/CLKI pin. When an external clock
input is used, the max. cycle time limit is DC (no clock) for all devices.
DS39762F-page 445
PIC18F97J60 FAMILY
TABLE 28-7:
Param
No.
Sym
Characteristic
Min
Typ
Max
Units
Conditions
F10
8
8
25
37.5
F11
FSYS
20
62.5
MHz
F12
trc
ms
F13
CLK
-2
+2
Data in Typ column is at 3.3V, 25C, unless otherwise stated. These parameters are for design guidance
only and are not tested.
TABLE 28-8:
Param
No.
Note 1:
Characteristic
Min
Typ
Max
Units
21.7
40.3
kHz
Conditions
DS39762F-page 446
PIC18F97J60 FAMILY
FIGURE 28-5:
Q4
Q2
Q3
OSC1
11
10
CLKO
13
12
14
18
19
16
I/O pin
(Input)
15
17
I/O pin
(Output)
New Value
Old Value
20, 21
Refer to Figure 28-3 for load conditions.
Note:
TABLE 28-9:
Param
No.
Symbol
Characteristic
Min
Typ
Max
Units Conditions
10
75
200
ns
11
75
200
ns
12
TCKR
15
30
ns
13
TCKF
15
30
ns
0.5 TCY + 20
ns
0.25 TCY + 25
ns
14
15
16
TCKH2IOI
17
18
TOSH2IOI
19
ns
50
150
ns
100
ns
ns
20
TIOR
ns
21
TIOF
ns
22
TINP
TCY
ns
23
TRBP
TCY
ns
These parameters are asynchronous events not related to any internal clock edges.
DS39762F-page 447
PIC18F97J60 FAMILY
FIGURE 28-6:
Q2
Q3
Q4
Q1
Q2
OSC1
A<19:16>
BA0
AD<15:0>
Address
Address
Address
150
151
Address
163
160
162
161
155
166
167
ALE
168
164
169
171
CE
171A
OE
165
Operating Conditions: 2.0V < VCC < 3.6V, -40C < TA < +125C, unless otherwise stated.
Symbol
Characteristics
Min
Typ
Max
Units
150
TadV2alL
0.25 TCY 10
ns
151
TalL2adl
ns
155
TalL2oeL
ALE to OE
10
0.125 TCY
ns
160
TadZ2oeL
ns
161
ToeH2adD OE to AD Driven
0.125 TCY 5
ns
162
20
ns
163
ToeH2adl
ns
164
TalH2alL
165
TCY
ns
0.5 TCY 5
0.5 TCY
ns
166
TalH2alH
0.25 TCY
ns
167
Tacc
0.75 TCY 25
ns
168
Toe
OE to Data Valid
0.5 TCY 25
ns
169
TalL2oeH
ALE to OE
0.625 TCY 10
0.625 TCY + 10
ns
171
TalH2csL
0.25 TCY 20
ns
171A
10
ns
DS39762F-page 448
PIC18F97J60 FAMILY
FIGURE 28-7:
Q2
Q3
Q4
Q1
Q2
OSC1
A<19:16>
BA0
Address
Address
166
AD<15:0>
Data
Address
Address
153
150
156
151
ALE
171
CE
171A
154
WRH or
WRL
157A
157
UB or
LB
Operating Conditions: 2.0V < VCC < 3.6V, -40C < TA < +125C, unless otherwise stated.
Symbol
Characteristics
Min
Typ
Max
Units
150
TadV2alL
0.25 TCY 10
ns
151
TalL2adl
ns
153
TwrH2adl
154
TwrL
156
157
157A
TwrH2bsI
166
TalH2alH
171
TalH2csL
171A
ns
0.5 TCY 5
0.5 TCY
ns
0.5 TCY 10
ns
0.25 TCY
ns
0.125 TCY 5
ns
0.25 TCY
ns
0.25 TCY 20
ns
10
ns
DS39762F-page 449
PIC18F97J60 FAMILY
FIGURE 28-8:
VDD
MCLR
30
Internal
POR
33
PWRT
Time-out
32
Oscillator
Time-out
Internal
Reset
Watchdog
Timer
Reset
31
34
34
I/O pins
Note:
TABLE 28-12: RESET, WATCHDOG TIMER, OSCILLATOR START-UP TIMER, POWER-UP TIMER
AND BROWN-OUT RESET REQUIREMENTS
Param.
Symbol
No.
Characteristic
Min
Typ
Max
Units
Conditions
30
TMCL
31
TWDT
2.8
4.1
5.4
ms
32
TOST
1024 TOSC
1024 TOSC
33
TPWRT
46.2
66
85.8
ms
34
TIOZ
3TCY + 2
415
200
38
TCSD
DS39762F-page 450
PIC18F97J60 FAMILY
FIGURE 28-9:
41
40
42
T1OSO/T13CKI
46
45
47
48
TMR0 or
TMR1
Note:
Symbol
Characteristic
40
TT0H
41
TT0L
42
TT0P
T0CKI Period
No prescaler
With prescaler
No prescaler
With prescaler
No prescaler
With prescaler
45
46
47
TT1H
TT1L
Max
Units
0.5 TCY + 20
ns
10
ns
0.5 TCY + 20
ns
10
ns
TCY + 10
ns
Greater of:
20 ns or
(TCY + 40)/N
ns
0.5 TCY + 20
ns
10
ns
Asynchronous
30
ns
0.5 TCY + 5
ns
10
ns
Asynchronous
30
ns
Greater of:
20 ns or
(TCY + 40)/N
ns
TT1P
FT 1
Asynchronous
48
Min
60
ns
DC
50
kHz
2 TOSC
7 TOSC
Conditions
N = prescale
value
(1, 2, 4,..., 256)
N = prescale
value
(1, 2, 4, 8)
DS39762F-page 451
PIC18F97J60 FAMILY
FIGURE 28-10:
50
51
52
CCPx
(Compare or PWM Mode)
53
Note:
54
TCCL
TCCH
Characteristic
Min
Max
Units
0.5 TCY + 20
ns
10
ns
CCPx Input
High Time
0.5 TCY + 20
ns
10
ns
3 TCY + 40
N
ns
No prescaler
With prescaler
TCCP
53
TCCR
25
ns
54
TCCF
25
ns
52
Conditions
N = prescale
value (1, 4 or 16)
Symbol
Characteristic
Min
Max
Units
62
TdtV2wrH
20
ns
63
TwrH2dtI
20
ns
64
TrdL2dtV
80
ns
65
TrdH2dtI
RD or CS to DataOut Invalid
10
30
ns
66
TibfINH
3 TCY
DS39762F-page 452
Conditions
PIC18F97J60 FAMILY
FIGURE 28-11:
SCKx
(CKP = 0)
78
79
79
78
SCKx
(CKP = 1)
80
bit 6 - - - - - - 1
MSb
SDOx
LSb
75, 76
SDIx
MSb In
bit 6 - - - - 1
LSb In
74
73
Note:
Symbol
Characteristic
Min
Max Units
73
TDIV2SCH,
TDIV2SCL
100
ns
74
TSCH2DIL,
TSCL2DIL
100
ns
75
TDOR
25
ns
76
TDOF
25
ns
78
TSCR
25
ns
79
TSCF
25
ns
80
50
ns
Conditions
DS39762F-page 453
PIC18F97J60 FAMILY
FIGURE 28-12:
SCKx
(CKP = 0)
79
73
SCKx
(CKP = 1)
80
78
MSb
SDOx
bit 6 - - - - - - 1
LSb
bit 6 - - - - 1
LSb In
75, 76
SDIx
MSb In
74
Note:
Symbol
Characteristic
Min
Max Units
73
TDIV2SCH,
TDIV2SCL
100
ns
74
TSCH2DIL,
TSCL2DIL
100
ns
75
TDOR
25
ns
76
TDOF
25
ns
78
TSCR
25
ns
79
TSCF
80
81
DS39762F-page 454
25
ns
50
ns
TCY
ns
Conditions
PIC18F97J60 FAMILY
FIGURE 28-13:
SSx
70
SCKx
(CKP = 0)
83
71
72
SCKx
(CKP = 1)
80
MSb
SDOx
bit 6 - - - - - - 1
LSb
75, 76
MSb In
SDIx
SDI
77
bit 6 - - - - 1
LSb In
74
73
Refer to Figure 28-3 for load conditions.
Note:
TABLE 28-18: EXAMPLE SPI MODE REQUIREMENTS (SLAVE MODE TIMING, CKE = 0)
Param
No.
Symbol
Characteristic
70
71
TSCH
71A
72
TSCL
72A
Min
TCY
ns
Continuous
1.25 TCY + 30
ns
Single Byte
40
ns
Continuous
1.25 TCY + 30
ns
40
ns
100
ns
ns
100
ns
Single Byte
73
73A
TB2B
74
75
TDOR
25
ns
76
TDOF
25
ns
77
10
50
ns
80
50
ns
83
1.5 TCY + 40
ns
Note 1:
2:
Last Clock Edge of Byte 1 to the First Clock Edge of Byte 2 1.5 TCY + 40
(Note 1)
(Note 1)
(Note 2)
DS39762F-page 455
PIC18F97J60 FAMILY
FIGURE 28-14:
SSx
SCKx
(CKP = 0)
70
83
71
72
SCKx
(CKP = 1)
80
MSb
SDOx
bit 6 - - - - - - 1
LSb
75, 76
SDI
SDIx
MSb In
77
bit 6 - - - - 1
LSb In
74
Note:
Symbol
Characteristic
70
71
TSCH
71A
72
TSCL
72A
Min
TCY
ns
Continuous
1.25 TCY + 30
ns
Single Byte
40
ns
Continuous
1.25 TCY + 30
ns
Single Byte
40
ns
(Note 1)
ns
(Note 2)
ns
73A
TB2B
74
Last Clock Edge of Byte 1 to the First Clock Edge of Byte 2 1.5 TCY + 40
100
75
TDOR
25
ns
76
TDOF
25
ns
77
10
50
ns
80
50
ns
82
50
ns
83
1.5 TCY + 40
ns
Note 1:
2:
(Note 1)
DS39762F-page 456
PIC18F97J60 FAMILY
FIGURE 28-15:
SCLx
91
93
90
92
SDAx
Stop
Condition
Start
Condition
Note:
Characteristic
90
TSU:STA
Start Condition
91
THD:STA
92
TSU:STO
93
Max
Units
Conditions
4700
ns
ns
Setup Time
600
Start Condition
4000
Hold Time
600
Stop Condition
4700
Setup Time
Hold Time
FIGURE 28-16:
Min
600
4000
600
ns
ns
102
100
101
SCLx
90
106
107
91
92
SDAx
In
110
109
109
SDAx
Out
Note:
DS39762F-page 457
PIC18F97J60 FAMILY
TABLE 28-21: I2C BUS DATA REQUIREMENTS (SLAVE MODE)
Param.
Symbol
No.
100
THIGH
101
TLOW
102
TR
103
TF
90
91
106
Characteristic
Clock High Time
110
2:
0.6
MSSP module
1.5 TCY
4.7
1.3
1.5 TCY
1000
ns
300
ns
300
ns
300
ns
CB is specified to be from
10 to 400 pF
Only relevant for Repeated
Start condition
0.6
4.0
0.6
ns
0.9
CB
Note 1:
4.0
TBUF
D102
TAA
Conditions
MSSP module
250
ns
100
ns
4.7
0.6
3500
ns
ns
109
Units
92
Max
107
Min
4.7
1.3
400
pF
CB is specified to be from
10 to 400 pF
(Note 2)
(Note 1)
Time the bus must be free
before a new transmission
can start
As a transmitter, the device must provide this internal minimum delay time to bridge the undefined region
(min. 300 ns) of the falling edge of SCLx to avoid unintended generation of Start or Stop conditions.
A Fast mode I2C bus device can be used in a Standard mode I2C bus system, but the requirement,
TSU:DAT 250 ns, must then be met. This will automatically be the case if the device does not stretch the
LOW period of the SCLx signal. If such a device does stretch the LOW period of the SCLx signal, it must
output the next data bit to the SDAx line,
TR max. + TSU:DAT = 1000 + 250 = 1250 ns (according to the Standard mode I2C bus specification), before
the SCLx line is released.
DS39762F-page 458
PIC18F97J60 FAMILY
FIGURE 28-17:
SCLx
93
91
90
92
SDAx
Stop
Condition
Start
Condition
Note:
TSU:STA
Characteristic
Start Condition
Setup Time
91
92
93
Note 1:
Min
Max
Units
2(TOSC)(BRG + 1)
ns
ns
2(TOSC)(BRG + 1)
1 MHz mode(1)
2(TOSC)(BRG + 1)
2(TOSC)(BRG + 1)
2(TOSC)(BRG + 1)
1 MHz mode(1)
2(TOSC)(BRG + 1)
2(TOSC)(BRG + 1)
2(TOSC)(BRG + 1)
1 MHz mode(1)
2(TOSC)(BRG + 1)
2(TOSC)(BRG + 1)
2(TOSC)(BRG + 1)
1 MHz mode(1)
2(TOSC)(BRG + 1)
Conditions
ns
ns
FIGURE 28-18:
102
100
101
SCLx
90
106
91
107
92
SDAx
In
109
109
110
SDAx
Out
Note:
DS39762F-page 459
PIC18F97J60 FAMILY
TABLE 28-23: MASTER SSP I2C BUS DATA REQUIREMENTS
Param.
Symbol
No.
100
101
THIGH
TLOW
Characteristic
Min
Max
Units
2(TOSC)(BRG + 1)
ms
2(TOSC)(BRG + 1)
ms
1 MHz mode(1)
2(TOSC)(BRG + 1)
ms
2(TOSC)(BRG + 1)
ms
2(TOSC)(BRG + 1)
ms
(1)
2(TOSC)(BRG + 1)
ms
1000
ns
20 + 0.1 CB
300
ns
300
ns
1 MHz mode
102
TR
103
90
91
106
107
92
109
110
D102
TF
TSU:STA
Data Input
Setup Time
TBUF
CB
Output Valid
from Clock
Bus Free Time
300
ns
20 + 0.1 CB
300
ns
1 MHz mode(1)
100
ns
2(TOSC)(BRG + 1)
ms
2(TOSC)(BRG + 1)
ms
1 MHz mode(1)
2(TOSC)(BRG + 1)
ms
2(TOSC)(BRG + 1)
ms
2(TOSC)(BRG + 1)
ms
1 MHz mode(1)
2(TOSC)(BRG + 1)
ms
ns
0.9
ms
1 MHz mode(1)
TBD
ns
250
ns
100
ns
1 MHz mode(1)
TBD
ns
2(TOSC)(BRG + 1)
ms
2(TOSC)(BRG + 1)
ms
1 MHz mode(1)
2(TOSC)(BRG + 1)
ms
3500
ns
1000
ns
(1)
1 MHz mode
ns
4.7
ms
1.3
ms
1 MHz mode(1)
TBD
ms
400
pF
Conditions
CB is specified to be from
10 to 400 pF
CB is specified to be from
10 to 400 pF
Only relevant for
Repeated Start
condition
After this period, the first
clock pulse is generated
(Note 2)
DS39762F-page 460
PIC18F97J60 FAMILY
FIGURE 28-19:
TXx/CKx
pin
121
121
RXx/DTx
pin
120
Note:
122
Symbol
Characteristic
Min
Max
Units
120
40
ns
121
TCKRF
20
ns
122
TDTRF
20
ns
FIGURE 28-20:
Conditions
TXx/CKx
pin
125
RXx/DTx
pin
126
Note:
Symbol
Characteristic
125
126
TCKL2DTL
Min
Max
Units
10
ns
15
ns
Conditions
DS39762F-page 461
PIC18F97J60 FAMILY
TABLE 28-26: A/D CONVERTER CHARACTERISTICS: PIC18F97J60 FAMILY (INDUSTRIAL)
Param
Symbol
No.
Characteristic
Min
Typ
Max
Units
10
bit
Conditions
VREF 2.0V
A01
NR
Resolution
A03
EIL
<1
A04
EDL
<1
A06
EOFF
Offset Error
<3
A07
EGN
Gain Error
<3
A10
Monotonicity
A20
VREF
1.8
3
V
V
VDD 3.0V
VDD 3.0V
AVDD + 0.5
Guaranteed(1)
VREFH
VREFL
AVDD
A22
VREFL
AVSS
VREFH
A25
VAIN
VREFL
VREFH
A30
ZAIN
Recommended Impedance of
Analog Voltage Source
2.5
A50
IREF
5
1000
A
A
Note 1:
2:
The A/D conversion result never decreases with an increase in the input voltage and has no missing
codes.
VREFH current is from RA3/AN3/VREF+ pin or AVDD, whichever is selected as the VREFH source.
VREFL current is from RA2/AN2/VREF- pin or AVSS, whichever is selected as the VREFL source.
FIGURE 28-21:
BSF ADCON0, GO
(Note 2)
131
Q4
A/D CLK(1)
130
132
A/D DATA
...
...
OLD_DATA
ADRES
NEW_DATA
TCY
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.
DS39762F-page 462
PIC18F97J60 FAMILY
TABLE 28-27: A/D CONVERSION REQUIREMENTS
Param
Symbol
No.
Characteristic
Min
Max
Units
0.7
25.0(1)
130
TAD
TBD
131
TCNV
Conversion Time
(not including acquisition time) (Note 2)
11
12
TAD
s
132
TACQ
1.4
135
TSWC
(Note 4)
TBD
TDIS
Discharge Time
0.2
Legend:
Note 1:
2:
3:
4:
28.5
Conditions
-40C to +85C
TBD = To Be Determined
The time of the A/D clock period is dependent on the device frequency and the TAD clock divider.
ADRES registers may be read on the following TCY cycle.
The time for the holding capacitor to acquire the New input voltage when the voltage changes full scale
after the conversion (VDD to VSS or VSS to VDD). The source impedance (RS) on the input channels is 50.
On the following cycle of the device clock.
Min
Norm
Max
Units
1:1
TX Turns Ratio
1:1
Insertion Loss
-1.1
dB
RX Turns Ratio
Primary Inductance
350
Transformer Isolation
1.5
Differential to Common-Mode
Rejection
40
dB
Return Loss
-16
dB
Conditions
Transformer Center Tap = 3.3V
8 mA bias
DS39762F-page 463
PIC18F97J60 FAMILY
NOTES:
DS39762F-page 464
PIC18F97J60 FAMILY
29.0
PACKAGING INFORMATION
29.1
64-Lead TQFP
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
YYWWNNN
18F67J60I/PT e3
1110017
Example
80-Lead TQFP
XXXXXXXXXXXX
XXXXXXXXXXXX
YYWWNNN
XXXXXXXXXXXX
XXXXXXXXXXXX
YYWWNNN
XXXXXXXXXXXX
XXXXXXXXXXXX
YYWWNNN
Legend: XX...X
Y
YY
WW
NNN
e3
Note:
PIC18F87J60I/PT e3
1110017
Example
PIC18F97J60I/PT e3
1110017
Example
PIC18F97J60I/PF e3
1110017
Customer-specific information
Year code (last digit of calendar year)
Year code (last 2 digits of calendar year)
Week code (week of January 1 is week 01)
Alphanumeric traceability code
Pb-free JEDEC designator for Matte Tin (Sn)
This package is Pb-free. The Pb-free JEDEC designator ( e3 )
can be found on the outer packaging for this package.
In the event the full Microchip part number cannot be marked on one line, it will
be carried over to the next line, thus limiting the number of available
characters for customer-specific information.
DS39762F-page 465
PIC18F97J60 FAMILY
29.2
Package Details
!" #$ %
&
'
(
E
e
E1
N
b
NOTE 1
123
NOTE 2
A
c
A2
A1
L1
6&!
'
!7'&!
8"')
%7
#!
'
77..
8
89
:
;
7 #&
9 < &
/1+
=
/
/
&#%%
/
/
3&7 &
/
;
/
3&
&
7
.3
3&
9 ?#&
>
1+
/>
9 7 &
1+
.
1+
1+
>
7 #4 !!
7 #?#&
>
>
>
>
>
>
(
!"#
$%
&"
' ()"&'"!&)
&
#*&&
&
#
+'%
!&
!
&,!-
'
'
!!#.#&"#
'#%!
&"!!#%!
&"!!!&
$
#/''
!#
'
!#&
.0/
1+2 1!'
!
&
$& "
!**&"&&
!
.32
%
'
!("!"*&"&&
(%%'&
"
!
!
* + @/1
DS39762F-page 466
PIC18F97J60 FAMILY
!" #$ %
&
'
(
DS39762F-page 467
PIC18F97J60 FAMILY
)
## !" #$ %
&
'
(
E
e
E1
NOTE 1
12 3
NOTE 2
A2
A1
L1
6&!
'
!7'&!
8"')
%7
#!
'
77..
8
89
:
@
7 #&
9 < &
/1+
=
/
/
&#%%
/
/
3&7 &
/
;
/
3&
&
7
.3
3&
9 ?#&
>
1+
/>
9 7 &
1+
.
1+
1+
>
7 #4 !!
7 #?#&
>
>
>
>
>
>
(
!"#
$%
&"
' ()"&'"!&)
&
#*&&
&
#
+'%
!&
!
&,!-
'
'
!!#.#&"#
'#%!
&"!!#%!
&"!!!&
$
#/''
!#
'
!#&
.0/
1+2 1!'
!
&
$& "
!**&"&&
!
.32
%
'
!("!"*&"&&
(%%'&
"
!
!
* + 1
DS39762F-page 468
PIC18F97J60 FAMILY
)
## !" #$ %
&
'
(
DS39762F-page 469
PIC18F97J60 FAMILY
## !" #$ %
&
'
(
e
E
E1
NOTE 1
1 23
NOTE 2
A1
6&!
'
!7'&!
8"')
%7
#!
'
A2
L1
77..
8
89
:
7 #&
9 < &
1+
=
/
/
&#%%
/
/
3&7 &
/
;
/
3&
&
7
.3
3&
9 ?#&
>
1+
/>
9 7 &
1+
.
1+
1+
>
7 #4 !!
7 #?#&
@
>
>
>
>
>
>
(
!"#
$%
&"
' ()"&'"!&)
&
#*&&
&
#
+'%
!&
!
&,!-
'
'
!!#.#&"#
'#%!
&"!!#%!
&"!!!&
$
#/''
!#
'
!#&
.0/
1+2 1!'
!
&
$& "
!**&"&&
!
.32
%
'
!("!"*&"&&
(%%'&
"
!
!
* + 1
DS39762F-page 470
PIC18F97J60 FAMILY
## !" #$ %
&
'
(
DS39762F-page 471
PIC18F97J60 FAMILY
!" #$ %
&
'
(
E1
E
b
N
NOTE 1
1 23
NOTE 2
A2
A1
L1
6&!
'
!7'&!
8"')
%7
#!
'
77..
8
89
:
7 #&
9 < &
/1+
=
/
/
&#%%
/
/
3&7 &
/
;
/
3&
&
7
.3
3&
9 ?#&
>
;1+
/>
9 7 &
;1+
.
1+
1+
>
7 #4 !!
7 #?#&
>
>
>
>
>
>
(
!"#
$%
&"
' ()"&'"!&)
&
#*&&
&
#
+'%
!&
!
&,!-
'
'
!!#.#&"#
'#%!
&"!!#%!
&"!!!&
$
#/''
!#
'
!#&
.0/
1+2 1!'
!
&
$& "
!**&"&&
!
.32
%
'
!("!"*&"&&
(%%'&
"
!
!
* + 1
DS39762F-page 472
PIC18F97J60 FAMILY
!" #$ %
&
'
(
DS39762F-page 473
PIC18F97J60 FAMILY
NOTES:
DS39762F-page 474
PIC18F97J60 FAMILY
APPENDIX A:
REVISION HISTORY
DS39762F-page 475
PIC18F97J60 FAMILY
APPENDIX B:
DEVICE
DIFFERENCES
Interrupt Sources
I/O Ports (Pins)
Enhanced USART Modules
PIC18F86J65
PIC18F87J60
PIC18F96J60
PIC18F96J65
PIC18F97J60
Program Memory
(Instructions)
PIC18F86J60
PIC18F67J60
Features
PIC18F66J65
TABLE B-1:
64K
96K
128K
64K
96K
128K
64K
96K
128K
32764
49148
65532
32764
49148
65532
32764
49148
65532
26
Ports A, B, C, D, E, F, G
(39)
1
MSSP Modules
Parallel Slave Port
Communications (PSP)
External Memory Bus
10-Bit Analog-to-Digital
Module
Packages
DS39762F-page 476
27
29
Ports A, B, C, D, E, F, G, H, J Ports A, B, C, D, E, F, G, H, J
(55)
(70)
2
1
No
Yes
No
Yes
11 input channels
15 input channels
16 input channels
64-pin TQFP
80-pin TQFP
100-pin TQFP
PIC18F97J60 FAMILY
INDEX
A
A/D ................................................................................... 339
Acquisition Requirements ........................................ 344
ADCAL Bit ................................................................ 347
ADCON0 Register .................................................... 339
ADCON1 Register .................................................... 339
ADCON2 Register .................................................... 339
ADRESH Register ............................................ 339, 342
ADRESL Register .................................................... 339
Analog Port Pins, Configuring .................................. 345
Associated Registers ............................................... 347
Automatic Acquisition Time, Selecting and
Configuring ...................................................... 345
Configuring the Module ............................................ 343
Conversion Clock (TAD) ........................................... 345
Conversion Requirements ....................................... 463
Conversion Status (GO/DONE Bit) .......................... 342
Conversions ............................................................. 346
Converter Calibration ............................................... 347
Converter Characteristics ........................................ 462
Converter Interrupt, Configuring .............................. 343
Operation in Power-Managed Modes ...................... 347
Special Event Trigger (ECCP) ......................... 202, 346
Use of the ECCP2 Trigger ....................................... 346
Absolute Maximum Ratings ............................................. 429
AC (Timing) Characteristics ............................................. 443
Load Conditions for Device Timing
Specifications ................................................... 444
Parameter Symbology ............................................. 443
Temperature and Voltage Specifications ................. 444
Timing Conditions .................................................... 444
ACKSTAT ........................................................................ 304
ACKSTAT Status Flag ..................................................... 304
ADCAL Bit ........................................................................ 347
ADCON0 Register ............................................................ 339
GO/DONE Bit ........................................................... 342
ADCON1 Register ............................................................ 339
ADCON2 Register ............................................................ 339
ADDFSR .......................................................................... 418
ADDLW ............................................................................ 381
ADDULNK ........................................................................ 418
ADDWF ............................................................................ 381
ADDWFC ......................................................................... 382
ADRESH Register ............................................................ 339
ADRESL Register .................................................... 339, 342
Analog-to-Digital Converter. See A/D.
ANDLW ............................................................................ 382
ANDWF ............................................................................ 383
Assembler
MPASM Assembler .................................................. 426
B
Baud Rate Generator ....................................................... 300
BC .................................................................................... 383
BCF .................................................................................. 384
BF .................................................................................... 304
BF Status Flag ................................................................. 304
Block Diagrams
16-Bit Byte Select Mode .......................................... 121
16-Bit Byte Write Mode ............................................ 119
16-Bit Word Write Mode ........................................... 120
8-Bit Multiplexed Mode ............................................ 123
A/D ........................................................................... 342
DS39762F-page 477
PIC18F97J60 FAMILY
BSF .................................................................................. 387
BTFSC ............................................................................. 388
BTFSS .............................................................................. 388
BTG .................................................................................. 389
BZ ..................................................................................... 390
C
C Compilers
MPLAB C18 ............................................................. 426
CALL ................................................................................ 390
CALLW ............................................................................. 419
Capture (CCP Module) ..................................................... 191
Associated Registers ............................................... 193
CCPRxH:CCPRxL Registers ................................... 191
CCPx Pin Configuration ........................................... 191
Prescaler .................................................................. 191
Software Interrupt .................................................... 191
Timer1/Timer3 Mode Selection ................................ 191
Capture (ECCP Module) .................................................. 202
Capture/Compare/PWM (CCP) ........................................ 189
Capture Mode. See Capture.
CCPRxH Register .................................................... 190
CCPRxL Register ..................................................... 190
CCPx/ECCPx Interconnect Configurations .............. 190
CCPx/ECCPx Mode and Timer Resources ............. 190
Compare Mode. See Compare.
Module Configuration ............................................... 190
Clock Sources
Default System Clock on Reset ................................. 54
Effects of Power-Managed Modes ............................. 54
Oscillator Switching .................................................... 52
CLRF ................................................................................ 391
CLRWDT .......................................................................... 391
Code Examples
16 x 16 Signed Multiply Routine .............................. 128
16 x 16 Unsigned Multiply Routine .......................... 128
8 x 8 Signed Multiply Routine .................................. 127
8 x 8 Unsigned Multiply Routine .............................. 127
Changing Between Capture Prescalers ................... 191
Computed GOTO Using an Offset Value ................... 83
Erasing a Flash Program Memory Row ................... 110
Fast Register Stack .................................................... 83
How to Clear RAM (Bank 1) Using Indirect
Addressing ......................................................... 98
Implementing a Real-Time Clock Using a
Timer1 Interrupt Service .................................. 179
Initializing PORTA .................................................... 146
Initializing PORTB .................................................... 148
Initializing PORTC .................................................... 151
Initializing PORTD .................................................... 154
Initializing PORTE .................................................... 157
Initializing PORTF .................................................... 160
Initializing PORTG ................................................... 162
Initializing PORTH .................................................... 164
Initializing PORTJ .................................................... 166
Loading the SSP1BUF (SSP1SR) Register ............. 272
Reading a Flash Program Memory Word ................ 109
Saving STATUS, WREG and BSR
Registers in RAM ............................................. 144
Writing to Flash Program Memory ........................... 112
Code Protection ............................................................... 359
COMF ............................................................................... 392
DS39762F-page 478
D
Data Addressing Modes .................................................... 98
Comparing Addressing Modes with the
Extended Instruction Set Enabled ................... 102
Direct ......................................................................... 98
Indexed Literal Offset .............................................. 101
Affected Instructions ........................................ 101
BSR ................................................................. 103
Mapping Access Bank ..................................... 103
Indirect ....................................................................... 98
Inherent and Literal .................................................... 98
Data Memory ..................................................................... 86
Access Bank .............................................................. 88
Bank Select Register (BSR) ...................................... 86
Ethernet SFRs ........................................................... 90
Extended Instruction Set ......................................... 100
General Purpose Register File .................................. 88
PIC18F97J60 FAMILY
Memory Maps
Ethernet Special Function Registers ................. 90
PIC18F97J60 Family ......................................... 87
Special Function Registers ................................ 89
Special Function Registers ........................................ 89
DAW ................................................................................. 394
DC Characteristics ........................................................... 439
Power-Down and Supply Current ............................ 432
Supply Voltage ......................................................... 431
DCFSNZ .......................................................................... 395
DECF ............................................................................... 394
DECFSZ ........................................................................... 395
Default System Clock ......................................................... 54
Development Support ...................................................... 425
Device Differences ........................................................... 476
Device Overview ................................................................ 11
Details on Individual Family Members ....................... 12
Features (100-Pin Devices) ....................................... 14
Features (64-Pin Devices) ......................................... 13
Features (80-Pin Devices) ......................................... 13
Direct Addressing ............................................................... 99
E
ECCP2
Pin Assignment ........................................................ 190
Effect on Standard PIC Instructions ................................. 422
Electrical Characteristics .................................................. 429
Requirements for Ethernet Transceiver
External Magnetics .......................................... 463
Enhanced Capture/Compare/PWM (ECCP) .................... 197
Capture and Compare Modes .................................. 202
Capture Mode. See Capture (ECCP Module).
ECCP1/ECCP3 Outputs and Program
Memory Mode .................................................. 199
ECCP2 Outputs and Program Memory Modes ........ 199
Enhanced PWM Mode ............................................. 203
Outputs and Configuration ....................................... 199
Pin Configurations for ECCP1 ................................. 200
Pin Configurations for ECCP2 ................................. 200
Pin Configurations for ECCP3 ................................. 201
PWM Mode. See PWM (ECCP Module).
Standard PWM Mode ............................................... 202
Timer Resources ...................................................... 199
Use of CCP4/CCP5 with ECCP1/ECCP3 ................ 199
Enhanced Capture/Compare/PWM (ECCPx)
Associated Registers ............................................... 215
Enhanced Universal Synchronous Asynchronous
Receiver Transmitter (EUSART). See EUSART.
ENVREG pin .................................................................... 369
Equations
16 x 16 Signed Multiplication Algorithm ................... 128
16 x 16 Unsigned Multiplication Algorithm ............... 128
A/D Acquisition Time ................................................ 344
A/D Minimum Charging Time ................................... 344
Calculating Baud Rate Error .................................... 320
Calculating the A/D Minimum Required
Acquisition Time .............................................. 344
Random Access Address Calculation ...................... 253
Receive Buffer Free Space Calculation ................... 254
Errata ................................................................................... 9
DS39762F-page 479
PIC18F97J60 FAMILY
Transmitting and Receiving Data ............................. 247
Packet Field Definitions ........................... 247248
Reading Received Packets .............................. 253
Receive Buffer Space ...................................... 254
Receive Packet Layout .................................... 252
Receive Status Vectors .................................... 253
Receiving Packets ........................................... 252
Transmit Packet Layout ................................... 250
Transmit Status Vectors ................................... 251
Transmitting Packets ....................................... 249
Ethernet Operation, Microcontroller Clock ......................... 51
EUSARTx
Asynchronous Mode ................................................ 325
Associated Registers, Receive ........................ 329
Associated Registers, Transmit ....................... 327
Auto-Wake-up on Sync Break Character ......... 330
Break Character Sequence .............................. 332
Receiving ................................................. 332
Receiver ........................................................... 328
Setting Up 9-Bit Mode with Address Detect ..... 328
Transmitter ....................................................... 325
Baud Rate Generator
Operation in Power-Managed Modes .............. 319
Baud Rate Generator (BRG) .................................... 319
Associated Registers ....................................... 320
Auto-Baud Rate Detect .................................... 323
Baud Rates, Asynchronous Modes .................. 321
High Baud Rate Select (BRGH Bit) .................. 319
Sampling .......................................................... 319
Synchronous Master Mode ...................................... 333
Associated Registers, Receive ........................ 336
Associated Registers, Transmit ....................... 334
Reception ......................................................... 335
Transmission .................................................... 333
Synchronous Slave Mode ........................................ 337
Associated Registers, Receive ........................ 338
Associated Registers, Transmit ....................... 337
Reception ......................................................... 338
Transmission .................................................... 337
Extended Instruction Set
ADDFSR .................................................................. 418
ADDULNK ................................................................ 418
CALLW ..................................................................... 419
MOVSF .................................................................... 419
MOVSS .................................................................... 420
PUSHL ..................................................................... 420
SUBFSR .................................................................. 421
SUBULNK ................................................................ 421
External Clock Input (EC Modes) ....................................... 50
External Memory Bus ....................................................... 115
16-Bit Byte Select Mode .......................................... 121
16-Bit Byte Write Mode ............................................ 119
16-Bit Data Width Modes ......................................... 118
16-Bit Mode Timing .................................................. 122
16-Bit Word Write Mode ........................................... 120
21-Bit Addressing ..................................................... 117
8-Bit Data Width Mode ............................................. 123
8-Bit Mode Timing .................................................... 124
Address and Data Line Usage (table) ...................... 117
Address and Data Width .......................................... 117
Address Shifting ....................................................... 117
Control ..................................................................... 116
I/O Port Functions .................................................... 115
Operation in Power-Managed Modes ...................... 125
Program Memory Modes ......................................... 118
DS39762F-page 480
F
Fail-Safe Clock Monitor ........................................... 359, 371
and the Watchdog Timer ......................................... 371
Exiting Operation ..................................................... 371
Interrupts in Power-Managed Modes ....................... 372
POR or Wake-up From Sleep .................................. 372
Fast Register Stack ........................................................... 83
Firmware Instructions ...................................................... 375
Flash Configuration Words ........................................ 78, 359
Flash Program Memory ................................................... 105
Associated Registers ............................................... 113
Control Registers ..................................................... 106
EECON1 and EECON2 ................................... 106
TABLAT (Table Latch) ..................................... 108
TBLPTR (Table Pointer) .................................. 108
Erase Sequence ...................................................... 110
Erasing .................................................................... 110
Operation During Code-Protect ............................... 113
Reading ................................................................... 109
Table Pointer
Boundaries Based on Operation ..................... 108
Table Pointer Boundaries ........................................ 108
Table Reads and Table Writes ................................ 105
Write Sequence ....................................................... 111
Writing ..................................................................... 111
Protection Against Spurious Writes ................. 113
Unexpected Termination ................................. 113
Write Verify ...................................................... 113
FSCM. See Fail-Safe Clock Monitor.
G
GOTO .............................................................................. 396
H
Hardware Multiplier .......................................................... 127
Introduction .............................................................. 127
Operation ................................................................. 127
Performance Comparison ........................................ 127
I
I/O Ports ........................................................................... 145
Pin Capabilities ........................................................ 145
I2C Mode (MSSP) ............................................................ 279
Acknowledge Sequence Timing .............................. 307
Associated Registers ............................................... 313
Baud Rate Generator .............................................. 300
Bus Collision
During a Repeated Start Condition .................. 311
During a Start Condition .................................. 309
During a Stop Condition .................................. 312
Clock Arbitration ...................................................... 301
Clock Rate w/BRG ................................................... 300
Clock Stretching ....................................................... 293
10-Bit Slave Receive Mode (SEN = 1) ............ 293
10-Bit Slave Transmit Mode ............................ 293
7-Bit Slave Receive Mode (SEN = 1) .............. 293
7-Bit Slave Transmit Mode .............................. 293
Clock Synchronization and the CKP Bit ................... 294
Effects of a Reset .................................................... 308
General Call Address Support ................................. 297
PIC18F97J60 FAMILY
Master Mode ............................................................ 298
Baud Rate Generator ....................................... 300
Operation ......................................................... 299
Reception ......................................................... 304
Repeated Start Condition Timing ..................... 303
Start Condition Timing ..................................... 302
Transmission ................................................... 304
Multi-Master Communication, Bus Collision
and Arbitration ................................................. 308
Multi-Master Mode ................................................... 308
Operation ................................................................. 284
Read/Write Bit Information (R/W Bit) ............... 284, 286
Registers .................................................................. 279
Serial Clock (SCKx/SCLx) ....................................... 286
Slave Mode .............................................................. 284
Address Masking ............................................. 285
Addressing ....................................................... 284
Reception ......................................................... 286
Transmission ................................................... 286
Sleep Operation ....................................................... 308
Stop Condition Timing .............................................. 307
INCF ................................................................................. 396
INCFSZ ............................................................................ 397
In-Circuit Debugger .......................................................... 373
In-Circuit Serial Programming (ICSP) ...................... 359, 373
Indexed Literal Offset Addressing
and Standard PIC18 Instructions ............................. 422
Indexed Literal Offset Mode ............................................. 422
Indirect Addressing ............................................................ 99
INFSNZ ............................................................................ 397
Initialization Conditions for All Registers ...................... 6975
Instruction Cycle ................................................................ 84
Clocking Scheme ....................................................... 84
Flow/Pipelining ........................................................... 84
Instruction Set .................................................................. 375
ADDLW .................................................................... 381
ADDWF .................................................................... 381
ADDWF (Indexed Literal Offset Mode) .................... 423
ADDWFC ................................................................. 382
ANDLW .................................................................... 382
ANDWF .................................................................... 383
BC ............................................................................ 383
BCF .......................................................................... 384
BN ............................................................................ 384
BNC ......................................................................... 385
BNN ......................................................................... 385
BNOV ....................................................................... 386
BNZ .......................................................................... 386
BOV ......................................................................... 389
BRA .......................................................................... 387
BSF .......................................................................... 387
BSF (Indexed Literal Offset Mode) .......................... 423
BTFSC ..................................................................... 388
BTFSS ..................................................................... 388
BTG .......................................................................... 389
BZ ............................................................................ 390
CALL ........................................................................ 390
CLRF ........................................................................ 391
CLRWDT .................................................................. 391
COMF ...................................................................... 392
CPFSEQ .................................................................. 392
CPFSGT .................................................................. 393
CPFSLT ................................................................... 393
DAW ......................................................................... 394
DCFSNZ .................................................................. 395
DS39762F-page 481
PIC18F97J60 FAMILY
Interrupt Sources .............................................................. 359
Interrupt-on-Change (RB7:RB4) .............................. 148
INTx Pin ................................................................... 144
PORTB, Interrupt-on-Change .................................. 144
TMR0 ....................................................................... 144
TMR0 Overflow ........................................................ 173
TMR1 Overflow ........................................................ 175
TMR2 to PR2 Match (PWM) .................................... 203
TMR3 Overflow ................................................ 183, 185
TMR4 to PR4 Match ................................................ 188
TMR4 to PR4 Match (PWM) .................................... 187
Interrupts .......................................................................... 129
Context Saving ......................................................... 144
Interrupts, Flag Bits
Interrupt-on-Change (RB7:RB4) Flag
(RBIF Bit) ......................................................... 148
INTRC. See Internal Oscillator Block.
IORLW ............................................................................. 398
IORWF ............................................................................. 398
IPR Registers ................................................................... 140
L
LFSR ................................................................................ 399
M
Master Clear (MCLR) ......................................................... 65
Master Synchronous Serial Port (MSSP). See MSSP.
Memory Organization ......................................................... 77
Data Memory ............................................................. 86
Program Memory ....................................................... 77
Memory Programming Requirements .............................. 441
Microchip Internet Web Site ............................................. 488
MOVF ............................................................................... 399
MOVFF ............................................................................. 400
MOVLB ............................................................................. 400
MOVLW ............................................................................ 401
MOVSF ............................................................................ 419
MOVSS ............................................................................ 420
MOVWF ........................................................................... 401
MPLAB ASM30 Assembler, Linker, Librarian .................. 426
MPLAB Integrated Development Environment
Software ................................................................... 425
MPLAB PM3 Device Programmer .................................... 428
MPLAB REAL ICE In-Circuit Emulator System ................ 427
MPLINK Object Linker/MPLIB Object Librarian ............... 426
MSSP
ACK Pulse ........................................................ 284, 286
Control Registers (general) ...................................... 269
Module Overview ..................................................... 269
SPI Master/Slave Connection .................................. 273
SSPxBUF Register .................................................. 274
SSPxSR Register ..................................................... 274
MULLW ............................................................................ 402
MULWF ............................................................................ 402
N
NEGF ............................................................................... 403
NOP ................................................................................. 403
O
Opcode Field Descriptions ............................................... 376
Organizationally Unique Identifier (OUI) .......................... 248
DS39762F-page 482
P
Packaging ........................................................................ 465
Details ...................................................................... 466
Marking .................................................................... 465
Parallel Slave Port (PSP) ................................................. 168
Associated Registers ............................................... 170
PORTD .................................................................... 168
Select (PSPMODE Bit) ............................................ 168
PIE Registers ................................................................... 137
Pin Functions
AVDD .............................................................. 32, 42, 24
AVSS .............................................................. 42, 32, 24
ENVREG ....................................................... 24, 32, 42
MCLR ............................................................ 25, 33, 18
OSC1/CLKI .................................................... 18, 25, 33
OSC2/CLKO .................................................. 18, 25, 33
RA0/LEDA/AN0 ............................................. 18, 25, 33
RA1/LEDB/AN1 ............................................. 18, 25, 33
RA2/AN2/VREF- ............................................. 18, 25, 33
RA3/AN3/VREF+ ............................................ 18, 25, 33
RA4/T0CKI .................................................... 18, 25, 33
RA5/AN4 ........................................................ 18, 25, 33
RB0/INT0/FLT0 .............................................. 19, 26, 34
RB1/INT1 ....................................................... 19, 26, 34
RB2/INT2 ....................................................... 19, 26, 34
RB3/INT3 ............................................................. 19, 26
RB3/INT3/ECCP2/P2A .............................................. 34
RB4/KBI0 ....................................................... 19, 26, 34
RB5/KBI1 ....................................................... 19, 26, 34
RB6/KBI2/PGC .............................................. 19, 26, 34
RB7/KBI3/PGD .............................................. 19, 26, 34
RBIAS ............................................................ 24, 32, 42
RC0/T1OSO/T13CKI ..................................... 20, 27, 35
RC1/T1OSI/ECCP2/P2A ............................... 20, 27, 35
RC2/ECCP1/P1A ........................................... 20, 27, 35
RC3/SCK1/SCL1 ........................................... 20, 27, 35
RC4/SDI1/SDA1 ............................................ 20, 27, 35
RC5/SDO1 ..................................................... 20, 27, 35
RC6/TX1/CK1 ................................................ 20, 27, 35
RC7/RX1/DT1 ................................................ 20, 27, 35
RD0 ........................................................................... 28
RD0/AD0/PSP0 ......................................................... 36
RD0/P1B .................................................................... 21
RD1 ........................................................................... 28
RD1/AD1/PSP1 ......................................................... 36
RD1/ECCP3/P3A ....................................................... 21
RD2 ........................................................................... 28
RD2/AD2/PSP2 ......................................................... 36
PIC18F97J60 FAMILY
RD2/CCP4/P3D ......................................................... 21
RD3/AD3/PSP3 .......................................................... 36
RD4/AD4/PSP4/SDO2 ............................................... 36
RD5/AD5/PSP5/SDI2/SDA2 ...................................... 36
RD6/AD6/PSP6/SCK2/SCL2 ..................................... 36
RD7/AD7/PSP7/SS2 .................................................. 36
RE0/AD8/RD/P2D ...................................................... 37
RE0/P2D .............................................................. 22, 28
RE1/AD9/WR/P2C ..................................................... 37
RE1/P2C .............................................................. 22, 28
RE2/AD10/CS/P2B .................................................... 37
RE2/P2B .............................................................. 22, 28
RE3/AD11/P3C .......................................................... 37
RE3/P3C .............................................................. 22, 28
RE4/AD12/P3B .......................................................... 37
RE4/P3B .............................................................. 22, 28
RE5/AD13/P1C .......................................................... 37
RE5/P1C .............................................................. 22, 28
RE6/AD14/P1B .......................................................... 37
RE6/P1B .................................................................... 28
RE7/AD15/ECCP2/P2A ............................................. 37
RE7/ECCP2/P2A ....................................................... 28
RF0/AN5 .................................................................... 38
RF1/AN6/C2OUT ........................................... 23, 29, 38
RF2/AN7/C1OUT ........................................... 23, 29, 38
RF3/AN8 ........................................................ 23, 29, 38
RF4/AN9 ........................................................ 23, 29, 38
RF5/AN10/CVREF .......................................... 23, 38, 29
RF6/AN11 ...................................................... 23, 29, 38
RF7/SS1 ........................................................ 23, 38, 29
RG0/ECCP3/P3A ................................................. 30, 39
RG1/TX2/CK2 ...................................................... 30, 39
RG2/RX2/DT2 ...................................................... 30, 39
RG3/CCP4/P3D ................................................... 30, 39
RG4/CCP5/P1D ............................................. 24, 30, 39
RG5 ............................................................................ 39
RG6 ............................................................................ 39
RG7 ............................................................................ 39
RH0 ............................................................................ 31
RH0/A16 .................................................................... 40
RH1 ............................................................................ 31
RH1/A17 .................................................................... 40
RH2 ............................................................................ 31
RH2/A18 .................................................................... 40
RH3 ............................................................................ 31
RH3/A19 .................................................................... 40
RH4/AN12/P3C .................................................... 31, 40
RH5/AN13/P3B .................................................... 31, 40
RH6/AN14/P1C .................................................... 31, 40
RH7/AN15/P1B .................................................... 31, 40
RJ0/ALE ..................................................................... 41
RJ1/OE ...................................................................... 41
RJ2/WRL .................................................................... 41
RJ3/WRH ................................................................... 41
RJ4 ............................................................................. 32
RJ4/BA0 ..................................................................... 41
RJ5 ............................................................................. 32
RJ5/CE ....................................................................... 41
RJ6/LB ....................................................................... 41
RJ7/UB ....................................................................... 41
TPIN- .............................................................. 24, 32, 42
TPIN+ ............................................................. 24, 32, 42
TPOUT- .......................................................... 24, 32, 42
TPOUT+ ......................................................... 24, 32, 42
DS39762F-page 483
PIC18F97J60 FAMILY
PORTJ
Associated Registers ............................................... 167
LATJ Register .......................................................... 166
PORTJ Register ....................................................... 166
TRISJ Register ......................................................... 166
Power-Managed Modes ..................................................... 55
and SPI Operation ................................................... 277
Clock Sources ............................................................ 55
Clock Transitions and Status Indicators ..................... 56
Entering ...................................................................... 55
Exiting Idle and Sleep Modes .................................... 61
By Interrupt ........................................................ 61
By Reset ............................................................ 61
By WDT Time-out .............................................. 61
Without an Oscillator Start-up Timer Delay ........ 61
Idle Modes ................................................................. 59
PRI_IDLE ........................................................... 60
RC_IDLE ............................................................ 61
SEC_IDLE .......................................................... 60
Multiple Sleep Commands ......................................... 56
Run Modes ................................................................. 56
PRI_RUN ........................................................... 56
RC_RUN ............................................................ 58
SEC_RUN .......................................................... 56
Selection .................................................................... 55
Sleep Mode ................................................................ 59
Summary (table) ........................................................ 55
Power-on Reset (POR) ...................................................... 65
Power-up Timer (PWRT) ........................................... 66
Time-out Sequence .................................................... 66
Power-up Delays ................................................................ 54
Power-up Timer (PWRT) .............................................. 54, 66
Prescaler
Timer2 ...................................................................... 204
Prescaler, Timer0 ............................................................. 173
Prescaler, Timer2 ............................................................. 195
PRI_IDLE Mode ................................................................. 60
PRI_RUN Mode ................................................................. 56
Program Counter ................................................................ 81
PCL, PCH and PCU Registers ................................... 81
PCLATH and PCLATU Registers .............................. 81
Program Memory
Extended Instruction Set .......................................... 100
Instructions ................................................................. 85
Two-Word .......................................................... 85
Interrupt Vector .......................................................... 78
Look-up Tables .......................................................... 83
Memory Maps ............................................................ 77
Hard Vectors and Configuration Words ............. 78
Memory Maps, Modes ............................................... 80
Modes
Memory Access (table) ...................................... 80
Reset Vector .............................................................. 78
Program Memory Modes .................................................... 79
Address Shifting (Extended Microcontroller) .............. 80
Extended Microcontroller ........................................... 79
Microcontroller ........................................................... 79
Program Verification and Code Protection ....................... 373
Programming, Device Instructions ................................... 375
PSP. See Parallel Slave Port.
Pulse-Width Modulation. See PWM (CCP Module)
and PWM (ECCP Module).
PUSH ............................................................................... 404
PUSH and POP Instructions .............................................. 82
PUSHL ............................................................................. 420
DS39762F-page 484
Q
Q Clock .................................................................... 195, 204
R
RAM. See Data Memory.
RC_IDLE Mode .................................................................. 61
RC_RUN Mode .................................................................. 58
RCALL ............................................................................. 405
RCON Register
Bit Status During Initialization .................................... 68
Reader Response ............................................................ 489
Receive Filters
AND Logic Flow ....................................................... 262
Magic Packet Format ............................................... 264
OR Logic Flow ......................................................... 261
Pattern Match Filter Format ..................................... 263
Register File Summary ................................................ 9196
Registers
ADCON0 (A/D Control 0) ......................................... 339
ADCON1 (A/D Control 1) ......................................... 340
ADCON2 (A/D Control 2) ......................................... 341
BAUDCONx (Baud Rate Control x) ......................... 318
CCPxCON (Capture/Compare/PWM Control,
CCP4 and CCP5) ............................................ 189
CCPxCON
(Enhanced
CCPx
Control,
ECCP1/ECCP2/ECCP3) ................................. 198
CMCON (Comparator Control) ................................ 349
CONFIG1H (Configuration 1 High) .......................... 361
CONFIG1L (Configuration 1 Low) ........................... 361
CONFIG2H (Configuration 2 High) .......................... 363
CONFIG2L (Configuration 2 Low) ........................... 362
CONFIG3H (Configuration 3 High) .......................... 365
CONFIG3L (Configuration 3 Low) ..................... 79, 364
CVRCON (Comparator Voltage
Reference Control) .......................................... 355
DEVID1 (Device ID 1) .............................................. 366
DEVID2 (Device ID 2) .............................................. 366
ECCP1AS (ECCP1 Auto-Shutdown
Configuration) .................................................. 212
ECCP1DEL (ECCP1 Dead-Band Delay) ................. 211
PIC18F97J60 FAMILY
ECON1 (Ethernet Control 1) .................................... 227
ECON2 (Ethernet Control 2) .................................... 228
EECON1 (EEPROM Control 1) ................................ 107
EFLOCON (Ethernet Flow Control) ......................... 258
EIE (Ethernet Interrupt Enable) ................................ 240
EIR (Ethernet Interrupt Request, Flag) .................... 241
ERXFCON (Ethernet Receive Filter Control) ........... 260
ESTAT (Ethernet Status) ......................................... 228
INTCON (Interrupt Control) ...................................... 131
INTCON2 (Interrupt Control 2) ................................. 132
INTCON3 (Interrupt Control 3) ................................. 133
IPR1 (Peripheral Interrupt Priority 1) ........................ 140
IPR2 (Peripheral Interrupt Priority 2) ........................ 141
IPR3 (Peripheral Interrupt Priority 3) ........................ 142
MABBIPG (MAC Back-to-Back
Inter-Packet Gap) ............................................ 246
MACON1 (MAC Control 1) ....................................... 229
MACON3 (MAC Control 3) ....................................... 230
MACON4 (MAC Control 4) ....................................... 231
MEMCON (External Memory Bus Control) .............. 116
MICMD (MII Command) ........................................... 231
MISTAT (MII Status) ................................................ 232
OSCCON (Oscillator Control) .................................... 53
OSCTUNE (PLL Block Control) ................................. 51
PHCON1 (PHY Control 1) ........................................ 235
PHCON2 (PHY Control 2) ........................................ 236
PHIE (PHY Interrupt Enable) ................................... 242
PHIR (PHY Interrupt Request, Flag) ........................ 242
PHLCON (PHY Module LED Control) ...................... 238
PHSTAT1 (Physical Layer Status 1) ........................ 235
PHSTAT2 (Physical Layer Status 2) ........................ 237
PIE1 (Peripheral Interrupt Enable 1) ........................ 137
PIE2 (Peripheral Interrupt Enable 2) ........................ 138
PIE3 (Peripheral Interrupt Enable 3) ........................ 139
PIR1 (Peripheral Interrupt Request (Flag) 1) ........... 134
PIR2 (Peripheral Interrupt Request (Flag) 2) ........... 135
PIR3 (Peripheral Interrupt Request (Flag) 3) ........... 136
PSPCON (Parallel Slave Port Control) .................... 169
RCON (Reset Control) ....................................... 64, 143
RCSTAx (Receive Status and Control x) ................. 317
SSPxCON1 (MSSPx Control 1, I2C Mode) .............. 281
SSPxCON1 (MSSPx Control 1, SPI Mode) ............. 271
SSPxCON2 (MSSPx Control 2,
I2C Master Mode) ............................................ 282
SSPxCON2 (MSSPx Control 2,
I2C Slave Mode) .............................................. 283
SSPxSTAT (MSSPx Status, I2C Mode) ................... 280
SSPxSTAT (MSSPx Status, SPI Mode) .................. 270
STATUS ..................................................................... 97
STKPTR (Stack Pointer) ............................................ 82
T0CON (Timer0 Control) .......................................... 171
T1CON (Timer1 Control) .......................................... 175
T2CON (Timer2 Control) .......................................... 180
T3CON (Timer3 Control) .......................................... 183
T4CON (Timer4 Control) .......................................... 187
TXSTAx (Transmit Status and Control x) ................. 316
WDTCON (Watchdog Timer Control) ...................... 368
RESET ............................................................................. 405
Reset ................................................................................. 63
Brown-out Reset (BOR) ............................................. 63
Configuration Mismatch (CM) .................................... 63
MCLR Reset, During Power-Managed Modes .......... 63
MCLR Reset, Normal Operation ................................ 63
Power-on Reset (POR) .............................................. 63
RESET Instruction ..................................................... 63
Stack Full Reset ........................................................ 63
Stack Underflow Reset .............................................. 63
State of Registers ...................................................... 68
Watchdog Timer (WDT) Reset
During Execution ............................................... 63
Resets ............................................................................. 359
Brown-out Reset (BOR) ........................................... 359
Oscillator Start-up Timer (OST) ............................... 359
Power-on Reset (POR) ............................................ 359
Power-up Timer (PWRT) ......................................... 359
Stack Full/Underflow .................................................. 83
RETFIE ............................................................................ 406
RETLW ............................................................................ 406
RETURN .......................................................................... 407
Return Address Stack ........................................................ 81
Return Stack Pointer (STKPTR) ........................................ 82
Revision History ............................................................... 475
RLCF ............................................................................... 407
RLNCF ............................................................................. 408
RRCF ............................................................................... 408
RRNCF ............................................................................ 409
S
SCKx ............................................................................... 269
SDIx ................................................................................. 269
SDOx ............................................................................... 269
SEC_IDLE Mode ............................................................... 60
SEC_RUN Mode ................................................................ 56
Serial Clock, SCKx .......................................................... 269
Serial Data In (SDIx) ........................................................ 269
Serial Data Out (SDOx) ................................................... 269
Serial Peripheral Interface. See SPI Mode.
SETF ............................................................................... 409
Slave Select (SSx) ........................................................... 269
SLEEP ............................................................................. 410
Sleep
OSC1 and OSC2 Pin States ...................................... 54
Software Simulator (MPLAB SIM) ................................... 427
Special Event Trigger. See Compare (ECCP Module).
Special Features of the CPU ........................................... 359
Special Function Registers
Ethernet SFRs ........................................................... 90
SPI Mode (MSSP)
Associated Registers ............................................... 278
Bus Mode Compatibility ........................................... 277
Clock Speed and Module Interactions ..................... 277
Effects of a Reset .................................................... 277
Enabling SPI I/O ...................................................... 273
Master Mode ............................................................ 274
Master/Slave Connection ........................................ 273
Operation ................................................................. 272
Operation in Power-Managed Modes ...................... 277
DS39762F-page 485
PIC18F97J60 FAMILY
Serial Clock .............................................................. 269
Serial Data In ........................................................... 269
Serial Data Out ........................................................ 269
Slave Mode .............................................................. 275
Slave Select ............................................................. 269
Slave Select Synchronization .................................. 275
SPI Clock ................................................................. 274
Typical Connection .................................................. 273
SSPOV ............................................................................. 304
SSPOV Status Flag .......................................................... 304
SSPSTAT Register
R/W Bit ..................................................................... 286
SSPxSTAT Register
R/W Bit ..................................................................... 284
......................................................................................... 269
SUBFSR ........................................................................... 421
SUBFWB .......................................................................... 410
SUBLW ............................................................................ 411
SUBULNK ........................................................................ 421
SUBWF ............................................................................ 411
SUBWFB .......................................................................... 412
SWAPF ............................................................................ 412
T
Table Pointer Operations (table) ...................................... 108
Table Reads/Table Writes .................................................. 83
TBLRD ............................................................................. 413
TBLWT ............................................................................. 414
Timer0 .............................................................................. 171
Associated Registers ............................................... 173
Clock Source Select (T0CS Bit) ............................... 172
Operation ................................................................. 172
Overflow Interrupt .................................................... 173
Prescaler .................................................................. 173
Prescaler Assignment (PSA Bit) .............................. 173
Prescaler Select (T0PS2:T0PS0 Bits) ..................... 173
Prescaler, Switching Assignment ............................. 173
Prescaler. See Prescaler, Timer0.
Reads and Writes in 16-Bit Mode ............................ 172
Source Edge Select (T0SE Bit) ................................ 172
Timer1 .............................................................................. 175
16-Bit Read/Write Mode ........................................... 177
Associated Registers ............................................... 179
Considerations in Asynchronous Counter Mode ...... 178
Interrupt .................................................................... 178
Operation ................................................................. 176
Oscillator .......................................................... 175, 177
Layout Considerations ..................................... 177
Overflow Interrupt .................................................... 175
Resetting, Using the ECCPx Special
Event Trigger ................................................... 178
Special Event Trigger (ECCP) ................................. 202
TMR1H Register ...................................................... 175
TMR1L Register ....................................................... 175
Use as a Clock Source ............................................ 177
Use as a Real-Time Clock ....................................... 178
Timer2 .............................................................................. 180
Associated Registers ............................................... 181
Interrupt .................................................................... 181
Operation ................................................................. 180
Output ...................................................................... 181
PR2 Register .................................................... 194, 203
TMR2 to PR2 Match Interrupt .................................. 203
DS39762F-page 486
PIC18F97J60 FAMILY
I2C Bus Collision During a Stop
Condition (Case 2) ........................................... 312
I2C Bus Collision During Start
Condition (SCLx = 0) ....................................... 310
I2C Bus Collision During Start
Condition (SDAx Only) ..................................... 309
I2C Bus Collision for Transmit and Acknowledge .... 308
I2C Bus Data ............................................................ 457
I2C Bus Start/Stop Bits ............................................. 457
I2C Master Mode (7 or 10-Bit Transmission) ........... 305
I2C Master Mode (7-Bit Reception) .......................... 306
I2C Slave Mode (10-Bit Reception, SEN = 0,
ADMSK = 01001) ............................................. 291
I2C Slave Mode (10-Bit Reception, SEN = 0) .......... 290
I2C Slave Mode (10-Bit Reception, SEN = 1) .......... 296
I2C Slave Mode (10-Bit Transmission) ..................... 292
I2C Slave Mode (7-Bit Reception, SEN = 0,
ADMSK = 01011) ............................................. 288
I2C Slave Mode (7-Bit Reception, SEN = 0) ............ 287
I2C Slave Mode (7-Bit Reception, SEN = 1) ............ 295
I2C Slave Mode (7-Bit Transmission) ....................... 289
I2C Slave Mode General Call Address
Sequence (7 or 10-Bit Addressing Mode) ........ 297
I2C Stop Condition Receive or Transmit Mode ........ 307
Master SSP I2C Bus Data ........................................ 459
Master SSP I2C Bus Start/Stop Bits ........................ 459
Parallel Slave Port (PSP) Read ............................... 170
Parallel Slave Port (PSP) Write ............................... 169
Program Memory Read ............................................ 448
Program Memory Write ............................................ 449
PWM Auto-Shutdown (P1RSEN = 0,
Auto-Restart Disabled) .................................... 213
PWM Auto-Shutdown (P1RSEN = 1,
Auto-Restart Enabled) ..................................... 213
PWM Direction Change ........................................... 210
PWM Direction Change at Near
100% Duty Cycle ............................................. 210
PWM Output ............................................................ 194
Repeated Start Condition ......................................... 303
Reset, Watchdog Timer (WDT), Oscillator Start-up
Timer (OST) and Power-up Timer (PWRT) ..... 450
Send Break Character Sequence ............................ 332
Slave Synchronization ............................................. 275
Slow Rise Time (MCLR Tied to VDD,
VDD Rise > TPWRT) ............................................ 67
SPI Mode (Master Mode) ......................................... 274
SPI Mode (Slave Mode, CKE = 0) ........................... 276
SPI Mode (Slave Mode, CKE = 1) ........................... 276
Synchronous Reception (Master Mode, SREN) ...... 335
Synchronous Transmission ...................................... 333
Synchronous Transmission (Through TXEN) .......... 334
Time-out Sequence on Power-up (MCLR
Not Tied to VDD), Case 1 ................................... 66
Time-out Sequence on Power-up (MCLR
Not Tied to VDD), Case 2 ................................... 67
Time-out Sequence on Power-up (MCLR Tied
to VDD, VDD Rise < TPWRT) ................................ 66
Timer0 and Timer1 External Clock .......................... 451
Transition for Entry to Idle Mode ................................ 60
Transition for Entry to SEC_RUN Mode .................... 57
Transition for Entry to Sleep Mode ............................ 59
Transition for Two-Speed Start-up
(INTRC to HSPLL) ........................................... 370
Transition for Wake From Idle to Run Mode .............. 60
Transition for Wake From Sleep Mode (HSPLL) ....... 59
V
VDDCORE/VCAP Pin .......................................... 369, 442, 369
W
Watchdog Timer (WDT) ........................................... 359, 367
Associated Registers ............................................... 368
Control Register ....................................................... 367
Programming Considerations .................................. 367
WCOL ...................................................... 302, 303, 304, 307
WCOL Status Flag ................................... 302, 303, 304, 307
WWW Address ................................................................ 488
WWW, On-Line Support ...................................................... 9
X
XORLW ........................................................................... 415
XORWF ........................................................................... 416
DS39762F-page 487
PIC18F97J60 FAMILY
NOTES:
DS39762F-page 488
PIC18F97J60 FAMILY
THE MICROCHIP WEB SITE
CUSTOMER SUPPORT
Distributor or Representative
Local Sales Office
Field Application Engineer (FAE)
Technical Support
Development Systems Information Line
Customers
should
contact
their
distributor,
representative or field application engineer (FAE) for
support. Local sales offices are also available to help
customers. A listing of sales offices and locations is
included in the back of this document.
Technical support is available through the web site
at: http://microchip.com/support
DS39762F-page 489
PIC18F97J60 FAMILY
READER RESPONSE
It is our intention to provide you with the best documentation possible to ensure successful use of your Microchip
product. If you wish to provide your comments on organization, clarity, subject matter, and ways in which our
documentation can better serve you, please FAX your comments to the Technical Publications Manager at
(480) 792-4150.
Please list the following information, and use this outline to provide us with your comments about this document.
TO:
RE:
Reader Response
From: Name
Company
Address
City / State / ZIP / Country
Telephone: (_______) _________ - _________
Application (optional):
Would you like a reply?
Questions:
1. What are the best features of this document?
2. How does this document meet your hardware and software development needs?
3. Do you find the organization of this document easy to follow? If not, why?
4. What additions to the document do you think would enhance the structure and subject?
5. What deletions from the document could be made without affecting the overall usefulness?
DS39762F-page 490
PIC18F97J60 FAMILY
PRODUCT IDENTIFICATION SYSTEM
To order or obtain information, e.g., on pricing or delivery, refer to the factory or the listed sales office.
PART NO.
/XX
XXX
Device
Temperature
Range
Package
Pattern
Device
PIC18F66J60/66J65/67J60,
PIC18F86J60/86J65/87J60,
PIC18F96J60/96J65/97J60,
PIC18F66J60/66J65/67J60T(1),
PIC18F86J60/86J65/87J60T(1),
PIC18F96J60/96J65/97J60T(1)
Temperature Range
Package
PT =
PF =
Pattern
Examples:
a)
b)
Note 1:
DS39762F-page 491
ASIA/PACIFIC
ASIA/PACIFIC
EUROPE
Corporate Office
2355 West Chandler Blvd.
Chandler, AZ 85224-6199
Tel: 480-792-7200
Fax: 480-792-7277
Technical Support:
http://www.microchip.com/
support
Web Address:
www.microchip.com
India - Bangalore
Tel: 91-80-3090-4444
Fax: 91-80-3090-4123
India - New Delhi
Tel: 91-11-4160-8631
Fax: 91-11-4160-8632
Austria - Wels
Tel: 43-7242-2244-39
Fax: 43-7242-2244-393
Denmark - Copenhagen
Tel: 45-4450-2828
Fax: 45-4485-2829
India - Pune
Tel: 91-20-2566-1512
Fax: 91-20-2566-1513
France - Paris
Tel: 33-1-69-53-63-20
Fax: 33-1-69-30-90-79
Japan - Yokohama
Tel: 81-45-471- 6166
Fax: 81-45-471-6122
Germany - Munich
Tel: 49-89-627-144-0
Fax: 49-89-627-144-44
Atlanta
Duluth, GA
Tel: 678-957-9614
Fax: 678-957-1455
Boston
Westborough, MA
Tel: 774-760-0087
Fax: 774-760-0088
Chicago
Itasca, IL
Tel: 630-285-0071
Fax: 630-285-0075
Cleveland
Independence, OH
Tel: 216-447-0464
Fax: 216-447-0643
Dallas
Addison, TX
Tel: 972-818-7423
Fax: 972-818-2924
Detroit
Farmington Hills, MI
Tel: 248-538-2250
Fax: 248-538-2260
Indianapolis
Noblesville, IN
Tel: 317-773-8323
Fax: 317-773-5453
Los Angeles
Mission Viejo, CA
Tel: 949-462-9523
Fax: 949-462-9608
Santa Clara
Santa Clara, CA
Tel: 408-961-6444
Fax: 408-961-6445
Toronto
Mississauga, Ontario,
Canada
Tel: 905-673-0699
Fax: 905-673-6509
Australia - Sydney
Tel: 61-2-9868-6733
Fax: 61-2-9868-6755
China - Beijing
Tel: 86-10-8528-2100
Fax: 86-10-8528-2104
China - Chengdu
Tel: 86-28-8665-5511
Fax: 86-28-8665-7889
Korea - Daegu
Tel: 82-53-744-4301
Fax: 82-53-744-4302
China - Chongqing
Tel: 86-23-8980-9588
Fax: 86-23-8980-9500
Korea - Seoul
Tel: 82-2-554-7200
Fax: 82-2-558-5932 or
82-2-558-5934
China - Nanjing
Tel: 86-25-8473-2460
Fax: 86-25-8473-2470
Malaysia - Penang
Tel: 60-4-227-8870
Fax: 60-4-227-4068
China - Qingdao
Tel: 86-532-8502-7355
Fax: 86-532-8502-7205
Philippines - Manila
Tel: 63-2-634-9065
Fax: 63-2-634-9069
China - Shanghai
Tel: 86-21-5407-5533
Fax: 86-21-5407-5066
Singapore
Tel: 65-6334-8870
Fax: 65-6334-8850
China - Shenyang
Tel: 86-24-2334-2829
Fax: 86-24-2334-2393
China - Shenzhen
Tel: 86-755-8203-2660
Fax: 86-755-8203-1760
Taiwan - Kaohsiung
Tel: 886-7-213-7830
Fax: 886-7-330-9305
China - Wuhan
Tel: 86-27-5980-5300
Fax: 86-27-5980-5118
Taiwan - Taipei
Tel: 886-2-2500-6610
Fax: 886-2-2508-0102
China - Xian
Tel: 86-29-8833-7252
Fax: 86-29-8833-7256
Thailand - Bangkok
Tel: 66-2-694-1351
Fax: 66-2-694-1350
Italy - Milan
Tel: 39-0331-742611
Fax: 39-0331-466781
Netherlands - Drunen
Tel: 31-416-690399
Fax: 31-416-690340
Spain - Madrid
Tel: 34-91-708-08-90
Fax: 34-91-708-08-91
UK - Wokingham
Tel: 44-118-921-5869
Fax: 44-118-921-5820
China - Xiamen
Tel: 86-592-2388138
Fax: 86-592-2388130
China - Zhuhai
Tel: 86-756-3210040
Fax: 86-756-3210049
02/18/11
DS39762F-page 492