Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Gating an edge counter in daqmx

I'm using an edge counter (PXI1Slot2/ctr0) to count edges from a photo multiplier. Now I'd like to gate the counter so it only counts when an external signal is high for instance. I've read on this forum that the 'pause trigger' is needed (I've had no luck with the gate terminal). But when I try to configure the pause trigger I just get "NationalInstruments.DAQmx.DaqException: 'Source terminal to be routed could not be found on the device."

 

CIChannel chan = myTask.CIChannels.CreateCountEdgesChannel("PXI1Slot2/ctr0", "Counter 0", CICountEdgesActiveEdge.Rising, 0, CICountEdgesCountDirection.Up);

 

myTask.Triggers.PauseTrigger.ConfigureDigitalLevelTrigger("PXI1Slot2/PFI0", DigitalLevelPauseTriggerCondition.High);

 

 

0 Kudos
Message 1 of 8
(1,684 Views)

What is the model of your DAQ device?

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
-------------------------------------------------------
https://github.com/ZhiYang-Ong
0 Kudos
Message 2 of 8
(1,672 Views)

I'm using counter 0 on a PXIe-6363. At present I'm stuck trying to configure the PauseTrigger in C# using DAQmx.

 

myTask = new NationalInstruments.DAQmx.Task();
CIChannel chan = myTask.CIChannels.CreateCountEdgesChannel("PXI1Slot2/ctr0", "Counter 0", CICountEdgesActiveEdge.Rising, 0, CICountEdgesCountDirection.Up);
myTask.Triggers.PauseTrigger.ConfigureDigitalLevelTrigger("PXI1Slot2/P1.0", DigitalLevelPauseTriggerCondition.High);
myTask.Control(TaskAction.Verify); //throws exception see below
 
NationalInstruments.DAQmx.DaqException
  HResult=0x80131501
  Message=Source terminal to be routed could not be found on the device.
Make sure the terminal name is valid for the specified device. Refer to Measurement & Automation Explorer for valid terminal names.
 
Property: NationalInstruments.DAQmx.DigitalLevelPauseTrigger.Source
Property: NationalInstruments.DAQmx.DigitalLevelPauseTrigger.Condition
Source Device: PXI1Slot2
Source Terminal: PXI1Slot2/P1.0
0 Kudos
Message 3 of 8
(1,610 Views)

When I lookup the pinout for your 6363 device, I see that P1.0 is also known as PFI0.

And that's probably where the problem is.  In DAQmx syntax, "P1.0" refers to a digital physical channel (or possibly a specific line in a port-wide channel).  Whereas "PFI0" refers to a terminal with many options for configuration and routing as a timing signal.

 

Even though the exact same pin is referenced, DAQmx requires that you use PFIx syntax when configuring a terminal for use as a clock, trigger, or other routable timing signal.  Try it out and let us know.

myTask.Triggers.PauseTrigger.ConfigureDigitalLevelTrigger("PXI1Slot2/PFI0", DigitalLevelPauseTriggerCondition.High);

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 4 of 8
(1,600 Views)

Thanks for the suggestion but that doesn't run either.

 

For such a simple problem, running a gated edge counter, there seems to be no source code samples and NI support seems baffled as well.

 

As a novice looking at the 6363 counter, the hardware seems designed to do what I want: there's a counter output and a gate input but I have yet to see a code example of anyone using the gate for, well, gating. Then there's a start trigger but most people on the forum seem to talk about the pause trigger so I'm lost.

 

 CIChannel chan = myTask.CIChannels.CreateCountEdgesChannel("PXI1Slot2/ctr0", "Counter 0", CICountEdgesActiveEdge.Rising, 0, CICountEdgesCountDirection.Up);
//myTask.Timing.ConfigureImplicit(SampleQuantityMode.FiniteSamples, 1000);
myTask.Timing.ConfigureSampleClock("100kHzTimebase", 100000, SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples,100000);
myTask.Triggers.PauseTrigger.ConfigureDigitalLevelTrigger("PXI1Slot2/PFI0", DigitalLevelPauseTriggerCondition.High);
myCounterReader = new CounterSingleChannelReader(myTask.Stream);
myTask.Control(TaskAction.Verify);


Exception thrown: 'NationalInstruments.DAQmx.DaqException' in NationalInstruments.DAQmx.dll
An unhandled exception of type 'NationalInstruments.DAQmx.DaqException' occurred in NationalInstruments.DAQmx.dll
Source terminal to be routed could not be found on the device.
Make sure the terminal name is valid for the specified device. Refer to Measurement & Automation Explorer for valid terminal names.

Property: NationalInstruments.DAQmx.DigitalLevelPauseTrigger.Source
Property: NationalInstruments.DAQmx.DigitalLevelPauseTrigger.Condition
Source Device: PXI1Slot2
Source Terminal: PXI1Slot2/PFI0

Channel Name: Counter 0

0 Kudos
Message 5 of 8
(1,593 Views)

So far, no proposed solutions have worked. I’m posting now because I’ve gotten email from the ‘community’ prompting me to accept a solution. There is none.

 

I’ve also filed a service request.

 

 

0 Kudos
Message 6 of 8
(1,561 Views)

The solution was very simple. Change "PXI1Slot2/PFI0" to "/PXI1Slot2/PFI0". Nobody included NI tech support suggested that.

Message 7 of 8
(1,501 Views)

That's a little quirk of syntax I've noticed in the past but somehow missed this time.  And not a particularly easy thing to discover until you're looking for it.  Sorry about that, wish I could have saved you some time and frustration...

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 8 of 8
(1,488 Views)