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 contained in this publication regarding device
applications and the like is provided only for your convenience
and may be superseded by updates. It is your responsibility to
ensure that your application meets with your specifications.
MICROCHIP MAKES NO REPRESENTATIONS OR
WARRANTIES OF ANY KIND WHETHER EXPRESS OR
IMPLIED, WRITTEN OR ORAL, STATUTORY OR
OTHERWISE, RELATED TO THE INFORMATION,
INCLUDING BUT NOT LIMITED TO ITS CONDITION,
QUALITY, PERFORMANCE, MERCHANTABILITY OR
FITNESS FOR PURPOSE. Microchip disclaims all liability
arising from this information and its use. Use of Microchip
devices in life support and/or safety applications is entirely at
the buyer’s risk, and the buyer agrees to defend, indemnify and
hold harmless Microchip from any and all damages, claims,
suits, or expenses resulting from such use. No licenses are
conveyed, implicitly or otherwise, under any Microchip
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.
3.0Special Features of the CPU...................................................................................................................................................... 35
Appendix D: Migration from Baseline to Enhanced Devices................................................................................................................ 46
Appendix E: Migration from Mid-Range to Enhanced Devices ............................................................................................................ 47
Appendix F: Migration from High-End to Enhanced Devices ............................................................................................................... 47
Index ................................................................................................................................................................................................... 49
The Microchip Web Site....................................................................................................................................................................... 51
Customer Change Notification Service ................................................................................................................................................ 51
Customer Support ................................................................................................................................................................................ 51
Product Identification System .............................................................................................................................................................. 53
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.
This document contains device-specific information for
the following devices:
• PIC18F2423• PIC18LF2423
• PIC18F2523• PIC18LF2523
• PIC18F4423• PIC18LF4423
• PIC18F4523• PIC18LF4523
Note: This data sheet documents only the devices’
features and specifications that are in addition
to, or different from, the features and specifications of the PIC18F2420/2520/4420/4520
devices. For information on the features and
specifications shared by the PIC18F2423/
2523/4423/4523 and PIC18F2420/2520/
4420/4520 devices, see the “PIC18F2420/2520/4420/4520 Data Sheet” (DS39631).
This family offers the advantages of all PIC18
microcontrollers – namely, high computational performance at an economical price – with the addition of
high-endurance, Enhanced Flash program memory.
On top of these features, the PIC18F2423/2523/4423/
4523 family introduces design enhancements that
make these microcontrollers a logical choice for many
high-performance, power-sensitive applications.
1.1New Core Features
1.1.1nanoWatt TECHNOLOGY
All of the devices in the PIC18F2423/2523/4423/4523
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 also can run
with its CPU core disabled and 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 power-saving 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 4.0 “Electrical Characteristics” for values.
1.1.2MULTIPLE OSCILLATOR OPTIONS
AND FEATURES
All of the devices in the PIC18F2423/2523/4423/4523
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.
• 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 that offers eight clock
frequencies: an 8 MHz clock and an INTRC source
(approximately 31 kHz), as well as a range of six
user-selectable clock frequencies, between
125 kHz to 4 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, allowing clock speeds
of up to 40 MHz from the HS clock source. Used
with the internal oscillator, the PLL gives users a
complete selection of clock speeds, from 31 kHz
to 32 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:
• Fail-Safe Clock Monitor: Constantly monitors
the main clock source against a reference signal
provided by the internal oscillator. If a clock failure
occurs, the controller is switched to the internal
oscillator block, allowing for continued operation
or a safe application shutdown.
• Two-Speed Start-up: 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.
programmable acquisition time, allowing for a
channel to be selected and a conversion to be
initiated without waiting for a sampling period,
thereby reducing code overhead.
• Memory Endurance: The Enhanced Flash cells
for both program memory and data EEPROM are
rated to last for many thousands of erase/write
cycles – up to 100,000 for program memory and
1,000,000 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 is possible to create an
application that can update itself in the field.
• Extended Instruction Set: The PIC18F2423/
2523/4423/4523 family introduces an optional
extension to the PIC18 instruction set that 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 one, two or four 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, and auto-restart, to reactivate outputs
once the condition has cleared.
• Enhanced Addressable USART: This serial
communication module is capable of standard
RS-232 operation and provides support for the
LIN/J2602 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).
• Extended Watchdog Timer (WDT): This
Enhanced version incorporates a 16-bit prescaler,
allowing an extended time-out range that is stable
across operating voltage and temperature. See
Section 4.0 “Electrical Characteristics” for
time-out periods.
1.3Details on Individual Family
Members
Devices in the PIC18F2423/2523/4423/4523 family are
available in 28-pin and 40/44-pin packages. Block
diagrams for the two groups are shown in Figure 1-1
and Figure 1-2.
The devices are differentiated from each other in these
ways:
• Flash Program Memory:
- PIC18F2423/4423 devices – 16 Kbytes
- PIC18F2523/4523 devices – 32 Kbytes
• A/D Channels:
- PIC18F2423/2523 devices – 10
- PIC18F4423/4523 devices – 13
• I/O Ports:
- PIC18F2423/2523 devices – Three bidirectional
ports
- PIC18F4423/4523 devices – Five bidirectional
ports
• CCP and Enhanced CCP Implementation:
- PIC18F2423/2523 devices – Two standard
CCP modules
- PIC18F4423/4523 devices – One standard
CCP module and one ECCP module
• Parallel Slave Port – Present only on
PIC18F4423/4523 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 Table 1-2 and
Table 1-3.
Members of the PIC18F2423/2523/4423/4523 family
are available only as low-voltage devices, designated
by “LF” (such as PIC18LF2423), and function over an
extended V
ST= Schmitt Trigger input with CMOS levelsI= Input
O=Output P=Power
2
C=I2C™/SMBus
I
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
QFN
126
96
107
Pin
Typ e
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).
Master Clear (Reset) input. This pin is an active-low
Reset to the device.
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/CLKI, OSC2/CLKO
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 CLKO, 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
2
C=I2C™/SMBus
I
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
PDIP QFN TQFP
11818
133230
143331
Pin
Type
I
P
I
I
I
I/O
O
O
I/O
Buffer
Typ e
ST
ST
ST
CMOS
TTL
—
—
TTL
Description
Master Clear (input) or programming voltage (input).
Master Clear (Reset) input. This pin is an active-low
Reset to the device.
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/CLKI,
OSC2/CLKO 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 CLKO, 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
2
C=I2C™/SMBus
I
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
PDIP QFN TQFP
193838
203939
214040
224141
2722
2833
2944
3055
Pin
Buffer
Type
Typ e
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 the 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 Analog-to-Digital (A/D) Converter module has
10 inputs for the PIC18F2423/2523 devices and 13 for
the PIC18F4423/4523 devices. This module allows
conversion of an analog input signal to a corresponding
12-bit digital number.
The module has five registers:
• A/D Result High Register (ADRESH)
• A/D Result Low Register (ADRESL)
• A/D Control Register 0 (ADCON0)
• A/D Control Register 1 (ADCON1)
• A/D Control Register 2 (ADCON2)
Of the ADCONx registers:
• ADCON0 (shown in Register 2-1) – Controls the
module’s operation
• ADCON1 (Register 2-2) – Configures the
functions of the port pins
• ADCON2 (Register 2-3) – Configures the A/D
clock source, programmed acquisition time and
justification
REGISTER 2-1:ADCON0: A/D CONTROL REGISTER 0
U-0U-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
——CHS3CHS2CHS1CHS0GO/DONEADON
bit 7bit 0
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
0001AA A AAAAAAAAAA
0010AA A AAAAAAAAAA
0011D A AAAAAAAAAAA
0100DDAAAAAAAAAAA
0101DDDAAAAAAAAAA
0110DDDDAAAAAAAAA
0111
(1)
DDDDDAAAAAAAA
1000D D DDDDAAAAAAA
1001D D DDDDDAAAAAA
1010D D DDDDDDAAAAA
1011D D DDDDDDDAAAA
1100D D DDDDDDDDAAA
1101D D DDDDDDDDDAA
1110D D DDDDDDDDDDA
1111D D DDDDDDDDDDD
REGISTER 2-2:ADCON1: A/D CONTROL REGISTER 1
U-0U-0R/W-0R/W-0R/W-0
(1)
——VCFG1VCFG0PCFG3PCFG2PCFG1PCFG0
bit 7bit 0
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 7-6Unimplemented: Read as ‘0’
bit 5VCFG1: Voltage Reference Configuration bit (V
1 = V
REF- (AN2)
0 = V
SS
REF- source)
bit 4VCFG0: Voltage Reference Configuration bit (VREF+ source)
REF+ (AN3)
1 = V
DD
0 = V
bit 3-0PCFG<3:0>: A/D Port Configuration Control bits:
R/W
(1)
R/W
(1)
R/W
(1)
Note 1: The POR value of the PCFG bits depends on the value of the PBADEN Configuration bit. When
Note 1: Channels, AN5 through AN7, are not available on PIC18F2423/2523 devices.
2: I/O pins have diode protection to VDD and VSS.
0X
1X
X
1
X0
The analog reference voltage is software selectable to
either the device’s positive and negative supply voltage
(VDD and VSS), or the voltage level on the RA3/AN3/
REF+ and RA2/AN2/VREF-/CVREF pins.
V
The A/D Converter has a unique feature of being able
to operate while the device is in Sleep mode. To operate in Sleep, the A/D conversion clock must be derived
from the A/D’s internal RC oscillator.
The output of the sample and hold is the input into the
converter, which generates the result via successive
approximation.
FIGURE 2-1:A/D BLOCK DIAGRAM
A device Reset forces all registers to their Reset state.
This forces the A/D module to be turned off and any
conversion in progress is aborted.
Each port pin associated with the A/D Converter can be
configured as an analog input or as a digital I/O. The
ADRESH and ADRESL registers contain the result of
the A/D conversion. When the A/D conversion is complete, the result is loaded into the ADRESH:ADRESL
register pair, the GO/DONE
bit (ADCON0<1>) is cleared
and A/D Interrupt Flag bit, ADIF, is set.
The block diagram of the A/D module is shown in
Figure 2-1.
The value in the ADRESH:ADRESL registers is
unknown following POR and BOR Resets and is not
affected by any other Reset.
After the A/D module has been configured as desired,
the selected channel must be acquired before the
conversion is started. The analog input channels must
have their corresponding TRIS bits selected as inputs.
To determine acquisition time, see Section 2.1 “A/DAcquisition Requirements”.
After this acquisition time has elapsed, the A/D conversion can be started. An acquisition time can be
programmed to occur between setting the GO/DONE
bit and the actual start of the conversion.
The following steps should be followed to perform an A/D
conversion:
1.Configure the A/D module:
• Configure analog pins, voltage reference and
digital I/O (ADCON1)
• Select A/D input channel (ADCON0)
• Select A/D acquisition time (ADCON2)
• Select A/D conversion clock (ADCON2)
• Turn on the A/D module (ADCON0)
2.Configure the A/D interrupt (if desired):
• Clear ADIF bit
• Set ADIE bit
• Set GIE bit
3.Wait the required acquisition time (if required).
4.Start conversion by setting the GO/DONE
bit
(ADCON0<1>).
5.Wait for the A/D conversion to complete by either:
• Polling for the GO/DONE
bit to be cleared
OR
• Waiting for the A/D interrupt
6.Read the A/D Result registers (ADRESH:ADRESL)
and clear the ADIF bit, if required.
7.For the next conversion, go to step 1 or step 2,
as required.
For the A/D Converter to meet its specified accuracy,
the charge holding capacitor (C
to fully charge to the input channel voltage level. The
analog input model is shown in Figure 2-3.
The source impedance (R
switch (R
SS) impedance directly affect the time
required to charge the capacitor, C
switch (R
(V
SS) impedance varies over the device voltage
DD). The source impedance affects the offset voltage
at the analog input (due to pin leakage current). The
maximum recommended impedance for analog
sources is 2.5 kΩ.
After the analog input channel is selected (changed),
the channel must be sampled for at least the minimum
acquisition time before starting a conversion.
HOLD) must be allowed
S) and the internal sampling
HOLD. The sampling
To calculate the minimum acquisition time, Equation 2-1
may be used. This equation assumes that 1/2 LSb error
is used (4,096 steps for the A/D). The 1/2 LSb error is the
maximum error allowed for the A/D to meet its specified
resolution.
Example 2-3 shows the calculation of the minimum
required acquisition time, T
based on the application system assumptions shown in
Table 2-1:
TABLE 2-1:TACQ ASSUMPTIONS
CHOLD =25 pF
Rs=2.5 kΩ
Conversion Error≤1/2 LSb
DD =3V → Rss = 4 kΩ
V
Temperature=85°C (system maximum)
Note:When the conversion is started, the
holding capacitor is disconnected from the
input pin.
EQUATION 2-1:ACQUISITION TIME
TACQ =Amplifier Settling Time + Holding Capacitor Charging Time + Temperature Coefficient
AMP + TC + TCOFF
=T
ACQ. This calculation is
EQUATION 2-2:A/D MINIMUM CHARGING TIME
VHOLD = (VREF – (VREF/4096)) • (1 – e
or
C = -(CHOLD)(RIC + RSS + RS) ln(1/4096)
T
(-TC/CHOLD(RIC + RSS + RS))
)
EQUATION 2-3:CALCULATING THE MINIMUM REQUIRED ACQUISITION TIME
T
ACQ =TAMP + TC + TCOFF
TAMP =0.2 μs
COFF=(Temp – 25°C)(0.02 μs/°C)
T
(85°C – 25°C)(0.02 μs/°C)
1.2 μs
Temperature coefficient is only required for temperatures > 25°C. Below 25°C, T
The ADCON2 register allows the user to select an
acquisition time that occurs each time the GO/DONE
bit is set. It also gives users the option of having an
automatically determined acquisition time.
Acquisition time may be set with the ACQT<2:0> bits
(ADCON2<5:3>), which provide a range of 2 to 20 T
When the GO/DONE
bit is set, the A/D module continues to sample the input for the selected acquisition
time, then automatically begins a conversion. Since the
acquisition time is programmed, there may be no need
to wait for an acquisition time between selecting a
channel and setting the GO/DONE
bit.
Manual acquisition time is selected when
ACQT<2:0> = 000. When the GO/DONE
bit is set,
sampling is stopped and a conversion begins. The user
is responsible for ensuring the required acquisition time
has passed between selecting the desired input
channel and setting the GO/DONE
bit. This option is
also the default Reset state of the ACQT<2:0> bits and
is compatible with devices that do not offer
programmable acquisition times.
In either case, when the conversion is completed, the
GO/DONE
bit is cleared, the ADIF flag is set and the
A/D begins sampling the currently selected channel
again. If an acquisition time is programmed, there is
nothing to indicate if the acquisition time has ended or
if the conversion has begun.
AD.
2.3Selecting the A/D Conversion
Clock
The A/D conversion time per bit is defined as TAD. The
A/D conversion requires 13 T
The source of the A/D conversion clock is software
selectable.
There are seven possible options for T
•2 TOSC• 32 TOSC
•4 TOSC• 64 TOSC
•8 TOSC• Internal RC Oscillator
OSC
•16 T
For correct A/D conversions, the A/D conversion clock
(T
AD) must be as short as possible, but greater than the
minimum T
AD. (For more information, see parameter 130
on page 41.)
Table 2-2 shows the resultant T
the device operating frequencies and the A/D clock
source selected.
AD per 12-bit conversion.
AD:
AD times derived from
TABLE 2-2:TAD vs. DEVICE OPERATING FREQUENCIES
A/D Clock Source (TAD)
OperationADCS<2:0>Maximum F
2 TOSC0002.50 MHz
4 TOSC1005.00 MHz
OSC00110.00 MHz
8 T
16 TOSC10120.00 MHz
32 T
OSC01040.00 MHz
OSC11040.00 MHz
64 T
(2)
RC
x11 1.00 MHz
Note 1: The RC source has a typical TAD time of 2.5 μs.
2: For device frequencies above 1 MHz, the device must be in Sleep for the entire conversion or a F
divider should be used instead; otherwise, the A/D accuracy specification may not be met.
The selection of the automatic acquisition time and A/D
conversion clock is determined in part by the clock
source and frequency while in a power-managed mode.
If the A/D is expected to operate while the device is in
a power-managed mode, the ADCS<2:0> bits in
ADCON2 should be updated in accordance with the
clock source to be used. The ACQT<2:0> bits do not
need to be adjusted as the ADCS<2:0> bits adjust the
AD time for the new clock speed. After entering the
T
mode, an A/D acquisition or conversion may be started.
Once started, the device should continue to be clocked
by the same clock source until the conversion has been
completed.
If desired, the device may be placed into the
corresponding Idle mode during the conversion. If the
device clock frequency is less than 1 MHz, the A/D RC
clock source should be selected.
Operation in Sleep mode requires the A/D F
be selected. If bits, ACQT<2:0>, are set to ‘000’ and a
conversion is started, the conversion will be delayed
one instruction cycle to allow execution of the SLEEP
instruction and entry to Sleep mode. The IDLEN bit
(OSCCON<7>) must have already been cleared prior
to starting the conversion.
RC clock to
2.5Configuring Analog Port Pins
The ADCON1, TRISA, TRISB and TRISE registers all
configure the A/D port pins. The port pins needed as
analog inputs must have their corresponding TRIS bits
set (input). If the TRIS bit is cleared (output), the digital
output level (V
The A/D operation is independent of the state of the
CHS<3:0> bits and the TRIS bits.
Note 1: When reading the PORT register, all pins
OH or VOL) will be converted.
configured as analog input channels will
read as cleared (a low level). Analog conversion on pins configured as digital pins
can be performed. The voltage on the pin
will be accurately converted.
2: Analog levels on any pin defined as a
digital input may cause the digital input
buffer to consume current out of the
device’s specification limits.
3: The PBADEN bit in Configuration
Register 3H configures PORTB pins to
reset as analog or digital pins by controlling
how the PCFG<3:0> bits in ADCON1 are
reset.
Holding capacitor is disconnected from analog input (typically 100 ns)
TAD9 TAD10TCY – TAD
ADRESH:ADRESL are loaded, GO/DONE bit is cleared,
ADIF bit is set, holding capacitor is connected to analog input.
Conversion starts
b2
b11
b8
b7
b6
b5
b4
b3
b10
b9
On the following cycle:
Discharge
TAD13TAD12
b0b1
TAD1
(typically 200 ns)
1
2
34
5
67
813
Set GO/DONE bit
(Holding capacitor is disconnected)
9
12
Conversion starts
1
2
3
4
(Holding capacitor continues
acquiring input)
T
ACQT Cycles
TAD Cycles
Automatic
Acquisition
Time
b0b11
b8
b7b6
b5
b4
b1
b10
b9
ADRESH:ADRESL are loaded, GO/DONE bit is cleared,
ADIF bit is set, holding capacitor is connected to analog input.
On the following cycle:
TAD1
Discharge
10
11
b3
b2
(typically
200 ns)
Points to end of T
ACQT period (current black arrow)
2.6A/D Conversions
Figure 2-4 shows the operation of the A/D Converter
after the GO/DONE
ACQT<2:0> bits are cleared. A conversion is started
after the following instruction to allow entry into Sleep
mode before the conversion begins.
Figure 2-5 shows the operation of the A/D Converter
after the GO/DONE
bits have been set to ‘010’ and a 4 T
has been selected before the conversion starts.
Clearing the GO/DONE
the current conversion. The A/D Result register pair will
NOT be updated with the partially completed A/D
conversion sample. This means, the ADRESH:ADRESL
registers will continue to contain the value of the last
completed conversion (or the last value written to the
ADRESH:ADRESL registers).
bit has been set and the
bit has been set, the ACQT<2:0>
AD acquisition time
bit during a conversion will abort
After the A/D conversion is completed or aborted, a
CY wait is required before the next acquisition can
2T
be started. After this wait, acquisition on the selected
channel is automatically started.
Note:The GO/DONE bit should NOT be set in
the same instruction that turns on the A/D.
Code should wait at least 3 TAD after
enabling the A/D before beginning an
acquisition and conversion cycle.
2.7Discharge
The discharge phase is used to initialize the value of
the holding capacitor. The array is discharged before
every sample. This feature helps to optimize the unitygain amplifier, as the circuit always needs to charge the
capacitor array, rather than charge/discharge based on
previous measure values.
An A/D conversion can be started by the Special Event
Trigger of the CCP2 module. This requires that the
CCP2M<3:0> bits (CCP2CON<3:0>) be programmed
as ‘1011’ and that the A/D module is enabled (ADON
bit is set). When the trigger occurs, the GO/DONE
will be set, starting the A/D acquisition and conversion,
and the Timer1 (or Timer3) counter will be reset to zero.
Timer1 (or Timer3) is reset to automatically repeat the
A/D acquisition period with minimal software overhead
bit
The appropriate analog input channel must be selected
and the minimum acquisition period is either timed by
the user or an appropriate TACQ time is selected before
the Special Event Trigger sets the GO/DONE
bit (starts
a conversion).
If the A/D module is not enabled (ADON is cleared), the
Special Event Trigger will be ignored by the A/D
module, but will still reset the Timer1 (or Timer3)
counter.
TRISBPORTB Data Direction Control Register(Note 4)
LATBPORTB Data Latch Register (Read and Write to Data Latch)(Note 4)
PORTE
TRISE
(1)
LATE
(1)
(1)
————RE3
IBFOBFIBOVPSPMODE—TRISE2TRISE1TRISE0(Note 4)
—————PORTE Data Latch Register(Note 4)
(3)
RE2RE1RE0(Note 4)
Legend: — = unimplemented, read as ‘0’. Shaded cells are not used for A/D conversion.
Note 1: These registers and/or bits are not implemented on PIC18F2423/2523 devices and are read as ‘0’.
2: PORTA<7:6> and their direction bits are individually configured as port pins based on various primary
oscillator modes. When disabled, these bits read as ‘0’.
3: RE3 port bit is available only as an input pin when the MCLRE Configuration bit is ‘0’.
4: For these Reset values, see Section 4.0 “Reset” of the “PIC18F2420/2520/4420/4520 Data Sheet”
bits, refer to Section 23.1 “Configuration
Bits” in the “PIC18F2420/2520/4420/4520
3.1Device ID Registers
The Device ID registers are read-only registers. They
identify the device type and revision for device programmers and can be read by firmware using table
reads.
Data Sheet” (DS39631). Device ID information presented in this section is for the
PIC18F2423/2523/4423/4523 devices only.
TABLE 3-1:DEVICE IDs
Default/
File NameBit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
(1)
3FFFFEh DEVID1
3FFFFFh DEVID2
Legend:x = unknown, u = unchanged, — = unimplemented. Shaded cells are unimplemented, read as ‘0’.
Note 1:DEVID registers are read-only and cannot be programmed by the user.
2:See Register 3-1 and Register 3-2 for DEVID1 and DEVID2 values.
DEV3DEV2DEV1DEV0REV3REV2REV1REV0xxxx xxxx
(1)
DEV11DEV10DEV9DEV8DEV7DEV6DEV5DEV4xxxx xxxx
Unprogrammed
Value
REGISTER 3-1:DEVID1: DEVICE ID REGISTER 1 FOR PIC18F2423/2523/4423/4523
RRRRRRRR
DEV3DEV2DEV1DEV0REV3REV2REV1REV0
bit 7bit 0
(2)
(2)
Legend:
R = Read-only bitP = Programmable bitU = Unimplemented bit, read as ‘0’
-n = Value when device is unprogrammedu = Unchanged from programmed state
Note:Other than some basic data, this section documents only the PIC18F2423/2523/4423/4523 devices’ specifi-
cations that differ from those of the PIC18F2420/2520/4420/4520 devices. For detailed information on the
electrical specifications shared by the PIC18F2423/2523/4423/4523 and PIC18F2420/2520/4420/4520
devices, see the “PIC18F2420/2520/4420/4520 Data Sheet” (DS39631).
Absolute Maximum Ratings
Ambient temperature under bias.............................................................................................................-40°C to +125°C
Storage temperature .............................................................................................................................. -65°C to +150°C
Voltage on any pin with respect to V
Voltage on V
Voltage on MCLR
Total power dissipation (Note 1) ...............................................................................................................................1.0W
Maximum current out of V
Maximum current into V
Input clamp current, I
Output clamp current, I
Maximum output current sunk by any I/O pin..........................................................................................................25 mA
Maximum output current sourced by any I/O pin ....................................................................................................25 mA
Maximum current sunk by all ports .......................................................................................................................200 mA
Maximum current sourced by all ports ..................................................................................................................200 mA
Note 1: Power dissipation is calculated as follows:
DD with respect to VSS ......................................................................................................... -0.3V to +7.5V
with respect to VSS(Note 2)......................................................................................... 0V to +13.25V
SS pin ...........................................................................................................................300 mA
DD pin ..............................................................................................................................250 mA
IK (VI < 0 or VI > VDD)...................................................................................................................... ±20 mA
OK (VO < 0 or VO > VDD) .............................................................................................................. ±20 mA
Pdis = V
2: Voltage spikes below V
latch-up. Thus, a series resistor of 50-100Ω should be used when applying a “low” level to the MCLR
RE3 pin, rather than pulling this pin directly to V
DD x {IDD – ∑ IOH} + ∑ {(VDD – VOH) x IOH} + ∑(VOL x IOL)
(†)
SS (except VDD and MCLR) ................................................... -0.3V to (VDD + 0.3V)
SS at the MCLR/VPP/RE3 pin, inducing currents greater than 80 mA, may cause
/VPP/
SS.
† 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.
Note 1: If the A/D clock source is selected as RC, a time of T
CY 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.
. . .
. . .
TCY
0
FIGURE 4-4:A/D CONVERSION TIMING
TABLE 4-2:A/D CONVERSION REQUIREMENTS
Param
130T
131T
132TACQAcquisition Time
135T
137TDISDischarge Time0.2—μs
Note 1: The time of the A/D clock period is dependent on the device frequency and the T
SymbolCharacteristicMinMaxUnitsConditions
No.
ADA/D Clock PeriodPIC18FXXXX0.812.5
PIC18LFXXXX1.425.0
(1)
μsTOSC based, VREF≥ 3.0V
(1)
μsVDD = 3.0V;
PIC18FXXXX—1μsA/D RC mode
PIC18LFXXXX—3μsVDD = 3.0V; A/D RC mode
CNVConversion Time
(not including acquisition time)
(3)
SWCSwitching Time from Convert → Sample—(Note 4)
(2)
1314TAD
1.4—μs
2: ADRES registers may be read on the following TCY cycle.
3: The time for the holding capacitor to acquire the “New” input voltage when the voltage changes full scale
after the conversion (V
4: On the following cycle of the device clock.
DD to VSS or VSS to VDD). The source impedance (RS) on the input channels is 50Ω.
This appendix discusses the considerations for
converting from previous versions of a device to the
ones listed in this data sheet. Typically, these changes
are due to the differences in the process technology
used. An example of this type of conversion is from a
PIC16C74A to a PIC16C74B.
Not Applicable
APPENDIX D:MIGRATION FROM
BASELINE TO
ENHANCED DEVICES
This section discusses how to migrate from a Baseline
device (i.e., PIC16C5X) to an Enhanced MCU device
(i.e., PIC18FXXX).
The following are the list of modifications over the
PIC16C5X microcontroller family:
A detailed discussion of the differences between the
mid-range MCU devices (i.e., PIC16CXXX) and the
enhanced devices (i.e., PIC18FXXX) is provided in
AN716, “Migrating Designs from PIC16C74A/74B to
PIC18C442”. The changes discussed, while device
specific, are generally applicable to all mid-range to
enhanced device migrations.
This Application Note is available as Literature Number
DS00716.
APPENDIX F:MIGRATION FROM
HIGH-END TO
ENHANCED DEVICES
A detailed discussion of the migration pathway and
differences between the high-end MCU devices (i.e.,
PIC17CXXX) and the enhanced devices (i.e.,
PIC18FXXX) is provided in AN726, “PIC17CXXX toPIC18CXXX Migration”. This Application Note is
available as Literature Number DS00726.
Microchip provides online support via our WWW site at
www.microchip.com. This web site is used as a means
to make files and information easily available to
customers. Accessible by using your favorite Internet
browser, the web site contains the following
information:
• Product Support – Data sheets and errata,
application notes and sample programs, design
resources, user’s guides and hardware support
documents, latest software releases and archived
software
• General Technical Support – Frequently Asked
Questions (FAQ), technical support requests,
online discussion groups, Microchip consultant
program member listing
• Business of Microchip – Product selector and
ordering guides, latest Microchip press releases,
listing of seminars and events, listings of
Microchip sales offices, distributors and factory
representatives
CUSTOMER CHANGE NOTIFICATION
SERVICE
CUSTOMER SUPPORT
Users of Microchip products can receive assistance
through several channels:
• Distributor or Representative
• Local Sales Office
• Field Application Engineer (FAE)
• Technical Support
• Development Systems Information Line
Customers should contact their distributor,
representative or field application engineer (FAE) for
support. Local sales offices are also available to help
customers. A listing of sales offices and locations is
included in the back of this document.
Technical support is available through the web site
at: http://support.microchip.com
Microchip’s customer notification service helps keep
customers current on Microchip products. Subscribers
will receive e-mail notification whenever there are
changes, updates, revisions or errata related to a
specified product family or development tool of interest.
To register, access the Microchip web site at
www.microchip.com, click on Customer Change
Notification and follow the registration instructions.
It is our intention to provide you with the best documentation possible to ensure successful use of your Microchip product. If you wish to provide your comments on organization, clarity, subject matter, and ways in which our documentation
can better serve you, please FAX your comments to the Technical Publications Manager at (480) 792-4150.
Please list the following information, and use this outline to provide us with your comments about this document.
1. What are the best features of this document?
2. How does this document meet your hardware and software development needs?
3. Do you find the organization of this document easy to follow? If not, why?
4. What additions to the document do you think would enhance the structure and subject?
5. What deletions from the document could be made without affecting the overall usefulness?
6. Is there any incorrect or misleading information (what and where)?