LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I set a boolean until another condition is met to reset it?

Solved!
Go to solution
In PLC programming, you have SETs and RESETs and a line of logic can set something to ON, until something else RESETs it and turns it OFF.  I was hoping to do the same thing in LabVIEW and am having a hard time imagining the solution.  Can someone give me a tip?  I am using the crippled Base version so no event structures for me.
0 Kudos
Message 1 of 7
(5,828 Views)
Solution
Accepted by topic author Orion HE

Use shift registers to wire a value through the loop.  Use case structures to change the value within the loop.    You could also use the Select Function

 

Message Edited by Ravens Fan on 10-28-2008 04:55 PM
0 Kudos
Message 2 of 7
(5,824 Views)
Well, it's not as simple as I had hoped for, but I am sure with a whole bunch of creativity I will be able to do what I am aiming for.  Thanks for you help.
0 Kudos
Message 3 of 7
(5,815 Views)

Orion HE wrote:
Well, it's not as simple as I had hoped for, ...

 

 You can probably simplify it quite a bit more and get away with a single "select" function. (all three switches (stop|Set|Reset) are latch action.)

 

Message Edited by altenbach on 10-28-2008 03:58 PM
0 Kudos
Message 4 of 7
(5,801 Views)
Thank you for the alternative method.  Being exposed to the different styles of programming will help me to form my own.  I was actually hoping there would be some internal property nodes or something that would enable a boolean to be "true until x" and then another boolean property "x".  I hope that makes sense.  That is more like the flow of logic in certain PLC programming software.  I recognize LabVIEW is a different sort of language entirely, but even in text programming languages I could initialize a boolean value and then "set" it until some other code changes it.  Unless I am missing something in LabVIEW, that is what I was hoping for.  But again, thanks for the ideas.
0 Kudos
Message 5 of 7
(5,798 Views)

Maybe you should explain a bit more what you are actually trying to do.

 

  • Where are the inputs comping from?
  • Where should the output go?

 

If the output is just an LED or writing a command to an instrument, you could do the following. No shift register|feedback node needed. Remember that indicators have tier own memory and they only change when you actually write a new value to them.

 

 

The FALSE case is empty. (Make sure that the initial state of the LED is defined).

Message Edited by altenbach on 10-28-2008 05:06 PM
0 Kudos
Message 6 of 7
(5,792 Views)

I'm gonna take heat for this, because they are "officially" discouraged, but I'm betting that what you really want is a local variable.  Some condition happens somewhere to set your boolean true.  Then something else happens later/elsewhere and now you need to set that same boolean false.  Wire the false condition to the "local" copy of the boolean, and voila!, the boolean becomes false---both the variable, and all local copies.  It works just like any named variable in a text based programming language.

 

You have now been given enough rope to hang yourself.  Evil race conditions can develop.  Apparently unrelated parts of your program can now interact, mysterious things can go bump in the night, etc., etc.  But if you know what you are doing, local variables can be real posterior preserver.

 

I will now go out behind the woodshed and thrash myself for espousing such LabVIEW apostasy.

0 Kudos
Message 7 of 7
(5,776 Views)