batConsumptionTotal (function)

Top  Previous  Next

Architecture:

X32

Device support:

SX1

Firmware version:

2.70


This function will return the total battery current consumption in mAh accumulated since the last call to batConsumptionClear.

 

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

The current consumption total is persistent even through system restarts and may be reset by calling batConsumptionClear,

 

 

Input:

None.

 

Returns: DINT

The total current that has been consumed from the battery in mAh.

 

Declaration:

FUNCTION batConsumptionTotal : 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 := batConsumptionTotal();
  ...
END;
END_PROGRAM;