The syntax descriptions refer to a POU with exactly one parameter, to which an argument is passed. As a result, the data type of the argument specifies the generic data type of the input variable. For example, arguments of the type BYTE, WORD, DWORD, LWORD can be passed to a type ANY_BIT input variable.
Syntax of function call:
<name of function> (<argument>)
Syntax of function block call
<name of function block instance> (<name of input variable> := <argument>)
Syntax of method call
<name of function block instance> . <name of method> (<name of input variable> := <argument>)
|
<argument> |
Transfer variable |
Example
PROGRAM PLC_PRG
VAR
byValue : BYTE := 16#AB;
iValue : INT := -1234;
xResultByte : BOOL;
xResultInt : BOOL;
fbComputeAnyByte : FB_ComputeAny;
fbComputeAnyInt : FB_ComputeAny;
fbComputeM1 : FB_ComputeMethod;
fbComputeM2 : FB_ComputeMethod;
byN : BYTE := 1;
wBitField1 : WORD := 16#FFFF;
wBitField2 : WORD := 16#0001;
xInit : BOOL;
xResult : BOOL;
END_VAR
//Implementation
xResultByte := funComputeAny(byValue);
xResultInt := funComputeAny(iValue);
xResult := funGenericCompare(wBitField1, wBitField2);
fbComputeAnyByte(anyInput1 := byValue);
fbComputeAnyInt(anyInput1 := iValue);
fbComputeM1.methComputeAnny(anyInput1 := byValue);
fbComputeM2.methComputeAnny(anyInput1 := iValue);