5 Bit Binary to BCD

Thread Starter

luke3346

Joined Apr 15, 2024
10
Hello all, I have an assignment to create a simple calculator. It has two 4-bit binary inputs, they must add to 30 or subtract to -15. I need help with the display of the answers using two seven segment displays. I used a 7483 to add and subtract the values but the answer is in binary, does anyone know how to display them on a 7 segment display?
 

WBahn

Joined Mar 31, 2012
30,252
There are a number of ways to do it. As this is an assignment, you need to show YOUR best effort to solve it. We can then help you discover issues with your approach and help you overcome them. We can't do your work for you.

The first thing you might consider is how are you representing negative values and how do you plan to display -15 using two 7-seg displays.
 

dl324

Joined Mar 30, 2015
17,012
Welcome to AAC!
does anyone know how to display them on a 7 segment display?
There are several obvious ways to convert a 5 bit binary number to BCD. What methods have you studied?

As noted, displaying -15 will require more than just 2 seven segment displays.
 

Thread Starter

luke3346

Joined Apr 15, 2024
10
There are a number of ways to do it. As this is an assignment, you need to show YOUR best effort to solve it. We can then help you discover issues with your approach and help you overcome them. We can't do your work for you.

The first thing you might consider is how are you representing negative values and how do you plan to display -15 using two 7-seg displays.
Representing negative values is one of the troubles I am having because the output of the 7483 when subtracting shows the answer in the two's compliment. Also I would just use a indicator light in front of the displays. When the light is on that would indicate its a negative.
 

Thread Starter

luke3346

Joined Apr 15, 2024
10
Welcome to AAC!

There are several obvious ways to convert a 5 bit binary number to BCD. What methods have you studied?

As noted, displaying -15 will require more than just 2 seven segment displays.
I'm reaching out because we haven't really studied how to do this. Our previous studies include representing 0-9 on a single 7 segment display. Along with using a full adder with a control and xor gates to add or subtract.
 

Ian0

Joined Aug 7, 2020
10,074
But does it say you have to display them in decimal on a 7-segment display?
Rather simpler to display them in hexadecimal on a 7-segment display.
 

WBahn

Joined Mar 31, 2012
30,252
Representing negative values is one of the troubles I am having because the output of the 7483 when subtracting shows the answer in the two's compliment. Also I would just use a indicator light in front of the displays. When the light is on that would indicate its a negative.
Can you see how you can use a second 7483 to take the absolute value of a two's-complement number?
 

dl324

Joined Mar 30, 2015
17,012
I'm reaching out because we haven't really studied how to do this.
It would be unusual for an instructor to expect you to be able to do something that you haven't been taught to do. You should be reaching out to your instructor because s/he probably has some expectations for your solutions.
 

Thread Starter

luke3346

Joined Apr 15, 2024
10
First you will have to expand it to 6 bits in order to represent numbers higher than +15.
Then think about what needs to be added to 10 to make it display 10.
how would I expand the 4 bit full adder when it only has the Carry Out and 4 sum outputs?
 

Thread Starter

luke3346

Joined Apr 15, 2024
10
It would be unusual for an instructor to expect you to be able to do something that you haven't been taught to do. You should be reaching out to your instructor because s/he probably has some expectations for your solutions.
It's something that we are given alot of time to figure out and complete, therefore expecting us to work through it and figure it out. But I am at a standstill
 

dl324

Joined Mar 30, 2015
17,012
It's something that we are given alot of time to figure out and complete, therefore expecting us to work through it and figure it out. But I am at a standstill
You could use a lookup table in some non-volatile memory, logic gates, or the Double Dabble algorithm for the binary to BCD conversion. You still need to work out how to handle negative numbers.
 

Thread Starter

luke3346

Joined Apr 15, 2024
10
You could use a lookup table in some non-volatile memory, logic gates, or the Double Dabble algorithm for the binary to BCD conversion. You still need to work out how to handle negative numbers.
I am not familiar with the lookup table in some non-volatile memory or the double dabble. Just logic Gates
 

dl324

Joined Mar 30, 2015
17,012
I am not familiar with the lookup table in some non-volatile memory or the double dabble. Just logic Gates
It would be best for you to use a method that you're already familiar with.

Using logic gates only requires solving 5 variables maps which is fairly straightforward.

If you want to learn about lookup tables, read the datasheet for 74185. It implements the double dabble algorithm using a PROM.

You can read about Double Dabble here. I read it before and believe it's accurate.
 

Attachments

crutschow

Joined Mar 14, 2008
34,700
One way to convert binary to BCD is to parallel load the binary number simultaneously into both a binary counter and a BCD counter.
You then clock both counters, with the binary counter counting down to zero and the BCD counter counting up from zero.
When the binary counter reaches zero, the BCD counter will contain the BCD number.
The BCD counter can be the type that directly drives a 7-segment display.
 

WBahn

Joined Mar 31, 2012
30,252
Not 100% sure but if the msb-lsb were flipped from the output of one to the next and make the lsb of the second input high?
Think about this -- if you make the lsb of the second one HI, that is forcing it to be an odd number, regardless of what the actual number is.

Let's simplify it further.

What if you were given the task of taking a value in two's complement and producing the negative of that value. How would you do it? First consider how you would do it for a 4-bit value, then consider how you would do it for a 5 (or 6) bit value?
 
Top