how to return a value in a function (type: ST)
Hello,
how to set a return value for a function (not a function block) Code-Type: ST.
Signatur:
[code type="markup"]
Returntype: LREAL
[/code]
Code:
[code type="markup"]
dwTemp := SHL(TO_DWORD(wHigh), 16) + wLow;
RETURN TO_LREAL(dwTemp);
[/code]
is not working. I get an Error, want a ";" after RETURN statement
I searched in the internet for a long time, but have found nothing.
how to set a return value for a function (not a function block) Code-Type: ST.
Signatur:
[code type="markup"]
Returntype: LREAL
[/code]
Code:
[code type="markup"]
dwTemp := SHL(TO_DWORD(wHigh), 16) + wLow;
RETURN TO_LREAL(dwTemp);
[/code]
is not working. I get an Error, want a ";" after RETURN statement
I searched in the internet for a long time, but have found nothing.
Comments
In ST, the RETURN statement simply returns to the calling POU at that point, and in ST this statement doesn't take any parameters.
To return a value from a function in ST, simply assign a value to the name of the function. So, if your function is called MyFunc, the statement would be:
I hope this helps.