Jump to content

General UDFB questions


steliosliv

Recommended Posts

Hello everyone,

Recently, I have started using the Unilogic program. I was familiar with TIA portal from siemens and I have some questions regarding the functions in Unilogic.

1) Is it possible to refer to the input or output of a function? For example, in TIA portal if the function is call calc the input is x and the output is y, you can use the variables directly by typing calc.x and calc.y.

2) Is there is a way to insert a contact or a series of contacts into the input of a function (as seen in the picture attached) without the need of an auxiliary coil?

3) If I call the same function multiple times is there a way to name each function call differently? For example in siemens if you called the function calc twice you could name the functions calc1 and calc2 and easily access the inputs outputs by typing calc1.input/output/local variable or calc2.input/output/local variable

4) Since you cannot insert a timer locally in a function you have to assign it globally. Let's say I want to call twice a function which uses a timer.  Can I somehow use the same function in order to make two calls or I have to make two functions which are exactly the same except the timer. This is not a problem when you use the function a few times, but it is a waste of time when you have tens of calls to the same function.

5) I have read in the help file that there is a limit to the inputs/outputs of a function and that limit is 10. For the inputs this in not an obstacle since you can insert a struct as input containing as many variables as you desire. How can you overcome this problem with the outputs since you cannot assign a struct as an output in a function?

 

If something needs further explaining please let me know.

Thank you

2.PNG

Link to comment
Share on other sites

hi steliosliv,

i will try to anser at your questions...i hope that i will not write wrong informations:

1) no...the UNILOGIC don't manage the UDFB as an object...so doesn't expose the Inputs and Outputs as attributes.

2) no...the Input always needs a variable...could be local or global but doesn't accept the direct "power flow" of contacts.

3) no...by what is wrote at point 1...but obviously you can use the same function many times.

4) you are right...no local timer is managed by the UDFB...you have to use a different strategy...use the "millis counter"...in other thread, in this forum, I already post an example how to use millis.

5) Structs and Arrays are always passed by reference...so also if assigned as Input variable (left side of the UDFB) you can modify the value of their members inside the UDFB...so an Output of this Struct or Array is not needed.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...