Calling Functions
Functions (as defined in the relevant section) are invoked by placing the function name in the operator field. This invocation takes the following form:LD 1MUX 5, var0, -6.5, 3.14ST vRESNote that the first argument is not contained in the input list, but the accumulator is used as the first argument of the function. Additional arguments (starting with the 2nd), if required, are given in the operand field, separated by commas, in the order of their declaration. For example, operator MUX in the table above takes 5 operands, the first of which is loaded into the accumulator, whereas the remaining 4 arguments are orderly reported after the function name.The following rules apply to function invocation.
- Assignments to VAR_INPUT arguments may be empty, constants, or variables.
- Execution of a function ends upon reaching a RET instruction or the physical end of the function. When this happens, the output variable of the function is copied into the accumulator.
Keyword | Description |
FBInstanceName | Name of the instance to be invoked. |
IO_var | Input or output variable to be written / read. |