Jump to content

How to extract elapsed time from Elapsed Timer before resetting programmatically


Recommended Posts

Here's a newbie problem. I'm trying to extract how much time is spent inside an event structure activated by a switch control. I'm using a Elapsed Timer function. I reset the function when leaving the event structure but before leaving reseting I need the elapsed time. It seems that the reset has priority so my elapsed time always gets initialized to 0 before sending my info. Any suggestions?

Link to comment

QUOTE (Atif @ Nov 7 2008, 11:47 PM)

Here's a newbie problem. I'm trying to extract how much time is spent inside an event structure activated by a switch control. I'm using a Elapsed Timer function. I reset the function when leaving the event structure but before leaving reseting I need the elapsed time. It seems that the reset has priority so my elapsed time always gets initialized to 0 before sending my info. Any suggestions?

I'm not sure what your trying to measure? Can you post an example? Its likely that the function in question does, in fact, execute faster than 1 millisecond. In which case you'll need to use the VI Profiler toolkit or other means to perform the benchmark.

Link to comment

If you notice I'm trying to grab "TimeElapsedInEvent" and pass it to a local var outside the event struct. But when I reset the Elapsed Time2 as I'm leaving the event struct, it initializes the Elapsed Time output back to 0. I would like to grab the Elapsed Time before it gets initialized.

Link to comment

Please don't be offended... but your code is a mess. (Local/Global variables tend to do that!). To be honest, if I didn't recognize the front panel as being the Car Wash CLD example I would have had no clue what you trying to do. Also, using the event structure this way is ill advised. The event code should be short and sweet. Placing a while loop in there sort of defeats its purpose.

Of course, I realize that your a new user and I'm here to help. I've attached a simplified version of the VI. I used locals (and event structure) only to demonstrate a possible "working" solution... but ultimately this is not a very good approach.

Link to comment

QUOTE (Dan DeFriese @ Nov 9 2008, 08:44 PM)

Please don't be offended... but your code is a mess. (Local/Global variables tend to do that!). To be honest, if I didn't recognize the front panel as being the Car Wash CLD example I would have had no clue what you trying to do. Also, using the event structure this way is ill advised. The event code should be short and sweet. Placing a while loop in there sort of defeats its purpose.

Of course, I realize that your a new user and I'm here to help. I've attached a simplified version of the VI. I used locals (and event structure) only to demonstrate a possible "working" solution... but ultimately this is not a very good approach.

No offense taken at all. I know its ugly...I would've treated someone the same if it was in C/C++. I have a lot to learn about shift registers. Thanks for your help though

Link to comment

QUOTE (Atif @ Nov 10 2008, 08:41 PM)

No offense taken at all. I know its ugly...I would've treated someone the same if it was in C/C++. I have a lot to learn about shift registers. Thanks for your help though

Maybe I should show you some of my C/C++ code (or VBA which I just started playing with a few weeks ago :o ).

Have you peaked at the NI example code yet?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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

Important Information

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