Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Routing Counter Gate to PFI0 on USB-6216 in .NET C#

When I tried to round Ctr0Gate to PFI0 a runtime error occurs indicating that the resources are already in use by another route. Anybody have any ideas? Thanks.

 

 

myTask = new Task();

NationalInstruments.DAQmx.DaqSystem.Local.ConnectTerminals("/Dev1/PFI0", "/Dev1/Ctr0Gate");                myTask.CIChannels.CreateFrequencyChannel("/Dev1/Ctr0",   "Measure Dig Freq Low Frequency",                     Convert.ToDouble(minValueTextBox.Text),   Convert.ToDouble(maxValueTextBox.Text), edges,                     CIFrequencyMeasurementMethod.LowFrequencyOneCounter, 0.001, 4,  CIFrequencyUnits.Hertz);

myCounterReader = new CounterReader(myTask.Stream);

0 Kudos
Message 1 of 6
(6,012 Views)

Hi bionicbuider,

 

The ConnectTerminals function is not going to be the best way to go about this. Instead, I recommend using the frequency input terminal

(NationalInstruments.DAQmx.CIChannel.FrequencyTerminal) to set the input terminal to PFI0. That way, it will modify your task instead of your hardware.

 

Regards,


Daniel H. 

0 Kudos
Message 2 of 6
(6,005 Views)

Hi Daniel,

 

Thanks.

 

Even though that class exists in the documentation is does not exist in my NIDAQmx 9.4 installation. I can only get to(NationalInstruments.DAQmx.CIChannel). Maybe I should set that to something? The examples say it is easy to redirect PFIs but do not show how. Are there any examples on how to do this with C#?

 

Thanks again.

 

Bionicbuilder

0 Kudos
Message 3 of 6
(6,003 Views)

Hi Bionicbuilder,

 

Sorry about the faulty info. After you create your frequency channel, you can use "CIChannels.All.FrequencyTerminal = "Dev1/PFI0";" to set the input terminal for the counter in that task. 

 

As for examples, this document shows you where you can find different types of examples if you have installed them. If you don't have the examples installed, this document will show you how to install them.

 

Regards,

 

Daniel H.

 

 

Message 4 of 6
(5,996 Views)

Daniel,

 

That works great, would have never figured it out. Thanks.

 

Bionicbuilder.

0 Kudos
Message 5 of 6
(5,991 Views)

Bionicbuilder,

 

No problem.


Daniel H.

0 Kudos
Message 6 of 6
(5,988 Views)