LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

One signal front edge to front edge timing

I've been trying for a couple of days to create a program using one signal to detect front edges and the times between them. I would like the times to be added to an accumulated output on the user interface if the time is above 2 minutes and 30 seconds. If the time between edges is less than 2 minutes and 30 seconds then the time is not added to the accumulated value and the timer resets. Attached are 2  time accumulator VIs I've created, but neither are outputting values.

 

Only 1 sensor shining on a reflector is to be used to accomplish goal.

Starting point:

When sensors beam is broken (rising edge) by unit 1, a timer starts

Scenario 1:

When the 2 nd unit passes through and breaks the beam (2nd rising edge) and the time between units was

less than 2 minutes and 30 seconds then the timer resets and starts counting the time between the 2 nd

and 3 rd units. This process will continue to repeat for hundreds of units.

Scenario 2:

When the 2nd unit passes through and breaks the beam (2nd rising edge) and the time between units

was greater than 2 minutes and 30 seconds then the timer will start collecting the time and adding it to

an accumulated value until the 3rd unit passes through and then scenario 1 or 2 will occur again.

 

Example incorporating scenario 1 and scenario 2

Unit 1 passes. Unit 2 passes two minutes later. Result = no time is accumulated. Scenario 1

Unit 3 passes three minutes later. Result = cumulative time of thirty seconds. Scenario 2

Unit 4 passes four minutes later. Result = cumulative time of two minutes. Scenario 2

Unit 5 passes one minute later. Result = cumulative time of two minutes. Scenario 1

So on and so forth. This will occur for hundreds of units.

Download All
0 Kudos
Message 1 of 2
(2,584 Views)

Howdy bkg,

Your post gives a great idea of what you are looking to get your VI to do, but not much detail on “how” is isn’t working currently. Troubleshooting this should be an iterative process of confirming:

 

  • That you are, in fact, registering digital rising edges being received from your device (perhaps confirm this using test panels in NI-MAX). It looks like you have a digital waveform in your “EXAMPLE CODE TEST 1” section.
  • That the timing between edges is being correctly detected. An indicator on the front panel would likely be enough to confirm this behavior.
  • That your method of sorting and displaying these times is working as you intend. This is also one point that I was confused on in your description. Do you intend to have the pulse time measured from the initial “Unit 1” pulse, or do you mean that you are recording the time between “U1 and U2”, then the time between “U2 and U3”?

My recommendation for troubleshooting this is to just break it down piece by piece and make sure that every step of your code is outputting what you expect. Probes are your friend! Best of luck with this.

 

Thanks and have a great day,

 

Sam R.

Applications Engineer

National Instruments

www.ni.com/support

Sam R.
0 Kudos
Message 2 of 2
(2,508 Views)