LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Counting Boolean Changes in a SubVI Preferrably Without Polling

I've got a photoeye that monitors the position of a lift. The photoeye defaults to always being true but turns to false when passing over  photoreflectors positioned along a line. This way the lift's current position can be deteremined. I've got the program to move the lift, but I need to signal the lift to stop moving after a certain number of photoreflectors have been passed.
 
I tried counting the number of times that the true value turns false by using a loop with a timer, but the lift moves at different speeds and sometimes the lift needs to stop for a minute and the photoreflector is recording a "false" every 700ms making the lift think it has moved when really it is just sitting there.
 
So anyways, how can I get the program to only loop again when the value has indeed gone from true to false instead of polling it?
 
Thanks gurus! This code goes into a subVI and I have attached the actual subVI. And I know globals are back, I'm hoping to pass a reference but globals are in my example for testing purposes. Thanks folks!
 
-- Jason
 
 
 
 
0 Kudos
Message 1 of 4
(2,938 Views)

Place the current boolean in a shift register, then use an "implies" from the boolean plaette to compare the old and new value at each iteration.

Check the truth table in the context help for the desired outcome.

...or simply use compound boolean node as follows:


(EDIT: see next post.)

Message Edited by altenbach on 03-23-2007 12:27 PM

Message 2 of 4
(2,933 Views)
Sorry, I recycled the wrong old picture above. Correct is:

Message Edited by altenbach on 03-23-2007 12:26 PM

Message 3 of 4
(2,923 Views)
Thanks Altenbach! I'll try that when I get back to work on Monday. I have this fear that the sensor is "pulsing" rapidly between off and on when passing over a reflector (so instead of registering one move, it's registering several)  and that is why my method using time isn't working, but this method should let me check for that as well. Have a great weekend!

-- Jason
0 Kudos
Message 4 of 4
(2,904 Views)