Jump to content

Periodic trigger lossless version

Recommended Posts

I was using the OpenG Periodic Trigger in an application and notice that my time base was drifting. After spending some time on it and rewritting to make it a little more readable I made a change to fix what seems to be a time leak to me. The change is made where it gets the new time after a trigger has occurred. If someone would take a look and give me feedback that would be great. Could this be an update to the OpenG Time library?Periodic Trigger.zip

  • Like 2

Share this post

Link to post
Share on other sites

Hello Dan,

your code looks valid and for the (small) test I'v run it's OK.

I don't fully understand what the bug/fix is, could you describe that in more detail?


Share this post

Link to post
Share on other sites

OK, I figured out what the essential difference between the two implementation is.

The original OpenG Periodic trigger resets the phase upon every trigger. Your implementation is maintaining the phase.

I have a little table showing this:


Where I had a Time (ms) of 500 ms and waited 450, 100, 400, 100 and 10 ms. The column Next Trigger is showing the output state of the upper Shift Register which basically contains when the next rollover of the timer will happen.

I think we should add both implementations, making yours the default for new VIs, the old functionality should be maintained via deprecation. So currently already code isn't changing current behaviour.

Here's my proposal:


And it's documentation:


Losing phase has functionality if you alter the 'Time to wait'. However we might need to auto-reset then as well.


Please note that you might get unexpected Triggers with Maintain Phase On:



Share this post

Link to post
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.

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

Important Information

By using this site, you agree to our Terms of Use.