07-29-2020 03:22 AM
Dear all,
I am having an issue with the attached VI regarding the cycle time of the timed loop. Purpose of the VI is to "playback" csv files (values in 1 column, sampling rate 500Hz) and to create an analogue voltage signal between -9,9V and 9,9V from the csv files. Acc. to the constant sampling rate of the csv files the "dt" of the 1kHz timed loop is "2" which is supposed to yield 500Hz loop frequency.
The issue is that the cycle time of the timed loop seems to depend on the size of the playback file:
There seems to be a linear correlation between what I call "playback factor" PF (e.g. 0,625 or 1,685) and Filelenght FL which is like:
PF = -0,00035*FL + 1,73
The positive thing about that is: Since small files run faster than real time it doesn't look like a hardware limitation (e.g. caused by desktop DAQ via USB) which is described in other posts here. Playback with a sampling rate of 500Hz seems to be achievable with the hardware used.
When I remove only the "DAQmx Write" from the schematic the playback always is correct (500Hz, neither too fast nor to slow) and independent from filelength.
What can be the reason for that undesired feedback of filelength to cycle time? Any idea is highly appreciated.
Thanks in advance.
Christoph
NI-cDAQ-9172 with NI9263 (1 AO used)
LabView 2017
07-29-2020 09:49 AM
You should be trying to use a hardware sample clock when you want precise output timing. Here's a minimum working example (MWE) to show how you can replay column 0 of the data in your file at 500 Hz.
-Kevin P
07-31-2020 03:58 AM
Dear Kevin, thank you very much, your VI works almost perfectly. I had to add a "-1" to the "DAQmx Wait until done" because I received an error 200560 for each of my playback files regardless of their lenght.
The only drawback with the VI is that without the loop (timed loop or any other) I seem to have no chance to observe my playback data online e.g. using a waveform chart. The files are of 1 minute to 45 minutes playback duration (@500Hz sampling rate). Do you see any possibility to add such a feature as I used it in my original VI? I would really like to be able to monitor the signal like in an oscilloscope.
07-31-2020 09:28 AM
Here's a head start. Each iteration of the loop sends an appropriate subset of data to a chart based on acquisition progress so far. You may want to display a different amount of the chart history or maybe even change from chart to graph -- this is just a starting point to show how to get your display to stay sync'ed up with the hardware signal being generated.
-Kevin P
08-02-2020 03:05 AM
Dear Kevin. Thanks again for your help. Could you please post the VI again using version 2017?
08-02-2020 05:54 AM
Sure, here it is. It's actually saved back to 2016 so that I could verify that it saved correctly. I made a small mod to get rid of the not-yet-available-in-2016 "Stall Data Flow" function.
-Kevin P
08-03-2020 01:07 AM
Maybe I'm doing something wrong, but I keep receiving this errror message.
08-03-2020 07:37 AM
Must be my mistake. I've got both and it looks like I attached the wrong one.
-Kevin P
08-04-2020 03:11 AM
Thank you very much. It works perfectly!! I will now try to add some comfort features like resetting the playback to the start, open a different file during a running playback and adding the possibility to deliver constant values to the output channel (for calibration), and I am curious if I'll manage that myself. Kind regards!