# 9s complement of BCD digit

Discussion in 'Homework Help' started by samina, Mar 18, 2010.

1. ### saminaMember

Joined:
Aug 9, 2009
Messages:
91
Likes:
2
Location:
i have to design a combinational circuit which would generate 9s complement of a BCD digit.

if i subtract the digit from 9, i will get the output. but i dont know what to use for subtraction.

do i need to use any terminal for carry operation

hope to get help from u?

2. ### saminaMember

Joined:
Aug 9, 2009
Messages:
91
Likes:
2
Location:
Can i use here selection variable ?

3. ### ericgibbsWell-Known MemberMost Helpful Member

Joined:
Jan 4, 2007
Messages:
21,174
Likes:
644
Location:
Ex Yorks' Hants UK
ONLINE

Joined:
Jan 12, 1997
Messages:
-
Likes:
0

5. ### saminaMember

Joined:
Aug 9, 2009
Messages:
91
Likes:
2
Location:

hi eric,
I know the process, but i need to design a circuit which will do the operation
can u suggest anything about that

6. ### MrAlWell-Known MemberMost Helpful Member

Joined:
Sep 7, 2008
Messages:
11,026
Likes:
951
Location:
NJ
Hi,

What you could do is look at the ALU TTL chips and see what you can get from the data sheet. It's possible to use gates to do this, but
you'll need to look at how it is done and those chips might help. Of course if you use those chips directly that's even easier.
One ALU chip part number is 74181.

Another possibility is to use 1 bit adders after taking the 2's complement of the number. One part number is 74183 but you could make your own.

Still yet another possibility is to use a method sometimes called the 'tare' method. This involves a set of pre-settable up/down counters where you load the number to be subtracted from into the counters (minuend) first, then pulse 'down' the entire count of the number to be subtracted. If another set of counters is used to store the subtrahend, the first set can be pulsed while the second set is also pulsed and when the second set gets to zero stop the pulsing and extract the result from the first set.
Using a high frequency this can be fast, but it will of course be slower for a large number of BCD digits.
For example, if you want to subtract '8' from '9' you load the first counter with '9' and the second counter with '8'. Then, start pulsing 'down' both counters until the second counter reaches zero. At that point the first counter will contain '1', the result.

Last edited: Mar 20, 2010
7. ### xpi0t0sMember

Joined:
Feb 22, 2003
Messages:
69
Likes:
0
You don't need to do a subtraction; just design the truth table the other way round:

abcd 0123456
0000 1111011 - instead of 1111110 (i.e. display 9 instead of 0)
..etc
So for an input of 0000 the output would be 9, for 0001 8, 0010 7 and so on. Then from the truth table work out an appropriate arrangement of gates for segments 0-6.

Or if you already have a BCD decoder and you need to add some glue logic to subtract then just do the truth table for that:

abcd a'b'c'd'
0000 1 0 0 1
0001 1 0 0 0
0010 0 1 1 1
etc
d' is just not-d, of course. From these 3 lines it looks as if c' might equal c. There'll be more to a' and b'.
Then feed a'b'c'd' into the decoder instead of abcd.