From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

USB-6212: timing issue with retriggerable analog input

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?

 

 

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

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).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 5
(3,270 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 5
(3,264 Views)

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!

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

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.

 

 

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