Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Measure separation between two signals that may be coincident

Solved!
Go to solution

Hi

 

I need to determine the time period between two pulse signals. I'm going to assume for now that I can get these pulses as TTL.

 

I was initially drawn to the 'Two-Signal Edge-Separation' method using two counter inputs. However, it's quite possible that the signals would be coincident some of the time. Could anyone please answer the following questions:

 

  1. If my signals were coincident, would the 'two-signal edge-separation' measurement be armed on the edge of signal 1 (= same time as edge of signal 2) and continue counting until the next edge of signal 2 as shown below? Or is it re-armed on the next edge of signal 1?

    Coincident Edges.JPG
  2. Is there any other method I could use to log the time between my two pulses? Either as simultaneous counter outputs or something completely different (non-counter method maybe)?

 

(Probably not relevant at this stage, but I will be using Measurement Studio to implement this - hardware as yet unselected).

 

 

Thanks in advnace for any help.

 

 

CAS

0 Kudos
Message 1 of 3
(5,849 Views)
Solution
Accepted by topic author CAS

Hi CAS,

 

The count is not re-armed on the next edge of signal 1 using the two-edge separation mode.  Once the counter is armed the first time, it will continue counting until signal 2 is detected.  

 

 

Alternate Approach 1:

 

If you want the count to reset on every edge of signal 1, you could configure an edge count task (counting the internal timebase) using signal 1 as the count reset terminal and signal 2 as the sample clock.  You still would have uncertainty of which signal is detected first if they occur at precisely the same time, so your measured result might be close to 0, or it might be close to 1 full period of the signal in the case that signal 1 and signal 2 are identical.

 

If you wanted to remove this uncertainty, you can actually delay signal 2 by enabling the PFI filter for the signal 2 terminal.  The original intent of this feature was to be able to add a debounce filter to avoid picking up multiple edges on transitions, but a result of the implementation is that the signal is delayed by some amount of time (between the pulse width guaranteed to pass and the pulse width guaranteed to not pass).  The best case scenario would be X Series using the 100 MHz timebase, you would add 10 ns of jitter but you could delay the signal by an arbitrary amount.  So, you can add the delay and account for it in your reported values, but you would run into problems if the delay caused signal 2 to occur after the 2nd edge of signal 1 (i.e. if the signals were already close to 1 full period apart).  You'd have to have an idea of the maximum frequency of the signals as well as the maximum delay between them to determine if this would work or not.

 

 

Alternate Approach 2:

 

You could use two counters configured as edge count tasks.  Count the fastest internal timebase.  Sample the first counter off of signal 1, and the second counter off of signal 2.  If you arm the counters together and ensure that signal 1 and signal 2 start at the same time, then you can simply subtract your buffered samples of counter 1 from your buffered samples of counter 2 to get an array of differences.

 

 

 

There are a number of other ways you could get similar results, but I think the above 2 suggestions are probably the easiest to implement.  Alternate Approach 1 has the advantage of still only requiring 1 counter and you don't have to worry as much with arming the counters and starting the sampling together (which could be a problem with Alternate Approach 2 if signal 1 and signal 2 are free-running).

 

I would recommend X Series DAQ for this task for the following reasons:

  1. The count reset feature mentioned in Alternate Approach 1 is only currently available on X Series and 2nd Generation cDAQ.  It will hopefully be added in the somewhat near future to M Series with a driver update but I can't make any guarantees.
  2. The 100 MHz timebase on X Series gives a 10 ns resolution to your measurement.  M Series and cDAQ use an 80 MHz timebase (12.5 ns resolution), and E Series uses a 20 MHz timebase (50 ns resolution).
  3. X Series have the most flexible digital filters on their PFI lines and the PFI filters introduce the lowest jitter (compared to M Series and 660x that is--E Series devices do not have digital filters at all).
  4. You didn't mention what frequency you would be using, but X Series have on-board FIFOs which will help you avoid errors from samples being overwritten if your external frequency is relatively fast.
  5. X Series are priced similarly to their M Series equivalents.  All X Series have the same counter features with the lowest cost X Series being the PCIe-6320.

 

Best Regards,

John Passiak
Message 2 of 3
(5,841 Views)

Dear John

 

Thank you for your help. I think that your 'Alternative Approach 2' sounds most suitable for my application - now that I fully understand how the two-edge separation method works.

 

As it's possible that signal 2 can move around and occur before, after and at the same time as signal 1 during measurement, it would not be possible for me to apply a delay to signal 2 and guarantee that the signals would not still be coincident at some point.

 

Thanks again - that's a great solution to my problem.

CAS 

0 Kudos
Message 3 of 3
(5,834 Views)