ELEC 132
COURSEWORK – ADC
This work will be assessed based on program demonstration (during lab sessions) and design. You will also have to submit your c-source codes as word or pdf files through SCOLAR sub-system.
This piece of work contributes 20% towards your total mark.
The final opportunity to demonstrate your program operation is Thursday, March 21.
Introduction
The Digital-to-Analogue Converter (DAC) can be used to perform an Analogue-to-Digital Conversion (ADC) with the aid of a comparator, as explained in Lab 6.
Task1. ADC conversion using RAMP method and P1 output (6 marks).
1.1. Write and test a program which produces an analogue to digital conversion using the RAMP method and outputs the conversion value to the LEDs.
(1 marks)
1.2. Modify the program output to P1 in a way that the LEDs will display the rounded percentage of the full scale output. Since there are 8 LEDs each one represents 12.5%. However, since we want the rounded percentage the LED on the LSB should be illuminated if the voltage is above 6.25% (312mV) and the next LED should be illuminated if the voltage is above 18.75% (937mV) etc…
(2 marks)
1.3. Further modify the program so the output to P1 will include a flashing LED if the percentage is less to illuminate this LED. For example, if the voltage is less than 6.25% of full scale (312mV), LSB will be flushing and the frequency of flashing will increase with increasing the voltage . The next bit (P1.1) will start to flash when the voltage is 12.5% with increasing frequency until fully lit at 18.75%, etc.
(3 marks)
Task 2. Successive Approximation ADC ( 5 marks)
The Ramp method of ADC is simple but can take a long time to complete the conversion. Unlike the RAMP method the successive approximation technique has a fixed conversion time whatever the level of the analogue input. See Lab 6 for details.
?
Write a program to produce analogue to digital conversion using the successive approximation method and output the voltage value into serial port with the accuracy of 1 mV. Try to use bit-wise operators for realising successive approximation.
Task 3. Digital Volt Meter (DVM) (5 marks)
Use any ADC method to simulate a Digital Volt Meter with output to LCD. The upper line of the display should have an appropriate message like “Voltage (mv)” and the bottom line should displays the correct voltage (in millivolts) with the accuracy of 1 mV.
Task 4. Integrated output (4 marks)
Finally, integrate your previous programs to produce all three types of output: to port 1, to serial port and to LCD. The output to serial port should be with the period of 100 ms. Your final program design has to be modulus, therefore, the use of functions will be important.
1