芯片MSP430F6733,使用外部基准电压3.0V,过采样OSR=256,精度24位
我外部输入电压0.61V时, 经过SD24_B转换后获取的数据除以0x1000000,再乘以3.0,结果居然有1.83伏左右
我外部输入电压0.88V时, 经过SD24_B转换后获取的数据除以0x1000000,再乘以3.0,结果居然有1.97伏左右
我有点搞不懂了,请帮忙分析下是怎么回事
下面是我的采样代码:
unsigned long resultsVoltages[10];
unsigned long baseVoltages[10];
unsigned char voltageIndex;
float results,bases;
void main()
{
SD24BCTL0 = SD24SSEL_1;
SD24BCCTL1 = SD24SNGL | SD24SCS_4; // Single conversion, group 0
SD24BCCTL2 = SD24SNGL | SD24SCS_4; // Single conversion, group 0
SD24BIE = SD24IE2; // Enable channel 2 interrupt
delay_ms(10);
voltageIndex=0;
while(voltageIndex<10)
{
SD24BCTL1 |= SD24GRP0SC; // Set bit to start conversion
__bis_SR_register(LPM0_bits | GIE); // Enter LPM0 w/ interrupts
SD24BCTL1 &= ~SD24GRP0SC; // Clear bit for next conversion
__no_operation(); // SET BREAKPOINT HERE
voltageIndex++;
}
results=0;
for(int i=0;i<10;i++)
{
results+=resultsVoltages[i];
}
results/=10;
results=results*3.0/0x1000000;
floatToStr(results,s,5);
displayFloat(results);
bases=0;
for(int i=0;i<10;i++)
{
bases+=baseVoltages[i];
}
bases/=10;
bases=bases*3.0/0x1000000;
displayFloat(bases);
delay_ms(2000);
}
#pragma vector=SD24B_VECTOR
__interrupt void SD24BISR(void)
{
switch (SD24BIV)
{
case SD24BIV_SD24OVIFG: // SD24MEM Overflow
break;
case SD24BIV_SD24TRGIFG: // SD24 Trigger IFG
break;
case SD24BIV_SD24IFG0: // SD24MEM0 IFG
break;
case SD24BIV_SD24IFG1: // SD24MEM1 IFG
break;
case SD24BIV_SD24IFG2: // SD24MEM2 IFG
resultsVoltages[voltageIndex] = SD24BMEMH1; // Save CH2 results (clears IFG)
resultsVoltages[voltageIndex] = (resultsVoltages[voltageIndex] << 16) | SD24BMEML1; // Concatenate lower and upper words
baseVoltages[voltageIndex] = SD24BMEMH2;
baseVoltages[voltageIndex] = (baseVoltages[voltageIndex] << 16) | SD24BMEML2;
break; }
__bic_SR_register_on_exit(LPM0_bits); // Exit LPM0
}
Triton Zhang:
你把你采样值是多少列出来吧?
Jian Shen:
回复 Triton Zhang:
SD2P0输入约为0.61V,SD2N0接地,仿真时
SD24BMEML2=0xADEA
SD24BMEMH2=0x009B
多次采样,获取的值SD24BMEMH2不变,SD24BMEML2低三位变动!
Jian Shen:
回复 Triton Zhang:
使用内部参考电压, VREF端测得电压为1.15V,跟说明书中的指明一样,然后在
SD2P0输入约为0.61V,SD2N0接地,仿真时
SD24BMEML2=0x8407
SD24BMEMH2=0x00C5
这样算出来的电压也有0.887V,明显跟输入的相差太大!难道是我这块芯片的sd24_b模块坏了?测了下其它的ADC10_A模块,都是正常滴!
还请用过用过SD24_B的帮我看看哪里出了问题?
aaron song:
回复 Jian Shen:
您好!不知道你问题解决了没有,我现在也碰到类似问题