verCheckUpgrade (Functionblock)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

1.00 / 1.00.00


This function block is used to inform the VPL program that a background update is in progress and that a download of either a new firmware or a new application has completed.

With this functionality, the application can decide not to PowerDown() during an upgrade and it can also decide when the "switch" to the new application or firmware should happen. When a background update is available, the actual "upgrade" will happen when the device starts up next time - for example after a boardReset().

 

Input:                

None.

 

Output:

firmware : BOOL

True if a new firmware is available as a background update.

 

application : BOOL

True if a new application is available as a background update.

 

transfer : BOOL

True if the application or firmware is being transferred in the background.

 

 

Declaration:

FUNCTION_BLOCK verCheckUpgrade;
VAR_OUTPUT
  firmware   : BOOL; // New firmware is available
  application : BOOL; // New application is available
  transfer   : BOOL; // New application or firmware being transferred in the background
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
VAR
  UpgChk : verCheckUpgrade;
END_VAR;
 
PROGRAM test;
 
  // Get Application name and version
  DebugFmt(message := "Application: " + verGetAppName() + " \1.\2",
           v1 := verGetAppVersion() / 100,
           v2 := verGetAppVersion() MOD 100);
  ...
 
BEGIN
  UpgChk();
  ...
  // is Application ready to reset?
  IF ... THEN
    // is background upgrade ready?
    IF UpgChk.application OR UpgChk.firmware THEN
        // Reset RTCU device. The firmware or application is updated automatically
        boardReset();
    END_IF;
  END_IF;
  ...
END;
END_PROGRAM;