In several scenarios, a bridge between the analog and digital worlds is required by using an Analog-to-Digital Converter (ADC). The ADC in a digital thermometer, for example, converts an analog temperature reading, in volts, into a digital temperature reading, in binary, as shown in Figure 1.

The analog signal is continuous on both the time (t) and voltage (V(t)) axes, meaning that there are infinite points along both axes, i.e., integer and decimal values. The digital signal is continuous on the time axis and discrete on the binary axis, meaning there are infinite points along the time axis and finite points, integer values only, on the binary axis. It is impossible to convert an analog signal, in its entirety, into a digital signal. This is because there are an infinite number of data points along an analog signal, which requires infinite processing power to convert.
A solution to practically convert an analog signal into a digital signal is via a sample and convert sequence, as shown in Figure 2.

Sample block
The function of the Sample block is to take samples of an analog signal at points in time, as shown in Figure 3.

At the beginning of sampling, the switch connecting the Analog Input (AI) to the HOLD capacitor (cHOLD) is closed, resulting in cHOLD rapidly charging from 0V to the voltage of the analog signal at, for example, sample n = x, i.e., vsmp ≈ 1.987V, over the sampling period (tsmp). After this period, the switch is opened. Note that the exploded view of this sample is not to scale. Depending on the architecture of the ADC module, some modules have cHOLD charging/discharging from the previously converted sample. Other modules, such as that discussed on this page, have cHOLD in a discharged state over a discharge period (tdis) prior to each sample. The red shading represents the resolution error associated between samples n = x and n = x + 1, i.e., the unsampled voltage points in between. The Nyquist theorem states that an analog signal, to be sampled, must be sampled at a frequency that is more than twice that of the highest frequency component of the signal. Failing to do so will result in a distorted digital representation of the original analog signal. Samples are discrete in time and continuous in voltage.
Hold block
The function of the Hold block is to hold onto a sampled voltage, via cHOLD, for a conversion period (tcnv), such that quantization and encoding can be executed. The cHOLD discharges slowly such that there is a minimal drop in voltage over tcnv, resulting in an acceptable error during the conversion process.
Quantize block
The function of the Quantize block is to convert/map a set of continuous values, sampled voltages, into a discrete set of values, binary numbers, as shown in Figure 4.

Assume the operating voltage of an MCU is from 0V to 3.3V and the quantization resolution is 3-bit. With a 3-bit resolution, 8 analog voltages, from 0V to 3.3V, can be represented in binary form, hence a resolution error of 0.4125V. Assuming the thermometer has an operating temperature range between 0°C and 100°C, the resolution is 12.5°C. With an 8-bit resolution, the margin of error drops down to 0.39°C. Quantized results are discrete in time, from the sampled voltages, and discrete in voltage.
Encode block
The function of the Encode block is to write a binary value, following quantization, into the results buffer of an ADC module. Overall, the sampling switch is closed for a period of tsmp and left open for a period of tcnv and tdis, i.e., totalling a sequence period (tseq). In other words, the switch closes and opens at a sampling frequency (fseq). This frequency is not the inverse of tsmp. From this point forward, the original signal can be reconstructed within an acceptable margin of error into a digital signal. The reconstructed digital signal is continuous in time and discrete in voltage.