03-21-2017 04:36 AM
Dear Community,
at the moment I am working on the data acquisition using a PXIe-4461.
I have managed to read out one channel, also both channels simultaniously is no problem.
When I do so I am creating a task by:
tOsc = new NationalInstruments.DAQmx.Task(sTaskName); tOsc.AIChannels.CreateVoltageChannel("PXI1Slot4/ai0:1", "AnalogIn", AITerminalConfiguration.Pseudodifferential, -10, 10, AIVoltageUnits.Volts);
Which gives me a task from which I can read waveform data of both channels.
What I have tried but did not get to work (I guess I have some kind of missunderstanding, I just startet working with this Hard/Software) is to create a task (array) for each analog channel like:
NationalInstruments.DAQmx.Task[] tOsc; int nChannel = 2; tOsc = new NationalInstruments.DAQmx.Task[nChannel]; for (int iChannel = 0; iChannel < nChannel; iChannel++) { tOsc[iChannel] = new NationalInstruments.DAQmx.Task(sTaskName); string sViChannelName = "AnalogIn_" + Convert.ToString(iChannel); string sResource = "PXI1Slot4/ai" + Convert.ToString(iChannel); tOsc[iChannel].AIChannels.CreateVoltageChannel(sResource, sViChannelName, AITerminalConfiguration.Pseudodifferential, -oSD.OscRange[iChannel], oSD.OscRange[iChannel] , AIVoltageUnits.Volts); }
which would give me the possibility to manage my settings and tasks convinient in arrays.
However, using this for task creation and configuration works fine, also
tOsc[iChannel].Control(TaskAction.Verify);
in the for loop give no error.
When I try to start the task I get the error message that the resource is occupied.
My gues would be that I block the resource already by starting one task for the module.
But how I could manage and use both channels independent?
Thanks for reading and I am looking forward to your replies.
Best wishes
Johannes
Solved! Go to Solution.
03-30-2017 08:40 AM
Dear Johannes,
thank you for the detailed description. May I ask you for the reason of using independent input channels. Should they run simultaneous or with different sample rates?
Due to the error I suspect, are not several tasks with different sample rates on the map executable. But maybe there is the possibility to combine all measurements into one task?
Best regards
Lucia Nagl
03-30-2017 09:16 AM
Dear Lucia,
thank you very much for your reply.
The reason was that I wanted different measurement scenarios, additionally in the case that both channels are not running simultaneously the settings of the channels and, hence, the tasks can be stored convenient in an array structure and therefore can be applied inside a loop.
In the scenario where both channels should work independently I wanted to use a digital trigger for channel one and an analogue trigger level for channel two, which I can not do when I combine the channels in one task, or is this possible?
Best wishes and thank you again
Johannes
03-31-2017 06:22 AM
Dear Johannes,
thanks for the Explanation. Unfortunately, the Card that you use has one Timing Engine which is already used by the first Task (Case 6 from the following link:http://digital.ni.com/public.nsf/allkb/485201B647950BF886257537006CEB89)
There are several Cards which provide multiple Timing Engines to complete Tasks with different sample Rates. Information for that can be found on the Driver: http://zone.ni.com/reference/en-XX/help/370466AC-01/mxdevconsid/multitimingengines/
If it is possible to adapt the hardware, you can perform such a measurement.
Best regards
Lucia
03-31-2017 06:38 AM
Dear Lucia,
I had the presumption that it may be that what I want to do is limited by the features of the card I am using.
Thank you very much for clarification and the provided links.
Best regards
Johannes