0% found this document useful (0 votes)
25 views30 pages

FALLSEM2024-25 BEEE213L TH VL2024250101176 2024-08-07 Reference-Material-I

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

FALLSEM2024-25 BEEE213L TH VL2024250101176 2024-08-07 Reference-Material-I

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

Analog to Digital Converter

Motivation

• Embedded computers often need to monitor the characteristics of the surrounding


environment, such as sound, temperature, pressure, acceleration, strain, and light
intensity
• These characteristics are analog because they can take on an infinite number of
possible values (even within a limited range).
• For example, a temperature sensor might indicate its reading by setting its output
signal’s voltage to 0.05 V per degree C. A reading of 0.5 V would indicate a
temperature of 10°C, whereas a reading of 0.50005 V would indicate 10.001°C.
• This analog signal must be converted to a digital (numerical) value for the program
to process it; this is done with an analog-to-digital converter (ADC). Whether the
ADC will be able to differentiate between these two temperatures depends on its
resolution and other factors.
• In order to generate sounds accurately (with little distortion), the MCU must
generate analog voltage signals to drive headphones or speakers. The digital values
representing the sound signal can be converted to an analog voltage using a
digital-to-analog converter (DAC).
Quantization

• Quantization: Process of selecting a discrete digital value to represent


an analog value
• Sampling :Process of converting a continuous-time signal to a series
of discrete-time samples
Successive approximation ADC

We can use a single comparator to make a series of comparisons, changing its


reference voltage for each. The successive approximation architecture uses this
approach and performs a binary search to quantize the input.

Most MCUs with built-in ADCs use a successive approximation ADC


The converter first clears all bits in the SAR to zero. It then sets the most significant bit in
the SAR to one. The comparator determines if the input voltage is greater than the DAC
output voltage. If so, the first bit is left as one, or else it is cleared to zero. This process
advances to the next bit and repeats until all bits have been determined.
Sample and hold circuit

When the switch is closed, the circuit will sample the input by charging the
capacitor to the input voltage. Opening the switch disconnects the capacitor from
the input, so the circuit will hold the saved value of the input voltage for the ADC to
perform its conversion
Single ended vs., differential

A single-ended signal represents information with the voltage difference


between the signal and ground.

Differential signals represent information with the voltage difference


between two signals, neither of which is ground.

This reduces the effects of noise. Some ADCs support differential signal
inputs.

These ADCs contain hardware that allows direct measurement of the voltage
difference, making conversion a single-step process.

An ADC without differential input signal support needs to convert each of


the two signals separately, and then use software to find the difference.
Reference voltage

• Two voltage references (V+ref and V–ref) are needed to define the
boundaries of the conversion range.
• Often the positive supply rail (e.g. 3.3V) is used as the positive reference and
ground is used as the negative reference
• Digital electronics work with binary values, so the number of discrete output
values is typically a power of 2. The resolution describes the number of bits
(B) used to hold the output value.
• For example, a code with eight-bit resolution has 256 possible output values.
• An output value n does not represent an exact voltage, but instead a range of
voltages

• As the resolution B increases, the quantization becomes more accurate. The


maximum quantization error is typically half of this voltage range.
Sampling

• How often do we need to update an output or sample an input to get an


adequate signal?
• A sampled signal is a discrete-time representation (a series of individual
samples) of a continuous-time signal
• The sampling rate determines how often an input is measured, or how
often an output is updated
• Any information between the samples is lost
• In a digital system (such as a microcontroller), a discrete-time signal can be
represented as an array, where each sample in the signal is an array entry
Interfacing
Voice Command ONE Fs=8333Hz
1

0.8

0.6

0.4
Amplitude(mV)

0.2

-0.2

-0.4

-0.6

-0.8

-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 50 Hz Current Signature of a Lamp Load Fs=2048Hz
2.5
Time(s)

amplitude(V) 1.5

0.5

0
0 500 1000 1500 2000 2500
Time(sec)
ADC Pins
Multiple input channels

• The ADC module can perform sampling and conversions on a set of pre-defined
input channels in a round-robin fashion
• This conversion scheme is called scan mode. For a regular group, this mode
scans all channels defined in registers ADC_SQR1, ADC_SQR2, ADC_SQR3, and
ADC_SQR4
• The conversion operation can be set up to perform only once or repeatedly,
depending on bit CONT bit in the ADC_CFGR register
• However, for a regular group, there is only one data register that is shared by all
channels in this group
• Therefore, after each conversion in a regular group, the software needs to read
the data register between continuous sampling.
• An interrupt request or a DMA request can be triggered at the end of each
conversion if enabled. Thus, to reduce the software overhead, we often use the
ADC interrupt handler or the DMA controller to copy the ADC results to a user
buffer.
ADC pins
Data alignment
Next we will examine three applications of the ADC. Both use polling to
determine when the conversion is complete.
1. Voltage measurement
2. Temperature measurement
3. Multichannel ADC
4. Frequency measurement
ADC Trigger signal using Timer
Setting the ADC sampling sequence for regular channels
ADC with DMA

You might also like