cc2640使用sensor controller中的ADC问题?
时间:10-02
整理:3721RD
点击:
我在使用cc2640的adc的时候,通过sensor controller来控制adc。选择adc的参考电压为电池电压的时候,即配置:ADC_REF_VDDS_REL参数。再通过adc来采集电池电压:ADC_INPUT_VDDS。
发现这个读到的值不是0xFFF,而是0xF87,偏差有点大。这是为什么呢?
由于电池电压使用过程电压会变化,不能作为参考电压的。
换成内部参考电压试试!
测量电池电压需要电阻串联分压。
试过用内部参考电压,2640的内部参考电压为4.3v。用sensor controller ADC,有选择电源电压作为输入,为什么要串联电阻分压呢。我做过如下实验:
用两个电阻进行分下,其中一个电阻值已知,另外一个未知。当我用内部参考电压的时候,用ADC测量电池电压和已知电阻的电压,计算得到的未知电阻的结果波动很大;当用电池电压作为相对参考电压的时候,未知电阻的测量结果波动较小。
参考下面代码:
/*! * @brief Specifies whether the internal reference of the ADC is sourced from the battery voltage or a fixed internal source. * * - In practice, using the internal fixed voltage reference sets the upper range of the ADC to a fixed value. That value is 4.3V with * input scaling enabled and ~1.4785V with input scaling disabled. In this mode, the output is a function of the input voltage multiplied * by the resolution in alternatives (not bits) divided by the upper voltage range of the ADC. Output = Input (V) * 2^12 / (ADC range (V)) * * - Using VDDS as a reference scales the upper range of the ADC with the battery voltage. As the battery depletes and its voltage drops, so does * the range of the ADC. This is helpful when measuring signals that are generated relative to the battery voltage. In this mode, the output is * a function of the input voltage multiplied by the resolution in alternatives (not bits) divided by VDDS multiplied by a scaling factor derived * from the input scaling. Output = Input (V) * 2^12 / (VDDS (V) * Scaling factor), where the scaling factor is ~1.4785/4.3 for input scaling * disabled and 1 for input scaling enabled. * * @note The actual reference values are slightly different for each device and are higher than the values specified above. This gain is saved in * the FCFG. The function ::ADC_convertRawToMicroVolts() must be used to derive actual voltage values. Do not attempt to compare raw values * between devices or derive a voltage from them yourself. The results of doing so will only be approximately correct. * * @warning Even though the upper voltage range of the ADC is 4.3 volts in fixed mode with input scaling enabled, the input should never exceed * VDDS as per the data sheet. */ typedef enum ADCCC26XX_Reference_Source { ADCCC26XX_FIXED_REFERENCE = AUXADC_REF_FIXED, ADCCC26XX_VDDS_REFERENCE = AUXADC_REF_VDDS_REL } ADCCC26XX_Reference_Source;
controller ADC 相关文章: