0% found this document useful (0 votes)
66 views13 pages

Exercise 7

This document provides an overview of the aim and theoretical background for an exercise measuring the properties of 12-bit D/A and A/D converters. The exercise aims to study the static errors and nonlinearities of a 12-bit D/A converter and examine the properties of a 12-bit successive-approximation A/D converter, investigating its static and dynamic errors. Key concepts discussed include analog to digital conversion, sampling, quantization, differential nonlinearity, integral nonlinearity, fast Fourier transforms, harmonic distortion, total harmonic distortion, spurious free dynamic range, and signal-to-noise-and-distortion. Measurement equipment including an oscilloscope, power supply, function generator, and digital multimeter are also listed

Uploaded by

Ahmed Said
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)
66 views13 pages

Exercise 7

This document provides an overview of the aim and theoretical background for an exercise measuring the properties of 12-bit D/A and A/D converters. The exercise aims to study the static errors and nonlinearities of a 12-bit D/A converter and examine the properties of a 12-bit successive-approximation A/D converter, investigating its static and dynamic errors. Key concepts discussed include analog to digital conversion, sampling, quantization, differential nonlinearity, integral nonlinearity, fast Fourier transforms, harmonic distortion, total harmonic distortion, spurious free dynamic range, and signal-to-noise-and-distortion. Measurement equipment including an oscilloscope, power supply, function generator, and digital multimeter are also listed

Uploaded by

Ahmed Said
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/ 13

Laboratory 2. Exercise 7.

Exercise 7.

A/D and D/A converters

Aim of the measurement


1.Using a 12 bit D/A converter static errors, nonlinearities of the converter are studied.
2.The different properties of a 12 bit successive-approximation A/D converter are examined.
Its static and dynamic errors are investigated. Moreover, different methods to obtain
parameters of a converter are practiced.

Keywords
analog-to-digital converter (A/D, ADC), digital-to-analog converter (D/A, DAC), sine fitting

References
[1] http://en.wikipedia.org/wiki/Analog-to-digital_converter
[2] http://en.wikipedia.org/wiki/Digital-to-analog_converter
[3] http://en.wikipedia.org/wiki/Sampling_(signal_processing)
[4] http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem
[5] http://www.maxim-ic.com/appnotes.cfm/appnote_number/1040/CMP/ELK1

Measurement Instruments
Oscilloscope Agilent 54622A
Power Supply Agilent E3630
Function Generator Agilent 33220A
Digital multimeter (6 digit) Agilent 33401A

Theoretical Background
In this part of the guide some of the necessary theory are presented.

1
Laboratory 2. Exercise 7.

Analog digital conversion


An analog signal is continuous both in time and in amplitude. During the analog-to-digital
conversion this analog data is first sampled (that is the amplitude is only inspected at discrete
time points) then the continuous amplitude is converted into discrete digital values
(quantization).

Sampling
The theory of sampling was created by Nyquist and Shannon. The sampling theorem says
that an analog signal can be correctly sampled (and reproduced) if the analog signal does
only contain frequency components which are smaller than the half of the sampling
frequency (denoted with fs). This is due to the fact that the spectrum of the sampled signal is
periodic with the sampling frequency if the analog signal contains larger than fs/2
frequencies, these components overlap.
Correct sampling:

Undersampling (with overlapping spectrums):

2
Laboratory 2. Exercise 7.

Quantization
The quantization process maps the continuous input value to discrete (digital) values. The
number of possible values can be determined from the resolution of the quantization: when n
bits are used, 2n quantization levels can be selected.
The following figure shows the theoretical linear quantization (left part) and the
amplitude error introduced by the quantization process (right part).

In computing, the least significant bit (lsb) is the bit position in a binary integer
giving the units value, that is, determining whether the number is even or odd. The lsb is
sometimes referred to as the right-most bit, due to the convention in positional notation of
writing less significant digits further to the right. It is analogous to the least significant digit
of a decimal integer, which is the digit in the ones (right-most) position. In the context of
D/A converters LSB denotes the potential change when the least significant bit of the input
is changed.

