10-20-2015 01:42 PM
Hello everybody,
I would like to use NI6120 (in PXI 1045 chassis) to generate double counters (counter 0 and counter1). I am using .NET platform. For each counter generation, I create a task, then here is the following code:
Task_For_DAQ1_Cnt0.COChannels.CreatePulseChannelTicks(GetDeviceMap.DaqOne + "/ctr0", "daq1cnt0", "/" + GetDeviceMap.DaqOne + "/PXI_Trig2", COPulseIdleState.Low, 0, low_ticks, high_ticks);
Task_For_DAQ1_Cnt0.Timing.ConfigureImplicit(SampleQuantityMode.ContinuousSamples);
Task_For_DAQ1_Cnt0.ExportSignals.ExportHardwareSignal(ExportSignal.CounterOutputEvent, "/" + GetDeviceMap.DaqOne + "/PXI_Trig0");
Task_For_DAQ1_Cnt1.COChannels.CreatePulseChannelTicks(GetDeviceMap.DaqOne + "/ctr1", "daq1cnt1", "/" + GetDeviceMap.DaqOne + "/PXI_Trig2", COPulseIdleState.Low, 0, low_ticks/2, high_ticks/2);
Task_For_DAQ1_Cnt1.Timing.ConfigureImplicit(SampleQuantityMode.ContinuousSamples);
Task_For_DAQ1_Cnt1.ExportSignals.ExportHardwareSignal(ExportSignal.CounterOutputEvent, "/" + GetDeviceMap.DaqOne + "/PXI_Trig1");
If i start tasks running, second task throw the following exception (first one runs fine, and see the signal coming out - NI6124 (in PXIe 1065 chassis) have no problem by double clock generation and routing)
Specified route cannot be satisfied, because it requires resources that are currently in use by another route.
Property: NationalInstruments.DAQmx.COChannel.PulseTerminal
Destination Device: DAC1
Destination Terminal: PXI_Trig1
Required Resources in Use by
Task Name: _unnamedTask<4>
Source Device: DAC1
Source Terminal: Low
Destination Device: DAC1
Destination Terminal: Ctr0Gate
Task Name: _unnamedTask<5>
Status Code: -89137
Please help me out to solve this problem. When I create tasks on NI-MAX, double clock generation is OK, but can't route them on the backplane.
10-21-2015 03:40 PM - edited 10-21-2015 03:40 PM
Hi Freewalks,
Typically a resource reserved error means that you are using that line for another function. Are you sure that you aren't running any test panels in NI MAX or referencing the same line anywhere else in your program? What is PXI_Trig2 being used for? It seems like you are referencing it for both counters.
10-21-2015 03:43 PM
Hi! Thank you.
PXI_Trig2 is the source terminal for both counters
10-21-2015 04:17 PM
Hi Freewalks,
Based on your error message, I actually can't tell which line of code is the issue. Do you think you can specify which specific line is throwing the error?
Thanks!
10-28-2015 08:46 AM
it throws error when I start each task.
I think I know the exact reason. Please advise me on finding the solution.
I reliaze that NI 6120 doesn't have a direct route from Ctr1InternalOutput to PXI Trigger lines, whereas NI 6124 has.
There are 2 ways to route Ctr1:
1) through Ctr0Gate, however I'm already using Ctr0 - I guess this is using counters in a cascade form
2) through Analog Out Sample clk: I tried to route this, but i couldn't see the clock coming out on Pxi trigger
so in summary,
ctr0 can be routed on pxi lines easily
but i don't know how ctr1 can?
Thanks
10-29-2015 07:01 PM
Hi freewalks,
You can check your internal device routes through NI MAX. This can help you see where to route your counter on your device. Information on how to do that can be found here: http://digital.ni.com/public.nsf/allkb/E539D226A643C1CE8625715E007C23C8
10-30-2015 08:59 AM
I'm sorry but I already did this in my previous answer.
11-10-2015 05:45 PM
so daqmx connect
Ctr1internaloutput with ao/sampleclock
and
ao/sampleclock with trig3
did not work.... I think it means fake ao task should be running.
11-11-2015 03:31 PM
Freewalks,
The reason that you are able to do it for when there is only one counter is because it is able to use all the resources needed in terms of gate, source, and output of the counter. The reason when you are using two counters is that they share resources through an indirect route through the subsystems. The source being the same is not the issue the Trig_2 works perfectly fine. The issue is that the Ctrl 1 uses the Ctr0Gate so that is why you are getting the error. You can see this on the device routes in NI MAX. I attached a screenshot of this as well below.
A gate also can’t be reroute to use something else because that is programmed on the FPGA level. However to test this out you can use just ctrl 1 without ctrl 0 and that should work perfectly fine.
I verified this simulating the device and using LabVIEW as well and got the same error.
Hope this helps!