LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

COUNT

Hello all, I have a small issue that I can't seem to get my head around. I have a boolean that is creating a count. I want to keep the value of the count if the program is stopped for any reason so I eliminated the constant outside the while loop wired to the shift register. I want to have a boolean that will reset the value of the count by the user. I have tried to do an event structure with a property node and  zero wired to it, having the boolean creat a value change. This works in resetting it to zero, but when I start the count it goes back to the last value. I know it's something simple I'm missing. Thanks for help in advance.

0 Kudos
Message 1 of 12
(2,940 Views)

You are only resetting the indicator, not the value in the shift register.

0 Kudos
Message 2 of 12
(2,939 Views)
Message 3 of 12
(2,936 Views)

Outstanding, thank you, that was driving me nuts.

0 Kudos
Message 4 of 12
(2,932 Views)
Now try with a single loop and a single event structure with three frames: Increment, reset, stop.
0 Kudos
Message 5 of 12
(2,926 Views)
Also note that I changed the mechanical action of the buttons. You want latch action, which is true until it is read by the code once, no matter how fast the loop spins or how long you press the button.
0 Kudos
Message 6 of 12
(2,923 Views)

Yeah I did notice the difference, when I reworked mine I forgot to make current the default and it kept going to true and I couldn't figure out why. I'm learning. I will try with the event structure. Thanks again.

0 Kudos
Message 7 of 12
(2,920 Views)

Did I do this correctly? It works but I feel like something isn't right

0 Kudos
Message 8 of 12
(2,911 Views)

That looks pretty good.

 

I would move the terminal for count outside and after the event structure.  Then you won't need the local variable of the count in the other cases.

 

I would eliminate the 100 msec wait in the while loop.  The event structure will control the pacing of the loop.

 

I would disconnect the reset boolean and cycle switch buttons from the stop terminal of the loop.  Though it should behave okay like you have it, there is no reason to connect it.  Logically, hitting either of those buttons should have nothing to do with whether the loop continues or stops.

0 Kudos
Message 9 of 12
(2,904 Views)

As Ravens' already said, simplify! 😄

 

 

0 Kudos
Message 10 of 12
(2,894 Views)