二进制转十进制

 

// the 24 bit adc value from the chip is actually the fraction of the full
// dynamic range, the actual full dynamic range voltage is fixed by hardware
// design, and it's defined as VOLTAGE_SCALE. so the formular will be:
//
// vrms(in milliVolt) = adc * VOLTAGE_SCALE * 1000 / 2^24
//
// if we multiply everything first, we might overrun the 32 bit value
// but if we do all the bit shift first, we will lost to much accuracy
// so we do the this step by step.
//
// the last 5 bits are insignificant to milliV, and good enough for us to do
// a mulitplication without overrun.

 

v=adc/ 2^N  (N表示几位)  //公式

 例子

0.75   011   ==3/(2^2) =3/4=0.75

 
 
 
好文要顶 关注我 收藏该文  

posted on 2018-08-28 15:16  朱光铭  阅读(129)  评论(0)    收藏  举报

导航