LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

counter for boolean transition and reset

i am trying to design a counter that will
 
(a)count 1 for first high/true
(b) count 2 for second high/true
(c) reset to 0 after counting second high/true.

NI Software :
LabVIEW  version 7.1.1
I am pasting a reply from NI support engineer and also attaching a file of what I tried to do.
 
Thank you for contacting National Instruments.
I think this task is a great challenge. To solve it, I think you'll
need to use a while loop with a sift register and a case structure. You can use
the shift register to keep your count. Then once your count is equal to
two, reset the shift register to zero. I think that should get you squared
away.

0 Kudos
Message 1 of 3
(2,886 Views)

Hello

Here is one that does this. I'm not completely sure how and when it should be reset. My version resets when it reaches 2 (outputs zero for FALSE input) and is incremented again for TRUE input. For continous TRUE input, the output will only be 1 and 2. A zero is only seen when incremented to 2 and a FALSE input comes as input.

The counter_mod is the counter and the main is just to see if it worked.

Message 2 of 3
(2,869 Views)
Here is the main.vi (it was only possible with one single attachment)
Message 3 of 3
(2,867 Views)