LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

timing control

Hello,
I need to acquire data from a powermeter every 2 milliseconds,how can i create a simple loop that can control the time and start the measurement?
Thanks in advance.
0 Kudos
Message 1 of 9
(3,919 Views)

Hi Michael,

One easy way to do is to use a while loop. Use a toggle switch to control the stopping/starting of the loop. Outside the loop, set up your tag information or any parameters that are required to open an connection to your device. Wire this into the loop to a "read device" VI for reading your device. Within the loop, you also need a time delay, you can probably use the "Wait Until Next ms Multiple" VI from labview. Instead of setting a constant delay, wire a "Numerical Control" to this delay (value is measured in ms already), then you can change the measurement time even during measurement.

tak

0 Kudos
Message 2 of 9
(3,910 Views)
Hi,thanks for the reply.Can you maybe post an example if it's possible?
Thanks
0 Kudos
Message 3 of 9
(3,907 Views)
Hi Michael,
 
Here is a simple example for reading values from a field point RTD module and a DO module (since that's what I used). You may need to modify it somehow to suit your application. The start and stop switch is not really useful in this case because you can simply set your loop to continuously run mode and it will never stop. If you want to use this switch to start and stop your measurement, you may consider adding another while loop outside of this loop. Hope this will help you get started.
 
tak
0 Kudos
Message 4 of 9
(3,899 Views)
thanks a lot,i'll give it a try tomorrow!
0 Kudos
Message 5 of 9
(3,896 Views)
Something worth noting is that if your application is very time critical, you may wish to use a Timed While Loop, which is not dissimilar to a regular while loop, except it is timed more precisely than a regular while loop with a user specified delay.

In LV8 there's quite a few functions in the "Timed Events" section on your palette.

If your application is indeed time critical this would be the way to go.  Timed loops are more accurately timed than a delay in a normal loop, and there is the ability to syncronize iterations with other loops, should you need it.
0 Kudos
Message 6 of 9
(3,892 Views)
I've tried to use while loops and timed loops,but my applications doesn't work properly.
I need to acquire data very fast, (every 0,5 to 2 ms).I'm using a Daq card 6024. Other suggestions on how to do this?
Another related question:
i create a virtual channell and i start it outside a while loop where i've put the Daqmx read, the when the iteration stops i stop and clear the vi. it's the correct way to operate?
Thanks

0 Kudos
Message 7 of 9
(3,870 Views)

Hi Michael,

If you want to acquire data so fast, maybe this is not a very good method. Maybe what you can do is to set up some sort of buffer, and acquire a data every 2 ms or so and store all these into a buffer of some sort. Once it is full, you then try to read off the data and store them else where. However, I don't have too much experience on that.

tak

0 Kudos
Message 8 of 9
(3,850 Views)
Doing just continuous acquisition at these rates shouldn't be that hard. Have you looked at the shipping examples for DAQmx? Cont Acq&Grpah Voltage-Int Clk is a good one to start with. The internal clock will provide a very reliable sample rate and .5 to 2 msec is not that fast. The 6024 can acquire 200Ksamples/sec. What may effect overall sampling though is what else you might be doing in the loop.
0 Kudos
Message 9 of 9
(3,845 Views)