LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Button Reset Triggering

(Note: I am relatively new to LabVIEW so some of my "understandings" may be muddled or, simply, incorrect.  I appreciate any patience required for assistance.)

 

In performing data acquisition work, I make use of 2 manually-programmed buttons (plus the "Start VI" button within the toolbar) - they are:

1.) "Press to Record" button which displays "Recording" when pressed, and

2.) "Press to Stop" which displays "Stopping" when pressed.

 

In stopping the VI, the process is as follows for the Stop button:

Press the "Press to Stop" button,

button displays "Stopping",

VI stops,

button display resets to displaying "Press to Stop". 

 

My problem lies within the Recording button not being reset which, after restarting the VI a second time, initiates recording immediately since the button is still "pressed". 

 

I am unsure if the behavior of the Stop button is inherently built into it as it is a defined control within LabVIEW, so I may be attempting to overcomplicate something impossible to achieve (however, removing human-error is, generally, worth the complication).

 

What I need is a way to reset the Recording button once, and only when, the Stop button is pressed.  For right now, I'd rather the rest of the indicators/controls/graphs/etc. NOT be reset - ONLY the Recording button.

 

I'm working in LabVIEW 2017, for what it's worth.

 

Any help or direction pointing would be greatly appreciated.  I will provide any other required information I can (and that I'm allowed to due to company policy).

 

Thank you and have a great day.

0 Kudos
Message 1 of 9
(3,537 Views)

One simple way of doing this would be use a Reinitialize to Defaults invoke node in your VI.

Are you using an Event Structure? If so you can also add a local variable to reset your record button when the Stop is pressed.

Post your VI if you want more specific help.

0 Kudos
Message 2 of 9
(3,529 Views)

@whskytngofox wrote:

... (plus the "Start VI" button within the toolbar) - they are:

1.) "Press to Record" button which displays "Recording" when pressed, and

2.) "Press to Stop" which displays "Stopping" when pressed.

...

VI stops,

button display resets to displaying "Press to Stop". 


Without seeing your code, we cannot really help, but what you need is a simple state machine architecture. A stopped VI is only useful during development (that's why it is called edit mode). Once the VI is actually used in the field, it should be set to "run when opened" and never stop until it is closed. You do this by having an "idle" state at startup and whenever nothing else needs to happen. As user interaction occur, it will go to different states according to the requirements.

 

Please show us your code. Thanks!

0 Kudos
Message 3 of 9
(3,513 Views)

@Taki1999 wrote:

One simple way of doing this would be use a Reinitialize to Defaults invoke node in your VI.


I was attempting to use this, however am unsure where to connect it.  My first attempt was to place it inside the While loop.  However that resulted in a constant "resetting" of all values across the VI.

 


@Taki1999 wrote:

Are you using an Event Structure? If so you can also add a local variable to reset your record button when the Stop is pressed.


I am not.  I have a while loop surrounding my thermocouple/pressure transducer inputs which then go to the graph displays and numerical displays.  Finally everything gets dumped into an LVM file.  All of this is within a while loop.

 


Post your VI if you want more specific help.


Currently checking with supervisors on legality of sharing it.  I was just attempting to see what I could find out immediately and revisit the issue should it require much more time and/or work.

 

Thank you for the help and suggestions.

0 Kudos
Message 4 of 9
(3,484 Views)

altenbach wrote:

 

Without seeing your code, we cannot really help, but what you need is a simple state machine architecture. A stopped VI is only useful during development (that's why it is called edit mode). Once the VI is actually used in the field, it should be set to "run when opened" and never stop until it is closed. You do this by having an "idle" state at startup and whenever nothing else needs to happen. As user interaction occur, it will go to different states according to the requirements.

 

Please show us your code. Thanks!


Checking on the legality of sharing the code.  However, I can share that I work with R&D and we run tests that occur for 15secs-15mins, then the computer gets shut down and hauled back to the lab.  An idle state would be great if the computer was left on and in the location.  However we literally run out to the site, turn on the comp, take the data, shut off the comp, and walk back. 

 

I agree with you completely that in a different case, your suggestion would be correct.  For my specific needs, however, I am just looking for a way to reset a button status so if someone besides myself runs the tests and software, they don't have issues with recording the data.

 

(There's a chance I'm not completely understanding your suggestion as LabVIEW is relatively new to me, however I believe I get the gist of what you're saying.  If I am wrong, please let me know.)

 

Thank you for the suggestion regardless and if I find out I can share some/all of the code, I will.

0 Kudos
Message 5 of 9
(3,481 Views)

Because you cannot tell if the users randomly changed buttons while the VI is in edit mode, and also things cannot reset properly if the VI is aborted, you need to set the desired controls values first thing when the program starts. This can be done using local variables and you need to ensure that it happens before the rest of the code executes.  (If you only reset them when the program stops, nothing can be guaranteed next time the code runs.)

0 Kudos
Message 6 of 9
(3,467 Views)

@altenbach wrote:

Because you cannot tell if the users randomly changed buttons while the VI is in edit mode, and also things cannot reset properly if the VI is aborted, you need to set the desired controls values first thing when the program starts. This can be done using local variables and you need to ensure that it happens before the rest of the code executes.  (If you only reset them when the program stops, nothing can be guaranteed next time the code runs.)


I hadn't looked at it like that - thank you.  It appears I need to reassess my outlook on this.

0 Kudos
Message 7 of 9
(3,463 Views)

@whskytngofox wrote:

@Taki1999 wrote:

One simple way of doing this would be use a Reinitialize to Defaults invoke node in your VI.


I was attempting to use this, however am unsure where to connect it.  My first attempt was to place it inside the While loop.  However that resulted in a constant "resetting" of all values across the VI.

 


It goes before the while loop and you should wire the error cluster to your while loop.

0 Kudos
Message 8 of 9
(3,458 Views)

@Taki1999 wrote:

It goes before the while loop and you should wire the error cluster to your while loop.


Thank you.  Once I get back to the computer, I will look into this further and play around with it a bit.

0 Kudos
Message 9 of 9
(3,441 Views)