05-05-2022 12:05 PM
the updated VI builds an array of waveforms and passes that to the Multiple Channels>>Multiple Samples>>1D Waveform instance of DAQmx Write. The ordering of the signals in the array of waveforms should align to the channel ordering in the task. When you want <channel0> to be the best channel, wire the best signal data to index 0 of the array of waveforms, and wire the noisy signal data to index 1 of the array of waveforms.
When you want <channel1> to be the best channel, wire the noisy signal to index 0 and the best signal data to index 1.
Note that case "1" swaps the order of elements before connection to DAQmx Write.
05-05-2022 04:47 PM
@Zuc_Lab wrote:
Hi,
some of the problems are solved, for now the last one remained seems to be linked to the presence of the DAQmx Write.vi followed by the DAQmx Start Task.vi. From what I can tell, the default value of the Write.vi Auto start property is true so it’s an error to put the start task after it with that Boolean set to true. This fact can be related to the error -200479 “Specified operation cannot be performed while the task is running” which occurs at the start task vi. But I can’t figure out why this problem arises only at the second loop of the for loop.
Hereafter I attach the link of the NI paper which help me together with your help:
https://zone.ni.com/reference/en-XX/help/370469AP-01/daqmxprop/attr1826/
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P6VkSAK&l=it-IT
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000PA1PSAW&l=it-IT
A last question the DAQms Stop Taswk.vi must be included in the for loop for avoid problem with the task or a shift resister can be enough?
Thank you for the help!
Best Regards,
Zuc
Yes, in the updated code I posted, the sample mode is set to Finite Samples and autostart is set to TRUE. You need the Stop in the For Loop. Here is another pass where we only put what is necessary in the case structure which more clearly shows that every iteration of the loop operates exactly the same on the DAQmx task.
05-06-2022 03:06 AM
Hi Doug,
that's a wonderful solution which help me a lot in learning Labview and the DAQmx Vis. But if a need a static different delay different for each channel, how I can introduce it in your architecture? Do I have to use parallel loops as Bob suggested?
Since you are providing me a lot of info, I ask you some more questions:
Thank you very much for all the kindness and the answer you give me!
Best Regards,
Zuc
05-06-2022 12:12 PM
Delay:
For Finite generation, you can introduce a delay in the signal by adding zeros at the beginning of your waveform data. Remember to keep the same length for each channel, so add zeros at the beginning and/or end of each waveform to introduce the desired delay while keeping the channel lengths identical.
1. You should be able to reproduce the waveform in its entirety. How long are your WAV files? When I run the code, I have been pointing to short little demo WAV files that ship with the Sound and Vibration Toolkit examples. When you say it stops for tens of milliseconds, do you mean between iterations of the For Loop? I would expect this for Finite tasks. If you want to eliminate dead spots, you can transition to using a Continuous task, but you should refer back to the DAQmx examples to note the changes needed in your code.
2. Can you create a reproducible test case? I didn't see 'dead' channels running the modified VI with my hardware. What hardware are you using?
If your original question is answered, please consider accepting a solution for your original post and starting new discussions for new questions.