#include "DSP28x_Project.h"
Uint16 LoopCount
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 = 5
AdcRegs.ADCSOC1CTL.bit.TRIGSEL = 5
AdcRegs.ADCSOC0CTL.bit.ACQPS = 6
AdcRegs.ADCSOC1CTL.bit.ACQPS = 6
EDIS
//还没开始研究ePWM
EPwm1Regs.ETSEL.bit.SOCAEN = 1
EPwm1Regs.ETSEL.bit.SOCASEL = 4
EPwm1Regs.ETPS.bit.SOCAPRD = 1
EPwm1Regs.CMPA.half.CMPA = 0x0080
EPwm1Regs.TBPRD = 0xFFFF
EPwm1Regs.TBCTL.bit.CTRMODE = 0
for(
{
while(AdcRegs.ADCINTFLG.bit.ADCINT1 == 0){} //等待EOC1信号(ADCINT1)
AdcRegs.ADCINTFLGCLR.bit.ADCINT1 = 1
if(ConversionCount == 9)
{
ConversionCount = 0
}
else ConversionCount++
Voltage1[ConversionCount] = AdcResult.ADCRESULT0
Voltage2[ConversionCount] = AdcResult.ADCRESULT1
}
}