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.
07-27-2020 11:29 PM
Hi all,
I'm trying to add a control to my front panel so I can change the sampling period of my DAQ system instead of number of samples (it should get the sampling rate and the desired period from the user, multiply these two numbers and set it as the number of samples in the sample clock.).
I tried to do this with both desired and actual sampling rate (the actual sample rate would be more desirable), but none of them worked. Is that even possible? if yes, what's the right way?
Any help or comments would be appreciated.
Thanks
07-27-2020 11:53 PM
Don’t have LabVIEW at the moment, but this is what I do:
typing on mobile, sorry can’t be clearer.
mcduff
07-28-2020 09:49 AM
The "# of samples" inputs for DAQmx Timing and DAQmx Read have been misleading people for years. Like many before you, you've wired the same value to both. However, that's not necessary and is frequently not even a particularly good idea.
I couldn't open your LV2019 code, but the screenshots showed me enough. The one you labeled "1" is the best place to start.
1. First, decide how many samples you want to read per iteration and wire that value into DAQmx Read. I'd simply divide the sample rate by 10, giving me about 1/10th second of data per iteration.
2. Use a shift register or feedback node so you can add each iteration's # of samples to a cumulative total. Compare the cumulative total to your target total # to acquire. Once you reach or exceed the target, end the loop and stop & clear the task.
3. If it matters in your app that your last iteration ends exactly *at* the target # samples, it'll just take some simple math & conditional logic to fine tune things at the end.
-Kevin P