Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

generating TTL pulse, acquiring a TTL pulse and measuring time difference

Hi,

I am using PCI 6259 and Labview 8. I would like to send out a TTL pulse, be able to acquire it, acquire another digital (TTL) signal and then measure the time difference between the two pulses. I have tried using the measure time difference between two pulses vi, but since this requires using both counters, I encoutner error with the resources being reserved by one of the counters. Is there a way to get around this problem?

Aniket
0 Kudos
Message 1 of 6
(9,342 Views)

I'm not near hardware to verify for sure, but I *think* the M-series boards' counters support a mode called something like "two edge separation" measurement.  This only requires 1 counter which detects both edges.

So, generate a pulse with ctr0.  Setup ctr1 to measure "two edge separation", using Ctr0 output as the earlier edge and your external response pulse as the later edge.

Another sneaky option would be to setup ctr1 for buffered period measurement.  Ctr0 output would act as an "Arm Start" trigger and your external response pulse would be the Sample Clock.  The 1st (and only? -- depends on your device) measured "period" would be the time from the trigger to the first response edge.

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 6
(9,337 Views)
Hi Kevin,

Thanks very much for the reply. I was actually using the two-edge separation routine. This is how I set things up:
1. ctr0 generates a TTL pulse. I route this to the Gate input of ctr1, I have tried both software routing and hardware connection.
2. The second pulse, which is from a camera, arrives on the Aux input of ctr1.
However, when I run the vi, the I see an error like this:
Specified route cannot be satisfied, because it requires resources that are currently in use by another route.
The full message looks like this:
Property: CI.CtrTimebaseActiveEdge
Source Device: Dev1
Source Terminal: 80MHzTimebase
Destination Device: Dev1
Destination Terminal: Ctr1Source

Required Resources in Use by
Source Device: Dev1
Source Terminal: PFI12
Destination Device: Dev1
Destination Terminal: PFI4

PFI12 being the output of ctr0 on this board and PFI4 is the gate input of ctr1.

Then I tried routing the 20MHz timebase signal to the ctr1 source. But that did not work either. The same error resulted. In retrospect, it is the same issue. So, I am kind of stuck at that point. Let me look into your second idea.

Aniket

0 Kudos
Message 3 of 6
(9,331 Views)
Aniket,

Can you please post the code you are using for this?

Thanks,

Abhinav T.
Applications Engineering
National Instruments India

LabVIEW Introduction Course - Six Hours
Getting Started with NI-DAQmx
Measurement Fundamentals
0 Kudos
Message 4 of 6
(9,305 Views)
Abhinav,

Thanks for your interest. Here are two vis I used:
1.Generate_pulse_meas_separation_3: routes the output of ctr0 to the gate input of ctr1 through the route signal vi and then performs the measurement.
2. gen_pulse_meas_separation: this performs the measurement while I hardware route the relevant signal.

Aniket
0 Kudos
Message 5 of 6
(9,296 Views)

Aniket,

I played around with your VI and have attached a much cleaner version of your code. The only thing I had to do was connect another TTl signal to PFI9 and it measured the seperation between the channels.

 

Abhinav T.
Applications Engineering
National Instruments India

LabVIEW Introduction Course - Six Hours
Getting Started with NI-DAQmx
Measurement Fundamentals
0 Kudos
Message 6 of 6
(9,277 Views)