麻烦各位看看,adc采集的数值一直是3.0V,请问是怎么回事

2019-07-15 18:54发布

tica, sans-serif">用28335在编写adc的采集程序,但是采集到的电压总是3.0V,想请各位给看看,问题是出在了哪里,现附上adc配置程序:void main(void)
{
InitSysCtrl();
InitEPwm1Gpio();
EALLOW;
#define ADC_MODCLK 0x3
SysCtrlRegs.HISPCP.all = ADC_MODCLK;
EDIS;
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EALLOW;
PieVectTable.ADCINT = &adc_isr;
EDIS;

EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0;
EDIS;
InitEPwm1Example();InitAdc();
EALLOW;
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1;
EDIS;

IER |= M_INT1;
PieCtrlRegs.PIEIER1.bit.INTx6 = 1;
EINT;
ERTM;

kk=ii=0;
Uinput=8;
kp1=0.1;ki1=0.3;
kp2=0.1;ki2=0.3;
ek=ek1=0;
uk=0;
uk1=250;

AdcRegs.ADCREFSEL.bit.REF_SEL=1;
AdcRegs.ADCTRL1.bit.ACQ_PS = 0x4;//采样窗口预定标=ADCLK*(ACQ_PS+1)
AdcRegs.ADCTRL3.bit.ADCCLKPS =0x0;//高速外设时钟预定标系数
AdcRegs.ADCTRL1.bit.SEQ_CASC = 1; // 级联排序
AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1 = 0x1;//允许SEQ1中断
AdcRegs.ADCTRL2.bit.RST_SEQ1 = 0x1;//复位SEQ1
AdcRegs.ADCMAXCONV.all = 0x0001; // Setup 2 conv's on SEQ1
AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x0; // Setup ADCINA3 as 1st SEQ1 conv.
AdcRegs.ADCCHSELSEQ1.bit.CONV01 = 0x1;
AdcRegs.ADCTRL2.bit.EPWM_SOCA_SEQ1 = 1;// Enable SOCA from ePWM to start SEQ1
AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1 = 1; // Enable SEQ1 interrupt (every EOS)
for(;;)
{
asm(" NOP");
}
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。