PIC18F47J53
PIC18F47J53
Data Sheet
28/44-Pin, High-Performance
USB Microcontrollers
with nanoWatt XLP Technology
• Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
• Microchip is willing to work with the customer who is concerned about the integrity of their code.
• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
ISBN: 978-1-60932-306-6
Memory (bytes)
SRAM (bytes)
Comparators
ECCP/(PWM)
Remappable
Deep Sleep
PMP/PSP
EUSART
Program
8/16-Bit
SPI w/DMA
Timers
CTMU
RTCC
PIC18F
Pins
Pins
USB
I2C™
Device
RB4/CCP4/KBI0/SCK1/SCL1/RP7
RB5/CCP5/KBI1/SDI1/SDA1/RP8
28-Pin QFN
RA0/AN0/C1INA/ULPWU/RP0
RB7/CCP7/KBI3/PGD/RP10
RB6/CCP6/KBI2/PGC/RP9
RA1/AN1/C2INA/VBG/RP1
MCLR
28 27 26 25 24 23 22
RA2/AN2/C2INB/C1IND/C3INB/VREF-/CVREF 1 21 RB3/AN9/C3INA/CTED2/VPO/RP6
RA3/AN3/C1INB/VREF+ 2 20 RB2/AN8/C2INC/CTED1/VMO/REFO/RP5
VDDCORE/VCAP 3 19 RB1/AN10/C3INC/RTCC/RP4
RA5/AN4/C1INC/SS1/HLVDIN/RCV/RP2 4 PIC18F2XJ53 18 RB0/AN12/C3IND/INT0/RP3
VSS1 5 17 VDD
OSC1/CLKI/RA7 6 16 VSS2
OSC2/CLKO/RA6 7 15 RC7/CCP10/RX1/DT1/SDO1/RP18
8 9 10 11 12 13 14
RC0/T1OSO/T1CKI/RP11
RC1/CCP8/T1OSI/UOE/RP12
RC2/AN11/C2IND/CTPLS/RP13
RC4/D-/VM
RC6/CCP9/TX1/CK1/RP17
VUSB
RC5/D+/VP
28-Pin SPDIP/SOIC/SSOP
MCLR 1 28 RB7/CCP7/KBI3/PGD/RP10
RA0/AN0/C1INA/ULPWU/RP0 2 27 RB6/CCP6/KBI2/PGC/RP9
RA1/AN1/C2INA/VBG/RP1 3 26 RB5/CCP5/KBI1/SDI1/SDA1/RP8
RA2/AN2/C2INB/C1IND/C3INB/VREF-/CVREF 4 25 RB4/CCP4/KBI0/SCK1/SCL1/RP7
PIC18F2XJ53
RA3/AN3/C1INB/VREF+ 5 24 RB3/AN9/C3INA/CTED2/VPO/RP6
VDDCORE/VCAP 6 23 RB2/AN8/C2INC/CTED1/VMO/REFO/RP5
RA5/AN4/C1INC/SS1/HLVDIN/RCV/RP2 7 22 RB1/AN10/C3INC/RTCC/RP4
VSS1 8 21 RB0/AN12/C3IND/INT0/RP3
OSC1/CLKI/RA7 9 20 VDD
OSC2/CLKO/RA6 10 19 VSS2
RC0/T1OSO/T1CKI/RP11 11 18 RC7/CCP10/RX1/DT1/SDO1/RP18
RC1/CCP8/T1OSI/UOE/RP12 12 17 RC6/CCP9/TX1/CK1/RP17
RC2/AN11/C2IND/CTPLS/RP13 13 16 RC5/D+/VP
VUSB 14 15 RC4/D-/VM
RC6/CCP9/PMA5/TX1/CK1/RP17
RC2/AN11/C2IND/CTPLS/RP13
44-Pin QFN
RC1/CCP8/T1OSI/UOE/RP12
RC0/T1OSO/T1CKI/RP11
RD1/PMD1/SDA2
RD3/PMD3/RP20
RD2/PMD2/RP19
RD0/PMD0/SCL2
RC5/D+/VP
RC4/D-/VM
VUSB
44
43
42
41
40
39
38
37
36
35
34
RC7/CCP10/PMA4/RX1/DT1/SDO1/RP18 1 33 OSC2/CLKO/RA6
RD4/PMD4/RP21 2 32 OSC1/CLKI/RA7
RD5/PMD5/RP22 3 31 VSS2
RD6/PMD6/RP23 4 30 AVSS1
RD7/PMD7/RP24 5 29 VDD2
VSS1 6 PIC18F4XJ53 28 AVDD2
AVDD1 7 27 RE2/AN7/PMCS
VDD1 8 26 RE1/AN6/PMWR
RB0/AN12/C3IND/INT0/RP3 9 25 RE0/AN5/PMRD
RB1/AN10/C3INC/PMBE/RTCC/RP4 10 24 RA5/AN4/C1INC/SS1/HLVDIN/RCV/RP2
RB2/AN8/C2INC/CTED1/PMA3/VMO/REFO/RP5 11 23 VDDCORE/VCAP
15
16
14
17
12
13
18
19
20
21
22
RB3/AN9/C3INA/CTED2/PMA2/VPO/RP6
RB6/CCP6/KBI2/PGC/RP9
RB7/CCP7/KBI3/PGD/RP10
RA2/AN2/C2INB/C1IND/C3INB/VREF-/CVREF
NC
MCLR
RA3/AN3/C1INB/VREF+
RA1/AN1/C2INA/VBG/PMA7/RP1
RB4/CCP4/PMA1/KBI0/SCK1/SCL1/RP7
RB5/CCP5/PMA0/KBI1/SDI1/SDA1/RP8
RA0/AN0/C1INA/ULPWU/PMA6/RP0
44-Pin TQFP(2)
RC6/CCP9/PMA5/TX1/CK1/RP17
RC2/AN11/C2IND/CTPLS/RP13
RC1/CCP8/T1OSI/UOE/RP12
RD1/PMD1/SDA2
RD3/PMD3/RP20
RD2/PMD2/RP19
RD0/PMD0/SCL2
RC5/D+/VP
RC4/D-/VM
VUSB
NC
44
43
42
41
40
39
38
37
36
35
34
RC7/CCP10/PMA4/RX1/DT1/SDO1/RP18 1 33 NC
RD4/PMD4/RP21 2 32 RC0/T1OSO/T1CKI/RP11
RD5/PMD5/RP22 3 31 OSC2/CLKO/RA6
RD6/PMD6/RP23 4 30 OSC1/CLKI/RA7
RD7/PMD7/RP24 5 29 VSS2
VSS1 6 PIC18F4XJ53 28 VDD2
VDD1 7 27 RE2/AN7/PMCS
RB0/AN12/C3IND/INT0/RP3 8 26 RE1/AN6/PMWR
RB1/AN10/C3INC/PMBE/RTCC/RP4 9 25 RE0/AN5/PMRD
RB2/AN8/C2INC/CTED1/PMA3/VMO/REFO/RP5 10 24 RA5/AN4/C1INC/SS1/HLVDIN/RCV/RP2
RB3/AN9/C3INA/CTED2/PMA2/VPO/RP6 11 23 VDDCORE/VCAP
12
13
14
15
16
17
18
19
20
21
22
RB6/CCP6/KBI2/PGC/RP9
RB7/CCP7/KBI3/PGD/RP10
NC
NC
MCLR
RA3/AN3/C1INB/VREF+
RA2/AN2/C2INB/C1IND/C3INB/VREF-/CVREF
RB4/CCP4/PMA1/KBI0/SCK1/SCL1/RP7
RB5/CCP5/PMA0/KBI1/SDI1/SDA1/RP8
RA0/AN0/C1INA/ULPWU/PMA6/RP0
RA1/AN1/C2INA/VBG/PMA7/RP1
Errata
An errata sheet, describing minor operational differences from the data sheet and recommended workarounds, may exist for current
devices. As device/documentation issues become known to us, we will publish an errata sheet. The errata will specify the revision
of silicon and revision of document to which it applies.
To determine if an errata sheet exists for a particular device, please check with one of the following:
• Microchip’s Worldwide 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.
Devices in the PIC18F47J53 family incorporate a The Flash program memory is readable and writable
fully-featured USB communications module with a during normal operation. The PIC18F47J53 family also
built-in transceiver that is compliant with the USB provides plenty of room for dynamic application data
Specification Revision 2.0. The module supports both with up to 3.8 Kbytes of data RAM.
low-speed and full-speed communication for all
supported data transfer types.
Data Bus<8>
Table Pointer<21>
PORTA
Data Latch
inc/dec logic 8 8 RA0:RA7(1)
Data Memory
(3.8 Kbytes)
21 PCLATU PCLATH
20 Address Latch
PCU PCH PCL
Program Counter 12 PORTB
Data Address<12>
RB0:RB7(1)
31-Level Stack
Address Latch 4 12 4
BSR FSR0 Access
Program Memory STKPTR Bank
(16 Kbytes-64 Kbytes) FSR1
Data Latch FSR2 12
PORTC
inc/dec RC0:RC7(1)
8 logic
Table Latch
IR
8
Instruction State Machine
Decode and Control Signals
Control
PRODH PRODL
8 x 8 Multiply
Timing 3
Power-up 8
OSC2/CLKO Generation
OSC1/CLKI Timer BITOP W
8 MHz 8
INTOSC 8 8
Oscillator
INTRC Start-up Timer
8 8
Oscillator
VUSB Power-on
USB ALU<8>
Module Reset
8
Precision Watchdog
Band Gap Timer
Reference
Brown-out
Voltage Reset(2)
Regulator
RTCC HLVD ADC Timer0 Timer1 Timer2 Timer3 Timer4 Timer5 Timer6 Timer8 Comparators
CTMU ECCP1 ECCP2 ECCP3 CCP4 CCP5 CCP6 CCP7 CCP8 CCP9 CCP10 EUSART1 EUSART2 MSSP1 MSSP2 USB
Data Bus<8>
PORTA
Table Pointer<21> Data Latch
8 8 RA0:RA7(1)
Data Memory
inc/dec logic (3.8 Kbytes)
PCLATU PCLATH
21 20 Address Latch
PCU PCH PCL PORTB
Program Counter 12 RB0:RB7(1)
Data Address<12>
31-Level Stack
Address Latch 4 12 4
System Bus Interface
8 inc/dec
logic PORTD
Table Latch
RD0:RD7(1)
BITOP W
Timing 8 8 8
OSC2/CLKO Generation Power-up
OSC1/CLKI Timer
8 MHz
INTOSC 8 8
Oscillator
INTRC Start-up Timer ALU<8>
Oscillator
VUSB 8
Power-on
USB
Module Reset
Precision Watchdog
Band Gap Timer
Reference
Brown-out
Voltage Reset(2)
Regulator
RTCC HLVD ADC Timer0 Timer1 Timer2 Timer3 Timer4 Timer5 Timer6 Timer8 Comparators
CTMU ECCP1 ECCP2 ECCP3 CCP4 CCP5 CCP6 CCP7 CCP8 CCP9 CCP10 EUSART1 EUSART2 MSSP1 MSSP2 USB
VDD
VSS
R1 (1)
microcontrollers requires attention to a minimal set of R2
device pin connections before proceeding with MCLR
development. VCAP/VDDCORE
C1
The following pins must always be connected: C7
PIC18FXXJXX
• All VDD and VSS pins
VDD
(see Section 2.2 “Power Supply Pins”) VSS
C6(2) C3(2)
• All AVDD and AVSS pins, regardless of whether or VSS
VDD
not the analog device features are used
AVDD
AVSS
VDD
VSS
(see Section 2.2 “Power Supply Pins”)
• MCLR pin
(see Section 2.3 “Master Clear (MCLR) Pin”)
C5(2) C4(2)
• VCAP/VDDCORE pins (see Section 2.4 “Voltage
Regulator Pins (VCAP/VDDCORE)”)
These pins must also be connected if they are being Key (all values are recommendations):
used in the end application: C1 through C6: 0.1 F, 20V ceramic
• PGC/PGD pins used for In-Circuit Serial C7: 10 F, 6.3V or greater, tantalum or ceramic
Programming™ (ICSP™) and debugging purposes R1: 10 kΩ
(see Section 2.5 “ICSP Pins”)
R2: 100Ω to 470Ω
• OSCI and OSCO pins when an external oscillator
Note 1: See Section 2.4 “Voltage Regulator Pins
source is used (VCAP/VDDCORE)” for explanation of
(see Section 2.6 “External Oscillator Pins”) VCAP/VDDCORE connections.
Additionally, the following pins may be required: 2: The example shown is for a PIC18F device
with five VDD/VSS and AVDD/AVSS pairs.
• VREF+/VREF- pins are used when external voltage Other devices may have more or less pairs;
reference for analog modules is implemented adjust the number of decoupling capacitors
Note: On 44-pin QFN packages, the AVDD and appropriately.
AVSS pins must always be connected,
regardless of whether any of the analog
modules are being used. On other pack-
age types, the AVDD and AVSS pins are
internally connected to the VDD/VSS pins.
The minimum mandatory connections are shown in
Figure 2-1.
1
ESR ()
0.1
0.01
0.001
0.01 0.1 1 10 100 1000 10,000
Frequency (MHz)
Note: Data for Murata GRM21BF50J106ZE01 shown.
Measurements at 25°C, 0V DC bias.
similar noise).
OSCO
For additional information and design guidance on
oscillator circuits, please refer to these Microchip
C2
Application Notes, available at the corporate web site
Oscillator
(www.microchip.com): GND Crystal
• AN826, “Crystal Oscillator Basics and Crystal C1
Selection for rfPIC™ and PICmicro® Devices”
• AN849, “Basic PICmicro® Oscillator Design” OSCI
• AN943, “Practical PICmicro® Oscillator Analysis
and Design”
• AN949, “Making Your Oscillator Work”
12 000
10
PLL Prescaler
001
6 010
5 011 4 MHz 96 MHz 48 MHz
4 PLL(1) 2
100
3 101
2 110
Primary Oscillator 1 111 FSEN
OSC2
FOSC2 1
USB Module
Clock
1 1
OSC1 (Note 2) Needs 48 MHz for FS
8 1
0 0 Needs 6 MHz for LS
0
CPDIV<1:0>
4 0
6 00 LS48MHZ
CPU Divider
3
01
PLLEN
2
10
CFGPLLEN
1
11
FOSC<2:1>
Primary Clock
Other
Source(4) IDLE
00 CPU
Secondary Oscillator 00
Timer1 Clock(3) Peripherals
T1OSO 01
11 RA6
Postscaled
Internal Clock 4
OSCCON<6:4>
T1OSI
8 MHz OSCCON<1:0> CLKO
111 Enabled Modes
4 MHz
Internal 110
INTOSC Postscaler
Oscillator 2 MHz
Block 101
1 MHz
100
8 MHz 500 kHz
8 MHz 011
INTRC 250 kHz
010
31 kHz 125 kHz
001
1 31 kHz
000
0
WDT, PWRT, FSCM
OSCTUNE<7> and Two-Speed Start-up
Note 1: The PLL requires a 4 MHz input and it produces a 96 MHz output. The PLL will not be available until the PLLEN bit
in the OSCTUNE register is set. Once the PLLEN bit is set, the PLL requires up to trc to lock. During this time, the
device continues to be clocked at the PLL bypassed frequency.
2: In order to use the USB module in Full-Speed mode, this node must be run at 48 MHz. For Low-Speed mode, this
node may be run at either 48 MHz or 24 MHz, but the CPDIV bits must be set such that the USB module is clocked
at 6 MHz.
3: Selecting the Timer1 clock or postscaled internal clock will turn off the primary oscillator (unless required by the
reference clock of Section 3.6 “Reference Clock Output”) and PLL.
4: The USB module cannot be used to communicate unless the primary clock source is selected.
The PLLEN bit, contained in the OSCTUNE register, It is also possible to verify device clock speed against
can be used to enable or disable the internal 96 MHz a reference clock. Two timers may be used: one timer
PLL when running in one of the PLL type oscillator is clocked by the peripheral clock, while the other is
modes (e.g., INTOSCPLL). Oscillator modes that do clocked by a fixed reference source, such as the
not contain “PLL” in their name cannot be used with Timer1 oscillator. Both timers are cleared, but the timer
the PLL. In these modes, the PLL is always disabled clocked by the reference generates interrupts. When
regardless of the setting of the PLLEN bit. an interrupt occurs, the internally clocked timer is read
and both timers are cleared. If the internally clocked
When configured for one of the PLL enabled modes, set- timer value is greater than expected, then the internal
ting the PLLEN bit does not immediately switch the oscillator block is running too fast. To adjust for this,
device clock to the PLL output. The PLL requires up to decrement the OSCTUNE register.
electrical parameter, trc, to start-up and lock, during
which time, the device continues to be clocked. Once the Finally, an ECCP module can use free-running Timer1
PLL output is ready, the microcontroller core will (or Timer3), clocked by the internal oscillator block and
automatically switch to the PLL derived frequency. an external event with a known period (i.e., AC power
frequency). The time of the first event is captured in the
3.2.5.2 Internal Oscillator Output Frequency CCPRxH:CCPRxL registers and is recorded for use
and Drift later. When the second event causes a capture, the
time of the first event is subtracted from the time of the
The internal oscillator block is calibrated at the factory second event. Since the period of the external event is
to produce an INTOSC output frequency of 8.0 MHz. known, the time difference between events can be
However, this frequency may drift as VDD or tempera- calculated.
ture changes, which can affect the controller operation
in a variety of ways. If the measured time is greater than the calculated time,
the internal oscillator block is running too fast; to
The low-frequency INTRC oscillator operates indepen- compensate, decrement the OSCTUNE register. If the
dently of the INTOSC source. Any changes in INTOSC measured time is less than the calculated time, the inter-
across voltage and temperature are not necessarily nal oscillator block is running too slow; to compensate,
reflected by changes in INTRC and vice versa. increment the OSCTUNE register.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: When the CFGPLLEN Configuration bit is used to enable the PLL, clearing OSCTUNE<6> will not disable
the PLL.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: Reset value is ‘0’ when Two-Speed Start-up is enabled and ‘1’ if disabled.
2: Default output frequency of INTOSC on Reset (4 MHz).
3: Source selected by the INTSRC bit (OSCTUNE<7>).
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: Reset value is ‘0’ when Two-Speed Start-up is enabled and ‘1’ if disabled.
2: Default output frequency of INTOSC on Reset (4 MHz).
3: When the SOSC is selected to run from a digital clock input, rather than an external crystal, this bit has no
effect.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: The crystal oscillator must be enabled using the FOSC<2:0> bits; the crystal maintains the operation in
Sleep mode.
T1OSI 1 2 3 n-1 n
CPU
Clock
Peripheral
Clock
Program
Counter PC PC + 2 PC + 4
FIGURE 4-2: TRANSITION TIMING FROM SEC_RUN MODE TO PRI_RUN MODE (HSPLL)
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3
T1OSI
OSC1
TOST(1) TPLL(1)
1 2 n-1 n
PLL Clock
Output
Clock
Transition
CPU Clock
Peripheral
Clock
Program PC + 2 PC + 4
PC
Counter
Note 1: TOST = 1024 TOSC; TPLL = 2 ms (approx). These intervals are not shown to scale.
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3
INTRC 1 2 3 n-1 n
Clock Transition
OSC1
CPU
Clock
Peripheral
Clock
Program
Counter PC PC + 2 PC + 4
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3
INTRC
OSC1
TOST(1) TPLL(1)
1 2 n-1 n
PLL Clock
Output
Clock
Transition
CPU Clock
Peripheral
Clock
Program PC PC + 2 PC + 4
Counter
Note 1: TOST = 1024 TOSC; TPLL = 2 ms (approx). These intervals are not shown to scale.
CPU
Clock
Peripheral
Clock
Sleep
Program
Counter PC PC + 2
OSC1
TOST(1) TPLL(1)
PLL Clock
Output
CPU Clock
Peripheral
Clock
Program PC PC + 2 PC + 4 PC + 6
Counter
Note 1: TOST = 1024 TOSC; TPLL = 2 ms (approx). These intervals are not shown to scale.
Q1 Q2 Q3 Q4 Q1
OSC1
CPU Clock
Peripheral
Clock
Program
Counter PC PC + 2
FIGURE 4-8: TRANSITION TIMING FOR WAKE FROM IDLE TO RUN MODE
Q1 Q2 Q3 Q4
OSC1
TCSD
CPU Clock
Peripheral
Clock
Program PC
Counter
Wake Event
Pins that are configured as outputs (TRIS bit clear) The software can determine if the wake-up was caused
prior to entry into Deep Sleep will remain as output pins from an exit from Deep Sleep mode by reading the DS
during Deep Sleep. While in this mode, they will drive bit (WDTCON<3>). If this bit is set, the POR was
the output level determined by their corresponding LAT caused by a Deep Sleep exit. The DS bit must be
bit at the time of entry into Deep Sleep. manually cleared by the software.
When the device wakes back up, the I/O pin behavior The software can determine the wake event source by
depends on the type of wake up source. reading the DSWAKEH and DSWAKEL registers.
When the application firmware is done using the
If the device wakes back up by an RTCC alarm, INT0 DSWAKEH and DSWAKEL status registers, individual
interrupt, DSWDT or ULPWU event, all I/O pins will bits do not need to be manually cleared before entering
continue to maintain their previous states, even after the Deep Sleep again. When entering Deep Sleep mode,
device has finished the POR sequence and is executing these registers are automatically cleared.
application code again. Pins configured as inputs during
Deep Sleep will remain high-impedance, and pins 4.6.3.1 Wake-up Event Considerations
configured as outputs will continue to drive their previous
Deep Sleep wake-up events are only monitored while
value.
the processor is fully in Deep Sleep mode. If a wake-up
After waking up, the TRIS and LAT registers will be event occurs before Deep Sleep mode is entered, the
reset, but the I/O pins will still maintain their previous event status will not be reflected in the DSWAKE
states. If firmware modifies the TRIS and LAT values registers. If the wake-up source asserts prior to entering
for the I/O pins, they will not immediately go to the Deep Sleep, the CPU will either go to the interrupt vector
newly configured states. Once the firmware clears the (if the wake source has an interrupt bit and the interrupt
RELEASE bit (DSCONL<0>), the I/O pins will be is fully enabled) or will abort the Deep Sleep entry
“released”. This causes the I/O pins to take the states sequence by executing past the SLEEP instruction if the
configured by their respective TRIS and LAT bit values. interrupt was not enabled. In this case, a wake-up event
If the Deep Sleep BOR (DSBOR) circuit is enabled, and handler should be placed after the SLEEP instruction to
VDD drops below the DSBOR and VDD rail POR thresh- process the event and re-attempt entry into Deep Sleep
olds, the I/O pins will be immediately released similar to if desired.
clearing the RELEASE bit. All previous state informa- When the device is in Deep Sleep with more than one
tion will be lost, including the general purpose DSGPR0 wake-up source simultaneously enabled, only the first
and DSGPR1 contents. See Section 4.6.5 “Deep wake-up source to assert will be detected and logged
Sleep Brown-Out Reset (DSBOR)” for additional in the DSWAKEH/DSWAKEL status registers.
details regarding this scenario
If a MCLR Reset event occurs during Deep Sleep, the 4.6.4 DEEP SLEEP WATCHDOG TIMER
I/O pins will also be released automatically, but in this (DSWDT)
case, the DSGPR0 and DSGPR1 contents will remain Deep Sleep has its own dedicated WDT (DSWDT) with
valid. a postscaler for time-outs of 2.1 ms to 25.7 days,
In all other Deep Sleep wake-up cases, application configurable through the bits, DSWDTPS<3:0>.
firmware needs to clear the RELEASE bit in order to The DSWDT can be clocked from either the INTRC or
reconfigure the I/O pins. the T1OSC/T1CKI input. If the T1OSC/T1CKI source
will be used with a crystal, the T1OSCEN bit in the
T1CON register needs to be set prior to entering Deep
Sleep. The reference clock source is configured through
the DSWDTOSC bit.
DSWDT is enabled through the DSWDTEN bit. Entering
Deep Sleep mode automatically clears the DSWDT. See
Section 28.0 “Special Features of the CPU” for more
information.
REGISTER 4-1: DSCONH: DEEP SLEEP CONTROL HIGH BYTE REGISTER (BANKED F4Dh)
R/W-0 U-0 U-0 U-0 U-0 r-0 R/W-0 R/W-0
(1)
DSEN — — — — r DSULPEN RTCWDIS
bit 7 bit 0
Note 1: In order to enter Deep Sleep, Sleep must be executed immediately after setting DSEN.
REGISTER 4-2: DSCONL: DEEP SLEEP LOW BYTE CONTROL REGISTER (BANKED F4Ch)
U-0 U-0 U-0 U-0 U-0 R/W-0 R/W-0(1) R/W-0(1)
— — — — — ULPWDIS DSBOR RELEASE
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: All register bits are maintained unless: VDDCORE drops below the normal BOR threshold outside of Deep
Sleep or the device is in Deep Sleep and the dedicated DSBOR is enabled and VDD drops below the
DSBOR threshold, or DSBOR is enabled or disabled, but VDD is hard cycled to near VSS.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: All register bits are maintained unless: VDDCORE drops below the normal BOR threshold outside of Deep
Sleep or the device is in Deep Sleep and the dedicated DSBOR is enabled and VDD drops below the
DSBOR threshold, or DSBOR is enabled or disabled, but VDD is hard cycled to near VSS.
REGISTER 4-5: DSWAKEH: DEEP SLEEP WAKE HIGH BYTE REGISTER (BANKED F4Bh)
U-0 U-0 U-0 U-0 U-0 U-0 U-0 R/W-0
— — — — — — — DSINT0
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: Unlike the other bits in this register, this bit can be set outside of Deep Sleep.
//***************************
//Charge the capacitor on RA0
//***************************
TRISAbits.TRISA0 = 0;
PORTAbits.RA0 = 1;
for(i = 0; i < 10000; i++) Nop();
//**********************************
//Stop Charging the capacitor on RA0
//**********************************
TRISAbits.TRISA0 = 1;
//*****************************************
//Enable the Ultra Low Power Wakeup module
//and allow capacitor discharge
//*****************************************
WDTCONbits.ULPEN = 1;
WDTCONbits.ULPSINK = 1;
//******************************************
//Enable Interrupt for ULPW
//******************************************
//For Sleep
//(assign the ULPOUT signal in the PPS module to a pin
//which has also been assigned an interrupt capability,
//such as INT1)
INTCON3bits.INT1IF = 0;
INTCON3bits.INT1IE = 1;
//********************
//Configure Sleep Mode
//********************
//For Sleep
OSCCONbits.IDLEN = 0;
PMDIS3 CCP10MD CCP9MD CCP8MD CCP7MD CCP6MD CCP5MD CCP4MD — 0000 000–
PMDIS2 — TMR8MD — TMR6MD TMR5MD CMP3MD CMP2MD CMP1MD –0–0 0000
PMDIS1 PSPMD(1) CTMUMD RTCCMD TMR4MD TMR3MD TMR2MD TMR1MD — 0000 000–
PMDIS0 ECCP3MD ECCP2MD ECCP1MD UART2MD UART1MD SPI2MD SPI1MD ADCMD 0000 0000
Note 1: Not implemented on 28-pin devices (PIC18F26J53, PIC18F27J53, PIC18LF26J53 and PIC18LF27J53).
External Reset
MCLR ( )_IDLE
Deep Sleep Reset
Sleep
WDT
Time-out
VDDCORE PWRT
32 ms PWRT 66 ms Chip_Reset
R Q
INTRC
11-Bit Ripple Counter
Note 1: The VDD monitoring BOR circuit can be enabled or disabled on “LF” devices based on the CONFIG3L<DSBOREN>
Configuration bit. On “F” devices, the VDD monitoring BOR circuit is only enabled during Deep Sleep mode by
CONFIG3L<DSBOREN>.
2: The VDDCORE monitoring BOR circuit is only implemented on “F” devices. It is always used, except while in Deep
Sleep mode. The VDDCORE monitoring BOR circuit has a trip point threshold of VBOR (parameter D005).
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: 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).
FIGURE 5-2: TIME-OUT SEQUENCE ON POWER-UP (MCLR TIED TO VDD, VDD RISE < TPWRT)
VDD
MCLR
INTERNAL POR
TPWRT
PWRT TIME-OUT
INTERNAL RESET
VDD
MCLR
INTERNAL POR
TPWRT
PWRT TIME-OUT
INTERNAL RESET
FIGURE 5-4: TIME-OUT SEQUENCE ON POWER-UP (MCLR NOT TIED TO VDD): CASE 2
VDD
MCLR
INTERNAL POR
TPWRT
PWRT TIME-OUT
INTERNAL RESET
FIGURE 5-5: SLOW RISE TIME (MCLR TIED TO VDD, VDD RISE > TPWRT)
3.3V
VDD 0V 1V
MCLR
INTERNAL POR
TPWRT
PWRT TIME-OUT
INTERNAL RESET
TABLE 5-1: STATUS BITS, THEIR SIGNIFICANCE AND THE INITIALIZATION CONDITION FOR
RCON REGISTER
PC<20:0>
CALL, CALLW, RCALL, 21
RETURN, RETFIE, RETLW,
ADDULNK, SUBULNK
Stack Level 1
Stack Level 31
PIC18FX6J53 PIC18FX7J53
000000h
On-Chip On-Chip
Memory Memory
Config. Words
00FFFFh
Config. Words
User Memory Space
01FFFFh
Unimplemented Unimplemented
Read as ‘0’ Read as ‘0’
1FFFFFF
Note: Sizes of memory areas are not to scale. Sizes of program memory areas are enhanced to show detail.
Read as ‘0’
1FFFFFh
00011
Top-of-Stack 001A34h 00010
000D58h 00001
00000
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
OSC1
Q1
Q2 Internal
Phase
Q3 Clock
Q4
PC PC PC + 2 PC + 4
OSC2/CLKO
(RC mode)
Execute INST (PC – 2)
Fetch INST (PC) Execute INST (PC)
Fetch INST (PC + 2) Execute INST (PC + 2)
Fetch INST (PC + 4)
Note: All instructions are single-cycle, except for any program branches. These take two cycles since the
fetch instruction is “flushed” from the pipeline while the new instruction is being fetched and then
executed.
6.2.4 TWO-WORD INSTRUCTIONS used by the instruction sequence. If the first word is
skipped for some reason and the second word is
The standard PIC18 instruction set has four two-word
executed by itself, a NOP is executed instead. This is
instructions: CALL, MOVFF, GOTO and LSFR. In all
necessary for cases when the two-word instruction is
cases, the second word of the instructions always has
preceded by a conditional instruction that changes the
‘1111’ as its four Most Significant bits (MSbs); the other
PC. Example 6-4 illustrates how this works.
12 bits are literal data, usually a data memory address.
The use of ‘1111’ in the 4 MSbs of an instruction Note: See Section 6.5 “Program Memory and
specifies a special form of NOP. If the instruction is the Extended Instruction Set” for infor-
executed in proper sequence immediately after the first mation on two-word instructions in the
word, the data in the second word is accessed and extended instruction set.
BSR(1)
Data Memory From Opcode(2)
7 0 000h 00h 7 0
0 0 0 0 0 0 1 0 Bank 0 11 11 11 11 11 1 1 1
FFh
100h 00h
Bank 1
Bank Select(2) 200h FFh
00h
Bank 2
300h FFh
00h
Bank 3
through
Bank 13
FFh
E00h
00h
Bank 14
F00h FFh
00h
Bank 15
FFFh FFh
Note 1: The Access RAM bit of the instruction can be used to force an override of the selected bank (BSR<3:0>) to
the registers of the Access Bank.
2: The MOVFF instruction embeds the entire 12-bit address in the instruction.
6.3.3 ACCESS BANK Using this “forced” addressing allows the instruction to
operate on a data address in a single cycle without
While the use of the BSR with an embedded 8-bit
updating the BSR first. For 8-bit addresses of 60h and
address allows users to address the entire range of
above, this means that users can evaluate and operate
data memory, it also means that the user must always
on SFRs more efficiently. The Access RAM below 60h
ensure that the correct bank is selected. Otherwise,
is a good place for data values that the user might need
data may be read from or written to the wrong location.
to access rapidly, such as immediate computational
This can be disastrous if a GPR is the intended target
results or common program variables. Access RAM
of an operation, but an SFR is written to instead.
also allows for faster and more code efficient context
Verifying and/or changing the BSR for each read or
saving and switching of variables.
write to data memory can become very inefficient.
The mapping of the Access Bank is slightly different
To streamline access for the most commonly used data
when the extended instruction set is enabled (XINST
memory locations, the data memory is configured with
Configuration bit = 1). This is discussed in more detail
an Access Bank, which allows users to access a
in Section 6.6.3 “Mapping the Access Bank in
mapped block of memory without specifying a BSR.
Indexed Literal Offset Mode”.
The Access Bank consists of the first 96 bytes of
memory (00h-5Fh) in Bank 0 and the last 160 bytes of
6.3.4 GENERAL PURPOSE
memory (60h-FFh) in Bank 15. The lower half is known
REGISTER FILE
as the Access RAM and is composed of GPRs. The
upper half is where the device’s SFRs are mapped. PIC18 devices may have banked memory in the GPR
These two areas are mapped contiguously in the area. This is data RAM, which is available for use by all
Access Bank and can be addressed in a linear fashion instructions. GPRs start at the bottom of Bank 0
by an 8-bit address (Figure 6-6). (address 000h) and grow upward toward the bottom of
the SFR area. GPRs are not initialized by a POR and
The Access Bank is used by core PIC18 instructions
are unchanged on all other Resets.
that include the Access RAM bit (the ‘a’ parameter in
the instruction). When ‘a’ is equal to ‘1’, the instruction
uses the BSR and the 8-bit address included in the
opcode for the data memory address. When ‘a’ is ‘0’,
however, the instruction is forced to use the Access
Bank address map; the current value of the BSR is
ignored entirely.
Address Name Address Name Address Name Address Name Address Name Address Name
F5Fh PMCONH F3Fh RTCCFG F1Fh PR6 EFFh RPINR24 EDFh — EBFh PPSCON
F5Eh PMCONL F3Eh RTCCAL F1Eh T6CON EFEh RPINR23 EDEh — EBEh —
F5Dh PMMODEH F3Dh REFOCON F1Dh TMR8 EFDh RPINR22 EDDh — EBDh —
F5Ch PMMODEL F3Ch PADCFG1 F1Ch PR8 EFCh RPINR21 EDCh — EBCh PMDIS3
F5Bh PMDOUT2H F3Bh RTCVALH F1Bh T8CON EFBh — EDBh — EBBh PMDIS2
F5Ah PMDOUT2L F3Ah RTCVALL F1Ah PSTR3CON EFAh — EDAh — EBAh PMDIS1
F59h PMDIN2H F39h UCFG F19h ECCP3AS EF9h — ED9h — EB9h PMDIS0
F58h PMDIN2L F38h UADDR F18h ECCP3DEL EF8h RPINR17 ED8h RPOR24 EB8h ADCTRIG
F57h PMEH F37h UEIE F17h CCPR3H EF7h RPINR16 ED7h RPOR23 EB7h —
F56h PMEL F36h UIE F16h CCPR3L EF6h — ED6h RPOR22 EB6h —
F55h PMSTATH F35h UEP15 F15h CCP3CON EF5h — ED5h RPOR21 EB5h —
F54h PMSTATL F34h UEP14 F14h CCPR4H EF4h RPINR14 ED4h RPOR20 EB4h —
F53h CVRCON F33h UEP13 F13h CCPR4L EF3h RPINR13 ED3h RPOR19 EB3h —
F52h CCPTMRS0 F32h UEP12 F12h CCP4CON EF2h RPINR12 ED2h RPOR18 EB2h —
F51h CCPTMRS1 F31h UEP11 F11h CCPR5H EF1h — ED1h RPOR17 EB1h —
F50h CCPTMRS2 F30h UEP10 F10h CCPR5L EF0h — ED0h — EB0h —
F4Fh DSGPR1 F2Fh UEP9 F0Fh CCP5CON EEFh — ECFh —
F4Eh DSGPR0 F2Eh UEP8 F0Eh CCPR6H EEEh — ECEh —
F4Dh DSCONH F2Dh UEP7 F0Dh CCPR6L EEDh — ECDh RPOR13
F4Ch DSCONL F2Ch UEP6 F0Ch CCP6CON EECh — ECCh RPOR12
F4Bh DSWAKEH F2Bh UEP5 F0Bh CCPR7H EEBh — ECBh RPOR11
F4Ah DSWAKEL F2Ah UEP4 F0Ah CCPR7L EEAh RPINR9 ECAh RPOR10
F49h ANCON1 F29h UEP3 F09h CCP7CON EE9h RPINR8 EC9h RPOR9
F48h ANCON0 F28h UEP2 F08h CCPR8H EE8h RPINR7 EC8h RPOR8
F47h ALRMCFG F27h UEP1 F07h CCPR8L EE7h RPINR15 EC7h RPOR7
F46h ALRMRPT F26h UEP0 F06h CCP8CON EE6h RPINR6 EC6h RPOR6
F45h ALRMVALH F25h CM3CON F05h CCPR9H EE5h — EC5h RPOR5
F44h ALRMVALL F24h TMR5H F04h CCPR9L EE4h RPINR4 EC4h RPOR4
F43h — F23h TMR5L F03h CCP9CON EE3h RPINR3 EC3h RPOR3
F42h ODCON1 F22h T5CON F02h CCPR10H EE2h RPINR2 EC2h RPOR2
F41h ODCON2 F21h T5GCON F01h CCPR10L EE1h RPINR1 EC1h RPOR1
F40h ODCON3 F20h TMR6 F00h CCP10CON EE0h — EC0h RPOR0
FDCh PREINC2 Uses contents of FSR2 to address data memory – value of FSR2 pre-incremented (not a physical register) N/A
FDBh PLUSW2 Uses contents of FSR2 to address data memory – value of FSR2 pre-incremented (not a physical register) – N/A
value of FSR2 offset by W
FDAh FSR2H — — — — Indirect Data Memory Address Pointer 2 High Byte ---- xxxx
FD9h FSR2L Indirect Data Memory Address Pointer 2 Low Byte xxxx xxxx
FD8h STATUS — — — N OV Z DC C ---x xxxx
FD7h TMR0H Timer0 Register High Byte 0000 0000
FD6h TMR0L Timer0 Register Low Byte xxxx xxxx
FD5h T0CON TMR0ON T08BIT T0CS T0SE PSA T0PS2 T0PS1 T0PS0 1111 1111
FD3h OSCCON IDLEN IRCF2 IRCF1 IRCF0 OSTS FLTS SCS1 SCS0 0110 q000
FD2h CM1CON CON COE CPOL EVPOL1 EVPOL0 CREF CCH1 CCH0 0001 1111
FD1h CM2CON CON COE CPOL EVPOL1 EVPOL0 CREF CCH1 CCH0 0001 1111
FD0h RCON IPEN — CM RI TO PD POR BOR 0-11 11qq
FCFh TMR1H Timer1 Register High Byte xxxx xxxx
FCEh TMR1L Timer1 Register Low Bytes xxxx xxxx
FCDh T1CON TMR1CS1 TMR1CS0 T1CKPS1 T1CKPS0 T1OSCEN T1SYNC RD16 TMR1ON 0000 0000
FCCh TMR2 Timer2 Register 0000 0000
FCBh PR2 Timer2 Period Register 1111 1111
FCAh T2CON — T2OUTPS3 T2OUTPS2 T2OUTPS1 T2OUTPS0 TMR2ON T2CKPS1 T2CKPS0 -000 0000
FC9h SSP1BUF MSSP1 Receive Buffer/Transmit Register xxxx xxxx
FC8h SSP1ADD MSSP1 Address Register (I2C™ Slave Mode). MSSP1 Baud Rate Reload Register (I2C Master Mode). 0000 0000
FC8h SSP1MSK MSK7 MSK6 MSK5 MSK4 MSK3 MSK2 MSK1 MSK0 ---- ----
FC7h SSP1STAT SMP CKE D/A P S R/W UA BF 1111 1111
FC6h SSP1CON1 WCOL SSPOV SSPEN CKP SSPM3 SSPM2 SSPM1 SSPM0 0000 0000
FC5h SSP1CON2 GCEN ACKSTAT ACKDT ACKEN RCEN PEN RSEN SEN 0000 0000
FC5h SSP1CON2 GCEN ACKSTAT ADMSK5 ADMSK4 ADMSK3 ADMSK2 ADMSK1 SEN 0000 0000
FC4h ADRESH A/D Result Register High Byte xxxx xxxx
FC3h ADRESL A/D Result Register Low Byte xxxx xxxx
FC2h ADCON0 VCFG1 VCFG0 CHS3 CHS2 CHS1 CHS0 GO/DONE ADON 0000 0000
FC1h ADCON1 ADFM ADCAL ACQT2 ACQT1 ACQT0 ADCS2 ADCS1 ADCS0 0000 0000
FC0h WDTCON REGSLP LVDSTAT ULPLVL VBGOE DS ULPEN ULPSINK SWDTEN 1xx0 0000
FBFh PSTR1CON CMPL1 CMPL0 — STRSYNC STRD STRC STRB STRA 00-0 0001
FBEh ECCP1AS ECCP1ASE ECCP1AS2 ECCP1AS1 ECCP1AS0 PSS1AC1 PSS1AC0 PSS1BD1 PSS1BD0 0000 0000
FBDh ECCP1DEL P1RSEN P1DC6 P1DC5 P1DC4 P1DC3 P1DC2 P1DC1 P1DC0 0000 0000
FBCh CCPR1H Capture/Compare/PWM Register 1 High Byte xxxx xxxx
FBBh CCPR1L Capture/Compare/PWM Register 1 Low Byte xxxx xxxx
FBAh CCP1CON P1M1 P1M0 DC1B1 DC1B0 CCP1M3 CCP1M2 CCP1M1 CCP1M0 0000 0000
FB9h PSTR2CON CMPL1 CMPL0 — STRSYNC STRD STRC STRB STRA 00-0 0001
FB8h ECCP2AS ECCP2ASE ECCP2AS2 ECCP2AS1 ECCP2AS0 PSS2AC1 PSS2AC0 PSS2BD1 PSS2BD0 0000 0000
FB7h ECCP2DEL P2RSEN P2DC6 P2DC5 P2DC4 P2DC3 P2DC2 P2DC1 P2DC0 0000 0000
FB6h CCPR2H Capture/Compare/PWM Register 2 High Byte xxxx xxxx
FB5h CCPR2L Capture/Compare/PWM Register 2 Low Byte xxxx xxxx
FB4h CCP2CON P2M1 P2M0 DC2B1 DC2B0 CCP2M3 CCP2M2 CCP2M1 CCP2M0 0000 0000
FB3h CTMUCONH CTMUEN — CTMUSIDL TGEN EDGEN EDGSEQEN IDISSEN CTTRIG 0-00 0000
FB2h CTMUCONL EDG2POL EDG2SEL1 EDG2SEL0 EDG1POL EDG1SEL1 EDG1SEL0 EDG2STAT EDG1STAT 0000 00xx
FB1h CTMUICON ITRIM5 ITRIM4 ITRIM3 ITRIM2 ITRIM1 ITRIM0 IRNG1 IRNG0 0000 0000
FB0h SPBRG1 EUSART1 Baud Rate Generator Register Low Byte 0000 0000
FAFh RCREG1 EUSART1 Receive Register 0000 0000
Legend: x = unknown, u = unchanged, - = unimplemented, q = value depends on condition, r = reserved, do not modify
Note 1: Implemented only for 44-pin devices (PIC18F46J53, PIC18F47J53, PIC18LF46J53 and PIC18LF47J53).
2: Implemented only for 28-pin devices (PIC18F26J53, PIC18F27J53, PIC18LF26J53 and PIC18LF27J53).
3: Implemented only for devices with 128 Kbyte of program memory (PIC18F27J53, PIC18F47J53, PIC18LF27J53 and PIC18LF47J53).
F7Fh SPBRGH1 EUSART1 Baud Rate Generator High Byte 0000 0000
F7Eh BAUDCON1 ABDOVF RCIDL RXDTP TXCKP BRG16 — WUE ABDEN 0100 0-00
F7Dh SPBRGH2 EUSART2 Baud Rate Generator High Byte 0000 0000
F7Ch BAUDCON2 ABDOVF RCIDL RXDTP TXCKP BRG16 — WUE ABDEN 0100 0-00
F7Bh TMR3H Timer3 Register High Byte xxxx xxxx
F7Ah TMR3L Timer3 Register Low Byte xxxx xxxx
F79h T3CON TMR3CS1 TMR3CS0 T3CKPS1 T3CKPS0 T3OSCEN T3SYNC RD16 TMR3ON 0000 0000
F78h TMR4 Timer4 Register 0000 0000
F77h PR4 Timer4 Period Register 1111 1111
F76h T4CON — T4OUTPS3 T4OUTPS2 T4OUTPS1 T4OUTPS0 TMR4ON T4CKPS1 T4CKPS0 -000 0000
F75h SSP2BUF MSSP2 Receive Buffer/Transmit Register xxxx xxxx
F74h SSP2ADD MSSP2 Address Register (I2C™ Slave Mode). MSSP2 Baud Rate Reload Register (I2C Master Mode). ---- ----
F74h SSP2MSK MSK7 MSK6 MSK5 MSK4 MSK3 MSK2 MSK1 MSK0 0000 0000
F73h SSP2STAT SMP CKE D/A P S R/W UA BF 1111 1111
F72h SSP2CON1 WCOL SSPOV SSPEN CKP SSPM3 SSPM2 SSPM1 SSPM0 0000 0000
F71h SSP2CON2 GCEN ACKSTAT ACKDT ACKEN RCEN PEN RSEN SEN 0000 0000
ADMSK5 ADMSK4 ADMSK3 ADMSK2 ADMSK1
F70h CMSTAT — — — — — COUT3 COUT2 COUT1 ---- -111
F6Fh PMADDRH/ — CS1 Parallel Master Port Address High Byte -000 0000
PMDOUT1H(1)
Parallel Port Out Data High Byte (Buffer 1) 0000 0000
F6Eh PMADDRL/ Parallel Master Port Address Low Byte/ 0000 0000
PMDOUT1L(1) Parallel Port Out Data Low Byte (Buffer 1)
F6Dh PMDIN1H(1) Parallel Port In Data High Byte (Buffer 1) 0000 0000
F6Ch PMDIN1L(1) Parallel Port In Data Low Byte (Buffer 1) 0000 0000
F6Bh TXADDRL SPI DMA Transmit Data Pointer Low Byte xxxx xxxx
F6Ah TXADDRH — — — — SPI DMA Transmit Data Pointer High Byte ---- xxxx
F69h RXADDRL SPI DMA Receive Data Pointer Low Byte xxxx xxxx
F68h RXADDRH — — — — SPI DMA Receive Data Pointer High Byte ---- xxxx
F67h DMABCL SPI DMA Byte Count Low Byte xxxx xxxx
F66h DMABCH — — — — — — SPI DMA Byte Count High ---- --xx
Byte
F65h UCON(1) — PPBRST SE0 PKTDIS USBEN RESUME SUSPND — -0x0 000-
F64h USTAT — ENDP3 ENDP2 ENDP1 ENDP0 DIR PPBI — -xxx xxx-
F63h UEIR BTSEF — — BTOEF DFN8EF CRC16EF CRC5EF PIDEF 0--0 0000
F62h UIR — SOFIF STALLIF IDLEIF TRNIF ACTVIF UERRIF URSTIF -000 0000
F61h UFRMH — — — — — FRM10 FRM9 FRM8 ---- -xxx
F60h UFRML FRM7 FRM6 FRM5 FRM4 FRM3 FRM2 FRM1 FRM0 xxxx xxxx
F5Fh PMCONH(1) PMPEN — PSIDL ADRMUX1 ADRMUX0 PTBEEN PTWREN PTRDEN 0-00 0000
F5Eh PMCONL(1) CSF1 CSF0 ALP — CS1P BEP WRSP RDSP 000- 0000
F5Dh PMMODEH(1) BUSY IRQM1 IRQM0 INCM1 INCM0 MODE16 MODE1 MODE0 0000 0000
F5Ch PMMODEL(1) WAITB1 WAITB0 WAITM3 WAITM2 WAITM1 WAITM0 WAITE1 WAITE0 0000 0000
F5Bh PMDOUT2H(1) Parallel Port Out Data High Byte (Buffer 2) 0000 0000
F5Ah PMDOUT2L(1) Parallel Port Out Data Low Byte (Buffer 2) 0000 0000
F59h PMDIN2H(1) Parallel Port In Data High Byte (Buffer 2) 0000 0000
F58h PMDIN2L(1) Parallel Port In Data Low Byte (Buffer 2) 0000 0000
F57h PMEH(1) PTEN15 PTEN14 PTEN13 PTEN12 PTEN11 PTEN10 PTEN9 PTEN8 0000 0000
F56h PMEL(1) PTEN7 PTEN6 PTEN5 PTEN4 PTEN3 PTEN2 PTEN1 PTEN0 0000 0000
F55h PMSTATH(1) IBF IBOV — — IB3F IB2F IB1F IB0F 00-- 0000
F54h PMSTATL(1) OBE OBUF — — OB3E OB2E OB1E OB0E 10-- 1111
Legend: x = unknown, u = unchanged, - = unimplemented, q = value depends on condition, r = reserved, do not modify
Note 1: Implemented only for 44-pin devices (PIC18F46J53, PIC18F47J53, PIC18LF46J53 and PIC18LF47J53).
2: Implemented only for 28-pin devices (PIC18F26J53, PIC18F27J53, PIC18LF26J53 and PIC18LF27J53).
3: Implemented only for devices with 128 Kbyte of program memory (PIC18F27J53, PIC18F47J53, PIC18LF27J53 and PIC18LF47J53).
F53h CVRCON CVREN CVROE CVRR CVRSS CVR3 CVR2 CVR1 CVR0 0000 0000
F52h CCPTMRS0 C3TSEL1 C3TSEL0 C2TSEL2 C2TSEL1 C2TSEL0 C1TSEL2 C1TSEL1 C1TSEL0 0000 0000
F51h CCPTMRS1 C7TSEL1 C7TSEL0 — C6TSEL0 — C5TSEL0 C4TSEL1 C4TSEL0 00-0 -000
F50h CCPTMRS2 — — — C10TSEL0(3) — C9TSEL0(3) C8TSEL1 C8TSEL0 ---0 -000
F4Fh DSGPR1 Deep Sleep Persistent General Purpose Register (contents retained even in deep sleep) xxxx xxxx
F4Eh DSGPR0 Deep Sleep Persistent General Purpose Register (contents retained even in deep sleep) xxxx xxxx
F4Dh DSCONH DSEN — — — — r DSULPEN RTCWDIS 0--- -000
F4Ch DSCONL — — — — — ULPWDIS DSBOR RELEASE ---- -000
F4Bh DSWAKEH — — — — — — — DSINT0 ---- ---0
F4Ah DSWAKEL DSFLT — DSULP DSWDT DSRTC DSMCLR — DSPOR 0-00 00-1
F49h ANCON1 VBGEN — — PCFG12 PCFG11 PCFG10 PCFG9 PCFG8 0--0 0000
F48h ANCON0 PCFG7(1) PCFG6(1) PCFG5(1) PCFG4 PCFG3 PCFG2 PCFG1 PCFG0 0000 0000
F47h OEDCON ALRMEN CHIME AMASK3 AMASK2 AMASK1 AMASK0 ALRMPTR1 ALRMPTR0 0000 0000
F46h ALRMRPT ARPT7 ARPT6 ARPT5 ARPT4 ARPT3 ARPT2 ARPT1 ARPT0 0000 0000
F45h ALRMVALH Alarm Value High Register Window based on ALRMPTR<1:0> xxxx xxxx
F44h ALRMVALL Alarm Value Low Register Window based on ALRMPTR<1:0> xxxx xxxx
F43h — — — — — — — — — ---- ----
F42h ODCON1 CCP8OD CCP7OD CCP6OD CCP5OD CCP4OD ECCP3OD ECCP2OD ECCP1OD 0000 0000
F41h ODCON2 — — — — CCP10OD CCP9OD U2OD U1OD ---- 0000
F40h ODCON3 — — — — — — SPI2OD SPI1OD ---- --00
F3Fh RTCCFG RTCEN — RTCWREN RTCSYNC HALFSEC RTCOE RTCPTR1 RTCPTR0 0-00 0000
F3Eh RTCCAL CAL7 CAL6 CAL5 CAL4 CAL3 CAL2 CAL1 CAL0 0000 0000
F3Dh REFOCON ROON — ROSSLP ROSEL RODIV3 RODIV2 RODIV1 RODIV0 0-00 0000
F3Ch PADCFG1 — — — — — RTSECSEL1 RTSECSEL0 PMPTTL(1) ---- -000
F3Bh RTCVALH RTCC Value High Register Window Based on RTCPTR<1:0> 0xxx xxxx
F3Ah RTCVALL RTCC Value Low Register Window Based on RTCPTR<1:0> 0xxx xxxx
F39h UCFG UTEYE UOEMON — UPUEN UTRDIS FSEN PPB1 PPB0 00-0 0000
F38h UADDR — ADDR6 ADDR5 ADDR4 ADDR3 ADDR2 ADDR1 ADDR0 -000 0000
F37h UEIE BTSEE — — BTOEE DFN8EE CRC16EE CRC5EE PIDEE 0--0 0000
F36h UIE — SOFIE STALLIE IDLEIE TRNIE ACTVIE UERRIE URSTIE -000 0000
F35h UEP15 — — — EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL ---0 0000
F34h UEP14 — — — EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL ---0 0000
F33h UEP13 — — — EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL ---0 0000
F32h UEP12 — — — EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL ---0 0000
F31h UEP11 — — — EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL ---0 0000
F30h UEP10 — — — EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL ---0 0000
F2Fh UEP9 — — — EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL ---0 0000
F2Eh UEP8 — — — EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL ---0 0000
F2Dh UEP7 — — — EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL ---0 0000
F2Ch UEP6 — — — EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL ---0 0000
F2Bh UEP5 — — — EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL ---0 0000
F2Ah UEP4 — — — EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL ---0 0000
F29h UEP3 — — — EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL ---0 0000
F28h UEP2 — — — EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL ---0 0000
F27h UEP1 — — — EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL ---0 0000
F26h UEP0 — — — EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL ---0 0000
F25h CM3CON CON COE CPOL EVPOL1 EVPOL0 CREF CCH1 CCH0 0001 1111
F24h TMR5H Timer5 Register High Byte xxxx xxxx
Legend: x = unknown, u = unchanged, - = unimplemented, q = value depends on condition, r = reserved, do not modify
Note 1: Implemented only for 44-pin devices (PIC18F46J53, PIC18F47J53, PIC18LF46J53 and PIC18LF47J53).
2: Implemented only for 28-pin devices (PIC18F26J53, PIC18F27J53, PIC18LF26J53 and PIC18LF27J53).
3: Implemented only for devices with 128 Kbyte of program memory (PIC18F27J53, PIC18F47J53, PIC18LF27J53 and PIC18LF47J53).
EF4h RPINR14 — — — Timer5 Gate Input (T5G) to Input Pin Mapping bits ---1 1111
EF3h RPINR13 — — — Timer3 Gate Input (T3G) to Input Pin Mapping bits ---1 1111
EF2h RPINR12 — — — Timer1 Gate Input (T1G) to Input Pin Mapping bits ---1 1111
EF1h — — — — — — — — —
EF0h — — — — — — — — —
EEFh — — — — — — — — —
EEEh — — — — — — — — —
EEDh — — — — — — — — —
EECh — — — — — — — — —
EEBh — — — — — — — — —
EEAh RPINR9 — — — ECCP3 Input Capture (IC3) to Input Pin Mapping bits ---1 1111
EE9h RPINR8 — — — ECCP2 Input Capture (IC2) to Input Pin Mapping bits ---1 1111
EE8h RPINR7 — — — ECCP1 Input Capture (IC1) to Input Pin Mapping bits ---1 1111
EE7h RPINR15 — — — Timer5 External Clock Input (T5CKI) to Input Pin Mapping bits ---1 1111
EE6h RPINR6 — — — Timer3 External Clock Input (T3CKI) to Input Pin Mapping bits ---1 1111
EE5h — — — — — — — — —
EE4h RPINR4 — — — Timer0 External Clock Input (T0CKI) to Input Pin Mapping bits ---1 1111
EE3h RPINR3 — — — External Interrupt (INT3) to Input Pin Mapping bits ---1 1111
EE2h RPINR2 — — — External Interrupt (INT2) to Input Pin Mapping bits ---1 1111
EE1h RPINR1 — — — External Interrupt (INT1) to Input Pin Mapping bits ---1 1111
EE0h — — — — — — — — —
EDFh — — — — — — — — —
EDEh — — — — — — — — —
EDDh — — — — — — — — —
EDCh — — — — — — — — —
EDBh — — — — — — — — —
EDAh — — — — — — — — —
ED9h — — — — — — — — —
ED8h(1) RPOR24 — — — Remappable Pin RP24 Output Signal Select bits ---0 0000
ED7h(1) RPOR23 — — — Remappable Pin RP23 Output Signal Select bits ---0 0000
ED6h(1) RPOR22 — — — Remappable Pin RP22 Output Signal Select bits ---0 0000
ED5h(1) RPOR21 — — — Remappable Pin RP21 Output Signal Select bits ---0 0000
ED4h(1) RPOR20 — — — Remappable Pin RP20 Output Signal Select bits ---0 0000
ED3h(1) RPOR19 — — — Remappable Pin RP19 Output Signal Select bits ---0 0000
ED2h RPOR18 — — — Remappable Pin RP18 Output Signal Select bits ---0 0000
ED1h RPOR17 — — — Remappable Pin RP17 Output Signal Select bits ---0 0000
ED0h) — — — — — — — — — ---0 0000
ECFh — — — — — — — — — ---0 0000
ECEh — — — — — — — — — ---0 0000
ECDh RPOR13 — — — Remappable Pin RP13 Output Signal Select bits ---0 0000
ECCh RPOR12 — — — Remappable Pin RP12 Output Signal Select bits ---0 0000
ECBh RPOR11 — — — Remappable Pin RP11 Output Signal Select bits ---0 0000
ECAh RPOR10 — — — Remappable Pin RP10 Output Signal Select bits ---0 0000
EC9h RPOR9 — — — Remappable Pin RP9 Output Signal Select bits ---0 0000
EC8h RPOR8 — — — Remappable Pin RP8 Output Signal Select bits ---0 0000
EC7h RPOR7 — — — Remappable Pin RP7 Output Signal Select bits ---0 0000
EC6h RPOR6 — — — Remappable Pin RP6 Output Signal Select bits ---0 0000
EC5h RPOR5 — — — Remappable Pin RP5 Output Signal Select bits ---0 0000
Legend: x = unknown, u = unchanged, - = unimplemented, q = value depends on condition, r = reserved, do not modify
Note 1: Implemented only for 44-pin devices (PIC18F46J53, PIC18F47J53, PIC18LF46J53 and PIC18LF47J53).
2: Implemented only for 28-pin devices (PIC18F26J53, PIC18F27J53, PIC18LF26J53 and PIC18LF27J53).
3: Implemented only for devices with 128 Kbyte of program memory (PIC18F27J53, PIC18F47J53, PIC18LF27J53 and PIC18LF47J53).
EC4h RPOR4 — — — Remappable Pin RP4 Output Signal Select bits ---0 0000
EC3h RPOR3 — — — Remappable Pin RP3 Output Signal Select bits ---0 0000
EC2h RPOR2 — — — Remappable Pin RP2 Output Signal Select bits ---0 0000
EC1h RPOR1 — — — Remappable Pin RP1 Output Signal Select bits ---0 0000
EC0h RPOR0 — — — Remappable Pin RP0 Output Signal Select bits ---0 0000
EBFh PPSCON — — — — — — — IOLOCK ---- ---0
EBEh — — — — — — — — —
EBDh — — — — — — — — —
EBCh PMDIS3 CCP10MD CCP9MD CCP8MD CCP7MD CCP6MD CCP5MD CCP4MD — 0000 000-
EBBh PMDIS2 — TMR8MD — TMR6MD TMR5MD CMP3MD CMP2MD CMP1MD -0-0 0000
EBAh PMDIS1 PSPMD(1) CTMUMD RTCCMD TMR4MD TMR3MD TMR2MD TMR1MD — 0000 000-
EB9h PMDIS0 CCP3MD CCP2MD CCP1MD UART2MD UART1MD SPI2MD SPI1MD ADCMD 0000 0000
EB8h ADCTRIG — — — — — — TRIGSEL1 TRIGSEL0 ---- --00
EB7h — — — — — — — — —
EB6h — — — — — — — — —
EB5h — — — — — — — — —
EB4h — — — — — — — — —
EB3h — — — — — — — — —
EB2h — — — — — — — — —
EB1h — — — — — — — — —
EB0h — — — — — — — — —
300000h CONFIG1L DEBUG XINST STVREN CFGPLLEN PLLDIV2 PLLDIV1 PLLDIV0 WDTEN 1111 1111
300001h CONFIG1H — — — — — CP0 CPDIV1 CPDIV0 ---- -111
300002h CONFIG2L IESO FCMEN CLKOEC SOSCSEL1 SOSCSEL0 FOSC2 FOSC1 FOSC0 1111 1111
300003h CONFIG2H — — — — WDTPS3 WDTPS2 WDTPS1 WDTPS0 ---- 1111
300004h CONFIG3L DSWDTPS3 DSWDTPS2 DSWDTPS1 DSWDTPS0 DSWDTEN DSBOREN RTCOSC DSWDTOSC 1111 1111
300005h CONFIG3H — — — — MSSPMSK — ADCSEL IOL1WAY ---- 1-11
300006h CONFIG4L WPCFG WPFP6 WPFP5 WPFP4 WPFP3 WPFP2 WPFP1 WPFP0 1111 1111
300007h CONFIG4H — — — — LS48MHZ — WPEND WPDIS ---- 1-11
Legend: x = unknown, u = unchanged, - = unimplemented, q = value depends on condition, r = reserved, do not modify
Note 1: Implemented only for 44-pin devices (PIC18F46J53, PIC18F47J53, PIC18LF46J53 and PIC18LF47J53).
2: Implemented only for 28-pin devices (PIC18F26J53, PIC18F27J53, PIC18LF26J53 and PIC18LF27J53).
3: Implemented only for devices with 128 Kbyte of program memory (PIC18F27J53, PIC18F47J53, PIC18LF27J53 and PIC18LF47J53).
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: For Digit Borrow, the polarity is reversed. A subtraction is executed by adding the 2’s complement of the
second operand. For rotate (RRF, RLF) instructions, this bit is loaded with either bit 4 or bit 3 of the source
register.
2: For Borrow, the polarity is reversed. A subtraction is executed by adding the 2’s complement of the sec-
ond operand. For rotate (RRF, RLF) instructions, this bit is loaded with either the high or low-order bit of
the source register.
000h
Using an instruction with one of the ADDWF, INDF1, 1 Bank 0
Indirect Addressing registers as the 100h
operand.... Bank 1
200h
Bank 2
300h
...uses the 12-bit address stored in FSR1H:FSR1L
the FSR pair associated with that
7 0 7 0
register.... Bank 3
x x x x 1 1 1 1 1 1 0 0 1 1 0 0 through
Bank 13
000h
When a = 0 and f 60h:
The instruction executes in 060h
Direct Forced mode. ‘f’ is Bank 0
interpreted as a location in the 100h
Access RAM between 060h 00h
Bank 1
and FFFh. This is the same as through 60h
locations, F60h to FFFh Bank 14
Valid range
(Bank 15), of data memory. for ‘f’
Locations below 060h are not FFh
F00h Access RAM
available in this addressing
Bank 15
mode.
F60h
SFRs
FFFh
Data Memory
BSR
When a = 1 (all values of f): 000h 00000000
Bank 0
The instruction executes in
060h
Direct mode (also known as
Direct Long mode). ‘f’ is 100h
interpreted as a location in
one of the 16 banks of the data Bank 1 001001da ffffffff
memory space. The bank is through
Bank 14
designated by the Bank Select
Register (BSR). The address
can be in any implemented F00h
bank in the data memory Bank 15
space. F60h
SFRs
FFFh
Data Memory
FIGURE 6-10: REMAPPING THE ACCESS BANK WITH INDEXED LITERAL OFFSET ADDRESSING
Example Situation:
ADDWF f, d, a 000h
Not Accessible
FSR2H:FSR2L = 120h 05Fh
Instruction: TBLRD*
Program Memory
Table Pointer(1)
Table Latch (8-bit)
TBLPTRU TBLPTRH TBLPTRL
TABLAT
Program Memory
(TBLPTR)
Instruction: TBLWT*
Program Memory
Holding Registers
Table Pointer(1) Table Latch (8-bit)
Program Memory
(TBLPTR)
Note 1: The Table Pointer actually points to one of 64 holding registers, the address of which is determined by
TBLPTRL<5:0>. The process for physically writing data to the program memory array is discussed in
Section 7.5 “Writing to Flash Program Memory”.
7.2 Control Registers The FREE bit, when set, will allow a program memory
erase operation. When FREE is set, the erase
Several control registers are used in conjunction with operation is initiated on the next WR command. When
the TBLRD and TBLWT instructions. Those are: FREE is clear, only writes are enabled.
• EECON1 register The WREN bit, when set, will allow a write operation.
• EECON2 register On power-up, the WREN bit is clear. The WRERR bit is
• TABLAT register set in hardware when the WR bit is set, and cleared
• TBLPTR registers when the internal programming timer expires and the
write operation is complete.
7.2.1 EECON1 AND EECON2 REGISTERS Note: During normal operation, the WRERR is
The EECON1 register (Register 7-1) is the control read as ‘1’. This can indicate that a write
register for memory accesses. The EECON2 register is operation was prematurely terminated by
not a physical register; it is used exclusively in the a Reset or a write operation was
memory write and erase sequences. Reading attempted improperly.
EECON2 will read all ‘0’s.
The WR control bit initiates write operations. The bit
The WPROG bit, when set, will allow programming cannot be cleared, only set, in software. It is cleared in
two bytes per word on the execution of the WR hardware at the completion of the write operation.
command. If this bit is cleared, the WR command will
result in programming on a block of 64 bytes.
TABLE 7-1: TABLE POINTER OPERATIONS WITH TBLRD AND TBLWT INSTRUCTIONS
Example Operation on Table Pointer
TBLRD*
TBLPTR is not modified
TBLWT*
TBLRD*+
TBLPTR is incremented after the read/write
TBLWT*+
TBLRD*-
TBLPTR is decremented after the read/write
TBLWT*-
TBLRD+*
TBLPTR is incremented before the read/write
TBLWT+*
ERASE: TBLPTR<20:10>
Program Memory
TABLAT
Write Register
8 8 8 8
Program Memory
PROGRAM_MEMORY
BSF EECON1, WPROG ; enable single word write
BSF EECON1, WREN ; enable write to memory
BCF INTCON, GIE ; disable interrupts
MOVLW 55h
Required MOVWF EECON2 ; write 55h
Sequence MOVLW 0AAh
MOVWF EECON2 ; write AAh
BSF EECON1, WR ; start program (CPU stall)
BSF INTCON, GIE ; re-enable interrupts
BCF EECON1, WPROG ; disable single word write
BCF EECON1, WREN ; disable write to memory
8.2 Operation
Example 8-1 provides the instruction sequence for an
8 x 8 unsigned multiplication. Only one instruction is
required when one of the arguments is already loaded
in the WREG register.
Example 8-2 provides the instruction sequence for an
8 x 8 signed multiplication. To account for the sign bits
of the arguments, each argument’s Most Significant bit
(MSb) is tested and the appropriate subtractions are
done.
CONT_CODE
:
TMR0IF Wake-up if in
TMR0IE Idle or Sleep modes
TMR0IP
RBIF
RBIE
RBIP
INT0IF
INT0IE
INT1IF
INT1IE Interrupt to CPU
INT1IP Vector to Location
INT2IF
INT2IE 0008h
PIR1<7:0>
PIE1<7:0> INT2IP
IPR1<7:0> INT3IF
INT3IE
INT3IP
PIR2<7:0> GIE/GIEH
PIE2<7:0>
IPR2<7:0> IPEN
PIR3<7:0> IPEN
PIE3<7:0>
IPR3<7:0> PEIE/GIEL
IPEN
PIR1<7:0>
PIE1<7:0>
IPR1<7:0>
PIR2<7:0>
PIE2<7:0>
IPR2<7:0> Interrupt to CPU
TMR0IF Vector to Location
TMR0IE IPEN
PIR3<7:0> 0018h
PIE3<7:0> TMR0IP
IPR3<7:0>
RBIF
RBIE
RBIP GIE/GIEH
PEIE/GIEL
INT1IF
INT1IE
INT1IP
INT2IF
INT2IE
INT2IP
INT3IF
INT3IE
INT3IP
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: A mismatch condition will continue to set this bit. Reading PORTB and waiting 1 TCY will end the mismatch
condition and allow the bit to be cleared.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note: Interrupt flag bits are set when an interrupt condition occurs, regardless of the state of its corresponding
enable bit or the global interrupt enable bit. User software should ensure the appropriate interrupt flag bits
are clear prior to enabling an interrupt. This feature allows for software polling.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note: Interrupt flag bits are set when an interrupt condition occurs, regardless of the state of its corresponding
enable bit or the global interrupt enable bit. User software should ensure the appropriate interrupt flag bits
are clear prior to enabling an interrupt. This feature allows for software polling.
REGISTER 9-4: PIR1: PERIPHERAL INTERRUPT REQUEST (FLAG) REGISTER 1 (ACCESS F9Eh)
R/W-0 R/W-0 R-0 R-0 R/W-0 R/W-0 R/W-0 R/W-0
PMPIF(1) ADIF RC1IF TX1IF SSP1IF CCP1IF TMR2IF TMR1IF
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
RD LAT
10.1.2 INPUT PINS AND VOLTAGE
Data
Bus CONSIDERATIONS
D Q
WR LAT I/O pin(1)
The voltage tolerance of pins used as device inputs is
or PORT
CK
dependent on the pin’s input function. Pins that are used
as digital only inputs are able to handle DC voltages up
Data Latch
to 5.5V; a level typical for digital logic circuits. In contrast,
D Q pins that also have analog input functions of any kind
can only tolerate voltages up to VDD. Voltage excur-
WR TRIS
CK sions beyond VDD on these pins should be avoided.
TRIS Latch
Table 10-2 summarizes the input capabilities. Refer to
Input
Buffer Section 31.0 “Electrical Characteristics” for more
details.
RD TRIS
3.3V +5V
PIC18F47J53
RD7
VDD TXX 5V
(at logic ‘1’)
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: To enable the actual RTCC output, the RTCOE (RTCCFG<2>) bit needs to be set.
10.2 PORTA, TRISA and LATA Registers All PORTA pins have TTL input levels and full CMOS
output drivers.
PORTA is a 7-bit wide, bidirectional port. It may
function as a 5-bit port, depending on the oscillator The TRISA register controls the direction of the PORTA
mode selected. Setting a TRISA bit (= 1) will make the pins, even when they are being used as analog inputs.
corresponding PORTA pin an input (i.e., put the The user must ensure the bits in the TRISA register are
corresponding output driver in a High-impedance maintained set when using them as analog inputs.
mode). Clearing a TRISA bit (= 0) will make the
corresponding PORTA pin an output (i.e., put the EXAMPLE 10-2: INITIALIZING PORTA
contents of the output latch on the selected pin). CLRF PORTA ; Initialize PORTA by
; clearing output
Reading the PORTA register reads the status of the ; data latches
pins, whereas writing to it, will write to the port latch. CLRF LATA ; Alternate method
The Data Latch (LATA) register is also memory mapped. ; to clear output
Read-modify-write operations on the LATA register read ; data latches
and write the latched output value for PORTA. MOVLW 07h ; Configure A/D
MOVWF ADCON0 ; for digital inputs
The other PORTA pins are multiplexed with analog MOVWF 07h ; Configure comparators
inputs, the analog VREF+ and VREF- inputs and the com- MOVWF CMCON ; for digital input
parator voltage reference output. The operation of pins, MOVLW 0CFh ; Value used to
RA<3:0> and RA5, as A/D Converter inputs is selected ; initialize data
by clearing or setting the control bits in the ADCON0 ; direction
register (A/D Port Configuration Register 0). MOVWF TRISA ; Set RA<3:0> as inputs
; RA<5:4> as outputs
Pins, RA0, RA2, and RA3, may also be used as com-
parator inputs and by setting the appropriate bits in the
CMCON register. To use RA<3:0> as digital inputs, it is
also necessary to turn off the comparators.
Note: On a Power-on Reset (POR), RA5 and
RA<3:0> are configured as analog inputs
and read as ‘0’.
RA5/AN4/C1INC/ RA5 0 O DIG LATA<5> data output; not affected by analog input.
SS1/HLVDIN/ 1 I TTL PORTA<5> data input; disabled when analog input is enabled.
RCV/RP2
AN4 1 I ANA A/D Input Channel 4. Default configuration on POR.
C1INC 0 O DIG Comparator 1 Input C.
SS1 1 I TTL Slave select input for MSSP1.
HLVDIN 1 I ANA High/Low-Voltage Detect external trip point reference input.
RCV 1 I TTL External USB transceiver RCV input.
RP2 1 I ST Remappable Peripheral Pin 2 input.
0 O DIG Remappable Peripheral Pin 2 output.
OSC2/CLKO/ OSC2 x O ANA Main oscillator feedback output connection (HS mode).
RA6 CLKO x O DIG System cycle clock output (FOSC/4) in RC and EC Oscillator
modes.
RA6 1 I TTL PORTA<6> data input.
0 O DIG LATA<6> data output.
OSC1/CLKI/RA7 OSC1 1 I ANA Main oscillator input connection.
CLKI 1 I ANA Main clock input connection.
RA7 1 I TTL PORTA<6> data input.
0 O DIG LATA<6> data output.
Legend: DIG = Digital level output; TTL = TTL input buffer; ST = Schmitt Trigger input buffer; ANA = Analog level
input/output; x = Don’t care (TRIS bit does not affect port direction or is overridden for this option)
Note 1: This bit is only available on 44-pin devices (PIC18F46J53, PIC18F47J53, PIC18LF46J53 and
PIC18LF47J53).
REGISTER 10-5: PPSCON: PERIPHERAL PIN SELECT INPUT REGISTER 0 (BANKED PPSCON)(1)
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
REGISTER 10-6: RPINR1: PERIPHERAL PIN SELECT INPUT REGISTER 1 (BANKED EE1h)
REGISTER 10-7: RPINR2: PERIPHERAL PIN SELECT INPUT REGISTER 2 (BANKED EE2h)
REGISTER 10-9: RPINR4: PERIPHERAL PIN SELECT INPUT REGISTER 4 (BANKED EE4h)
REGISTER 10-10: RPINR6: PERIPHERAL PIN SELECT INPUT REGISTER 6 (BANKED EE6h)
REGISTER 10-12: RPINR8: PERIPHERAL PIN SELECT INPUT REGISTER 8 (BANKED EE9h)
REGISTER 10-13: RPINR9: PERIPHERAL PIN SELECT INPUT REGISTER 9 (BANKED EEAh)
REGISTER 10-15: RPINR13: PERIPHERAL PIN SELECT INPUT REGISTER 13 (BANKED EF3h)
REGISTER 10-16: RPINR14: PERIPHERAL PIN SELECT INPUT REGISTER 14 (BANKED EF4h)
REGISTER 10-18: RPINR15: PERIPHERAL PIN SELECT INPUT REGISTER 15 (BANKED EE7h)
REGISTER 10-19: RPINR17: PERIPHERAL PIN SELECT INPUT REGISTER 17 (BANKED EF8h)
REGISTER 10-20: RPINR21: PERIPHERAL PIN SELECT INPUT REGISTER 21 (BANKED EFCh)
REGISTER 10-22: RPINR23: PERIPHERAL PIN SELECT INPUT REGISTER 23 (BANKED EFEh)
REGISTER 10-23: RPINR24: PERIPHERAL PIN SELECT INPUT REGISTER 24 (BANKED EFFh)
REGISTER 10-25: RPOR1: PERIPHERAL PIN SELECT OUTPUT REGISTER 1 (BANKED EC7h)
REGISTER 10-26: RPOR2: PERIPHERAL PIN SELECT OUTPUT REGISTER 2 (BANKED EC3h)
REGISTER 10-28: RPOR4: PERIPHERAL PIN SELECT OUTPUT REGISTER 4 (BANKED EC4h)
REGISTER 10-29: RPOR5: PERIPHERAL PIN SELECT OUTPUT REGISTER 5 (BANKED EC5h)
REGISTER 10-31: RPOR7: PERIPHERAL PIN SELECT OUTPUT REGISTER 7 (BANKED EC7h)
REGISTER 10-32: RPOR8: PERIPHERAL PIN SELECT OUTPUT REGISTER 8 (BANKED EC8h)
REGISTER 10-34: RPOR10: PERIPHERAL PIN SELECT OUTPUT REGISTER 10 (BANKED ECAh)
REGISTER 10-35: RPOR11: PERIPHERAL PIN SELECT OUTPUT REGISTER 11 (BANKED ECBh)
REGISTER 10-37: RPOR13: PERIPHERAL PIN SELECT OUTPUT REGISTER 13 (BANKED ECDh)
REGISTER 10-38: RPOR17: PERIPHERAL PIN SELECT OUTPUT REGISTER 17 (BANKED ED1h)
REGISTER 10-40: RPOR19: PERIPHERAL PIN SELECT OUTPUT REGISTER 19 (BANKED ED3h)(1)
REGISTER 10-41: RPOR20: PERIPHERAL PIN SELECT OUTPUT REGISTER 20 (BANKED ED4h)(1)
REGISTER 10-43: RPOR22: PERIPHERAL PIN SELECT OUTPUT REGISTER 22 (BANKED ED6h)(1)
REGISTER 10-44: RPOR23: PERIPHERAL PIN SELECT OUTPUT REGISTER 23 (BANKED ED7h)(1)
Up to 8-Bit Address
PMA<7:2> EEPROM
PMCSx
PMBE
PMRD FIFO
Microcontroller LCD
PMRD/PMWR Buffer
PMWR
PMENB
PMD<7:0>
PMA<7:0>
PMA<15:8>
8-Bit Data
REGISTER 11-1: PMCONH: PARALLEL PORT CONTROL REGISTER HIGH BYTE (BANKED F5Fh)(1)
R/W-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
PMPEN — PSIDL ADRMUX1 ADRMUX0 PTBEEN PTWREN PTRDEN
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 7-6 WAITB<1:0>: Data Setup to Read/Write Wait State Configuration bits(2)
11 = Data Wait of 4 TCY; multiplexed address phase of 4 TCY
10 = Data Wait of 3 TCY; multiplexed address phase of 3 TCY
01 = Data Wait of 2 TCY; multiplexed address phase of 2 TCY
00 = Data Wait of 1 TCY; multiplexed address phase of 1 TCY
bit 5-2 WAITM<3:0>: Read to Byte Enable Strobe Wait State Configuration bits
1111 = Wait of additional 15 TCY
.
.
.
0001 = Wait of additional 1 TCY
0000 = No additional Wait cycles (operation forced into one TCY)
bit 1-0 WAITE<1:0>: Data Hold After Strobe Wait State Configuration bits(2)
11 = Wait of 4 TCY
10 = Wait of 3 TCY
01 = Wait of 2 TCY
00 = Wait of 1 TCY
REGISTER 11-5: PMEH: PARALLEL PORT ENABLE REGISTER HIGH BYTE (BANKED F57h)(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
PTEN15 PTEN14 PTEN13 PTEN12 PTEN11 PTEN10 PTEN9 PTEN8
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
REGISTER 11-6: PMEL: PARALLEL PORT ENABLE REGISTER LOW BYTE (BANKED F56h)(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
PTEN7 PTEN6 PTEN5 PTEN4 PTEN3 PTEN2 PTEN1 PTEN0
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
REGISTER 11-7: PMSTATH: PARALLEL PORT STATUS REGISTER HIGH BYTE (BANKED F55h)(1)
R-0 R/W-0 U-0 U-0 R-0 R-0 R-0 R-0
IBF IBOV — — IB3F IB2F IB1F IB0F
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
REGISTER 11-8: PMSTATL: PARALLEL PORT STATUS REGISTER LOW BYTE (BANKED F54h)(1)
R-1 R/W-0 U-0 U-0 R-1 R-1 R-1 R-1
OBE OBUF — — OB3E OB2E OB1E OB0E
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ r = Reserved
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: In Enhanced Slave mode, PMADDRH functions as PMDOUT1H, one of the Output Data Buffer registers.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ r = Reserved
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: In Enhanced Slave mode, PMADDRL functions as PMDOUT1L, one of the Output Data Buffer registers.
Address Bus
Master PIC18 Slave
Data Bus
PMD<7:0> PMD<7:0> Control Lines
PMCS1 PMCS1
PMRD PMRD
PMWR PMWR
PMCSx
PMWR
PMRD
PMD<7:0>
IBF
OBE
PMPIF
| Q4 | Q1 | Q2 | Q3 | Q4
PMCS1
PMWR
PMRD
PMD<7:0>
IBF
OBE
PMPIF
Data Bus
Control Lines
11.2.5.1 READ FROM SLAVE PORT output registers and their associated address. When an
output buffer is read, the corresponding OBxE bit is set.
When chip select is active and a read strobe occurs
The OBxE flag bit is set when all the buffers are empty.
(PMCSx = 1 and PMRD = 1), the data from one of the
If any buffer is already empty, OBxE = 1, the next read
four output bytes is presented onto PMD<7:0>. Which
to that buffer will generate an OBUF event.
byte is read depends on the 2-bit address placed on
ADDR<1:0>. Table 11-1 provides the corresponding
PMCSx
PMWR
PMRD
PMD<7:0>
PMA<1:0>
OBE
PMPIF
| Q4 | Q1 | Q2 | Q3 | Q4
PMCSx
PMWR
PMRD
PMD<7:0>
PMA<1:0>
IBF
PMPIF
PIC18F
PMA<7:0>
PMD<7:0>
PMCSx
PIC18F
PMD<7:0>
PMA<7:0>
PMCSx
PMALL
Address Bus
PMRD Multiplexed
Data and
Address Bus
PMWR
Control Lines
PIC18F PMD<7:0>
PMA<13:8>
PMCSx
PMALL
PMALH
Multiplexed
PMRD Data and
Address Bus
PMWR Control Lines
FIGURE 11-12: READ AND WRITE TIMING, 8-BIT DATA, DEMULTIPLEXED ADDRESS
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
PMCS1
PMD<7:0>
PMA<7:0>
PMWR
PMRD
PMPIF
BUSY
PMCS1
PMWR
PMRD
PMALL
PMPIF
BUSY
PMCS1
PMD<7:0> Address<7:0> Data
PMRD
PMWR
PMALL
PMPIF
BUSY
WAITB<1:0> = 01 WAITE<1:0> = 00
WAITM<3:0> = 0010
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
PMCS1
PMWR
PMRD
PMALL
PMPIF
BUSY
PMCS1
PMD<7:0> Address<7:0> Data
PMWR
PMRD
PMALL
PMPIF
BUSY
WAITB<1:0> = 01 WAITE<1:0> = 00
WAITM<3:0> = 0010
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
PMCS1
PMRD/PMWR
PMENB
PMALL
PMPIF
BUSY
PMCS1
PMRD/PMWR
PMENB
PMALL
PMPIF
BUSY
FIGURE 11-19: READ TIMING, 8-BIT DATA, FULLY MULTIPLEXED 16-BIT ADDRESS
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
PMCS1
PMWR
PMRD
PMALL
PMALH
PMPIF
BUSY
FIGURE 11-20: WRITE TIMING, 8-BIT DATA, FULLY MULTIPLEXED 16-BIT ADDRESS
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
PMCS1
PMD<7:0> Address<7:0> Address<13:8> Data
PMWR
PMRD
PMALL
PMALH
PMPIF
BUSY
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
PMCS1
PMD<7:0> LSB MSB
PMA<7:0>
PMWR
PMRD
PMBE
PMPIF
BUSY
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
PMCS1
PMD<7:0> LSB MSB
PMA<7:0>
PMWR
PMRD
PMBE
PMPIF
BUSY
FIGURE 11-23: READ TIMING, 16-BIT MULTIPLEXED DATA, PARTIALLY MULTIPLEXED ADDRESS
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
PMCS1
PMD<7:0> Address<7:0> LSB MSB
PMWR
PMRD
PMBE
PMALL
PMPIF
BUSY
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
PMCS1
PMD<7:0> Address<7:0> LSB MSB
PMWR
PMRD
PMBE
PMALL
PMPIF
BUSY
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
PMCS1
PMD<7:0> Address<7:0> Address<13:8> LSB MSB
PMWR
PMRD
PMBE
PMALH
PMALL
PMPIF
BUSY
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
PMCS1
PMD<7:0> Address<7:0> Address<13:8> LSB MSB
PMWR
PMRD
PMBE
PMALH
PMALL
PMPIF
BUSY
11.4.2 PARTIALLY MULTIPLEXED an external latch. If the peripheral has internal latches,
MEMORY OR PERIPHERAL as displayed in Figure 11-29, then no extra circuitry is
required except for the peripheral itself.
Partial multiplexing implies using more pins; however,
for a few extra pins, some extra performance can be
achieved. Figure 11-28 provides an example of a
memory or peripheral that is partially multiplexed with
FIGURE 11-30: PARALLEL EEPROM EXAMPLE (UP TO 15-BIT ADDRESS, 8-BIT DATA)
PMD<7:0> D<7:0>
PMCSx CE
Address Bus
PMRD OE
Data Bus
PMWR WR
Control Lines
FIGURE 11-31: PARALLEL EEPROM EXAMPLE (UP TO 15-BIT ADDRESS, 16-BIT DATA)
PMD<7:0> D<7:0>
PMBE A0
PMCSx CE
Address Bus
PMRD OE
Data Bus
PMWR WR
Control Lines
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
FOSC/4 0
1
Sync with Set
1 Internal TMR0L TMR0IF
T0CKI pin Programmable 0 Clocks on Overflow
Prescaler
T0SE (2 TCY Delay)
T0CS 8
3
T0PS<2:0>
8
PSA Internal Data Bus
Note: Upon Reset, Timer0 is enabled in 8-bit mode with clock input from T0CKI max. prescale.
FOSC/4 0
1
Sync with Set
1 Internal TMR0
TMR0L High Byte TMR0IF
T0CKI pin Programmable 0 Clocks on Overflow
Prescaler 8
T0SE (2 TCY Delay)
T0CS 3 Read TMR0L
T0PS<2:0>
Write TMR0L
PSA
8
8
TMR0H
8
8
Internal Data Bus
Note: Upon Reset, Timer0 is enabled in 8-bit mode with clock input from T0CKI max. prescale.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: The FOSC clock source should not be selected if the timer will be used with the ECCP capture/compare features.
2: The Timer1 oscillator crystal driver is powered whenever T1OSCEN (T1CON<3>) or T3OSCEN
(T3CON<3>) = 1. The circuit is enabled by the logical OR of these two bits. When disabled, the inverter and
feedback resistor are disabled to eliminate power drain. The TMR1ON and TMR3ON bits do not have to be
enabled to power up the crystal driver.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
T1GSS<1:0>
T1G 00 T1GSPM
From Timer2 01
Match PR2 T1G_IN 0
T1GVAL Data Bus
Comparator 1 0 D Q
10
Output Single Pulse RD
Comparator 2 1 T1GCON
11 Acq. Control Q1 EN
Output D Q 1
Interrupt Set
CK Q T1GGO/T1DONE
TMR1ON det TMR1GIF
R
T1GPOL T1GTM
TMR1GE
Set Flag bit TMR1ON
TMR1IF on
Overflow TMR1(2)
EN Synchronized
0 Clock Input
TMR1H TMR1L T1CLK
Q D
1
TMR1CS<1:0>
T1SYNC
T1OSO/T1CKI OUT
TMR1GE
T1GPOL
T1G_IN
T1CKI
T1GVAL
TMR1GE
T1GPOL
T1GTM
T1G_IN
T1CKI
T1GVAL
TMR1GE
T1GPOL
T1GSPM
Cleared by Hardware on
T1GGO/ Set by Software Falling Edge of T1GVAL
T1DONE
Counting Enabled on
Rising Edge of T1G
T1G_IN
T1CKI
T1GVAL
Cleared by
TMR1GIF Cleared by Software Set by Hardware on Software
Falling Edge of T1GVAL
TMR1GE
T1GPOL
T1GSPM
T1GTM
Cleared by Hardware on
T1GGO/ Set by Software Falling Edge of T1GVAL
T1DONE Counting Enabled on
Rising Edge of T1G
T1G_IN
T1CKI
T1GVAL
The module is controlled through the T2CON register The TMR2 and PR2 registers are both directly readable
(Register 14-1) which enables or disables the timer and and writable. The TMR2 register is cleared on any
configures the prescaler and postscaler. Timer2 can be device Reset, while the PR2 register initializes at FFh.
shut off by clearing control bit, TMR2ON (T2CON<2>), Both the prescaler and postscaler counters are cleared
to minimize power consumption. on the following events:
A simplified block diagram of the module is shown in • a write to the TMR2 register
Figure 14-1. • a write to the T2CON register
• any device Reset (Power-on Reset (POR), MCLR
Reset, Watchdog Timer Reset (WDTR) or
Brown-out Reset (BOR))
TMR2 is not cleared when T2CON is written.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
4 1:1 to 1:16
T2OUTPS<3:0> Set TMR2IF
Postscaler
2
T2CKPS<1:0> TMR2 Output
(to PWM or MSSPx)
TMR2/PR2
Reset Match
1:1, 1:4, 1:16
FOSC/4 TMR2 Comparator PR2
Prescaler
8 8
8
Internal Data Bus
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: The FOSC clock source should not be selected if the timer will be used with the ECCP capture/compare
features.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: Reset value is ‘0’ when Two-Speed Start-up is enabled and ‘1’ if disabled.
2: Default output frequency of INTOSC on Reset (4 MHz).
3: When the SOSC is selected to run from a digital clock input, rather than an external crystal, this bit has no
effect.
TxGSS<1:0>
TxG 00 TxGSPM
TMRxCS<1:0> TxSYNC
T1OSO/T1CKI OUT
T1OSC/SOSC
Prescaler Synchronize(3)
1 1, 2, 4, 8 det
T1OSI 10
EN
SOSCGO 2
0
T1OSCEN FOSC TxCKPS<1:0>
T3OSCEN Internal 01
T5OSCEN Clock
TXOSCEN FOSC/2
Internal Sleep Input
FOSC/4 Clock
Internal 00
(1) Clock
TxCKI
TMRxGE
TxGPOL
TxG_IN
TxCKI
TxGVAL
TMRxGE
TxGPOL
TxGTM
TxG_IN
TxCKI
TxGVAL
TMRxGE
TxGPOL
TxGSPM
Cleared by Hardware on
TxGGO/ Set by Software Falling Edge of TxGVAL
TxDONE
Counting Enabled on
Rising Edge of TxG
TxG_IN
TxCKI
TxGVAL
Cleared by
TMRxGIF Cleared by Software Set by Hardware on Software
Falling Edge of TxGVAL
TMRxGE
TxGPOL
TxGSPM
TxGTM
Cleared by Hardware on
TxGGO/ Set by Software Falling Edge of TxGVAL
TxDONE
Counting Enabled on
Rising Edge of TxG
TxG_IN
TxCKI
TxGVAL
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
4
1:1 to 1:16
TxOUTPS<3:0> Set TMRxIF
Postscaler
2
TxCKPS<1:0> TMRx Output
(to PWM)
TMRx/PRx
Reset Match
1:1, 1:4, 1:16
FOSC/4 TMRx Comparator PRx
Prescaler
8 8
8
Internal Data Bus
ALMTHDY
Compare Registers
ALRMVAL ALWDHR
with Masks
ALMINSEC
Repeat Counter
RTCC Interrupt
RTCC Interrupt Logic
Alarm Pulse
RTCC Pin
RTCOE
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: To enable the actual RTCC output, the RTCOE (RTCCFG<2>) bit must be set.
2: Available only on 44-pin devices (PIC18F46J53, PIC18F47J53, PIC18LF46J53 and PIC18LF47J53). For
28-pin devices, the bit is U-0.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 7-4 YRTEN<3:0>: Binary Coded Decimal Value of Year’s Tens Digit bits
Contains a value from 0 to 9.
bit 3-0 YRONE<3:0>: Binary Coded Decimal Value of Year’s Ones Digit bits
Contains a value from 0 to 9.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Hours
(24-hour format) Minutes Seconds
CONFIG 3L<1>
Day
Second Hour:Minute Month Year
Day of Week
Note 1: Writing to the lower half of the MINSEC register resets all counters, allowing fraction of a second synchronization.
The clock prescaler is held in Reset when RTCEN = 0.
17.2.2.1 Real-Time Clock Enable For the day to month rollover schedule, see Table 17-2.
The RTCC module can be clocked by an external, Considering that the following values are in BCD
32.768 kHz crystal (Timer1 oscillator or T1CKI input) or format, the carry to the upper BCD digit will occur at a
the INTRC oscillator, which can be selected in count of 10 and not at 16 (SECONDS, MINUTES,
CONFIG3L<1>. HOURS, WEEKDAY, DAYS and MONTHS).
If the Timer1 oscillator will be used as the clock source
for the RTCC, make sure to enable it by setting TABLE 17-1: DAY OF WEEK SCHEDULE
T1CON<3> (T1OSCEN). The selected RTC clock can Day of Week
be brought out to the RTCC pin by the
RTSECSEL<1:0> bits in the PADCFG register. Sunday 0
Monday 1
17.2.3 DIGIT CARRY RULES Tuesday 2
This section explains which timer values are affected Wednesday 3
when there is a rollover.
Thursday 4
• Time of Day: From 23:59:59 to 00:00:00 with a
Friday 5
carry to the Day field
Saturday 6
• Month: From 12/31 to 01/01 with a carry to the
Year field
• Day of Week: From 6 to 0 with no carry (see
Table 17-1)
• Year Carry: From 99 to 00; this also surpasses the
use of the RTCC
RTCEN bit
ALRMEN bit
RTCC Pin
All
File Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Resets
File Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 All Resets
RTCVALH RTCC Value Register Window High Byte, Based on RTCPTR<1:0> xxxx
RTCVALL RTCC Value Register Window Low Byte, Based on RTCPTR<1:0> xxxx
RTCCFG RTCEN — RTCWREN RTCSYNC HALFSEC RTCOE RTCPTR1 RTCPTR0 0000
ALRMCFG ALRMEN CHIME AMASK3 AMASK2 AMASK1 AMASK0 ALRMPTR1 ALRMPTR0 0000
ALRMVALH Alarm Value Register Window High Byte, Based on ALRMPTR<1:0> xxxx
ALRMVALL Alarm Value Register Window Low Byte, Based on ALRMPTR<1:0> xxxx
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal for 44-pin devices.
All
File Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Resets
ALRMRPT ARPT7 ARPT6 ARPT5 ARPT4 ARPT3 ARPT2 ARPT1 ARPT0 0000
ALRMVALH Alarm Value Register Window High Byte, Based on ALRMPTR<1:0> xxxx
ALRMVALL Alarm Value Register Window Low Byte, Based on ALRMPTR<1:0> xxxx
RTCCAL CAL7 CAL6 CAL5 CAL4 CAL3 CAL2 CAL1 CAL0 0000
RTCVALH RTCC Value Register Window High Byte, Based on RTCPTR<1:0> xxxx
RTCVALL RTCC Value Register Window Low Byte, Based on RTCPTR<1:0> xxxx
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal for 44-pin devices.
REGISTER 18-1: CCPxCON: CCP4-10 CONTROL REGISTER (4, BANKED F12h; 5, F0Fh; 6, F0Ch;
7, F09h; 8, F06h; 9, F03h; 10, F00h)
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 U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
REGISTER 18-5: CCPRxH: CCP4-10 PERIOD HIGH BYTE REGISTER (4, BANKED F14h; 5, F11h; 6,
F0Eh; 7, F0Bh; 8, F08h; 9, F05h; 10, F02h)
R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x R/W-x
CCPRxH7 CCPRxH6 CCPRxH5 CCPRxH4 CCPRxH3 CCPRxH2 CCPRxH1 CCPRxH0
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
CCP8
CCP8 CCP9 CCP10
Devices with 64 Kbyte
TMR5H TMR5L
Set CCP5IF
C5TSEL0 TMR5
CCP5 Pin Enable
Prescaler and CCPR5H CCPR5L
1, 4, 16 Edge Detect
TMR1
C5TSEL0 Enable
4 TMR1H TMR1L
CCP5CON<3:0> Set CCP4IF
4
Q1:Q4
4
CCP4CON<3:0>
C4TSEL1 TMR3H TMR3L
C4TSEL0
TMR3
Enable
CCP4 Pin
Prescaler and CCPR4H CCPR4L
1, 4, 16 Edge Detect
TMR1
Enable
C4TSEL0
TMR1H TMR1L
C4TSEL1
Note: This block diagram uses CCP4 and CCP5 and their appropriate timers as an example. For details on all of
the CCP modules and their timer assignments, see Table 18-2 and Table 18-3.
There are four prescaler settings in Capture mode. 18.3.2 TIMER1/3/5 MODE SELECTION
They are specified as part of the operating mode
selected by the mode select bits (CCP4M<3:0>). If the CCP module is using the compare feature in
Whenever the CCP module is turned off, or the CCP conjunction with any of the Timer1/3/5 timers, the tim-
module is not in Capture mode, the prescaler counter ers must be running in Timer mode or Synchronized
is cleared. This means that any Reset will clear the Counter mode. In Asynchronous Counter mode, the
prescaler counter. compare operation may not work.
Switching from one capture prescaler to another may Note: Details of the timer assignments for the
generate an interrupt. Doing that also will not clear the CCP modules are given in Table 18-2 and
prescaler counter – meaning the first capture may be Table 18-3.
from a non-zero prescaler.
18.3.3 SOFTWARE INTERRUPT MODE
Example 18-1 shows the recommended method for
switching between capture prescalers. This example When the Generate Software Interrupt mode is chosen
also clears the prescaler counter and will not generate (CCP4M<3:0> = 1010), the CCP4 pin is not affected.
the “false” interrupt. Only a CCP interrupt is generated, if enabled, and the
CCP4IE bit is set.
EXAMPLE 18-1: CHANGING BETWEEN
CAPTURE PRESCALERS 18.3.4 SPECIAL EVENT TRIGGER
CLRF CCP4CON ; Turn CCP module off
Both CCP modules are equipped with a Special Event
MOVLW NEW_CAPT_PS ; Load WREG with the Trigger. This is an internal hardware signal generated
; new prescaler mode in Compare mode to trigger actions by other modules.
; value and CCP ON The Special Event Trigger is enabled by selecting
MOVWF CCP4CON ; Load CCP4CON with the Compare Special Event Trigger mode
; this value (CCP4M<3:0> = 1011).
For either CCP module, the Special Event Trigger resets
the Timer register pair for whichever timer resource is
18.3 Compare Mode
currently assigned as the module’s time base. This
In Compare mode, the 16-bit CCPR4 register value is allows the CCPRx registers to serve as a programmable
constantly compared against either the TMR1 or TMR3 period register for either timer.
register pair value. When a match occurs, the CCP4 The Special Event Trigger for CCP4 cannot start an
pin can be: A/D conversion.
• Driven high
Note: The Special Event Trigger of ECCP1 can
• Driven low start an A/D conversion, but the A/D
• Toggled (high-to-low or low-to-high) Converter must be enabled. For more
• Unchanged (that is, reflecting the state of the I/O information, see Section 19.0 “Enhanced
latch) Capture/Compare/PWM (ECCP) Module”.
The action on the pin is based on the value of the mode
select bits (CCP4M<3:0>). At the same time, the inter-
rupt flag bit, CCP4IF, is set.
Figure 18-2 gives the Compare mode block diagram
Compare Output S Q
Comparator
Match Logic
R
TRIS
4 Output Enable
CCP5CON<3:0>
TMR1H TMR1L 0
TMR5H TMR5L 1
C5TSEL0
0 TMR1H TMR1L
1 TMR5H TMR5L
Special Event Trigger
(Timer1/Timer3 Reset, A/D Trigger)
C4TSEL1
C4TSEL0
Compare Output S Q
Comparator
Match Logic
R
TRIS
4 Output Enable
CCPR4H CCPR4L
CCP4CON<3:0>
Note: This block diagram uses CCP4 and CCP5 and their appropriate timers as an example. For details on all of
the CCP modules and their timer assignments, see Table 18-2 and Table 18-3.
EQUATION 18-1:
Comparator R Q
PWM Period = [(PR2) + 1] • 4 • TOSC •
RC2/CCP1 (TMR2 Prescale Value)
TMR2 (Note 1)
S
PWM frequency is defined as 1/[PWM period].
TRISC<2> When TMR2 is equal to PR2, the following three events
Comparator
Clear Timer, occur on the next increment cycle:
CCP1 pin and
PR2
latch D.C. • TMR2 is cleared
• The CCP4 pin is set
Note 1: The 8-bit TMR2 value is concatenated with the 2-bit (An exception: If the PWM duty cycle = 0%, the
internal Q clock, or 2 bits of the prescaler, to create CCP4 pin will not be set)
the 10-bit time base.
2: CCP4 and its appropriate timers are used as an • The PWM duty cycle is latched from CCPR4L into
example. For details on all of the CCP modules and CCPR4H
their timer assignments, see Table 18-2 and
Table 18-3. Note: The Timer2 postscalers (see Section 14.0
“Timer2 Module”) are not used in the
determination of the PWM frequency. The
postscaler could be used to have a servo
update rate at a different frequency than
the PWM output.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
TMR3H TMR3L
Set CCP1IF
C1TSEL0
C1TSEL1 TMR3
ECCP1 Pin C1TSEL2 Enable
Prescaler and CCPR1H CCPR1L
1, 4, 16 Edge Detect
C1TSEL0 TMR1
C1TSEL1 Enable
C1TSEL2
4 TMR1H TMR1L
CCP1CON<3:0>
4
Q1:Q4
0 TMR1H TMR1L
1 TMR3H TMR3L
Compare Output S Q
Comparator
Match Logic
R
TRIS
4 Output Enable
CCPR1H CCPR1L
CCP1CON<3:0>
FIGURE 19-3: SIMPLIFIED BLOCK DIAGRAM OF THE ENHANCED PWM MODE EXAMPLE
DC1B<1:0> PxM<1:0> CCPxM<3:0>
Duty Cycle Registers
2 4
CCPR1L
ECCPx/PxA ECCPx/Output Pin
TRIS
CCPR1H (Slave)
PxB Output Pin
Output TRIS
Comparator R Q
Controller
PxC Output Pin
TMR2 (1)
S TRIS
Note 1: 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.
Note 1: The TRIS register value for each PWM output must be configured appropriately.
2: Any pin not used by an Enhanced PWM mode is available for alternate pin functions.
Period
PxA Active
PxD Modulated
PxA Inactive
PxD Inactive
Relationships:
• Period = 4 * TOSC * (PR2 + 1) * (TMR2 Prescale Value)
• Pulse Width = TOSC * (CCPRxL<7:0>:CCPxCON<5:4>) * (TMR2 Prescale Value)
• Delay = 4 * TOSC * (ECCPxDEL<6:0>)
Note 1: Dead-band delay is programmed using the ECCPxDEL register (see Section 19.4.6 “Programmable
Dead-Band Delay Mode”).
Pulse PR2 + 1
PxM<1:0> Signal 0
Width
Period
PxA Modulated
Delay(1) Delay(1)
10 (Half-Bridge) PxB Modulated
PxA Active
PxD Modulated
PxA Inactive
PxD Inactive
Relationships:
• Period = 4 * TOSC * (PR2 + 1) * (TMR2 Prescale Value)
• Pulse Width = TOSC * (CCPRxL<7:0>:CCPxCON<5:4>) * (TMR2 Prescale Value)
• Delay = 4 * TOSC * (ECCPxDEL<6:0>)
Note 1: Dead-band delay is programmed using the ECCPxDEL register (see Section 19.4.6 “Programmable Dead-Band
Delay Mode”).
FET
Driver +
PxA
-
Load
FET
Driver
+
PxB
-
V+
FET FET
Driver Driver
PxA
Load
FET FET
Driver Driver
PxB
FET QA QC FET
Driver Driver
PxA
Load
PxB
FET FET
Driver Driver
PxC
QB QD
V-
PxD
PxB(2)
PxC(2)
PxD(2)
(1) (1)
Reverse Mode
Period
Pulse Width
PxA(2)
PxB(2)
PxC(2)
PxD(2)
(1) (1)
Note 1: At this time, the TMR2 register is equal to the PR2 register.
2: The output signal is shown as active-high.
PxA (Active-High)
PxB (Active-High)
Pulse Width
PxC (Active-High)
(2)
PxD (Active-High)
Pulse Width
Note 1: The direction bit, PxM1 of the CCPxCON register, is written any time during the PWM cycle.
2: When changing directions, the PxA and PxC signals switch before the end of the current PWM cycle. The
modulated PxB and PxD signals are inactive at this time. The length of this time is:
(1/FOSC) • TMR2 Prescale Value.
PxA
PxB
PW
PxC
PxD PW
TON
External Switch C
TOFF
External Switch D
19.4.3 START-UP CONSIDERATIONS pin output drivers. The completion of a full PWM cycle
is indicated by the TMR2IF or TMR4IF bit of the PIR1
When any PWM mode is used, the application
or PIR3 register being set as the second PWM period
hardware must use the proper external pull-up and/or
begins.
pull-down resistors on the PWM output pins.
Note: When the microcontroller is released from 19.4.4 ENHANCED PWM
Reset, all of the I/O pins are in the AUTO-SHUTDOWN MODE
high-impedance state. The external The PWM mode supports an Auto-Shutdown mode that
circuits must keep the power switch will disable the PWM outputs when an external
devices in the OFF state until the micro- shutdown event occurs. Auto-Shutdown mode places
controller drives the I/O pins with the the PWM output pins into a predetermined state. This
proper signal levels or activates the PWM mode is used to help prevent the PWM from damaging
output(s). the application.
The CCPxM<1:0> bits of the CCPxCON register allow The auto-shutdown sources are selected using the
the user to choose whether the PWM output signals are ECCPxAS<2:0> bits (ECCPxAS<6:4>). A shutdown
active-high or active-low for each pair of PWM output event may be generated by:
pins (PxA/PxC and PxB/PxD). The PWM output
polarities must be selected before the PWM pin output • A logic ‘0’ on the pin that is assigned to the FLT0
drivers are enabled. Changing the polarity configura- input function
tion while the PWM pin output drivers are enabled is • Comparator C1
not recommended, since it may result in damage to the • Comparator C2
application circuits. • Setting the ECCPxASE bit in firmware
The PxA, PxB, PxC and PxD output latches may not be A shutdown condition is indicated by the ECCPxASE
in the proper states when the PWM module is (Auto-Shutdown Event Status) bit (ECCPxAS<7>). If
initialized. Enabling the PWM pin output drivers at the the bit is a ‘0’, the PWM pins are operating normally. If
same time as the Enhanced PWM modes may cause the bit is a ‘1’, the PWM outputs are in the shutdown
damage to the application circuit. The Enhanced PWM state.
modes must be enabled in the proper Output mode and
complete a full PWM cycle before enabling the PWM
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: The auto-shutdown condition is a level-based signal, not an edge-based signal. As long as the level is
present, the auto-shutdown will persist.
2: Writing to the ECCPxASE bit is disabled while an auto-shutdown condition persists.
3: Once the auto-shutdown condition has been removed and the PWM restarted (either through firmware or
auto-restart), the PWM signal will always restart at the beginning of the next PWM period.
Shutdown Event
ECCPxASE bit
PWM Activity
Normal PWM
ECCPxASE
Cleared by
Start of Shutdown Shutdown Firmware PWM
PWM Period Event Occurs Event Clears Resumes
19.4.5 AUTO-RESTART MODE The module will wait until the next PWM period begins,
however, before re-enabling the output pin. This behav-
The Enhanced PWM can be configured to automatically
ior allows the auto-shutdown with auto-restart features
restart the PWM signal once the auto-shutdown condi-
to be used in applications based on the current mode
tion has been removed. Auto-restart is enabled by
of PWM control.
setting the PxRSEN bit (ECCPxDEL<7>).
If auto-restart is enabled, the ECCPxASE bit will
remain set as long as the auto-shutdown condition is
active. When the auto-shutdown condition is removed,
the ECCPxASE bit will be cleared via hardware and
normal operation will resume.
PWM Period
Shutdown Event
ECCPxASE bit
PWM Activity
Normal PWM
FET
Driver +
PxA V
-
Load
FET
Driver
+
PxB V
-
V-
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
19.4.7 PULSE STEERING MODE While the PWM Steering mode is active, the
CCPxM<1:0> bits (CCPxCON<1:0>) select the PWM
In Single Output mode, pulse steering allows any of the
output polarity for the Px<D:A> pins.
PWM pins to be the modulated signal. Additionally, the
same PWM signal can simultaneously be available on The PWM auto-shutdown operation also applies to
multiple pins. PWM Steering mode, as described in Section 19.4.4
“Enhanced PWM Auto-shutdown mode”. An
Once the Single Output mode is selected
auto-shutdown event will only affect pins that have
(CCPxM<3:2> = 11 and PxM<1:0> = 00 of the
PWM outputs enabled.
CCPxCON register), the user firmware can bring out
the same PWM signal to one, two, three or four output
pins by setting the appropriate STR<D:A> bits
(PSTRxCON<3:0>), as provided in Table 19-3.
Note: The associated TRIS bits must be set to
output (‘0’), to enable the pin output driver,
in order to see the PWM signal on the pin.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 7-6 CMPL<1:0>: Complementary Mode Output Assignment Steering Sync bits
1 = Modulated output pin toggles between PxA and PxB for each period
0 = Complementary output assignment disabled; the STRD:STRA bits are used to determine Steering
mode
bit 5 Unimplemented: Read as ‘0’
bit 4 STRSYNC: Steering Sync bit
1 = Output steering update occurs on next PWM period
0 = Output steering update occurs at the beginning of the instruction cycle boundary
bit 3 STRD: Steering Enable D bit
1 = PxD pin has the PWM waveform with polarity control from CCPxM<1:0>
0 = PxD pin is assigned to port pin
bit 2 STRC: Steering Enable C bit
1 = PxC pin has the PWM waveform with polarity control from CCPxM<1:0>
0 = PxC pin is assigned to port pin
bit 1 STRB: Steering Enable B bit
1 = PxB pin has the PWM waveform with polarity control from CCPxM<1:0>
0 = PxB pin is assigned to port pin
bit 0 STRA: Steering Enable A bit
1 = PxA pin has the PWM waveform with polarity control from CCPxM<1:0>
0 = PxA pin is assigned to port pin
Note 1: The PWM Steering mode is available only when the CCPxCON register bits, CCPxM<3:2> = 11 and
PxM<1:0> = 00.
PORT Data(1)
0
TRIS
Note 1: Port outputs are configured as displayed when
the CCPxCON register bits, PxM<1:0> = 00
and CCP1M<3:2> = 11.
2: Single PWM output requires setting at least
one of the STR<D:A> bits.
PWM
STRn
P1n = PWM
PWM
STRn
P1n = PWM
File Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
INTCON GIE/GIEH PEIE/GIEL TMR0IE INT0IE RBIE TMR0IF INT0IF RBIF
RCON IPEN — CM RI TO PD POR BOR
PIR1 PMPIF ADIF RC1IF TX1IF SSP1IF CCP1IF TMR2IF TMR1IF
PIR2 OSCFIF CM2IF CM1IF USBIF BCL1IF HLVDIF TMR3IF CCP2IF
PIR4 CCP10IF CCP9IF CCP8IF CCP7IF CCP6IF CCP5IF CCP4IF CCP3IF
PIE1 PMPIE ADIE RC1IE TX1IE SSP1IE CCP1IE TMR2IE TMR1IE
PIE2 OSCFIE CM2IE CM1IE USBIE BCL1IE HLVDIE TMR3IE CCP2IE
PIE4 CCP10IE CCP9IE CCP8IE CCP7IE CCP6IE CCP5IE CCP4IE CCP3IE
IPR1 PMPIP ADIP RC1IP TX1IP SSP1IP CCP1IP TMR2IP TMR1IP
IPR2 OSCFIP CM2IP CM1IP USBIP BCL1IP HLVDIP TMR3IP CCP2IP
IPR4 CCP10IP CCP9IP CCP8IP CCP7IP CCP6IP CCP5IP CCP4IP CCP3IP
TRISB TRISB7 TRISB6 TRISB5 TRISB4 TRISB3 TRISB2 TRISB1 TRISB0
TRISC TRISC7 TRISC6 — — — TRISC2 TRISC1 TRISC0
TRISE RDPU REPU — — — TRISE2 TRISE1 TRISE0
TMR1H Timer1 Register High Byte
TMR1L Timer1 Register Low Byte
TMR2 Timer2 Register
TMR3H Timer3 Register High Byte
TMR3L Timer3 Register Low Byte
TMR4 Timer4 Register
TMR6 Timer6 Register
TMR8 Timer8 Register
PR2 Timer2 Period Register
PR4 Timer4 Period Register
PR6 Timer6 Period Register
PR8 Timer8 Period Register
T1CON TMR1CS1 TMR1CS0 T1CKPS1 T1CKPS0 T1OSCEN T1SYNC RD16 TMR1ON
T2CON — T2OUTPS3 T2OUTPS2 T2OUTPS1 T2OUTPS0 TMR2ON T2CKPS1 T2CKPS0
T3CON TMR3CS1 TMR3CS0 T3CKPS1 T3CKPS0 T3OSCEN T3SYNC RD16 TMR3ON
T4CON — T4OUTPS3 T4OUTPS2 T4OUTPS1 T4OUTPS0 TMR4ON T4CKPS1 T4CKPS0
T6CON — T6OUTPS3 T6OUTPS2 T6OUTPS1 T6OUTPS0 TMR6ON T6CKPS1 T6CKPS0
File Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
T8CON — T8OUTPS3 T8OUTPS2 T8OUTPS1 T8OUTPS0 TMR8ON T8CKPS1 T8CKPS0
CCPR1H Capture/Compare/PWM Register1 High Byte
CCPR1L Capture/Compare/PWM Register1 Low Byte
CCPR2H Capture/Compare/PWM Register2 High Byte
CCPR2L Capture/Compare/PWM Register2 Low Byte
CCPR3H Capture/Compare/PWM Register3 High Byte
CCPR3L Capture/Compare/PWM Register3 Low Byte
CCP1CON P1M1 P1M0 DC1B1 DC1B0 CCP1M3 CCP1M2 CCP1M1 CCP1M0
CCP2CON P2M1 P2M0 DC2B1 DC2B0 CCP2M3 CCP2M2 CCP2M1 CCP2M0
CCP3CON P3M1 P3M0 DC3B1 DC3B0 CCP3M3 CCP3M2 CCP3M1 CCP3M0
REGISTER 20-1: SSPxSTAT: MSSPx STATUS REGISTER (SPI MODE) (ACCESS 1, FC7h; 2, F73h)
R/W-1 R/W-1 R-1 R-1 R-1 R-1 R-1 R-1
(1)
SMP CKE D/A P S R/W UA BF
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: Polarity of the clock state is set by the CKP bit (SSPxCON1<4>).
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: In Master mode, the overflow bit is not set since each new reception (and transmission) is initiated by
writing to the SSPxBUF register.
2: When enabled, this pin must be properly configured as input or output.
3: Bit combinations not specifically listed here are either reserved or implemented in I2C™ mode only.
Any write to the SSPxBUF register during transmission The open-drain output option is controlled by the
or reception of data will be ignored and the Write SPI2OD and SPI1OD bits (ODCON3<1:0>). Setting an
Collision Detect bit, WCOL (SSPxCON1<7>), will be set. SPIxOD bit configures both the SDOx and SCKx pins for
User software must clear the WCOL bit so that it can be the corresponding open-drain operation.
determined if the following write(s) to the SSPxBUF
register completed successfully.
Note: When the application software is expecting
to receive valid data, the SSPxBUF should
be read before the next byte of transfer
data is written to the SSPxBUF. Application
software should follow this process even
when the current contents of SSPxBUF
are not important.
SDOx SDIx
Write to
SSPxBUF
SCKx
(CKP = 0
CKE = 0)
SCKx
(CKP = 1
CKE = 0)
4 Clock
SCKx Modes
(CKP = 0
CKE = 1)
SCKx
(CKP = 1
CKE = 1)
Input
Sample
(SMP = 1)
SSPxIF
Next Q4 Cycle
SSPxSR to after Q2
SSPxBUF
SSx
SCKx
(CKP = 0
CKE = 0)
SCKx
(CKP = 1
CKE = 0)
Write to
SSPxBUF
SDIx bit 0
(SMP = 0) bit 7 bit 7
Input
Sample
(SMP = 0)
SSPxIF
Interrupt
Flag
Next Q4 Cycle
SSPxSR to after Q2
SSPxBUF
SSx
Optional
SCKx
(CKP = 0
CKE = 0)
SCKx
(CKP = 1
CKE = 0)
Write to
SSPxBUF
SDIx
(SMP = 0) bit 7 bit 0
Input
Sample
(SMP = 0)
SSPxIF
Interrupt
Flag
Next Q4 Cycle
SSPxSR to after Q2
SSPxBUF
SSx
Not Optional
SCKx
(CKP = 0
CKE = 1)
SCKx
(CKP = 1
CKE = 1)
Write to
SSPxBUF
SDIx
(SMP = 0) bit 7 bit 0
Input
Sample
(SMP = 0)
SSPxIF
Interrupt
Flag
Next Q4 Cycle
after Q2
SSPxSR to
SSPxBUF
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 7-6 SSCON<1:0>: SSDMA Output Control bits (Master modes only)
11 = SSDMA is asserted for the duration of 4 bytes; DLYINTEN is always reset low
01 = SSDMA is asserted for the duration of 2 bytes; DLYINTEN is always reset low
10 = SSDMA is asserted for the duration of 1 byte; DLYINTEN is always reset low
00 = SSDMA is not controlled by the DMA module; DLYINTEN bit is software programmable
bit 5 TXINC: Transmit Address Increment Enable bit
Allows the transmit address to increment as the transfer progresses.
1 = The transmit address is to be incremented from the initial value of TXADDR<11:0>
0 = The transmit address is always set to the initial value of TXADDR<11:0>
bit 4 RXINC: Receive Address Increment Enable bit
Allows the receive address to increment as the transfer progresses.
1 = The received address is to be incremented from the intial value of RXADDR<11:0>
0 = The received address is always set to the initial value of RXADDR<11:0>
bit 3-2 DUPLEX<1:0>: Transmit/Receive Operating Mode Select bits
10 = SPI DMA operates in Full-Duplex mode, data is simultaneously transmitted and received
01 = DMA operates in Half-Duplex mode, data is transmitted only
00 = DMA operates in Half-Duplex mode, data is received only
bit 1 DLYINTEN: Delay Interrupt Enable bit
Enables the interrupt to be invoked after the number of TCY cycles specified in DLYCYC<2:0> has
elapsed from the latest completed transfer.
1 = The interrupt is enabled, SSCON<1:0> must be set to ‘00’
0 = The interrupt is disabled
bit 0 DMAEN: DMA Operation Start/Stop bit
This bit is set by the users’ software to start the DMA operation. It is reset back to zero by the DMA
engine when the DMA operation is completed or aborted.
1 = DMA is in session
0 = DMA is not in session
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
InitSPIPins:
movlb 0x0F ;Select bank 15, for access to ODCON3 register
bcf ODCON3, SPI2OD ;Let’s not use open drain outputs in this example
bcf LATB, RB2 ;Initialize our (to be) SCK2 pin low (idle).
bcf LATB, RB1 ;Initialize our (to be) SDO2 pin to an idle state
bcf TRISB, RB1 ;Make SDO2 output, and drive low
bcf TRISB, RB2 ;Make SCK2 output, and drive low (idle state)
bsf TRISB, RB0 ;SDI2 is an input, make sure it is tri-stated
InitMSSP2:
clrf SSP2STAT ;CKE = 0, SMP = 0 (sampled at middle of bit)
movlw b'00000000' ;CKP = 0, SPI Master mode, Fosc/4
movwf SSP2CON1 ;MSSP2 initialized
bsf SSP2CON1, SSPEN ;Enable the MSSP2 module
InitSPIDMA:
movlw b'00111010' ;Full duplex, RX/TXINC enabled, no SSCON
movwf DMACON1 ;DLYINTEN is set, so DLYCYC3:DLYCYC0 = 1111
movlw b'11110000' ;Minimum delay between bytes, interrupt
movwf DMACON2 ;only once when the transaction is complete
; udata 0x500
;DestBuf res 0x200 ;Let’s reserve 0x500-0x6FF for use as our SPI
; ;receive data buffer in this example
;SrcBuf res 0x200 ;Lets reserve 0x700-0x8FF for use as our SPI
; ;transmit data buffer in this example
PrepareTransfer:
movlw HIGH(DestBuf) ;Get high byte of DestBuf address (0x05)
movwf RXADDRH ;Load upper four bits of the RXADDR register
movlw LOW(DestBuf) ;Get low byte of the DestBuf address (0x00)
movwf RXADDRL ;Load lower eight bits of the RXADDR register
movlw 0x01 ;Lets move 0x200 (512) bytes in one DMA xfer
movwf DMABCH ;Load the upper two bits of DMABC register
movlw 0xFF ;Actual bytes transferred is (DMABC + 1), so
movwf DMABCL ;we load 0x01FF into DMABC to xfer 0x200 bytes
BeginXfer:
bsf DMACON1, DMAEN ;The SPI DMA module will now begin transferring
;the data taken from SrcBuf, and will store
;received bytes into DestBuf.
Note: Only port I/O names are used in this diagram for
the sake of brevity. Refer to the text for a full list of
multiplexed functions.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: When enabled, the SDAx and SCLx pins must be configured as inputs.
2: Bit combinations not specifically listed here are either reserved or implemented in SPI mode only.
3: When SSPM<3:0> = 1001, any reads or writes to the SSPxADD SFR address actually accesses the
SSPxMSK register.
4: This mode is only available when 7-Bit Address Masking mode is selected (MSSPMSK Configuration bit is ‘1’).
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: Value that will be transmitted when the user initiates an Acknowledge sequence at the end of a receive.
2: If the I2C module is active, these bits may not be set (no spooling) and the SSPxBUF may not be written
(or writes to the SSPxBUF are disabled).
3: This bit is not implemented in I2C Master mode.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: 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).
2: This bit is unimplemented in I2C Slave mode.
REGISTER 20-9: SSPxMSK: I2C™ SLAVE ADDRESS MASK REGISTER (7-BIT MASKING MODE)
(1, ACCESS FC8h; 2, F74h)(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
MSK7 MSK6 MSK5 MSK4 MSK3 MSK2 MSK1 MSK0(2)
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: This register shares the same SFR address as SSPxADD and is only addressable in select MSSP
operating modes. See Section 20.5.3.4 “7-Bit Address Masking Mode” for more details.
2: MSK0 is not used as a mask bit in 7-bit addressing.
SDAx A7 A6 A5 A4 A3 A2 A1 ACK D7 D6 D5 D4 D3 D2 D1 D0 D7 D6 D5 D4 D3 D2 D1 D0
SCLx 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S P
BF (SSPxSTAT<0>)
Preliminary
Cleared in software
SSPxBUF is read
SSPOV (SSPxCON1<6>)
SSPOV is set
because SSPxBUF is
still full. ACK is not sent.
CKP (SSPxCON1<4>)
(CKP does not reset to ‘0’ when SEN = 0)
I2C™ SLAVE MODE TIMING WITH SEN = 0 (RECEPTION, 7-BIT ADDRESS)
DS39964B-page 319
PIC18F47J53 FAMILY
FIGURE 20-9:
DS39964B-page 320
Receiving Address R/W = 0 Receiving Data ACK Receiving Data ACK
SDAx A7 A6 A5 X A3 X X ACK D7 D6 D5 D4 D3 D2 D1 D0 D7 D6 D5 D4 D3 D2 D1 D0
SCLx 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S P
Bus master
terminates
transfer
(RECEPTION, 7-BIT ADDRESS)(1)
BF (SSPxSTAT<0>)
Preliminary
Cleared in software
SSPxBUF is read
SSPOV (SSPxCON1<6>)
SSPOV is set
because SSPxBUF is
still full. ACK is not sent.
CKP (SSPxCON1<4>)
Note 1: In this example, an address equal to A7.A6.A5.X.A3.X.X will be Acknowledged and cause an interrupt.
I2C™ SLAVE MODE TIMING WITH SEN = 0 AND ADMSK<5:1> = 01011
SCLx
1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S
Data in SCLx held low P
sampled while CPU
responds to SSPxIF
SSPxIF (PIR1<3>)
BF (SSPxSTAT<0>)
Cleared in software Cleared in software
From SSPxIF ISR From SSPxIF ISR
Preliminary
SSPxBUF is written in software SSPxBUF is written in software
Clear by reading
CKP
DS39964B-page 321
PIC18F47J53 FAMILY
FIGURE 20-11:
DS39964B-page 322
Clock is held low until Clock is held low until
update of SSPxADD has update of SSPxADD has
taken place taken place
Receive First Byte of Address Receive Second Byte of Address Receive Data Byte Receive Data Byte
R/W = 0 ACK
SCLx 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S P
Bus master
terminates
SSPxIF (PIR1<3> or PIR3<7>) transfer
BF (SSPxSTAT<0>)
PIC18F47J53 FAMILY
SSPOV is set
Preliminary
because SSPxBUF is
still full. ACK is not sent.
UA (SSPxSTAT<1>)
Note 1: In this example, an address equal to A9.A8.A7.A6.A5.X.A3.A2.X.X will be Acknowledged and cause an interrupt.
I2C™ SLAVE MODE TIMING WITH SEN = 0 AND ADMSK<5:1> = 01001
2: Note that the Most Significant bits of the address are not affected by the bit masking.
Receive First Byte of Address Receive Second Byte of Address Receive Data Byte Receive Data Byte
R/W = 0 ACK
Bus master
terminates
SSPxIF (PIR1<3> or PIR3<7>) transfer
BF (SSPxSTAT<0>)
SSPOV is set
Preliminary
because SSPxBUF is
still full. ACK is not sent.
UA (SSPxSTAT<1>)
DS39964B-page 323
PIC18F47J53 FAMILY
FIGURE 20-13:
DS39964B-page 324
Bus master
terminates
Clock is held low until Clock is held low until transfer
update of SSPxADD has update of SSPxADD has Clock is held low until
taken place taken place CKP is set to ‘1’
R/W = 0
Receive First Byte of Address Receive Second Byte of Address Receive First Byte of Address R/W = 1 Transmitting Data Byte ACK
SDAx 1 1 1 1 0 A9 A8 ACK A7 A6 A5 A4 A3 A2 A1 A0 ACK 1 1 1 1 0 A9 A8 ACK D7 D6 D5 D4 D3 D2 D1 D0
SCLx 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S Sr P
BF (SSPxSTAT<0>)
Preliminary
Dummy read of SSPxBUF Write of SSPxBUF Completion of
contents of SSPxSR to clear BF flag BF flag is clear
to clear BF flag initiates transmit data transmission
at the end of the
UA (SSPxSTAT<1>) third address sequence clears BF flag
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
SDAx DX DX – 1
SCLx
Master device
CKP asserts clock
Master device
deasserts clock
WR
SSPxCON1
SDAx A7 A6 A5 A4 A3 A2 A1 ACK D7 D6 D5 D4 D3 D2 D1 D0 D7 D6 D5 D4 D3 D2 D1 D0
SCLx 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S P
BF (SSPxSTAT<0>)
Preliminary
Cleared in software
SSPxBUF is read
SSPOV (SSPxCON1<6>)
SSPOV is set
because SSPxBUF is
still full. ACK is not sent.
CKP (SSPxCON1<4>)
CKP
written
to ‘1’ in
If BF is cleared
software
prior to the falling
edge of the 9th clock,
CKP will not be reset BF is still set after falling
to ‘0’ and no clock edge of the 9th clock,
stretching will occur CKP is reset to ‘0’ and
clock stretching occurs
I2C™ SLAVE MODE TIMING WITH SEN = 1 (RECEPTION, 7-BIT ADDRESS)
DS39964B-page 327
PIC18F47J53 FAMILY
FIGURE 20-16:
DS39964B-page 328
Clock is held low until
update of SSPxADD has update of SSPxADD has Clock is not held low
Clock is held low until
taken place taken place because ACK = 1
CKP is set to ‘1’
Receive First Byte of Address Receive Second Byte of Address Receive Data Byte Receive Data Byte
R/W = 0 ACK
ACK ACK
SDAx 1 1 1 1 0 A9 A8 ACK A7 A6 A5 A4 A3 A2 A1 A0 D7 D6 D5 D4 D3 D2 D1 D0 D7 D6 D5 D4 D3 D2 D1 D0
SCLx 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S P
BF (SSPxSTAT<0>)
PIC18F47J53 FAMILY
SSPOV is set
Preliminary
because SSPxBUF is
still full. ACK is not sent.
UA (SSPxSTAT<1>)
SCLx
1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
S
SSPxIF
BF (SSPxSTAT<0>)
Cleared in software
SSPxBUF is read
SSPOV (SSPxCON1<6>) ‘0’
GCEN (SSPxCON2<7>)
‘1’
20.5.6 MASTER MODE Once Master mode is enabled, the user has six
options.
Master mode is enabled by setting and clearing the
appropriate SSPM bits in SSPxCON1 and by setting 1. Assert a Start condition on SDAx and SCLx.
the SSPEN bit. In Master mode, the SCLx and SDAx 2. Assert a Repeated Start condition on SDAx and
lines are manipulated by the MSSP hardware if the SCLx.
TRIS bits are set. 3. Write to the SSPxBUF register initiating
Master mode of operation is supported by interrupt transmission of data/address.
generation on the detection of the Start and Stop con- 4. Configure the I2C port to receive data.
ditions. The Start (S) and Stop (P) bits are cleared from 5. Generate an Acknowledge condition at the end
a Reset or when the MSSP module is disabled. Control of a received byte of data.
of the I2C bus may be taken when the Stop bit is set, or
6. Generate a Stop condition on SDAx and SCLx.
the bus is Idle, with both the Start and Stop bits clear.
In Firmware Controlled Master mode, user code
conducts all I2C bus operations based on Start and
Stop bit conditions.
Internal SSPM<3:0>
Data Bus SSPxADD<6:0>
Read Write
SSPxBUF Baud
Rate
Generator
SDAx Shift
SDAx In
SSPM<3:0> SSPxADD<6:0>
SDAx DX DX – 1
BRG decrements on
Q2 and Q4 cycles
BRG
03h 02h 01h 00h (hold off) 03h 02h
Value
20.5.8 I2C MASTER MODE START Note: If, at the beginning of the Start condition, the
CONDITION TIMING SDAx and SCLx pins are already sampled
To initiate a Start condition, the user sets the Start low, or if during the Start condition, the
Enable bit, SEN (SSPxCON2<0>). If the SDAx and SCLx line is sampled low before the SDAx
SCLx pins are sampled high, the BRG is reloaded with line is driven low, a bus collision occurs.
the contents of SSPxADD<6:0> and starts its count. If The Bus Collision Interrupt Flag, BCLxIF, is
SCLx and SDAx are both sampled high when the Baud set, the Start condition is aborted and the
Rate Generator times out (TBRG), the SDAx pin is I2C module is reset into its Idle state.
driven low. The action of the SDAx being driven low
while SCLx is high is the Start condition and causes the 20.5.8.1 WCOL Status Flag
Start bit (SSPxSTAT<3>) to be set. Following this, the If the user writes the SSPxBUF when a Start sequence
BRG is reloaded with the contents of SSPxADD<6:0> is in progress, the WCOL bit is set and the contents of
and resumes its count. When the BRG times out the buffer are unchanged (the write does not occur).
(TBRG), the SEN bit (SSPxCON2<0>) will be
Note: Because queueing of events is not
automatically cleared by hardware. The BRG is
allowed, writing to the lower five bits of
suspended, leaving the SDAx line held low and the Start
SSPxCON2 is disabled until the Start
condition is complete.
condition is complete.
SCLx
TBRG
S
Sr = Repeated Start
DS39964B-page 336
Write SSPxCON2<0> (SEN = 1), ACKSTAT in
Start condition begins SSPxCON2 = 1
From slave, clear ACKSTAT bit (SSPxCON2<6>)
SEN = 0
Transmitting Data or Second Half
Transmit Address to Slave R/W = 0
of 10-bit Address ACK
SDAx A7 A6 A5 A4 A3 A2 A1 ACK = 0 D7 D6 D5 D4 D3 D2 D1 D0
Preliminary
BF (SSPxSTAT<0>)
PEN
R/W
I 2C™ MASTER MODE WAVEFORM (TRANSMISSION, 7-BIT OR 10-BIT ADDRESS)
Write to SSPxCON2<4>
to start Acknowledge sequence,
SDAx = ACKDT (SSPxCON2<5>) = 0
Write to SSPxCON2<0> (SEN = 1),
begin Start condition ACK from master, Set ACKEN, start Acknowledge sequence,
Master configured as a receiver SDAx = ACKDT = 0 SDAx = ACKDT = 1
SEN = 0 by programming SSPxCON2<3> (RCEN = 1)
Bus master
ACK is not sent terminates
transfer
1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9
SCLx S P
Data shifted in on falling edge of CLK Set SSPxIF at end
of receive Set SSPxIF interrupt
Set SSPxIF interrupt at end of Acknowledge
Set SSPxIF interrupt sequence
at end of receive
at end of Acknowledge
SSPxIF sequence
Set P bit
Cleared in software Cleared in software Cleared in software Cleared in software (SSPxSTAT<4>)
Cleared in
Preliminary
SDAx = 0, SCLx = 1, software and SSPxIF
while CPU
responds to SSPxIF
BF
(SSPxSTAT<0>) Last bit is shifted into SSPxSR and
contents are unloaded into SSPxBUF
SSPOV
ACKEN
I2C™ MASTER MODE WAVEFORM (RECEPTION, 7-BIT ADDRESS)
DS39964B-page 337
PIC18F47J53 FAMILY
PIC18F47J53 FAMILY
20.5.12 ACKNOWLEDGE SEQUENCE 20.5.13 STOP CONDITION TIMING
TIMING A Stop bit is asserted on the SDAx pin at the end of a
An Acknowledge sequence is enabled by setting the receive/transmit by setting the Stop Sequence Enable
Acknowledge Sequence Enable bit, ACKEN bit, PEN (SSPxCON2<2>). At the end of a
(SSPxCON2<4>). When this bit is set, the SCLx pin is receive/transmit, the SCLx line is held low after the
pulled low and the contents of the Acknowledge data bit falling edge of the ninth clock. When the PEN bit is set,
are presented on the SDAx pin. If the user wishes to the master will assert the SDAx line low. When the
generate an Acknowledge, then the ACKDT bit should SDAx line is sampled low, the BRG is reloaded and
be cleared. If not, the user should set the ACKDT bit counts down to 0. When the BRG times out, the SCLx
before starting an Acknowledge sequence. The BRG pin will be brought high and one Baud Rate Generator
then counts for one rollover period (TBRG) and the SCLx rollover count (TBRG) later, the SDAx pin will be
pin is deasserted (pulled high). When the SCLx pin is deasserted. When the SDAx pin is sampled high while
sampled high (clock arbitration), the BRG counts for SCLx is high, the Stop bit (SSPxSTAT<4>) is set. A
TBRG; the SCLx pin is then pulled low. Following this, the TBRG later, the PEN bit is cleared and the SSPxIF bit is
ACKEN bit is automatically cleared, the BRG is turned set (Figure 20-26).
off and the MSSP module then goes into an inactive
state (Figure 20-25). 20.5.13.1 WCOL Status Flag
If the user writes the SSPxBUF when a Stop sequence
20.5.12.1 WCOL Status Flag is in progress, then the WCOL bit is set and the
If the user writes the SSPxBUF when an Acknowledge contents of the buffer are unchanged (the write does
sequence is in progress, then WCOL is set and the not occur).
contents of the buffer are unchanged (the write does
not occur).
SCLx 8 9
SSPxIF
Cleared in
SSPxIF set at software
the end of receive Cleared in
software SSPxIF set at the end
of Acknowledge sequence
Note: TBRG = one Baud Rate Generator period.
TBRG
SCLx
SDAx ACK
P
TBRG TBRG TBRG
SCLx brought high after TBRG
SDAx asserted low before rising edge of clock
to set up Stop condition
SDAx
BCLxIF
SDAx
SCLx
Set SEN, enable Start SEN cleared automatically because of bus collision.
condition if SDAx = 1, SCLx = 1 MSSPx module reset into Idle state.
SEN
SDAx sampled low before
Start condition. Set BCLxIF.
S bit and SSPxIF set because
BCLxIF SDAx = 0, SCLx = 1.
SSPxIF and BCLxIF are
cleared in software
SSPxIF
TBRG TBRG
SDAx
FIGURE 20-30: BRG RESET DUE TO SDAx ARBITRATION DURING START CONDITION
SDAx = 0, SCLx = 1
Set S Set SSPxIF
Less than TBRG
TBRG
SCLx S
SCLx pulled low after BRG
time-out
SEN
Set SEN, enable Start
sequence if SDAx = 1, SCLx = 1
BCLxIF ‘0’
SSPxIF
SDAx = 0, SCLx = 1, Interrupts cleared
set SSPxIF in software
SDAx
SCLx
RSEN
BCLxIF
Cleared in software
S ‘0’
SSPxIF ‘0’
TBRG TBRG
SDAx
SCLx
S ‘0’
SSPxIF
PEN
BCLxIF
P ‘0’
SSPxIF ‘0’
SDAx
SCLx goes low before SDAx goes high,
Assert SDAx
set BCLxIF
SCLx
PEN
BCLxIF
P ‘0’
SSPxIF ‘0’
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
0.3 — — — — — — — — — — — —
1.2 — — — 1.221 1.73 255 1.202 0.16 129 1.201 -0.16 103
2.4 2.441 1.73 255 2.404 0.16 129 2.404 0.16 64 2.403 -0.16 51
9.6 9.615 0.16 64 9.766 1.73 31 9.766 1.73 15 9.615 -0.16 12
19.2 19.531 1.73 31 19.531 1.73 15 19.531 1.73 7 — — —
57.6 56.818 -1.36 10 62.500 8.51 4 52.083 -9.58 2 — — —
115.2 125.000 8.51 4 104.167 -9.58 2 78.125 -32.18 1 — — —
0.3 — — — — — — — — — — — —
1.2 — — — — — — — — — — — —
2.4 — — — — — — 2.441 1.73 255 2.403 -0.16 207
9.6 9.766 1.73 255 9.615 0.16 129 9.615 0.16 64 9615. -0.16 51
19.2 19.231 0.16 129 19.231 0.16 64 19.531 1.73 31 19.230 -0.16 25
57.6 58.140 0.94 42 56.818 -1.36 21 56.818 -1.36 10 55.555 3.55 8
115.2 113.636 -1.36 21 113.636 -1.36 10 125.000 8.51 4 — — —
0.3 0.300 0.00 8332 0.300 0.02 4165 0.300 0.02 2082 0.300 -0.04 1665
1.2 1.200 0.02 2082 1.200 -0.03 1041 1.200 -0.03 520 1.201 -0.16 415
2.4 2.402 0.06 1040 2.399 -0.03 520 2.404 0.16 259 2.403 -0.16 207
9.6 9.615 0.16 259 9.615 0.16 129 9.615 0.16 64 9.615 -0.16 51
19.2 19.231 0.16 129 19.231 0.16 64 19.531 1.73 31 19.230 -0.16 25
57.6 58.140 0.94 42 56.818 -1.36 21 56.818 -1.36 10 55.555 3.55 8
115.2 113.636 -1.36 21 113.636 -1.36 10 125.000 8.51 4 — — —
0.3 0.300 0.04 832 0.300 -0.16 415 0.300 -0.16 207
1.2 1.202 0.16 207 1.201 -0.16 103 1.201 -0.16 51
2.4 2.404 0.16 103 2.403 -0.16 51 2.403 -0.16 25
9.6 9.615 0.16 25 9.615 -0.16 12 — — —
19.2 19.231 0.16 12 — — — — — —
57.6 62.500 8.51 3 — — — — — —
115.2 125.000 8.51 1 — — — — — —
0.3 0.300 0.00 33332 0.300 0.00 16665 0.300 0.00 8332 0.300 -0.01 6665
1.2 1.200 0.00 8332 1.200 0.02 4165 1.200 0.02 2082 1.200 -0.04 1665
2.4 2.400 0.02 4165 2.400 0.02 2082 2.402 0.06 1040 2.400 -0.04 832
9.6 9.606 0.06 1040 9.596 -0.03 520 9.615 0.16 259 9.615 -0.16 207
19.2 19.193 -0.03 520 19.231 0.16 259 19.231 0.16 129 19.230 -0.16 103
57.6 57.803 0.35 172 57.471 -0.22 86 58.140 0.94 42 57.142 0.79 34
115.2 114.943 -0.22 86 116.279 0.94 42 113.636 -1.36 21 117.647 -2.12 16
0.3 0.300 0.01 3332 0.300 -0.04 1665 0.300 -0.04 832
1.2 1.200 0.04 832 1.201 -0.16 415 1.201 -0.16 207
2.4 2.404 0.16 415 2.403 -0.16 207 2.403 -0.16 103
9.6 9.615 0.16 103 9.615 -0.16 51 9.615 -0.16 25
19.2 19.231 0.16 51 19.230 -0.16 25 19.230 -0.16 12
57.6 58.824 2.12 16 55.555 3.55 8 — — —
115.2 111.111 -3.55 8 — — — — — —
BRG Clock
RCxIF bit
(Interrupt)
Read
RCREGx
Note: The ABD sequence requires the EUSART module to be configured in Asynchronous mode and WUE = 0.
BRG Clock
ABDEN bit
ABDOVF bit
FFFFh
BRG Value XXXXh 0000h 0000h
TRMT SPEN
BRG16 SPBRGHx SPBRGx
TX9
Baud Rate Generator TX9D
Write to TXREGx
Word 1
BRG Output
(Shift Clock)
TXx (pin)
Start bit bit 0 bit 1 bit 7/8 Stop bit
Word 1
TXxIF bit
(Transmit Buffer 1 TCY
Reg. Empty Flag)
Word 1
TRMT bit
Transmit Shift Reg
(Transmit Shift
Reg. Empty Flag)
Write to TXREGx
Word 1 Word 2
BRG Output
(Shift Clock)
TXx (pin)
Start bit bit 0 bit 1 bit 7/8 Stop bit Start bit bit 0
RX9
SPEN
8
RCxIF
(Interrupt Flag)
OERR bit
CREN
Note: This timing diagram shows three words appearing on the RXx input. The RCREGx (Receive Buffer) is read after
the third word causing the OERR (Overrun) bit to be set.
21.2.4 AUTO-WAKE-UP ON SYNC BREAK wake-up event independent of the CPU mode. A
CHARACTER wake-up event consists of a high-to-low transition on
the RXx/DTx line. (This coincides with the start of a
During Sleep mode, all clocks to the EUSART are
Sync Break or a Wake-up Signal character for the
suspended. Because of this, the BRG is inactive and a
LIN/J2602 protocol.)
proper byte reception cannot be performed. The
auto-wake-up feature allows the controller to wake-up Following a wake-up event, the module generates an
due to activity on the RXx/DTx line while the EUSART RCxIF interrupt. The interrupt is generated synchro-
is operating in Asynchronous mode. nously to the Q clocks in normal operating modes
(Figure 21-8) and asynchronously if the device is in
The auto-wake-up feature is enabled by setting the
Sleep mode (Figure 21-9). The interrupt condition is
WUE bit (BAUDCONx<1>). Once set, the typical
cleared by reading the RCREGx register.
receive sequence on RXx/DTx is disabled and the
EUSART remains in an Idle state, monitoring for a
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
OSC1
Bit set by user Auto-Cleared
WUE bit(1)
RXx/DTx Line
RCxIF
Cleared due to user read of RCREGx
Note 1: The EUSART remains in Idle while the WUE bit is set.
RXx/DTx Line
Note 1
RCxIF
Cleared due to user read of RCREGx
SLEEP Command Executed Sleep Ends
Note 1: If the wake-up event requires long oscillator warm-up time, the auto-clear of the WUE bit can occur before the
oscillator is ready. This sequence should not depend on the presence of Q clocks.
2: The EUSART remains in Idle while the WUE bit is set.
Write to TXREGx
Dummy Write
BRG Output
(Shift Clock)
Break
TXxIF bit
(Transmit Buffer
Reg. Empty Flag)
TRMT bit
(Transmit Shift
Reg. Empty Flag)
SENDB sampled here Auto-Cleared
SENDB bit
(Transmit Shift
Reg. Empty Flag)
RC7/CCP10/PMA4/RX1/
DT1/SDO1/RP18 bit 0 bit 1 bit 2 bit 7 bit 0 bit 1 bit 7
Word 1 Word 2
RC6/CCP9/PMA5/TX1/CK1/
RP17 (TXCKP = 0)
RC6/CCP9/PMA5/TX1/CK1/
RP17 (TXCKP = 1)
Write to
TXREG1 Reg
Write Word 1 Write Word 2
TX1IF bit
(Interrupt Flag)
TRMT bit
Note: Sync Master mode, SPBRGx = 0; continuous transmission of two 8-bit words. This example is equally applicable to EUSART2
(RPn1/TX2/CK2 and RPn2/RX2/DT2).
RC6/CCP9/PMA5/TX1/CK1/
RP17 Pin
Write to
TXREG1 reg
TX1IF bit
TRMT bit
TXEN bit
RC7/CCP10/PMA4/RX1/
DT1/SDO1/RP18 bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7
RC6/CCP9/PMA5/TX1/
CK1/RP17 (TXCKP = 0)
RC6/CCP9/PMA5/TX1/
CK1/RP17 (TXCKP = 1)
Write to
SREN bit
SREN bit
CREN bit ‘0’ ‘0’
RC1IF bit
(Interrupt)
Read
RCREG1
Note: Timing diagram demonstrates Sync Master mode with bit, SREN = 1, and bit, BRGH = 0. This example is equally applicable to EUSART2
(RPn1/TX2/CK2 and RPn2/RX2/DT2).
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: 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.
Legend:
R = Readable bit WO = Write-Once bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 7-4 Unimplemented: Program the corresponding Flash Configuration bit to ‘1’
bit 3 MSSPMSK: MSSP 7-Bit Address Masking Mode Enable bit
1 = 7-Bit Address Masking mode enabled
0 = 5-Bit Address Masking mode enabled
bit 2 Unimplemented: Read as ‘0’
bit 1 ADCSEL: A/D Converter Mode bit
1 = 10-Bit Conversion mode enabled
0 = 12-Bit Conversion mode enabled
bit 0 IOL1WAY: IOLOCK One Way Set Enable bit
1 = IOLOCK bit (PPSCON<0>) can be set once, provided the unlock sequence has been completed.
Once set, the Peripheral Pin Select registers cannot be written to a second time.
0 = IOLOCK bit (PPSCON<0>) can be set and cleared as needed, provided the unlock sequence has
been completed
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
1111
VBG
1110
VDDCORE/VCAP
1100
AN12
1011
AN11
1010
AN10
1001
AN9
1000
AN8
0111
AN7(1)
0110
AN6(1)
VAIN
0101
10/12-Bit (Input Voltage) AN5(1)
A/D
Converter 0100
AN4
0011
AN3
0010
AN2
VCFG<1:0> 0001
Reference AN1
Voltage
VDD(2) 0000
AN0
VREF+
VREF-
VSS(2)
Note 1: Channels, AN5, AN6 and AN7, are not available on 28-pin devices.
2: I/O pins have diode protection to VDD and VSS.
VSS
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Conversion starts
Holding capacitor is disconnected from analog input (typically 100 ns)
FIGURE 22-4: A/D CONVERSION TAD CYCLES (ACQT<2:0> = 010, TACQ = 4 TAD)
1 2 3 4 1 2 3 4 5 6 7 8 9 10 11
b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
Automatic
Acquisition Conversion starts
Time (Holding capacitor is disconnected)
22.7 A/D Converter Calibration The calibration process assumes that the device is in a
relatively steady-state operating condition. If A/D
The A/D Converter in the PIC18F47J53 family of calibration is used, it should be performed after each
devices includes a self-calibration feature, which com- device Reset or if there are other major changes in
pensates for any offset generated within the module. operating conditions.
The calibration process is automated and is initiated by
setting the ADCAL bit (ADCON1<6>). The next time
the GO/DONE bit is set, the module will perform an off-
set calibration and store the result internally. Thus,
subsequent offsets will be compensated.
Example 22-1 provides an example of a calibration
routine.
PIC18F47J53 Family
External 3.3V
VUSB Supply
Optional
P External
Pull-ups(1)
FSEN P
UPUEN
Internal Pull-ups (Full (Low
UTRDIS Speed) Speed)
Transceiver
USB Bus
USB Clock from the FS
D+
Oscillator Module
D-
USB
SIE
3.8-Kbyte
USB RAM
Note 1: The internal pull-up resistors should be disabled (UPUEN = 0) if external pull-up resistors are used.
Note 1: Make sure the USB clock source is correctly configured before setting this bit.
2: There should be at least four cycles of delay between the setting and PPBRST.
Prior to communicating over USB, the module’s In order to achieve optimum USB signal quality, the D+
associated internal and/or external hardware must be and D- traces between the microcontroller and USB
configured. Most of the configuration is performed with connector (or cable) should be less than 19 cm long.
the UCFG register (Register 23-2).The UFCG register Both traces should be equal in length and they should
contains most of the bits that control the system level be routed parallel to each other. Ideally, these traces
behavior of the USB module. These include: should be designed to have a characteristic impedance
matching that of the USB cable.
• Bus Speed (full speed versus low speed)
• On-Chip Pull-up Resistor Enable
• On-Chip Transceiver Enable
• Ping-Pong Buffer Usage
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: The UPUEN, UTRDIS and FSEN bits should never be changed while the USB module is enabled. These
values must be preconfigured prior to enabling the module.
2: This bit is only valid when the on-chip transceiver is active (UTRDIS = 0); otherwise, it is ignored.
3: If UTRDIS is set, the UOE signal will be active – independent of the UOEMON bit setting.
VUSB
1.5 k
D+
D-
Data Bus
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: This bit is only valid for endpoints with available Even and Odd BD registers.
REGISTER 23-4: UEPn: USB ENDPOINT n CONTROL REGISTER (UEP0 THROUGH UEP15)
(BANKED F26h-F35h)
U-0 U-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
— — — EPHSHK EPCONDIS EPOUTEN EPINEN EPSTALL
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: This bit must be initialized by the user to the desired value prior to enabling the USB module.
2: This bit is ignored unless DTSEN = 1.
3: If these bits are set, USB communication may not work. Hence, these bits should always be maintained as
‘0’.
Available
as
EP15 IN Odd Data RAM
Descriptor
DFFh DFFh DFFh DFFh
Maximum Memory Maximum Memory Maximum Memory Maximum Memory
Used: 128 bytes Used: 132 bytes Used: 256 bytes Used: 248 bytes
Maximum BDs: Maximum BDs: Maximum BDs: 6 Maximum BDs:
32 (BD0 to BD31) 33 (BD0 to BD32) 4 (BD0 to BD63) 62 (BD0 to BD61)
Mode 3
Mode 0 Mode 1 Mode 2
Endpoint (Ping-Pong on all other EPs,
(No Ping-Pong) (Ping-Pong on EP0 OUT) (Ping-Pong on all EPs)
except EP0)
SOFIF
SOFIE
BTSEF
BTSEE TRNIF USBIF
TRNIE
BTOEF
BTOEE
IDLEIF
DFN8EF IDLEIE
DFN8EE UERRIF
CRC16EF UERRIE
CRC16EE
CRC5EF STALLIF
STALLIE
CRC5EE
PIDEF
PIDEE ACTVIF
ACTVIE
URSTIF
URSTIE
Control Transfer(1)
1 ms Frame
Note 1: The control transfer shown here is only an example showing events that can occur for every transaction. Typical
control transfers will spread across multiple frames.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: Once an Idle state is detected, the user may want to place the USB module in Suspend mode.
2: Clearing this bit will cause the USTAT FIFO to advance (valid only for IN, OUT and SETUP tokens).
3: This bit is typically unmasked only following the detection of a UIDLE interrupt event.
4: Only error conditions enabled through the UEIE register will set this bit. This bit is a status bit only and
cannot be set or cleared by the user.
C:
UCONbits.SUSPND = 0;
while (UIRbits.ACTVIF) { UIRbits.ACTVIF = 0; }
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
REGISTER 23-9: UEIR: USB ERROR INTERRUPT STATUS REGISTER (ACCESS F63h)
R/C-0 U-0 U-0 R/C-0 R/C-0 R/C-0 R/C-0 R/C-0
BTSEF — — BTOEF DFN8EF CRC16EF CRC5EF PIDEF
bit 7 bit 0
Legend:
R = Readable bit C = Clearable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
REGISTER 23-10: UEIE: USB ERROR INTERRUPT ENABLE REGISTER (BANKED F37h)
R/W-0 U-0 U-0 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0
BTSEE — — BTOEE DFN8EE CRC16EE CRC5EE PIDEE
bit 7 bit 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
100 k VUSB
Legend: VUSB – Voltage applied to the VUSB pin in volts (should be 3.0V to 3.6V).
PZERO – Percentage (in decimal) of the IN traffic bits sent by the PIC® MCU that are a value of ‘0’.
PIN – Percentage (in decimal) of total bus bandwidth that is used for IN traffic.
LCABLE – Length (in meters) of the USB cable. The USB 2.0 Specification requires that full-speed
applications use cables no longer than 5m.
IPULLUP – Current which the nominal, 1.5 k pull-up resistor (when enabled) must supply to the USB
cable. On the host or hub end of the USB cable, 15 k nominal resistors (14.25 k to 24.8 k) are
present which pull both the D+ and D- lines to ground. During bus Idle conditions (such as between
packets or during USB Suspend mode), this results in up to 218 A of quiescent current drawn at 3.3V.
IPULLUP is also dependant on bus traffic conditions and can be as high as 2.2 mA when the USB bandwidth
is fully utilized (either IN or OUT traffic) for data that drives the lines to the “K” state most of the time.
Device
Configuration
Interface Interface
CCH<1:0> COUTx
(CMSTAT<2:0>)
CxINB 0
VIRV 3
Interrupt
CMxIF
CxINC 1 Logic
CxIND 2
EVPOL<1:0>
CREF COE
VIN- CxOUT
Polarity
CxINA 0 VIN+ Cx Logic
CVREF 1
CON CPOL
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: The CMxIF is automatically set any time this mode is selected and must be cleared by the application after
the initial configuration.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
VDD
VT = 0.6V RIC
RS < 10k
Comparator
AIN Input
CPIN ILEAKAGE
VA VT = 0.6V ±100 nA
5 pF
VSS
CVRSS = 1
VREF+
VDD
CVRSS = 0 8R
CVR<3:0>
CVREN R
16-to-1 MUX
16 Steps
CVREF
R
R
CVRR 8R
CVRSS = 1
VREF-
CVRSS = 0
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
PIC18F47J53
CVREF
R(1)
Module
+
Voltage RA2 CVREF Output
–
Reference
Output
Impedance
Note 1: R is dependent upon the Comparator Voltage Reference Configuration bits, CVRCON<5> and CVRCON<3:0>.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: See Table 31-8 in Section 31.0 “Electrical Characteristics” for specifications.
The module is enabled by setting the HLVDEN bit. The VDIRMAG bit determines the overall operation of
Each time the module is enabled, the circuitry requires the module. When VDIRMAG is cleared, the module
some time to stabilize. The IRVST bit is a read-only bit monitors for drops in VDD below a predetermined set
that indicates when the circuit is stable. The module point. When the bit is set, the module monitors for rises
can generate an interrupt only after the circuit is stable in VDD above the set point.
and IRVST is set.
VDD
HLVDL<3:0> HLVDCON
Register
HLVDEN VDIRMAG
HLVDIN
16-to-1 MUX
Set
HLVDIF
Internal Voltage
Reference
1.2V Typical
VDD
VHLVD
HLVDIF
Enable HLVD
TIRVST
IRVST
HLVDIF cleared in software
Internal Reference is stable
CASE 2:
VDD
VHLVD
HLVDIF
Enable HLVD
TIRVST
IRVST
Internal Reference is stable
HLVDIF cleared in software
VHLVD
VDD
HLVDIF
Enable HLVD
IRVST TIRVST
CASE 2:
VHLVD
VDD
HLVDIF
Enable HLVD
IRVST TIRVST
CTMUCON
EDGEN CTMUICON
EDGSEQEN
ITRIM<5:0> TGEN
EDG1SELx
EDG1POL IRNG<1:0> IDISSEN
EDG2SELx EDG1STAT
EDG2POL EDG2STAT Current Source
CTED1 Edge
CTMU
Control Control
CTED2 Logic Current Logic
Control
Timer1
Pulse CTPLS
ECCP1 Generator
A/D Converter Comparator 2
Input
Comparator 2 Output
PIC18F47J53
CTMU
Current Source
A/D Converter
ANx
A/D
RCAL MUX
/**************************************************************************/
//Setup AD converter;
/**************************************************************************/
// ADCON1
ADCON1bits.ADFM=1; // Resulst format 1= Right justified
ADCON1bits.ADCAL=0; // Normal A/D conversion operation
ADCON1bits.ACQT=1; // Acquition time 7 = 20TAD 2 = 4TAD 1=2TAD
ADCON1bits.ADCS=2; // Clock conversion bits 6= FOSC/64 2=FOSC/32
// ADCON0
ADCON0bits.VCFG0 =0; // Vref+ = AVdd
ADCON0bits.VCFG1 =0; // Vref- = AVss
ADCON0bits.CHS=2; // Select ADC channel
int main(void)
{
int i;
int j = 0; //index for loop
unsigned int Vread = 0;
double VTot = 0;
float Vavg=0, Vcal=0, CTMUISrc = 0; //float values stored for calcs
int main(void)
{
int i;
int j = 0; //index for loop
unsigned int Vread = 0;
float CTMUISrc, CTMUCap, Vavg, VTot, Vcal;
int main(void)
{
unsigned int Vread; //storage for reading
unsigned int switchState;
int i;
CTMU
CTED1 EDG1
Current Source
CTED2 EDG2
Output Pulse
A/D Converter
ANX
CAD
RPR
PIC18F47J53
CTMU
CTED1 EDG1 CTPLS
Current Source
Comparator
C2INB
C2
CPULSE CVREF
27.7 Operation During Sleep/Idle case, if the module is performing an operation when
Modes Idle mode is invoked, the results will be similar to those
with Sleep mode.
27.7.1 SLEEP MODE AND DEEP SLEEP
MODES 27.8 Effects of a Reset on CTMU
When the device enters any Sleep mode, the CTMU Upon Reset, all registers of the CTMU are cleared. This
module current source is always disabled. If the CTMU leaves the CTMU module disabled; its current source is
is performing an operation that depends on the current turned off and all configuration options return to their
source when Sleep mode is invoked, the operation may default settings. The module needs to be re-initialized
not terminate correctly. Capacitance and time following any Reset.
measurements may return erroneous values.
If the CTMU is in the process of taking a measurement at
the time of Reset, the measurement will be lost. A partial
27.7.2 IDLE MODE
charge may exist on the circuit that was being measured,
The behavior of the CTMU in Idle mode is determined and should be properly discharged before the CTMU
by the CTMUSIDL bit (CTMUCONH<5>). If CTMUSIDL makes subsequent attempts to make a measurement.
is cleared, the module will continue to operate in Idle The circuit is discharged by setting and then clearing the
mode. If CTMUSIDL is set, the module’s current source IDISSEN bit (CTMUCONH<1>) while the A/D Converter
is disabled when the device enters Idle mode. In this is connected to the appropriate channel.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
300000h CONFIG1L DEBUG XINST STVREN CFGPLLEN PLLDIV2 PLLDIV1 PLLDIV0 WDTEN 1111 1111
300001h CONFIG1H —(2) —(2) —(2) —(2) — CP0 CPDIV1 CPDIV0 1111 -111
300002h CONFIG2L IESO FCMEN CLKOEC SOSCSEL1 SOSCSEL0 FOSC2 FOSC1 FOSC0 1111 1111
300003h CONFIG2H —(2) —(2) —(2) —(2) WDTPS3 WDTPS2 WDTPS1 WDTPS0 1111 1111
300004h CONFIG3L DSWDTPS3 DSWDTPS2 DSWDTPS1 DSWDTPS0 DSWDTEN DSBOREN RTCOSC DSWDTOSC 1111 1111
300005h CONFIG3H —(2) —(2) —(2) —(2) MSSPMSK — ADCSEL IOL1WAY 1111 1-11
300006h CONFIG4L WPCFG WPFP6 WPFP5 WPFP4 WPFP3 WPFP2 WPFP1 WPFP0 1111 1111
300007h CONFIG4H —(2) —(2) —(2) —(2) LS48MHZ — WPEND WPDIS 1111 1-11
3FFFFEh DEVID1 DEV2 DEV1 DEV0 REV4 REV3 REV2 REV1 REV0 xxx0 0000(3)
3FFFFFh DEVID2 DEV10 DEV9 DEV8 DEV7 DEV6 DEV5 DEV4 DEV3 0100 00xx(3)
Legend: x = unknown, u = unchanged, - = unimplemented. Shaded cells are unimplemented, read as ‘0’.
Note 1: Values reflect the unprogrammed state as received from the factory and following Power-on Resets. In all other Reset states, the
configuration bytes maintain their previously programmed states.
2: The value of these bits in program memory should always be programmed to ‘1’. This ensures that the location is executed as a NOP if it
is accidentally executed.
3: See Register 28-9 and Register 28-10 for DEVID values. These registers are read-only and cannot be programmed by the user.
Legend:
R = Readable bit WO = Write-Once bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit WO = Write-Once bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 7-4 Unimplemented: Program the corresponding Flash Configuration bit to ‘1’
bit 3 Unimplemented: Maintain as ‘0’
bit 2 CP0: Code Protection bit
1 = Program memory is not code-protected
0 = Program memory is code-protected
bit 1-0 CPDIV<1:0>: CPU System Clock Selection bits
11 = No CPU system clock divide
10 = CPU system clock is divided by 2
01 = CPU system clock is divided by 3
00 = CPU system clock is divided by 6
Legend:
R = Readable bit WO = Write-Once bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit WO = Write-Once bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 7-4 Unimplemented: Program the corresponding Flash Configuration bit to ‘1’
bit 3-0 WDTPS<3:0>: Watchdog Timer Postscale Select bits
1111 = 1:32,768
1110 = 1:16,384
1101 = 1:8,192
1100 = 1:4,096
1011 = 1:2,048
1010 = 1:1,024
1001 = 1:512
1000 = 1:256
0111 = 1:128
0110 = 1:64
0101 = 1:32
0100 = 1:16
0011 = 1:8
0010 = 1:4
0001 = 1:2
0000 = 1:1
Legend:
R = Readable bit WO = Write-Once bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 7-4 DSWDTPS<3:0>: Deep Sleep Watchdog Timer Postscale Select bits(1)
The DSWDT prescaler is 32. This creates an approximate base time unit of 1 ms.
1111 = 1:2,147,483,648 (25.7 days)
1110 = 1:536,870,912 (6.4 days)
1101 = 1:134,217,728 (38.5 hours)
1100 = 1:33,554,432 (9.6 hours)
1011 = 1:8,388,608 (2.4 hours)
1010 = 1:2,097,152 (36 minutes)
1001 = 1:524,288 (9 minutes)
1000 = 1:131,072 (135 seconds)
0111 = 1:32,768 (34 seconds)
0110 = 1:8,192 (8.5 seconds)
0101 = 1:2,048 (2.1 seconds)
0100 = 1:512 (528 ms)
0011 = 1:128 (132 ms)
0010 = 1:32 (33 ms)
0001 = 1:8 (8.3 ms)
0000 = 1:2 (2.1 ms)
bit 3 DSWDTEN: Deep Sleep Watchdog Timer Enable bit(1)
1 = DSWDT is enabled
0 = DSWDT is disabled
bit 2 DSBOREN: “F” Device Deep Sleep BOR Enable bit, “LF” Device VDD BOR Enable bit
For “F” Devices:
1 = VDD sensing BOR is enabled in Deep Sleep
0 = VDD sensing BOR circuit is always disabled
For “LF” Devices:
1 = VDD sensing BOR circuit is always enabled
0 = VDD sensing BOR circuit is always disabled
bit 1 RTCOSC: RTCC Reference Clock Select bit
1 = RTCC uses T1OSC/T1CKI as reference clock
0 = RTCC uses INTRC as the reference clock
bit 0 DSWDTOSC: DSWDT Reference Clock Select bit(1)
1 = DSWDT uses INTRC as the reference clock
0 = DSWDT uses T1OSC/T1CKI as reference clock
Legend:
R = Readable bit WO = Write-Once bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 7-4 Unimplemented: Program the corresponding Flash Configuration bit to ‘1’
bit 3 MSSPMSK: MSSP 7-Bit Address Masking Mode Enable bit
1 = 7-Bit Address Masking mode is enabled
0 = 5-Bit Address Masking mode is enabled
bit 2 Unimplemented: Read as ‘0’
bit 1 ADCSEL: A/D Converter Mode
1 = 10-bit conversion mode is enabled
0 = 12-bit conversion mode is enabled
bit 0 IOL1WAY: IOLOCK One-Way Set Enable bit
1 = IOLOCK bit (PPSCON<0>) can be set once, provided the unlock sequence has been completed.
Once set, the Peripheral Pin Select registers cannot be written to a second time.
0 = IOLOCK bit (PPSCON<0>) can be set and cleared as needed, provided the unlock sequence has
been completed
Legend:
R = Readable bit WO = Write-Once bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 7 WPCFG: Write/Erase Protect Configuration Region Select bit (valid when WPDIS = 0)
1 = Configuration Words page is not erase/write-protected unless WPEND and WPFP<5:0> settings
include the Configuration Words page(1)
0 = Configuration Words page is erase/write-protected, regardless of WPEND and WPFP<5:0>(1)
bit 6-0 WPFP<6:0>: Write/Erase Protect Page Start/End Location bits
Used with WPEND bit to define which pages in Flash will be write/erase protected.
Note 1: The “Configuration Words page” contains the FCWs and is the last page of implemented Flash memory on
a given device. Each page consists of 1,024 bytes. For example, on a device with 64 Kbytes of Flash, the
first page is 0 and the last page (Configuration Words page) is 63 (3Fh).
Legend:
R = Readable bit WO = Write-Once bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 7-4 Unimplemented: Program the corresponding Flash Configuration bit to ‘1’
bit 3 LS48MHZ: Low-Speed USB Clock Selection
1 = 48-MHz system clock is expected; divide-by-8 generates low-speed USB clock
0 = 24-MHz system clock is expected; divide-by-4 generates low-speed USB clock
bit 2 Unimplemented: Read as ‘0’
bit 1 WPEND: Write-Protect Disable bit
1 = Flash pages, WPFP<6:0> to (Configuration Words page), are write/erase protected
0 = Flash pages 0 to WPFP<6:0> are write/erase-protected
bit 0 WPDIS: Write-Protect Disable bit
1 = WPFP<5:0>, WPEND and WPCFG bits are ignored; all Flash memory may be erased or written
0 = WPFP<5:0>, WPEND and WPCFG bits enabled; erase/write-protect is active for the selected
region(s)
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
DEV<10:3> DEV<2:0>
Device
(DEVID2<7:0>) (DEVID2<7:5>)
0101 1000 111 PIC18F47J53
0101 1000 101 PIC18F46J53
0101 1000 011 PIC18F27J53
0101 1000 001 PIC18F26J53
0101 1010 111 PIC18LF47J53
0101 1010 101 PIC18LF46J53
0101 1010 011 PIC18LF27J53
0101 1010 001 PIC18LF26J53
Enable WDT
SWDTEN INTRC Control
WDT Counter
Sleep
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Note 1: This bit has no effect if the Configuration bit, WDTEN, is enabled.
2: Not available on devices where the on-chip voltage regulator is disabled (“LF” devices).
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3
INTRC
OSC1
TOST(1) TPLL(1)
1 2 n-1 n
PLL Clock
Output
Clock
Transition
CPU Clock
Peripheral
Clock
Program PC PC + 2 PC + 4 PC + 6
Counter
Note1: TOST = 1024 TOSC; TPLL = 2 ms (approx). These intervals are not shown to scale.
Sample Clock
Device Oscillator
Clock Failure
Output
Clock Monitor
Output (Q)
Failure
Detected
OSCFIF
Note: The device clock is normally at a much higher frequency than the sample clock. The relative frequencies in
this example have been chosen for clarity.
Field Description
a RAM access bit:
a = 0: RAM location in Access RAM (BSR register is ignored)
a = 1: RAM bank is specified by BSR register
bbb Bit address within an 8-bit file register (0 to 7).
BSR Bank Select Register. Used to select the current RAM bank.
C, DC, Z, OV, N ALU Status bits: Carry, Digit Carry, Zero, Overflow, Negative.
d Destination select bit:
d = 0: store result in WREG
d = 1: store result in file register f
dest Destination: either the WREG register or the specified register file location.
f 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 Global Interrupt Enable bit.
k 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:
* No Change to register (such as TBLPTR with table reads and writes)
*+ Post-Increment register (such as TBLPTR with table reads and writes)
*- Post-Decrement register (such as TBLPTR with table reads and writes)
+* Pre-Increment register (such as TBLPTR with table reads and writes)
n The relative address (2’s complement number) for relative branch instructions or the direct address for
Call/Branch and Return instructions.
PC Program Counter.
PCL Program Counter Low Byte.
PCH Program Counter High Byte.
PCLATH Program Counter High Byte Latch.
PCLATU Program Counter Upper Byte Latch.
PD Power-Down bit.
PRODH Product of Multiply High Byte.
PRODL Product of Multiply Low Byte.
s Fast Call/Return mode select bit:
s = 0: do not update into/from shadow registers
s = 1: certain registers loaded into/from shadow registers (Fast mode)
TBLPTR 21-bit Table Pointer (points to a Program Memory location).
TABLAT 8-bit Table Latch.
TO Time-out bit.
TOS Top-of-Stack.
u Unused or Unchanged.
WDT Watchdog Timer.
WREG Working register (accumulator).
x Don’t 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 7-bit offset value for Indirect Addressing of register files (source).
zd 7-bit offset value for Indirect Addressing of register files (destination).
{ } Optional argument.
[text] Indicates an Indexed Address.
(text) The contents of text.
Field Description
[expr]<n> Specifies bit n of the register indicated by the pointer expr.
Assigned to.
< > Register bit field.
In the set of.
italics User-defined term (font is Courier New).
Literal operations
15 8 7 0
OPCODE k (literal) MOVLW 7Fh
Control operations
CALL, GOTO and Branch operations
15 8 7 0
OPCODE n<7:0> (literal) GOTO Label
15 12 11 0
1111 n<19:8> (literal)
15 8 7 0
OPCODE S n<7:0> (literal) CALL MYFUNC
15 12 11 0
1111 n<19:8> (literal)
S = Fast bit
15 11 10 0
BYTE-ORIENTED OPERATIONS
ADDWF f, d, a Add WREG and f 1 0010 01da ffff ffff C, DC, Z, OV, N 1, 2
ADDWFC f, d, a Add WREG and Carry bit to f 1 0010 00da ffff ffff C, DC, Z, OV, N 1, 2
ANDWF f, d, a AND WREG with f 1 0001 01da ffff ffff Z, N 1,2
CLRF f, a Clear f 1 0110 101a ffff ffff Z 2
COMF f, d, a Complement f 1 0001 11da ffff ffff Z, N 1, 2
CPFSEQ f, a Compare f with WREG, Skip = 1 (2 or 3) 0110 001a ffff ffff None 4
CPFSGT f, a Compare f with WREG, Skip > 1 (2 or 3) 0110 010a ffff ffff None 4
CPFSLT f, a Compare f with WREG, Skip < 1 (2 or 3) 0110 000a ffff ffff None 1, 2
DECF f, d, a Decrement f 1 0000 01da ffff ffff C, DC, Z, OV, N 1, 2, 3, 4
DECFSZ f, d, a Decrement f, Skip if 0 1 (2 or 3) 0010 11da ffff ffff None 1, 2, 3, 4
DCFSNZ f, d, a Decrement f, Skip if Not 0 1 (2 or 3) 0100 11da ffff ffff None 1, 2
INCF f, d, a Increment f 1 0010 10da ffff ffff C, DC, Z, OV, N 1, 2, 3, 4
INCFSZ f, d, a Increment f, Skip if 0 1 (2 or 3) 0011 11da ffff ffff None 4
INFSNZ f, d, a Increment f, Skip if Not 0 1 (2 or 3) 0100 10da ffff ffff None 1, 2
IORWF f, d, a Inclusive OR WREG with f 1 0001 00da ffff ffff Z, N 1, 2
MOVF f, d, a Move f 1 0101 00da ffff ffff Z, N 1
MOVFF fs, fd Move fs (source) to 1st word 2 1100 ffff ffff ffff None
fd (destination) 2nd word 1111 ffff ffff ffff
MOVWF f, a Move WREG to f 1 0110 111a ffff ffff None
MULWF f, a Multiply WREG with f 1 0000 001a ffff ffff None 1, 2
NEGF f, a Negate f 1 0110 110a ffff ffff C, DC, Z, OV, N
RLCF f, d, a Rotate Left f through Carry 1 0011 01da ffff ffff C, Z, N 1, 2
RLNCF f, d, a Rotate Left f (No Carry) 1 0100 01da ffff ffff Z, N
RRCF f, d, a Rotate Right f through Carry 1 0011 00da ffff ffff C, Z, N
RRNCF f, d, a Rotate Right f (No Carry) 1 0100 00da ffff ffff Z, N
SETF f, a Set f 1 0110 100a ffff ffff None 1, 2
SUBFWB f, d, a Subtract f from WREG with 1 0101 01da ffff ffff C, DC, Z, OV, N
Borrow
SUBWF f, d, a Subtract WREG from f 1 0101 11da ffff ffff C, DC, Z, OV, N 1, 2
SUBWFB f, d, a Subtract WREG from f with 1 0101 10da ffff ffff C, DC, Z, OV, N
Borrow
SWAPF f, d, a Swap Nibbles in f 1 0011 10da ffff ffff None 4
TSTFSZ f, a Test f, Skip if 0 1 (2 or 3) 0110 011a ffff ffff None 1, 2
XORWF f, d, a Exclusive OR WREG with f 1 0001 10da ffff ffff Z, N
Note 1: When a PORT register is modified as a function of itself (e.g., MOVF PORTB, 1, 0), the value used will be that
value present on the pins themselves. For example, if the data latch is ‘1’ for a pin configured as input and is
driven low by an external device, the data will be written back with a ‘0’.
2: If this instruction is executed on the TMR0 register (and, where applicable, d = 1), the prescaler will be cleared
if assigned.
3: If Program Counter (PC) is modified or a conditional test is true, the instruction requires two cycles. The second
cycle is executed as a NOP.
4: Some instructions are two-word instructions. The second word of these instructions will be executed as a NOP
unless the first word of the instruction retrieves the information embedded in these 16 bits. This ensures that all
program memory locations have a valid instruction.
BIT-ORIENTED OPERATIONS
BCF f, b, a Bit Clear f 1 1001 bbba ffff ffff None 1, 2
BSF f, b, a Bit Set f 1 1000 bbba ffff ffff None 1, 2
BTFSC f, b, a Bit Test f, Skip if Clear 1 (2 or 3) 1011 bbba ffff ffff None 3, 4
BTFSS f, b, a Bit Test f, Skip if Set 1 (2 or 3) 1010 bbba ffff ffff None 3, 4
BTG f, b, a Bit Toggle f 1 0111 bbba ffff ffff None 1, 2
CONTROL OPERATIONS
BC n Branch if Carry 1 (2) 1110 0010 nnnn nnnn None
BN n Branch if Negative 1 (2) 1110 0110 nnnn nnnn None
BNC n Branch if Not Carry 1 (2) 1110 0011 nnnn nnnn None
BNN n Branch if Not Negative 1 (2) 1110 0111 nnnn nnnn None
BNOV n Branch if Not Overflow 1 (2) 1110 0101 nnnn nnnn None
BNZ n Branch if Not Zero 1 (2) 1110 0001 nnnn nnnn None
BOV n Branch if Overflow 1 (2) 1110 0100 nnnn nnnn None
BRA n Branch Unconditionally 2 1101 0nnn nnnn nnnn None
BZ n Branch if Zero 1 (2) 1110 0000 nnnn nnnn None
CALL n, s Call Subroutine 1st word 2 1110 110s kkkk kkkk None
2nd word 1111 kkkk kkkk kkkk
CLRWDT — Clear Watchdog Timer 1 0000 0000 0000 0100 TO, PD
DAW — Decimal Adjust WREG 1 0000 0000 0000 0111 C
GOTO n Go to Address 1st word 2 1110 1111 kkkk kkkk None
2nd word 1111 kkkk kkkk kkkk
NOP — No Operation 1 0000 0000 0000 0000 None
NOP — No Operation 1 1111 xxxx xxxx xxxx None 4
POP — Pop Top of Return Stack (TOS) 1 0000 0000 0000 0110 None
PUSH — Push Top of Return Stack (TOS) 1 0000 0000 0000 0101 None
RCALL n Relative Call 2 1101 1nnn nnnn nnnn None
RESET Software Device Reset 1 0000 0000 1111 1111 All
RETFIE s Return from Interrupt Enable 2 0000 0000 0001 000s GIE/GIEH,
PEIE/GIEL
RETLW k Return with Literal in WREG 2 0000 1100 kkkk kkkk None
RETURN s Return from Subroutine 2 0000 0000 0001 001s None
SLEEP — Go into Standby mode 1 0000 0000 0000 0011 TO, PD
Note 1: When a PORT register is modified as a function of itself (e.g., MOVF PORTB, 1, 0), the value used will be that
value present on the pins themselves. For example, if the data latch is ‘1’ for a pin configured as input and is
driven low by an external device, the data will be written back with a ‘0’.
2: If this instruction is executed on the TMR0 register (and, where applicable, d = 1), the prescaler will be cleared
if assigned.
3: If Program Counter (PC) is modified or a conditional test is true, the instruction requires two cycles. The second
cycle is executed as a NOP.
4: Some instructions are two-word instructions. The second word of these instructions will be executed as a NOP
unless the first word of the instruction retrieves the information embedded in these 16 bits. This ensures that all
program memory locations have a valid instruction.
LITERAL OPERATIONS
ADDLW k Add Literal and WREG 1 0000 1111 kkkk kkkk C, DC, Z, OV, N
ANDLW k AND Literal with WREG 1 0000 1011 kkkk kkkk Z, N
IORLW k Inclusive OR Literal with WREG 1 0000 1001 kkkk kkkk Z, N
LFSR f, k Move literal (12-bit) 2nd word 2 1110 1110 00ff kkkk None
to FSR(f) 1st word 1111 0000 kkkk kkkk
MOVLB k Move Literal to BSR<3:0> 1 0000 0001 0000 kkkk None
MOVLW k Move Literal to WREG 1 0000 1110 kkkk kkkk None
MULLW k Multiply Literal with WREG 1 0000 1101 kkkk kkkk None
RETLW k Return with Literal in WREG 2 0000 1100 kkkk kkkk None
SUBLW k Subtract WREG from Literal 1 0000 1000 kkkk kkkk C, DC, Z, OV, N
XORLW k Exclusive OR Literal with WREG 1 0000 1010 kkkk kkkk Z, N
DATA MEMORY PROGRAM MEMORY OPERATIONS
TBLRD* Table Read 2 0000 0000 0000 1000 None
TBLRD*+ Table Read with Post-Increment 0000 0000 0000 1001 None
TBLRD*- Table Read with Post-Decrement 0000 0000 0000 1010 None
TBLRD+* Table Read with Pre-Increment 0000 0000 0000 1011 None
TBLWT* Table Write 2 0000 0000 0000 1100 None
TBLWT*+ Table Write with Post-Increment 0000 0000 0000 1101 None
TBLWT*- Table Write with Post-Decrement 0000 0000 0000 1110 None
TBLWT+* Table Write with Pre-Increment 0000 0000 0000 1111 None
Note 1: When a PORT register is modified as a function of itself (e.g., MOVF PORTB, 1, 0), the value used will be that
value present on the pins themselves. For example, if the data latch is ‘1’ for a pin configured as input and is
driven low by an external device, the data will be written back with a ‘0’.
2: If this instruction is executed on the TMR0 register (and, where applicable, d = 1), the prescaler will be cleared
if assigned.
3: If Program Counter (PC) is modified or a conditional test is true, the instruction requires two cycles. The second
cycle is executed as a NOP.
4: Some instructions are two-word instructions. The second word of these instructions will be executed as a NOP
unless the first word of the instruction retrieves the information embedded in these 16 bits. This ensures that all
program memory locations have a valid instruction.
Note: All PIC18 instructions may take an optional label argument preceding the instruction mnemonic for use in
symbolic addressing. If a label is used, the instruction format then becomes: {label} instruction argument(s).
Words: 1
Cycles: 1
Q Cycle Activity:
Q1 Q2 Q3 Q4
Decode Read Process Write to
register ‘f’ Data destination
Cycles: 1 No No No No
operation operation operation operation
Q Cycle Activity:
If No Jump:
Q1 Q2 Q3 Q4
Q1 Q2 Q3 Q4
Decode Read Process Write to
Decode Read literal Process No
register ‘f’ Data destination
‘n’ Data operation
BTFSC Bit Test File, Skip if Clear BTFSS Bit Test File, Skip if Set
Words: 1 Q1 Q2 Q3 Q4
Decode Read literal Process Write to PC
Cycles: 1
‘n’ Data
Q Cycle Activity: No No No No
Q1 Q2 Q3 Q4 operation operation operation operation
Decode Read Process Write If No Jump:
register ‘f’ Data register ‘f’ Q1 Q2 Q3 Q4
Decode Read literal Process No
Example: BTG PORTC, 4, 0 ‘n’ Data operation
Before Instruction:
PORTC = 0111 0101 [75h] Example: HERE BOV Jump
After Instruction:
Before Instruction
PORTC = 0110 0101 [65h]
PC = address (HERE)
After Instruction
If Overflow = 1;
PC = address (Jump)
If Overflow = 0;
PC = address (HERE + 2)
Words: 1
Example: CLRWDT
Cycles: 1
Before Instruction
Q Cycle Activity:
WDT Counter = ?
Q1 Q2 Q3 Q4 After Instruction
Decode Read Process Write WDT Counter = 00h
register ‘f’ Data register ‘f’ WDT Postscaler = 0
TO = 1
PD = 1
Example: CLRF FLAG_REG,1
Before Instruction
FLAG_REG = 5Ah
After Instruction
FLAG_REG = 00h
CPFSGT Compare f with W, Skip if f > W CPFSLT Compare f with W, Skip if f < W
Syntax: CPFSGT f {,a} Syntax: CPFSLT f {,a}
Operands: 0 f 255 Operands: 0 f 255
a [0,1] a [0,1]
Operation: (f) –W),
Operation: (f) –W),
skip if (f) > (W)
skip if (f) < (W)
(unsigned comparison)
(unsigned comparison)
Status Affected: None
Status Affected: None
Encoding: 0110 010a ffff ffff
Encoding: 0110 000a ffff ffff
Description: Compares the contents of data memory
location ‘f’ to the contents of the W by Description: Compares the contents of data memory
performing an unsigned subtraction. location ‘f’ to the contents of W by
performing an unsigned subtraction.
If the contents of ‘f’ are greater than the
contents of WREG, then the fetched If the contents of ‘f’ are less than the
instruction is discarded and a NOP is contents of W, then the fetched
executed instead, making this a instruction is discarded and a NOP is
two-cycle instruction. executed instead, making this a
two-cycle instruction.
If ‘a’ is ‘0’, the Access Bank is selected.
If ‘a’ is ‘1’, the BSR is used to select the If ‘a’ is ‘0’, the Access Bank is selected.
GPR bank (default). If ‘a’ is ‘1’, the BSR is used to select the
GPR bank (default).
If ‘a’ is ‘0’ and the extended instruction
set is enabled, this instruction operates Words: 1
in Indexed Literal Offset Addressing Cycles: 1(2)
mode whenever f 95 (5Fh). See Note: 3 cycles if skip and followed
Section 29.2.3 “Byte-Oriented and by a 2-word instruction.
Bit-Oriented Instructions in Indexed
Q Cycle Activity:
Literal Offset Mode” for details.
Q1 Q2 Q3 Q4
Words: 1
Decode Read Process No
Cycles: 1(2) register ‘f’ Data operation
Note: 3 cycles if skip and followed
If skip:
by a 2-word instruction.
Q1 Q2 Q3 Q4
Q Cycle Activity:
No No No No
Q1 Q2 Q3 Q4
operation operation operation operation
Decode Read Process No
register ‘f’ Data operation If skip and followed by 2-word instruction:
If skip: Q1 Q2 Q3 Q4
Q1 Q2 Q3 Q4 No No No No
No No No No operation operation operation operation
operation operation operation operation No No No No
If skip and followed by 2-word instruction: operation operation operation operation
Q1 Q2 Q3 Q4
No No No No Example: HERE CPFSLT REG, 1
operation operation operation operation NLESS :
No No No No LESS :
operation operation operation operation
Before Instruction
PC = Address (HERE)
Example: HERE CPFSGT REG, 0 W = ?
NGREATER : After Instruction
GREATER : If REG < W;
Before Instruction PC = Address (LESS)
If REG W;
PC = Address (HERE) PC = Address (NLESS)
W = ?
After Instruction
If REG W;
PC = Address (GREATER)
If REG W;
PC = Address (NGREATER)
Decode Read literal Process Write If ‘a’ is ‘0’, the Access Bank is selected.
‘k’ MSB Data literal ‘k’ If ‘a’ is ‘1’, the BSR is used to select the
MSB to GPR bank (default).
FSRfH If ‘a’ is ‘0’ and the extended instruction
Decode Read literal Process Write literal set is enabled, this instruction operates
‘k’ LSB Data ‘k’ to FSRfL in Indexed Literal Offset Addressing
mode whenever f 95 (5Fh). See
Section 29.2.3 “Byte-Oriented and
Example: LFSR 2, 3ABh
Bit-Oriented Instructions in Indexed
After Instruction Literal Offset Mode” for details.
FSR2H = 03h
FSR2L = ABh Words: 1
Cycles: 1
Q Cycle Activity:
Q1 Q2 Q3 Q4
Decode Read Process Write
register ‘f’ Data W
POP Pop Top of Return Stack PUSH Push Top of Return Stack
RLNCF Rotate Left f (No Carry) RRCF Rotate Right f through Carry
Words: 1 C register f
Cycles: 1
Words: 1
Q Cycle Activity:
Cycles: 1
Q1 Q2 Q3 Q4
Decode Read Process Write to Q Cycle Activity:
register ‘f’ Data destination Q1 Q2 Q3 Q4
Decode Read Process Write to
Example: RLNCF REG, 1, 0 register ‘f’ Data destination
Before Instruction
REG = 1010 1011 Example: RRCF REG, 0, 0
After Instruction Before Instruction
REG = 0101 0111 REG = 1110 0110
C = 0
After Instruction
REG = 1110 0110
W = 0111 0011
C = 0
ADDFSR Add Literal to FSR ADDULNK Add Literal to FSR2 and Return
Syntax: ADDFSR f, k Syntax: ADDULNK k
Operands: 0 k 63 Operands: 0 k 63
f [ 0, 1, 2 ] Operation: FSR2 + k FSR2,
Operation: FSR(f) + k FSR(f) (TOS) PC
Status Affected: None Status Affected: None
Encoding: 1110 1000 ffkk kkkk Encoding: 1110 1000 11kk kkkk
Description: The 6-bit literal ‘k’ is added to the Description: The 6-bit literal ‘k’ is added to the
contents of the FSR specified by ‘f’. contents of FSR2. A RETURN is then
Words: 1 executed by loading the PC with the
TOS.
Cycles: 1
Q Cycle Activity: The instruction takes two cycles to
execute; a NOP is performed during
Q1 Q2 Q3 Q4
the second cycle.
Decode Read Process Write to
literal ‘k’ Data FSR This may be thought of as a special
case of the ADDFSR instruction,
where f = 3 (binary ‘11’); it operates
Example: ADDFSR 2, 23h only on FSR2.
Words: 1
Before Instruction
FSR2 = 03FFh Cycles: 2
After Instruction Q Cycle Activity:
FSR2 = 0422h Q1 Q2 Q3 Q4
Decode Read Process Write to
literal ‘k’ Data FSR
No No No No
Operation Operation Operation Operation
Note: All PIC18 instructions may take an optional label argument preceding the instruction mnemonic for use in
symbolic addressing. If a label is used, the instruction format then becomes: {label} instruction argument(s).
MOVSS Move Indexed to Indexed PUSHL Store Literal at FSR2, Decrement FSR2
Syntax: MOVSS [zs], [zd] Syntax: PUSHL k
Operands: 0 zs 127 Operands: 0k 255
0 zd 127
Operation: k (FSR2),
Operation: ((FSR2) + zs) ((FSR2) + zd) FSR2 – 1 FSR2
Status Affected: None
Status Affected: None
Encoding:
Encoding: 1111 1010 kkkk kkkk
1st word (source) 1110 1011 1zzz zzzzs
2nd word (dest.) 1111 xxxx xzzz zzzzd Description: The 8-bit literal ‘k’ is written to the data
Description The contents of the source register are memory address specified by FSR2.
FSR2 is decremented by 1 after the
moved to the destination register. The
addresses of the source and destination operation.
registers are determined by adding the This instruction allows users to push
7-bit literal offsets, ‘zs’ or ‘zd’, values onto a software stack.
respectively, to the value of FSR2. Both
Words: 1
registers can be located anywhere in
the 4096-byte data memory space Cycles: 1
(000h to FFFh). Q Cycle Activity:
The MOVSS instruction cannot use the Q1 Q2 Q3 Q4
PCL, TOSU, TOSH or TOSL as the Decode Read ‘k’ Process Write to
destination register. data destination
If the resultant source address points to
an Indirect Addressing register, the
value returned will be 00h. If the Example: PUSHL 08h
resultant destination address points to Before Instruction
an Indirect Addressing register, the FSR2H:FSR2L = 01ECh
instruction will execute as a NOP. Memory (01ECh) = 00h
Words: 2
After Instruction
Cycles: 2 FSR2H:FSR2L = 01EBh
Q Cycle Activity: Memory (01ECh) = 08h
Q1 Q2 Q3 Q4
Decode Determine Determine Read
source addr source addr source reg
Decode Determine Determine Write
dest addr dest addr to dest reg
SUBFSR Subtract Literal from FSR SUBULNK Subtract Literal from FSR2 and Return
Syntax: SUBFSR f, k Syntax: SUBULNK k
Operands: 0 k 63 Operands: 0 k 63
f [ 0, 1, 2 ] Operation: FSR2 – k FSR2,
Operation: FSRf – k FSRf (TOS) PC
Status Affected: None Status Affected: None
Encoding: 1110 1001 ffkk kkkk Encoding: 1110 1001 11kk kkkk
Description: The 6-bit literal ‘k’ is subtracted from Description: The 6-bit literal ‘k’ is subtracted from the
the contents of the FSR specified contents of the FSR2. A RETURN is then
by ‘f’. executed by loading the PC with the
TOS.
Words: 1
Cycles: 1 The instruction takes two cycles to
execute; a NOP is performed during the
Q Cycle Activity:
second cycle.
Q1 Q2 Q3 Q4
This may be thought of as a special case
Decode Read Process Write to
of the SUBFSR instruction, where f = 3
register ‘f’ Data destination
(binary ‘11’); it operates only on FSR2.
Words: 1
Example: SUBFSR 2, 23h Cycles: 2
Before Instruction Q Cycle Activity:
FSR2 = 03FFh Q1 Q2 Q3 Q4
After Instruction Decode Read Process Write to
FSR2 = 03DCh register ‘f’ Data destination
No No No No
Operation Operation Operation Operation
† 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.
4.0V
3.6V
3.5V
2.5V
2.35V(1)
2.15V
8 MHz 48 MHz
0
Frequency
Note 1: When the USB module is enabled, VUSB should be provided 3.0V-3.6V while VDD must be 2.35V. When the USB
module is not enabled, the wider limits shaded in grey apply. VUSB should be maintained VDD, but may optionally
be high-impedance when the USB module is not in use.
3.00V
2.75V 2.75V
Valid Operating Range
2.50V
Voltage (VDDCORE)
2.35V(2)
2.25V
2.00V
8 MHz 48 MHz
0 Frequency
Param
Symbol Characteristic Min Typ Max Units Conditions
No.
D001 VDD Supply Voltage 2.15 — 3.6 V PIC18F4XJ53, PIC18F2XJ53
D001A VDD Supply Voltage 2.0 — 3.6 V PIC18LF4XJ53, PIC18LF2XJ53
D001B VDDCORE External Supply 2.0 — 2.75 V PIC18LF4XJ53, PIC18LF2XJ53
for Microcontroller Core
D001C AVDD Analog Supply Voltage VDD – 0.3 — VDD + 0.3 V
D001D AVSS Analog Ground Potential VSS – 0.3 — VSS + 0.3 V
D001E VUSB USB Supply Voltage 3.0 3.3 3.6 V USB module enabled(2)
D002 VDR RAM Data Retention 1.5 — — V
Voltage(1)
D003 VPOR VDD Start Voltage — — 0.7 V See Section 5.3 “Power-on
to Ensure Internal Reset (POR)” for details
Power-on Reset Signal
D004 SVDD VDD Rise Rate 0.05 — — V/ms See Section 5.3 “Power-on
to Ensure Internal Reset (POR)” for details
Power-on Reset Signal
D005 VBOR VDDCORE Brown-out Reset — 2.0 — V PIC18F4XJ53, PIC18F2XJ53
Voltage only
D006 VDSBOR VDD Brown-out Reset — 1.8 — V DSBOREN = 1 on “LF” device or
Voltage “F” device in Deep Sleep
Note 1: This is the limit to which VDDCORE can be lowered in Sleep mode, or during a device Reset, without losing RAM
data.
2: VUSB should always be maintained VDD, but may be left floating when the USB module is disabled and
RC4/RC5 will not be used as general purpose inputs.
Param
Device Typ Max Units Conditions
No.
Power-Down Current (IPD)(1) – Sleep mode
PIC18LFXXJ53 0.1 1.6 A -40°C
0.2 1.6 A +25°C VDD = 2.0V,
0.8 7.0 A +60°C VDDCORE = 2.0V
2.1 11.5 A +85°C
PIC18LFXXJ53 0.2 2.0 A -40°C
0.5 2.0 A +25°C VDD = 2.5V,
1.4 9.0 A +60°C VDDCORE = 2.5V
3.2 15.0 A +85°C Sleep mode,
PIC18FXXJ53 3.0 6.0 A -40°C REGSLP = 1
3.8 6.0 A +25°C VDD = 2.15V
Vddcore = 10 F
4.7 9.0 A +60°C Capacitor
6.4 18.5 A +85°C
PIC18FXXJ53 3.3 9.0 A -40°C
4.2 9.0 A +25°C VDD = 3.3V
Vddcore = 10 F
5.5 12.0 A +60°C Capacitor
7.8 22.0 A +85°C
Power-Down Current (IPD)(1) – Deep Sleep mode
PIC18FXXJ53 2 25 nA -40°C
9 100 nA +25°C VDD = 2.15V,
VDDCORE = 10 F
72 250 nA +60°C
Capacitor
0.26 1.0 A +85°C
Deep Sleep mode
PIC18FXXJ53 17 50 nA -40°C
53 150 nA +25°C VDD = 3.3V,
VDDCORE = 10 F
186 400 nA +60°C Capacitor
0.50 2.0 A +85°C
Note 1: 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, BOR, etc.).
2: 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. All features that add delta current are disabled (USB module,
WDT, etc.). 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/VSS;
MCLR = VDD; WDT disabled unless otherwise specified.
3: Low-power Timer1 with standard, low-cost 32 kHz crystals have an operating temperature range of -10°C to
+70°C. Extended temperature crystals are available at a much higher cost.
4: This is the module differential current when the USB module is enabled and clocked at 48 MHz, but with no USB
cable attached. When the USB cable is attached or data is being transmitted, the current consumption may be
much higher (see Section 23.6.4 “USB Transceiver Current Consumption”). During USB Suspend mode
(USBEN = 1, SUSPND = 1, bus in Idle state), the USB module current will be dominated by the D+ or D- pull-up
resistor. The integrated pull-up resistors use “resistor switching” according to the resistor_ecn supplement to
the USB 2.0 Specifications, and therefore, may be as low as 900 during Idle conditions.
Param
Device Typ Max Units Conditions
No.
Supply Current (IDD)(2)
PIC18LFXXJ53 5.5 14.2 A -40°C
VDD = 2.0V,
5.8 14.2 A +25°C
VDDCORE = 2.0V
7.9 19.0 A +85°C
PIC18LFXXJ53 8.4 16.5 A -40°C
VDD = 2.5V,
8.5 16.5 A +25°C
VDDCORE = 2.5V FOSC = 31 kHz
11.3 25.0 A +85°C (RC_RUN mode,
PIC18FXXJ53 23.7 60.0 A -40°C Internal RC Oscillator,
VDD = 2.15V
INTSRC = 0)
27.8 60.0 A +25°C VDDCORE = 10 F
34.0 70.0 A +85°C Capacitor
PIC18FXXJ53 26.1 70.0 A -40°C VDD = 3.3V
29.6 70.0 A +25°C VDDCORE = 10 F
36.2 96.0 A +85°C Capacitor
PIC18LFXXJ53 0.87 1.5 mA -40°C
VDD = 2.0V,
0.91 1.5 mA +25°C
VDDCORE = 2.0
0.95 1.6 mA +85°C
PIC18LFXXJ53 1.23 2.0 mA -40°C
VDD = 2.5V,
1.24 2.0 mA +25°C
VDDCORE = 2.5V
1.25 2.0 mA +85°C FOSC = 4 MHz,
RC_RUN mode,
PIC18FXXJ53 0.99 2.4 mA -40°C VDD = 2.15V, Internal RC Oscillator
1.02 2.4 mA +25°C VDDCORE = 10 F
1.06 2.6 mA +85°C capacitor
PIC18FXXJ53 1.31 2.6 mA -40°C VDD = 3.3V,
1.25 2.6 mA +25°C VDDCORE = 10 F
1.26 2.7 mA +85°C capacitor
Note 1: 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, BOR, etc.).
2: 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. All features that add delta current are disabled (USB module,
WDT, etc.). 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/VSS;
MCLR = VDD; WDT disabled unless otherwise specified.
3: Low-power Timer1 with standard, low-cost 32 kHz crystals have an operating temperature range of -10°C to
+70°C. Extended temperature crystals are available at a much higher cost.
4: This is the module differential current when the USB module is enabled and clocked at 48 MHz, but with no USB
cable attached. When the USB cable is attached or data is being transmitted, the current consumption may be
much higher (see Section 23.6.4 “USB Transceiver Current Consumption”). During USB Suspend mode
(USBEN = 1, SUSPND = 1, bus in Idle state), the USB module current will be dominated by the D+ or D- pull-up
resistor. The integrated pull-up resistors use “resistor switching” according to the resistor_ecn supplement to
the USB 2.0 Specifications, and therefore, may be as low as 900 during Idle conditions.
Param
Device Typ Max Units Conditions
No.
Supply Current (IDD)(2)
PIC18LFXXJ53 1.45 3.0 mA -40°C
VDD = 2.0V,
1.48 3.0 mA +25°C
VDDCORE = 2.0V
1.52 3.0 mA +85°C
PIC18LFXXJ53 2.12 3.8 mA -40°C
VDD = 2.5V,
2.10 3.8 mA +25°C
VDDCORE = 2.5V
2.10 3.9 mA +85°C FOSC = 8 MHz,
RC_RUN mode,
PIC18FXXJ53 1.65 3.6 mA -40°C
VDD = 2.15V, Internal RC Oscillator
1.68 3.6 mA +25°C
VDDCORE = 10 F
1.71 3.9 mA +85°C
PIC18FXXJ53 2.26 4.3 mA -40°C
VDD = 3.3V,
2.13 4.3 mA +25°C
VDDCORE = 10 F
2.10 4.6 mA +85°C
PIC18LFXXJ53 1.5 11 A -40°C
VDD = 2.0V,
1.7 11 A +25°C
VDDCORE = 2.0V
3.9 20 A +85°C
PIC18LFXXJ53 2.0 12 A -40°C
VDD = 2.5V,
2.4 13 A +25°C
VDDCORE = 2.5V FOSC = 31 kHz,
5.4 23 A +85°C RC_IDLE mode,
PIC18FXXJ53 19.0 60 A -40°C Internal RC Oscillator,
VDD = 2.15V, INTSRC = 0
23.2 60 A +25°C
VDDCORE = 10 F
29.9 75 A +85°C
PIC18FXXJ53 19.7 65 A -40°C
VDD = 3.3V,
24.0 65 A +25°C
VDDCORE = 10 F
31.4 90 A +85°C
Note 1: 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, BOR, etc.).
2: 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. All features that add delta current are disabled (USB module,
WDT, etc.). 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/VSS;
MCLR = VDD; WDT disabled unless otherwise specified.
3: Low-power Timer1 with standard, low-cost 32 kHz crystals have an operating temperature range of -10°C to
+70°C. Extended temperature crystals are available at a much higher cost.
4: This is the module differential current when the USB module is enabled and clocked at 48 MHz, but with no USB
cable attached. When the USB cable is attached or data is being transmitted, the current consumption may be
much higher (see Section 23.6.4 “USB Transceiver Current Consumption”). During USB Suspend mode
(USBEN = 1, SUSPND = 1, bus in Idle state), the USB module current will be dominated by the D+ or D- pull-up
resistor. The integrated pull-up resistors use “resistor switching” according to the resistor_ecn supplement to
the USB 2.0 Specifications, and therefore, may be as low as 900 during Idle conditions.
Param
Device Typ Max Units Conditions
No.
Supply Current (IDD)(2)
PIC18LFXXJ53 0.41 0.98 mA -40°C
VDD = 2.0V,
0.44 0.98 mA +25°C
VDDCORE = 2.0V
0.48 1.12 mA +85°C
PIC18LFXXJ53 0.48 1.14 mA -40°C
VDD = 2.5V,
0.51 1.14 mA +25°C
VDDCORE = 2.5V
0.55 1.25 mA +85°C FOSC = 4 MHz,
RC_IDLE mode,
PIC18FXXJ53 0.45 1.21 mA -40°C
VDD = 2.15V, Internal RC Oscillator
0.48 1.21 mA +25°C
VDDCORE = 10 F
0.52 1.30 mA +85°C
PIC18FXXJ53 0.52 1.20 mA -40°C
VDD = 3.3V,
0.54 1.20 mA +25°C
VDDCORE = 10 F
0.58 1.35 mA +85°C
PIC18LFXXJ53 0.53 1.4 mA -40°C
VDD = 2.0V,
0.56 1.5 mA +25°C
VDDCORE = 2.0V
0.60 1.6 mA +85°C
PIC18LFXXJ53 0.63 2.0 mA -40°C
VDD = 2.5V,
0.67 2.0 mA +25°C
VDDCORE = 2.5V
0.72 2.2 mA +85°C FOSC = 8 MHz,
RC_IDLE mode,
PIC18FXXJ53 0.58 1.8 mA -40°C
VDD = 2.15V, Internal RC Oscillator
0.62 1.8 mA +25°C
VDDCORE = 10 F
0.66 2.0 mA +85°C
PIC18FXXJ53 0.69 2.2 mA -40°C
VDD = 3.3V,
0.70 2.2 mA +25°C
VDDCORE = 10 F
0.74 2.3 mA +85°C
Note 1: 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, BOR, etc.).
2: 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. All features that add delta current are disabled (USB module,
WDT, etc.). 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/VSS;
MCLR = VDD; WDT disabled unless otherwise specified.
3: Low-power Timer1 with standard, low-cost 32 kHz crystals have an operating temperature range of -10°C to
+70°C. Extended temperature crystals are available at a much higher cost.
4: This is the module differential current when the USB module is enabled and clocked at 48 MHz, but with no USB
cable attached. When the USB cable is attached or data is being transmitted, the current consumption may be
much higher (see Section 23.6.4 “USB Transceiver Current Consumption”). During USB Suspend mode
(USBEN = 1, SUSPND = 1, bus in Idle state), the USB module current will be dominated by the D+ or D- pull-up
resistor. The integrated pull-up resistors use “resistor switching” according to the resistor_ecn supplement to
the USB 2.0 Specifications, and therefore, may be as low as 900 during Idle conditions.
Param
Device Typ Max Units Conditions
No.
Supply Current (IDD)(2)
PIC18LFXXJ53 0.61 1.25 mA -40°C
VDD = 2.0V,
0.62 1.25 mA +25°C
VDDCORE = 2.0V
0.64 1.35 mA +85°C
PIC18LFXXJ53 0.99 1.70 mA -40°C
VDD = 2.5V,
0.96 1.70 mA +25°C
VDDCORE = 2.5V
0.94 1.82 mA +85°C FOSC = 4 MHz,
PRI_RUN mode,
PIC18FXXJ53 0.78 1.60 mA -40°C EC Oscillator
VDD = 2.15V,
0.78 1.60 mA +25°C
VDDCORE = 10 F
0.78 1.70 mA +85°C
PIC18FXXJ53 1.10 1.95 mA -40°C
VDD = 3.3V,
1.02 1.90 mA +25°C
VDDCORE = 10 F
1.00 2.00 mA +85°C
PIC18LFXXJ53 9.8 14.8 mA -40°C
VDD = 2.5V,
9.5 14.8 mA +25°C
VDDCORE = 2.5V
9.4 15.1 mA +85°C FOSC = 48 MHz,
PRI_RUN mode,
PIC18FXXJ53 10.9 19.5 mA -40°C EC Oscillator
VDD = 3.3V,
10.2 19.5 mA +25°C
VDDCORE = 10 F
9.9 19.5 mA +85°C
Note 1: 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, BOR, etc.).
2: 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. All features that add delta current are disabled (USB module,
WDT, etc.). 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/VSS;
MCLR = VDD; WDT disabled unless otherwise specified.
3: Low-power Timer1 with standard, low-cost 32 kHz crystals have an operating temperature range of -10°C to
+70°C. Extended temperature crystals are available at a much higher cost.
4: This is the module differential current when the USB module is enabled and clocked at 48 MHz, but with no USB
cable attached. When the USB cable is attached or data is being transmitted, the current consumption may be
much higher (see Section 23.6.4 “USB Transceiver Current Consumption”). During USB Suspend mode
(USBEN = 1, SUSPND = 1, bus in Idle state), the USB module current will be dominated by the D+ or D- pull-up
resistor. The integrated pull-up resistors use “resistor switching” according to the resistor_ecn supplement to
the USB 2.0 Specifications, and therefore, may be as low as 900 during Idle conditions.
Param
Device Typ Max Units Conditions
No.
PIC18LFXXJ53 0.18 0.70 mA -40°C
VDD = 2.0V,
0.18 0.70 mA +25°C
VDDCORE = 2.0V
0.19 0.75 mA +85°C
PIC18LFXXJ53 0.23 0.90 mA -40°C
VDD = 2.5V,
0.23 0.90 mA +25°C
VDDCORE = 2.5V
0.24 1.00 mA +85°C FOSC = 4 MHz
PRI_IDLE mode,
PIC18FXXJ53 0.23 0.80 mA -40°C VDD = 2.15V, EC Oscillator
0.24 0.80 mA +25°C VDDCORE = 10 F
0.25 0.85 mA +85°C Capacitor
PIC18FXXJ53 0.32 1.00 mA -40°C VDD = 3.3V,
0.31 1.00 mA +25°C VDDCORE = 10 F
0.32 1.00 mA +85°C Capacitor
PIC18LFXXJ53 2.74 7.00 mA -40°C
VDD = 2.5V,
2.77 6.50 mA +25°C
VDDCORE = 2.5V
2.80 6.50 mA +85°C FOSC = 48 MHz
PRI_IDLE mode,
PIC18FXXJ53 3.48 11.00 mA -40°C VDD = 3.3V, EC Oscillator
3.42 10.00 mA +25°C VDDCORE = 10 F
3.44 10.00 mA +85°C Capacitor
Note 1: 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, BOR, etc.).
2: 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. All features that add delta current are disabled (USB module,
WDT, etc.). 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/VSS;
MCLR = VDD; WDT disabled unless otherwise specified.
3: Low-power Timer1 with standard, low-cost 32 kHz crystals have an operating temperature range of -10°C to
+70°C. Extended temperature crystals are available at a much higher cost.
4: This is the module differential current when the USB module is enabled and clocked at 48 MHz, but with no USB
cable attached. When the USB cable is attached or data is being transmitted, the current consumption may be
much higher (see Section 23.6.4 “USB Transceiver Current Consumption”). During USB Suspend mode
(USBEN = 1, SUSPND = 1, bus in Idle state), the USB module current will be dominated by the D+ or D- pull-up
resistor. The integrated pull-up resistors use “resistor switching” according to the resistor_ecn supplement to
the USB 2.0 Specifications, and therefore, may be as low as 900 during Idle conditions.
Param
Device Typ Max Units Conditions
No.
PIC18LFXXJ53 6.9 11.0 mA -40°C
VDD = 2.5V,
6.7 11.0 mA +25°C
VDDCORE = 2.5V FOSC = 24 MHz
6.4 10.0 mA +85°C PRI_RUN mode,
PIC18FXXJ53 7.0 15.0 mA -40°C ECPLL Oscillator
VDD = 3.3V,
(4 MHz Input)
6.8 14.0 mA +25°C VDDCORE = 10 F
6.6 14.0 mA +85°C Capacitor
PIC18LFXXJ53 9.9 14.0 mA -40°C
VDD = 2.5V,
9.7 14.0 mA +25°C
VDDCORE = 2.5V FOSC = 48 MHz
9.5 14.0 mA +85°C PRI_RUN mode,
PIC18FXXJ53 10.3 21.5 mA -40°C VDD = 3.3V, ECPLL Oscillator
10.0 20.5 mA +25°C VDDCORE = 10 F (4 MHz Input)
Param
Device Typ Max Units Conditions
No.
PIC18LFXXJ53 9 45 A -40°C
VDD = 2.5V,
9 45 A +25°C
VDDCORE = 2.5V
12 61 A +85°C
PIC18FXXJ53 24 95 A -40°C VDD = 2.15V, FOSC = 32 kHz(3)
28 95 A +25°C VDDCORE = 10 F SEC_RUN mode,
35 105 A +85°C Capacitor (SOSCSEL<1:0> = 01)
PIC18FXXJ53 27 110 A -40°C VDD = 3.3V,
31 110 A +25°C VDDCORE = 10 F
35 150 A +85°C Capacitor
PIC18LFXXJ53 2.5 31 A -40°C
VDD = 2.5V,
3.0 31 A +25°C
VDDCORE = 2.5V
6.1 50 A +85°C
PIC18FXXJ53 19 87 A -40°C VDD = 2.15V, FOSC = 32 kHz(3)
24 89 A +25°C VDDCORE = 10 F SEC_IDLE mode,
31 97 A +85°C Capacitor (SOSCSEL<1:0> = 01)
PIC18FXXJ53 21 100 A -40°C VDD = 3.3V,
25 100 A +25°C VDDCORE = 10 F
31 140 A +85°C Capacitor
Note 1: 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, BOR, etc.).
2: 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. All features that add delta current are disabled (USB module,
WDT, etc.). 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/VSS;
MCLR = VDD; WDT disabled unless otherwise specified.
3: Low-power Timer1 with standard, low-cost 32 kHz crystals have an operating temperature range of -10°C to
+70°C. Extended temperature crystals are available at a much higher cost.
4: This is the module differential current when the USB module is enabled and clocked at 48 MHz, but with no USB
cable attached. When the USB cable is attached or data is being transmitted, the current consumption may be
much higher (see Section 23.6.4 “USB Transceiver Current Consumption”). During USB Suspend mode
(USBEN = 1, SUSPND = 1, bus in Idle state), the USB module current will be dominated by the D+ or D- pull-up
resistor. The integrated pull-up resistors use “resistor switching” according to the resistor_ecn supplement to
the USB 2.0 Specifications, and therefore, may be as low as 900 during Idle conditions.
Param
Device Typ Max Units Conditions
No.
Module Differential Currents (IWDT, IHLVD, IOSCB, IAD, IUSB)
D022
(IWDT) Watchdog Timer 0.38 4.0 A -40°C
VDD = 2.5V,
0.41 4.0 A +25°C PIC18LFXXJ53
VDDCORE = 2.5V
0.44 5.2 A +85°C
0.33 4.0 A -40°C VDD = 2.15V,
0.33 4.0 A +25°C VDDCORE = 10 F
0.39 6.0 A +85°C Capacitor
PIC18FXXJ53
0.49 8.0 A -40°C VDD = 3.3V,
0.48 8.0 A +25°C VDDCORE = 10 F
0.45 9.0 A +85°C Capacitor
D022B High/Low-Voltage Detect 4.1 8.0 A -40°C
(IHLVD) VDD = 2.5V,
4.9 8.0 A +25°C PIC18LFXXJ53
VDDCORE = 2.5V
5.8 9.0 A +85°C
2.6 6.0 A -40°C VDD = 2.15V,
3.0 6.0 A +25°C VDDCORE = 10 F
3.5 8.0 A +85°C Capacitor
PIC18FXXJ53
3.4 9.0 A -40°C VDD = 3.3V,
3.9 9.0 A +25°C VDDCORE = 10 F
4.2 12.0 A +85°C Capacitor
Note 1: 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, BOR, etc.).
2: 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. All features that add delta current are disabled (USB module,
WDT, etc.). 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/VSS;
MCLR = VDD; WDT disabled unless otherwise specified.
3: Low-power Timer1 with standard, low-cost 32 kHz crystals have an operating temperature range of -10°C to
+70°C. Extended temperature crystals are available at a much higher cost.
4: This is the module differential current when the USB module is enabled and clocked at 48 MHz, but with no USB
cable attached. When the USB cable is attached or data is being transmitted, the current consumption may be
much higher (see Section 23.6.4 “USB Transceiver Current Consumption”). During USB Suspend mode
(USBEN = 1, SUSPND = 1, bus in Idle state), the USB module current will be dominated by the D+ or D- pull-up
resistor. The integrated pull-up resistors use “resistor switching” according to the resistor_ecn supplement to
the USB 2.0 Specifications, and therefore, may be as low as 900 during Idle conditions.
Param
Device Typ Max Units Conditions
No.
D025 Module Differential Currents (IWDT, IHLVD, IOSCB, IAD, IUSB)
(IOSCB)
Real-Time Clock/Calendar 0.5 4.0 A -40°C
with Low-Power Timer1 0.7 4.5 A +25°C VDD = 2.15V,
Oscillator VDDCORE = 10 F
0.8 4.5 A +60°C Capacitor
0.9 4.5 A +85°C
0.6 4.5 A -40°C
0.8 5.0 A +25°C VDD = 2.5V, PIC18FXXJ53
VDDCORE = 10 F 32.768 kHz(3), T1OSCEN = 1,
0.9 5.0 A +60°C Capacitor (SOSCSEL<1:0> = 01)
1.0 5.0 A +85°C
0.8 6.5 A -40°C
1.0 6.5 A +25°C VDD = 3.3V,
VDDCORE = 10 F
1.1 8.0 A +60°C Capacitor
1.3 8.0 A +85°C
Note 1: 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, BOR, etc.).
2: 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. All features that add delta current are disabled (USB module,
WDT, etc.). 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/VSS;
MCLR = VDD; WDT disabled unless otherwise specified.
3: Low-power Timer1 with standard, low-cost 32 kHz crystals have an operating temperature range of -10°C to
+70°C. Extended temperature crystals are available at a much higher cost.
4: This is the module differential current when the USB module is enabled and clocked at 48 MHz, but with no USB
cable attached. When the USB cable is attached or data is being transmitted, the current consumption may be
much higher (see Section 23.6.4 “USB Transceiver Current Consumption”). During USB Suspend mode
(USBEN = 1, SUSPND = 1, bus in Idle state), the USB module current will be dominated by the D+ or D- pull-up
resistor. The integrated pull-up resistors use “resistor switching” according to the resistor_ecn supplement to
the USB 2.0 Specifications, and therefore, may be as low as 900 during Idle conditions.
Param
Device Typ Max Units Conditions
No.
Module Differential Currents (IWDT, IHLVD, IOSCB, IAD, IUSB)
D026 A/D Converter 0.5 4.0 A -40°C
(IAD) VDD = 2.5V, PIC18LFXXJ53
0.5 4.0 A +25°C
VDDCORE = 2.5V A/D on, not converting
0.5 4.0 A +85°C
1.1 5.0 A -40°C VDD = 2.15V,
1.1 5.0 A +25°C VDDCORE = 10 F
1.1 5.0 A +85°C Capacitor
PIC18FXXJ53
3.2 11 A -40°C A/D on, not converting
VDD = 3.3V,
3.2 11 A +25°C VDDCORE = 10 F
3.2 11 A +85°C Capacitor
Param
Symbol Characteristic Min Max Units Conditions
No.
VIL Input Low Voltage
All I/O ports:
D030 with TTL Buffer(4) VSS 0.15 VDD V VDD < 3.3V
(4)
D030A with TTL Buffer VSS 0.8 V 3.3V < VDD <3.6V
D031 with Schmitt Trigger Buffer VSS 0.2 VDD V
D031A SCLx/SDAx — 0.3 VDD V I2C™ enabled
D031B SCLx/SDAx — 0.8 V SMBus enabled
D032 MCLR VSS 0.2 VDD V
D033 OSC1 VSS 0.3 VDD V HS, HSPLL modes
D033A OSC1 VSS 0.2 VDD V EC, ECPLL modes
D034 T1OSI VSS 0.3 V T1OSCEN = 1
VIH Input High Voltage
I/O Ports without 5.5V
Tolerance:
D040 with TTL Buffer(4) 0.25 VDD + 0.8V VDD V VDD < 3.3V
D040A with TTL Buffer(4) 2.0 VDD V 3.3V < VDD <3.6V
D041 with Schmitt Trigger Buffer 0.8 VDD VDD V
I/O Ports with 5.5V Tolerance:(5)
Dxxx with TTL Buffer 0.25 VDD + 0.8V 5.5 V VDD < 3.3V
DxxxA 2.0 5.5 V 3.3V VDD 3.6V
Dxxx with Schmitt Trigger Buffer 0.8 VDD 5.5 V
D041A SCLx/SDAx 0.7 VDD — V I2C™ enabled
D041B SCLx/SDAx 2.1 — V SMBus enabled; VDD > 3V
D042 MCLR 0.8 VDD 5.5 V
D043 OSC1 0.7 VDD VDD V HS, HSPLL modes
D043A OSC1 0.8 VDD VDD V EC, ECPLL modes
D044 T1OSI 1.6 VDD V T1OSCEN = 1
IIL (1,2)
Input Leakage Current
D060 I/O Ports ±5 ±200 nA VSS VPIN VDD,
Pin at high-impedance
D061 MCLR ±5 ±200 nA Vss VPIN VDD
D062 D+/D- ±75 typical ±500 nA Vss VPIN VDD
D063 OSC1 ±5 ±200 nA Vss VPIN VDD
IPU Weak Pull-up Current
D070 IPURB PORTB, PORTD(3) and 80 400 A VDD = 3.3V, VPIN = VSS
PORTE(3) Weak Pull-up Current
Note 1: The leakage current on the MCLR pin is strongly dependent on the applied voltage level. The specified levels represent
normal operating conditions. Higher leakage current may be measured at different input voltages.
2: Negative current is defined as current sourced by the pin.
3: Only available in 44-pin devices.
4: When used as general purpose inputs, the RC4 and RC5 thresholds are referenced to VUSB instead of VDD.
5: Refer to Table 10-2 for pin tolerance levels.
Param
Symbol Characteristic Min Max Units Conditions
No.
VOL Output Low Voltage
D080 I/O Ports:
PORTA (except RA6), — 0.4 V IOL = 4 mA, VDD = 3.3V,
PORTD(3), PORTE(3) -40C to +85C
PORTB, PORTC, RA6 — 0.4 V IOL = 8.5 mA, VDD = 3.3V,
-40C to +85C
VOH Output High Voltage
D090 I/O Ports: V
PORTA (except RA6), 2.4 — V IOH = -3 mA, VDD = 3.3V,
PORTD(3), PORTE(3) -40C to +85C
PORTB, PORTC, RA6 2.4 — V IOH = -6 mA, VDD = 3.3V,
-40C to +85C
Capacitive Loading Specs
on Output Pins
D101 CIO All I/O Pins and OSC2 — 50 pF To meet the AC Timing
Specifications
D102 CB SCLx, SDAx — 400 pF I2C™ Specification
Note 1: The leakage current on the MCLR pin is strongly dependent on the applied voltage level. The specified levels represent
normal operating conditions. Higher leakage current may be measured at different input voltages.
2: Negative current is defined as current sourced by the pin.
3: Only available in 44-pin devices.
4: When used as general purpose inputs, the RC4 and RC5 thresholds are referenced to VUSB instead of VDD.
5: Refer to Table 10-2 for pin tolerance levels.
Param
Sym Characteristics Min Typ Max Units Comments
No.
D300 VIOFF Input Offset Voltage — +5 +25 mV
D301 VICM Input Common Mode Voltage 0 — VDD V
VIRV Internal Reference Voltage 0.57 0.60 0.63 V
D302 CMRR Common Mode Rejection Ratio 55 — — dB
300 TRESP Response Time(1) — 150 400 ns
301 TMC2OV Comparator Mode Change to — — 10 s
Output Valid
Note 1: Response time measured with one comparator input at VDD/2, while the other input transitions from VSS to
VDD.
Param
Sym Characteristics Min Typ Max Units Comments
No.
VRGOUT Regulator Output Voltage 2.35 2.5 2.7 V Regulator enabled, VDD = 3.0V
CEFC External Filter Capacitor 5.4 10 18 F ESR < 3 recommended
Value(1) ESR < 5 required
Note 1: CEFC applies for PIC18F devices in the family. For PIC18LF devices in the family, there is no specific
minimum or maximum capacitance for VDDCORE, although proper supply rail bypassing should still be
used.
Param
Sym Characteristics Min Typ Max Units Comments
No.
D313 VUSB USB Voltage 3.0 — 3.6 V Voltage on VUSB pin must
be in this range for proper
USB operation
D314 IIL Input Leakage on D+ or D- — — +0.2 A VSS < VPIN < VUSB
D315 VILUSB Input Low Voltage for — — 0.8 V For VUSB range
USB Buffer
D316 VIHUSB Input High Voltage for 2.0 — — V For VUSB range
USB Buffer
D318 VDIFS Differential Input Sensitivity — — 0.2 V The difference between D+
and D- must exceed this
value while VCM is met
D319 VCM Differential Common Mode 0.8 — 2.5 V
Range
D320 ZOUT Driver Output Impedance(1) 28 — 44
D321 VOL Voltage Output Low 0.0 — 0.3 V 1.5 kload connected to
3.6V
D322 VOH Voltage Output High 2.8 — 3.6 V 1.5 kload connected to
ground
Note 1: The D+ and D- signal lines have built-in impedance matching resistors. No external resistors, capacitors or
magnetic components are necessary on the D+/D- signal paths between the PIC18F47J53 family device
and a USB cable.
VHLVD
VHLVD
HLVDIF
Param
Symbol Characteristic Min Typ Max Units Conditions
No.
D420 HLVD Voltage on VDD HLVDL<3:0> = 1000 2.33 2.45 2.57 V
Transition High-to-Low HLVDL<3:0> = 1001 2.47 2.60 2.73 V
HLVDL<3:0> = 1010 2.66 2.80 2.94 V
HLVDL<3:0> = 1011 2.76 2.90 3.05 V
HLVDL<3:0> = 1100 2.85 3.00 3.15 V
HLVDL<3:0> = 1101 2.97 3.13 3.29 V
HLVDL<3:0> = 1110 3.23 3.40 3.57 V
D421 TIRVST Time for Internal Reference Voltage to — 50 — s
become Stable
D422 TLVD High/Low-Voltage Detect Pulse Width 200 — — s
VDD/2
RL Pin CL
VSS
CL
Pin
RL = 464
VSS CL = 50 pF for all pins except OSC2/CLKO/RA6
and including D and E outputs as ports
CL = 15 pF for OSC2/CLKO/RA6
OSC1
1 3 3 4 4
2
CLKO
OSC1
10 11
CLKO
13 12
14 19 18
16
I/O pin
(Input)
17 15
20, 21
VDD
MCLR
30
Internal
POR
33
PWRT
Time-out 32
Oscillator
Time-out
Internal
Reset
Watchdog
Timer
Reset
31
34 34
I/O pins
TABLE 31-14: RESET, WATCHDOG TIMER, OSCILLATOR START-UP TIMER, POWER-UP TIMER
AND BROWN-OUT RESET REQUIREMENTS
Param.
Symbol Characteristic Min Typ Max Units Conditions
No.
T0CKI
40 41
42
T1OSO/T1CKI
45 46
47 48
TMR0 or
TMR1
ECCPx
(Capture Mode)
50 51
52
ECCPx
(Compare or PWM Mode)
53 54
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2
System
Clock
PMA<13:18> Address
PM6
PM2
PM7
PM3
PMRD
PM5
PMWR
PMALL/PMALH
PM1
PMCS<2:1>
Operating Conditions: 2.0V < VDD < 3.6V, -40°C < TA < +85°C unless otherwise stated.
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2
System
Clock
PMA<13:18> Address
PM12 PM13
PMRD
PMWR
PM11
PMALL/
PMALH
PMCS<2:1>
PM16
Note: Operating Conditions: 2.0V < VDD < 3.6V, -40°C < TA < +85°C unless otherwise stated.
SCKx
(CKP = 0)
78 79
SCKx
(CKP = 1)
79 78
75, 76
81
SCKx
(CKP = 0)
79
73
SCKx
(CKP = 1)
78
75, 76
74
SSx
70
SCKx
(CKP = 0) 83
71 72
SCKx
(CKP = 1)
80
75, 76 77
SDIx
SDI MSb In bit 6 - - - - 1 LSb In
74
73
TABLE 31-22: EXAMPLE SPI MODE REQUIREMENTS (SLAVE MODE TIMING, CKE = 0)
Param
Symbol Characteristic Min Max Units Conditions
No.
70
SCKx 83
(CKP = 0)
71 72
73
SCKx
(CKP = 1)
80
75, 76 77
SDI
SDIx
MSb In bit 6 - - - - 1 LSb In
74
Note: Refer to Figure 31-4 for load conditions.
SCLx
91 93
90 92
SDAx
Start Stop
Condition Condition
91 92
SDAx
In
110
109 109
SDAx
Out
91 THD:STA Start Condition Hold Time 100 kHz mode 4.0 — s After this period, the first clock
400 kHz mode 0.6 — s pulse is generated
SCLx
91 93
90 92
SDAx
Start Stop
Condition Condition
SDAx
Out
TXx/CKx
pin
121 121
RXx/DTx
pin
120
122
Note: Refer to Figure 31-4 for load conditions.
TXx/CKx
pin 125
RXx/DTx
pin
126
BSF ADCON0, GO
(Note 2)
131
Q4
130
A/D CLK 132
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.
90%
VCRS
10%
XXXXXXXX 18F27J53
XXXXXXXX /ML e3
YYWWNNN 0910017
XXXXXXXXXXXXXXXXXXXX PIC18F27J53/SO e3
PIC18F26J50/SO
XXXXXXXXXXXXXXXXXXXX 0910017
XXXXXXXXXXXXXXXXXXXX
YYWWNNN
XXXXXXXXXXXXXXXXX PIC18F27J53
XXXXXXXXXXXXXXXXX -I/SP e3
YYWWNNN 0910017
XXXXXXXXXXXX PICXXFXXXX
XXXXXXXXXXXX -I/SS
YYWWNNN 0610017
XXXXXXXXXX 18F47J53
XXXXXXXXXX -I/ML e3
XXXXXXXXXX 0910017
YYWWNNN
XXXXXXXXXX 18F47J53
XXXXXXXXXX -I/PT e3
XXXXXXXXXX 0910017
YYWWNNN
!"
#
$ %&'' ()
)
$
* 2%
& %!
%
*
") '
%
*
$%%
"%
%%
133)))&
&3
*
D D2
EXPOSED
PAD
E
b
E2
2 2
1 1 K
N N
NOTE 1 L
TOP VIEW BOTTOM VIEW
A3 A1
4% 55,,
&
5&% 6 67 8
6!&(
$ 6 9
%
:./0
7
;
% 9
%"$$ .
0%%*
+ ,2
7
<"% , :/0
,#
""<"% , +:. +
7
5
% :/0
,#
""5
% +:. +
0%%<"% ( + + +.
0%%5
% 5 . ..
0%% % ,#
"" = > >
*
!"
#$
%!
&'(!%&! %(
%
")%%
%
"
*
) !%
"
+ &
"%
,-.
/01 / &
%
#%!
))%!%%
,21
$
&
'! !)%!%%
'$$&%
!
) 0 ./
!"
#
$ %&'' ()
)
$
* 2%
& %!
%
*
") '
%
*
$%%
"%
%%
133)))&
&3
*
+ ,
) +, - .&'% !+,/("
* 2%
& %!
%
*
") '
%
*
$%%
"%
%%
133)))&
&3
*
D
N
E
E1
NOTE 1
1 2 3
e
b
h
α
h
φ c
A A2
L
A1 L1 β
4% 55,,
&
5&% 6 67 8
6!&(
$ 6 9
%
/0
7
;
% > > :.
"
"*
*
. > >
%"$$? > +
7
<"% , +/0
"
"*
<"% , ./0
7
5
% /0
0&$
@
%A . > .
2%5
% 5 >
2%
% 5 ,2
2%
I B > 9B
5
"*
9 > ++
5
"<"% ( + > .
"$%
D .B > .B
"$%
/%%& E .B > .B
*
!"
#$
%!
&'(!%&! %(
%
")%%
%
"
?$%0%
%
+ &
","%!"
&"$
%! "$
%! %
#
".&&
"
&
"%
,-.
/01 / &
%
#%!
))%!%%
,21
$
&
'! !)%!%%
'$$&%
!
) 0 ./
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
+))
0 /)) +
1%% !+
0/
"
* 2%
& %!
%
*
") '
%
*
$%%
"%
%%
133)))&
&3
*
N
NOTE 1
E1
1 2 3
A A2
L c
A1 b1
b e eB
4% 60;,
&
5&% 6 67 8
6!&(
$ 6 9
%
/0
%
%
> >
"
"*
*
+. .
/
%
%
. > >
!"
%!"
<"% , + ++.
"
"*
<"% , 9. .
7
5
% +. +:.
%
%
5 + .
5
"*
9 .
4
) 0 /
+$2) + ,
) ++ '&1% !++,
"
* 2%
& %!
%
*
") '
%
*
$%%
"%
%%
133)))&
&3
*
D
N
E
E1
1 2
b
NOTE 1
e
c
A A2
φ
A1
L1 L
4% 55,,
&
5&% 6 67 8
6!&(
$ 6 9
%
:./0
7
;
% > >
"
"*
*
:. . 9.
%"$$ . > >
7
<"% , 9 9
"
"*
<"% , . .+ .:
7
5
% .
2%5
% 5 .. . .
2%
% 5 .,2
5
"*
> .
2%
I B B 9B
5
"<"% ( > +9
*
!"
#$
%!
&'(!%&! %(
%
")%%
%
"
&
","%!"
&"$
%! "$
%! %
#
"&&
"
+ &
"%
,-.
/01 / &
%
#%!
))%!%%
,21
$
&
'! !)%!%%
'$$&%
!
) 0 +/
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
33
!"
* 2%
& %!
%
*
") '
%
*
$%%
"%
%%
133)))&
&3
*
D D2
EXPOSED
PAD
E2
b
2 2
1 1
N N K
NOTE 1 L
A3 A1
4% 55,,
&
5&% 6 67 8
6!&(
$ 6
%
:./0
7
;
% 9
%"$$ .
0%%*
+ ,2
7
<"% , 9/0
,#
""<"% , :+ :. :9
7
5
% 9/0
,#
""5
% :+ :. :9
0%%<"% ( . + +9
0%%5
% 5 + .
0%% % ,#
"" = > >
*
!"
#$
%!
&'(!%&! %(
%
")%%
%
"
*
) !%
"
+ &
"%
,-.
/01 / &
%
#%!
))%!%%
,21
$
&
'! !)%!%%
'$$&%
!
) 0 +/
33
!"
* 2%
& %!
%
*
") '
%
*
$%%
"%
%%
133)))&
&3
*
33
4$)
5
4 6%6%6 &%% !4
"
* 2%
& %!
%
*
") '
%
*
$%%
"%
%%
133)))&
&3
*
D
D1
E
e
E1
N
b
NOTE 1 1 2 3
NOTE 2
A α
c φ
β A1 A2
L L1
4% 55,,
&
5&% 6 67 8
6!&(
$5
" 6
5
"%
9/0
7
;
% > >
"
"*
*
. .
%"$$ . > .
2%5
% 5 . : .
2%
% 5 ,2
2%
I B +.B B
7
<"% , /0
7
5
% /0
"
"*
<"% , /0
"
"*
5
% /0
5
"*
>
5
"<"% ( + + .
"$%
D B B +B
"$%
/%%& E B B +B
*
!"
#$
%!
&'(!%&! %(
%
")%%
%
"
0&$
%
%D E
&
+ &
","%!"
&"$
%! "$
%! %
#
".&&
"
&
"%
,-.
/01 / &
%
#%!
))%!%%
,21
$
&
'! !)%!%%
'$$&%
!
) 0 :/
33
4$)
5
4 6%6%6 &%% !4
"
* 2%
& %!
%
*
") '
%
*
$%%
"%
%%
133)))&
&3
*
From: Name
Company
Address
City / State / ZIP / Country
Telephone: (_______) _________ - _________ FAX: (______) _________ - _________
Application (optional):
Would you like a reply? Y N
Questions:
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?
Package ML = QFN
PT = TQFP (Thin Quad Flatpack)
SO = SOIC
SP = Skinny Plastic DIP
SS = SSOP
01/05/10