# comparator

Discussion in 'Homework Help' started by zulfi100, Feb 6, 2013.

1. ### zulfi100 Thread Starter Active Member

Jun 7, 2012
464
1
Hi,
I dont know about comparator. I saw the circuit but its difficult to understand. Kindly guide me about comparator. I have got following question:
The binary numbers A=1100 and B=1001 are applied to the inputs of a comparator. What would be the output levels?

Zulfi.

2. ### nepdeep Active Member

Sep 14, 2011
140
0
As far as I know....depends on the comparator....is it the comparator that compares the greatest or smallest or equal....depending on the type comparator gives either true(high) or false(low) result

3. ### tshuck Well-Known Member

Oct 18, 2012
3,527
679
Which is compared to which? Is A compared to B, or B compared to A? A simple comparator tells you if input X is greater than input Y...

4. ### WBahn Moderator

Mar 31, 2012
23,187
6,982
And does the comparator treat the input as unsigned binary or signed binary? If signed binary, what representation is assumed?

5. ### zulfi100 Thread Starter Active Member

Jun 7, 2012
464
1
Hi,
Thanks for the replies but i have additional questions.

Kindly guide me about the output levels also. I think there should be only one output level and output would be in terms of 0 and 1. But how we get this value? Kindly guide me.

Zulfi.

6. ### ScottWang Moderator

Aug 23, 2012
6,422
995
Go to check mc14585 on page 2, then you will easy to figure out.

If you still have any questions, then post it.

Mar 31, 2012
23,187
6,982

8. ### zulfi100 Thread Starter Active Member

Jun 7, 2012
464
1
Hi,
Thanks for asking for the feed back
I think A is compared to B.
The document does not say about signed numbers.
A>B

Kindly guide me.

Zulfi.

9. ### WBahn Moderator

Mar 31, 2012
23,187
6,982
In your first post you said that you saw the circuit. But you are asking us to explain to you a circuit we have not see. If it is a standard part, give us the part number so that we can look it up. Otherwise please post the circuit schematic. It's important that we be talking about the same circuit.

10. ### zulfi100 Thread Starter Active Member

Jun 7, 2012
464
1
Hi,
I saw the circuit on web initially (wiki) which i was not able to understand as it had lot of electronics. Then i saw the circuit (datasheet) provided to me by ScottWang earlier in this thread. I am referring to that circuit in my answer. I want to get answer for the following question:

The binary numbers A=1100 and B=1001 are applied to the inputs of a comparator. What would be the output levels?

Which i thought is A>B but i am not able to undersatnd about the use of signed numbers in this context as the circuit provided by Scottwang (datasheet) does not discuss it.

Kindly guide me. I am grateful for you people in taking interest in my problem. Well done.

Zulfi.

11. ### ScottWang Moderator

Aug 23, 2012
6,422
995
The answer is at the fifth line of the truth table that I linked, that is item 2 for compares.

The meaning of A>B=1 is represent a high level, 0 is a low level.

|A3 = B3 | A2 > B2 | x | x | x | x | x | 0 | 0 | 1 | ← The last 1 = high level.

12. ### WBahn Moderator

Mar 31, 2012
23,187
6,982
Okay, so you are talking about an MC14585. Fine.

Notice the name of the device - "4-Bit Magnitude Comparator"

It compares magnitudes, thus the four bits are an unsigned integer.

The logic diagram is given in the data sheet, so you can always just walk your inputs through the logic and see what the outputs will be.

13. ### zulfi100 Thread Starter Active Member

Jun 7, 2012
464
1
Hi,
Yes i found. I would say its the second entry. I now realize that we have to compare the individual bits. But in the exam do we need to remember the entire table? Its simple to notice that 12(i.e A)> 9 (i.e B). If we had 9 (i.e A) & 12 (i.e. B) then A>B=0, A=B equals to 0 and A<B=1. Should we tell all the three outputs???

Zulfi.

14. ### WBahn Moderator

Mar 31, 2012
23,187
6,982
If you understand the function of the circuit, then answering in terms of the functionality should be fine unless the question specifically (or within the context of the exam) is looking for a more low-level answer. Yes, I would say you should give all three outputs. You should probably also specify what the other inputs to the circuit should be in order for your answer to be valid.

15. ### ScottWang Moderator

Aug 23, 2012
6,422
995
Talking about a digital comparators, they should be using bin to compares for each bit step by step, they comparing from the Most significant bit of 4 bits, that is the Leftmost bit as b3, and b2,b1,b0.

The answering is according to conditions of the inputs and outputs, if in your exam already setup the input and ouput bits conditions.

During A,B two nibbles comparing when which b3 of nibble is bigger one, then that nibble is the bigger one, so the I/O as this:
1. The input as : A>B
a) A3=1.
b) B3=0.
c) The other inputs just don't care.

2. The output :
a) A<B = 0.
b) A=B = 0.
c) A>B = 1

Otherwise you should go to compare the next bit - b2.

In another way.
1. The input as : A<B
a) A3=0.
b) B3=1.
c) The other inputs just don't care.

2. The output :
a) A<B = 1.
b) A=B = 0.
c) A>B = 0.

Otherwise you should go to compares the next bit - b2,

Using the way as above to comparing b2,b1,b0.

Byte = 8 bits
Nibble = 4 bits.
One Byte = Two nibbles.

16. ### zulfi100 Thread Starter Active Member

Jun 7, 2012
464
1
Thanks a lot, all of you for giving me so much time. Its really appreciating that you people tried to clear my concepts.

Zulfi.