Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Urgent Help!! Frequency Measurement on AI

I am using the 6022 DAQMx card and I am reading in a signal on AI0. Can anyone provide me a CODE that would determine the frequency of the incoming signal. I don't have a lot of time to figure out how to write the code. Please help...using c#
0 Kudos
Message 1 of 6
(4,041 Views)
E-Man,
NI doesn't, as far as I know, have a 6022..Is it a 6023 maybe ?
Given that, there are different ways you can measure frequency.

Use the counter instead of AI:
(1) Examples under MeasurementStudio\DotNET\Examples\DAQmx\Counter\MeasureDigitalFrequency

(2) You can use AI with DAQmx to measure frequency directly on devices that support it.
E.g. An SCXI 1126 supports using an AI channel to measure frequency.
Example under MeasurementStudio\DotNET\Examples\DAQmx\AnalogIn\MeasureFrequency.
An easy way to find out if your card supports creating a frequencyVoltage measurement, is to go to Data Neighbourhood in MAX, and create an AnalogInput task, that measures Frequency. If you have a device that supports this it will work, else it will tell you that no supported devices were found. The 6023 does NOT support this.

(3)Another way to calculate frequency is by using the MeasurementStudio analysis functions explained in this thread
You may have to use this approach to measure your frequency.

Hope this helps.
Nandan Dharwadker
Staff Software Engineer
Measurement Studio Hardware Team
0 Kudos
Message 2 of 6
(4,019 Views)
Would using a counter ctr0 give the same output as an AI channel. The input signal is sinusoid. How would the counter work with that. That seem to be my only option because I don't have the SCX-1126 and using the peak detector is a real pain (never worked). My card is 6023. Help
0 Kudos
Message 3 of 6
(4,009 Views)
You should be able to use the counter example i mentioned in the previous post...
You could use MeasurementStudio\DotNET\Examples\DAQmx\Counter\MeasureDigitalFrequency\ MeasDigFreq_LowFreq1Ctr example.
You will have to connect your signal to the source pin of the counter you are going to use.
This should work.
Nandan Dharwadker
Staff Software Engineer
Measurement Studio Hardware Team
0 Kudos
Message 4 of 6
(4,003 Views)
actually the card I am using is PCI-6221...can I use the counter on this to measure frequency of an analog signal
0 Kudos
Message 5 of 6
(3,976 Views)
Hello E-man,

The PCI-6221 does not support analog triggering. Multifunction DAQ devices that support analog triggering contain an internal digital signal that is high whenever the trigger channel meets the specified trigger condition. However, you can always acquire your analog signal and analyze it in software to determine its frequency. To learn more about how to use analog triggering to measure the frequency of an analog signal using counters refer to following tutorial.

Regards,

Luis Navarro
0 Kudos
Message 6 of 6
(3,961 Views)