03-19-2017 08:23 AM - edited 03-19-2017 08:25 AM
hi ;
i want to create a numeric keybord for command a seven segment display, so what can i do to get an integer from a booleen button.
Solved! Go to Solution.
03-19-2017 09:51 AM
Your question could be interpreted a lot of different ways.
A boolean is just a true/false. What integer should that be converted to? The simplest answer would be using the Boolean to (0,1) function. But I imagine your actual question is a little bit more involved than that.
Please attach your VI so we can see where you are now. Just having your front panel would help us understand what your inputs are and what you are trying to get for an output.
03-19-2017 10:00 AM
Are you talking about a physical keyboard or a virtual keyboard?
Are you talking about a physical seven segment display or somethings simulated on the front panel?
Keyboards typically have more than one button, each with a boolean state of either up or down. All you need to do if find the key that is down to decide what value to display.
03-20-2017 08:03 AM
On the front panel, use a Radio Buttons control. In it place a pushbutton for each number. Make sure the order of the controls in the cluster matches the numeric value Set the control to allow no selection. On the block diagram, convert the output of the terminal to a U32 and subtract 1.
03-20-2017 10:30 AM
Nice Post
03-20-2017 11:07 AM
As has already been pointed out, your question is ambiguous and unclear. From your stated desire to make "a numeric keyboard for a 7-segment display", I'm guessing that you will arrange 10 Booleans, perhaps in a 3-3-3-1 pattern, to be your "numeric keyboard", and want to know how to get the number "3" when you push the Boolean labelled "Three".
But that's just my guess, and if you mean something completely different, then I've wasted both your time (in reading my inappropriate response) and my time.
But if you'd attached a VI with your attempt to do whatever it is you have in mind, your Front Panel ("a picture is worth 1000 words") and Block Diagram, however incomplete, would explain what you meant.
Please attach a VI (and not a "picture" of a VI).
Bob Schor
03-20-2017 12:22 PM
ps: my english is not so good
03-20-2017 12:27 PM - edited 03-20-2017 12:30 PM
you are right i'll share the vi
03-20-2017 12:34 PM
Use Build Array and Search 1-D array to find the first True.
There are easier ways to do this. Search the forums for 7-segment display and you should find some other VI's that do this same thing. For instance, a 2-D boolean array constant can set up which booleans to turn on and off for each digit.
03-20-2017 12:45 PM
1. Change all of your buttons to have a mechanical action of "Latch When Released".
2. Use an Event Structure to detect when the buttons are pressed (value change event). You can have all of the value change events in a single event case.
3. I recommend a 2D array to act as a lookup table for what the LED statuses should be. You can use Build Array and Search 1D Array to get an index for the lookup table from the buttons. You will then use Index Array to get your individual LED statuses.