From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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 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,609 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,592 Views)
Here is the main.vi (it was only possible with one single attachment)
Message 3 of 3
(2,590 Views)