pmPowerFail (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

1.00 / 1.00.00


This sets whether the device will continue to operate on internal battery or enter pmPowerDown (forever) when external power is lost (power fail). Please also refer to the technical manual for the specific RTCU device for further information and support.

If external power is disabled, operating on internal battery can not be disabled.

 

Input:

bat : BOOL

If true, the device will operate on internal battery when a power fail occur. If false, the device will enter a power-down mode.

 

Returns: INT

0

- Success.

1

- External power is disabled.

 

Declaration:

FUNCTION pmPowerFail : INT;
VAR_INPUT
  bat : BOOL;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  ext_pwr : BOOL;
END_VAR;
 
gsmPower(power:=ON);
gprsOpen();
DebugFmt(message:="pmPowerFail=\1",v1:=pmPowerFail(bat:=TRUE));
 
BEGIN
  ...
  IF boardSupplyType() = 1 AND ext_pwr THEN
     ext_pwr := FALSE;
    pmSetSpeed(speed:=2);
  ELSIF boardSupplyType() = 2 AND NOT ext_pwr THEN
     ext_pwr := TRUE;
    pmSetSpeed(speed:=4);
  END_IF;
  ...
END;
 
END_PROGRAM;