Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to use two Analog Output Channels at the same time

Hello
 
Hardware:  PCI-MIO-16E-4 board.
 
Software: LabView 7.1 on XP
 
Purpose:  I am trying to use Analog Output 1 and AO2 at the same time.  Sometimes I want them both "ON" (1000Hz square Wave)  Sometimes I want them both "OFF" (0V DC) Sometimes one channel on and one channel off.
 
My Solution:  1.
 
1.  I have a VI that creates an array of numbers for my square wave and an array of zeros for my DC.  I want to simply send this data out either AO1 or AO2.
 
2.  I wrote 2 vi's using DAQ assistant that work fine for each analog output.  .Attached are screen shots of the configuration(s). Note they are using different channels. 
 
3.  However if I try running both at the same time I get errors such as Task Unavailable.  (I can't remember the exact error because I switched to traditional DAQ and now nothing works!
 
4.  In DAQ I get different errors if I run 2 VIs for at the same time usually referring to buffers.
 
MY Question(s):  This seems to be trivial.  All I want is to send a array of numbers out analog 1 or analog 0 at the same time.  I would like to be able to switch from one state to another using software triggers (probably a global variable).  Can I use DAQmx with a E series board?  It seems to work fine with simple examples but not with multiple analog outputs.  How do you do this in DAQ?   I never used DAQ before so I am a little lost with this.  Thanks for any help.  All the examples work but they are just one output.  Any modification to a example to use both channels leads to an error. For each example there seems to be only one variable (Channel #) that would seem to matter so I figure if you change that it should work.  Any help would be appreciated.
 
 
0 Kudos
Message 1 of 3
(2,777 Views)
Tinman,

As there is only one analog output timing engine on your device, you can only perform one output at a time, or both outputs at the exact same update rate (in the same DAQmx task). Of course, you could be outputting different frequencies, depending on the number of samples per period of your waveform in the buffer. There is a DAQmx property which allows you to ground the voltage reference of the DAC on your board, which would cut off both channels at the same time. But since you sometimes want one channel to be on, one to be off, you will need to continuously update the output buffer with new data. Do you require phase continous output? If you don't, then you simply need to use a basic analog output example and update the waveform whenever you want to change it from a periodc signal. Starting with the Cont Gen Voltage Wfm-Int Clk.vi shipping example in the LabVIEW Example Finder (Help->Find Examples), you would only need to add a DAQmx write inside a case structure inside the loop (similar to the one before the loop). Whenever you wanted to change the waveform, you would execute the case which corresponds to that waveform - either a square wave, or an array of zeros. Of course, you would also want a case that does nothing but pass the error cluster and task handle through (you don't want to update the buffer if you don't have to). If you do require phase continuous output, then you will have to continuously write data from LabVIEW to the DAQmx buffer. There is an example which does just this, called Cont Gen Voltage Wfm-Int Clk-Non Regeneration.vi, but there is more CPU overhead involved. Please let me know if you have any questions!

Hope this helps,

Message Edited by Voltage Viper [DE] on 05-18-2006 10:12 AM

Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 2 of 3
(2,756 Views)
On a more basic note, I think two analog output channels on the same device have to be in the same task.  After starting one task, you'll get an error when trying to start the second.  Contrariwise, two output tasks on different devices must be in separate tasks.

0 Kudos
Message 3 of 3
(2,722 Views)