Jump to content

How can I set the initial value of a boolean indicator?


horatius

Recommended Posts

I have a lamp working as boolan indicator on my front panel. After I run my VI the PC takes some time to check the state of a device. Therefore the initial state of the lamp should be off. After checking of the device the lamp is on. However the state of the lamp changes only after the procedure irrespectively whether the lamp is initially on or off. What is an easy method to set the lamp in off state immediatly after pressing the run button?

Link to comment

QUOTE (horatius @ Oct 23 2008, 04:44 PM)

I have a lamp working as boolan indicator on my front panel. After I run my VI the PC takes some time to check the state of a device. Therefore the initial state of the lamp should be off. After checking of the device the lamp is on. However the state of the lamp changes only after the procedure irrespectively whether the lamp is initially on or off. What is an easy method to set the lamp in off state immediatly after pressing the run button?

Right Click the boolean terminal then select Create -> Invoke Node -> Initialize to Default. Use dataflow to ensure this invoke node execute immediately when the VI runs.

Link to comment

QUOTE (horatius @ Oct 23 2008, 05:44 PM)

I have a lamp working as boolan indicator on my front panel. After I run my VI the PC takes some time to check the state of a device. Therefore the initial state of the lamp should be off.

Set the control/indicator to off, right click on it (from the front panel), and select Data Operations > Make Current Value Default.

Link to comment

QUOTE (crelf @ Oct 24 2008, 09:31 AM)

Set the control/indicator to off, right click on it (from the front panel), and select Data Operations > Make Current Value Default.

I agree, as beginer to Labview this method works best.

When HORATIUS finish reading and practising Intro To Labview in 6hrs or something similar then you can start looking at

Property node and Invoke node, execution order and data flow.

Enjoy LabVIEW HORATIUS !

Link to comment

QUOTE

Set the control/indicator to off, right click on it (from the front panel), and select Data Operations > Make Current Value Default.

This method I tried before I started this thread. The method seemed intuitively at the beginning and I tested. However it didn't work (LV 8.51).

Maybe you can test with your labview.

Link to comment

QUOTE (horatius @ Oct 24 2008, 12:08 PM)

This method I tried before I started this thread. The method seemed intuitively at the beginning and I tested. However it didn't work (LV 8.51). Maybe you can test with your labview.

We must be talking about different things - it's worked fine for many versions of LabVIEW... What about it didn't work?

Link to comment

If you're running the VI multiple times without closing it between runs, the indicators will not clear unless you add code that does it before everything else, or do what Syrus suggested.

QUOTE (syrus @ Oct 23 2008, 03:15 PM)

Another option is to go to VI Properties->Execution and select the "Clear indicators when called" option. This will set all indicators to their default values each time you run your VI.
Link to comment

Horatius,

Other options that haven't been said so far are to use the "FirstCall?" VI. It returns TRUE only once after hitting the Run button. Using that and a case strcture afterward, you can reinitialize your indicator once per Run. Using Property node is easy and an efficient way of accessing the value of indicators and controls. Left click on the Property node to change the type of information and you can swap between Read/Write.

Is it good to know that this VI will return TRUE everywhere, once per execution which means that you can use it in as many places as you want in your code.

Hope this helps.

Olivier

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.