cancel
Showing results for 
Search instead for 
Did you mean: 

timed while loop

FredFred
Member

timed while loop

Hello to all!
 
I have a question. I am trying to visibly monitor my while loop using elapsed time from start of loop to stop.
 
I inserted a elapsed time vi into the loop but my issue is that once the while loop is stop, the timer is still functional.
I just want to stop the timer, so when i go back to the while loop i will begin at zero.
 
I tried to reset the timer with no end result,
 
Thanx 
 
16 REPLIES 16
Dennis_Knutson
Knight of NI

Re: timed while loop

It sounds like you have the while loop inside maybe a case statement and everything is inside another while loop. In the while loop with the elapsed time function, wire a Equal to 0? function to the iteration terminal of the while loop and the output of it to the reset terminal of the elapsed time function. That way, the elapsed time function will reset on only the first iteration of the inner while loop.
FredFred
Member

Re: timed while loop

I kinda don't understand your answer.

You are correct that I have a the elapsed time while loop inside of a case inside of a while.

what do i wire the equal to 0 input to?

ouptut (boolean) goes to iteration terminal of while loop, in my case stop if true. 

but the input is wired to what?

FredFred
Member

Re: timed while loop

Message contains an attachment
I want the elapsed time to reset each time this loop is entered
Joe_H
Active Participant

Re: timed while loop

Message contains an image Message contains an attachment
from the iteration terminal (i) wire that to a =0 function and then wire the output from the =0 function to the reset terminal of the elapsed time vi. 
 
 
 

Message Edited by jhoskins on 10-10-2005 06:42 PM




Joe.
"NOTHING IS EVER EASY"
p3
Member
Member

Re: timed while loop

I am trying to read in from a DAQmx card and periodically write to a file.  i tried encasing the write vi in a timed loop, however this seems to cause a delay to my entire program  I was wondering if there is some way to isolate the timed loop from the while loop.  Thanks
Rudi_N
Active Participant

Re: timed while loop

p3:

Trying to read from a DAQmx card within a timed while loop allows you to do a continuous software timed acquisition because you can control the rate at which you are acquiring. However, I am not quite sure about the reason behind isolating the timed loop from the while loop. Would the readings from the DAQmx card still be inside the while loop? What
would be the effect of having the timed loop outside of the while loop? Are you trying to do sequential tasks? Please let me know so that we can assist you further..

Thanks,

Rudi N.
Applications Engineer
p3
Member
Member

Re: timed while loop

Message contains an attachment
This is the VI i am working on.  It is rather straight forward.  I just need to input some information from 2 thermocouples and 1 pressure transducer and need to be able to set the record rate since the tests will span several weeks.  Thanks
Rudi_N
Active Participant

Re: timed while loop

p3:

Thank you very for posting the example you are currently working on. Instead of using a timed loop, you should consider using a case structure with "Elapsed Time" Express VI as the case selector. This will allow you to write data to the file in a periodic manner (controlled by the elapsed time Express VI). I hope this helps !!!

Regards,

Rudi N.
Applications Engineer
p3
Member
Member

Re: timed while loop

excellent! I was able to get the output timed to my satisfaction thanks!