add and sub bcd to seven segment

Discussion in 'The Projects Forum' started by mohsen, Oct 23, 2010.

  1. mohsen

    Thread Starter Active Member

    Oct 24, 2008
    37
    0
    i'm trying to do the add/ sub for my project
    i know how to do add but don't really know how to implement sub to it

    also, when i tried to test the add the display is always on i tried to change in input but i alway get the 7 segment on


    thanks
     
  2. tom66

    Senior Member

    May 9, 2009
    2,613
    214
    You have not specified what number system you are using. If you are not dealing with negative numbers then this is not important.

    To take away a number you complement (invert) the bits and add 1 to this.
     
  3. mohsen

    Thread Starter Active Member

    Oct 24, 2008
    37
    0
    well i finally found out how to do the subtraction,
    but i left with the negative number how can i solve it
    let's say i subtract 2 from 4
    2 - 4 = -2
    how can i make it -2
    otherwise my circuit work fine
     
  4. AlexR

    Well-Known Member

    Jan 16, 2008
    735
    54
    To subtract 2 from 4 you would change the 2 to -2 and then add.
    4 + (-2) = 2
    Code ( (Unknown Language)):
    1.  
    2. 4 = 0100
    3. 2 = 0010
    4.  
    5. -2 = (1101 + 0001) = 1110
    6.  
    7. 4 + (-2) =  0100
    8.             1110
    9.          =  0010 = 2
     
  5. mohsen

    Thread Starter Active Member

    Oct 24, 2008
    37
    0
    well it's not quit what i need.
    in this case i will end up with 2 instead of -2 ans so on
     
Loading...