From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Counting Boolean Transitions

Can anyone give me an example of how you could count boolean transitions in Labview? I thought it would be easy but haven't fiqured a way to do it.
0 Kudos
Message 1 of 5
(5,106 Views)
You need a shift register, which holds the value of the last iteration of the loop. Then, you can compare it to the current value and see if it changed. This will only detect changes that happen less frequently than the loop's delay. To create a shift register, right click on the left or right loop border and select Create>>Shift Register.

If doesn't help, write some more details about where you're getting your boolean values from and how often do you check them.

___________________
Try to take over the world!
0 Kudos
Message 2 of 5
(5,097 Views)
In a loop, keep the state of the boolean in a shift register. Compare the present value with the stored state. If a change has been made (not equal), increment the counter (also stored on a shift register). See the attached VI

Hope that this helps,
Bob
Message 3 of 5
(5,098 Views)
Thanks! I had been using a shift register, but not correctly. The example using the Select function cleared up a few things for me.
0 Kudos
Message 4 of 5
(5,071 Views)

Many thanks Bob Y

The example you uploaded was a big help to me.

0 Kudos
Message 5 of 5
(4,720 Views)