Electronics/Digital to Analog & Analog to Digital Converters

Signals in the real world tend to be analog. For example the water level in a tank or the speed of car as measured by a tacho-generator. In order to process them with a digital circuit, we need to convert them to digital signals. Conversely, once the digital signals are processed, they must often be converted back to an analog signal. An example would be processing an audio signal digitally and sending it to a speaker. The speaker requires an analog signal.

Analog-to-Digital Conversion
An Analog to Digital Converter (ADC) takes an analog input signal and converts the input, through a mathematical function, into a digital output signal. While there are many ways of implementing an ADC, there are three conceptual steps that occur.
 * 1) The signal is sampled.
 * 2) The sampled signal is quantized.
 * 3) The quantized signal is digitally coded.

Sampling
By, sampling we turn a continuous-time function which may take on infinitely many values at different times into a discretized function that may take on infinitely many values at different discrete indices.

Sampling generally is done with a Sample-And-Hold circuit (simple experiments can be done using a capacitor and switch). To be able to reconstruct the signal we must consider the Sampling Theorem which says that a sampling frequency twice the highest frequency we're expecting is needed. In a simple way sampling can be defined as the process of taking samples from the continuous time function x(t) and for the signal to reconstruct we must consider the sampling theorem which states that the sampling frequency must be always greater than or equal to twice the highest frequency.

Quantization
Quantization is the process of taking a continuous voltage signal and mapping it to a discrete number of voltage levels. The number of voltage levels affects the quantization noise that occurs. Since digital computers are binary in nature, the number of quantization levels is usually a power of 2, i.e.,

$$N = 2^n$$

where n is the number of quantization bits.

The signal may be amplified or attenuated before going into the ADC, so that the maximum and minimum voltage levels give the best compromise between resolution of the signal levels and minimization of clipping.

Encoding
Encoding is the process of converting the quantized signals into a digital representation. This encoding is performed by giving each quantization level a unique label. For instance, if four bits are used, the lowest level may be (in binary) 0000, and the next highest level 0001, etc.

Digital-to-Analog Conversion
A Digital to Analog converter (DAC) takes a digital signal and converts it, through a mathematical function, into an analog signal. Again, the DAC may be implemented in a number of ways, but conceptually it contains two steps. In fact along with the counters we are using digital to analog convertor while converting analog signal to digital signals also. Here we can use counter along with the shift register to store the digital data.
 * 1) Convert each time step of the digital signal into an "impulse" with the appropriate energy. In a real system, this could be accomplished by creating short pulses that have the same voltage, but whose total power is modified by changing the pulse length.  This pulse train produces a signal whose frequency response is periodic (and theoretically extends to infinity).
 * 2) Apply a low-pass filter to the time sequence of impulses. This removes all of the high-frequency periodicities, leaving only the original signal.