11-25-2009 06:38 AM
Hi,
i have a problem with my PXI-6624 Timer/Counter. I try to measure the pulse width of a signal connected to the AUX port a timer-channel. I use the DAQmx driver in my C# application to access the Timer.
I sample the signal 10 times and calculate the average value. But the array, the driver function returns, sometimes contains a very low value. i.e. when i measure the a pulse width of 50ms, the returned array contains 9x 50ms and 1x 1.5us.
Here is my code:
CIPulseWidthStartingEdge edge = CIPulseWidthStartingEdge.Rising;
// create task
m_objTaskPulseWidth = new Task();
// create channel
m_objTaskPulseWidth.CIChannels.CreatePulseWidthChannel(cmbPortMeasPulseWidth.Text, string.Empty, 0.05, 0.05, edge, CIPulseWidthUnits.Seconds);
m_objTaskPulseWidth.Control(TaskAction.Verify);
// change terminal to AUX
string sTerminal = m_objTaskPulseWidth.CIChannels.All.PulseWidthTerminal;sTerminal = sTerminal.Substring(0, sTerminal.LastIndexOf('/') + 1);sTerminal += "PFI21"; //AUX port of timer 4
m_objTaskPulseWidth.CIChannels.All.PulseWidthTerminal = sTerminal;
// configure timing
m_objTaskPulseWidth.Timing.ConfigureImplicit(SampleQuantityMode.FiniteSamples, 10);
m_objReaderPulseWidth = new CounterReader(m_objTaskPulseWidth.Stream);m_objReaderPulseWidth.SynchronizeCallbacks = true;
// get values
double[] adPulseWidth = m_objReaderPulseWidth.ReadMultiSampleDouble(iSamples);
Is there a fault in my code, in the configuration of the timer, or where?
11-26-2009 03:58 AM
Hi thesam,
your configuration seems OK, although you don't give a range for measurements (your minimum value equals your maximum). You should adjust that.
Also, what happens when you use the GATE (standard) terminal instead of the AUX terminal?
Have you tried creating a task in MAX (Measurement and Automation Explorer) and run it there? What DAQmx version do you have installed?
Thanks and best regards,
Peter
11-26-2009 04:50 AM
Hi Peter,
thanks for your answer.
I also tried other ranges. It is the same.
Now, i think it is a physical problem. I just tried the GATE terminal and it works. In series to the GATE terminal there is a resistor of 470R connected on my PCB. The AUX terminal has a resistor of 4k7 (because of some other reasons of my system). I changed the 4k7 to a 470R resistor in front of the AUX terminal and it works too.
Is there a minimum input current the terminal needs?
11-30-2009 10:21 AM
Per the specifications for the NI 6624, the terminal needs a minimum of 2.2mA current to transition to the ON state.
Regards,