four bit adder

Discussion in 'Homework Help' started by subinznz, Apr 23, 2012.

  1. subinznz

    Thread Starter New Member

    Apr 23, 2012
    1
    0
    Hi
    how do i do this

    the calculator takes in a double digit input,
    each digit is encoded in 4 bit ( 0.....9)
    the are both stored in order

    e.g.
    say i want to add 12 + 15

    the encoding takes place for 12

    first user inputs 1
    so 0001 = 1
    and then 2
    so 0010 =2

    then this value is stored.

    what im wondering now is how do i make it that these two 4 bit binary numbers (0001,0010) give me

    12 in binary (1100)

    thanks plz guide me or am i going in the wrong direction

    i am trying to make a calculator :)
     
  2. crutschow

    Expert

    Mar 14, 2008
    12,972
    3,219
    You need to do a decimal to binary conversion in software.

    After you do the desired mathematics on the numbers then you convert them back to BCD with a binary to BCD algorithm for display.
     
  3. WBahn

    Moderator

    Mar 31, 2012
    17,715
    4,787
    How are you implementing the solution? In hardware? As a computer program?

    Think about the underlying math of what you are trying to accomplish:

    Using your example, you have a two digit number AB in which A=1 and B=2 with A and B stored separately. You now wish to combine those into a single value, C. So, what is C in terms of A and B? Hint: What makes BA (i.e., 21) different from AB (i.e., 12)?
     
Loading...