ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Count Boolean True's

Solved!
Go to solution

I'm trying to create a simple counter when a boolean value is true. If I was writing line code, I would simply say that once SAVE is TRUE, then COUNT = COUNT + 1, else, COUNT = COUNT, and then drop out of the loop.

 

Attached is the scrren shot of what I have. The problem is the counter keeps counting until the SAVING variable goes off. I just want it to increment by one. I've tried multiple ways of doing this, however, 2 hours later and still no avail.Capture.JPG

0 Kudos
Message 1 of 6
(8,913 Views)

I used a while loop to wait for a user response.  Otherwise, the loop is not necessary.

 

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 2 of 6
(8,905 Views)

This gives you the option to reset the counter on the fly and it will reset on the first call. 

 

Example_VI_BD.png

aputman
0 Kudos
Message 3 of 6
(8,899 Views)
Solution
Accepted by topic author Superdude_123

@Superdude_123 wrote:

I'm trying to create a simple counter when a boolean value is true. If I was writing line code, I would simply say that once SAVE is TRUE, then COUNT = COUNT + 1, else, COUNT = COUNT, and then drop out of the loop.

 

Attached is the scrren shot of what I have. The problem is the counter keeps counting until the SAVING variable goes off. I just want it to increment by one. I've tried multiple ways of doing this, however, 2 hours later and still no avail.Capture.JPG


I hope this isn't homework.

 Capture.png EDIT: OOPS

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 6
(8,896 Views)

Hi,

 

LabVIEW comes with a ready-to-use PtByPt-BooleanCrossing function, which makes it easy to count (rising) edges of boolean signals...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 6
(8,880 Views)
@GerdW wrote:

Hi,

 

LabVIEW Full or Pro (not in Base or Home) comes with a ready-to-use PtByPt-BooleanCrossing function, which makes it easy to count (rising) edges of boolean signals...

 

Smiley Sad NI__PtbyPt_lvlib_Boolean_Crossing_PtByPtd3.pngNI__PtbyPt_lvlib_Boolean_Crossing_PtByPtd4.png Very Sad Implies 



"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 6
(8,868 Views)