Файл: Digital design with CPLD applications and VHDL (R. Dueck, 2000).pdf

ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 13.06.2025

Просмотров: 8185

Скачиваний: 6

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

12.1 • Analog and Digital Signals

567

If an instrument represents a measured quantity as a series of binary numbers, the representation is digital. Since the binary numbers in a circuit necessarily have a fixed number of bits, the instrument can represent the measured quantities only as having specific discrete values.

A compact disc stores a record of sound waves as a series of binary numbers. Each number represents the amplitude of the sound at a particular time. These numbers are decoded and translated into analog sound waves upon playback. The values of the stored numbers (the encoded sound information) are limited by the number of bits in each stored digital “word.”

The main advantage of a digital representation is that it is not subject to the same distortions as an analog signal. Nonideal properties of analog circuits, such as stray inductance and capacitance, amplification limits, and unwanted phase shifts, all degrade an analog signal. Storage techniques, such as magnetic tape, can also introduce distortion due to the nonlinearity of the recording medium.

Digital signals, on the other hand, do not depend on the shape of a waveform to preserve the encoded information. All that is required is to maintain the integrity of the logic HIGHs and LOWs of the digital signal. Digital information can be easily moved around in a circuit and stored in a latch or on some magnetic or optical medium. When the information is required in analog form, the analog quantity is reproduced as a new copy every time it is needed. Each copy is as good as any previous one. Distortions are not introduced between copy generations, as is the case with analog copying techniques, unless the constituent bits themselves are changed.

Digital circuits give us a good way of measuring and evaluating the physical world, with many advantages over analog methods. However, most properties of the physical world are analog. How do we bridge the gap?

We can make these translations with two classes of circuits. An analog-to-digital converter accepts an analog voltage or current at its input and produces a corresponding digital code. A digital-to-analog converter generates a unique analog voltage or current for every combination of bits at its inputs.

Sampling an Analog Voltage

K E Y T E R M S

Sample An instantaneous measurement of an analog voltage, taken at regular intervals.

Sampling frequency The number of samples taken per unit time of an analog signal.

Quantization The number of bits used to represent an analog voltage as a digital number.

Resolution The difference in analog voltage corresponding to two adjacent digital codes. Analog step size.

Before we examine actual D/A and A/D converter circuits, we need to look at some of the theoretical issues behind the conversion process. We will look at the concept of sampling an analog signal and discover how the sampling frequency affects the accuracy of the digital representation. We will also examine quantization, or the number of bits in the digital representation of the analog sample, and its effect on the quality of a digital signal.

Figure 12.1 shows a circuit that converts an analog signal (a sine pulse) to a series of 4-bit digital codes, then back to an analog output. The analog input and output voltages are shown on the two graphs.

There are two main reasons why the output is not a very good copy of the input. First, the number of bits in the digital representation is too low. Second, the input signal is not


568

C H A P T E R 1 2 • Interfacing Analog and Digital Circuits

FIGURE 12.1

Analog Input and Output Signals

sampled frequently enough. To help us understand the effect of each of these factors, let us examine the conversion process in more detail.

The analog input signal varies between 0 and 8 volts. This is evenly divided into 16 ranges, each corresponding to a 4-bit digital code (0000 to 1111). We say that the signal is quantized into 4 bits. The resolution, or analog step size, for a 4-bit quantization is 8 V/16 steps 0.5 V/step. Table 12.1 shows the codes for each analog range.

Table 12.1 4-bit Digital Codes for 0 to 8 V Analog Range

Analog Voltage

Digital Code

0.00–0.25

0000

0.25–0.75

0001

0.75–1.25

0010

1.25–1.75

0011

1.75–2.25

0100

2.25–2.75

0101

2.75–3.25

0110

3.25–3.75

0111

3.75–4.25

1000

4.25–4.75

1001

4.75–5.25

1010

5.25–5.75

1011

5.75–6.25

1100

6.25–6.75

1101

6.75–7.25

1110

7.25–8.00

1111


12.1 • Analog and Digital Signals

569

The analog input is sampled and converted at the beginning of each time division on the graph. The 4-bit digital code does not change until the next conversion, 1 ms later. This is the same as saying that the system has a sampling frequency of 1 kHz ( f 1/T 1/(1 ms) 1 kHz).

