declaration of subroutines/functions currently not possible in ST algorithms? [message #1761169] |
Mon, 08 May 2017 10:07  |
Eclipse User |
|
|
|
Hi.
I am attempting to create some BFBs using ST algorithms.
From the literature I found on ST, it should be possible to declare subroutines (see code snipped below). However, the IDE gives me the message, no viable alternative at input 'FUNCTION'.
Is it currently not possible to declare subroutines in BFBs? If not, is there a workaround?
Is it possible to call an algorithm from within another algorithm? If so, a workaround could be to declare internal variables of the function block that are designated as the subroutine-algorithm's inputs and outputs.
FUNCTION REAL_TO_CEILEDINT: INT
VAR_INPUT
X : REAL;
END_VAR
VAR
tmp : REAL;
END_VAR
tmp := REAL_TO_INT(X);
IF tmp < X THEN
REAL_TO_CEILEDINT := tmp + 1;
ELSE
REAL_TO_CEILEDINT := tmp;
END_IF
END_FUNCTION
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.08247 seconds