03-12-2025 03:04 AM
Hi, I have a large VI which effectively connects to a DAQ and performs testing. When testing is complete, I want a batch counter to increment +1. This works fine.
I am using a SR and want to be able to somehow set the SR to 0.
I have tried an event structure which sets the counter display to 0, but this works only until the next cycle and the the SR is displayed again. I imagine this is because I am not affecting the SR at all, merely the display temporarily.
I cant think of another way to affect the SR from within the while loop in which it resides.
I thought that using an SR was the simpliest way to get the counter working, but of course I welcome other ideas.
Again, all I want is a counter that increments if an input is True, a display for the counter, and a button which can reset the counter (in my example I have used 3 to see if my reset actually works).
Any help is greately appreciated.
I have reproduced a simplier version of my VI and can be seen below (and attached).
Using Labview 21
Solved! Go to Solution.
03-12-2025 12:02 PM - edited 03-12-2025 12:02 PM
@EdenR wrote:
Hi, I have a large VI which effectively connects to a DAQ and performs testing. When testing is complete, I want a batch counter to increment +1. This works fine.
I am using a SR and want to be able to somehow set the SR to 0.
I have tried an event structure which sets the counter display to 0, but this works only until the next cycle and the the SR is displayed again. I imagine this is because I am not affecting the SR at all, merely the display temporarily.
I cant think of another way to affect the SR from within the while loop in which it resides.
I thought that using an SR was the simpliest way to get the counter working, but of course I welcome other ideas.
Again, all I want is a counter that increments if an input is True, a display for the counter, and a button which can reset the counter (in my example I have used 3 to see if my reset actually works).
Any help is greately appreciated.
I have reproduced a simplier version of my VI and can be seen below (and attached).
Using Labview 21
Think about your logic here. What good does it do to set the counter display to zero? Don't you want to set the counter itself to zero?
03-12-2025 12:15 PM
In order for this to work, you'll need a state machine where one state is "reset the counter".
03-12-2025 02:23 PM
No need for the Event Structure here. Just use the same logic you used for the increment, but with the reset. I would also recommend using the Select? primitive instead of the Case Structure as it is easier to read (does not hide functionality).
03-13-2025 02:10 AM
yeah so it took me a while to realise I am stupid and just used a select, as you said (but within a case structure).
Not sure why it took me so long to think of doing this, but I appreciate your input too!
03-13-2025 02:14 AM
Hi Eden,
@EdenR wrote:
Not sure why it took me so long to think of doing this, but I appreciate your input too!
Why do you hide the reset feature inside the case structure?
Does the reset depend on another boolean condition?