用28335的ADC模块对模拟的正弦波形进行采样,发现波形会出现跳变的情况。请问这是什么原因造成的? EALLOW;
#if (CPU_FRQ_150MHZ)
#define ADC_MODCLK 0x3
#endif
#if (CPU_FRQ_100MHZ)
#define ADC_MODCLK 0x2
#endif
EDIS;
EALLOW;
SysCtrlRegs.HISPCP.all = ADC_MODCLK; // HSPCLK = SYSCLKOUT/ADC_MODCLK
EDIS;
AdcRegs.ADCTRL1.bit.ACQ_PS=0xf;
AdcRegs.ADCTRL3.bit.ADCCLKPS = 0x1;//设置采用2分频
AdcRegs.ADCTRL1.bit.SEQ_CASC=1;
AdcRegs.ADCMAXCONV.bit.MAX_CONV1=2;
AdcRegs.ADCTRL2.bit.EPWM_SOCA_SEQ1=1;
AdcRegs.ADCCHSELSEQ1.bit.CONV00=0x0;
AdcRegs.ADCCHSELSEQ1.bit.CONV01=0x1;
AdcRegs.ADCCHSELSEQ1.bit.CONV02=0x2;
AdcRegs.ADCTRL1.bit.CONT_RUN=1;
AdcRegs.ADCTRL1.bit.SEQ_OVRD=0;
AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1=1;
// AdcRegs.ADCTRL2.bit.SOC_SEQ1=1;
//设置ePWM1_SOCA为ADC模块的启动信号
EPwm1Regs.ETSEL.bit.SOCAEN = 1; // 使能A组的启动信号SOCA
EPwm1Regs.ETSEL.bit.SOCASEL = ET_CTR_ZERO; // 选择SOCA信号产生的时刻为CTR = 0
EPwm1Regs.ETPS.bit.SOCAPRD = ET_1ST; // 每次触发事件产生一个启动信号
EPwm1Regs.ETCLR.bit.SOCA = 1;
while(AdcRegs.ADCST.bit.INT_SEQ1==0){};
//AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1; //清除中断标志位
// while (AdcRegs.ADCST.bit.SEQ1_BSY == 1);
p->v_spe = 3 * (AdcRegs.ADCRESULT0>>4) /4095.0;
p->v_Ia = 3 * (AdcRegs.ADCRESULT1>>4) /4095.0;
p->v_Ib = 3 * (AdcRegs.ADCRESULT2>>4) /4095.0;
p->Speed_tar = p->v_spe /3.0; //目标转速标幺值
p->Ia = (p->v_Ia - 1.65) * 10;
p->Ib = (p->v_Ib - 1.65) * 10;
//AdcRegs.ADCTRL2.bit.RST_SEQ1 = 1; //复位SEQ1转换序列
AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1;
|