# how to display 0-30 sum in 7segment

Discussion in 'The Projects Forum' started by fhrozbite, Feb 4, 2008.

1. ### fhrozbite Thread Starter New Member

Feb 4, 2008
3
0
nid help guys.. in using 4bit full adder i dont have any problem but it displaying the output thats the problem comes out... in displaying a max sum of 9 only i can do but when the exceeds to 9 example 10 and above i cant do now... another problem is when im in subtraction mode i cant show the negative sign if the answer is negative...waht should i do... thnx for any reply...

2. ### Papabravo Expert

Feb 24, 2006
12,290
2,728
How do you get 0-30 from a 4-bit adder. As an unsigned number you can represent 0-15. As a signed number you can represent +7 to -8.

You can display the result in a number of ways but the easiest would be a lookup table, also known as a ROM. I think you need at least four inputs and a minimum of 14 outputs.

Another way to do it is to write boolean equations for each segment of the two displays and implement those equations in a PLD.

You could also use a medium pin count microcontroller to read the output of the adder and display the required digits.

3. ### beenthere Retired Moderator

Apr 20, 2004
15,808
295
Whether in hex or decimal, it takes two 7 segment displays to show two digits. Seven segments are not too clear showing hex - it takes a certain display driver to get the a - f numerals.

Consider using an LED as the negative number indicator.

4. ### fhrozbite Thread Starter New Member

Feb 4, 2008
3
0
my prof ask me to make a 4bit full adder that can displays 0-30 sum and -15 to 15 difference... i used dip switches for the input...

5. ### fhrozbite Thread Starter New Member

Feb 4, 2008
3
0
but how can i display the negative sign if the answer is negative??

6. ### hgmjr Retired Moderator

Jan 28, 2005
9,029
219
You could obtain one of those LEDs that has the shape of negative sign and mount that in the appropriate mechanical location so that it serves the purpose of a negative sign.

similar to this example.

hgmjr

Feb 22, 2007
53
0
When subtracting if you are using a 4bit adder than the carry will be the sign: 0 - positive; 1 - negative. To this can be achieved with a 4bit adder you first need to "invert" (two's complement) one of the operands.

8. ### Papabravo Expert

Feb 24, 2006
12,290
2,728
It takes 5 bits to display numbers in the range [-16..+15]. The fifth bit is the Carry Out from bit 4 of the adder. Listen carefully because you seem confused.

5 bits can represent the unsigned numbers in the range [0..31]
5 bits can represent the signed numbers in the range [-16..+15]

The range of signed numbers is not symmetrical with respect to zero, but there are 16 negative numbers and 16 non-negative numbers. The total number of representable numbers must be a power of 2. For five bits this is 2^5 = 32 numbers. For all the negative numbers the Carry Out will be a 1.

A single 7-segment display can represent a minus sign by turning on segment g only. Also, they make displays that can do +, - and the digit 1 for a total of four segments.

9. ### RiJoRI Well-Known Member

Aug 15, 2007
536
29
FWIW, there are 7-segment latching LEDs that can decode hex. If I remember, HP made them.

Again, one LED display can show ONLY one character at a time.

--Rich

10. ### nomurphy AAC Fanatic!

Aug 8, 2005
567
13
Most 7-seg LEDs come with a RH/LH decimal point option, use the decimal point to indicate sign.