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.
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.
01-17-2012 10:00 AM - edited 01-17-2012 10:08 AM
Hi all,
I have set up an easy VI for understanding how nidaq-mx works. In the attachment you can find the VI. In particular the sample rate is set to 1Hz and I read 4 samples in 4 loops. So the acquisition should take 4 secs, isn't it? So why does it take just 0.03secs?
Thank you
01-17-2012 10:23 AM
Although your sample rate on your DAQ-MX may be set up to sample at 1 Hz, your loop can run much much faster. I would try adding the wait function into your loop to assure that the loop takes at least 1 second if that is your desire.
Hope this helps.
-Franklin
01-17-2012 10:38 AM
pierluk wrote:I have set up an easy VI for understanding how nidaq-mx works. In the attachment you can find the VI. In particular the sample rate is set to 1Hz and I read 4 samples in 4 loops. So the acquisition should take 4 secs, isn't it? So why does it take just 0.03secs?
It does not! I am currently on a laptop using a simulated device, but the VI takes over 4 seconds to complete. I suspect that you create an error in your initial DAQ setup, causing all IO to instantly error out and complete.
There are quite a few things a bit strange with your VI:
01-17-2012 10:42 AM
@CTSFranklin wrote:
Although your sample rate on your DAQ-MX may be set up to sample at 1 Hz, your loop can run much much faster. I would try adding the wait function into your loop to assure that the loop takes at least 1 second if that is your desire.
This is incorrect. The read timeout is 10 seconds by default, meaning it will wait 10 seconds if no sample is available. This is sufficient to never timeout with a 1Hz sampling rate and the sampling rate will primarily determine the loop rate as it should be.
Adding an additional delay introduces a second timing dependency, possibly causing problems in the long run.
01-20-2012 04:53 AM
Tanks for your reply. In the beginning I set up the NI-DAQMX Read in reading 10 samples, but the VI runs really fast. So I just tried to read only one sample for each iteration, but nothing changes. When I execute the VI I don't get any error and the right amount of samples. When in the waveform properties I get the dt is 1 for any sample rate I set up. I don't understand what's wrong on my VI
01-20-2012 09:28 AM
Post your new VI. In your original, you don't have a waveform data type anywhere at all and any dt that you write to the file is garbage/default value since you are not passing any dt value to the Write to Measurement File function.
01-23-2012 07:38 AM
Thanks again for your reply, this is the new VI.
01-23-2012 10:40 AM
I never use dynamic data or the write to measurement file but your Convert to Dynamic Data looks wrong. You have a conversion dot on the input. Why did you select the input type as 1D Array of Scalars (which has no timestamp) instead of Single Waveform?
01-23-2012 11:24 AM
Dennis Knutson ha scritto:
I never use dynamic data or the write to measurement file but your Convert to Dynamic Data looks wrong. You have a conversion dot on the input. Why did you select the input type as 1D Array of Scalars (which has no timestamp) instead of Single Waveform?
I already did it, but it doens't change anything. I don't understand what's wrong with that VI.
01-23-2012 11:34 AM
Another strange thing I noticed is your sample rate. You have it set to .5S/sec. With it set to something reasonable (i.e. 500 or 1000) and the correct Convert to Dynamic Data, the dt in the file is correct.