02-13-2024 09:34 AM
Hi,
I'm attempting to read data from a CSV file to generate a waveform and output current. I'm using the Build Waveform function for this purpose, with the number of samples and the time between two samples known (0.305 ms). However, I'm facing difficulty in adjusting the frequency of the waveform independently of the sampling frequency. Modifying the time step (dt) alone doesn't seem to influence the frequency of the waveform. How can I adjust the waveform's frequency without affecting the sampling frequency? Could you please review the VI attached for further assistance?
Solved! Go to Solution.
02-13-2024 10:20 AM
I'm facing difficulty in adjusting the frequency of the waveform independently of the sampling frequency.
Well, that's because they are not independent!
You have a file with a bunch of sample values representing your waveform, apparently acquired with a 0.305 msec time spacing. The only way to set the waveform frequency as you output them is by defining the dt between samples, i.e., the sample rate. The generated waveform frequency is entirely dependent on the output sample rate. So if you want to change the waveform frequency, just generate your samples at a different rate than their nominal 0.305 msec spacing.
-Kevin P
02-13-2024 11:11 AM
Thank you for the reply. If I wish to adjust the frequency while the VI is running, I cannot dynamically alter the sampling rate during operation. Is there any other option for that?
02-13-2024 12:01 PM
What DAQ device are you using? I've known of many NI devices that DO allow you to change the AO sample rate on the fly during a continuous run.
Another option might be to generate a pulse train with a counter (whose frequency you can change on the fly) and then configure AO to use that signal as its sample clock.
-Kevin P
02-13-2024 01:29 PM
Hello,
I am using PXI- PXI 6345 I/O module
02-15-2024 09:10 AM
I think your device should allow you to change the AO sample rate on the fly. Have you tried it? In LabVIEW, you'd need to use a DAQmx Timing property node to change the sample rate of a running task.
(Note: my experience with this is somewhat old. It may be the case that you're only allowed to change the rate on the fly if you deliver data as an array of samples and not if you deliver data as a waveform. I doubt I ever experimented with it using waveform AO.)
-Kevin P
02-15-2024 12:10 PM
I generated a Digital pulse train on the fly using counter output and then used it as a source for my AO sample clock. I could change the AO sampling rate by changing the the pulse frequency.