Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Determine Time Intervals from External Trigger to Multiple Secondary Triggers

An external device generates a 100 Hz square wave (primary). During each 10 msec period, another device (secondary) generates multiple (say 10 nsec duration) pulses at random times. I want to determine the time, with respect to each primary waveform's leading edge, when each of the secondary pulses occurs.

I envision each 100 Hz leading edge resetting a counter to zero. Then each secondary pulse latches that counter's value into memory. Can this be done using two counters (E series) or are more required (TIO) ? I believe I need a high frequency timebase feeding a counter whose value is latched by the secondary pulses and the counter's count is re-initialized to zero by the primary wavefo
rm ?

For each count latched by the secondary pulses, it is not necessary to know within which specific primary period it belonged to.
0 Kudos
Message 1 of 4
(3,478 Views)
Hi Steve,

It looks like you want to measure the difference between when your 100Hz signal and your >1MHz signals arrive at the terminals of a counter. This is essentially a two signal edge separation measurement. LabVIEW comes with a NI-TIO example that demonstrates how to perform this type of measurement. Help >> Find Examples >> Hardware Input and Output >> Traditional NI-DAQ >> Counters >> NI-TIO.

You would connect your gate signal to your 100Hz signal and you would connect your >1MHz signal to the counter's aux line. The counter application to use is the "two signal edge separation measurement" or the "buffered two signal edge separation measurement". Only the NI-TIO counter/timer chips support this application. Here is the description of the shipping example:
This VI counts rising edges, using an NI-TIO based device (e.g.: 6602). The counter increments its event count everytime a pulse comes into its source input. The counters only increments between the rising edge of the aux line and the rising edge of the gate. The current value of the counter is read when the counter is finished or an error occurs.

INSTRUCTIONS:
1. Enter the device and counter you want use.
2. Optional controls are located on the left side of the front panel. You will have to use your scroll bar to reach these.
3. Connect your signals as described below in I/O CONNECTIONS.
4. Run the VI.

KEY PARAMETERS:
Counter Group Config.vi: task type = two edge separation measurement
Counter Source (NI-TIO).vi: Source Specification
Counter Gate (NI-TIO).vi: Gate Specification
Counter Aux Line (NI-TIO): Aux Line Specification
Counter Get Attribute.vi: armed, TC Reached, count
Counter Control.vi: Program, Reset

I/O CONNECTIONS:
Connect the start signal to the aux line input of the
selected counter. Connect the stop signal to the gate input of the selected counter. If you selected the Source Selection to be "PFI line", connect your event count base signal to the PFI line indicated by "Source PFI line number used". (If you selected "Internal Timebase", no source connection is necessary.)

NOTE: For actual I/O pin numbers, please refer to your hardware user manual.

DAQ VIs USED:
Counter Group Config.vi
Counter Source (NI-TIO).vi
Counter Gate (NI-TIO).vi
Counter Aux Line (NI-TIO)
Counter Get Attribute.vi
Counter Control.vi

There is also a great tutorial on our website. I have included the link below. Hope that helps. Have a good day.

Measuring the Time Between Two Pulses On Separate Lines
http://zone.ni.com/devzone/conceptd.nsf/webmain/1D19C27A104D5EAD86256802007B8AA1?opendocument

To measure all the difference between the 100Hz signal and all your >1MHz pulses you would use a second counter with buffered event count as the application.

The second counter will be setup for buffered event counting and you would put only your >1MHz signal into this one. The timebase on the second counter will be the 80MHz timebase (or 20MHz). This will essentially calculate the time between each successive >1MHz pulse. Therefore, if you know the difference between the 100Hz and the first >1MHz pulse (on the 1st counter), and you know the difference between each successive >1MHz pulse on the second counter then you should have the timing between that 100Hz pulse and all of the >1MHz pulses.

Anyway, hope that helps. Have a good day.

Ron
Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(3,477 Views)
Yes, I wish to measure the time difference between the 100Hz signal and ALL of the >1MHz pulses that follow it until the next 100Hz signal, so only your second suggestion might work. However, I also need to then continue to do this for subsequent 100Hz signals. It's not clear to me how to determine to which 100Hz signal the second counter results would be associated.
0 Kudos
Message 3 of 4
(3,477 Views)
Hi Steve,

They key to this is to use the counter start trigger on the 660x cards. A hardware pulse simultaneously starts all counters configured to start on a trigger. One different suggestion for you is to use 2 counters in the following configuration. 2 counters performing buffered event on your 100Hz signal and your >1MHz signal. This will measure the position of each 100Hz edge relative to a start point with respect to every other 100Hz signal. This is the same logic for the >1MHz signal. Now if you start both counters at the same time (using the trigger), then all your acquired data will be relative to this start point and thus all your signals will be in relation to the same start point. You can then identify the relationship of an
y signal to any other signal.

Hope that helps.

Ron
0 Kudos
Message 4 of 4
(3,476 Views)