NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
dsavir
Posts: 142
0 Kudos
Accepted Solution

using booleans to change a large number of parameters

Hi all,

 

We have a number of booleans. We want that when any one becomes TRUE, we would change a parameter in a different button.

 

If it was only one boolean, we would have no problem, but we have 36 such booleans. Does anyone have a way of programming this so that we don't have 36 nested IF cases? the booleans can become TRUE together.

 

To check if any boolean is true, we poll all of them in a while loop (they are hardware-connected and unfortunately the hardware is not built for interrupts, so polling is the only way).

 

Can anyone help?

 

Thanks,

Danielle

Proven Zealot
MikeS81
Posts: 5,371

Re: using booleans to change a large number of parameters

Hi Danielle,

where do you get the boolean values from? Is it necessary to poll them? You can use refnums from your controls. Build an array of all these refnums. With index array you can then set a specified value.

 

Mike

Member
dsavir
Posts: 142
0 Kudos

Re: using booleans to change a large number of parameters

Hi Mike,

 

It is unfortunately necessary to poll them.

 

The problem is not setting the values, it is knowing to which control to set the value. We get a number of booleans, and we need to check which are true and set our controls accordingly. for example, booleans 1,6 and 20 are true, so we need to change controls 101, 106 and 120. Other then checking each of the 36 booleans in 36 parallel IF loops, are there any suggestions for how to determine which controls we need to change?

 

Thanks,

Danielle

Proven Zealot
MikeS81
Posts: 5,371

Re: using booleans to change a large number of parameters

Hi Danielle,

from what i understand what you try to do, something like the attached should work for you.

 

Mike

Member
dsavir
Posts: 142
0 Kudos

Re: using booleans to change a large number of parameters

Thanks Mike, this is exactly what we were looking for!

 

Danielle

Member
Joven
Posts: 47
0 Kudos

Re: using booleans to change a large number of parameters

 

Dear mike,

 

Can you save it as a VI file? I have problem loading the VI example using snippet. Thanks!

Proven Zealot
MikeS81
Posts: 5,371
0 Kudos

Re: using booleans to change a large number of parameters


Joven wrote:

 

Dear mike,

 

Can you save it as a VI file? I have problem loading the VI example using snippet. Thanks!


It's not a snippet. ;-)

 

Mike

By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page