MicroprocessorBasedSystems Term-II Lec2 ADC and DAC Interface
MicroprocessorBasedSystems Term-II Lec2 ADC and DAC Interface
time
time
• Sample – the action of duplicating the voltage value of the input
signal.
• Hold – the action of holding the voltage for a brief amount of time by
use of a capacitor.
ANALOG TO DIGITAL CONVERTERS
ANALOG TO DIGITAL CONVERTERS
time
• The Sample is accomplished by momentarily connecting the signal to
a capacitor in order to charge it up to the same voltage.
• The Hold is accomplished by disconnecting the signal and allowing
the conversion to be conducted on the voltage on the capacitor.
time
VR+
VR- time
• Input Voltage Range – The voltage is digitized within a range of
voltages from:
o Voltage Reference High (VR+)
o Voltage Reference High (VR-)
VR+
VR- time
• The goal of the conversion is to convert the analog voltage into a
digital number.
• This is called digitizing, quantizing, or discretizing.
VR+
1
0
VR- time
n=1
Sample=0
• n represents the number of bits in the digital value of the conversion.
VR+
1
0
VR- time
n=1
Sample=0
• n represents the number of bits in the digital value of the conversion.
• The input voltage range is divided into 2n discrete zones.
VR+
1
0
VR- time
n=1
Sample=0
• The larger the n, the closer the digital value is to the actual analog
voltage.
VR+
11
10
01
00
VR- time
n=2
Sample=01
• The larger the n, the closer the digital value is to the actual analog
voltage.
VR+
111
110
101
100
011
010
001
000
VR- time
n=3
Sample=010
• The larger the n, the closer the digital value is to the actual analog
voltage.
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000
n=4 VR-
Sample=0100
• The larger the n, the closer the digital value is to the actual analog
voltage.
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000
n=4 VR-
Sample=0100
• The number of bits n is called the ADC’s resolution.
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000
n=4 VR-
Sample=0100
• The number of bits n is called the ADC’s resolution.
• MCU’s typically have ADC’s with resolutions of 8 to 16 bits.
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000
n=4 VR-
Sample=0100
• The number of bits n is called the ADC’s resolution.
• MCU’s typically have ADC’s with resolutions of 8 to 16 bits.
• The MSP430 has up to 12-bits of resolution.
• The STM32 has up to 16-bits of resolution
ANALOG TO DIGITAL CONVERTERS
ANALOG TO DIGITAL CONVERTERS
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000
n=4 VR-
Sample=0100
• The precision of an ADC is the smallest voltage that the LSB of the
digital output can represent.
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000
n=4 VR-
Sample=0100
• The precision of an ADC is the smallest voltage that the LSB of the
digital output can represent.
• This is found by dividing the input voltage
range by the number of discrete zones.
ANALOG TO DIGITAL CONVERTERS
ANALOG TO DIGITAL CONVERTERS
VR+
VR- time
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000
n=4 VR-
Sample=0100
• The original analog value is found by multiplying the digital
conversion result (NADC) with the resolution.
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000
VR-
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000
n=4 VR-
Sample=0100
• The accuracy is how close the digital output is to the input signal.
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000
n=4 VR-
Sample=0100
• The accuracy is how close the digital output is to the input signal.
• By design, an ADC will only ever be able
to get within +/- ½ LSB of the original
analog value.
ANALOG TO DIGITAL CONVERTERS
ANALOG TO DIGITAL CONVERTERS
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000
VR-
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000
TSA
• The sample period (TSA) is the time between samples.
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000
TSA
• The sampling rate is the frequency of sampling: fSA= 1/TSA
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000
TSA
• The sampling rate is the frequency of sampling: fSA= 1/TSA
• This has units of samples-per-second (i.e., ksps, Msps).
ANALOG TO DIGITAL CONVERTERS
ANALOG TO DIGITAL CONVERTERS
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000
• If you sample fast enough, you can reconstruct the original signal.
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000
• If you sample fast enough, you can reconstruct the original signal.
• Nyquist-Shannon Sampling Theorem states you need to sample at
least twice as fast as the frequency of the incoming signal to
accurately reconstruct the original waveform.
ANALOG TO DIGITAL CONVERTERS
ANALOG TO DIGITAL CONVERTERS
VR+
1111
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
time
0000