0% found this document useful (0 votes)
48 views5 pages

ADC in LPC2148 ARM7 Microcontroller Analog To Digital Converter

Uploaded by

forgeryfraud420
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views5 pages

ADC in LPC2148 ARM7 Microcontroller Analog To Digital Converter

Uploaded by

forgeryfraud420
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

ADC in LPC2148 ARM7 Microcontroller Analog to Digital

Converter
Microcontrollers are very useful especially when it comes to communicate with other devices,
such as sensors, motors, switches, memory and even other microcontroller. As we all know
many interface methods have been developed over years to solve complex problem of
balancing need of features, cost, size, power consumption, reliability etc. but ADC Analog-to-
Digital converter remains famous among all. Interfacing analog sensors using ADC is simple
and efficient technique to read data from sensor.

What is ADC & its Resolution?


Analog to Digital Converter (ADC) is used to convert analog signal/voltage into its equivalent
digital number so that microcontroller can process that numbers and make it human readable.
The ADC characterized by resolution. The resolution of ADC indicates the number of digital
values. Let’s take example: In LPC2148 microcontroller we have in-built 10-bit ADC. So for
10-bit ADC resolution is 10-bit and maximum value will be 210=1024. This means our digital
value or discrete level lies between 0 to 1023. There is one more term important to understand
while dealing with ADC and it is step size. Step size is the minimum change in input voltage
which can be resolved by ADC. The concept of step size is closely associated with the
resolution of ADC.
.

So in this case we can measure minimum 2.23 mV (Approx.) . This is how step size defines
an accuracy of ADC circuit.

Introduction: ADC in LPC2148 ARM7 Microcontroller


The ADC in LPC2148 ARM7 Microcontroller is 10-bit successive approximation analog
to digital converter. The features are listed as:
 LPC2148 has two inbuilt ADC Modules, named as ADC0 & ADC1.
 ADC0 has 6-Channels (AD0.1-AD0.6).
 ADC1 has 8-Channels (AD1.0-AD1.7).
 ADC operating frequency is 4.5 MHz (max.), operating frequency decides the conversion
time.
There are several registers associated with ADC feature but we will mainly discussing about
ADC Control Register (ADCR) & ADC Global Data Register (ADGDR).
Registers of ADC in LPC2148 Microcontroller
There are several registers which will be used to setup and configure ADC feature in LPC2148.
The two registers we will be concerning about: ADCR (A/D Control Register) and ADGDR
(A/D Global Data register).

Register
Function
Name

A/D Control Register: The ADCR register must be written to select the
ADCR
operating mode before A/D conversion can occurs.

A/D Global Data Register: This register contains ADC’s DONE bit and the
ADGDR
result of the most recent A/D conversion.

A/D Status Register: This register contains DONE and OVERRUN flag for all
ADSTAT
the A/D Channels, as well as the A/D interrupt flag.

A/D Global Start Register: This address can be written (in the AD0 address
ADGSR
range) to start conversions in both A/D converters simultaneously.

A/D Interrupt Enable Register: This register contains enable bits that allow
ADINTEN the DONE flag of each A/D channel to be included or excluded from
contributing to the generation of an A/D interrupt.

ADDRx A/D Channel x Data: ‘x’ varies from 0 to 7


Programming Steps: ADC in LPC2148 ARM7 Microcontroller

 Configure input pin as analog input pin for ADC block

 Select channel we wish to use in our conversion

 Select clock for conversion & start conversion

 Wait for conversion to complete

 Read 10-bit conversion result

 Convert this result i.e. ADC output into decimal number

 Display reading on serial emulator or display device

Example Project: In this example project we will be using 10K POT to provide analog input
at ADC Channel 0 i.e. Pin P0.28 of LPC2148 Microcontroller. To read ADC count from POT
we will configure UART0 of LPC2148 and read data on terminal emulator. When we vary
resistance of POT the change in ADC count will reflect on terminal in real time. The circuit
connection shown as:

CIRCUIT DIAGRAM: ADC in LPC2148 ARM7 Microcontroller

Circuit: ADC in LPC2148 ARM7 Microcontroller


Source Code: ADC in LPC2148 ARM7 Microcontroller

You might also like