|
要使用外部的REF3020 作为 F2808 ADC 的外部参考,但ADC ADCRESULTn 中得到的结果却是以3V为参考基准的。帮忙看看以下程序有何问题?
通过设置断点查看寄存器的位已设置成功。外部电路已按照手册的接法接好,ADCREFP接2.2uF,ADCREFM接2.2uF ADCRESEXT接22K 都检查过。
作了个测试,当外部输入2.048v时,ADC的结果寄存器数值为2800左右(应为0xFFF 呀??)。
void InitAdc(void)
{
extern void DSP28x_usDelay(Uint32 Count);
AdcRegs.ADCREFSEL.bit.REF_SEL = 0x1; // 1:选择外部参考, ADCREFIN = 2.048v
AdcRegs.ADCTRL3.all = 0xE0; // Power up bandgap/reference/ADC circuits
DELAY_US(ADC_usDELAY); // Delay before converting ADC channels
AdcRegs.ADCTRL1.bit.ACQ_PS = 0x0F;
AdcRegs.ADCTRL3.bit.ADCCLKPS = 2;
AdcRegs.ADCTRL1.bit.CPS = 1;
AdcRegs.ADCTRL1.bit.SEQ_CASC = 1;
AdcRegs.ADCTRL3.bit.SMODE_SEL = 1;
AdcRegs.ADCTRL1.bit.CONT_RUN = 0;
AdcRegs.ADCMAXCONV.all = 0x0007;
AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x0;
AdcRegs.ADCCHSELSEQ1.bit.CONV01 = 0x0;
AdcRegs.ADCCHSELSEQ1.bit.CONV02 = 0x1;
AdcRegs.ADCCHSELSEQ1.bit.CONV03 = 0x1;
AdcRegs.ADCCHSELSEQ2.bit.CONV04 = 0x2;
AdcRegs.ADCCHSELSEQ2.bit.CONV05 = 0x2;
AdcRegs.ADCCHSELSEQ2.bit.CONV06 = 0x4;
AdcRegs.ADCCHSELSEQ2.bit.CONV07 = 0x4;
AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1 = 1;
AdcRegs.ADCTRL2.bit.INT_MOD_SEQ1 = 0;
}
|
|