11-06-2023 02:17 AM
I'm currently trying to send hardware trigger to two devices. Don't really know what is the best kind of signal to use for triggering purpose but outputting two values (2,0) seems to be working for me so far for triggering the devices. However, I'm facing a challenge when working with both devices. Creating two tasks for AO0 and AO1 results in a resource reservation error.
After some testing it seems that I can't write both signals without stopping either task. Unfortunately, stopping one task before writing the other isn't feasible for my application due to the extended time it takes, and I need to repeatedly send the trigger before ending the task so I can't keep creating and ending tasks. What is the issue with my code and are there any solution to this?
Solved! Go to Solution.
11-06-2023 07:21 AM
The basic issue is that there is only one timing engine on your DAQ card, with this said, it can create and manage only one AO task at any time. In your case, you're creating two AO tasks to run at the same for which it doesn't have enough resources (timing engine).
Options,
11-06-2023 07:31 PM
Thanks very much for the input. Just a few more questions.
1. When you say place both AO into the same task do you mean to combine the 1D arrays using build array and use the "N channels N samples" instance? This is my current approach but was hoping to output individually using 2 separate tasks since I only need to trigger device A once per cycle while I need to trigger device B like 20 times per cycle. If I combine the arrays one of the array will be padded zeros after the trigger instead of just 2 samples. Currently don't see any problems but I am not sure
2. The card I am using is 6341. What specifications should I look at to know how many timing engines are on the card?
3. I have 2 devices (A and B). I want to trigger device A once while triggering device B 20 times. The way I trigger is by sending 2 analog voltages (2V and 0V) and currently triggering on rising edge. I will be looping this so I want to minimize the time taken so I cannot be creating and ending task during each loop.
11-06-2023 08:12 PM
11-06-2023 09:44 PM - edited 11-06-2023 10:22 PM
1. Thanks I will try using this. Didn't know I can do that. So if the arrays have different length, there is no way I can control when to output each channel individually right? For example I write 50 samples to AO0 and 2 samples to AO1 and I want the signal to AO1 to start on the 10th signal of AO0.
It seems that I don't understand how exactly to do what you describe. Do you mean to just slot another "create channel" into what I initially have? In that case how can I control the number of samples to write if it doesn't have its own timing vi? Could you briefly comment on how to proceed from my current code?
3. Yes, the interval is fixed. Basically I want something like a frequency comb with 20 cycles for 1 channel and 1 cycle for the other. Both channels will output the first sample at the same time. No, I just want both devices to start at the same time. The duration of the trigger is not really important (kinda), I am just concern with the rising edge passing some threshold voltage. I am trying to synchronize digital micromirror device (DMD) and camera. I want to trigger the camera to turn on while changing DMD images. I do that by sending 1 trigger to the camera to tell it to start exposure while multiple triggers to DMD to get it to change images.
11-09-2023 06:42 PM
You can create an array of waveforms - one waveform with the 1 cycle and another with 20 cycles, wire it to DAQmx write, now DAQ will generate both these waveforms on each of the channels at the same rate and thereby achieving your goal.