Syntax
unsigned int GetBatteryVoltage(void);
Parameters
None
Return value
Returns the output voltage level of the battery pack in mV.
Remarks
The relationship between the output voltage level of the battery pack and the remaining battery level changes depending on the characteristics of the battery and the usage history of charging and discharging.
Requirements
Header file:
lib.hLibrary file:
libSTARTUPOPH5000.a
Sample
#include <stdio.h>
#include <stdlib.h>
#include "lib.h"
void main(void)
{
unsigned int voltage;
Cursor(NOWRAP);
printf("\fBattery voltage:");
for(;;)
{
voltage = (long)GetBatteryVoltage();
GotoXY(0,1);
// mVからVに変換して表\u31034 示する
printf("%1d.%02d V",voltage/1000,((voltage-1000*(voltage/1000))/10));
Sound(TCLICK,VMEDIUM,SHIGH,0);
GoodReadLed(GREEN,TCLICK);
Delay(TIME_100MS * 50);
}
}
Last updated: 2020/10/07