Lab 6: Analog-to-Digital Converter
6 - 22 C2000 Microcontroller Workshop - Analog-to-Digital Converter
8. Click the “Debug” button (green bug). The “Debug Perspective” view should open, the
program will load automatically, and you should now be at the start of main(). If the
device has been power cycled since the last lab exercise, be sure to configure the boot
mode to EMU_BOOT_SARAM using the Scripts menu.
Run the Code
9. In Main_6.c place the cursor in the “main loop” section, right click on the mouse
key and select Run To Line.
10. Open a memory browser to view some of the contents of the ADC results buffer. The
address label for the ADC results buffer is AdcBuf (type &AdcBuf) in the “Data”
memory page. Select GO to view the contents of the ADC result buffer.
Note: Exercise care when connecting any wires, as the power to the USB Docking Station is
on, and we do not want to damage the controlCARD!
11. Using a connector wire provided, connect the ADCINA0 (pin # ADC-A0) to “GND” (pin
# GND) on the Docking Station. Then run the code again, and halt it after a few seconds.
Verify that the ADC results buffer contains the expected value of ~0x0000. Note that
you may not get exactly 0x0000 if the device you are using has positive offset error.
12. Adjust the connector wire to connect the ADCINA0 (pin # ADC-A0) to “+3.3V” (pin #
GPIO-20) on the Docking Station. (Note: pin # GPIO-20 has been set to “1” in Gpio.c).
Then run the code again, and halt it after a few seconds. Verify that the ADC results
buffer contains the expected value of ~0x0FFF. Note that you may not get exactly
0x0FFF if the device you are using has negative offset error.
13. Adjust the connector wire to connect the ADCINA0 (pin # ADC-A0) to GPIO18 (pin #
GPIO-18) on the Docking Station. Then run the code again, and halt it after a few
seconds. Examine the contents of the ADC results buffer (the contents should be
alternating ~0x0000 and ~0x0FFF values). Are the contents what you expected?
14. Open and setup a graph to plot a 50-point window of the ADC results buffer.
Click: Tools Graph Single Time and set the following values:
Acquisition Buffer Size 50
DSP Data Type 16-bit unsigned integer
Sampling Rate (Hz) 50000
Start Address AdcBuf
Display Data Size 50
Time Display Unit
µs
Select OK to save the graph options.