我采集出来的数据不是顶部失真,就是底部失真; 我设置峰峰值为2V,直流偏置1V,fs=300Hz时出现顶部失真,而且按照转换公式D=(A-参考值)*4096/3计算的话也该是2730,而在变量表中显示的最大值是4095,求大神指教。下面配置AD的主要程序 AdcRegs.ADCTRL3.bit.ADCCLKPS = ADC_CKPS; // 值是2 AdcRegs.ADCTRL1.bit.CPS=1
AdcRegs.ADCTRL1.bit.CPS=1 ;
AdcRegs.ADCTRL1.bit.ACQ_PS = ADC_SHCLK; // 值是f Sequential mode: Sample rate = 1/[(2+ACQ_PS)*ADC clock in ns]
// = 1/(3*40ns) =8.3MHz (for 150 MHz SYSCLKOUT)
// = 1/(3*80ns) =4.17MHz (for 100 MHz SYSCLKOUT)
AdcRegs.ADCTRL1.bit.SEQ_CASC = 1; // 1 Cascaded mode 级联
AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x1; // 选择通道00 即ADCINA0
AdcRegs.ADCTRL1.bit.CONT_RUN = 1; // Setup continuous run 连续运行模式
AdcRegs.ADCTRL1.bit.SEQ_OVRD = 1; // Enable Sequencer override feature
AdcRegs.ADCCHSELSEQ1.all = 0x0; // Initialize all ADC channel selects to A0
AdcRegs.ADCCHSELSEQ2.all = 0x0;
AdcRegs.ADCCHSELSEQ3.all = 0x0;
AdcRegs.ADCCHSELSEQ4.all = 0x0;
AdcRegs.ADCMAXCONV.bit.MAX_CONV1 = 0x1; // convert and store in 8 results registers
|