PreviousNext
getSupplyVoltage
Help > OS functions > Other > getSupplyVoltage

Function

 

Power supply measurement (up to 3.84 V)

Purpose

 

Battery check

Syntax

 

uns8 getSupplyVoltage()

Parameters

 

 –

Return value

 

level = 1, 2, …59                   Voltage [V] = 261.12 / (127 - level)

Output values

 

 –

Preconditions

 

 –

Remarks

 

     The internal power supply voltage is checked.

     In the case of TR modules with LDO, it is the LDO output but not the actual battery voltage. This value is 3.0 V typically if the battery is O.K. and drops down if the battery is low.

     To evaluate the battery, take into consideration your battery type and power supply circuitry with respect to diodes and other possible voltage drops.

Side effects

 

A/D converter control registers are changed.

See also

 

  –

Example

 

if (getSupplyVoltage() < 38)

    …                             // Low battery

else

    …                             // Voltage > 2.93 V