Table 12.2 shows the digital codes for samples taken from t 0 to t 18 ms. The analog voltages in Table 12.2 are calculated by the formula

Vanalog 8 V sin (t (10°/ms))

For example at t 2 ms, Vanalog 8 V sin (2 ms (10°/ms)) 8 V sin (20°) 2.736 V. The calculated analog values are compared to the voltage ranges in Table 12.1 and as-

signed the appropriate code. The value 2.736 V is between 2.25 V and 2.75 V and therefore is assigned the 4-bit value of 0101.

Table 12.2 4-bit Codes for a Sampled Analog Signal

Time (ms)

Analog Amplitude (volts)

Digital Code

0

0.000

0000

1

1.389

0011

2

2.736

0101

3

4.000

1000

4

5.142

1010

5

6.128

1100

6

6.928

1110

7

7.518

1111

8

7.878

1111

9

8.000

1111

10

7.878

1111

11

7.518

1111

12

6.928

1110

13

6.128

1100

14

5.142

1010

15

4.000

1000

16

2.736

0101

17

1.389

0011

18

0.000

0000

Table 12.3 8-bit Codes for a Sampled Analog Signal

Time (ms)

Analog Amplitude (volts)

Digital Code

0

0.000

00000000

1

1.389

00101100

2

2.736

01011100

3

4.000

10000000

4

5.142

10100101

5

6.128

11000010

6

6.928

11011110

7

7.518

11110001

8

7.878

11111100

9

8.000

11111111

10

7.878

11111100

11

7.518

11110001

12

6.928

11011110

13

6.128

11000010

14

5.142

10100101

15

4.000

10000000

16

2.736

01011100

17

1.389

00101100

18

0.000

00000000

The digital-to-analog converter in Figure 12.1 continuously converts the digital codes to their analog equivalents. Each code produces an analog voltage whose value is the midpoint of the range corresponding to that code.

For this particular analog waveform, the A/D converter introduces the greatest inaccuracy at the peak of the waveform, where the magnitude of the input voltage changes the least per unit time. There is not sufficient difference between the values of successive analog samples to map them into unique codes. As a result, the output waveform flattens out at the top.

This is the consequence of using a 4-bit quantization, which allows only 16 different analog ranges in the signal. By using more bits, we could divide the analog signal into a greater number of smaller ranges, allowing more accurate conversion of a signal having small changes in amplitude. For example, an 8-bit code would give us 256 steps (a resolution of 8 V/256 31.25 mV). This would yield the code assignments shown in Table 12.3. Note that for an 8-bit code, there is a unique value for every sampled voltage.

Figure 12.2 shows how different levels of quantization affect the accuracy of a digital representation of an analog signal. The analog input is a sine wave, converted to digital


570

C H A P T E R 1 2 • Interfacing Analog and Digital Circuits

FIGURE 12.2

Effect of Quantization

codes and back to analog, as in Figure 12.1. The graphs show the analog input and three analog outputs, each of which has been sampled 28 times per cycle, but with different quantizations. The corresponding digital codes range from a maximum negative value of n 0s to a maximum positive value of n 1s for an n-bit quantization (e.g., for a 4-bit quantization, maximum negative 0000, maximum positive 1111).

The first output signal has an infinite number of bits in its quantization. Even the smallest analog change between samples has a unique code. This ideal case is not attainable, since a digital circuit always has a finite number of bits. We can see from the codes in Table 12.3 that an 8-bit quantization is sufficient to give unique codes for this waveform. An infinite quantization implies that the resolution is small enough that each sampled voltage can be represented, not only by a unique code, but as its exact value rather than a point within a range.

The 4-bit and 3-bit quantizations in the next two graphs show progressively worse representation of the original signal, especially at the peaks. The change in analog voltage is too small for each sample to have a unique code at these low quantizations.

Figure 12.3 shows how the digital representation of a signal can be improved by increasing its sampling frequency. It shows an analog signal and three analog waveforms resulting from an analog-digital-analog conversion. All waveforms have infinite quantization, but different numbers of samples in the analog-to-digital conversion. As the number of samples decreases, the output waveform becomes a poorer copy of the input.

In general, the sampling frequency affects the horizontal resolution of the digitized waveform and the quantization affects the vertical resolution.