03-09-2016 09:59 AM - edited 03-09-2016 10:22 AM
Basically, here's my issue:
I'm trying to get the time between two pairs of rising edges. I'm using a cDAQ 9171 with an NI 9402. Each input is connected to a velocity gate which outputs a TTL signal, and I'm trying to capture the time between a pair of inputs, such as the time between an input on line0 and the time between an input on line1. I'm trying to make the code so that it detects each input and gives a time between two pairs of edges; the caveat is that this is going to be used for calculating the velocity of a bullet, so it needs to be as fast and accurate as possible.
What I'd like the program to do is wait until the first rising edge triggers it, and get the number of samples up until that point. Then, once the second input triggers, get the number of samples up until the second input, and so on for the third and fourth inputs. From there, I know I'd need to subtract the sample values for each pair and divide by the 80 MHz clock. My problem is that this code doesn't trigger until it's already had one input, and the counter doesn't output each event after they happen. Ideally, the program should be continuous, so it can spit out the time, wait until the next shot, then spit out the next time, etc.
Edit: attached a file saved for LabVIEW version 10.
I should also add that I'm fairly new to LabVIEW, so I'm not entirely sure how everything works yet.
03-09-2016 12:14 PM
Here is a useful article that I found. Please read and let me know if you have any further questions.
http://digital.ni.com/public.nsf/allkb/4F5002129C5E720D86256AC30079A391
03-09-2016 01:08 PM
Conceptually, this is exactly what I'm looking for. But how would I map the digital input lines to this? All I can access when I try to use a property node is the PFI lines and other onboard things, not anything from port0/lineX
03-09-2016 03:56 PM
Please take a look at the following example. When you open the program, there will be a tab to select 2 Edge Separation. Select the input terminals you would like to measure edge separation between. Let me know if this helps!
03-11-2016 09:48 AM
Joe,
Unfortunately, with my hardware it seems that I can't use the two-edge separation, hence the change detection setup that I have in my diagram.