Note 1: Special ICPORT programming/debug port features available when ICPRT = 1
Pin Diagram
DS30684A-page 4 2012 Microchip Technology Inc.
2012 Microchip Technology Inc.DS30684A-page 5
TABLE 1:PIC18(L)F2X/45K50 PIN SUMMARY
I/O
28-Pin QFN
40-Pin PDIP
28-PIn PDIP/SOIC/SSOP
RA022721719AN0C12IN0-
RA132831820AN1C12IN1- CTCMP
RA24141921AN2C2IN+VREF-
RA35252022AN3C1IN+VREF+
RA46362123C1OUTSRQT0CKI
RA57472224AN4C2OUT
RA6107142931OSC2
RA796132830OSC1
RB021183388AN12SRIFLT0SDI
RB122193499AN10C12IN3-P1C
RB223 2035 1010AN8CTED1P1B
RB32421361111AN9C12IN2- CTED2CCP2
RB42522371214AN11P1D
RB52623381315AN13T1G
RB62724391416IOCB6YPGC
RB72825401517IOCB7YPGD
Note 1: Alternate CCP2 pin location based on Configuration bit.
2: Alternate T3CKI pin location based on Configuration bits.
3: Pins are enabled when ICPRT = 1, otherwise, they are disabled.
4: Location on 40/44-Pin parts (PIC18(L)F45K50). Function not on this pin on 28-Pin parts (PIC18(L)F2XK50).
5: Location on 28-Pin parts (PIC18(L)F2XK50). Function not on this pin on 40/44-Pin parts (PIC18(L)F45K50).
6: Alternate SDO pin location based on Configuration bits.
7: RE3 can be used for digital input only (no output functionality).
40-Pin UQFN
44-Pin TQFP
Analog
Comparator
CTMU
SR Latch
SRNQ
Reference
DACOUT
HLVDIN
USB
(E)CCP
(5)
(5)
(1)
(5)
EUSART
MSSP
SS
SDA
SCK
SCL
SDOY
T3CKI
Timers
(2)
Interrupts
INT0Y
INT1Y
INT2Y
IOCB4Y
IOCB5Y
Pull-up
CLKO
CLKI
Basic
ICD
PIC18(L)F2X/45K50
DS30684A-page 6 2012 Microchip Technology Inc.
TABLE 1:PIC18(L)F2X/45K50 PIN SUMMARY
PIC18(L)F2X/45K50
I/O
28-Pin QFN
40-Pin PDIP
28-PIn PDIP/SOIC/SSOP
RC0118153032SOSCO
RC1129163135CCP2SOSCI IOCC1
RC21310173236AN14CTPLSCCP1
—1411183337—VUSB3V3VDDCORE
—15 12233842—D-IOCC4
—16 13243943—D+IOCC5
RC61714254044AN18TX
RC718152611AN19RXDTSDO
RD0——193438AN20
RD1——203539AN21
RD2——213640AN22
RD3——223741AN23
RD4——2722AN24
RD5——2833AN25P1B
RD6——2944AN26P1C
RD7——3055AN27P1D
——
RE0
Note 1: Alternate CCP2 pin location based on Configuration bit.
2: Alternate T3CKI pin location based on Configuration bits.
3: Pins are enabled when ICPRT = 1, otherwise, they are disabled.
4: Location on 40/44-Pin parts (PIC18(L)F45K50). Function not on this pin on 28-Pin parts (PIC18(L)F2XK50).
5: Location on 28-Pin parts (PIC18(L)F2XK50). Function not on this pin on 40/44-Pin parts (PIC18(L)F45K50).
6: Alternate SDO pin location based on Configuration bits.
7: RE3 can be used for digital input only (no output functionality).
823 25 AN5
40-Pin UQFN
44-Pin TQFP
Analog
Comparator
CTMU
SR Latch
Reference
USB
P1A
(E)CCP
(4)
(4)
(4)
EUSART
CK
MSSP
(6)
Timers
T1CKI
T3CKI
T3G
Interrupts
IOCC0
IOCC2
IOCC6
IOCC7
Pull-up
Basic
ICD
2012 Microchip Technology Inc.DS30684A-page 7
TABLE 1:PIC18(L)F2X/45K50 PIN SUMMARY
I/O
28-Pin QFN
40-Pin PDIP
28-PIn PDIP/SOIC/SSOP
——
RE1
——
RE2
(7)
RE3
Note 1: Alternate CCP2 pin location based on Configuration bit.
126
201711, 327, 267,
8,195,1612,316,276,
2: Alternate T3CKI pin location based on Configuration bits.
3: Pins are enabled when ICPRT = 1, otherwise, they are disabled.
4: Location on 40/44-Pin parts (PIC18(L)F45K50). Function not on this pin on 28-Pin parts (PIC18(L)F2XK50).
5: Location on 28-Pin parts (PIC18(L)F2XK50). Function not on this pin on 40/44-Pin parts (PIC18(L)F45K50).
6: Alternate SDO pin location based on Configuration bits.
7: RE3 can be used for digital input only (no output functionality).
2.0Guidelines for Getting Started with PIC18(L)F2X/45K50 Microcontrollers ................................................................................ 27
7.0Flash Program Memory........................................................................................................................................................... 101
16.0 Master Synchronous Serial Port (MSSP) Module ................................................................................................................... 215
20.0 Charge Time Measurement Unit (CTMU)................................................................................................................................ 325
21.0 SR L
22.0 Fixed Voltage Reference (FVR)............................................................................................................................................... 347
24.0 Universal Serial Bus (USB) ..................................................................................................................................................... 353
26.0 Special Features of the CPU ................................................................................................................................................... 387
27.0 Instruction Set Summary ......................................................................................................................................................... 407
28.0 Development Support.............................................................................................................................................................. 457
30.0 DC and AC Characteristics Graphs and Charts ...................................................................................................................... 501
Index ................................................................................................................................................................................................. 523
The Microchip Web Site.................................................................................................................................................................... 533
Customer Change Notification Service ............................................................................................................................................. 533
Customer Support ............................................................................................................................................................................. 533
It is our intention to provide our valued customers with the best documentation possible to ensure successful use of your Microchip
products. To this end, we will continue to improve our publications to better suit your needs. Our publications will be refined and
enhanced as new volumes and updates are introduced.
If you have any questions or comments regarding this publication, please contact the Marketing Communications Department via
E-mail at docerrors@microchip.com or fax the Reader Response Form in the back of this data sheet to (480) 792-4150. We
welcome your feedback.
Most Current Data Sheet
To obtain the most up-to-date version of this data sheet, please register at our Worldwide Web site at:
http://www.microchip.com
You can determine the version of a data sheet by examining its literature number found on the bottom outside corner of any page.
The last character of the literature number is the version number, (e.g., DS30000A is version A of document DS30000).
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.
Customer Notification System
Register on our web site at www.microchip.com to receive the most current information on all of our products.
2012 Microchip Technology Inc.DS30684A-page 9
PIC18(L)F2X/45K50
NOTES:
DS30684A-page 10 2012 Microchip Technology Inc.
PIC18(L)F2X/45K50
1.0DEVICE OVERVIEW
This document contains device-specific information for
the following devices:
•PIC18(L)F45K50
•PIC18(L)F25K50
•PIC18(L)F24K50
This family offers the advantages of all PIC18
microcontrollers – namely, high computational
performance at an economical price – with the addition
of high-endurance, Flash program memory. On top of
these features, the PIC18(L)F2X/45K50 family
introduces design enhancements that make these
microcontrollers a logical choice for many highperformance, power sensitive applications.
1.1New Core Features
1.1.1XLP TECHNOLOGY
All of the devices in the PIC18(L)F2X/45K50 family
incorporate a range of features that can significantly
reduce power consumption during operation. Key
items include:
• Alternate Run Modes: By clocking the controller
from the Timer1 source or the internal oscillator
block, power consumption during code execution
can be reduced by as much as 90%.
• Multiple Idle Modes: The controller can also run
with its CPU core disabled but the peripherals still
active. In these states, power consumption can be
reduced even further, to as little as 4% of normal
operation requirements.
• Peripheral Module Disable bits: User code can
power down individual peripheral modules during
Run and Idle modes for further lowering dynamic
power reduction.
• On-the-fly Mode Switching: The power-
managed modes are invoked by user code during
operation, allowing the user to incorporate powersaving ideas into their application’s software
design.
• Low Consumption in Key Modules: The
power requirements for both Timer1 and the
Watchdog Timer are minimized. See
Section 29.0 “Electrical Characteristics”
for values.
1.1.2UNIVERSAL SERIAL BUS (USB)
Devices in the PIC18(L)F2X/45K50 family incorporate
a fully-featured USB communications module with a
built-in transceiver that is compliant with the USB
Specification Revision 2.0. The module supports both
low-speed and full-speed communication for all
supported data transfer types. The device
incorporates its own on-chip transceiver and 3.3V
regulator for USB.
1.1.3MULTIPLE OSCILLATOR OPTIONS
AND FEATURES
All of the devices in the PIC18(L)F2X/45K50 family
offer ten different oscillator options, allowing users a
wide range of choices in developing application
hardware. These include:
• Four Crystal modes, using crystals or ceramic
resonators
• Six External Clock modes, offering the option of
using two pins (oscillator input and a divide-by-4
clock output) or one pin (oscillator input, with the
second pin reassigned as general I/O)
• Two External RC Oscillator modes with the same
pin options as the External Clock modes
• An internal oscillator block which contains a
16 MHz HFINTOSC oscillator and a 31 kHz
INTRC oscillator, which together provide eight
user selectable clock frequencies, from 31 kHz to
16 MHz. This option frees the two oscillator pins
for use as additional general purpose I/O.
• 3x and 4x Phase Lock Loop (PLL) frequency
multipliers, available to both external and internal
oscillator modes, which allows clock speeds of up
to 48 MHz. Used with the internal oscillator, the
PLL gives users a complete selection of clock
speeds, from 31 kHz to 48 MHz – all without using
an external crystal or clock circuit.
Besides its availability as a clock source, the internal
oscillator block provides a stable reference source that
gives the family additional features for robust
operation:
• Active Clock Tuning: This option allows the
internal oscillator to automatically tune itself to
match USB host or external 32.768 kHz
secondary oscillator clock sources. Full-speed
USB operation can now meet specification
requirements without an external crystal, enabling
lower-cost designs.
• Fail-Safe Clock Monitor: This option constantly
monitors the main clock source against a
reference signal provided by the INTRC. If a clock
failure occurs, the controller is switched to the
internal oscillator block, allowing for continued
operation or a safe application shutdown.
• T wo-Speed Start-up: This option allows the
internal oscillator to serve as the clock source
from Power-on Reset, or wake-up from Sleep
mode, until the primary clock source is available.
2012 Microchip Technology Inc.DS30684A-page 11
PIC18(L)F2X/45K50
1.2Other Special Features
• Memory Endurance: The Flash cells for both
program memory and data EEPROM are rated to
last for many thousands of erase/write cycles – up to
10K for program memory and 100K for EEPROM.
Data retention without refresh is conservatively
estimated to be greater than 40 years.
• Self-programmability: These devices can write
to their own program memory spaces under internal software control. By using a bootloader routine
located in the protected Boot Block at the top of
program memory, it becomes possible to create
an application that can update itself in the field.
• Extended Instruction Set: The PIC18(L)F2X/
45K50 family introduces an optional extension to
the PIC18 instruction set, which adds eight new
instructions and an Indexed Addressing mode.
This extension, enabled as a device configuration
option, has been specifically designed to optimize
re-entrant application code originally developed in
high-level languages, such as C.
• Enhanced CCP module: In PWM mode, this
module provides 1, 2 or 4 modulated outputs for
controlling half-bridge and full-bridge drivers.
Other features include:
- Auto-shutdown, for disabling PWM outputs
on interrupt or other select conditions
- Auto-restart, to reactivate outputs once the
condition has cleared
- Output steering to selectively enable one or
more of four outputs to provide the PWM
signal.
• Enhanced Addressable EUSART: This serial
communication module is capable of standard
RS-232 operation and provides support for the LIN
bus protocol. Other enhancements include
automatic baud rate detection and a 16-bit Baud
Rate Generator for improved resolution. When the
microcontroller is using the internal oscillator
block, the EUSART provides stable operation for
applications that talk to the outside world without
using an external crystal (or its accompanying
power requirement).
• 10-bit A/D Converter: This module incorporates
programmable acquisition time, allowing for a
channel to be selected and a conversion to be
initiated without waiting for a sampling period and
thus, reduce code overhead.
• Dedicated ICD/ICSP™ Port: These devices
introduce the use of debugger and programming
pins that are not multiplexed with other
microcontroller features. Offered as an option in
the TQFP packaged devices, this feature allows
users to develop I/O intensive applications while
retaining the ability to program and debug in the
circuit.
• Charge Time Measurement Unit (CTMU):
• SR Latch Output:
1.3Details on Individual Family
Members
Devices in the PIC18(L)F2X/45K50 family are available
in 28-pin and 40/44-pin packages. The block diagram
for the device family is shown in Figure 1-1.
The devices have the following differences:
1.Flash program memory
2. A/D channels
3.I/O ports
4.Input Voltage Range/Power Consumption
All other features for devices in this family are identical.
These are summarized in Ta bl e 1 -1 .
The pinouts for all devices are listed in the pin summary
table: Ta bl e 1 , and I/O description tables: Tab l e 1 -2 and
Legend:TTL = TTL compatible input; CMOS = CMOS compatible input or output; ST = Schmitt Trigger input with CMOS levels;
I = Input; O = Output; P = Power.
Note1: Default pin assignment for SDO, T3CKI and CCP2 when Configuration bits SDOMX, T3CMX and CCP2MX are set.
2: Alternate pin assignment for SDO, T3CKI and CCP2 when Configuration bits SDOMX, T3CMX and CCP2MX are clear.
3: Pin is “No Connect”, except on PIC18(L)F45K50 TQFP devices with ICPRT Configuration bit set.
Pin Name
RA0/C12IN0-/AN0
RA0I/OTTL/DIG Digital I/O.
C12IN0-IAnalog Comparators C1 and C2 inverting input.
AN0IAnalog Analog input 0.
RA1/C12IN1-/AN1
RA1I/OTTL/DIG Digital I/O.
C12IN1-IAnalog Comparators C1 and C2 inverting input.
AN1IAnalog Analog input 1.
RA2/C2IN+/AN2/DACOUT/VREF-
RA2I/OTTL/DIG Digital I/O.
C2IN+IAnalog Comparator C2 non-inverting input.
AN2IAnalog Analog input 2.
DACOUTOAnalog DAC Reference output.
REF-IAnalog A/D reference voltage (low) input.
V
RA3/C1IN+/AN3/VREF+
RA3I/OTTL/DIG Digital I/O.
C1IN+IAnalog Comparator C1 non-inverting input.
AN3IAnalog Analog input 3.
REF+IAnalog A/D reference voltage (high) input.
V
RA4/C1OUT/SRQ/T0CKI
RA4I/OST/DIG Digital I/O.
C1OUTODIGComparator C1 output.
SRQOTTLSR latch Q output.
T0CKIISTTimer0 external clock input.
RA5/C2OUT/SRNQ/SS/HLVDIN/AN4
RA5I/OTTL/DIG Digital I/O.
C2OUTODIGComparator C2 output.
SRNQODIGSR latch Q output.
SSITTLSPI slave select input (MSSP).
HLVDINIAnalog High/Low-Voltage Detect input.
AN4IAnalog Analog input 4.
RA6/CLKO/OSC2
RA6I/OTTL/DIG Digital I/O.
CLKOODIGOutputs 1/4 the frequency of OSC1 and denotes the
OSC2O—Oscillator crystal output. Connects to crystal or resonator in
RA7/CLKI/OSC1
RA7I/OTTL/DIG Digital I/O.
CLKIICMOSExternal clock source input. Always associated with pin
OSC1ISTOscillator crystal input or external clock source input ST buffer
Legend:TTL = TTL compatible input; CMOS = CMOS compatible input or output; ST = Schmitt Trigger input with CMOS levels;
I = Input; O = Output; P = Power.
Note1: Default pin assignment for SDO, T3CKI and CCP2 when Configuration bits SDOMX, T3CMX and CCP2MX are set.
2: Alternate pin assignment for SDO, T3CKI and CCP2 when Configuration bits SDOMX, T3CMX and CCP2MX are clear.
3: Pin is “No Connect”, except on PIC18(L)F45K50 TQFP devices with ICPRT Configuration bit set.
Pin Name
/SDI/SDA/SRI/AN12
RB0I/OTTL/DIG Digital Output or Input with internal pull-up option.
INT0ISTExternal interrupt 0.
FLT0
SDIISTSPI Data in (MSSP).
SDAI/OI
SRIISTSR latch input.
AN12IAnalog Analog input 12.
RB1/INT1/P1C/SCK/SCL/C12IN3-/AN10
RB1I/OTTL/DIG Digital Output or Input with internal pull-up option.
INT1ISTExternal interrupt 1.
P1CODIGEnhanced CCP1 PWM output.
SCKI/OST/DIG Synchronous serial clock input/output for SPI mode (MSSP).
SCLI/OI
C12IN3-IAnalog Comparators C1 and C2 inverting input.
AN10IAnalog Analog input 10.
RB2/P1B/INT2/CTED1/AN8
RB2I/OTTL/DIG Digital Output or Input with internal pull-up option.
P1BODIGEnhanced CCP1 PWM output.
INT2ISTExternal interrupt 2.
CTED1ISTCTMU Edge 1 input.
AN8IAnalog Analog input 8.
RB3I/OTTL/DIG Digital Output or Input with internal pull-up option.
CTED2ISTCTMU Edge 2 input.
(1)
SDO
(2)
CCP2
C12IN2-IAnalog Comparators C1 and C2 inverting input.
AN9IAnalog Analog input 9.
RB4I/OTTL/DIG Digital Output or Input with internal pull-up option.
IOCB4ITTLInterrupt-on-change pin.
P1DODIGEnhanced CCP1 PWM output.
AN11IAnalog Analog input 11.
RB5/IOCB5/T3CKI/T1G/AN13
RB5I/OTTL/DIG Digital Output or Input with internal pull-up option.
IOCB5ITTLInterrupt-on-change pin.
(2)
T3CKI
T1GISTTimer1 external clock gate input.
AN13IAnalog Analog input 13.
Pin
Buffer
Type
Type
ISTPWM Fault input for ECCP auto-shutdown.
2
C™I2C™ Data I/O (MSSP).
2
C™Synchronous serial clock input/output for I2C™ mode (MSSP).
Legend:TTL = TTL compatible input; CMOS = CMOS compatible input or output; ST = Schmitt Trigger input with CMOS levels;
I = Input; O = Output; P = Power.
Note1: Default pin assignment for SDO, T3CKI and CCP2 when Configuration bits SDOMX, T3CMX and CCP2MX are set.
2: Alternate pin assignment for SDO, T3CKI and CCP2 when Configuration bits SDOMX, T3CMX and CCP2MX are clear.
3: Pin is “No Connect”, except on PIC18(L)F45K50 TQFP devices with ICPRT Configuration bit set.
Pin Name
RB6I/OTTL/DIG Digital Output or Input with internal pull-up option.
IOCB6ITTLInterrupt-on-change pin.
PGCI/OSTIn-Circuit Debugger and ICSP™ programming clock pin.
RB7/IOCB7/PGD
RB7I/OTTL/DIG Digital Output or Input with internal pull-up option.
IOCB7ITTLInterrupt-on-change pin.
PGDI/OSTIn-Circuit Debugger and ICSP™ programming data pin.
Legend:TTL = TTL compatible input; CMOS = CMOS compatible input or output; ST = Schmitt Trigger input with CMOS levels;
I = Input; O = Output; P = Power.
Note1: Default pin assignment for SDO, T3CKI and CCP2 when Configuration bits SDOMX, T3CMX and CCP2MX are set.
2: Alternate pin assignment for SDO, T3CKI and CCP2 when Configuration bits SDOMX, T3CMX and CCP2MX are clear.
3: Pin is “No Connect”, except on PIC18(L)F45K50 TQFP devices with ICPRT Configuration bit set.
Pin Name
RC6I/OST/DIG Digital I/O.
IOCC6ITTLInterrupt-on-change pin.
TXO—EUSART asynchronous transmit.
CKI/OSTEUSART synchronous clock (see related RX/DT).
AN18IAnalog Analog input 18.
RC7/RX/DT/SDO/IOCC7/AN19
RC7I/OST/DIG Digital I/O.
RXISTEUSART asynchronous receive.
DTI/OSTEUSART synchronous data (see related TX/CK).
Legend:TTL = TTL compatible input; CMOS = CMOS compatible input or output; ST = Schmitt Trigger input with CMOS levels;
I = Input; O = Output; P = Power.
Note1: Default pin assignment for SDO, T3CKI and CCP2 when Configuration bits SDOMX, T3CMX and CCP2MX are set.
2: Alternate pin assignment for SDO, T3CKI and CCP2 when Configuration bits SDOMX, T3CMX and CCP2MX are clear.
3: Pin is “No Connect”, except on PIC18(L)F45K50 TQFP devices with ICPRT Configuration bit set.
Pin Name
RE0I/OST/DIG Digital I/O.
AN5IAnalog Analog input 5.
RE1/AN6
RE1I/OST/DIG Digital I/O.
AN6IAnalog Analog input 6.
RE2I/OSTDigital I/O.
AN7IAnalog Analog input 7.
RE3/VPP/MCLR
RE3ISTDigital input.
PPPProgramming voltage input.
V
MCLR
ICCKI/OSTDedicated In-Circuit Debugger clock.
(3)
ICPGC
ICDTI/OSTDedicated In-Circuit Debugger data.
(3)
ICPGD
/ICVPP
ICRSTISTDedicated Master Clear Reset input.
(3)
ICV
PP
DDP—Positive supply for logic and I/O pins.
SSP—Ground reference for logic and I/O pins.
Pin
Buffer
Type
Type
ISTActive-low Master Clear (device Reset) input.
I/OSTDedicated ICSP™ programming clock.
I/OSTDedicated ICSP™ programming data.
IPDedicated programming voltage input.
Description
2012 Microchip Technology Inc.DS30684A-page 23
PIC18(L)F2X/45K50
NOTES:
DS30684A-page 24 2012 Microchip Technology Inc.
PIC18(L)F2X/45K50
PIC18F2X/45K50
VDD
VSS
VDD
VSS
VSS
VDD
VDD
VSS
C1
R1
V
DD
MCLR
VUSB3V3
R2
C7
(2)
C2
(2)
C3
(2)
C4
(2)
C6
(2)
Key (all values are recommendations):
C1 through C6: 0.1 F, 20V ceramic
R1: 10 kΩ
R2: 100Ω to 470Ω
Note 1:See Section 2.4 “Voltage Regulator Pins
(V
USB3V3)” for explanation of VUSB3V3 pin
connections.
2:The example shown is for a PIC18F device
with five V
DD/VSS pairs. Other devices may
have more or less pairs; adjust the number
of decoupling capacitors appropriately.
(1)
2.0GUIDELINES FOR GETTING
STARTED WITH
FIGURE 2-1:RECOMMENDED
MINIMUM CONNECTIONS
PIC18(L)F2X/45K50
MICROCONTROLLERS
2.1Basic Connection Requirements
Getting started with the PIC18(L)F2X/45K50 family of
8-bit microcontrollers requires attention to a minimal
set of device pin connections before proceeding with
development.
The following pins must always be connected:
DD and VSS pins
•All V
(see Section 2.2 “Power Supply Pins”)
•MCLR
•V
These pins must also be connected if they are being
used in the end application:
• PGC/PGD pins used for In-Circuit Serial
• OSC1 and OSC2 pins when an external oscillator
Additionally, the following pins may be required:
•V
The minimum mandatory connections are shown in
Figure 2-1.
pin
(see Section 2.3 “Master Clear (MCLR) Pin”)
USB3V3 pins
(see Section 2.4 “Voltage Regulator Pins
(VUSB3V3)”)
Programming™ (ICSP™) and debugging purposes
(see Section 2.5 “ICSP Pins”)
source is used
(see Section 2.6 “External Oscillator Pins”)
REF+/VREF- pins are used when external voltage
reference for analog modules is implemented
2012 Microchip Technology Inc.DS30684A-page 25
PIC18(L)F2X/45K50
Note 1: R1 10 k is recommended. A suggested
starting value is 10 k. Ensure that the
MCLR
pin VIH and VIL specifications are met.
2: R2 470 will limit any current flowing into
MCLR
from the external capacitor, C, in the
event of MCLR
pin breakdown, due to
Electrostatic Discharge (ESD) or Electrical
Overstress (EOS). Ensure that the MCLR
pin
V
IH and VIL specifications are met.
C1
R2
R1
V
DD
MCLR
PIC18F2X/45K50
JP
2.2Power Supply Pins
2.2.1DECOUPLING CAPACITORS
The use of decoupling capacitors on every pair of
power supply pins, such as V
Consider the following criteria when using decoupling
capacitors:
• Value and type of capacitor: A 0.1 F (100 nF),
10-20V capacitor is recommended. The capacitor
should be a low-ESR device, with a resonance
frequency in the range of 200 MHz and higher.
Ceramic capacitors are recommended.
• Placement on the printed circuit board: The
decoupling capacitors should be placed as close
to the pins as possible. It is recommended to
place the capacitors on the same side of the
board as the device. If space is constricted, the
capacitor can be placed on another layer on the
PCB using a via; however, ensure that the trace
length from the pin to the capacitor is no greater
than 0.25 inch (6 mm).
• Handling high-frequency noise: If the board is
experiencing high-frequency noise (upward of
tens of MHz), add a second ceramic type capacitor in parallel to the above described decoupling
capacitor. The value of the second capacitor can
be in the range of 0.01 F to 0.001 F. Place this
second capacitor next to each primary decoupling
capacitor. In high-speed circuit designs, consider
implementing a decade pair of capacitances as
close to the power and ground pins as possible
(e.g., 0.1 F in parallel with 0.001 F).
• Maximizing performance: On the board layout
from the power supply circuit, run the power and
return traces to the decoupling capacitors first,
and then to the device pins. This ensures that the
decoupling capacitors are first in the power chain.
Equally important is to keep the trace length
between the capacitor and the power pins to a
minimum, thereby reducing PCB trace
inductance.
DD and VSS is required.
2.3Master Clear (MCLR) Pin
The MCLR pin provides two specific device
functions: Device Reset, and Device Programming
and Debugging. If programming and debugging are
not required in the end application, a direct
connection to V
addition of other components, to help increase the
application’s resistance to spurious Resets from
voltage sags, may be beneficial. A typical
configuration is shown in Figure 2-1. Other circuit
designs may be implemented, depending on the
application’s requirements.
During programming and debugging, the resistance
and capacitance that can be added to the pin must
be considered. Device programmers and debuggers
drive the MCLR
levels (V
IH and VIL) and fast signal transitions must
not be adversely affected. Therefore, specific values
of R1 and C1 will need to be adjusted based on the
application and PCB requirements. For example, it is
recommended that the capacitor, C1, be isolated
from the MCLR
debugging operations by using a jumper (Figure 2-2).
The jumper is replaced for normal run-time
operations.
Any components associated with the MCLR
should be placed within 0.25 inch (6 mm) of the pin.
FIGURE 2-2:EXAMPLE OF MCLR PIN
DD may be all that is required. The
pin. Consequently, specific voltage
pin during programming and
pin
CONNECTIONS
2.2.2TANK CAPACITORS
On boards with power traces running longer than
six inches in length, it is suggested to use a tank capacitor for integrated circuits, including microcontrollers, to
supply a local power source. The value of the tank
capacitor should be determined based on the trace
resistance that connects the power supply source to
the device, and the maximum current drawn by the
device in the application. In other words, select the tank
capacitor so that it meets the acceptable voltage sag at
the device. Typical values range from 4.7 F to 47 F.
DS30684A-page 26 2012 Microchip Technology Inc.
PIC18(L)F2X/45K50
-80
-70
-60
-50
-40
-30
-20
-10
0
10
51011121314151617
DC Bias Voltage (VDC)
Capacitance Change (%)
01234 6789
16V Capacitor
10V Capacitor
6.3V Capacitor
2.4Volt age Regulator Pins (VUSB3V3)
The on-chip voltage regulator must always be
connected directly to either a supply voltage or to an
external capacitor.
When the regulator is enabled (F devices), a low-ESR
(< 5Ω) capacitor is required on the V
stabilize the voltage regulator output voltage. The
USB3V3 pin must not be connected to VDD and is
V
recommended to use a ceramic capacitor of between
0.22 to 0.47 µF connected to ground.
It is recommended that the trace length not exceed
0.25 inch (6 mm). Refer to Section 29.0 “Electrical
Characteristics” for additional information.
When the regulator is disabled (LF devices), the
USB3V3 pin should be externally tied to a voltage
V
source maintained at the V
Section 29.0 “Electrical Characteristics” for
information on VDD and VUSB3V3.
• LF devices (with the name, PIC18LF2X/45K50)
permanently disable the voltage regulator.
DD level of these devices must comply with
The V
the “voltage regulator disabled” specification for
Parameter D001, in Section 29.0 “Electrical
Characteristics”.
• F devices permanently enable the voltage
regulator.
These devices require an external capacitor on
USB3V3 pin. It is recommended that the
the V
capacitor be a ceramic cap between 0.22 to
0.47 µF.
USB3V3 pin to
DD level. Refer to
The X5R and X7R capacitors typically exhibit satisfactory temperature stability (ex: ±15% over a wide
temperature range, but consult the manufacturer’s data
sheets for exact specifications). However, Y5V capacitors typically have extreme temperature tolerance
specifications of +22%/-82%. Due to the extreme
temperature tolerance, a 10 F nominal rated Y5V type
capacitor may not deliver enough total capacitance to
meet minimum internal voltage regulator stability and
transient response requirements. Therefore, Y5V
capacitors are not recommended for use with the
internal regulator if the application must operate over a
wide temperature range.
In addition to temperature tolerance, the effective
capacitance of large value ceramic capacitors can vary
substantially, based on the amount of DC voltage
applied to the capacitor. This effect can be very significant, but is often overlooked or is not always
documented.
A typical DC bias voltage vs. capacitance graph for
X7R type and Y5V type capacitors is shown in
Figure 2-3.
FIGURE 2-3:DC BIAS VOLTAGE vs.
CAPACITANCE
CHARACTERISTICS
2.4.1CONSIDERATIONS FOR CERAMIC
In recent years, large value, low-voltage, surface-mount
ceramic capacitors have become very cost effective in
sizes up to a few tens of microfarad. The low-ESR, small
physical size and other properties make ceramic
capacitors very attractive in many types of applications.
Ceramic capacitors are suitable for use with the internal voltage regulator of this microcontroller. However,
some care is needed in selecting the capacitor to
ensure that it maintains sufficient capacitance over the
intended operating range of the application.
Typical low-cost, ceramic capacitors are available in
X5R, X7R and Y5V dielectric ratings (other types are
also available, but are less common). The initial tolerance specifications for these types of capacitors are
often specified as ±10% to ±20% (X5R and X7R), or
-20%/+80% (Y5V). However, the effective capacitance
that these capacitors provide in an application circuit will
also vary based on additional factors, such as the
applied DC bias voltage and the temperature. The total
in-circuit tolerance is, therefore, much wider than the
initial tolerance specification.
2012 Microchip Technology Inc.DS30684A-page 27
CAPACITORS
When selecting a ceramic capacitor to be used with the
internal voltage regulator, it is suggested to select a
high-voltage rating, so that the operating voltage is a
small percentage of the maximum rated capacitor
voltage. For example, choose a ceramic capacitor
rated at 16V for the 3.3V V
USB3V3 voltage.
PIC18(L)F2X/45K50
2.5ICSP Pins
The PGC and PGD pins are used for In-Circuit Serial
Programming™ (ICSP™) and debugging purposes. It
is recommended to keep the trace length between the
ICSP connector and the ICSP pins on the device as
short as possible. If the ICSP connector is expected to
experience an ESD event, a series resistor is recommended, with the value in the range of a few tens of
ohms, not to exceed 100Ω.
Pull-up resistors, series diodes and capacitors on the
PGC and PGD pins are not recommended as they will
interfere with the programmer/debugger communications to the device. If such discrete components are an
application requirement, they should be removed from
the circuit during programming and debugging. Alternatively, refer to the AC/DC characteristics and timing
requirements information in the respective device
Flash programming specification for information on
capacitive loading limits, and pin input voltage high
IH) and input low (VIL) requirements.
(V
For device emulation, ensure that the “Communication
Channel Select” (i.e., PGCx/PGDx pins), programmed
into the device, matches the physical connections for
the ICSP to the Microchip debugger/emulator tool.
For more information on available Microchip
development tools connection requirements, refer to
Section 28.0 “Development Support”.
2.6External Oscillator Pins
Many microcontrollers have options for at least two
oscillators: a high-frequency primary oscillator and a
low-frequency secondary oscillator (refer to
Section 3.0 “Oscillator Module (With Fail-Safe
Clock Monitor)” for details).
The oscillator circuit should be placed on the same
side of the board as the device. Place the oscillator
circuit close to the respective oscillator pins with no
more than 0.5 inch (12 mm) between the circuit
components and the pins. The load capacitors should
be placed next to the oscillator itself, on the same side
of the board.
Use a grounded copper pour around the oscillator circuit to isolate it from surrounding circuits. The
grounded copper pour should be routed directly to the
MCU ground. Do not run any signal traces or power
traces inside the ground pour. Also, if using a two-sided
board, avoid any traces on the other side of the board
where the crystal is placed.
Layout suggestions are shown in Figure 2-4. In-line
packages may be handled with a single-sided layout
that completely encompasses the oscillator pins. With
fine-pitch packages, it is not always possible to completely surround the pins and components. A suitable
solution is to tie the broken guard sections to a mirrored
ground layer. In all cases, the guard trace(s) must be
returned to ground.
In planning the application’s routing and I/O assignments, ensure that adjacent port pins, and other
signals in close proximity to the oscillator, are benign
(i.e., free of high frequencies, short rise and fall times,
and other similar noise).
For additional information and design guidance on
oscillator circuits, please refer to these Microchip
Application Notes, available at the corporate web site
(www.microchip.com):
• AN826, “Crystal Oscillator Basics and Crystal
Selection for rfPIC™ and PICmicro
• AN849, “Basic PICmicro® Oscillator Design”
• AN943, “Practical PICmicro
and Design”
• AN949, “Making Your Oscillator Work”
®
Devices”
®
Oscillator Analysis
2.7Unused I/Os
Unused I/O pins should be configured as outputs and
driven to a logic low state. Alternatively, connect a 1 kΩ
to 10 kΩ resistor to V
output to logic low.
DS30684A-page 28 2012 Microchip Technology Inc.
SS on unused pins and drive the
FIGURE 2-4:SUGGESTE D
GND
`
`
`
OSC1
OSC2
SOSCO
SOSCI
Copper Pour
Primary Oscillator
Crystal
Timer1 Oscillator
Crystal
DEVICE PINS
Primary
Oscillator
C1
C2
T1 Oscillator: C1
T1 Oscillator: C2
(tied to ground)
Single-Sided and In-Line Layouts:
Fine-Pitch (Dual-Sided) Layouts:
GND
OSCO
OSCI
Bottom Layer
Copper Pour
Oscillator
Crystal
Top Layer Copper Pour
C2
C1
DEVICE PINS
(tied to ground)
(tied to ground)
PIC18(L)F2X/45K50
PLACEMENT OF THE
OSCILLATOR CIRCUIT
2012 Microchip Technology Inc.DS30684A-page 29
PIC18(L)F2X/45K50
NOTES:
DS30684A-page 30 2012 Microchip Technology Inc.
Loading...
+ 506 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.