From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

Counter that only takes one data

Title may be misleading, but what i'm trying to do is counting how many 1's im getting, i have made this counter https://i.gyazo.com/1da22e7ee306654a3d5e11e510cd2c35.png 

Basically i'm getting 1 and 0's from a device, but the counter counts 1 reading and counts 5-6 readings basically it wont stop if the 1 is held.  

i cant figure out a way that the counter only works if the previous data is 0.  

what i thought is i have to record the previous data,and only start if it is zero.  

help thanks, i'm obviously a beginner in labvview

0 Kudos
Message 1 of 8
(2,614 Views)

Hi Hamza,

 

you want to count rising edges?

Use PtByPt-BooleanCrossing…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 8
(2,612 Views)

Hey there Thank you so much for introducing me to this , it should solve my problem! unfortunatly it is not working for me , this is only me testing it with a button, What did i do wrong?.  

When i use the highlight exution, the case structure keeps going to false, even if i tried both true-false and false-true.  

is there something im not getting?

0 Kudos
Message 3 of 8
(2,594 Views)

Difficult to tell, since we see only part of your code. One correction would be to also connect the wire in the FALSE case of your case-structure.

 

Regards, Jens

Kudos are welcome...
Message 4 of 8
(2,577 Views)

Hey there, Thank you for your help.  
First off heres a simpler version that is not working (what am i getting wrong? )

Second: wither i do a true false or not i still get a False in the case , so that wont help but thank you so much for your suggestion

0 Kudos
Message 5 of 8
(2,567 Views)

Hi Hamza,

 

could you please upload your images to the forum?

All I see is:

check.png

BooleanCrossing needs to be used inside a loop…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 8
(2,562 Views)

Here you go, image attached.  

The booleancrossing is inside a while loop for arduino, wouldnt that be perfect for it? since what im getting is readings from the digital pin?.  

Thanks a lot

0 Kudos
Message 7 of 8
(2,556 Views)

Hi Hamza,

 

wouldnt that be perfect for it?

Yes.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 8
(2,553 Views)