12-08-2010 10:44 PM
Hi,
I am trying to generate asynchronized out put from multiple channels with certain delay, and Im using NI USB-6259 card.
It turns out that no matter which channel comes first, I cannot get output from the second channel. for example in the figure attched, the white waveform can be output but not the red waveform. But if I generate synchronized output I can get signal from both channel. Can anyone help me with this? Thanks!
12-09-2010 02:29 PM
Hello Sandriver,
After looking over your post, it looks like you want to be able to have 2 asynchronous analog outputs. Unfortunately, the analog outputs have only 1 internal timebase to create signals from. You can though send out different outputs on each analog output channel with the same sample clock.
For right now, could you explain in more detail what you are looking to do? This will help me understand your project so I can assist you.
12-13-2010 02:25 AM
Hi Jim,
Sorry my post was not very clear. The object is: N asynchronous analog output with specific delays between each channel. The output is triggered by another program (I use global variable as trigger signal), and the delay time can be controled (also from another program). The outputs from different channels come in sequence, for example, S1(from ch1) -delay-S2 (from ch2)-delay-....
Right now I am using 2D matrix as input to DAQmx Write vi. which writes to all the channels (so all channels use the same internal timebase I guess?). The 2D matrix is generated from matlab script and have the entire sequence (S1-delay-S2-...). The problem is I can only get S1 from the output no matter what the 2D matrix is. But if S1 and S2 are synchronized I can get both.
12-14-2010 12:57 PM
Howdy sandriver!
You will not be able to start multiple analog output channels at different times. As Jim had mentioned, there is only one analog output timebase, so once you start that task all of the output channels you have included will begin generating signals from the data you loaded into their buffers. I can think of two options for inserting a delay between the channels.
1. You will need to stop the active output task, add another channel to it, then restart the task. The flow for this would basically be:
-Start the task with just channel1 output S1
-Wait for delay S2
-Stop the task
-Add channel 2 to the task to generate S2
-Restart the task
2. You could zero buffer the beginning of your output signals to generate the delay when they all start together. For example, if S1 started initially, S2 began 5 samples later, and S3 began 3 samples after S2 you would create:
S1: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ...]
S2: [0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, ...]
S3: [0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, ...]
Regards,
12-14-2010 04:40 PM
Hi,
Thanks for the reply. I think right now the problem is:
for 1, if I start task for S1, stop it and start another task for S2, I will get a jitter of ~30ms, so I cannot get a <30ms delay between stimulus.
for 2, I generated matrix like:
S1: [1, 2, 3, 4, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, ...]
S2: [0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, ...]
but in this case the task stops after the first 6 samples (when S1 finishes), so I cannot get S2. Is there anyway to solve this?
12-15-2010 11:00 AM
Hi sandriver,
You are correct that if you start and stop the task there will be a jitter due to the overhead involved in start/stopping.
In the second case, the task should NOT be stopping after the sixth sample based on the waveforms you show. Make sure that you are putting zeros in the buffer after waveform S1. The task should not stop, but the channel outputting S1 will just generate zero after the waveform.
Regards,