09-04-2023 08:14 AM - edited 09-04-2023 08:18 AM
Hi,
I can’t find a clue on how I can use the USB-6211 to generate on both the AO channels simultaneously (following this advices: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019KxoSAE&l=it-IT). I need to generate the same waveform on both channels, but in my vi (here attached) I obtain always the mismatch error in the Channels number in the task (2) from the number of channels in the data (1). I have tried all the possible ways that come to my mind, but I don’t understand how to fix this.
Also because if I try to generate the AO signal on the 2 channels by adding a task in the NImax interface everything works fine without errors, except for a bit distorted on the sine wave.
Can you help me please?
Thank you,
Zuc
Solved! Go to Solution.
09-04-2023 09:34 AM
You should configure your Output Array waveform generation to generate two waveforms.
Before:
After:
09-04-2023 03:15 PM
It took me a little while to notice you are using the example that ships with LabVIEW for AO (I recognized the "look" of the Front Panel icons from @ZYOng's reply, which is the obvious "solution", and which I hope works for you!).
Something to note, however, is you have specified Continuous Sampling, which means if you specify 1000 samples at 100 kHz, you will be playing the same 1000 samples over and over again 100 times a second, which sounds a bit problematic to me. I notice on your Front Panel the "Actual Sample Rate" is shown as 1000 (Hz), which puzzles me. One of us (almost certainly me) doesn't understand what you are doing (or trying to do) -- it is possible that you are doing something that is not easy to do with the hardware you have (I don't remember if you said what it was). But anyway, @ZYOng's suggestion should at least get rid of the LabVIEW error so you can see if your output is what you need.
Bob Schor
09-05-2023 02:34 AM
Only one doubt, why passing the channels in a for loop give me an error always in mismatch while adding more DAQmx generate Channel in series works fine? So what is the difference between these two code?
09-05-2023 02:42 AM
Hi Bob,
even if the vi is one LabView modified example the vi i have added is not the one i using, since my vi is related to a TestStand sequence where i have to generate a tone while i do some other actions for an undefined tme interval. So that's why i have the continous option activated. Moreover this tone must be generated on both the AO channelsof the DAQmx. If you have any advices fell free explain them, i then will try to improve my skills.
Best Regards,
Zuc
09-05-2023 02:46 AM - edited 09-05-2023 02:55 AM
Hi Zuc,
@Zuc_Lab wrote:
why passing the channels in a for loop give me an error always in mismatch while adding more DAQmx generate Channel in series works fine? So what is the difference between these two code?
Because your code does NOT THE SAME!
In your loop you create a NEW TASK in each iteration, while in the flat version you wire the task from CreateChannel to next CreateChannel.
Solution: use a shift register to hold the DAQmxTask in your loop version… (Or flatten the channel array into one string containing a list of channels and get rid of the loop.)
Both options shown in the image:
09-05-2023 09:35 AM
you're right, i was so focused on the vi that i lost the most simple thingt: how data are managed!
Thank you very much for the patience!