at lost in Building calculator

Discussion in 'Homework Help' started by alphoneex, Mar 2, 2012.

  1. alphoneex

    Thread Starter New Member

    Mar 2, 2012
    Hello! this is my first calculator project in school.
    I thought I almost there but..have lots of errors :confused:
    (attached pictures of my half done or less calculator)

    In my calculator I have...
    1. numeric key input(0 to 9)
    2. BCD encoder(8 outputs, 2 for each bit, ON and OFF)
    3. 16bits memory(4 x 4 S-R latch, total 16 bits)
    4. 16 x full Adder(BCD input so paired by 4)
    5. and 4bits input display(included in the program)

    and I will need..
    1. Logic interface between memory and arithmetic units
    (I have only adders now but I will add sub, multi and divider)
    2. Timing control in memory
    (all 16bits of memory are enabled by any key input, but my memory has input to only first 4bits(LSD), and that 4bits will carry over to the next 4bits(next significant digit), if another enable signal comes in. The problem is this enable signal is not very accurate so sometime datas are mixed up D:

    so was introduction of my calculator...and the reason I am asking some help is....(please refer to the picture "HEX error.jpg", 9+9=12! OMG!)

    My calculator works fine, until I input some values that required carry out function. Those 16 adders are all connected in series. I tried "4bits input hex to decimal converter" at output but it simply ignored any value more than 9.....did not carry it over to the next set of adders D:

    if any more information is needed I will add it.

    Thank you!
  2. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    I find it interesting that 9+9=12 is correct! If you are adding two hex numbers... That is, 9h + 9h = 12h
  3. alphoneex

    Thread Starter New Member

    Mar 2, 2012
    9+9=12 is correct if they are I thought hex to decimal converter would fix the problem.. is another example..(attached picture)

    199+199=332 :confused:
    9 + 9 = 12 (carry out 10) => 2
    9 + 9 = 12 (carry out 10 and carry in 1) => 3
    1 + 1 = 2 (carry in 1) => 3

    result should be 398(deci) or 18E(or 1, 8, 15 like that..for hex)
    but it is somewhere in between..very weird operation..

    It calculates based on hex..then carry 10 out to next adder..(not 16!)
    I suspect.. the cause is BCD. Its 4bits are not allowed to go higher than 1001 because it receives signal from decimal input.
    However, somehow, those 4bits have been allowed to have more than 1001.

    it is so it better to start it all over again?
  4. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    I don't routinely add hex numbers, so for your second example, I used a programmers calculator and indeed 199h + 199h = 332h

    I don't know how this affects your circuit, but present it as a possible clue
    alphoneex likes this.
  5. alphoneex

    Thread Starter New Member

    Mar 2, 2012
    Oh..I think I get it..

    If it is 4bits, there is no clue for a calculator to say it is BCD or hex.(unless it has some logic circuit for that?)
    4bits input to 4bits output has no error but it is I! because I expected to get decimal value.

    not 100% sure about this yet but..
    Thank you sir!
    Last edited: Mar 3, 2012