03-31-2009 03:06 PM
Hi!
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!
/Sebastian
Solved! Go to Solution.
03-31-2009 03:16 PM
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.
03-31-2009 03:28 PM - edited 03-31-2009 03:29 PM
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
03-31-2009 04:04 PM
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.
/Sebastian
03-31-2009 04:11 PM