TI中文支持网
TI专业的中文技术问题搜集分享网站

TMS320F28335: 不管ADC引脚接多少V,读回的值一直是2300,15个ADC口都这样。这是怎么回事呢,芯片还是新买的。

Part Number:TMS320F28335Other Parts Discussed in Thread:C2000WARE

ADC初始化代码如下:

void ADC_Init(void){EALLOW;SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1; // Enable ADC clockSysCtrlRegs.HISPCP.all = 3; // ADC: 25MHZInitAdc();  // provide by TI//  AdcRegs.ADCTRL3.all = 0x00E0;AdcRegs.ADCTRL1.bit.ACQ_PS = 0x0F; // sequential samplingAdcRegs.ADCTRL3.bit.ADCCLKPS = 1; // 25Mhz no frequency divisionAdcRegs.ADCTRL1.bit.SEQ_CASC = 1; // 1:  Cascaded sequencer mode0:double sort modeAdcRegs.ADCTRL3.bit.SMODE_SEL = 0;// 1:Synchronous sampling0:sequential samplingAdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x0; // A0 as the sample channel  save data to results0AdcRegs.ADCCHSELSEQ1.bit.CONV01 = 0x1; // A1 as the sample channel  save data to results1AdcRegs.ADCCHSELSEQ1.bit.CONV02 = 0x2; // A2 as the sample channel  save data to results2AdcRegs.ADCCHSELSEQ1.bit.CONV03 = 0x3; // A3 as the sample channel  save data to results3AdcRegs.ADCCHSELSEQ2.bit.CONV04 = 0x4; // A4 as the sample channel  save data to results4AdcRegs.ADCCHSELSEQ2.bit.CONV05 = 0x5; // A4 as the sample channel  save data to results4AdcRegs.ADCCHSELSEQ2.bit.CONV06 = 0x6; // A4 as the sample channel  save data to results4AdcRegs.ADCCHSELSEQ2.bit.CONV07 = 0x7; // A4 as the sample channel  save data to results4AdcRegs.ADCCHSELSEQ3.bit.CONV08 = 0x8; // B0 as the sample channel save data to results5AdcRegs.ADCCHSELSEQ3.bit.CONV09 = 0x9; // B0 as the sample channel save data to results5AdcRegs.ADCCHSELSEQ3.bit.CONV10 = 0xA; // B0 as the sample channel save data to results5AdcRegs.ADCCHSELSEQ3.bit.CONV11 = 0xB; // B0 as the sample channel save data to results5AdcRegs.ADCCHSELSEQ4.bit.CONV12 = 0xC; // B0 as the sample channel save data to results5AdcRegs.ADCCHSELSEQ4.bit.CONV13 = 0xD; // B0 as the sample channel save data to results5AdcRegs.ADCCHSELSEQ4.bit.CONV14 = 0xE; // B0 as the sample channel save data to results5AdcRegs.ADCCHSELSEQ4.bit.CONV15 = 0xF; // B0 as the sample channel save data to results5//AdcRegs.ADCCHSELSEQ1.bit.CONV02 = 0x02; // A2 as the sample channelAdcRegs.ADCTRL1.bit.CONT_RUN = 1; // continuous samplingAdcRegs.ADCMAXCONV.bit.MAX_CONV1 = 0xF;  // max sample channel, CONV05 have used , so it should be 5. but actully, only two channel working. Cascaded mode max 15, double sort max 7;//AdcRegs.ADCMAXCONV.bit.MAX_CONV2 = 0xf;  // max sample channel, case only A0 is used , so 0x0;AdcRegs.ADCTRL2.all = 0x2000;//software triggerEDIS;
}

返回ADC读值的代码如下:

Uint16 Read_ADCValueResult0(void){while(AdcRegs.ADCST.bit.INT_SEQ1 == 0);// wait the end of the translationAdcRegs.ADCST.bit.INT_SEQ1_CLR = 1;//clear interrupt flagreturn AdcRegs.ADCRESULT0>>4;//return translate results, high 12bits valid, low 4bits invalid
}

Alice:

您好,

     请参考c2000ware中的ADC驱动。

     Examples (ti.com)

赞(0)
未经允许不得转载:TI中文支持网 » TMS320F28335: 不管ADC引脚接多少V,读回的值一直是2300,15个ADC口都这样。这是怎么回事呢,芯片还是新买的。
分享到: 更多 (0)

© 2024 TI中文支持网   网站地图 鲁ICP备2022002796号-1