02-22-2010 12:41 PM - edited 02-22-2010 12:48 PM
Solved! Go to Solution.
02-22-2010 01:06 PM
02-22-2010 01:12 PM
02-22-2010 02:25 PM
02-22-2010 02:30 PM
02-22-2010 09:15 PM
02-22-2010 09:39 PM
That's because the Wait (ms) Timer tells the code to wait that long before continuing execution.
What you want to use is the Elapsed Time Express VI. It stores the time in a shift register and outputs a True only after the specified amount of time has passed, it doensn't tell anyting to Wait. Make sure you read the help on it. It has multiple inputs such as Reset, and Auto-Reset you'll want to pay attention to if this is a function that you will need to handled a series of elapsed time measurements.
02-23-2010 12:04 AM
Yes. This is exactly what I was looking for. But, there is a issue. In practise, i will not be looking at 10 sec delay but a very small number like 50 ms. With this approach, when I set a value of 50ms, my program stops after close to 90-93ms (After 50ms, there is a AND gate, when true stops the program; Refer to the attachement).
There are multiple reasons which I see. First is obvious I am using a windows xp with lot of other stuff going on simutaneously. Also. elapsed time vi is an "express vi". Do you think this can be one of the primary reason for such a delay? Finally, I intend to use this program on RT based machine.
Do you see it working exactly as expected on those machines or do I have to modify my code? Please guide me.
Also, how to I mark your post as answer and other good things.
Thanks
02-23-2010 12:18 AM
02-23-2010 10:13 AM
Looking at your code, it is clear that the delay code and the DAQ code are not in parallel. Both the delay code and the DAQ code are in the same loop. The DAQ code can't continue to the next iteration when the delay code is still running, since they are constrained to the same loop. If you want two sections of code to run in parallel, you need to separate the two sections into two loops that are not in a sequence structure (if possible use state machine instead). Then, you can use a queue to pass variable between the two loop.
Go to New... and select the producer/consumer template. Study it a little, and you will see what I am talking about.
Yik