LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there an "any" boolean function in LabVIEW?

I want to execute the statement,
if any of the buttons on the front panel are false, do something
else, do nothing.

Is there a way to do this?

Also, is there a way to go from the last frame in a sequence structure to the first frame, sort of like a "GOTO" command?

Thanks a ton:)
Yusif
0 Kudos
Message 1 of 5
(2,489 Views)
Hi,

1) About "any" boolean function:

Use logical "and" of all booleans: if result is false, then some boolean is false

2) There is not command "GOTO" in LabVIEW. You can't change flow in sequence.
0 Kudos
Message 2 of 5
(2,489 Views)
Hi Yusif,
unfortunately, the answer to both of your questions is a no. You;ll need to handle them both prgramatically.
The second is the easiest to describe, so I'll cover that one first. -
Sequences and loops don't have the goto, break or continue capabilities of programming languages such as 'C' or Basic. You need to put a loop around the sequence and decide whether to run the whole sequence again.
If it's just a case of doing the first frame again, then copy the first frame, and if necessary put a case statement around the functionality inside the frame to get the program flow you want.
The "any" buttons problem is a little more in-depth.
The simplest way is to put all the buttons into either an array or (my preference) a cluster - you can arrange the
buttons where you wish and then interrogate the cluster in one go (use the cluster to array function, and then search 1-D array for index of the button that was pressed (search for a true, and if one is not found, the function returns a -1 - 0 or higher and you have your "any"
The alternative is a little trickerr still - I'm putting together a sub-vi which will interrogate the calling .vi's front panel, stripping off all the button controls, and performing an "any" or an "all" function on them. (this way it can be re-used) - I'm using LabVIEW 6.1. I'll post it here when it's finished

Hope this helps.

Sacha
// it takes almost no time to rate an answer Smiley Wink
Message 3 of 5
(2,489 Views)
Hi yusif,
what Nadav said is the easiest, but if you plan on expanding the .vi or have lots of controls, it's worth considering how you're managing them (look at clusters and arrays), otherwise you'll have lots of wires going all over your diagram, and you'll have to keep adding into it for every new control.
Of course with my example, if you create a boolean control that you want to ignore, then my method won't work. To get around this, you could pass in a list of names of controls you want to ignore, and then modifying the example attached so that if the name of the control matches one in the list, you ignore it.

I've attached my example below.

Hope that helps

Sacha
// it takes almost no time to rate an answer Smiley Wink
Download All
0 Kudos
Message 4 of 5
(2,489 Views)
Yusif wrote:
> I want to execute the statement,
> if any of the buttons on the front panel are false, do something
> else, do nothing.
>
> Is there a way to do this?
>
> Also, is there a way to go from the last frame in a sequence structure
> to the first frame, sort of like a "GOTO" command?
>
> Thanks a ton:)
> Yusif

Hi,
I would suggest a "State Machine" layout which basically consists of a
Case Structure within a while Loop with a shift register. One Case can
examine keys and direct execution to the next appropriate case.
Search at ni.com for "State Machine" there are some good articles
describing this kind of layout.

Dave.
Message 5 of 5
(2,489 Views)