LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Comparing two elapsed timer readings

Hi everyone,

 

I'm a new user of Labview, so I'm teaching myself as I go along really. I've come up against a problem though. I'm trying to compare two timer readings from elapsed timers. Eventually I am hoping to swap these timers for a pair of light beams inputted through a DAQ chassis. Initially though I wanted to get the content of my program correct, without having to have the equipment connected to my laptop.

 

I have attached my progress so far, apologies if my query has an obvious solution. As I say I'm a bit of an beginner! How would I take the two elasped timers log the times found off the timers, compare which one has a greater value and consequently start a new timer depending on this. I would then like to log this time in data form.

 

I've tried to compare the two elasped timers with greater than booleans etc but I cant seem to get it to work?

 

As I say I hope to use this idea in a time gate sort of application where depending on which light beam is broken first depends on which timer is started. Hope my explanation is clear.

 

Any help is much appreciated,

 

Thanks very much!

 

 

0 Kudos
Message 1 of 2
(2,187 Views)

PT-

Looking at your code you have a few problems that you will need to address.  Read the LabVIEW help section titled "Caveats and Recommendations when Using Events in LabVIEW."  You have some latching booleans controls that are incorrectly placed.  The terminals should be in the event case that handles the value change event.  

 

Why two event structures?  One structure is a better Idea you can handle all your events with 1 loop (and avoid stopping the loops independantly- this can lead to a condition where the vi becomes unresponsive.

 

The lower loop compares the start times to two different timestamps.  This is introducing potential errors since there is timing relationship between the calls to the system timer.  and the lower case structures are rather insane- in english they resolve to "if started return how long its been since started else return 0"  Check the NI website there is a CLD practice exam solution (Car Wash) that has a pretty good example and discussion of using the elapsed timer express vi.  It might point you in a better direction than where you are going.

 

Why not use the time terminals in the event structure?  thats the time the event fired.  But, you might want the time the event was handled I don't Know-  (hint-comment your code and write SOMETHING in the vi documentation.  Eventually you'll be writing more complex code so start developing good habits now)  (good habits--)  

 

Come on back when you've looked at some of the examples and I'ld be glad to help you more.  

 

 

 

 


"Should be" isn't "Is" -Jay
Message 2 of 2
(2,144 Views)