LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Resetting a large number of boolean indicators.

Hi All,

 

I have a bit of a problem displaying a large(-ish) number of booleans decoded from a decimal number.

 

Getting the signals out and turning the boolean ON is not a problem but what does cause me trouble is is having them turn off when they're no longer relevant...

 

I'm using a couple of condition structures one within another.

 

I've found a couple of topics talking about using local variables before and after the loop in order to set them to 0.
While that probably works, we're talking about dozens of booleans so that's pretty incovenient.

 

Is there a way to do this conveniently?

 

 

0 Kudos
Message 1 of 5
(1,509 Views)

@marc426 wrote:

Is there a way to do this conveniently?


1) Group the Booleans in a cluster or array. Then it's only one local, or one for each cluster or array.

 

2) You can do this with VI Server. Get all control references from your front panel (VI.Front Panel.All Controls[]), then filter on Boolean type or label. Use Value property to set the values.

 

The way this seems to be going is that you have a sub VI that keeps evolving into an application... This will go bad at some point. You should start to think about application structure. Start dividing functionality into sub VIs, libraries, classes, etc.. Setting the Booleans to a value and resetting the Booleans are two functions and should be in two sub VIs. With VI Server you can do that.

0 Kudos
Message 2 of 5
(1,504 Views)

Hi Marc,

 


@marc426 wrote:

Getting the signals out and turning the boolean ON is not a problem but what does cause me trouble is is having them turn off when they're no longer relevant...

 

I'm using a couple of condition structures one within another.

 

I've found a couple of topics talking about using local variables before and after the loop in order to set them to 0.
While that probably works, we're talking about dozens of booleans so that's pretty incovenient.

 

Is there a way to do this conveniently?


Surely there is a convenient way…

You "just" need to organize all those boolean indicators in a more appropriate way!

 

  • I would think about using clusters for those several groups you show on the frontpanel (CodeC, 3× CodeD). Now you could "reset" the whole cluster at once using a cluster constant in the code.
  • I would change/output those clusters always: when decoding your "nombre" you can set the related cluster as needed and clear the other clusters.
  • Your "nombre" input is set as U32 datatype, but in the code you only decode the lower 16 bits: I would set the control to U16 datatype…
  • For decoding ranges of 0…15 you don't need to use case structures with upto 16 cases: use a 2D array of boolean constants and index just one row (or column) to get the boolean values for all indicators…

In the end it boils down to "organize your data structures in a better way"!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 5
(1,493 Views)

You've already got some good advice, but you definitely have general architectural problems due to poor design. If you have indicator terminals in innermost structures wired to TRUE constants, there is no good way to ever reset them if the inputs change. All indicators need to update with every run, so they belong all the way after all the conditional parts.

 

Yes, use clusters from logical sets of indicators. I also see great potential to simplify your code in general.

 

 

0 Kudos
Message 4 of 5
(1,421 Views)

Frankly I don't understand what you are doing with your indicators...

 

The most coinvent way to handle this would be to try a different front panel layout so you can leave everything in an Array and just update it as required.

 

array2Capture.PNG

I know it's a P.I.T.A. but you can get all your labels to line up to an Array indicator and make the array "container" transparent.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 5
(1,416 Views)