zoukankan      html  css  js  c++  java
  • CC2540中的电压检测

    /**
    * Battery level conversion from ADC to a percentage:
    *
    * The maximum ADC value for the battery voltage level is 511 for a
    * 10-bit conversion. The ADC value is references vs. 1.25v and
    * this maximum value corresponds to a voltage of 3.75v.
    *
    * For a coin cell battery 3.0v = 100%. The minimum operating
    * voltage of the CC2540 is 2.0v so 2.0v = 0%.
    *
    * To convert a voltage to an ADC value use:
    *
    * (v/3)/1.25 * 511 = adc
    *
    * 3.0v = 409 ADC
    * 2.0v = 273 ADC
    *
    * We need to map ADC values from 409-273 to 100%-0%.
    *
    * Normalize the ADC values to zero:
    *
    * 409 - 273 = 136
    *
    * And convert ADC range to percentage range:
    *
    * percent/adc = 100/136 = 25/34
    *
    * Resulting in the final equation, with round:
    *
    * percent = ((adc - 273) * 25 + 33) / 34
    */

    这是 TI 官方给的一个demo,其电压源为 VDD/3。

    看了这个例子,然后完成了自己项目中的需求。我想,以后再遇到检测 MCU 电压的时候就很驾轻就熟了。

    附:我的项目中用到的是14bit的分辨率,参考电压为内部的1.25v,转换公式如下:

    (102V/(510+102))/1.25 * 8192 = ADC

    当你坚持做一件完全正确的事情,有可能在很长一段时间内,你的价值都是零。
  • 相关阅读:
    03 http请求协议与响应协议
    02 web应用程序
    Django web框架目录
    01 http协议
    Django框架
    Bootstrap栅格系统
    bootstrap介绍和引入
    Python中日志logging模块
    Python 装饰器实现单列模式
    Python 如何理解可更改元组中的可变序列
  • 原文地址:https://www.cnblogs.com/lweleven/p/adcMaster.html
Copyright © 2011-2022 走看看