Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Measure Frequency C#

Hi,

 

There was a question posted earlier asking about measuring frequency using C# and a multifunction DAQ that got my interested in th e topic.

I found this example using a counter but it throws an error at startup.

 

https://decibel.ni.com/content/docs/DOC-16563

 

There are 2 tasks, an AITask and a counter task.

The error occurs when trying to setup the input frequency terminal.

 

counterTask = new Task();
            
                counterTask.CIChannels.CreateFrequencyChannel(counterComboBox.Text, "",
                    Convert.ToDouble(minValueTextBox.Text),
                    Convert.ToDouble(maxValueTextBox.Text), edge, 
                    CIFrequencyMeasurementMethod.LargeRangeTwoCounter, 0.001,
                    (long)divisorNumericUpDown.Value, CIFrequencyUnits.Hertz);

                counterTask.Timing.ConfigureImplicit(SampleQuantityMode.ContinuousSamples, 1000);

                // Setup the Counter Input Frequency Terminal to be the Start Trigger from the AI Task
               counterTask.CIChannels.All.FrequencyTerminal = aiTask.Triggers.StartTrigger.Terminal.ToString() ;

 

Here's the Error

 

Error 1 'NationalInstruments.DAQmx.StartTrigger' does not contain a definition for 'Terminal' and no extension method 'Terminal' accepting a first argument of type 'NationalInstruments.DAQmx.StartTrigger' could be found (are you missing a using directive or an assembly reference?) 

 

I'm using Visual Studio 2008, Measurement Studio 2008 Ver 8.5, DAQmx 9.5.5 and NET 3.5.

 

Am I missing something?

 

Thanks

 

Curt

0 Kudos
Message 1 of 4
(6,781 Views)

Hi Curt

 

Do you have DAQmx properly installed? Meaning that you should install it after you install VS and MS, in order to install the DAQmx .NET Support? The easiest way to see if the .NET support is installed is to go  and try to run a built in example  in C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples\DotNET4.0, are you able to run any of this examples without errors?? 

Chris S.
0 Kudos
Message 2 of 4
(6,761 Views)

Hi Chris,

 

Thank for the reply.

 

This is the only example that doesn't work.

 

Curt

0 Kudos
Message 3 of 4
(6,747 Views)

Hi Curt

Do you have the proper references included in your project? I am able to run this code as it is with no errors. You should see NationalInstruments.DAQmx under the references of your project.

 

This reference is in this path. 

 

C:\Program Files (x86)\National Instruments\MeasurementStudioVS2010\DotNET\Assemblies\Current\NationalInstruments.DAQmx.dll

 

regards 

Chris S.
0 Kudos
Message 4 of 4
(6,731 Views)