Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
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.
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)
0001 1111111 - instead of 0110000 (8 instead of 1)
..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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.