Showing results for 
Search instead for 
Did you mean: 

Trying to measure/log voltage and frequency simultaneously with USB-6211

Hi there,


I'm having some trouble creating a VI to do what I want. I'm trying to simultaneously record 5 signals at 1kHz, for roughly 30 seconds.


Three of the signals are simply analog voltages. The other two are encoders (one is 54 pulse/rev, other is 60 pulse/rev).


I can get DAQ assistant to record the voltages for a fixed number of samples.


I can also put the DAQ assistant in a while loop and record frequency continuously though it doesn't record at a regular interval, which is what I need to do.


If I put all measurements in a while loop it slows way down and sometimes doesn't work at all. I'm sure there's a simpler way to do this but I'm a Labview Novice and the help files aren't helping. I've attached one of my crude VIs.

0 Kudos
Message 1 of 12

When I am trying to aquire analog data with encoder data I log the encoder outputs in an analog channel then postprocess the encoder data at a later date.

0 Kudos
Message 2 of 12

Yes, that was what I did in my previous VI. It works I suppose, but I'd like to minimize post processing if possible.

0 Kudos
Message 3 of 12

Here's a much better approach: Synchronize Encoder Counter Input and Analog Input example



0 Kudos
Message 4 of 12

I got that program to work out but it slows way down when I add more inputs. Am I doing something wrong here? I can't add more analog channels because it says the resource is reserved.

0 Kudos
Message 5 of 12

Hi mooktank,


It looks like you're trying to read 1 sample per loop iteration.  At 1 kHz, this isn't too feasible once you start adding more channels.  I recommend using the N Sample versions of DAQmx Read.  Setting N to 100 will mean your loop will iterate about 10 times a second.  Each loop iteration would return a 100-point array per task which you could send to a buffer etc.


All analog input channels must be part of the same task (unlike counters where you use a separate task for each).  If you have multiple Global Virtual Channels defined in MAX (which is what it looks like), you can reference them as a comma separated list in LabVIEW.



Best Regards,

John Passiak
0 Kudos
Message 6 of 12

Thanks for the replies thus far!


I'm starting to get closer. I've got the VI to the point where I can read three analog voltages and one frequency and start logging them to a text file. However, I'm having an error after running the program ~10s and the time column in my file is about 10x too small. When number of samples is 1, my gauge works nicely. When it's 10, it's choppy but okay. At 100, it's useless.


Any ideas?

0 Kudos
Message 7 of 12

Here's my latest iteration. It works okay at 100 Hz. I can take about 30s worth of data from all required channels. 1k is not really possible. Pardon my ignorance but I have no idea how to configure the buffers to run these tasks properly.

0 Kudos
Message 8 of 12

whats the exact error when you increase the rate?


-Ciao 😉

0 Kudos
Message 9 of 12

Actually I get this error even with writing disabled and at 100Hz 1 sample/iteration:


"Error -200279


Possible reason(s):
Attempted to read samples that are no longer available. The requested sample was previously available, but has since been overwritten.

Increasing the buffer size, reading the data more frequently, or specifying a fixed number of samples to read instead of reading all available samples might correct the problem.

Property: RelativeTo
Corresponding Value: Current Read Position
Property: Offset
Corresponding Value: 0

Task Name: Turbine Torque, Load Cell L, Load Cell R"

0 Kudos
Message 10 of 12