A differential Nonlinearity or differential Non-linearity (acronym DNL) is a term


describing the deviation between two adjacent points. The term used as an important
specification for measuring error in a D/A converter. Ideally, any two adjacent digital codes
correspond to output analog voltages that are exactly one LSB apart. Differential non-
linearity is a measure of the worst case deviation from the ideal 1 LSB step. For example, a
DAC with a 1.5 LSB output change for a 1 LSB digital code change exhibits 12 LSB
differential non-linearity. Differential non-linearity may be expressed in fractional bits or as

3
Laboratory 2. Exercise 7.

a percentage of full scale. A differential non-linearity greater than 1 LSB will lead to a non-
monotonic transfer function in a DAC.

Integral non-linearity (acronym INL) is a term describing the maximum deviation


between the ideal output of a D/A converter and the actual output level. The term often used
as an important specification for measuring error in a D/A converter. The transfer function of
a D/A converter should ideally be a line and the INL measurement depends on the line
selected. Two often used lines are the best fit line, which is the line that minimises the INL
result and the endpoint line which is a line that passes through the points on the transfer
function corresponding to the lowest and highest input code. In all cases, the INL is the
maximum distance between the ideal line selected and the actual transfer function.

The spectral output of the FFT is a series of M/2 points in the frequency domain (M is the
size of the FFT). The spacing between the points is fs/M, and the total frequency range
covered is dc to fs/2, where fs is the sampling rate. The width of each frequency "bin"
(sometimes called the resolution of the FFT) is fs/M. Figure 2 shows an FFT output for an
ideal 12-bit ADC. Note that the theoretical noise floor of the FFT is equal to the theoretical
SNR plus the FFT process gain, 10log(M/2). It is important to remember that the value for
noise used in the SNR calculation is the noise that extends over the entire Nyquist bandwidth
(dc to fs/2), but the FFT acts as a narrowband spectrum analyzer with a bandwidth of fs/M
that sweeps over the spectrum. This has the effect of pushing the noise down by an amount
equal to the process gainthe same effect as narrowing the bandwidth of an analog
spectrum analyzer.

The FFT data shown in Figure 2 represents the average of 5 individual FFTs. Note that
averaging a number of FFTs does not affect the average noise floor, it only acts to "smooth"
the random variations in the amplitudes contained in each frequency bin.

Figure 2 FFT Output for an Ideal 12-Bit ADC, Input = 2.111MHz, fs = 82MSPS,
Average of 5 FFTs, M = 8192

4
Laboratory 2. Exercise 7.

The FFT output can be used like an analog spectrum analyzer to measure the amplitude of
the various harmonics and noise components of a digitized signal. The harmonics of the
input signal can be distinguished from other distortion products by their location in the
frequency spectrum. Figure 3 shows a 7-MHz input signal sampled at 20 MSPS and the
location of the first 9 harmonics. Aliased harmonics of fa fall at frequencies equal to |Kfs
nfa|, where n is the order of the harmonic, and K = 0, 1, 2, 3,.... The second and third
harmonics are generally the only ones specified on a data sheet because they tend to be the
largest, although some data sheets may specify the value of the worst harmonic.

Harmonic distortion is normally specified in dBc (decibels below carrier), although in audio
applications it may be specified as a percentage. It is the ratio of the rms signal to the rms
value of the harmonic in question. Harmonic distortion is generally specified with an input
signal near full-scale (generally 0.5 to 1 dB below full-scale to prevent clipping), but it can
be specified at any level. For signals much lower than full-scale, other distortion products
due to the differential nonlinearity of the converternot direct harmonicsmay limit
performance.

Figure 3 Location of Distortion Products: Input Signal = 7 MHz, Sampling Rate = 20


MSPS

Total harmonic distortion (THD) is the ratio of the rms value of the fundamental signal to
the mean value of the root-sum-square of its harmonics (generally, only the first 5 harmonics
are significant). THD of an ADC is also generally specified with the input signal close to
full-scale, although it can be specified at any level.

