LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Triggering two different AO signals separately using PFI triggers

Hardware: PCIe-6323 driving a BNC-2090A

Software: LabView 2012

Error -89137

 

I am trying to trigger two different sine waves at different times using digital PFI triggers. I have the triggers wired to PFI 1 and PFI 2 on my BNC-2090A. I initialize the two sine waves separately using two DAQ-mx "create virtual channel" vis, based on the example "Voltage-finite output" in the DAQ-mx analog output example folder. When I try to run this code, I get error -89137, which indicates that the PFI resource can only be used by one "task" at a time. How do I make these two channels part of the same task while maintaining unique triggers for each channel? In the attached example, I tried solving the problem by using unique physical AO channels for each task, but ideally I would like to use the same physical AO port for both channels.ppivi.PNG

0 Kudos
Message 1 of 7
(3,935 Views)

You won't be able to use a single AO channel, since a nicely triggered task will involve the waveform being written to the hardware buffer beforehand. The other issue is that you only have one AO Start Trigger and Sample Clock, so two tasks can't both use it.  From DAQmx help "For most devices, only one task per subsystem can run at once":

http://zone.ni.com/reference/en-XX/help/370466AC-01/mxcncpts/tasksnidaqmx/

 

Incidently, your bundling of the Basic Function Generator's Sampling Info cluster is wrong - you are not specifying #s, so it defaults to 1000 samples.

 

Maybe some more information about your project would help. Can the two sequences be related in any way?  Or can you obtain a second card?

0 Kudos
Message 2 of 7
(3,882 Views)

Thank you very much for your response. I am specifying the #s to the sample clock vi and it seems to work. This is based on an example vi and I haven't changed that part of the code. 

I'm surprised there is no way to trigger two different AO's with different triggers without buying another $1000 worth of equipment. That's not an option for me, I'll need a workaround.

The only difference between the two sequences is the amplitude of the sine wave. The second needs to be triggered a fixed amount of time after the first, so maybe I could write it as one AO in the buffer with 0V for a specified period of time between the two sequences. Perhaps there is a more elegant way of doing this, but I've tried writing a waveform of amplitude 0 and concatenating it in between the two sequences. I can't seem to get the waveforms concatenated correctly. I'm using the "build array" function with "concatenate" checked. The output seems to have three channels, however, as indicated by the three-colored waveform graph. I've tried reshaping the array to 1d using the "reshape array" function, but then it only writes one of the sequences. Any suggestions for building this waveform?vi1.PNGgraph1.PNG

0 Kudos
Message 3 of 7
(3,867 Views)

You are building array of waveforms (multiple signals), you are not concatenating signals (sine and zeros). Signal is an array inside waveform type.

To add zeros in the beginning of a signal, you need to modify one waveform: get waveform components.vi, then concatenate arrays, then build waveform.

If signals have the same timing, then create one task with 2 channels. DAQmx Write has mode Analog output -> multiple channels -> multiple samples -> 1D waveform. 1D waveform means a number of signals, one array element describes each signal. 

0 Kudos
Message 4 of 7
(3,863 Views)

Your "Bundle By Name" node lists "Fs" twice instead of "#s" and "Fs", so it is not using the SampQuant.SampPerChan value but your hard-coded value for #s

0 Kudos
Message 5 of 7
(3,853 Views)

I see. Thanks again for the help!

0 Kudos
Message 6 of 7
(3,843 Views)

Thank you very much, this worked! Now I understand a little more about how this data type works. Cheers!

0 Kudos
Message 7 of 7
(3,842 Views)