ECE2049 Homework #4 – Analog-to-Digital Conversion and the ADC12
(Due Thursday 2/19/2015 to the box by AK-011 by 4 pm)
PLEASE (NEATLY) SHOW ALL WORK! Comment all code well. Do not make the
grader guess what your doing! All code should be typed.
To ensure proper grading & return, you must attach the included cover sheet!
Refererence: Davies Ch 9.2-3, 9.7, MSP430x55xx User’s Guide Ch. 28, class notes,
examples, TI code examples
1) Answer the following questions completely. (20 pts)
a. Define and present a numeric example (not from the class notes!) for each of the
following terms as they relate to analog-to-digital converters.
i. Full-scale range, ii. Resolution, iii. Dynamic Range
b. How many internal and external input channels (ADC12NCHx) does the MSP430’s
ADC12_A have? In the case of the internal input channels specifically list what each
channel is attached to.
c. When the ADC12_A makes a conversion, to what register(s) is the result(s) stored?
d. If the ADC12SREF bits for a given input channel equal 000b (i.e. ADC12SREF_0),
what are the values of the ADC12’s Vref+ and Vref- in volts? (Hint: you may need to
look on the schematic). What if ADC12SREF = 010 (i.e. ADC12SREF_2)?
e. Now, for the ADC12 as configured below what are the specific
i. Full-scale range, ii. Resolution, iii. Dynamic Range
iv. Input Channel v. Memory output register
REFCTL0 &= ~REFMSTR;
ADC12CTL0 = ADC12SHT0_9|ADC12REFON|ADC12ON;
ADC12CTL1 = ADC12SHP+ADC12CSTARTADD_4;
P6SEL |= BIT6;
ADC12MCTL4 = ADC12SREF_1 + ADC12INCH_6;
ADC12CTL0 |= (ADC12SC|ADC12ENC);
while (ADC12CTL1 & ADC12BUSY)
__no_operation();
in_value = ADC12MEM4 & 0x0FFF;
2) A certain pressure sensor has a sensitivity of 1.2 mV/kPa (kiloPascal). The analog
output of this pressure sensor is to be connected to the input of an analog-to-digital
converter. Atmospheric pressure at sea level is approximately 14.7 psi which is equal to
1 atmosphere (1atm) and 1.0 KPa = 0.145 psi.. (30 pts)
a. The pressure sensor’s data sheet lists its analog output range as 0 – 3V. What is the
minimum number of bits that the ADC must have to be able to detect changes of
0.25kPa? (Do not assume that you must use the MSP430’s built-in ADC12 ).
b. What is the dynamic range of the ADC from part (a).
c. What is the pressure in kPa associated with the full-scale reading of 3.0V if
the minimum detectable pressure is actually 0.20 kPa (i.e. 0V corresponds
to 0.20 kPa)?
d. What is the dynamic range of the pressure sensor in dB?
e. Assume that the output of the ADC from part (a) has been read into the global
variable unsigned long int adcPressure. Write a C function that converts
adcPressure to atmospheres.
f. If adcPressure=0x01EF, what is the pressure in kPa and in atmospheres.
3) An MSP430F449 is being used as part of a battery life testing system. There are four
separate 2.7V sealed lead acid (SLA) batteries under test. Each is connected to a different
load and all are exposed to a range of temperatures and humidities. The battery testing
system is to measure the voltage over time. Using the code examples from class and the
TI website as a guide, write a code segment in C that uses the ADC12_A to sample the
voltages of the 4 separate batteries once per minute. The batteries are connected to
analog inputs A4, A5, A6 and A7.
You must document the following in your solution — what clock source you are using
for the ADC12, what input channels (ADC12INCHx) are used, are you using single
channel or sequential channel mode, continuous or one-shot conversion. Also list you
choice for the reference voltage Vref. You may use code similar to the TimerA2 stop
watch example to measure time. You do not have to use ADC12_A interrupts but you
may. As is often the case, there are multiple approaches to this problem. What does a
ADC measurement of 0x05B8 equal in volts for you battery testing system? (25 pts)
4) Referring to the schematics at the end of the MSP-EXP430F5529 Experimenter’s
Board Users Guide. Configure and implement the scroll wheel potentiometer. You will
need this for Lab 3. (25 pts)
a. To what analog input channel is the variable arm of the potentiometer connected?
And what digital IO port and pin does the potentiometer use?
b. Explain the operation of the potentiometer circuit. Specifically, to what logic value
must the digital IO pin be set for a voltage drop to be evident across the
potentiometer?
c. Write a CCS C function that will configure the digital IO pin and the ADC12_A to
read in from the potentiometer (single channel, single conversion) using analog Vcc as
Vref+ and ground as Vref-.
ECE2049 Homework #4
Submitted by:__________________________________
ECE Box #:____________
Date:_______________________________
Question
Grade
1-20
2-30
3-25
4-25
Total:
Comments are closed.