LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

defining button defaults for each run

Is it possible to set a button to switch to a default value (false) everytime a program is either stopped or run again?

My program works in two parts... one part for measuring and obtaining values for the second part and the second part automates a production process. I want to have a switch where the user measures the values, then hits the switch to start the process (also it would act as an emergency off switch if hit again).

I've tried "Make current values default" but that only seems to work if I completely close the vi and reopen it. Mine will be open all the time and I just need it to reset for the next time its run.

I'm using Labview 7.1 on an XP box.

Thanks
0 Kudos
Message 1 of 6
(2,500 Views)
Hi J,

Yes, it is certainly possible to set a button to switch when your program stops, or is run (or at any time during execution that you wish for that matter).

This can be done using what we call property nodes.

To create a property node:

  1. Right click on the Boolean switch from the block diagram

  2. Select "Create"

  3. Select "Property Node"


Now you will be able to place this property node wherever you like on the block diagram. The particular proprty of the control which captures our interest in this case is the "Value" property. To choose the "Value" property, left click on the currently selected property which by default is "Visible" with the left mouse button. Now you can select "Value" from the pop-up.

We need now only to change this property to be a write property (since we are interested in setting the value). To do this you can right click on the "Value" property and select "Change to Write". Now you can right click again on the "Value" property, and select "Create" >> "Constant".

You can then specify whether to turn the switch ON or OFF.

I have attached a simple example which demonstrates the result of following the above procedure.

Good luck with the rest of your application!

Best Regards,

Evan R.
Applications Engineer
National Instruments
http://www.ni.com/support



@jworisek wrote:
Is it possible to set a button to switch to a default value (false) everytime a program is either stopped or run again?

My program works in two parts... one part for measuring and obtaining values for the second part and the second part automates a production process. I want to have a switch where the user measures the values, then hits the switch to start the process (also it would act as an emergency off switch if hit again).

I've tried "Make current values default" but that only seems to work if I completely close the vi and reopen it. Mine will be open all the time and I just need it to reset for the next time its run.

I'm using Labview 7.1 on an XP box.

Thanks

0 Kudos
Message 2 of 6
(2,490 Views)
here is a very simple example of using property nodes. I used led's rather than buttons as they were the first thing I grabbed 😉


Putnam Monroe
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 3 of 6
(2,482 Views)
You want all your controls to go back to their default values, right?
In that case, you need the method "Reinitialize all to default" and not "make current values default".
This should work immdiately.
Also, in general, using property nodes to set the values of controls is not recommended as it forces LV to do this through the user interface thread, which may slow your program down and cause the interface to respond more slowly. You can use local variables or you could have a state machine architecture with an INIT state. Calling that state would simply initialize all the controls you define.

___________________
Try to take over the world!
0 Kudos
Message 4 of 6
(2,463 Views)
0 Kudos
Message 5 of 6
(2,451 Views)
I tried the "Reinitialize all to default" and it didn't work at all. But using the property node method seems to be working, at least on my simple test vi.

Thanks a lot!
0 Kudos
Message 6 of 6
(2,441 Views)