TI中文支持网
TI专业的中文技术问题搜集分享网站

關於cc2640電池電壓量測問題

各位大大, 

我目前 利用 cc2640內部偵測電池的公式量測電壓如下面 .因為原本公式 主要是換算0~3.3V為0~100%,如果我  需要量測範為2~3,3V為0~100%,在下面的 battMaxLevel參數要如何修改,有沒有高手可以解答謝謝

static uint8_t battMeasure(void)
{
uint32_t percent;

// Call measurement setup callback
if (battServiceSetupCB != NULL)
{
battServiceSetupCB();
}

// Read the battery voltage (V), only the first 12 bits
percent = AONBatMonBatteryVoltageGet();

// Convert to from V to mV to avoid fractions.
// Fractional part is in the lower 8 bits thus converting is done as follows:
// (1/256)/(1/1000) = 1000/256 = 125/32
// This is done most effectively by multiplying by 125 and then shifting
// 5 bits to the right.
percent = (percent * 125) >> 5;
// Convert to percentage of maximum voltage.
percent = ((percent* 100) / battMaxLevel);

Viki Shi:

论坛有类似问题,解答请看这边: e2e.ti.com/…/480525

赞(0)
未经允许不得转载:TI中文支持网 » 關於cc2640電池電壓量測問題
分享到: 更多 (0)