02-13-2006 11:15 AM
@Sharonoff wrote:
Just repeat the code you need to
execute in a loop as many times as you want
...
11-16-2011 11:56 AM
Here is a very inelegant solution if you have access to a DAQ card:
Create a time source with the DAQmx Create Timing Source (Frequency).vi
Set the Frequency to 10 kHz
Use this time source as the source for a timed loop, make sure you set the period to 1 tick (as the default is 1000 ticks)
Leave the loop empty except for an error line going into and out of the loop, and use the error line to control the sequence of execution
Program the Timed loop to act like a For loop (connect the stop terminal of the loop to the (index +1) equals? (loop count constant/control)
Your delay will be .1 ms for each iteration of the Timed loop.
Setting the Frequency too high will eat up more processor and may interfere with the function of your VI, if timing is important... but if timing were really crucial, you shouldn't be using this method anyway.
I was able to run this without completely eating up my entire CPU (about 30% of a 2.14 GHz Dual Core), so it did not interfere with the function or timing of the VI.
Generally when I program my .VIs, they do not even use 1% of the CPU, so it's almost viable to use this as a method... However I would really recommend you avoid it unless absolutely necessary, as it is not very precise, and eats
up a lot of processor doing absolutely nothing but waiting... but if you have the available resources and you can't see any other way, there it is.