This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

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

Part Number: TMS320F28335
Other Parts Discussed in Thread: C2000WARE

ADC初始化代码如下:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void ADC_Init(void){
EALLOW;
SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1; // Enable ADC clock
SysCtrlRegs.HISPCP.all = 3; // ADC: 25MHZ
InitAdc(); // provide by TI
// AdcRegs.ADCTRL3.all = 0x00E0;
AdcRegs.ADCTRL1.bit.ACQ_PS = 0x0F; // sequential sampling
AdcRegs.ADCTRL3.bit.ADCCLKPS = 1; // 25Mhz no frequency division
AdcRegs.ADCTRL1.bit.SEQ_CASC = 1; // 1: Cascaded sequencer mode 0:double sort mode
AdcRegs.ADCTRL3.bit.SMODE_SEL = 0;// 1:Synchronous sampling 0:sequential sampling
AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x0; // A0 as the sample channel save data to results0
AdcRegs.ADCCHSELSEQ1.bit.CONV01 = 0x1; // A1 as the sample channel save data to results1
AdcRegs.ADCCHSELSEQ1.bit.CONV02 = 0x2; // A2 as the sample channel save data to results2
AdcRegs.ADCCHSELSEQ1.bit.CONV03 = 0x3; // A3 as the sample channel save data to results3
AdcRegs.ADCCHSELSEQ2.bit.CONV04 = 0x4; // A4 as the sample channel save data to results4
AdcRegs.ADCCHSELSEQ2.bit.CONV05 = 0x5; // A4 as the sample channel save data to results4
AdcRegs.ADCCHSELSEQ2.bit.CONV06 = 0x6; // A4 as the sample channel save data to results4
AdcRegs.ADCCHSELSEQ2.bit.CONV07 = 0x7; // A4 as the sample channel save data to results4
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

返回ADC读值的代码如下:

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

x 出现错误。请重试或与管理员联系。