1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Binary multiplication

  1. Apr 17, 2013 #1
    1. The problem statement, all variables and given/known data

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


    3. 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 cant 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. doesnt need to be every degree .
    and have to simulate it in multisim so cant use binary rate multipliers.

    any ideas? just somehwere to start looking.
     
  2. jcsd
  3. Apr 17, 2013 #2
    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...
     
  4. Apr 17, 2013 #3
    Good idea!! Thanks,
    Just another issue, multisim has no binary multiplier so I'm gonna 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
     
  5. Apr 17, 2013 #4
    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...
     
  6. Apr 17, 2013 #5

    rcgldr

    User Avatar
    Homework Helper

    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.
     
  7. Apr 17, 2013 #6
    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 ?
     
  8. Apr 17, 2013 #7

    rcgldr

    User Avatar
    Homework Helper

    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 (Text):

    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: Apr 17, 2013
  9. Apr 18, 2013 #8
    Doesn't need to be perfect. Just gonna 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
     
  10. Apr 27, 2013 #9
    Did you ever resolve this? I have to do a multiplication as well, but am a little overwhelmed by the complexities of it all.
     
  11. Apr 27, 2013 #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
     
  12. Apr 27, 2013 #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?
     
  13. Apr 27, 2013 #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: Apr 27, 2013
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Binary multiplication
  1. Binary addition (Replies: 14)

  2. Binary multiplication (Replies: 1)

  3. Binary question (Replies: 2)

  4. Basic Binary (Replies: 1)

Loading...