LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Resetting Switches and Buttons

Hello,

 

I have a vi which uses three initial switches to select an input. The switches activate once pressed and then stay pressed even when the vi is stopped. Also, I have a stop button wired into local variables so I cannot set as a latch as I would want to. If I set the initial three switches as latches then it is difficult for the user to see that a button has been pressed.

 

So the problem I have is that when I stop the vi with the stop button, this button stays pressed. I cannot set the stop button as a latch because it is not allowed in Labview with local variables. The next person who comes along will not see that the stop button is pressed and start the program only to find that the stop button is pressed and some sort of loop will happen.

 

Is there a way of when starting the vi that teh select buttons and stop button will default to the initial positions.

 

Nevica

Message Edited by nevica on 08-17-2009 04:06 AM
Message Edited by nevica on 08-17-2009 04:10 AM
0 Kudos
Message 1 of 24
(7,103 Views)

You need to create a value property node for each variable and set a value of false. You can, then, use the error out of the property nodes and wire them to the while loop. This will ensure that the property nodes execute before the while loop.

 

You should start having a look at the State Machine Design Pattern (File -> New.. and look in Design Patterns).

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 2 of 24
(7,085 Views)

Hi Adnan,

 

Thanks for your reply. Could you please be more specific. Where can I find 'State Machine Design Patterns'. I presume they must be in Labview examples but I cannot find them?

 

Nevica 

0 Kudos
Message 3 of 24
(7,080 Views)

Start.JPG

 

State machine.JPG

 

Did you feel this is specific? Smiley Very Happy

Message Edited by Baji on 08-17-2009 04:25 PM
Balaji PK (CLA)
Ever tried. Ever failed. No matter. Try again. Fail again. Fail better

Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
0 Kudos
Message 4 of 24
(7,077 Views)
Perhaps you modify your VI according to the attachment.
Message Edited by Jörn on 2009-08-17 17.08.2009 01:08 PM
0 Kudos
Message 5 of 24
(7,065 Views)
Some other suggestions: Why not use X Torr Gauges also for controlling the inner loops? Also long as one of the X Torr Gauge buttons is pressed data is shown. If you release the button data aquisition stops and one can press another X Torr Gauge button without the need to restart the programm. Inside the loops you can change the behaviour of the loop condition from "Stop if True" to "Continue if True" and can directly wire the appropriate terminal to the loop condition. Programm is then stopped by pressing stop and the X Torr Gauge button does not include the stop programm.
0 Kudos
Message 6 of 24
(7,058 Views)

Hello,

 

Thanks for your suggestions. I have decided to stop the vi with the vi stop button on the top bar instead of creating my own stop button.

 

I am still left with two problems.

 

1. How do I reset the initial selection buttons outside of the case structure every time the vi runs.

 

2. How can I output the data on just one graph no matter which gauge I select. Having three graphs is overkill. I cannot put the waveform chart and digital indicator outside of the case structure because the looping happens inside of the case structure. I have thought of using local variables as in the example of the second case structure in my attached vi but this does not work.

 

How can I get around these problems?

 

Nevica 

0 Kudos
Message 7 of 24
(7,048 Views)

Jorn, You shouldn't initialize the stop button AFTER the program ends since you have not accounted for the case when the VI stops abruptly. Always initialize your variables at the start of your application.

 


nevica wrote:
I have decided to stop the vi with the vi stop button on the top bar instead of creating my own stop button.

DON'T DO THIS. Using the Abort Execution button when stopping a VI is like using a tree to stop your car. You need to stop the VI gracefully in the application itself.

 

Have a look at the attached application for an example of how to initialize your boolean buttons at the start of the application. I have implemented it using a State Machine. Since I am in a hurry, I did not account for error checks.

 

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
Message 8 of 24
(7,031 Views)

Hello Adnan,

 

Unfortunately I am running Laview 7.0 so cannot open test.vi. Please could you do a screen shot or save in 7.0 please.

 

Thanks,

 

Nevica

0 Kudos
Message 9 of 24
(7,022 Views)

Adnan Z wrote:

Jorn, You shouldn't initialize the stop button AFTER the program ends since you have not accounted for the case when the VI stops abruptly. Always initialize your variables at the start of your application.

..


You are right. My intention was to provide a quick solution.

Message 10 of 24
(7,020 Views)