Lab 6: Analog-to-Digital Converter
C2000 Microcontroller Workshop - Analog-to-Digital Converter 6 - 21
Procedure
Open the Project
1. A project named Lab6 has been created for this lab. Open the project by clicking on
Project Import CCS Projects. The “Import CCS Eclipse Projects”
window will open then click Browse… next to the “Select search-directory” box.
Navigate to: C:\C28x\Labs\Lab6\Project and click OK. Then click Finish to
import the project. All build options have been configured the same as the previous lab.
The files used in this lab are:
F2806x_GlobalVariableDefs.c
F2806x_Headers_nonBIOS.cmd
Setup ADC Initialization and Enable Core/PIE Interrupts
2. In Main_6.c add code to call InitAdc() and InitEPwm() functions. The
InitEPwm() function is used to configure ePWM2 to trigger the ADC at a 50 kHz rate.
Details about the ePWM and control peripherals will be discussed in the next module.
3. Edit Adc.c to configure SOC0 in the ADC as follows:
• SOC0 converts input ADCINA0 in single-sample mode
• SOC0 has a 7 cycle acquisition window
• SOC0 is triggered by the ePWM2 SOCA
• SOC0 triggers ADCINT1 on end-of-conversion
• All SOCs run round-robin
4. Using the “PIE Interrupt Assignment Table” find the location for the ADC interrupt
“ADCINT1” (high-priority) and fill in the following information:
PIE group #: # within group:
This information will be used in the next step.
5. Modify the end of Adc.c to do the following:
- Enable the “ADCINT1” interrupt in the PIE (Hint: use the PieCtrlRegs structure)
- Enable the appropriate core interrupt in the IER register
6. Open and inspect DefaultIsr_6.c. This file contains the ADC interrupt service
routine. Save your work and close the modified files.
Build and Load
7. Click the “Build” button and watch the tools run in the Console window. Check for
errors in the Problems window.