|
//-----------------------------------------------------------------------------
// test_lib.vpl
// Application for creating and testing the simple library.
// It includes the files directly and does not use the library include path.
//-----------------------------------------------------------------------------
INCLUDE rtcu.inc
// Uncomment math.inc to add math library support.
//INCLUDE math.inc
INCLUDE simple_lib.inc
INCLUDE example_lib\enc_lib.inc
// Input variables that can be configured via the configuration dialog (These are global)
VAR_INPUT
END_VAR;
// Output variables that can be configured via the configuration dialog (These are global)
VAR_OUTPUT
END_VAR;
// These are the global variables of the program
VAR
END_VAR;
PROGRAM test_lib;
// These are the local variables of the program block
VAR
str:STRING;
END_VAR;
// The next code will only be executed once after the program starts
DebugMsg(message:="Test simple library:");
SimpleLibInit();
IF NOT simple_lib_initialized THEN
DebugMsg(message:="Error: Library was not initialilzed:");
END_IF;
SimpleLibBoardInfo();
// Validate variables
IF MAIN_PASSWORD <> "password" THEN
DebugMsg(message:="MAIN_PASSWORD is wrong");
ELSE
DebugMsg(message:="MAIN_PASSWORD: OK");
END_IF;
IF generated_password <> dintToHex(v:=boardSerialNumber()) THEN
DebugMsg(message:="generated_password is wrong");
ELSE
DebugMsg(message:="generated_password: OK");
END_IF;
IF enc_func(v1:=2, v2:=3) = 5 THEN
DebugMsg(message:="enc_func: OK");
ELSE
DebugMsg(message:="enc_func: ERROR");
END_IF;
BEGIN
// Code from this point until END will be executed repeatedly
END;
END_PROGRAM;
|