Showing results forΒ 
Search instead forΒ 
Did you mean:Β 

Numbers into textfield using boolean buttons and case structure?

Go to solution



I'm very new to these forums, and to LabVIEW in general. I'm currently trying to implement a calculator-ish, but without the operations (+ - * /).


I have 10 boolean buttons, named 0-9, and with these I want to basically write a sequence of numbers into a textfield. I've managed to solve the problem using an Event structure, but now i'd like to achieve the same result using a Case structure instead. The problem is that I can't identify which button has been pressed, so I can't make the program go to the correct case (0 to 9). Is there any simple solution to this that you guys could help me with? Maybe a property node that's generic for every button? I dont know πŸ™‚


Anyways, I'm attaching a simplified version of what I'm trying to achieve, withouh the code I don't know how to write obviously. πŸ˜‰


Thanks for your help in advance!



0 Kudos
Message 1 of 5

You can build the boolean values into an array, then search the 1-D array of booleans to get the index value of the one that is TRUE.


You will probably want to rearrange them on the block diagram to index 0 is button 0, index 1 is button 1, ....,  and button "." is index 10.  You will also want to have a default case with a value of -1 for the situation where no buttons are pressed.

Message 2 of 5
Accepted by topic author _Seb

Here is a way to do it: bundle the boolean values into an array, turn that into an 8 bit number and wire that to a case structure with a boolean radix





























Message Edited by jmcbee on 03-31-2009 02:29 PM
Message 3 of 5

Thanks you guys! You're amazing. Totally solved my problem. I also looked up the whole radix-story, and there I learned something new!


This seems like a great forum, with very helpful people. I will make sure to try to contribute myself, with whatever I can help with.



0 Kudos
Message 4 of 5
Welcome to the forums!  You should check out Darren's Nuggets, and by that I mean there is a fellow who works for NI named Darren who posts weekly nuggets of wisdom, a great place to pick up new tricks (this is where I learned about the radix option for case structures). 
Message 5 of 5