#include "DSP28x_Project.h"
Uint16 ConversionCount
Uint16 Voltage1[10]
Uint16 Voltage2[10]
main()
{
InitSysCtrl()
DINT
InitPieCtrl()
IER = 0x0000
IFR = 0x0000
InitPieVectTable()
InitAdc()
ConversionCount = 0
EALLOW
AdcRegs.ADCCTL1.bit.INTPULSEPOS = 1
AdcRegs.INTSEL1N2.bit.INT1E = 1
AdcRegs.INTSEL1N2.bit.INT1CONT = 0
AdcRegs.INTSEL1N2.bit.INT1SEL = 1
AdcRegs.ADCSOC0CTL.bit.CHSEL = 0
AdcRegs.ADCSOC1CTL.bit.CHSEL = 1
AdcRegs.ADCSOC0CTL.bit.TRIGSEL = 0
AdcRegs.ADCSOC1CTL.bit.TRIGSEL = 0
AdcRegs.ADCSOC0CTL.bit.ACQPS = 6
AdcRegs.ADCSOC1CTL.bit.ACQPS = 6
EDIS
AdcRegs.ADCSOCFRC1.all = 0x0003
for(
{
while(AdcRegs.ADCINTFLG.bit.ADCINT1 == 0){} //等待EOC1信号(ADCINT1)
AdcRegs.ADCINTFLGCLR.bit.ADCINT1 = 1
AdcRegs.ADCSOCFRC1.all = 0x0003
if(ConversionCount == 9)
{
ConversionCount = 0
}
else ConversionCount++
Voltage1[ConversionCount] = AdcResult.ADCRESULT0
Voltage2[ConversionCount] = AdcResult.ADCRESULT1
}
}