LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Swtich Logic

Hi,
 
I am trying to create a VI where I want to keep the last status of a switch. Kindly see the attached sample VI. If I run the VI and put the swtich to Auto (True Status), and re-start my pc, the next time I ran the VI it will show Manual (False Status). I know that I can select the function "Make the current value the default", but similarly if I want to select Manual, the next time I start my pc, it will show Auto.
 
I hope there is no default. I just want to keep the last status of the Switch whenever I re-start my PC.
Could anyone please teach me how to correct my VI.
 
Thank you very much.
0 Kudos
Message 1 of 11
(3,868 Views)

Hi,

You can save the value of your switch in a file and read this file when your start your program.

You can also use .ini files for this purpose.

Message Edited by K C on 03-08-2006 12:20 PM

0 Kudos
Message 2 of 11
(3,860 Views)
Hi Bong,

there is a way to perform a "make current value default" programatically, so if you do this on your boolean when your VI stops, and then when you re-open this VI the boolean takes the default value you set at the end of the last use 😉

I will try to find an example VI, but you if you search on the forums for "make current value default" or something alike, you will find example.

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 3 of 11
(3,854 Views)
There we are Smiley Happy

look here and there

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Message 4 of 11
(3,854 Views)
Hi,
 
Thank you for all your replies. I looked on all your attachments and I tried to create my own as attached. I tried to save two kinds of control; numeric and boolean control. For the numeric I dont see any problem, but for the boolean control, it always goes back to the default setting as soon as i hit the save button.
I want to save the last setting i choose for the boolean switch. I would appreciate your kind assistance.
 
kind regards,
0 Kudos
Message 5 of 11
(3,822 Views)
Hi Bong,

I don't have LV8 so I can't have a look at you code, could you repost in LV 7.1 please ?

just to be sure, check the "mechanical action" of your boolean, if it's a latch, that might be the reason why it's not working, then set it to a "switch" 😉

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 6 of 11
(3,817 Views)
Hi Titou,
 
Thank you for your reply.
Attached is the VI in 7.1.
 
I checked all the mechanical action of the switches.
I tried to make this VI, but I am still having difficulty "keeping the last status of the Switch regardless of its default".
If this VI will not work, can you please teach me a more simple VI with the same purpose. 
 
Thank you very much.
 
 
0 Kudos
Message 7 of 11
(3,793 Views)
Hi Bong,

To do this, I would recomand to use configuration (*.ini) files, check the example code in Help >> Find examples... >> and search for "configuration file".

Or this...

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Download All
0 Kudos
Message 8 of 11
(3,762 Views)
Hi Titou,
 
Thank you for the reply and the attached VI.
 
I found a simpler solution. Kindly see the attached. The path that I set is my own file, so please set
the XML file path to your original. This VI now works for me.
Thank you very much for the great assistance.
kind regards,
bon
0 Kudos
Message 9 of 11
(3,747 Views)
Hello Bon,

I'm glad you found your own solution. Congratulations 😉

Best regards.

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 10 of 11
(3,741 Views)