06-29-2017 08:53 PM
Hello Everyone!
I am new to low level programming labview and I’m having some issues with my NI-USB-6212 and labview. I have two boards NI-USB-6212 and I’m using them to read two analog channels. My effective sample rate is 100 Hz (each point is the average of 4000 points (samples per channel) sampled at 400 kHz (sampling rate)). To ensure that my effective sample rate is 100Hz I’m using a timed loop (1kHz Clock, 10 Period).
My problem is that I want to lower my averaging points (samples per channel), because sometimes my loop is finishing late, so by reducing my number of average points I will give enough time for the readings inside my loop to finish before 10ms. The problem is that I can’t reduce my averaging, because I get the error -200279 “The application is not able to keep up with the hardware acquisition”. I think the problem is that those boards don’t have retriggerable analog acquisition, therefore I’m using the available counters as a workaround, and because of that I’m using my Sample Mode as Continuous Samples.
Is there a way to lower my averaging,for example to 3000, without changing my sampling rate?
06-30-2017 06:09 AM
No need for a timed loop. Just use Continuous Acquisition and always read your 4000 samples. This will effectively set your loop rate to 1ms just from waiting at the DAQmx Read.
And why are you using 2 boards for 2 channels? Why not have both channels on the same DAQ and then you just need one task.
I will have to look at your code later to see if we can help speed up your loop (currently on mobile).
06-30-2017 08:56 AM
Now that I have had a quick look at your code...
Yes, you should be using 1 DAQ board and have all of your IO on it. Your Analog Input should definitely be in a single task. I would also eliminate the wires to the # Samples on the DAQmx Timing VI. That just limits your buffer size. But you do want to set the number of samples to read in the DAQmx Read to however many samples you actually want to average.
06-30-2017 01:00 PM
Hi Crossrulz,
My loop rate right now is 10ms. I'm using 2 boards to avoid crosstalk between the channels. When I tried using only one board it didn't work very well because my readings need to be very precise. Therefore, I still need two tasks for my analog inputs.
Do you know any other way that I can reduce the number of samples to read still using my two tasks?
Thanks in advance!
06-30-2017 02:34 PM
Hey joaovitor...
To be honest, I don't see useful the time loop.
If your labview version is updated, like (2015,2016,2017) You should be able to do a synchronization of this task just by (view attached picture)
I do agree with the suggestions giving by the two gentleman before me.