Engineering Design a logic circuit to add two 2-BCD decade numbers

Click For Summary
The discussion revolves around designing a logic circuit to add two 2-BCD decade numbers, focusing on troubleshooting an incorrect addition result. The user initially encountered issues with their circuit, leading to confusion over the inputs and outputs, particularly regarding the handling of invalid BCD values. After adjustments, they achieved a correct output but questioned whether to connect certain comparator outputs to +5V, which was advised against due to potential undefined behavior. Participants emphasized the importance of using comparator outputs to generate error signals for invalid BCD digits instead of tying outputs directly to power or ground. The conversation highlights the need for careful circuit design to avoid short circuits and ensure accurate results.
Fatima Hasan
Messages
315
Reaction score
14

Homework Statement


Capture.png


Homework Equations


-

The Attempt at a Solution


Here's my work :
Untitled.png

When I added 0000 0001 to 0000 0000 , I didn't get the correct answer .
Could someone check where is my mistake please ?
 

Attachments

  • Untitled.png
    Untitled.png
    19.2 KB · Views: 373
  • Capture.png
    Capture.png
    22.7 KB · Views: 974
  • Untitled.png
    Untitled.png
    19.2 KB · Views: 730
Last edited:
Physics news on Phys.org
It looks like you are adding 0001 0000 to 0000 0000 and the answer is correct..
 
willem2 said:
It looks like you are adding 0001 0000 to 0000 0000 and the answer is correct..
I added 0000 0001 not 0001 0000 and the answer was 0000 0XX1 0000 .
Why I didn't get 0000 0000 0001 ?
 
Fatima Hasan said:
I added 0000 0001 not 0001 0000 and the answer was 0000 0XX1 0000 .
Why I didn't get 0000 0000 0001 ?
The only 1 input I can see is going into the adder on the bottom left, and this must be the adder for the most significant digit, since it has a carry in coming from the other adders. I have no idea where those XX come from. Could be unconnected inputs, inputs that are between a 1 and a 0 or inputs that are changing, and I don't see any of that.
 
willem2 said:
The only 1 input I can see is going into the adder on the bottom left, and this must be the adder for the most significant digit, since it has a carry in coming from the other adders. I have no idea where those XX come from. Could be unconnected inputs, inputs that are between a 1 and a 0 or inputs that are changing, and I don't see any of that.

I've solved it again and disconnected +5V from (A>B) :
A3.png

I got the correct answer which is 0000 0001 0000 , but the question mentioned that the circuit will work if A and B are invalid BCD (A > 1001 and B > 1001 ) .So , should I connect +5V to A>B ( A > 1001 which is invalid BCD ) as I did in my first solution ?
 

Attachments

  • A3.png
    A3.png
    15.6 KB · Views: 356
  • A3.png
    A3.png
    16.7 KB · Views: 508
Fatima Hasan said:
I got the correct answer which is 0000 0001 0000 , but the question mentioned that the circuit will work if A and B are invalid BCD (A > 1001 and B > 1001 ) .So , should I connect +5V to A>B ( A > 1001 which is invalid BCD ) as I did in my first solution ?
Those are outputs, so tying them to +5 V will get you undefined behavior. You should use the outputs of the 2 comparators that check A to produce an error signal that is 1 whenever one of the digits of A is out of range.
 
willem2 said:
Those are outputs, so tying them to +5 V will get you undefined behavior. You should use the outputs of the 2 comparators that check A to produce an error signal that is 1 whenever one of the digits of A is out of range.
Here's when I connected the (A>B) of the 2 comparators to +5V :
9.png
 

Attachments

  • 9.png
    9.png
    14.6 KB · Views: 368
  • 9.png
    9.png
    17.8 KB · Views: 462
Fatima Hasan said:
Here's when I connected the (A>B) of the 2 comparators to +5V :
That is as I would expect. You are not using the outputs of the 4 comparators on the left to produce an error signal.
If you do use the comparators, you should connect all inputs. Do you understand what the inputs and outputs of the comparator are meant for? I think you use those. http://www.sycelectronica.com.ar/semiconductores/74LS85.pdf
 
willem2 said:
That is as I would expect. You are not using the outputs of the 4 comparators on the left to produce an error signal.
If you do use the comparators, you should connect all inputs. Do you understand what the inputs and outputs of the comparator are meant for? I think you use those. http://www.sycelectronica.com.ar/semiconductores/74LS85.pdf
I connected the cascade inputs of all the comparators as follows :

A<Bin and A>Bin = Ground.
A=Bin = Vcc
And the outputs as follows :
A>B =+5V to produce an error signal which is 1 if A or B are invalid BCD.
A=B and A<B = Ground .
6.png

But I still didn't get the correct answer .
 

Attachments

  • 6.png
    6.png
    19.5 KB · Views: 408
Last edited:
  • #10
Fatima Hasan said:
And the outputs as follows :
A>B =+5V to produce an error signal which is 1 if A or B are invalid BCD.
A=B and A<B = Ground .

You should not tie any outputs to either 5V or ground. If you don't understand why that is, this circuit is too complicated for you. The XXX in the output is probably, because you shorted out the power supply, and your simulater doesn't know what to do. You should try to modify the circuit, so a lamp or LED gets lid whenever A or B has digits that are invalid. It's really much easier than the part of the circuit that modifies the digits after the addition.
 
  • #11
willem2 said:
so a lamp or LED gets lid whenever A or B has digits that are invalid.
It lids when A = 1100 :
6.png
 

Attachments

  • 6.png
    6.png
    17.9 KB · Views: 432
  • 6.png
    6.png
    16.3 KB · Views: 320

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
11K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 1 ·
Replies
1
Views
1K