Introduction:

The ADC is arguably one of the most important parts of a Microcontroller. Why is this? The real world is analog and to be able to manipulate it digitally some sort of conversion is required. Although many techniques are possible, using an Analog to Digital Converter (ADC or A2D) is the most common when good signal fidelity is necessary. A more simple interface could be some threshold circuit that would allow you to know whether a signal passed a certain threshold.

The resolution is obviously very poor and would not be used to sample real signals unless it is required. The ADC is also probably the most difficult module to master. It is so because despite the simplicity that is assumed during courses that cover it (in which we just assume the ADC samples at a particular frequency and it does so perfectly to the available resolution.).

We will cover the ADC present in the MSP430F2274, a 10-bit SAR ADC. Most of the information will easily carry over to other ADCs, even if these ADCs have different features. What is an ADC? It is a device which converts the analog waveform at the input to the equivalent representation in the digital domain. It does so by a variety of techniques which depend on the architecture of the ADC itself. SAR stands for Successive Approximation and this name indicates the general idea behind the conversion.

There are many architectures out there. The ADC samples and quantizes the input waveform. Sampling means that it measures the voltage of the waveform at a particular moment in time. In reality, the ADC cannot use an impulse but rather a larger time frame to sample so that the value is stable. When we talk about the sampling frequency, we refer to the fact that the ADC will be continuously sample. This is the most common mode discussed in DSP courses. However, an ADC can sample one or in many other ways, depending on the application. Quantization means it assigns a particular value, usually binary, to represent the analog voltage present. Both of these important concepts will be discussed next.

ADC Parameters:

ADC Resolution:

Probably the most important and most cited parameter of the ADC is its resolution, usually expressed in bits. The MSP430F2274 in our case has 10-bits of resolution. The resolution is an extremely important parameter because it dictates how the lowest difference we can differentiate. The higher the resolution, the more we can distinguish between minute differences in the voltage. The resolution is specified in usually bits. This tells us how many different voltage levels we can represent.

Quantization Levels = 2bits

For a 10-bit ADC we have a maximum of

210 = 1024 possible levels of voltages we can represent. That’s why higher bit ADCs such as 16 and even 24 are used: you can readily distinguish between smaller changes in the signal and your digital representation better approximates the original. For 16-bits we have 216 = 65536 and for 24-bit we have more than 16 million different levels, a huge increase due to the exponential nature. Note however that noise is a prevalent issue in ADCs and becomes the major constraint at a certain point

The question now comes to how the number of levels is related to the input voltage? This is simple. The number of levels possible is divided equally for the voltage range. If we have a 1V on the ADC’s input pin and assuming the ADC is operating with a voltage range of 3V, each successive level from 0V to 3V is: 3V 1024  1 = 0:00293V = 3mV

If the signal changes by less than 3mV we can’t distinguish the difference, but every 3mV change in signal level translates into an addition of 1 to the binary number. If we have 0V at the input (without any noise), then we have 10 zeros (since it’s a 10-bit ADC and no signal at the input). However, if we have 3mV at the input then we have 9 zeros followed by a one.

0V! 0000000000 = 0x00

3mV! 0000000001 = 0x01

You can think about the ADC as a staircase. For each range of voltages we assign an equivalent binary number usually referred to as the ”code”. The binary representation is usually replaced by hex since it is easier to read, as discussed in previous chapter. Note however that this is the ideal case and no offset or errors are taken into account.

The following shows a simple 3-bit ADC. Such ADC does not exist but serves to show how each new level is represented in binary:

Unfortunately, we cannot cover all the important details of ADCs. The interested reader is referred to the following excellent sources of information:

The general equation of the MSP430F2274 (which can be assumed for most other ADCs given a few changes) is:

NADC = 1023 _ Vin, VR VR+ VR

A simple example follows: Lets assume that the input voltage is 1V. VR+ and VR represent the upper and lower limits of the voltage range. In our case we will have VR+ = VCC and VR+ = VCC = VSS = 0V.

Using the equation above we have:

NADC = 1023 _1V  0V 3V  0V = 1023 _ 0:333 = 341 = 0x155

The binary representation is not shown because it is large and hexadecimal represents it nicely. Notice that 1V is exactly a third of the voltage range and therefore the output code will be a third of all the maximum number, 1023 in this case.