Lab 6: Analog-to-Digital Converter
Main_6.c Labcfg.cmd
Lab.cdb DSP281x_Headers_BIOS.cmd
User_5_6_7.cmd CodeStartBranch.asm
SysCtrl.c Gpio.c
DSP281x_GlobalVariableDefs.c PieCtrl_5_6_7_8_9.c
DefaultIsr_5_6_7.c Adc.c
Ev_6.c
Setup ADC Initialization and Enable Core/PIE Interrupts
2. In Main_6.c add code to call InitAdc() and InitEv() functions. The
InitEv() function is used to configure Timer 2 to trigger the ADC at a 50 kHz rate.
Details about the event manager will be discussed in the next module.
3. Edit Adc.c to implement the ADC initialization as described above in the objective for
the lab by configuring the following registers: ADCTRL1, ADCTRL2, ADCMAXCONV
and ADCCHSELSEQ1. (Set ADC for cascaded sequencer mode, CPS = CLK/1, and
acquisition time prescale = 8 * (1/ADCCLK).
4. Using the “PIE Interrupt Assignment Table” find the location for the
ADC interrupt, “ADCINT” 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 "ADCINT" interrupt in the PIE (Hint: use the PieCtrlRegs structure)
enable core INT1 (IER register)
6. Open and inspect DefaultIsr_5_6_7.c. This file contains the ADC interrupt
service routine.
7. Modify the configuration file lab.cdb to setup the PIE vector for the ADC interrupt.
Click on the plus sign (+) to the left of Scheduling and again on the plus sign (+) to
the left of HWI – Hardware Interrupt Service Routine Manager. Click
the plus sign (+) to the left of PIE INTERRUPTS. Locate the interrupt location for the
ADC (use the information from step #4). Right click, select Properties, and type
_ADCINT_ISR (with a leading underscore) in the function field. Click OK and save all
updates.
Build and Load
8. Save all changes to the files and click the “Build” button.
9. Reset the DSP, and then “Go Main”.
C28x - Analog-to-Digital Converter 6 - 15