User Defined Function POU - Basics
Hi,
Apologies if this has been covered elsewhere, but could somebody please advise how to write to the output of a user defined function?
I have created a function with signature (output type) of WORD.
When I create the variables for the function, I can only create Input or Local.
Inside of my function definition, how do I address/write to the output WORD?
Thanks
Comments
You don't need to create a new variable for the Output value, you can just assign the value to the name of function, like this:
I can't find this mentioned anywhere in the PLCnext Engineer Help system, so there's no need to apologise for the question.
@j6a: If the event you need outputs other than just the one returned by a calling a Function, you can use a Function Block.
With the Function block, you can define "local" variables within the block. You can assign them as Input, Output, or In-Out variables.
Then, you can drop the function block into your "main" code...you will have the In, Out, In-Out variables you can use.
SFW