FB_HVACPersistent_String

FB_HVACPersistent_String 1:

VAR_INPUT

bSetDefault        : BOOL;
dwAdrString        : DWORD;
udiSizeOfString    : UDINT;
dwAdrString_Default: DWORD;                        

bSetDefault: if the variable is TRUE, the default values of the declared variable dwAdrString_Default are adopted and copied to the dwAdrString address.

dwAdrString: address of the declared variable to be persistently saved.

udiSizeOfString: size of the declared variable in bytes. (1 byte per character (size at declaration) + 1 byte for null termination)

dwAdrString_Default: address from the string with the default value.

VAR_OUTPUT

bInvalidParameter     : BOOL;

bInvalidParameter: TRUE if udiSizeOfString > g_udiMaxSizeOfString OR dwAdrString = 0 OR dwAdrString_Default = 0

VAR_GLOBAL CONSTANT

Name                : Type
g_udiMaxSizeOfString: UDINT := 255; (* size in number of characters *)                          

g_udiMaxSizeOfString: any size of the string can be specified via this globally declared constant. Preset value is 255.

Sample:

VAR
    fbBackupString     : FB_HVACPersistent_STRING;
    bSetDefault        : BOOL;                          (* default flag *)
    sVar               : STRING(55);                    (* normal value *)
    sVar_Default       : STRING(55) := 'Store the default String Value';    (* default value *)
    bInvalidParameter  : BOOL;
END_VAR                     

FB_HVACPersistent_String 2: