Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

How to measure two edge separation on PFI line

Hello,
 
I need to measure time (in micro sec) between two pulses on the PFI-0 line using C++.Net.  I am trying to program on the PCI 6250 device.  I have old codes that I used on the PCI MIO 16E to do the work.  Now that we change the data acquisition card to PCI 6250 (m series) and I am trying to convert this code to run on the m series.. I looked at several example codes such as meas2edgeseparation but this code does not allow me to set my source to be PFI0 line.  Now I looked at an example called "countDigitalEvent_Buffered_Continuous_ExtClock" but this example just counts the pulse and does not give me the time between the pulses.  I am very new to the whole DAXmx code Please help!! 
 
Previous codes that ran on PCI MIO 16E:
m_CWCounter.Reset();
 ::Sleep(10);
 // configure the device and counter
 m_CWCounter.SetDevice(1);
 m_CWCounter.SetCounter(0);
 m_CWCounter.SetGateSource(5); // PFI line
 m_CWCounter.SetGateSignal(0);
 m_CWCounter.SetMeasurementType(cwctrPulsePeriodRisingEdge);
 // set the intial count value to 0
 m_CWCounter.SetInitialCount(long(0));
 
 // configure and start the counter
 m_CWCounter.Configure();
 m_CWCounter.Start();
 
Thanks,
Yajai.

0 Kudos
Message 1 of 2
(3,646 Views)

Hi Yajai,

You've got the right idea about working from an example. The Meas2EdgeSeperation is actually a C# example - does that matter for you? You can program in C# using the Managed .NET Class, C++ only unmanaged is supported. If you want to use C++, you'll want to use the Two-Edge SeperationBuff-Cont example under C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Counter\Measure 2 Edge Separation\Two Edge Separation-Buff-Cont. You can set the input terminals using the DAQmxSetCITwoEdgeSepFirstTerm() and DAQmxSetCITwoEdgeSepSecondTerm(). Check out the DAQmx C Reference Help for info on those functions.

If you are using Managed in C#, then you'll still want to set those properties; TwoEdgeSeparationFirstTerminal and TwoEdgeSeparationSecondTerminal are properties of the CIChannel class. I always end up referencing the NI Measurement Studio Help when working with the Managed Classes.

Hope this helps,

Andrew S. 

National Instruments 

0 Kudos
Message 2 of 2
(3,635 Views)