Hi,
I am used to functions returning only one data type, depending on how the function itself is declared (for example FUNCTION fName : INT, which returns an INT).
However, I read the follwoing at Beckhoff's webpage in their chapter about functions
I am familiar with this in Function Blocks where you declare your output variables for example inside a VAR_OUTPUT (...) END_VAR, but I am hoping that someone could show me an example of additional outputs in a Function?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2017-10-19
Originally created by: scott_cunningham
Define the outputs the same way as a function block. You can keep the traditional single output and and the second and third and fourth outputs as var outputs or you can delete the traditional output type and put all outputs as var outs.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2017-11-01
Originally created by: scott_cunningham
Looks like it's a limitation with the version you are running. In version 3, it works. A crude workaround would be to create your function as a program instead and define any local variables as VAR_TEMP so they reset at every call.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The link refers to Version 3 Twincat, Here it works, however in 2.3 it is not working, you should have 1 output var returned by a function, however it is still possible to change other outputs within a function.
It all depends on the type of machine and software.
and yes you are correct, please use FB for this.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I am used to functions returning only one data type, depending on how the function itself is declared (for example FUNCTION fName : INT, which returns an INT).
However, I read the follwoing at Beckhoff's webpage in their chapter about functions
[1]
I am familiar with this in Function Blocks where you declare your output variables for example inside a VAR_OUTPUT (...) END_VAR, but I am hoping that someone could show me an example of additional outputs in a Function?
Related
Talk.ru: 1
Originally created by: scott_cunningham
Define the outputs the same way as a function block. You can keep the traditional single output and and the second and third and fourth outputs as var outputs or you can delete the traditional output type and put all outputs as var outs.
Trying to add VAR_OUTPUT in a function results in compiler error 3820: " 'VAR_OUTPUT' and 'VAR_IN_OUT' not allowed in functions"
The code I tried looked as follow
Declaration:
Originally created by: scott_cunningham
Looks like it's a limitation with the version you are running. In version 3, it works. A crude workaround would be to create your function as a program instead and define any local variables as VAR_TEMP so they reset at every call.
The link refers to Version 3 Twincat, Here it works, however in 2.3 it is not working, you should have 1 output var returned by a function, however it is still possible to change other outputs within a function.
It all depends on the type of machine and software.
and yes you are correct, please use FB for this.