Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Voltage and temperature measurements with 6221 and USB TC1

Solved!
Go to solution

Hi

 

I'm making a program to make voltage measurements with a PCI 6221 37 pin board and temperature measurements with a USB TC01. I use Labview 2009 SP1, and basically my program reads the data, shows it in a chart, and saves it to a file, all within a While loop which runs until I stop the program.

 

The program is enclosed. I wasn't too sure about timing with the 2 devices. The TC01 runs at a fixed rate, so I set DAQmx read to 1 Chan 1 Samp. On the 6221, I set a sample rate and chose "continuous samples", set DAQmx read to 1Chan Nsamp, and set "samples to read" to "-1". And it seems to work fine, but just setting "samples to read" to -1 seems too easy. Am I missing something. What determines the speed at which the loop runs ?

 

Thanks 

0 Kudos
Message 1 of 5
(3,426 Views)

The speed of the loop is determined by the time it takes all the code inside the loop to execute.  The Write to File VIs may be the slowest elements.  As the file grows the OS may need to re-allocate file space which could take some time.

 

The temperature measurement device may run at a fixed rate, but does the AI read wait for a new result or just repeat the previous result if you try to read again before new data is available?  Does it make sense to write one sample to the file at a time? Perhaps accumulating data for some period of time and then writing a "chunk" of data might be more effective.

 

There are a variety of ways to set the timing on a loop.  What do you want the timing to be?

 

Lynn

0 Kudos
Message 2 of 5
(3,421 Views)

I'll be measuring low frequency signals (about 0.5 Hz). My only constraint for timing is that the graph should be updated fairly often, so that the user can observe the measurements in almost real time. So 1 loop could take say between 100 ms and 1s.

0 Kudos
Message 3 of 5
(3,419 Views)
Solution
Accepted by scalpas

Try putting a Wait (ms) function in the loop.  Set the wait value to 100 to 1000 ms.  If everything else happens faster than that, then the wait will determine the loop rate.

 

Lynn

0 Kudos
Message 4 of 5
(3,391 Views)

Yes that works. Thanks !

0 Kudos
Message 5 of 5
(3,386 Views)