02-14-2016 03:30 PM
Hello,
I would like to add the availability of how many iterations the vi runs, which will allow the user to increment values of voltage (automatically) output by the myDAQ. When I change the while loop to a for a loop the timing of the vi is compromised. Is there a way to keep the same functionality as the vi below will show using a for loop?
Cheers.
02-14-2016 04:14 PM - edited 02-14-2016 04:21 PM
Seral1994 wrote: When I change the while loop to a for a loop the timing of the vi is compromised.
Then you did something wrong. Simply changing the While loop into a FOR loop should have no affect on the loop rate.
I think I typed too soon. I think this is what you are after. The While loop will iterate until the time elapsed or you press the stop button. The output of the DAQ only updates after the time has elapsed. This setup also allows to abort the FOR loop if you need to.
Of course, you should have some kind of wait inside of the While loop otherwise this will use 100% CPU. Alternatively, you could use an Event Structure instead of the While loop.