LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Increment +1 after Boolean toggle

Trying to increment +1 after Boolean variable toggle.

It should be simple but I got stuck because I need to increment when 1 goes 0 and 0 goes to 1.

Like detects the edge of pulse.

Thanks,

Jo

0 Kudos
Message 1 of 9
(280 Views)

You don't have a lot of details here but it kind of sounds like you need to add an event structure, with a "value change" event on a Boolean control, but with no other context to go on it could be something else that you need.

0 Kudos
Message 2 of 9
(265 Views)

See Counter and Digital Edge Detector

There is a mistake in the falling edge loop. The constant should start with a false.

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
0 Kudos
Message 3 of 9
(227 Views)

You can use a feedback node to compare current to previous. If the are not equal, add one to the counter.

 

Quick draft:

 

altenbach_0-1744958074727.png

 

0 Kudos
Message 4 of 9
(217 Views)

What is the source of the Boolean?

 

If it's hardware, you probably want a anti jitter strategy.

 

If it's a UI, you probably want to use an event structure 

0 Kudos
Message 5 of 9
(200 Views)

You can use the built-in Is Value Changed primitive, or any or it's variants, like the one supplied with the OpenG toolkit. There are differences, namely whether the first value received by the VI returns a True (NI's correctly does, OpenG's does not).

 

littlesphaeroid_0-1744997994348.png

 

_____________
Creator of the BundleMagic plugin for LabVIEW!
0 Kudos
Message 6 of 9
(169 Views)

Sorry i didnt realized that more detailed explanation was needed.

I m reading Temp from the sensor.  Temperature is going thru cycles, up and down.

Have a threshold that produces Boolean output.

Measuring time for True and False cycle.

Writing times for each cycle to array.  Thats why I need increment. 

I start looking to event structure, but I never did it before.  Because examples might not work for this case.

Hope this clarifies the need.

Thanks,

Jo

 

0 Kudos
Message 7 of 9
(64 Views)

Sorry i didnt realized that more detailed explanation was needed.

I m reading Temp from the sensor.  Temperature is going thru cycles, up and down.

Have a threshold that produces Boolean output.

Measuring time for True and False cycle.

Writing times for each cycle to array.  Thats why I need increment. 

I start looking to event structure, but I never did it before.  Because examples might not work for this case.

Hope this clarifies the need.

Thanks,

Jo

0 Kudos
Message 8 of 9
(63 Views)

Using the Boolean crossing point by point from the signal processing palette (ptbypt, other functions).

 

boolean crossing.png

 

Here I'm using a threshold of 0.5 and using the either direction setting.

 

Ben

0 Kudos
Message 9 of 9
(55 Views)