12-09-2011 07:59 AM
In a do while loop any suggestions on how restart the timer when the user hits the button? I trued a Case Statement but it only executes it once and the time picks up where it left off.
Solved! Go to Solution.
12-09-2011 08:21 AM
You're going to need a bit more code. You'll need a shift register to keep track of the last start time so you can compare the current time to this time, rather than the original start time. Thus, your tunnel needs to be a shift register. When you reset you pass out the current time to the shift register. Otherwise you pass out the current time.
Or, you could just use the Elapsed Time Express VI. It has a reset input.
12-09-2011 08:28 AM
Thanks..I had saw the express vi in the solution to someone elses question. I'll give the shift registers a try and let you know.
12-09-2011 08:32 AM - edited 12-09-2011 08:35 AM
You'll need your timer reference inside the loop. Attached are two examples of non-Express ways to do this.
<< Edit >> Smerc answered while I was copying and pasting my examples above, so I didn't see the response. About the Express VI, you can open the pront panel of it and convert it to a normal VI, and parse out what you need.
12-09-2011 08:40 AM
You both had the same solution. Can I accept 2 solutions?? I'd like you both to get credit.
12-09-2011 08:47 AM
@MarkDavid wrote:
You both had the same solution. Can I accept 2 solutions?? I'd like you both to get credit.
Just give Kudos!
12-09-2011 08:51 AM
Hey Broken Arrow..
Two things.
In between readings..ie between 1 and 2 sec say...i get a bunch of numbers that don't make sense.
1...3.406e+9...2....3.406e+9...3...3.406e+3 etc
2nd.. not familiar with the "i" symbol connected to the "or" function. Where on the pallet is that located?
12-09-2011 09:02 AM
MarkDavid wrote:
[...]
In between readings..ie between 1 and 2 sec say...i get a bunch of numbers that don't make sense.
1...3.406e+9...2....3.406e+9...3...3.406e+3 etc
Right click the indicator > Properties > Display Format... change it how you like, example shown....
MarkDavid wrote:
[...]
2nd.. not familiar with the "i" symbol connected to the "or" function. Where on the pallet is that located?
That's the very powerful synch tool called "First Call". The first time you run a VI, the output will be high. Use it to initialize something (as done here) or to fire code only once when the program starts.
12-09-2011 09:09 AM
I'm surprised Broken Arrow did not point you to the elapsed time GERM in our community nugget. It extends the timer functions and offers a robust method to reuse portions of your main vi's block diagram and provides consistant look and feel between your user interfaces.
@Richard- never pass up an opprotunity to promote your nuggets! it helps encourage nugget development within the community
12-09-2011 10:15 AM
I'm getting bizzar numbers between counts. It goes 1...then 3.406e9 then .2... then 3.406e9.. I keep getting 3.406e9 between increments.
When it should be 1...2...3...4...
Any ideas?