Jump to content

Rising edge on a StateMachine UDFB input

Recommended Posts


I'm building a reusable state machine using an UDFB.

I want to detect a rising edge when the statemachine should run to transition from the idle state to the next state.

I create the input tags but in the UDFB i cannot use the tag when using Positive and Negative transition contact. I can select it if I use the Direct or Inverted Contact.

What is the reason for this and how do you propose i do it otherwise?

Attached is a very minimal example.


Link to comment
Share on other sites

hi linnemann

I think that this happens because also the "function in" variables are consider as "local" so are inizialized at every loop of the program...so the -|P|- will be as a normal -| |-  .

if you want/need just a "one shot" command you have to reset the used variable at the end of what you need to do.

consider that a single variable is passed by value...so you have also use a "function out" to reset it...otherwise array and struct are passed as reference...so what you do with the relative "function in" variable will have a direct effect to the global variables.

hope that is clear but mostly that is right.

Link to comment
Share on other sites

Thank you for the link.

It does not solve the rising edge ,but it has workarounds.

I've added the rising edge in a struct to be a feature request as there should be no limitations as it is passed as reference when input is a Struct, Array or buffer.


Link to comment
Share on other sites

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.

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...