Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Resource reservation in dual analog output from DAQ card

Solved!
Go to solution

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?

 

Screenshot 2023-11-06 155614.png

0 Kudos
Message 1 of 6
(943 Views)
Solution
Accepted by Jaywai

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,

  1. Put both the AO channels into the same task
  2. Get a DAQ AO card with multiple timing engines
  3. Explain your requirement better for others to suggest clever ways to workaround your constraints
Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 2 of 6
(906 Views)

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.

0 Kudos
Message 3 of 6
(879 Views)
  1. Yes and no. When creating the task, provide a list of channel names instead of just one like 'Dev1/ao0:1' and using the N Channel N sample instance to generate the waveform.
  2. 6341 has only one timing engine for the AO task - this means, all AOs that must generate simultaneously must be part of the same task.
    https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019KWYSA2&l=en-US
  3. Can you share more about the requirement?
    Is the interval and when to trigger each device pre-determined? is there any external factor that determines when to send the trigger to these two devices? what is the duration of triggers? what are these two devices?
Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 4 of 6
(873 Views)

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. 

0 Kudos
Message 5 of 6
(863 Views)

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.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 6 of 6
(776 Views)