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: 

boolean signal counter

Solved!
Go to solution

Hi

 

I found similar program about that i want but I failed to insert it into my VI, than...... I need a counter that indicate me how many times the boolean Led switch-on .

 

My VI is attached

 

Thanks all

0 Kudos
Message 1 of 12
(5,923 Views)
comming soon

"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 12
(5,914 Views)

I modified your code by:

 

  1. Added a shift register to maintain the current Count of "Siganl"=True
  2. Added a boolean case structure to increment the value in the shift register only when "Siganl"=True
  3. Added a numeric indicator to display the updated shift registers value.
  4. Cosmetic changes to improve apperances - I assume you stripped outsome additional functions however you may want to review the style guide here

"Should be" isn't "Is" -Jay
0 Kudos
Message 3 of 12
(5,907 Views)

Jeff, your code is not correct, because it generates multiple counts for each square wave. I think the OP only wants to count low-high transitions.

 

You need two feedback nodes (or shift regsiters), one for the boolean state and one for the counter.

 

Here's a quick modification, there are many ways to do all that.

 

Message Edited by altenbach on 01-23-2010 11:59 AM
Download All
Message 4 of 12
(5,888 Views)

Your right!

 

I was counting iterations where Siganl was true.

 

 

 

I mis-interperated the post If the OP only wants to count transitions


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 12
(5,878 Views)
Solution
Accepted by Teo_CF
implies.png

Jeff Bohrer wrote:

Your right!

 

I was counting iterations where Siganl was true.

 

 

 

I mis-interperated the post If the OP only wants to count transitions


this works pretty well (reverse the inputs to Implies and init the sr T to count negative transitions)


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 12
(5,872 Views)
psstimplies2.pngsame thing but fewer clicks Smiley Wink

"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 12
(5,871 Views)
implies3.pngHmmmm Snippet cut off the invertSmiley Mad

"Should be" isn't "Is" -Jay
Message 8 of 12
(5,863 Views)

I used the compound node instead of implies because I also needed to invert the output in this specific implementation. 🙂

 

(Of course if you use a case structure, you have a choice of what you do in the false or true case) 😉

Message 9 of 12
(5,860 Views)

Thank you very much for helping me guys!!

 

See you next times!!

0 Kudos
Message 10 of 12
(5,823 Views)