Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Measuring analog input frequency using DAQmx C APIs on PXIe-6341 card

Solved!
Go to solution

Hello,

I'm using Linux DAQmx, and trying to measure Analog Input Frequency using the PXIe-6341 DAQ card.

There is an ANSI-C example for measuring frequency:

    /usr/local/natinst/nidaqmx/examples/ansi_c/Analog_In/Measure_Frequency/Cont_Freq-Int_Clk-SCXI1126

 

However, the call to DAQmxCreateAIFreqVoltageChan   results in the following error:

DAQmx Error: Selected physical channel does not support the measurement type required by the virtual channel you are creating.

Create a channel of a measurement type that is supported by the physical channel, or select a physical channel that supports the measurement type.
Property: DAQmx_AI_MeasType
Requested Value: DAQmx_Val_Freq_Voltage
Possible Values: DAQmx_Val_Current, DAQmx_Val_Resistance, DAQmx_Val_Strain_Gage, DAQmx_Val_Temp_BuiltInSensor, DAQmx_Val_Temp_RTD, DAQmx_Val_Temp_Thrmstr, DAQmx_Val_Temp_TC, DAQmx_Val_Voltage, DAQmx_Val_Voltage_CustomWithExcitation

Task Name: _unnamedTask<0>

Status Code: -200431

 

Does DAQmx support the Frequency function on the 6341 card, or do we have to use the voltage examples and compute the frequency manually ?

0 Kudos
Message 1 of 3
(3,605 Views)
Solution
Accepted by topic author kenstern

AI Frequency is a channel type that was only supported on the SCXI module in the name of the example. 

 

You'll have to use a voltage input channel and compute frequency manually for your device.

Nathan Murphy
Message 2 of 3
(3,589 Views)

Agreed. The SCXI 1126 is the only module that supports the AI Frequency channel type.

 

To build off of what Nathan said, here's a suggestion:

You can use an AI voltage task to acquire your signal and configure an Analog Comparison Event using the DAQmx Trigger properties. The Analog Comparison Event will generate a pulse at a specific level of you signal. You can then use a counter input frequency task to count these pulses and measure the frequency of the signal. This way you are still using hardware to measure your analog signal, instead of extra processing on the host.

 

I don't have an ANSI C example to share, but I think this LabVIEW community example displays the concept above pretty well.

Briana P.
Licensing
Sr SW Engineering Manager | NI R&D
ni.com/support
0 Kudos
Message 3 of 3
(3,570 Views)