07-06-2022 04:14 AM
Good afternoon! I'm trying to generate two signals on two different Analog Outputs. In this case, only one thing is launched. Tell me how to fix it?
I also tried to merge the channels, but in case I have a different Timing I don't know what to do.
07-06-2022 11:40 AM
The issue is that majority of the cards have only one timing engine, when you have more than 1 analog output to generate, all those channels must be part of same task, you cannot have two tasks in parallel.
The second image looks good if you remove the bottom implementation.
Unfortunately, by your hardware constrain you cannot have more than one AO task running and in turn you cannot have different sampling rate for each of the channels.
07-06-2022 01:19 PM
While true that you can't directly set up different AO channels to have different sample rates, as Santhosh already mentioned, I can think of 2 workarounds you might consider (but note that neither one is universally applicable).
I'll use your posted sample rates of 500 kHz for 2 channels, 1000 Hz for 1 channel to illustrate.
1. In your posted example (pic #2), the data for the 1000 Hz channel comes from a Function Generator function. In such cases where channel data is being calculated *based on* the sample rate, there's no reason you couldn't just drastically oversample and define your same function at a 500 kHz rate and then put all 3 channels into a single task.
(Note: the posted pic asks for a 500 Hz sawtooth wave with 1000 Hz sampling rate which isn't a good combo for an analog waveform shape -- as you can clearly see if you send that Function Generator output to a graph. A common rule of thumb is to aim for 20x oversampling. So you'd aim for a 10 kHz sample rate to produce a 500 Hz function. Some apps need more than 20x, others can get by with less, but something like 20x is a decent general starting point.)
2. Another special circumstance is when the fast rate is an integer multiple of the slow rate -- which you happen to have here as well. And then suppose that the slow channel is a specific sequence of voltage levels (perhaps you read them in from a file?) that you need to generate with the slower timing between changes.
Well, you can *still* manage this by putting all 3 channels into a common task at 500 kHz. You would just take your 1000 Hz data and replicate each sample 500 times. By generating the same value 500 times in a row at 500 kHz, the voltage *changes* only happen at 1000 Hz.