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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

loop frequency

Solved!
Go to solution

 

Hello

 

I have a doubt. I'm using NI daq assistant to aquire a signal from a device. I'm reading 6 channels simultaneously and continuously, at 1kHz.

However, I checked that the loop where the whole process runs makes 10 iterations in 1second , which give me 6 channels x 1 sample/channel, 60 samples in a second. (or 10 samples/channel)

 

This is kind of far from the 1kHz that I expected. The loop has no delays, nothing related with time... Am I confusing everything, missing something, or my computer cannot process teh cycle faster that 10 Hz?

 

Please Help...

Thanks in advance

0 Kudos
Message 1 of 7
(4,149 Views)

I suppose you use the DAQmx Read vi to read samples.

What did you specify at the connector “number of samples per channel”?

With a scan rate of 1kHz and a delay time of 0.1s I would say 100 Smiley Tongue  Is this correct?

 

Are you sure you read all available data from the buffer?

I mean, it’s pointless reading every sample one by one.

So I don’t see where your “1 sample/channel” come from Smiley Surprised

 

Can you post the vi you are using?

It will help us a lot in finding the error.

 

Regards

Message Edited by Alain S on 07-03-2009 07:04 PM
0 Kudos
Message 2 of 7
(4,143 Views)

You also might want to take a look at the task set up in MAX.

 

If you are set for N Samples, then you will only get the number of samples specified when you read.

If you are set for Continuous Samples, the system will continually put data into the buffer.

 

We generally use Continuous Samples in our systems and create the number of samples (which becomes your buffer size) for larger than the number of samples that we expect to read. For example we have a system that samples at 1kHz and we read all of the available data 10 times a second. We still set our number of samples to 200. We have plenty of time to get through our loop and read more samples.

 

Those are just some thoughts on setting up tasks for DAQmx.

 

    Rob 

0 Kudos
Message 3 of 7
(4,126 Views)

Hello

 

First, I would like to thank for the replies.

 

At DAQ assistant I set continuous samples and a sample frequency of 1 kHz. I want to have a program that allows me to give information in real time and allows me to make the average and standard deviation each 2 seconds. I expected to have 2000 samples to average (if the iteration time of the loop was 0.001 s (or 1/1kHz)), but I only have 20 samples in 2 seconds.

 

Thus, how can I improve the time spent at each iteration?

Hope my question is clear and thanks again for the help

 

Best regards

 

0 Kudos
Message 4 of 7
(4,101 Views)
Solution
Accepted by topic author fadetoblack

It's not because you have a sampling frequency of 1kHz that your iteration loop in LabView needs to run at 0.001s Smiley Surprised

The buffer on the DAQ will capture x samples and with one "Read DAQmx" instruction you read the x samples at once.

 

If you setup your DAQmx task to read 2000 samples "Samples to Read" in "Configuration" tab or wire 2000 to connector "number of samples per channel" of the "DAQmx Read" vi, that vi will wait for 2 seconds.

 

You can then average those 2000 readings with the "Mean" vi.

 

Hope this helped 🙂

0 Kudos
Message 5 of 7
(4,095 Views)

Hmmm...ok! Thanks Alain S. It sure help!!

 

Unfortunately I don't have access to the DAQ board in the next 2 or 3 days, but when I try what you said I'll let you know

 

Thanks for the replies and for the help

0 Kudos
Message 6 of 7
(4,085 Views)

Hello Alain S

 

You were absolutely right!

I changed the number of samples and the number of iterations per second icreased considerably, allowing me to do want I wanted.

 

Thanks for the help

0 Kudos
Message 7 of 7
(4,062 Views)