Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Waveforms and other analog conflicting

Solved!
Go to solution

Hello,

 

The vi that I am trying to program, I have 4 analog outputs to my disposal along with some onboard memory that I can use.  I successfully was able to create two waveforms out of two of the analog outputs using the onboard memory.  I also successfully have been able to output through the other two pointwise.  When I try to do these separate tasks at the same time, they conflict and I get an error saying that the resource is already reserved.

 

The way I'm doing it now is that I have two separate tasks, one for the two waveforms and the other task for the two other analog outs that I want to be able to change.  The error indicates that the resource is reserved for the waveform when I try to output through the other two analog outs.  

 

Is there a way to have all four channels in one task yet two of those channels output a waveform from the onboard memory and the other two outputting one value at a time?  If so, how?  If not, is there a way I can accomplish this task?  

 

Thanks,

Michael Bentley

0 Kudos
Message 1 of 10
(4,674 Views)

Michael,

 

This may be possible, depending on which device you are using.  What card are you using for your generation?

Seth B.
Principal Test Engineer | National Instruments
Certified LabVIEW Architect
Certified TestStand Architect
Message 2 of 10
(4,656 Views)
the card that I am using is the PCI-6229.  It has four digital to analog converters.
0 Kudos
Message 3 of 10
(4,644 Views)

Hi

 

Thanks for your reply.

 

I think I can the issue here.

 

For each device you can only have One Analog Input task and One Analog Output task.

 

This is because the cards only have two clocks, one for input and one for outputs. 

 

For example, to output multiple waveforms you need to create One DAQ task, with X number of channels. Then on the DAQmx read vi you can pass an array of data (data per channel). 

 

Please see example,  Cont Gen Voltage Wfm-Int Clk.vi (Help>>Find Example>> Hardware Input/output >>DAQmx>>Voltage...).

 

I hope this helps.

 

Kind Regards,
James.

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
Message 4 of 10
(4,634 Views)

Thanks for your comments.

 

I guess the answer to my question is that with my current hardware, it is impossible to have both using the same clock timer for different things. The solution may be in that I could have the single valued outputs to not use the clock, just to use the program...  I'm going to try it and I'll post the results of if it worked or not.

 

Thank you very much

0 Kudos
Message 5 of 10
(4,624 Views)

No, that will not work. You CANNOT tell the D/A to use hardware timed output for some channels and not use hardware timed output for other channels. It's a single D/A and you can only program it for one timing mode.

 

What you might do is combine everything into a single task. If you look at the shipping example called Con Gen Voltage Wfm-Int Clk-Non Regeneration, you will see a single waveform output. You can add another function generator and for the 'single' outputs you want, use the Initialize Array function to create an array the same size but where every element in the array is the same value.

Message 6 of 10
(4,616 Views)
Solution
Accepted by preschooler
Well, I tried it and for some reason that I cannot explain, it does work.  The two channels that were single valued outputs, I didn't attach to a timer at all, their speed is determined by the speed of the while loop the output is in.  The waveforms work wonderfully using the onboard memory of the card and using the timer as well.  They are in two separate tasks and work.  Problem solved.
0 Kudos
Message 7 of 10
(4,581 Views)
It would be nice to see your code. My guess is that you are starting and stopping each task and that the tasks are running sequentially.
0 Kudos
Message 8 of 10
(4,576 Views)

Michael,

 

The 6229 works as follows:

 

It has four separate DACs.  Each of these DACs can be written to in a engine fashion (I believe you referred to this as pointwise) individually without using any common resources.  The 6229 also has one 'timing engine' and one FIFO dedicated to AO.  These resources are reserved in a per-task manner.  What this means, is that any channels that need to share the same resource must be part of the same DAQmx task.  Hardware timed tasks must use the timing engine (and FIFO in 99% of use cases).  Since these are scarce resources, all channels using hardware timing must be part of the same task (and use the same sample clock, and both receive data from the same FIFO).  The two pointwise channels don't need access to the 'timing engine' or FIFO, and as such have no common resources with other tasks.  As such these pointwise channels can both be placed in one task, or they can each have their own task.  It's up to you to pick what works best for your application.

 

I hope that clarifies things,

Dan

0 Kudos
Message 9 of 10
(4,563 Views)

Oops... Looks like I lost my battle with the spellchecker in that last post.  The second sentence should read, "Each of these DACs can be written to in a non-timed fashion (I believe you referred to this as pointwise) individually without using any common resources."

 

Sorry for any confusion,

Dan

0 Kudos
Message 10 of 10
(4,557 Views)