10-20-2014 10:04 AM
Is there an easier way to write this code and keep the same functionallity?
Solved! Go to Solution.
10-20-2014 10:28 AM
Would this work?
10-20-2014 10:45 AM
Is there any reason you don't simply customize a radio button indicator to match your large booleans? Your code becomes a simple wire. I'm guessing that this is just an example of what you're trying to do, and not the end-product you're making. Why do you need boolean indicators of a boolean control? You're adding extra objects to the front panel without adding any extra information.
10-20-2014 02:03 PM
Thanks for the replies. Sorry if I was not clear. The indicators (big) are only indicative of the function I was looking for. I am having to send a radio button control signal down through a class - actor loop from the UI to the RealTime control on cRIO and back to the UI. The loop and communication I have done but for some reason the radio button has a weird functionality where it only shows one true/false value through the loop and back up to the UI.
meaning -
in the example the radio button has two controls radio 1 and radio 2. when they switch between the two I get the true/false value of only radio 2. so it signals radio 2 is true when radio 2 is on, and radio 2 false when radio 1 is on. As seen with a probe on the array wired into the for loop.
the value does change on NewVal line between radio 1 and 2 but when it is broadcast to the cRIO it shows only the value of radio 2 as being true/false. This is fine for the output channel as they energize correctly. (two different outputs) but It does not allow me to use the broadcast data back to the UI in the same way as if it were two booleans, not one radio button.
so in short I was trying to figure out a way to get the radio button to act llike a radio button on the front panel but act like two booleans on the return trip...
I hope that makes sense. Unfortunately, I can't supply code for the program (proprietary development) hence the example of functionality. (pretend the indicators are on the return loop)
10-20-2014 04:17 PM
Just use number to boolean array
The method works if you do not allow zero items NOTE: Do not replace the Add 1 with increment. We are using the U32 constasnt to coerce the radio button enum otherwise the incrment just inverts the enum; enum(0,1)++ = enum(1, 0) and enum(0,1)+1= U32(1,2)
If you do allow zero items remove the addition since "no selection" becomes 0
10-21-2014 09:09 AM
Jeff~
Thanks for that - it works with the boolean value and is much simpler to impliment. Though it did not solve all the issues I found a good work around. I believe the issue I am really having is the fact that I need both the name of the button and the value to travel the loop (DO and Status) The conflict I believe is coming that I am using a radio button control and an enum type def with all the DO names.
the issue is that the trype def does not change the value of the radio button name with the boolean value hence the radio 2 value shows true when radio 2 is on and false when radio 2 is off.
here is a snippit with a variation of your solution.