Total harmonic distortion plus noise (THD + N) is the ratio of the rms value of the
fundamental signal to the mean value of the root-sum-square of its harmonics plus all noise
components (excluding dc). The bandwidth over which the noise is measured must be
specified. In the case of an FFT, the bandwidth is dc to fs/2. (If the bandwidth of the
measurement is dc to fs/2 (the Nyquist bandwidth), THD + N is equal to SINADsee
below). Be warned, however, that in audio applications the measurement bandwidth may not
necessarily be the Nyquist bandwidth.

5
Laboratory 2. Exercise 7.

Spurious free dynamic range (SFDR) is the ratio of the rms value of the signal to the rms
value of the worst spurious signal regardless of where it falls in the frequency spectrum. The
worst spur may or may not be a harmonic of the original signal. SFDR is an important
specification in communications systems because it represents the smallest value of signal
that can be distinguished from a large interfering signal (blocker). SFDR can be specified
with respect to full-scale (dBFS) or with respect to the actual signal amplitude (dBc). The
definition of SFDR is shown graphically in Figure 4.

Figure 4 Spurious Free Dynamic Range (SFDR)

SINAD and SNR deserve careful attention, because there is still some variation between
ADC manufacturers as to their precise meaning. Signal-to-Noise-and-Distortion (SINAD, or
S/(N + D) is the ratio of the rms signal amplitude to the mean value of the root-sum-square
(rss) of all other spectral components, including harmonics, but excluding dc. SINAD is a
good indication of the overall dynamic performance of an ADC because it includes all
components which make up noise and distortion. SINAD is often plotted for various input
amplitudes and frequencies. For a given input frequency and amplitude, SINAD is equal to
THD + N, provided the bandwidth for the noise measurement is the same for both (the
Nyquist bandwidth). A typical plot for an 12-bit, 65-MSPS ADC is shown in Figure 6.

6
Laboratory 2. Exercise 7.

Figure 1 An 12-bit, 65-MSPS ADC SINAD and ENOB for Various Input Full-Scale
Spans (Range)

The SINAD plot shows that the ac performance of the ADC degrades due to high-frequency
distortion and is usually plotted for frequencies well above the Nyquist frequency so that
performance in undersampling applications can be evaluated. SINAD plots such as these are
very useful in evaluating the dynamic performance of ADCs. SINAD is often converted to
effective-number-of-bits (ENOB) using the relationship for the theoretical SNR of an ideal
N-bit ADC: SNR = 6.02N + 1.76 dB. The equation is solved for N, and the value of SINAD
is substituted for SNR:

Note that Equation 1 assumes a full-scale input signal. If the signal level is reduced, the
value of SINAD decreases, and the ENOB decreases. It is necessary to add a correction
factor for calculating ENOB at reduced signal amplitudes as shown in Equation 2:

The correction factor essentially "normalizes" the ENOB value to full-scale regardless of the
actual signal amplitude.

Signal-to-noise ratio (SNR, or sometimes called SNR-without-harmonics) is calculated from


the FFT data the same as SINAD, except that the signal harmonics are excluded from the
calculation, leaving only the noise terms. In practice, it is only necessary to exclude the first
5 harmonics, since they dominate. The SNR plot will degrade at high input frequencies, but
generally not as rapidly as SINAD because of the exclusion of the harmonic terms.

A few ADC data sheets somewhat loosely refer to SINAD as SNR, so you must be careful
when interpreting these specifications and understand exactly what the manufacturer means.

7
Laboratory 2. Exercise 7.

There is a mathematical relationship between SINAD, SNR, and THD (assuming all are
measured with the same input signal amplitude and frequency. In the following equations,
SNR, THD, and SINAD are expressed in dB, and are derived from the actual numerical
ratios S/N, S/D, and S/(N+D) as shown below:

Eq. 3, Eq. 4, and Eq. 5 can be solved for the numerical ratios N/S, D/S, and (N+D)/S as
follows:

Because the denominators of Eq. 6, Eq. 7, and Eq. 8 are all equal to S, the root sum square of
N/S and D/S is equal to (N+D)/S as follows:

Therefore, S/(N+D) must equal:

and hence,

Eq. 12 gives us SINAD as a function of SNR and THD.

Similarly, if we know SINAD and THD, we can solve for SNR as follows:

Similarly, if we know SINAD and SNR, we can solve for THD as follows:

8
Laboratory 2. Exercise 7.

It is important to emphasize again that these relationships hold true only if the input
frequency and amplitude are equal for all three measurements.

Development Board

The measurement is based on an Analog Devices Microconverter SAR Evaluation Board


which contains an AdC831 microcontroller it has an 8051 processor core and several 12-
bit A/D and D/A converters. The PC communicates with the board through an RS-232
(UART) interface. The program of the microcontroller is pre-written, the DACs and ADCs
can be controlled through simple UART commands, which are implemented in MATLAB
routines. The schematic diagram of the microcontroller is shown on Figure 1.

Figure 1. AdC831 microcontroller

The microcontroller contains a 12-bit, 8-channel multiplexed successive approximation A/D


converter and 2 resistor based D/A converters. The schematic diagram of the A/D converter
is shown on Figure 2. During the measurements AIN2 channel is used, which is connected
to the BNC connector of the development board (ADC2). The signal range of the A/D is
02.5V.

9
Laboratory 2. Exercise 7.

Figure 2. Schematic diagram of the A/D converter

The schematic diagram of the resistor based D/A converter is shown on Figure 3. The IC is
configured in a way that the D/A converter output connects to the D/A pins through an
integrated output buffer. The pins are wired to BNC connectors denoted with DAC0 and
DAC1. DAC0 is connected directly to the D/A IC, while DAC1 is connected through an
amplifier with amplification ratio of 1. As the amplifier offers protection and higher
loadability, use this output during the measurements.

Figure 3. Schematic of the D/A converter

The signal range of the D/A is programmable the microcontroller sets the reference voltage
to 2.5V.

Application Software
During the exercie the dac_gui.m function is used. The function works in Matlab.

10
Laboratory 2. Exercise 7.

Figure 4. dac_gui.m main window

The GUI offers the following functions:


DC output: the value written into the Output Code window can be written into the
output register of DAC1 by pressing the Enter key.
Square Wave: Generates a square wave on the DAC1 output. The low (L) level is
the digital 0, while the high level (H) can be set by entering a value into the text box.
The frequency of the generated square wave is ~850 Hz.
Glitch: The DAC1 output is droved with values 2047 and 2048. At the same time a
square wave is generated on DAC0 which can be used for synchronization.
Quantization Error: Generates sine waves on both of the DAC outputs. The
resolution of the sine wave is 12 bit on DAC0 and 4 bit on DAC1.
In the Matlab workspace we have the following functions which can be applied:

s_init() It opens the serial port and create an object com1. Before using the function
adc_measure you have to create this serial port object.
s_close() It closes the serial port object and frees its allocated resources.
y = adc_measure(channelID, Nsamples, com1) Running this function we can gather
samples by using the ADC converter. channeled determines the used channel (here, the
second channel DAC2 is used, so channelID=2 ). Nsamples is the number of the
samples (maximum 8192). com1 is the corresponding serial object (see the function
s_init). Returning this function the variable y contains the corresponding samples.
calc_sinefit() A 4 parameter sine fitting algorithm. For detailed instructions see its help
by typing help calc_sinefit in Matlabs workspace.
calc_fft() This function calculates the spectra of a coherently sample sine wave. The
function plots the spectrum, moreover calculates the SINAD, SNR s THD. For detailed
instructions see its help by typing help calc_fft in Matlabs workspace.
cleanup() This function closes all opened serial ports and closes all the running gui
applications.

Laboratory Exercises

1. Static properties of D/A converter


1.1. Measure the offset and amplification errors.
Drive the DAC1 output with the minimum and maximum values using dac_gui.m.
Measure the output voltage of the D/A with a high-precision multimeter (set the
multimeter to 6-digit resolution).
Notes: The nominal output range is denoted with FS (full-scale). Usually, digital 0
represents output value of 0V, while FS output value is generated when the D/A

11
Laboratory 2. Exercise 7.

digital input is set to 2n, where n is the resolution of the D/A. Obviously, the
maximum digital value which can be set on the input is 2n-1 (binary 111111),
therefore the maximal output voltage is FS-1LSB, where LSB denotes the potential
change when the least significant bit of the input is changed. The reference voltage
on the development board is set to 2.5V. Thus the nominal output range is 02.5V
(FS=2.5V). The 12-bit digital input has a range of 04095; the nominal output for
input value 0 is 0V, while input value 4095 nominally results in a FS-
1LSB=2.4994V. The amplification error is the difference of the measured values
and the nominal values at input values of 0 and 4095, represented in percentage or
LSB units.
1.2. Measure the integral linearity error.
For the absolute correct measurement of the linearity error, all possible input values
should be measured. In the case of the 12-bit D/A this would result in 4096
measurements. Due to the time constraints, only 10-20 different measurements are
done observations show that such amount of measurements are enough to get a
relatively exact characteristic.

Measure the output with minimal and maximal input values (0 and 4095). Then
select at least 10 input values evenly distributed in the input value range and
measure the output for all of these values. In every measured point, compute the
difference between the measured values and the theoretical linear characteristic.
The integral linearity error is the maximum value given in LSB units.
1.3. Measure the differential linearity error.
The gradient of the characteristic can be represented with the output voltage change
when the digital input is incremented with 1. In an ideal case, the voltage change is
exactly 1LSB. The differential linearity error is the difference of the measured
values from this theoretical value, given in LSB units.

Measure the output voltage at several points of the characteristic using consecutive
input values (e.g. 1030 and 1031). Determine the differential linearity error in LSB
units.

2. Measurements using sine wave


Coherent sampling means that the measured data contains an integer number of periods
from the measured signal. The sampling frequency of the ADC is 115200 Hz and the
measured data contains 8192 samples. Let us assume that the measured data contains k
number of periods and the frequency of the input sine wave is fm. In this case
fm=k*(115200/8192). E.g. if k=5, the frequency of the sine wave is fm=70.3125 Hz.
The range of the sine wave should be in 02.5V. Take care of not to generate larger
amplitude, as this may damage the A/D. Always verify the generated waveform with the
oscilloscope, before connecting it to the A/D!
To acquire the samples the function adc_measure is called. The necessary computations
and figures should be prepared by using Matlab. It is important that in the report the
applied computations and the parameters have to be written in order to be able to recall
the results. It is also useful to plot the measurement results because in a figure we can
check present of the possible errors (shape, noise, coherent sampling, etc.).
2.1. Drive the ADC2 input with a 100 Hz sine wave. Acquire 8192 samples and
using the function calc_sinefit approximate the signal by a sine wave.

12
Laboratory 2. Exercise 7.

Calculate the Signal-to-Noise-And-Distortion SINAD and effective bit number


Neff from the return values and the residual. Compare it to the given value in
the specification.
2.2. Repeat the previous measurement at different frequencies. Plot the function
SINAD(f) and Neff(f) where f is the frequency. What is your experience? A
proposed selection is f = [100,200,400,800,1600] Hz.

3. Measurement of an A/D converter in the frequency domain


The dynamic properties of an A/D converter is studied. Sine wave is applied during this
measurement. The amplitude should be so large that almost it is in the full input range of
the A/D converter. But it is important to avoid the clipping. The frequency has to be
chosen such that the conditions of coherent sampling are fulfilled.
3.1. Measure 5 complete periods from a sine wave with appropriate frequency.
Determine the spectrum of the signal and calculate the parameters SINAD,
SNR and THD. Use the function calc_fft. From the results calculate the
effective bit number Neff. Compare the results to those which were obtained
from the time domain measurements..
3.2. Repeat the measurements at different frequencies. Plot SINAD as the function
of the frequency f. What is the experience? The proposed numbers of periods
are [5,9,21,101].

13

You might also like