I am building a 4-bit adder/subtractor circuit using only logic gates on a breadboard. The following IC chips are being used:
XOR- 7486, AND - 7408, OR - 7432.
I have the full adders working fine. However, I can't seem to get my subtractor working, using an XOR gate - 7486. I understand the math, 2s complement, truth table, and concepts. I attached a schematic.
Problem: I don't understand where to connect the first carry-in. Since there is no carry-in on the first adder, I tied it to ground. That makes the adder work.
However, in order for the subtractor to work, I am confused about where to connect the first carry-in. The schematic shows it to be connected to both the mode switch and the first B input for the first full adder. I did that. It just makes the circuit light up random values. Even when all the inputs are low. I have the first input of B (LSB, B0) connected to the XOR, along with the first carry-in. The output is connected to the B input of the full adder.
I get the feeling that I am making this more difficult than it should be. If I can get the first carry-in connected correctly, I believe I will be fine from there.
As soon as I flip on subtractor (¬ADD/SUB) to high, the value 4 comes on, without any inputs (A = 0, B = 0).
When A = 0 and B = 1, the value is 3.
When A = 1 and B = 1, the value is 4.
When A = 3 and B = 1, the value is 6.
When A = 2 and B = 3, the value is 3.
Also, the adders were working fine until I hooked up the subtractor. The adders are not giving correct values either.
It has to be my first carry-in is wrong.
However, I have it connected to the mode and the carry-in, as well as the XOR.
