你好,
我们正在努力解决如何使用差异ADC。首先,从GP_ADC_RESULT_REG返回的值似乎比我们所预期的要高的一个值,其次是当测量的电压差实际增加时,差值在幅度幅度降低:
1) Our reading of the datasheet indicates that when configured for differential ADC operation between P0_ 0 and P0_1, that the result is a 10-bit 2's complement binary integer which would allow for full scale readings of 0x200 (-512) at -1.2v and 0x1ff (+511) at +1.2v. This would mean that each ADC count was roughly equal to 2.3mV on the measurement (i.e. 1.2 / 512 = 2.34e-03).
We're attempting to use the DA14580 devkit-basic differential ADC to measure the voltage difference between the 2 arms of a Wheatstone resistive bridge (P0_ 0 connected to the left hand side and P0_1 connected to the right hand side). Using an oscilloscope, we measure P0_ 0 to be at 1.54v and P0_1 to be at 1.26v.
1.26 - 1.54 = -0.28v
因此,我们期望ADC_Get_Sample()返回的ADC计数在0x388(-120)左右的某个地方,但实际上它在0x235(-459)〜= -1.07V左右。
我们误解了数据表吗?将ADC配置为单端似乎正常工作。
2)我们的惠斯通桥配置为测量NTC热敏电阻。当该热敏电阻的值随温度的变化时,随着温度加热时,电阻减小,因此通过P0_1测量的电压相对于在P0_ 0处测量的电压降低。因此,差分ADC结果应该变得更加负,但实际上它实际上变得更加负因为某些原因。
Our bridge has an 18k on the top for the left hand arm (connected to P0_ 0) with a 17.7k resistance at the bottom and the right hand arm (connected to P0_1) consists of 18k at the top and a nominally 10k (@25C) Thermistor at the bottom. The Thermistor's resistance at the time of measuring was around 12.5k, decreasing to 11k when we gently warmed it.
Our firmware's calling the following functions:
在睡觉处理手上唤醒adc_calibrate()
Inside our app_easy_timer() callback handler
adc_init(0,gp_adc_sign | gp_adc_chop,0);//差动ADC,签名反转和切块取消偏移电压,不要切换3.6V衰减器
adc_enable_channel(0);// p0_ 0和p0_1
int32_t adccount = adc_get_sample();
。。。// perform calculations etc.
adc_disable();
我们已经发现编码可能是符号+幅度,而不是2的COMP(我们要求将此信息添加到数据表中)。即0x3FF是最负值(理论上-1.2V)和0x1FF是最正值(理论上+ 1.2V)。
如果我们在范围上测量-0.3v和p0_1之间的范围,则ADC报告0x233(-51)。如果我们将导线切换到P0_0和P0_1(使差异现在+ 0.3V),则ADC返回0x1C4(452)的值。
然而如果我们P0_ 0然后P0_1地面adc for some reason returns 0x0ff. Surely it should return 0x000?
The differential ADC result actually looks to be a combination of sign and magnitude and 2's complement. The steps to turn the adc_get_sample() result into a signed integer ranging from -1024 to +1023 are as follows:
Code to perform the above conditioning of the get_adc_sample() result from a differential ADC:
/ *条件差分ADC结果将2的COMP整数与单个结束读数相同的比例* /
静态int32_t namalisedifferendedcount(Int32_t Adccount){
//标志和幅度
if(adccount&0x200){
adcCount = ~(adcCount & 0x1ff);
} 别的 {
//积极的结果是出于某种原因消极的
adcCount = (~adcCount & 0x1ff);
}
// Double to get the ADC count to the same scale as the single ended result
return adcCount * 2;
}
我们发现的另一件事是,数据表似乎表明,差分ADC引脚之间的差异可以在-1180和+1180 mV之间,但额外的约束是始终必须始终为0到1180mV之间的两个引脚。嗯(至少没有衰减器启用)。
嗨scsims,
对于延迟响应,不幸的是,关于差异模式没有关于ADC的额外信息,并且在任何参考设计中没有使用它,因此我必须运行一些实验以获得以下结论。在差分模式中,当电压差为零时,ADC的输出应接近0x1FF。当电压差为-1.2伏时,ADC的输出应接近0x0,并且当电压差为+1.2伏时,ADC的输出应接近0x3FF。据我所知,当您使用差异模式时,这是映射。
Thanks PM_dialog
嗨pm_dialog,
谢谢你看了这个,你的结论比我所观察到的行为更加有意义。如我在评论中提到的那样,我们可能已经将引脚驱动到电压限制之外。我会看看我是否可以在某些时候得到一些时间来重现你的实验。
Thanks,
scsims.
你好pm_dialog,
我现在已经复制了你的结果,但有一个例外,我们假设P0_ 0是AIN-和P0_1是AIN +然而,它们是相反的方式。
p0_1 = 0mV,p0_ 0 = + 1180mv然后get_adc_sample()返回0x3FF
p0_1 = 1180mv,p0_ 0 = 0mV然后get_adc_sample()返回0x000
我们也清楚地使用其范围之外的ADC输入,我们假设ADC最大电压仅为P0_0和P0_1达到+1180 mV,但实际上,P0_ 0和P0_1也仅额定到0mV至+之间的额定值1180mv单独。
Thanks again for your help.
scsims.