20 Adc1
20 Adc1
20 Adc1
1 Introduction
Most real world sensors convert physical parameters (like say temperature, pres-
sure etc) into some kind of electrical signal. Let us take a commonly available
sensor (Figure 1), the LM35, as an example.
LM35 is a temperature sensor. As shown in the gure, it is a 3 pin device
- Vcc, GND, Vout. If the temperature is 0 degree centigrade, the voltage on
the pin Vout is 0. For every 1 degree rise in temperature, the output voltage
increases by 10mv. So if the temperature is 30 degree celsius, the output on
Vout will be 300mV. If you are able to measure this voltage, you are eectively
measuring the temperature!
Analog to digital conversion is the name given to the process by which you
convert an analog signal (say voltage output of a temperature sensor which can
vary from 0 to 1V) to a discrete, binary pattern. An ADC (Analog to digital
converter) is a device which performs Analog to Digital conversion. A lot of
electrical engineering concepts are to be kept in mind when using an ADC to
build real world systems. We will not deal with these issues in this lesson;
interested students can refer the excellent text prescribed in the References
section of this document to get more information.
Analog to digital convertors are available as independent components - you
can also nd them integrated into microcontrollers (like our MSP430G2231). In
this lesson, we treat the ADC as a black box - we are going to learn about the
nature of the ADC's input and output - but we shall not examine how the ADC
actually performs the conversion .
1
use of the binary search algorithm as part of the AD conversion process; refer:
http://en.wikipedia.org/wiki/Successive_approximation_ADC
1
Figure 1: LM35 temperature sensor
Let us say you have a 3-bit ADC which you are using to digitize an analog
voltage which can assume a minimum value of 0 and a maximum value of 8V.
Now, what do you mean by a 3 bit ADC?
Simple. The output of a 3 bit ADC is a binary pattern of length 3 bits.
Table 1 shows the voltage inputs and the binary outputs produced by our ADC.
Let us look at the table a bit more in detail. The rst thing you notice is
that the ADC is not really capable of giving an accurate representation of all
voltage values - for example, for any voltage input from 0V to just about 0.5V,
0 to 0.5 0 0 0
0.5 to 1.5 0 0 1
1.5 to 2.5 0 1 0
2.5 to 3.5 0 1 1
3.5 to 4.5 1 0 0
4.5 to 5.5 1 0 1
5.5 to 6.5 1 1 0
6.5 to 8.0 1 1 1
2
the ADC gives you the same binary pattern, 000, as the output. Then, for
any input from just above 0.5V to about 1.5V, the ADC gives you the binary
pattern 001 as the output. The ADC eectively works by dividing the 0 to 8V
range into eight discrete steps. You note that each step is 1V (except at the
beginning and end).
The number of discrete steps is related to the number of bits in the output
N
- an N-bit ADC gives you 2 steps. You can reduce the size of each step by
increasing the number of bits in the output. For example, in the above case, if
you had a 4 bit ADC instead of a 3 bit ADC, you would have got a step size
of 0.5V instead of 1V (for a voltage swing from 0 to 8V). Commonly available
(and inexpensive) ADC's typically have resolutions of 8, 10 or 12 bits.
http://www.national.com/mpf/DC/ADC0808.html#Overview.
3
ADC's also come embedded in inexpensive microcontrollers, like our MSP430G2231.
The MSP430 family guide (available from the course web site: http://recursive-
labs.com/datasheets/msp430-family-guide.pdf ) gives a detailed description of
the ADC integrated with MSP430 microcontrollers. You will also nd the docu-
ment http://recursive-labs.com/datasheets/msp430g2x31.pdf useful for nding
out the pin numbers associated with the ADC. Please keeps these documents
at hand while solving the exercises in the next section.
Having an ADC integrated with a micrcontroller is very convenient - it be-
comes easy for us to write programs which monitor outputs from various sensor
elements. In the coming lessons, we will get a chance to use the ADC to perform
some interesting experiments!
5 Exercises
The objective of the exercises is to get you acquainted with some of the terms
associated with AD converters (and also to make you read part of the processor
manual explaining the working of the ADC - don't worry if you do not under-
stand most of the things that you read in the manual - that is to be expected!).
(a) Non-linearity
(a) True
(b) False
4. Which of the following is not a register associated with the ADC in the
MSP430G2231 processor?
(a) ADC10DATA
(b) ADC10MEM
(c) ADC10AE0
4
(a) ADC10IE
(b) ENC
(c) ADC10STP
(a) 8 channels
(b) 6 channels
(c) 4 channels
6 Reference