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, Accuron,
dsPIC, K
EELOQ, KEELOQ logo, microID, MPLAB, PIC,
PICmicro, PICSTART, PRO MATE, rfPIC and SmartShunt are
registered trademarks of Microchip Technology Incorporated
in the U.S.A. and other countries.
AmpLab, FilterLab, Linear Active Thermistor, Migratable
Memory, MXDEV, MXLAB, SEEVAL, SmartSensor and The
Embedded Control Solutions Company are registered
trademarks of Microchip Technology Incorporated in the
U.S.A.
Analog-for-the-Digital Age, Application Maestro, CodeGuard,
dsPICDEM, dsPICDEM.net, dsPICworks, ECAN,
ECONOMONITOR, FanSense, FlexROM, fuzzyLAB,
In-Circuit Serial Programming, ICSP, ICEPIC, Mindi, MiWi,
MPASM, MPLAB Certified logo, MPLIB, MPLINK, PICkit,
PICDEM, PICDEM.net, PICLAB, PICtail, PowerCal,
PowerInfo, PowerMate, PowerTool, REAL ICE, rfLAB, Select
Mode, Smart Serial, SmartTel, Total Endurance, UNI/O,
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...................................................................................................................................................... 29
Appendix C: Migration From Mid-Range to Enhanced Devices........................................................................................................... 38
Appendix D: Migration From High-End to Enhanced Devices ............................................................................................................. 38
Index .................................................................................................................................................................................................... 39
The Microchip Web Site....................................................................................................................................................................... 41
Customer Change Notification Service ................................................................................................................................................ 41
Customer Support ................................................................................................................................................................................ 41
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:
• PIC18F2458• PIC18F4458
• PIC18F2553• PIC18F4553
Note:This data sheet documents only the
devices’ features and specifications that are
in addition to the features and specifications of the PIC18F2455/2550/4455/4550
devices. For information on the features
and specifications shared by
the PIC18F2458/2553/4458/4553 and
PIC18F2455/2550/4455/4550 devices,
see the “PIC18F2455/2550/4455/4550
Data Sheet” (DS39632).
The PIC18F4553 family of devices 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. In addition to these features, the
PIC18F4553 family introduces design enhancements
that make these microcontrollers a logical choice for
many high-performance, power sensitive applications.
1.1Special Features
• 12-Bit A/D Converter: The PIC18F4553 family
implements a 12-bit A/D Converter. The A/D
Converter incorporates programmable acquisition time. This allows for a channel to be selected
and a conversion to be initiated, without waiting
for a sampling period and thus, reducing code
overhead.
1.2Details on Individual Family
Members
The PIC18F2458/2553/4458/4553 devices 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 the
following ways:
1.Flash program memory (24 Kbytes for
PIC18FX458 devices, 32 Kbytes for
PIC18FX553).
2.A/D channels (10 for 28-pin devices, 13 for
40-pin and 44-pin devices).
3.I/O ports (3 bidirectional ports and 1 input only
port on 28-pin devices, 5 bidirectional ports on
40-pin and 44-pin devices).
4.CCP and Enhanced CCP implementation
(28-pin devices have two standard CCP
modules, 40-pin and 44-pin devices have one
standard CCP module and one ECCP module).
5.Streaming Parallel Port (present only on
40/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 Table 1-2 and
Table 1-3.
Members of the PIC18F4553 family are available as
both standard and low-voltage devices. Standard
devices with Enhanced Flash memory, designated with
an “F” in the part number (such as PIC18F2458),
accommodate an operating V
Low-voltage parts, designated by “LF” (such as
PIC18LF2458), function over an extended VDD range
of 2.0V to 5.5V.
Note 1: RE3 is multiplexed with MCLR and is only available when the MCLR Resets are disabled.
2: OSC1/CLKI and OSC2/CLKO are only available in select oscillator modes and when these pins are not being used as digital I/O.
3: RB3 is the alternate pin for CCP2 multiplexing.
and is only available when the MCLR Resets are disabled.
USB
2: OSC1/CLKI and OSC2/CLKO are only available in select oscillator modes and when these pins are not being used as digital I/O.
3: These pins are only available on 44-pin TQFP packages under certain conditions.
4: RB3 is the alternate pin for CCP2 multiplexing.
ST = Schmitt Trigger input with CMOS levels I= Input
O= Output P= Power
Note 1: Alternate assignment for CCP2 when CCP2MX Configuration bit is cleared.
2: Default assignment for CCP2 when CCP2MX Configuration bit is set.
Number
SPDIP,
SOIC
10
Pin
Buffer
Type
1
9
Type
I
ST
P
I
ST
IIAnalog
Analog
O
O
I/O
—
—
TTL
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.
External clock source input. Always associated with pin
function OSC1. (See OSC2/CLKO pin.)
Oscillator crystal or clock output.
Oscillator crystal output. Connects to crystal or resonator in
Crystal Oscillator mode.
In select modes, 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 levels I= Input
O= Output P= Power
Note 1: Alternate assignment for CCP2 when CCP2MX Configuration bit is cleared.
2: Default assignment for CCP2 when CCP2MX Configuration bit is set.
3: These pins are No Connect unless the ICPRT Configuration bit is set. For NC/ICPORTS, the pin is No
Connect unless ICPRT is set and the DEBUG
11818
133230
143331
I
ST
P
I
ST
IIAnalog
Analog
O
—
O
—
I/O
TTL
Configuration bit is cleared.
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.
External clock source input. Always associated with
pin function OSC1. (See OSC2/CLKO 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.
Note 1: Alternate assignment for CCP2 when CCP2MX Configuration bit is cleared.
REF+
REF+
/
ST = Schmitt Trigger input with CMOS levels I= Input
O= Output P= Power
2: Default assignment for CCP2 when CCP2MX Configuration bit is set.
3: These pins are No Connect unless the ICPRT Configuration bit is set. For NC/ICPORTS, the pin is No
Connect unless ICPRT is set and the DEBUG
Pin Number
PDIP QFN TQFP
21919
32020
42121
52222
62323
72424
Pin
Buffer
Type
Type
I/OITTL
Analog
I/OITTL
Analog
I/O
I
Analog
I
Analog
O
Analog
I/O
I
Analog
I
Analog
I/O
I
O
I
I/O
I
Analog
I
I
Analog
O
PORTA is a bidirectional I/O port.
Digital I/O.
Analog input 0.
Digital I/O.
Analog input 1.
TTL
TTL
ST
ST
—
TTL
TTL
TTL
—
Configuration bit is cleared.
Digital I/O.
Analog input 2.
A/D reference voltage (low) input.
Analog comparator reference output.
Digital I/O.
Analog input 3.
A/D reference voltage (high) input.
Digital I/O.
Timer0 external clock input.
Comparator 1 output.
External USB transceiver RCV input.
Digital I/O.
Analog input 4.
SPI slave select input.
High/Low-Voltage Detect input.
Comparator 2 output.
ST = Schmitt Trigger input with CMOS levels I= Input
O= Output P= Power
Note 1: Alternate assignment for CCP2 when CCP2MX Configuration bit is cleared.
2: Default assignment for CCP2 when CCP2MX Configuration bit is set.
3: These pins are No Connect unless the ICPRT Configuration bit is set. For NC/ICPORTS, the pin is No
Connect unless ICPRT is set and the DEBUG
Pin Number
PDIP QFN TQFP
3398
34109
351110
361211
371414
381515
391616
401717
Pin
Type
I/O
I
I
I
I
I/O
I/O
I
I
I/O
I/O
I/O
I
I
O
I/O
I
I/O
O
I/O
I
I
O
I/O
I
I/O
I/O
I
I/O
I/O
I
I/O
Buffer
Type
PORTB is a bidirectional I/O port. PORTB can be software programmed for internal weak pull-ups on all inputs.
TTL
Analog
ST
ST
ST
ST
TTL
Analog
ST
ST
ST
TTL
Analog
ST
—
TTL
Analog
ST
—
TTL
Analog
TTL
—
TTL
TTL
ST
TTL
TTL
ST
TTL
TTL
ST
Configuration bit is cleared.
Digital I/O.
Analog input 12.
External interrupt 0.
Enhanced PWM Fault input (ECCP1 module).
SPI data in.
2
C™ data I/O.
I
Digital I/O.
Analog input 10.
External interrupt 1.
Synchronous serial clock input/output for SPI mode.
Synchronous serial clock input/output for I
Digital I/O.
Analog input 8.
External interrupt 2.
External USB transceiver VMO output.
Digital I/O.
Analog input 9.
Capture 2 input/Compare 2 output/PWM 2 output.
External USB transceiver VPO output.
Digital I/O.
Analog input 11.
Interrupt-on-change pin.
SPP chip select control output.
Digital I/O.
Interrupt-on-change pin.
Low-Voltage ICSP™ Programming enable pin.
Digital I/O.
Interrupt-on-change pin.
In-Circuit Debugger and ICSP programming clock pin.
Digital I/O.
Interrupt-on-change pin.
In-Circuit Debugger and ICSP programming data pin.
ST = Schmitt Trigger input with CMOS levels I= Input
O= Output P= Power
Note 1: Alternate assignment for CCP2 when CCP2MX Configuration bit is cleared.
2: Default assignment for CCP2 when CCP2MX Configuration bit is set.
3: These pins are No Connect unless the ICPRT Configuration bit is set. For NC/ICPORTS, the pin is No
Connect unless ICPRT is set and the DEBUG
Pin Number
PDIP QFN TQFP
153432
163535
173636
234242
244343
254444
2611
Pin
Type
I/O
O
I
I/O
I
I/O
O
I/O
I/O
O
I
I/O
I
I
I/O
I
I/O
O
I/O
I/O
I
I/O
O
Buffer
Type
PORTC is a bidirectional I/O port.
ST
—
ST
ST
CMOS
ST
—
ST
ST
TTL
TTL
—
TTL
TTL
—
TTL
ST
—
ST
ST
ST
ST
—
Configuration bit is cleared.
Digital I/O.
Timer1 oscillator output.
Timer1/Timer3 external clock input.
Digital I/O.
Timer1 oscillator input.
Capture 2 input/Compare 2 output/PWM2 output.
External USB transceiver OE output.
Digital I/O.
Capture 1 input/Compare 1 output/PWM1 output.
Enhanced CCP1 PWM output, channel A.
Digital input.
USB differential minus line (input/output).
External USB transceiver VM input.
Digital input.
USB differential plus line (input/output).
External USB transceiver VP input.
Digital I/O.
EUSART asynchronous transmit.
EUSART synchronous clock (see RX/DT).
Digital I/O.
EUSART asynchronous receive.
EUSART synchronous data (see TX/CK).
SPI data out.
ST = Schmitt Trigger input with CMOS levels I= Input
O= Output P= Power
Note 1: Alternate assignment for CCP2 when CCP2MX Configuration bit is cleared.
2: Default assignment for CCP2 when CCP2MX Configuration bit is set.
3: These pins are No Connect unless the ICPRT Configuration bit is set. For NC/ICPORTS, the pin is No
Connect unless ICPRT is set and the DEBUG
Pin Number
PDIP QFN 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
O
I/O
I/O
O
I/O
I/O
O
Description
PORTD is a bidirectional I/O port or a Streaming
Parallel Port (SPP). PORTD can be software
programmed for internal weak pull-ups on all inputs.
These pins have TTL input buffers when the SPP
module is enabled.
Digital I/O.
Streaming Parallel Port data.
Digital I/O.
Streaming Parallel Port data.
Digital I/O.
Streaming Parallel Port data.
Digital I/O.
Streaming Parallel Port data.
Digital I/O.
Streaming Parallel Port data.
ST
TTL
—
ST
TTL
—
ST
TTL
—
Configuration bit is cleared.
Digital I/O.
Streaming Parallel Port data.
ECCP1 PWM output, channel B.
Digital I/O.
Streaming Parallel Port data.
ECCP1 PWM output, channel C.
Digital I/O.
Streaming Parallel Port data.
ECCP1 PWM output, channel D.
ST = Schmitt Trigger input with CMOS levels I= Input
O= Output P= Power
Note 1: Alternate assignment for CCP2 when CCP2MX Configuration bit is cleared.
2: Default assignment for CCP2 when CCP2MX Configuration bit is set.
3: These pins are No Connect unless the ICPRT Configuration bit is set. For NC/ICPORTS, the pin is No
Connect unless ICPRT is set and the DEBUG
Pin
Buffer
Type
I/O
I
Analog
O
I/O
I
Analog
O
I/O
I
Analog
O
O
P
I/O
I/OSTST
I/O
I/OSTST
I
P
Type
Description
PORTE is a bidirectional I/O port.
ST
Digital I/O.
Analog input 5.
—
ST
SPP clock 1 output.
Digital I/O.
Analog input 6.
—
ST
SPP clock 2 output.
Digital I/O.
Analog input 7.
—
SPP output enable output.
/VPP/RE3 pin.
Internal USB transceiver power supply.
—
When the internal USB regulator is enabled, V
the regulator output.
—
When the internal USB regulator is disabled, VUSB
is the power input for the USB transceiver.
The Analog-to-Digital (A/D) Converter module has
10 inputs for the 28-pin devices and 13 for the 40-pin
and 44-pin 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)
The ADCON0 register, shown in Register 2-1, controls
the operation of the A/D module. The ADCON1
register, shown in Register 2-2, configures the
functions of the port pins. The ADCON2 register,
shown in 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
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-0PCFG3:PCFG0: A/D Port Configuration Control bits:
(2)
(2)
AN6
(2)
AN5
AN4
AN3
PCFG3:
PCFG0
(1)
0000
AN12
AN11
AN10
AN9
AN8
AN7
A A AAAAAAAAAAA
0001AA A AAAAAAAAAA
0010AA A AAAAAAAAAA
0011DA AAAAAAAAAAA
0100DDAAAAAAAAAAA
0101DDDAAAAAAAAAA
0110DDDDAAAAAAAAA
(1)
0111
DDDDDAAAAAAAA
1000DDDDDDAAAAAAA
1001DDDDDDDAAAAAA
1010D D DDDDDDAAAAA
1011D D DDDDDDDAAAA
1100D D DDDDDDDDAAA
1101D D DDDDDDDDDAA
1110D D DDDDDDDDDDA
1111D D DDDDDDDDDDD
A = Analog input D = Digital I/O
R/W
(1)
AN2
AN1
R/W
AN0
(1)
Note 1:The Reset value of the PCFG bits depends on the value of the PBADEN Configuration bit. When
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
V
AIN
12-Bit
A/D
Converter
Reference
Voltage
(Input Voltage)
VCFG1:VCFG0
VREF+
VREF-
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 register) is
cleared and the A/D Interrupt Flag bit, ADIF, is set. The
block diagram of the A/D module is shown in Figure 2-1.
CHS3:CHS0
1100
1011
1010
1001
1000
0111
AN12
AN11
AN10
AN9
AN8
AN7
0110
AN6
0101
AN5
X0
X1
0100
0011
0010
0001
DD
V
0000
AN4
AN3
AN2
AN1
AN0
1X
0X
(1)
(1)
(1)
VSS
Note 1: Channels AN5 through AN7 are not available on 28-pin devices.
The value in the ADRESH:ADRESL registers is
unknown following Power-on and Brown-out 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 an
input. To determine acquisition time, see Section 2.1“A/D Acquisition Requirements”. After this acquisition time has elapsed, the A/D conversion can be
started. An acquisition time can be programmed to
occur between setting the GO/DONE
bit and the actual
start of the conversion.
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 A/D module (ADCON0)
2.Configure 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:
• Set GO/DONE
bit (ADCON0 register)
5.Wait for 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 A/D Result registers (ADRESH:ADRESL);
clear bit ADIF, if required.
7.For next conversion, go to step 1 or step 2, as
required. The A/D conversion time per bit is
defined as T
AD. A minimum wait of 2 TAD is
required before the next acquisition starts.
FIGURE 2-2:A/D TRANSFER FUNCTION
FFFh
FFEh
003h
002h
Digital Code Output
001h
000h
1 LSB
0.5 LSB
1.5 LSB
Analog Input Voltage
3 LSB
2 LSB
2.5 LSB
4095 LSB
4094 LSB
4094.5 LSB
4095.5 LSB
FIGURE 2-3:ANALOG INPUT MODEL
VDD
T = 0.6V
ANx
Rs
VAIN
Legend: CPIN
VT
ILEAKAGE
RIC
SS
C
HOLD
CPIN
5 pF
= Input Capacitance
= Threshold Voltage
= Leakage Current at the pin due to
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
S) and the internal sampling switch (RSS)
impedance directly affect the time required to charge
the capacitor CHOLD. The sampling switch (RSS)
impedance varies over the device voltage (V
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
HOLD) must be allowed
DD). The
To calculate the minimum acquisition time, Equation 2-1
may be used. This equation assumes that 1/2 LSb error
is used (4096 steps for the 12-bit 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 following application system
assumptions:
HOLD =25 pF
C
Rs=2.5 kΩ
Conversion Error≤1/2 LSb
DD =3V → Rss = 4 kΩ
V
Temperature=85°C (system max.)
the minimum acquisition time before starting a
conversion.
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
TC = -(CHOLD)(RIC + RSS + RS) ln(1/4096)
(-TC/CHOLD(RIC + RSS + RS))
)
EQUATION 2-3:CALCULATING THE MINIMUM REQUIRED ACQUISITION TIME
TACQ =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 to use an
automatically determined acquisition time.
Acquisition time may be set with the ACQT2:ACQT0
bits (ADCON2<5:3>), which provides a range of 2 to
AD. When the GO/DONE bit is set, the A/D module
20 T
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
Manual acquisition is selected when
ACQT2:ACQT0 = 000. When the GO/DONE
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 ACQT2:ACQT0 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.
bit.
bit is set,
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
OSC
•2 T
•4 TOSC
•8 TOSC
•16 TOSC
•32 TOSC
•64 TOSC
• Internal RC Oscillator
For correct A/D conversions, the A/D conversion clock
AD) must be as short as possible, but greater than the
(T
minimum T
AD (see parameter 130 for more
information).
Table 2-1 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-1:TAD vs. DEVICE OPERATING FREQUENCIES
A/D Clock Source (TAD)
OperationADCS2:ADCS0Maximum F
2 TOSC0002.50 MHz
4 TOSC1005.00 MHz
OSC00110.00 MHz
8 T
16 TOSC10120.00 MHz
32 T
OSC01040.00 MHz
OSC11048.00 MHz
64 T
(1)
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 ADCS2:ADCS0 bits in
ADCON2 should be updated in accordance with the
clock source to be used. The ACQT2:ACQT0 bits do
not need to be adjusted as the ADCS2:ADCS0 bits
adjust the T
entering the 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 ACQT2:ACQT0 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.
AD time for the new clock speed. After
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
CHS3:CHS0 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 dig-
ital 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 PCFG3:PCFG0 bits in
ADCON1 are reset.
Figure 2-4 shows the operation of the A/D Converter
after the GO/DONE
ACQT2:ACQT0 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
ACQT2:ACQT0 bits are set to ‘010’, and selecting a
4TAD acquisition time 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 and the
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 2 μs 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 unity
gain 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
CCP2M3:CCP2M0 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/
bit will be set, starting the A/D acquisition and
DONE
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
the desired location). The appropriate analog input
channel must be selected and the minimum acquisition
period is either timed by the user, or an appropriate T
time 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.
LATBPORTB Data Latch Register (Read and Write to Data Latch)
PORTE
TRISE
(1)
LATE
(1)
RDPU———RE3
(1)
—————TRISE2TRISE1TRISE0
—————PORTE Data Latch Register
(3)
RE2
(1)
RE1
(1)
RE0
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 28-pin devices and are read as ‘0’.
2: RA6 and its associated latch and data direction bits are enabled as I/O pins based on oscillator configuration;
otherwise, they are 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 the “PIC18F2455/2550/4455/4550 Data Sheet”.
figuration bits, refer to the
“PIC18F2455/2550/4455/4550 Data Sheet”,
Section 25.1 “Configuration Bits”. Device
ID information presented in this section is for
PIC18F2458/2553/4458/4553 only.
PIC18F2458/2553/4458/4553 devices include several
features intended to maximize reliability and minimize
cost through elimination of external components.
These include:
• Device ID Registers
3.1Device ID Registers
The Device ID registers are “read-only” registers.
They identify the device type and revision to device
programmers, and can be read by firmware using
table reads.
Legend:x = unknown, u = unchanged
Note 1: See Register 3-1 and Register 3-2 for DEVID values. DEVID registers are read-only and cannot be programmed by the
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.
REFH Reference Voltage HighVSS + 3.0V—VDD + 0.3VVFor 12-bit resolution
REFL Reference Voltage LowVSS – 0.3V—VDD – 3.0VVFor 12-bit resolution
AINAnalog Input VoltageVREFL—VREFHV
AINRecommended
——2.5kΩ
DD – VSSVFor 12-bit resolution
DD = 5.0V
DD = 5.0V
DD = 5.0V
DD = 5.0V
—VSS≤ VAIN≤ VREF
Impedance of Analog
Voltage Source
REFVREF Input Current
(2)
—
—
—
—
5
150
μA
μA
During VAIN acquisition.
During A/D conversion
cycle.
2:V
REFH current is from the RA3/AN3/VREF+ pin or VDD, whichever is selected as the VREFH source.
REFL current is from the RA2/AN2/VREF-/CVREF pin or VSS, whichever is selected as the VREFL source.
Note 1: If the A/D clock source is selected as RC, a time of T
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.
OLD_DATA
SAMPLING STOPPED
CY is added before the A/D clock starts.
NEW_DATA
TCY
DONE
TABLE 4-2:A/D CONVERSION REQUIREMENTS
Param
130T
131TCNVConversion Time
132TACQAcquisition Time
135T
137T
Note 1: The time of the A/D clock period is dependent on the device frequency and the TAD clock divider.
SymbolCharacteristicMinMaxUnitsConditions
No.
ADA/D Clock PeriodPIC18FXXXX0.812.5
PIC18LFXXXX1.425.0
(1)
μsTOSC based, VREF≥ 3.0V
(1)
μsVDD = 3.0V;
OSC based, VREF full range
T
PIC18FXXXX—1μsA/D RC mode
PIC18LFXXXX—3μsV
(not including acquisition time)
(3)
SWCSwitching Time from Convert → Sample —(Note 4)
DISDischarge Time0.2—μs
(2)
1314TAD
1.4—μs
DD = 3.0V; A/D RC mode
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
DD to VSS or VSS to VDD). The source impedance (RS) on the input channels is 50Ω.
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 D: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.
To :
RE:Reader Response
From:
Application (optional):
Would you like a reply? Y N
Device: Literature Number:
Questions:
1. What are the best features of this document?
2. How does this document meet your hardware and software development needs?
3. Do you find the organization of this document easy to follow? If not, why?
Technical Publications Manager
Name
Company
Address
City / State / ZIP / Country
Telephone: (_______) _________ - _________
Total Pages Sent ________
FAX: (______) _________ - _________
DS39887BPIC18F2458/2553/4458/4553
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)?