Atif Posted November 9, 2008 Report Share Posted November 9, 2008 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? Quote Link to comment
Dan DeFriese Posted November 9, 2008 Report Share Posted November 9, 2008 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. Quote Link to comment
Atif Posted November 9, 2008 Author Report Share Posted November 9, 2008 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. Quote Link to comment
Dan DeFriese Posted November 11, 2008 Report Share Posted November 11, 2008 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. Quote Link to comment
Atif Posted November 12, 2008 Author Report Share Posted November 12, 2008 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 Quote Link to comment
Dan DeFriese Posted November 12, 2008 Report Share Posted November 12, 2008 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 ). Have you peaked at the NI example code yet? Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.