Note the following details of the code protection feature on Microchip devices:
•Microchip products meet the specification contained in their particular Microchip Data Sheet.
•Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
•There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
•Microchip is willing to work with the customer who is concerned about the integrity of their code.
•Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Information c ontained in t his p ublication regarding d evice
applications and the like is provided only for your convenience
and may be superseded by updates. It is your responsibility to
ensure that yo ur ap plication me ets wi th yo ur sp ecifications.
MICROCHIP MAKES N O R EPRESENTATIONS OR
WARRANTIES OF AN Y KIN D W HETHER EXPRESS OR
IMPLIED, WR ITTEN O R O RAL, ST ATUTORY OR
OTHERWISE, RE LATED T O T HE I NFORMATION,
INCLUDING B UT NOT L IMITED T O IT S C ONDITION,
QUALITY, PE RFORMANCE, M ERCHANTABILITY OR
FITNESS FOR PU RPOSE. Microchip dis claims al l lia bility
arising f rom t his i nformation an d its use. U se o f Microchip
devices in li fe support a nd/or safety applications is e ntirely at
the buyer’s risk, and the buyer agrees to defend, indemnify and
hold h armless M icrochip f rom a ny an d al l da mages, claims,
suits, o r e xpenses re sulting f rom such u se. No li censes are
conveyed, im plicitly or ot herwise, under an y M icrochip
intellectual property rights.
Trademarks
The Microchip name and logo, the Microchip logo, dsPIC,
K
rfPIC and UNI/O are registered trademarks of Microchip
Technology Incorporated in the U.S.A. and other countries.
FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor,
MXDEV, MXLAB, SEEVAL and The Embedded Control
Solutions Company are registered trademarks of Microchip
Technology Incorporated in the U.S.A.
logo, REAL ICE, rfLAB, Select Mode, Total
Endurance, TSHARC, UniWinDriver, WiperLock and ZENA
are trademarks of Microchip Technology Incorporated in the
U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated
in the U.S.A.
All other trademarks mentioned herein are property of their
respective companies.
Microchip received ISO/TS-16949:2002 certification for its worldwide
headquarters, design and wafer fabrication facilities in Chandler and
Tempe, Arizona; Gresham, Oregon and design centers in California
and India. The Company’s quality system processes and procedures
are for its PIC
devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchip’s quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.
®
MCUs and dsPIC® DSCs, KEELOQ
®
code hopping
DS41303G-page 2 2010 Microchip Technology Inc.
PIC18F2XK20/4XK20
28/40/44-Pin Flash Microcontrollers
with nanoWatt XLP Technology
High-Performance RISC CPU:
• C Compiler Optimized Architecture:
- Optional extended instruction set designed to
optimize re-entrant code
• Up to 1024 bytes Data EEPROM
• Up to 64 Kbytes Linear Program Memory
Addressing
6.0Flash Program Memory............................................................................................................................................................. 89
17.0 Master Synchronous Serial Port (MSSP) Module ................................................................................................................... 193
21.0 Voltage References ................................................................................................................................................................. 289
23.0 Special Features of the CPU................................................................................................................................................... 299
24.0 Instruction Set Summary......................................................................................................................................................... 315
25.0 Development Support.............................................................................................................................................................. 365
27.0 DC and AC Characteristics Graphs and Tables...................................................................................................................... 403
Index ................................................................................................................................................................................................. 443
The Microchip Web Site.................................................................................................................................................................... 453
Customer Change Notification Service ............................................................................................................................................. 453
Customer Support ............................................................................................................................................................................. 453
Product Identification System ........................................................................................................................................................... 455
2010 Microchip Technology Inc.DS41303G-page 9
PIC18F2XK20/4XK20
TO OUR VALUED CUSTOMERS
It is our intention to provide our valued customers with the best documentation possible to ensure successful use of your Microchip
products. To this end, we will continue to improve our publications to better suit your needs . Our publications will be refined and
enhanced as new volumes and updates are introduced.
If you have any questions or comments regarding this publication, please contact the Marketing Communications Department via
E-mail at docerrors@mail.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)
• The Microchip Corporate Literature Center; U.S. FAX: (480) 792-7277
When contacting a sales office or t he literature center, 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/cn to receive the most current information on all of our products.
DS41303G-page 10 2010 Microchip Technology Inc.
PIC18F2XK20/4XK20
1.0DEVICE OVERVIEW
This document contains device specific information for
the following devices:
• PIC18F23K20• PIC18F43K20
• PIC18F24K20• PIC18F44K20
• PIC18F25K20• PIC18F45K20
• PIC18F26K20• PIC18F46K20
This fam ily of fers th e ad vantages of all PI C18
microcontrollers – na mely, hig h computational
performance at an economical price – with the addition
of high-endurance, Flash program memory. On top of
these fea tures, the PIC18F2XK20/4XK20 fam ily
introduces d esign en hancements t hat make t hese
microcontrollers a log ical ch oice for many hig hperformance, power sensitive applications.
1.1New Core Features
1.1.1nanoWatt TECHNOLOGY
All of t he devices in the PIC18F2XK20/4XK20 family
incorporate a ra nge o f features that c an s ignificantly
reduce power c onsumption d uring operation. Ke y
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.
• 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 26.0 “Electrical Characteristics”
for values.
1.1.2MULTIPLE OSCILLATOR OPTIONS
AND FEATURES
All of th e devices in the PIC18F2XK20/4XK20 family
offer ten d ifferent oscillator options, allowing us ers a
wide r ange o f ch oices in de veloping a pplication
hardware. These include:
• Four Crystal modes, using crystals or ceramic
resonators
• Two 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
LFINTOSC oscillator which together provide 8
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.
• A Phase Lock Loop (PLL) frequency multiplier,
available to both the high-speed crystal and internal oscillator modes, which allows clock speeds of
up to 64 MHz. Used with the internal oscillator, the
PLL gives users a complete selection of clock
speeds, from 31 kHz to 64 MHz – all without using
an external crystal or clock circuit.
Besides its availability as a cl ock so urce, the internal
oscillator block provides a stable reference source that
gives th e fam ily a dditional feat ures for robust
operation:
• Fail-Safe Clock Monitor: This option constantly
monitors the main clock source against a reference signal provided by the LFINTOSC. 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-S pe ed 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.
2010 Microchip Technology Inc.DS41303G-page 11
PIC18F2XK20/4XK20
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 PIC18F2XK20/
4XK20 family introduces an optional extension to
the PIC18 instruction set, which adds 8 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 4 outputs to provide the PWM signal.
• Enhanced Addressable USART: 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 USART 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.
• Extended Watchdog Timer (WDT): This
enhanced version incorporates a 16-bit
postscaler, allowing an extended time-out range
that is stable across operating voltage and
temperature. See Section 26.0 “Electrical
Characteristics” for time-out periods.
1.3Details on Individual Family
Members
Devices in the PIC18F2XK20/4XK20 family are av ailable in 28-pin and 40/44-pin packages. Block diagrams
for the tw o g roups are shown i n Fi gure 1-1 an d
Figure 1-2.
The devices are differentiated from each other in five
ways:
1.Flash program memory (8 Kbytes for
PIC18F23K20/43K20 de vices, 16 Kbytes for
PIC18F24K20/44K20 de vices, 32 Kbytes for
PIC18F25K20/45K20 AN D 64 Kbytes for
PIC18F26K20/46K20).
2.A/D channels (11 for 28-pin devices, 14 for
40/44-pin devices).
3.I/O ports (3 bidirectional ports on 28-pin devices,
5 bidirectional ports on 40/44-pin devices).
4.Parallel Sl ave Port (p resent only on 4 0/44-pin
devices).
All other features for devices in this family are identical.
These are summarized in Table 1-1.
The pinouts for all devices are listed in the pin summary
tables: Table 1 and Table 2, and I/O description tables:
Table 1-2 and Table 1-3.
ST = Schmitt Trigger input with CMOS levelsI= Input
O= Output P= Power
Note 1: Default assignment for CCP2 when Configuration bit CCP2MX is set.
2: Alternate assignment for CCP2 when Configuration bit CCP2MX is cleared.
PDIP,
SOIC
126
96
107
QFN
Pin
Type
I
P
I
I
I
I/O
O
O
I/O
Buffer
Type
ST
ST
ST
CMOS
TTL
—
—
TTL
Description
Master Clear (input) or programming voltage (input)
Active-low Master Clear (device Reset) input
Programming voltage input
Digital input
Oscillator crystal or external clock input
Oscillator crystal input or external clock source input
ST buffer when configured in RC mode; CMOS otherwise
External clock source input. Always associated with pin
function OSC1. (See related OSC1/CLKIN, OSC2/CLKOUT
pins)
General purpose I/O pin
Oscillator crystal or clock output
Oscillator crystal output. Connects to crystal or
resonator in Crystal Oscillator mode
In RC mode, OSC2 pin outputs CLKOUT which has 1/4 the
frequency of OSC1 and denotes the instruction cycle rate
General purpose I/O pin
ST = Schmitt Trigger input with CMOS levelsI= Input
O= Output P= Power
Note 1: Default assignment for CCP2 when Configuration bit CCP2MX is set.
2: Alternate assignment for CCP2 when Configuration bit CCP2MX is cleared.
Pin Number
PDIPQFN TQFP
11818
133230
143331
Pin
Type
I
P
I
I
I
I/O
O
O
I/O
Buffer
Type
ST
ST
ST
CMOS
TTL
—
—
TTL
Description
Master Clear (input) or programming voltage (input)
Active-low Master Clear (device Reset) input
Programming voltage input
Digital input
Oscillator crystal or external clock input
Oscillator crystal input or external clock source input
ST buffer when configured in RC mode;
analog otherwise
External clock source input. Always associated with
pin function OSC1 (See related OSC1/CLKIN,
OSC2/CLKOUT pins)
General purpose I/O pin
Oscillator crystal or clock output
Oscillator crystal output. Connects to crystal
or resonator in Crystal Oscillator mode
In RC mode, OSC2 pin outputs CLKOUT which
has 1/4 the frequency of OSC1 and denotes
the instruction cycle rate
General purpose I/O pin
ST = Schmitt Trigger input with CMOS levelsI= Input
O= Output P= Power
Note 1: Default assignment for CCP2 when Configuration bit CCP2MX is set.
2: Alternate assignment for CCP2 when Configuration bit CCP2MX is cleared.
Pin Number
PDIPQFN TQFP
193838
203939
214040
224141
2722
2833
2944
3055
Pin
Buffer
Type
Type
I/O
I/OSTTTL
I/O
I/OSTTTL
I/O
I/OSTTTL
I/O
I/OSTTTL
I/O
I/OSTTTL
I/O
I/O
TTL
O
I/O
I/O
TTL
O
I/O
I/O
TTL
O
Description
PORTD is a bidirectional I/O port or a Parallel Slave
Port (PSP) for interfacing to a microprocessor port.
These pins have TTL input buffers when PSP module
is enabled.
Digital I/O
Parallel Slave Port data
Digital I/O
Parallel Slave Port data
Digital I/O
Parallel Slave Port data
Digital I/O
Parallel Slave Port data
Digital I/O
Parallel Slave Port data
ST
—
ST
—
ST
—
Digital I/O
Parallel Slave Port data
Enhanced CCP1 output
Digital I/O
Parallel Slave Port data
Enhanced CCP1 output
Digital I/O
Parallel Slave Port data
Enhanced CCP1 output
The O scillator m odule has a wide va riety o f cl ock
sources and selection features that allow it to be used
in a wide range of applications while maximizing performance and minimizing power consumption. Figure 2-1
illustrates a block diagram of the Oscillator module.
Clock sources ca n be con figured from external
oscillators, quartz crystal resonators, ceramic resonators
and R esistor-Capacitor (R C) c ircuits. In a ddition, the
system clock source can be configured from one of two
internal oscillators, with a choice of speeds selectable via
software. Additional clock features include:
• Selectable system clock source between external
or internal via software.
• Two-Speed Start-up mode, which minimizes
latency between external oscillator start-up and
code execution.
• Fail-Safe Clock Monitor (FSCM) designed to
detect a failure of the external clock source (LP,
XT, HS, EC or RC modes) and switch
automatically to the internal oscillator.
The Oscillator module can be configured in one of ten
primary clock modes.
1.LPLow-Power Crystal
2.XTCrystal/Resonator
3.HSHigh-Speed Crystal/Resonator
4.HSPLLHigh-Speed Crystal/Resonator
with PLL enabled
5.RCExternal Resistor/Capacitor with
OSC/4 output on RA6
F
6.RCIOExternal Resistor/Capacitor with I/O
on RA6
7.INTOSCInternal Oscillator with F
OSC/4
output on RA6 and I/O on RA7
8.INTOSCIO Internal Oscillator with I/O on RA6
and RA7
9.ECExternal Clock with F
OSC/4 output
10. ECIOExternal Clock with I/O on RA6
Primary Clock modes are selected by the FOSC<3:0>
bits of t he CONFIG1H C onfiguration R egister. T he
HFINTOSC and LFINTOSC are factory calibrated highfrequency and low-frequency oscillators, respectively,
which are used as the internal clock sources.
FIGURE 2-1:PIC® MCU CLOCK SOURCE BLOCK DIAGRAM
2010 Microchip Technology Inc.DS41303G-page 27
PIC18F2XK20/4XK20
2.2Oscillator Control
The OSCCON register (Register 2-1) controls several
aspects o f the dev ice c lock’s op eration, bo th in ful l
power operation and in power-managed modes.
• Main System Clock Selection (SCS)
• Internal Frequency selection bits (IRCF)
• Clock Status bits (OSTS, IOFS)
• Power management selection (IDLEN)
2.2.1MAIN SYSTEM CLOCK SELECTION
The Sy stem Cloc k Se lect b its, SCS<1 :0>, s elect th e
main clock source. The available clock sources are
• Primary clock defined by the FOSC<3:0> bits of
CONFIG1H. The primary clock can be the primary
oscillator, an external clock, or the internal oscillator block.
• Secondary clock (Timer1 oscillator)
• Internal oscillator block (HFINTOSC and
LFINTOSC).
The c lock s ource cha nges i mmediately af ter one or
more of the bits is written to, following a brief clock transition interval. The SCS bits are cl eared to sel ect the
primary clock on all forms of Reset.
2.2.4CLOCK STATUS
The OSTS and IOFS bits of the OSCCON register, and
the T1RUN bit of the T1CON register, indicate which
clock source is currently providing the main clock. The
OSTS b it i ndicates th at th e O scillator S tart-up T imer
has timed out and the primary clock is p roviding the
device clock. The IOFS bit indicates when the internal
oscillator b lock has stabilized a nd is p roviding th e
device cl ock i n H FINTOSC C lock m odes. The IO FS
and O STS S tatus bit s w ill bo th b e s et w hen
SCS<1:0> = 00 and HFINTOSC is the primary clock.
The T1RUN bit indicates when the Timer1 oscillator is
providing the device clock in secondary clock modes.
When SCS<1:0> 00, only one of these three bits will
be set at any time. If none of the se bits are set, th e
LFINTOSC is providing the clock or the H FINTOSC
has just started and is not yet stable.
2.2.5POWER MANAGEMENT
The IDLEN bit of the OSCCON register determines if
the d evice go es into Sle ep mode o r on e of the Idl e
modes when the SLEEP instruction is executed.
The use of the flag and control bits in the OSCCON
register i s di scussed in m ore d etail in Section 3.0“Power-Managed Modes”.
2.2.2INTERNAL FREQUENCY
SELECTION
The Int ernal Os cillator Frequency Se lect bit s
(IRCF<2:0>) select the frequency output of the internal
oscillator block. The choices are the LFINTOSC source
(31 kHz), the HFINTOSC so urce (16 MHz) or one of
the freq uencies de rived from the H FINTOSC pos tscaler (31 .25 kHz to 8 MHz). If the internal oscillator
block is supplying the main clock, changing the states
of th ese b its w ill ha ve an i mmediate c hange on th e
internal oscillator’s output. On device Resets, the output f requency of the in ternal oscillator is s et t o th e
default frequency of 1 MHz.
2.2.3LOW FREQUENCY SELECTION
When a nominal output frequency of 31 kHz is selected
(IRCF<2:0> = 000), users may choose which internal
oscillator ac ts as th e s ource. Thi s i s done w ith th e
INTSRC bit of the OSCTUNE register. Setting this bit
selects the HFINTOSC as a 31.25 kHz clock source by
enabling the di vide-by-512 ou tput of the H FINTOSC
postscaler. Clearing INTSRC selects LFINTOSC (nominally 31 kHz) as the clock source.
This option allows users to select the tunable and more
precise HFINTOSC as a clock source, while maintaining power savings with a very low clock speed. Regardless of t he se tting of I NTSRC, LFINTOSC a lways
remains th e c lock source fo r fea tures s uch a s th e
Watchdog Timer and the Fail-Safe Clock Monitor.
Note 1: The Timer1 oscillator must be enabled to
select the secondary c lock so urce. Th e
Timer1 oscillator is enabled by setting the
T1OSCEN b it of the T1 CON re gister. If
the Timer1 oscillator is not enabled, then
the m ain osc illator w ill c ontinue to ru n
from the previously selected source. The
source will then switch to the secondary
oscillator after the T1OSCEN bit is set.
2: It i s rec ommended tha t the Timer1
oscillator be operating and stable before
selecting the secondary clock source or a
very lo ng delay ma y o ccur while th e
Timer1 oscillator starts.
DS41303G-page 28 2010 Microchip Technology Inc.
PIC18F2XK20/4XK20
REGISTER 2-1:OSCCON: OSCILLATOR CONTROL REGISTER
R/W-0R/W-0R/W-1R/W-1R-qR-0R/W-0R/W-0
IDLENIRCF2IRCF1IRCF0OSTS
bit 7bit 0
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’q = depends on condition
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 7IDLEN: Idle Enable bit
1 = Device enters Idle mode on SLEEP instruction
0 = Device enters Sleep mode on SLEEP instruction
bit 6-4IRCF<2:0>: Internal Oscillator Frequency Select bits
bit 3OSTS: Oscillator Start-up Time-out Status bit
1 = Device is running from the clock defined by FOSC<2:0> of the CONFIG1 register
0 = Device is running from the internal oscillator (HFINTOSC or LFINTOSC)
bit 2IOFS: HFINTOSC Frequency Stable bit
1 = HFINTOSC frequency is stable
0 = HFINTOSC frequency is not stable
Note 1:Reset state depends on state of the IESO Configuration bit.
2:Source selected by the INTSRC bit of the OSCTUNE register, see text.
3:Default output frequency of HFINTOSC on Reset.
2010 Microchip Technology Inc.DS41303G-page 29
PIC18F2XK20/4XK20
OSC1/CLKIN
OSC2/CLKOUT
(1)
I/O
Clock from
Ext. System
PIC
®
MCU
Note 1:Alternate pin functions are listed in
Section 1.0 “Device Overview”.
2.3Clock Source Modes
Clock Source modes can be classified as external or
internal.
• External Clock modes rely on external circuitry for
the clock source. Examples are: Clock modules
(EC mode), quartz crystal resonators or ceramic
resonators (LP, XT and HS modes) and ResistorCapacitor (RC mode) circuits.
• Internal clock sources are contained internally
within the Oscillator block. The Oscillator block
has two internal oscillators: the 16 MHz HighFrequency Internal Oscillator (HFINTOSC) and
the 31 kHz Low-Frequency Internal Oscillator
(LFINTOSC).
The system clock can be selected between external or
internal cl ock sources vi a the S ystem Cl ock S elect
(SCS<1:0>) b its o f the OSCCO N register. Se e
Section 2.9 “Clock Switching” for additional informa-
tion.
2.4External Clock Modes
2.4.1OSCILLATOR START-UP TIMER
(OST)
When the Oscillator module is configured for LP, XT or
HS modes, the Oscillator Start-up Timer (OST) counts
1024 oscillations from O SC1. Thi s occurs following a
Power-on Reset (POR) and when the Power-up Timer
(PWRT) has expired (if configured), or a wake-up from
Sleep. During this time, the program counter does not
increment and program execution is suspended. The
OST ensures that the oscillator circuit, using a quartz
crystal resonator or ceramic resonator, has started and
is prov iding a stable system clo ck to the Oscillator
module. W hen swi tching be tween cl ock s ources, a
delay i s required to al low the new cl ock to s tabilize.
These oscillator delays are shown in Table 2-1.
In order to minimize latency between external oscillator
start-up a nd c ode ex ecution, the T wo-Speed C lock
Start-up mo de can be se lected (see Section 2.10
“Two-Speed Clock Start-up Mode”).
TABLE 2-1:OSCILLATOR DELAY EXAMPLES
Switch FromSwitch ToFrequencyOscillator Delay
Sleep/POR
Sleep/POREC, RCDC – 64 MHz2 instruction cycles
LFINTOSC (31 kHz)EC, RCDC – 64 MHz1 cycle of each
Sleep/PORLP, XT, HS32 kHz to 40 MHz1024 Clock Cycles (OST)
Sleep/PORHSPLL32 MHz to 64 MHz1024 Clock Cycles (OST) + 2 ms
LFINTOSC (31 kHz)HFINTOSC250 kHz to 16 MHz1 s (approx.)
LFINTOSC
HFINTOSC
31 kHz
250 kHz to 16 MHz
Oscillator Warm-Up Delay (T
WARM)
2.4.2EC MODE
The Ext ernal C lock ( EC) mode al lows an ext ernally
generated logic level as the system clock source. When
operating in this mode , a n ext ernal clock sour ce is
connected to the OSC1 input and the OSC2 is available
for ge neral p urpose I /O. Fig ure 2-2 s hows th e pi n
connections for EC mode.
The Oscillator Start-up Timer (OST) is disabled when
EC mode is selected. Therefore, there is no delay in
operation af ter a Power-on R eset (POR) or wake-up
from Sleep. B ecause t he PIC
static, sto pping t he external clock input w ill have the
effect of halting the device while leaving all data intact.
Upon res tarting the external cl ock, th e dev ice w ill
resume operation as if no time had elapsed.
DS41303G-page 30 2010 Microchip Technology Inc.
®
MCU de sign is fully
FIGURE 2-2:EXTERNAL CLOCK (EC)
MODE OPERATION
Loading...
+ 426 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.