# truth table to boolean expression

Discussion in 'Homework Help' started by dirtcrusher, Dec 20, 2010.

1. ### dirtcrusher Thread Starter New Member

Dec 20, 2010
4
0
So I'm working on my little project, but I'm stuck at the boolean expressions. I've got the truth table:
 H I J K L M N O P Q a b c d e f g 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 1 0 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 1 0 0 0 0 0 0 1 1 1 1 0 1 1 0 0 1 1 0 0 0 0 0 1 1 1 1 1 1 0 1 1 0 1 1 0 0 0 0 1 1 1 1 1 1 1 0 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1
So now I need to convert this to boolean expressions. I've started like this:

a=(~H.~I.~J.~K.~L.~M.~N.~O.~P.~Q)+(~H.~I.~J.~K.~L.~M.~N.~O.P.Q)+(~H.~I.~J.~K.~L.~M.~N.O.P.Q)
+(~H.~I.~J.~K.~L.M.N.O.P.Q)+(~H.~I.~J.~K.L.M.N.O.P.Q)+(~H.~I.~J.K.L.M.N.O.P.Q)+(~H.~I.J.K.L.M.N.O.P.Q)+(~H.I.J.K.L.M.N.O.P.Q)+(H.I.J.K.L.M.N.O.P.Q)
And I simplified to this:
a=~H.(~I.(~J.(~K.(~L.(~M.(~N.(~O.((~P.~Q)+(P.Q))+(O.P.Q))+(M.N.O.P.Q))+(L.M.N.O.P.Q))+(K.L.M.N.O.P.Q))+(J.K.L.M.N.O.P.Q))+(I.J.K.L.M.N.O.P.Q))+(I.J.K.L.M.N.O.P.Q))+(H.I.J.K.L.M.N.O.P.Q)

But this still isn't quite simple.
Could anybody help me simplifying this?

2. ### shteii01 AAC Fanatic!

Feb 19, 2010
3,924
601
That's a lot of scull work. Have you considered using Karnaugh map?

3. ### guitarguy12387 Active Member

Apr 10, 2008
359
12
Thats not even a complete truth table. And way too many inputs for a kmap.

I'm guessing you aren't supposed to use a truth table for whatever problem you are working on. The whole truth table has 2^10 = 1024 equations. Too much for this type of approach. Re-think the problem. It would help if you'd post the original problem and we can point you in the right direction.

4. ### dirtcrusher Thread Starter New Member

Dec 20, 2010
4
0
The whole project is like this:
-A potentiometer will measure the water level, giving an output of 0V to 15V
-A series of voltage comparators will give 10 outputs, like the truth table I posted in the first post
-Then I need to decode those outputs to output a 0,1,2,3,4,5,6,7,8,9,P on a led display

It's the decode part I'm having problem with, and I would like some help on it.

PS: I'm sorry for any grammar faults, I'm not English

5. ### dirtcrusher Thread Starter New Member

Dec 20, 2010
4
0
Why has this been moved to the homework section? It isn't homework, it's a personal project.

6. ### guitarguy12387 Active Member

Apr 10, 2008
359
12
I assume you are just wanting to use logic gates and not a microcontroller?

Well right off the bat, at the very least, use POS from rather than SOP for truth table outputs that have more zeros than ones.

I am sure there is a more clever solution... lemme think on it.

No worries, your english is fine

Last edited: Dec 21, 2010
7. ### Georacer Moderator

Nov 25, 2009
5,151
1,266
An ADC (Analolg to Digital Converter) fits exactly for the job.

A discrete solution exists however. You can add all the 1s you read from the comparators and convert them to a 4-bit number.
To do that you need to use 5 1-bit Full Adders to add all the outputs in pairs.
Then use 2 2-bit Full Adders to add the 4 2-bit numbers in pairs.
Then add the 2 3-bit numbers.
Add the result with the remaining 2-bit number.

The resulting 4-bit number is much easier to represent and solve in a Karnaugh map.

Here's a grafical representation of the additions. The numbers represent the length of the operands in bits.

1-1-1-1-1-1-1-1-1-1
\-/--\-/-\-/--\-/--\-/
-2---2---2----2---2
-\---/----\---/----|
---3--------3-----2
----\-------/------|
-------4----------2
-------\-----------/
------------4------

You will need 16 1-bit Full Adder units in total.

8. ### guitarguy12387 Active Member

Apr 10, 2008
359
12
Thats what i figured too! This would be a whole lot easier using software/programmable logic. But other issues.

This seems like alot of extra work/logic to me. After all that, you STILL have to decode the results into SSD. Each full adder has 5 gates = 80 gates total for 16 bits PLUS the decode logic which will be another couple dozen gates at least probably. I assume he is either using discrete gates or even BJTs to make up his own discrete 'logic' so that's why hes trying to minimize the logic by hand. This would be a nightmare.

9. ### RiJoRI Well-Known Member

Aug 15, 2007
536
26
(Your problem does look like a problem a teacher would hand out!)

To me, the simplest solution would be to get an EPROM and use it to decode the comparator outputs.

Next would be to get something like an Arduino board and use the ADC in the microcontroller to generate the outputs.

Finally, I would try using a PLD for the same effect as the EPROM.

These are not very elegant, but they would be quick and effective.

--Rich

10. ### guitarguy12387 Active Member

Apr 10, 2008
359
12
Yeah if you're getting an arduino, you might as well do it all in software. No need for comparators anymore.

Just use the ADC on the arduino, giving you an n-bit number (i forget what the bit depth of the arduino ADCs are. 8? 10?). Then just use a few if statements to determine what number you want to display. Then write a function that converts an int into a hex display using a case statement.

Theres plenty of digital I/O on the arduino to drive the SSD directly. Or you could use a serial to parallel shift reg or a BCD to SSD decoder.

11. ### djsfantasi AAC Fanatic!

Apr 11, 2010
3,486
1,245
Try approaching the problem in this manner:
Right-shift out the data into a decade counter.
Use a 7447 to display the BCD value from the counter.
If the carry is set (i.e. The number of 1s is 11), force the output to display a "P"

12. ### Georacer Moderator

Nov 25, 2009
5,151
1,266
djsfantasi is on a right course.
Dump the data into 3 serially connected 4-bit shifter-registers.
Use a binary 4-bit counter like the 74161 which has an enable input.
Use a clock circuit.

Your circuit will work in circles of a few clock pulses. In the first pulse the counter will be reset and the registers will be filled with 10 bits of data.
For the next 10 pulses, the registers will be unloaded on the counter's Count Enable pin, making it count the population of 1s.
After the 10 pulses, enable a 7-seg driver (7447) to display the result.

13. ### guitarguy12387 Active Member

Apr 10, 2008
359
12
That'd work too. I was trying to avoid sequential design... now he has to design an oscillator.

14. ### Georacer Moderator

Nov 25, 2009
5,151
1,266
Bill's gotta do something too, right?

15. ### dirtcrusher Thread Starter New Member

Dec 20, 2010
4
0
Well, ...
I wanted something simple and cheap, so I go for the ADC.
Thanks a lot for your help, I think that I can finish it myself now.

16. ### n1ist Senior Member

Mar 8, 2009
171
16
How about using an LM3914 as the ADC, a 74148 (or mux and counter) to get you BCD, and a 7447 for the display driver?

It still may be more expensive than an ATMega48 directly driving some LED displays, however...

/mike