batConsumption (function)

Top  Previous  Next

Architecture:

X32

Device support:

SX1

Firmware version:

2.70


This function will return the battery current consumption measured in mA.

The battery current consumption is only measured when the current consumption measurement circuit is enabled by using the batConsumptionEnable function.

 

 

Input:

None.

 

Returns: DINT

The current that is being consumed from the battery in mA.

 

Declaration:

FUNCTION batConsumption : DINT;

 

Example:

INCLUDE rtcu.inc
 
PROGRAM example;
VAR
  val : DINT;
END_VAR;
 
  // Start the current consumption measurement
  batConsumptionEnable(enable := ON);
 
BEGIN
  ...
  // Get the current consumption
  val := batConsumption();
  ...
END;
END_PROGRAM;