combining two 4-bit numbers to form an 8-bit number

Thread Starter

super7800

Joined Apr 3, 2019
42

here is the schematic of my circuit, don't pay too close of attention to the connections as this is my test schematic and even if it was connected wrong it would not influence the question i'm asking.

as you can see from the above schematic, i input 4 numbers, ex (9 9 7 4), and when that is done the adders treat it like (A=99 B=74). however this is not happening. what i need to do is convert this (1001 1001) to this (01100011) so that i can add them. how could i do this? i've looked online and have not found anything. the above circuit is a scaled down version of a "much" larger circuit, which will need to convert this (1001 1001 1001 1001) to this
(0010011100001111). i figure that i can do that after first figuring this first part out.

to sum it up, convert this (1001 1001) to this (01100011). thanks.
 

djsfantasi

Joined Apr 11, 2010
9,155
You need to multiply the first digit by 10 and add the second digit.

So how do you multiply a number by 10 in binary? To figure this out, think about what multiplying by 10 really means? Can you factor the original statement, so that your solution can be expressed in powers of 2.

For example to multiply a digit by 3 can be thought of as multiplying by (2+1).
 

WBahn

Joined Mar 31, 2012
29,932
Another option is to work in BCD. That's how most calculators still do it. Whether this makes sense in your particular case depends on what you are doing with the values over all.
 

Thread Starter

super7800

Joined Apr 3, 2019
42


@WBahn yes BCD would probably be the best solution as this circuit is for part of a calculator.
@djsfantasi ill try that if this BCD method doesn't end up working. thanks.

i have constructed the above circuit, and i'm now wondering what i'm doing wrong. most calculations on the above circuit work great, whilst others do not. i've tried some things to fix it, and have tried looking online but no-one else that i can find has posted about this (lots about 4-bit, nothing about 8). what am i missing?
 

WBahn

Joined Mar 31, 2012
29,932
It would sure help if we had a bit more to go on than, "most things work, others don't, so tell me what's wrong?"

WHAT things don't work? HOW do they not work (what should they do, what do they do)? What have you don't to troubleshoot it?
 

Thread Starter

super7800

Joined Apr 3, 2019
42
here are some examples of the problem, what they should do is be correct, which they are not:

22+66=55 (0010 0010 + 0110 0110)
22+0=22
22+22=11
66+66=35
99+99=191
66+99=?? (came out in random binary not correlating to anything)

i have tried messing with the order of the inputs and outputs, to no avail. i have also tried putting each number (i.e. 22) into their 8-bit forms as well, but this doesn't work either. I.e. (0010 0010 + 0110 0110) => (00010110 + 01000010). putting them into their 8-bit forms worked on the circuit pictured in the first post, the basic 8-bit adder. since this is a BCD adder i didnt think it would work, which it didnt (putting it into 8-bit form).
 

JohnInTX

Joined Jun 26, 2012
4,787
https://forum.allaboutcircuits.com/...ls83-to-dual-7-segment-decoder-74ls47.146757/
.. is a thread which has some info that you may find useful including the same circuit you used in #4 to convert to BCD. The last comment about it only working up to 19 is not really a problem since the biggest result you can have adding two BCD digits is 18.

The base problem you have is that you can represent your values as BCD in your head but they're still binary to the adder i.e. adding two BCD digits yields a binary result. You have to convert back to BCD. One way to do it is:
Add 6 to the 4 bit result if
a) there is a carry out of the 4 bit addition OR
b) the 4 bit sum is >9
The result will be BCD and may be more than one BCD digit.
It looks like that's what you are doing in #4 with the lower row of adders but don't forget you have to propagate the BCD carry digit into the next sum.

It's hard to tell from the image but it looks like you have the input bit order backwards on the top adders in #4?

The rest of the stuff in your earlier thread about debouncing etc. is still valid.
https://forum.allaboutcircuits.com/threads/problem-with-shift-registers.158393/#post-1377590
Besides debouncing, if your button is wired like #1 here, you need a pull-down resistor to pull 4 LSTTL loads to <.8V when the switch is open to get a good logic low.

Good luck!
 
Top