Lab 6: Analog-to-Digital Converter
C2000 Microcontroller Workshop - Analog-to-Digital Converter
6 - 23
15.
Recall that the code toggled the GPIO18 pin alternately high and low. (Also, the ADC
ISR is toggling the LED LD3 on the controlCARD as a visual indication that the ISR is
running). If you had an oscilloscope available to display GPIO18, you would expect to
see a square-wave. Why does Code Composer Studio plot resemble a triangle wave?
What is the signal processing term for what is happening here?
16.
Recall that the program toggled the GPIO18 pin at a 50 kHz rate. Therefore, a complete
cycle (toggle high, then toggle low) occurs at half this rate, or 25 kHz. We therefore
expect the period of the waveform to be 40
µ
s. Confirm this by measuring the period of
the triangle wave using the “measurement marker mode” graph feature. In the graph
window toolbar, left-click on the ruler icon with the red arrow. Note when you hover
your mouse over the icon, it will show “
Toggle Measurement Marker Mode
”.
Move the mouse to the first measurement position and left-click. Again, left-click on the
Toggle Measurement Marker Mode
icon. Move the mouse to the second
measurement position and left-click. The graph will automatically calculate the
difference between the two values taken over a complete waveform period. When done,
clear the measurement points by right-clicking on the graph and select
Remove All
Measurement Marks
(or Ctrl+Alt+M).
Using Real-time Emulation
Real-time emulation is a special emulation feature that offers two valuable capabilities:
A. Windows within Code Composer Studio can be updated at up to a 10 Hz rate
while the
MCU is running
. This not only allows graphs and watch windows to update, but also
allows the user to change values in watch or memory windows, and have those
changes affect the MCU behavior. This is very useful when tuning control law
parameters on-the-fly, for example.
B. It allows the user to halt the MCU and step through foreground tasks, while specified
interrupts continue to get serviced in the background. This is useful when debugging
portions of a realtime system (e.g., serial port receive code) while keeping critical
parts of your system operating (e.g., commutation and current loops in motor control).
We will only be utilizing capability “A” above during the workshop. Capability “B” is a
particularly advanced feature, and will not be covered in the workshop.
17.
The memory and graph windows displaying
AdcBuf
should still be open. The connector
wire between ADCINA0 (pin # ADC-A0) and GPIO18 (pin # GPIO-18) should still be
connected. In real-time mode, we will have our window continuously refresh at the
default rate. To view the refresh rate click:
Window
Preferences…
and in the section on the left select the “Code Composer Studio” category. Click the plus
sign (+) to the left of “Code Composer Studio” and select “Debug”. In the section on the
right notice the default setting:
•
“Continuous refresh interval (milliseconds)” = 500
Click
OK
.
Summary of Contents for C2000 Piccolo LaunchPad
Page 74: ...Interrupts 4 18 C2000 Microcontroller Workshop Reset and Interrupts ...
Page 100: ...Lab 5 System Initialization 5 26 C2000 Microcontroller Workshop System Initialization ...
Page 218: ...Lab 8 IQmath FIR Filter 8 42 C2000 Microcontroller Workshop Numerical Concepts ...
Page 334: ...F28069 controlCARD A 4 C2000 Microcontroller Workshop Appendix A Experimenter s Kit SW2 ...
Page 336: ...F28035 controlCARD A 6 C2000 Microcontroller Workshop Appendix A Experimenter s Kit SW2 SW3 ...