batChargerEnable (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

1.00 / 1.00.00


batChargerEnable enables/disables the charging of the on-board battery.

The charger enable/disable state is used until the device is restarted or batChargerEnable is called again.

The battery charger is enabled by default.

 

 

Input:

enable : BOOL (false/true)

TRUE:

Enables the charging.

FALSE:

Disables the charging.

 

Returns: INT

0

Denotes successful operation.

-1

Denotes that the function is not supported on the specific device or that the battery is missing.

 

Declaration:

FUNCTION batChargerEnable : INT;
VAR_INPUT
  enable : BOOL;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
VAR_INPUT
  doCharge : BOOL; | enable/disable charger
END_VAR;
 
VAR_OUTPUT
  isEnabled : BOOL; | Charger is enabled
END_VAR;
 
PROGRAM test;
BEGIN
  IF (doCharge XOR isEnabled) THEN
    // Enable/Disable battery charging
    batChargerEnable(enable:=doCharge);
    isEnabled := doCharge;
  END_IF;
END;
END_PROGRAM;