04-25-2012 06:22 PM
I am using PXI 4461 card, which has 2 inputs and 2 outputs.
I have a sequence, which will be loaded for multi UUT testing at the same time. I am trying to use AI0, AI1 to read the signals, which are generated by UUTs at the same time. One UUT can measure signal at AI0 and other UUT should measure AI1.
I was in impression that it can be possible to measure both AI0 and AI1 at the same time. But it's giving the error, when I try to measure.
I made the attached VI as an reentrant. Please let me know if this is possible.
I would like to know same if this is possible to generate from AO0, AO1 at the same time with different frequencies (1KHz, 10KHz). AO0 should generate signal with 1KHz and AO1 should generated signal with 10KHz. Is this possible?
Thanks,
04-26-2012 01:41 PM - edited 04-26-2012 01:51 PM
LV2010,
Thank you for using the forums!
First off, I ran your VI as is with one AI. I received the following error:
The message is letting you know you have your MIN set higher than your MAX. Basically, your max value is currently set to -10 and your min value is set to 10. Switch those, and you eliminate the error.
In order to read from both ai0 and ai1, you can simply put them both in the control window:
This is called channel expansion.
In order to see the waveforms, I added a Waveform Graph to my front panel and then on the block diagram I wired it to the data output of the DAQmx read.
The DAQmx Read VI will read the channels in the order in which you specify in the Physical Channels terminal.
In terms of generating two outputs from AO0 and AO1 at the same time, that is definitely something you can do! I have attached the final VI, but this is how I did it...
First, I opened the example finder by going to Help >> Find Examples. On the bottom left, I selected the PXI-4461 and marked the box next to where it says "Limit results to hardware". Navigating to Hardware Input and Output >> DAQmx >> Analog Generation >> Voltage, I opened the example "Cont Gen Voltage Wfm-Int Clk-Non Regeneration.vi".
Taking a look, this will allow us to generate one waveform at one frequency. First off, I know I want to output two different waveforms with separate information. I selected the relevant indicators and controls, then pressed Ctrl+C and dragged it over to create a copy. I changed labels and moved stop button to make it more appealing, and changed the waveform information.
Then, I moved to the block diagram. I placed a new Function Generator.vi and moved/wired the controls/indicators I created above to the inputs/outputs of the new function. I changed the error wire to go through the new Function Generator.vi before going into the DAQmx write. Lastly, I connected the sampling information from the first function generator to the new one.
Next, we need to change the write function. It is currently set up to write an along waveform with 1 channel and N samples. We want N channels and N samples. Change the DAQmx write to Analog >> Multiple Channels >> Multiple Samples >> 1D Waveform. By doing so, it creates an broken wire between the output of the one function generator.vi that is still wired to the input of the DAQmx write vi.
The reason for this is that the DAQmx write with N channels and N samples expects an array of waveforms, not a single waveform. I deleted this wire and placed a Build Array (Programming >> Arrays >> Build Array). I dragged it down to expand it to hold two waveforms, one for ao1 and one for ao0.
The order that you wire the two waveforms into the array will determine which waveform is output on which channel. The first waveform in the array will be output first. We will put the first function generator output to the first row of the Build Array function and the second to the bottom row. Then wire the output of the Build Array function into the DAQmx write.
The block diagram now looks like this:
All that is left is left is to specify what channels we want. We will again use channel expansion. Remember, the first waveform we wired into our array will be the first output, and the first in the list of the control will be the channel output first.
The front panel now looks like this:
And we are done! I have attached the final version of this VI as well as the edited version of the VI you posted.
I know this was long, but I hope it was helpful!
Also, here is an article and here is an example from our community forums you may find helpful.
The attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system, or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense
Katie
04-26-2012 02:01 PM
I just noticed there was one last question I didn't address!
"I made the attached VI as an reentrant. Please let me know if this is possible."
As it stands, it would not work. It would throw an error saying that the device is already reserved. However, there are some work arounds, such as having a subVI that just reads and making the subVI reentrant. The trouble with that is that you couldn't be sure which samples are showing up where. In order to determine a more robust work around, what is it that you are trying to accomplish? Why do you want it to be reentrant?
Katie
03-22-2013 04:33 AM
Hello All,
I have encountered a diffrent problem:
Reading both Inputs simultaneous works.
But how can i set the AI settings diffrent for both channels?
p.e.
AI0 should be set to DC-coupling and Range -10V/10V
AI1should be set to AC-coupling and Range -2V/2V
I can use DAQmx Create Virtual Channel (VI) to set the expected minimum and maximum values => do they affect both channels?
Also i can adjust the AI coupling via property node of the task => but again only AI coupling can be set not AI0 coupling or AI1 coupling.
Kind regards,
Richard
03-25-2013 01:43 PM
Hi Richard,
You can set different parameters for each channel by utililizing a for loop, property nodes, and arrays at the start of your application when you are creating each channel. I have attached a VI to this post that was created by making some minor edits to our Continuous Acquire & Graph example, each set of parameters correspond to each channel in the scan list(order they are listed in). For example, the values in index 0 of the arrays correspond to the first channel listed.
-Jake B.