Binary Multiplication to Represent 0-359 on 3 7-Seg Displays

AI Thread Summary
The discussion focuses on the challenge of representing decimal values from 0 to 359 on three 7-segment displays using an 8-bit input. Participants suggest methods to achieve this, including multiplying the input by 14 and dividing by 10, or using BCD encoding to handle the conversion to display format. There are considerations about creating a binary multiplier using JK flip-flops and the need for additional ICs to facilitate the design. Some participants propose using a series of additions instead of multiplication to simplify the process, while others discuss the potential for using a lookup table for conversion. The consensus is that while the task is complex, it can be approached through careful design and the right combination of logic components.
ProPatto16
Messages
323
Reaction score
0

Homework Statement



i have an 8 bit input, and i need to represent 0-359 in decimal on 3 7-seg displays


The Attempt at a Solution



with 8 bits there is only 256 possibilities so the input would have to be multiplied by 1.4 to get an even spread over 259 degrees.
but you can't multiply a binary number by a floating number and then if you have a result of say 345 how do you represent it with 8 bits.

so i need to find a way to take 8 bits and represent numbers from 0-359. doesn't need to be every degree .
and have to simulate it in multisim so can't use binary rate multipliers.

any ideas? just somehwere to start looking.
 
Physics news on Phys.org
Hi ProPatto16
You could multiply by 14 and divide by 10 :)
You are going to use BCD I guess, in any case you will need 2 bytes that would allow you to display up to 4 digits
So pretend you have 4 digits and whatever number you have to itself 13 times, and carry up to the second byte
At the end, you just ignore your last digits (the second nibble of your first byte)
Cheers...
 
Good idea! Thanks,
Just another issue, multisim has no binary multiplier so I'm going to have to make one out of JKs which is fine, but what other ICs would I need to get from the original 8-bit input to the 3 displays? Cause ill need to design them from scratch too. But that'll get me on the right track
 
Hi, sorry I don't know about ICs, I am not into electronics, I just have some memories about it but they are quite old :)
Anyway, multiplication is hard, I think you can avoid it by just doing addition, you just need to do 13 additions, it should be fast.
Once the additions are done, you convert to BCD if it is easy enough, I remember it is a standard way to work and there are plenty of ready to use algorithms / ICs to go from BCD to 7 segs displays
you should find yourself with 2 bytes encoding in BCD a 4 digits number, (the 4 nibbles) you just discard the last nibble and wire everything else and it should do the trick
Cheers...
 
To do this exactly, you need to multiply by 45, then divide by 32 (shift right 5 bits). You could create a translation table (like a rom), using the 8 bit input shifted left 2 bits to index the table to get 32 bits, using 21 bits of that for the three 7 segment displays.
 
Yeah I gave up on the multiplier and made an 8x8 adder. It's a beast. I just can't get the 9th bit to work when I add 2 large 8 bits and get a 9th bit to make a number over 255. I thought I just put the last carry out as the 9th bit so when there's carry it'll be high ?
 
Why not make a 14 bit adder? This will be large enough to multiply by 45. Then you need a second register to hold intermediate sums. Assuming the original value O is in X and using A... for the intermediate sums:

Code:
A = X + X    (A = 2 O)
A = A + A    (A = 4 O)
X = A + X    (X = 5 O)
A = X + X    (A = 10 O)
A = A + X    (A = 15 O)
X = A + A    (X = 30 O)
X = A + X    (X = 45 O)
X = X + 16   (round X before shifting)
X >>= 5      (use upper 9 bits of X)

You've still got the problem that you now have to convert this to decimal for the three 7 segment displays. As mentioned before, you could just create a 256 entry by 12 or 21 bit table and let multisim figure it out.
 
Last edited:
Doesn't need to be perfect. Just going to round the decimal off and show whole numbers so it'll go like 0,1,3,4,5,7,8,9,11,12,14 type thing
 
Did you ever resolve this? I have to do a multiplication as well, but am a little overwhelmed by the complexities of it all.
 
  • #10
I figured out the multiplier but havnt done the division. If you look at how binary numbers are multiplied and then add those combinations. Whatever your multiplicand is like 2 bits 3 bits 4 bits, then youll need one less adders. So for 4 bits you need 3 adders. Go do some multiplication the long way and you'll see if you multiply by a 4 bit number you'll get 4 additions before the last result. Put those 4 additions through adders
 
  • #11
Thanks for that. I've actually had some success with adders.
As for the division, couldn't you simply disregard the 'divide by 10'? After all, in 7-segment displays, that division would represent the decimal place. Does your project need that level of precision?
 
  • #12
As far as I can figure out all this divide by 10 stuff is for frequency not for binary numbers. So i start with say 25 and between 0-359 the 25th number is actually 35. to get 35 from 25 multiply by 14 to get 350 and then divide by 10 then display it. I don't need decimals at all, only displaying whole numbers. So I'm looking at shift registers to try turn that 350.0 into 35.00.
 
Last edited:
Back
Top