Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

6624: Wrong value in pulse width measurement

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?

 

0 Kudos
Message 1 of 4
(5,259 Views)

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

--
Peter A.
Field Sales Engineer, NI Germany
0 Kudos
Message 2 of 4
(5,239 Views)

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?

0 Kudos
Message 3 of 4
(5,236 Views)

Per the specifications for the NI 6624, the terminal needs a minimum of 2.2mA current to transition to the ON state.

 

Regards,

Seth B.
Principal Test Engineer | National Instruments
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 4 of 4
(5,209 Views)