Calling a function
A function calculates a result according to the current value of its inputs. Unlike a function block, a function has no internal data and is not linked to declared instances. A function has only one output: the result of the function. A function can be:
- Astandard function (SHL, SIN...).
- A function written in "C" language and embedded on the target.
ST Language
To call a function block in ST, you have to enter its name, followed by the input parameters written between parenthesis and separated by comas. The function call may be inserted into any complex expression. a function call can be used as an input parameter of another function. The following example demonstrates a call to ODD and SEL functions:
|
(* The following statement converts any odd integer value into the nearest even integer: *) iEvenVal := SEL ( ODD( iValue ), iValue, iValue+1 ); |
FBD Language and LD Language
To call a function block in FBD or LD languages, you just need to insert the function in the diagram and to connect its inputs and output.
Calling a function |
IEC 61131-3 Automation platform > Programming - Reference guide > Basic Operations > Calling a function |
Created with the Personal Edition of HelpNDoc: Upgrade your help files and your workflow with HelpNDoc's WinHelp HLP to CHM conversion