Comparision Of 8 Bit Binary Numbers

M

Michael

Jan 1, 1970
0
Hi,

I have two 8 bit binary numbers and am looking for some way of detecting
which is the largest. What's the best way to go about this? I was thinking
of using 2 DACs and then a comparator....Is there a better way?

Cheers,

Michael
 
G

Genome

Jan 1, 1970
0
Michael said:
Hi,

I have two 8 bit binary numbers and am looking for some way of detecting
which is the largest. What's the best way to go about this? I was thinking
of using 2 DACs and then a comparator....Is there a better way?

Cheers,

Michael

There was a CMOS logical chip that used to do this for 4bits..... 4585?
(4-bit magnitude comparator) and then you could cascade them for more bits.

DNA
 
J

John Larkin

Jan 1, 1970
0
Hi,

I have two 8 bit binary numbers and am looking for some way of detecting
which is the largest. What's the best way to go about this? I was thinking
of using 2 DACs and then a comparator....Is there a better way?

Cheers,

Michael

There's a ttl/hcmos part that does this directly. google.

John
 
M

martin griffith

Jan 1, 1970
0
There was a CMOS logical chip that used to do this for 4bits..... 4585?
(4-bit magnitude comparator) and then you could cascade them for more bits.

DNA
the 74181 ALU might be ok for this, but I think it went out of
production a few years ago. It would take about 5 mins programming on
an 8051 etc


martin
 
M

Michael

Jan 1, 1970
0
Genome said:
There was a CMOS logical chip that used to do this for 4bits..... 4585?
(4-bit magnitude comparator) and then you could cascade them for more
bits.

DNA

Got it - 74HC85 Thanks guys

Michael
 
J

Jan Panteltje

Jan 1, 1970
0
There was a CMOS logical chip that used to do this for 4bits..... 4585?
(4-bit magnitude comparator) and then you could cascade them for more bits.

DNA

74HC[T]85
 
Michael said:
Hi,

I have two 8 bit binary numbers and am looking for some way of detecting
which is the largest. What's the best way to go about this? I was thinking
of using 2 DACs and then a comparator....Is there a better way?

You've already seen the 4-bit magnitude comparator and the 8-bit
equlaity detector in TTL.

The logic is straightforward, and easy to program into a relatively
small programmable logic device. I got a 10-bit magntude comparator and
a buried 10-bit counter into an ICT7024 in 1993 (with only a little
help from my friends).

A Xilinix CoolRunner in a 44-pin package could probably accomodate the
comparator and the rest of the digital logic in your system.
 
J

jack1981

Jan 1, 1970
0
The magnitude comparators are used to detect equality only as far as i
know. Please tell me if I am wrong.
 
J

Jacques

Jan 1, 1970
0
Texas Instruments 74HC682
It has 2 outputs : = and >
In stock at DigiKey $3.3 / pce
 
J

Jan Panteltje

Jan 1, 1970
0
The logic is straightforward, and easy to program into a relatively
small programmable logic device. I got a 10-bit magntude comparator and
a buried 10-bit counter into an ICT7024 in 1993 (with only a little
help from my friends).

A Xilinix CoolRunner in a 44-pin package could probably accomodate the
comparator and the rest of the digital logic in your system.

I got a 16 bit frame comparator in a PIC in 2000 ;-):

frame_comparator:
;test high byte first
movf comparator_high, W
subwf frame_8_high, W
btfss STATUS, C
;carry if frame_8_high < comparator_high
goto f8_smaller
;test if high bytes the same
btfss STATUS, Z
;if not same must be greater
goto f8_greater_equal
;test low byte
movf comparator_low, W
subwf frame_8_low, W
btfss STATUS, C
;carry if frame_8_low < comparator_low
goto f8_smaller

f8_greater_equal:
bsf fflags, GO_FLAG
;LED on
bcf PORTB, LED
return

f8_smaller
bcf fflags, GO_FLAG
;LED off
bsf PORTB, LED
return




Bill Sloman, Nijmegen (but in Melbourne at the moment).

mmm was not Melbourne burned down recently?
 
Jan said:
mmm was not Melbourne burned down recently?

A couple of small country towns have lost a few houses, but Melbourne
appeared intact when we came in to land, and none of the bits I've
visited so far have looked even slightly singed.

There is a drought that has been going on for a few years now, and the
reservoirs are down to 40% capacity. My cousin the statistician is
involved in the software to monitor the outputs from the new sensors
that now measure what rain there is, so it looks as if the politicians
are starting to take the situation seriously.

Melbourne may well burn down eventually but it will probably take a few
more years of drought to get to the point of being easily inflammable.
 
J

James Beck

Jan 1, 1970
0
You've already seen the 4-bit magnitude comparator and the 8-bit
equlaity detector in TTL.

The logic is straightforward, and easy to program into a relatively
small programmable logic device. I got a 10-bit magntude comparator and
a buried 10-bit counter into an ICT7024 in 1993 (with only a little
help from my friends).

A Xilinix CoolRunner in a 44-pin package could probably accomodate the
comparator and the rest of the digital logic in your system.
You could also use a 2764 EPROM and do a big lookup table.
Use the 2 8 bit values as the address bits and then you can either have
one or more of the data bits show which byte is bigger or have the
largest (or smallest) byte presented on the data out, and you can do it
with a 28 pin DIP part. I wouldn't want to do the 65K of values by
hand, BUT........

Jim
 
D

Don Lancaster

Jan 1, 1970
0
You've already seen the 4-bit magnitude comparator and the 8-bit
equlaity detector in TTL.

The logic is straightforward, and easy to program into a relatively
small programmable logic device. I got a 10-bit magntude comparator and
a buried 10-bit counter into an ICT7024 in 1993 (with only a little
help from my friends).

A Xilinix CoolRunner in a 44-pin package could probably accomodate the
comparator and the rest of the digital logic in your system.
And the problem with a plain old table lookup ROM is...?


--
Many thanks,

Don Lancaster voice phone: (928)428-4073
Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
rss: http://www.tinaja.com/whtnu.xml email: [email protected]

Please visit my GURU's LAIR web site at http://www.tinaja.com
 
S

Spehro Pefhany

Jan 1, 1970
0
The magnitude comparators are used to detect equality only as far as i
know. Please tell me if I am wrong.

You are wrong (and a top-poster). The 74HC85's have A>B, A<B and A=B
outputs (and inputs so they can be cascaded)... two required at ~30
cents ea., so this is a very good solution.


Best regards,
Spehro Pefhany
 
S

Spehro Pefhany

Jan 1, 1970
0
And the problem with a plain old table lookup ROM is...?

He could use something like an OTP 27C512, but it would be more
expensive by several times, require programming, and suck way more
juice than a couple 'HC85s.

On the plus side, it would likely be faster, and there would be some
left-over outputs which might be useful for some other purpose (for
example to compare each input individually to a fixed value).


Best regards,
Spehro Pefhany
 
G

Genome

Jan 1, 1970
0
Spehro Pefhany said:
You are wrong (and a top-poster). The 74HC85's have A>B, A<B and A=B
outputs (and inputs so they can be cascaded)... two required at ~30
cents ea., so this is a very good solution.


Best regards,
Spehro Pefhany

Space travel was in my blood.
There was nothing I could do about it.
I'm on another planet with you, with you, with you..... ooo oooo oooo

Look Nigel, if you want a bacon sandwich you can go and make it yourself.
Don't come back. I'll be too busy having a snuggle with the sheets and
sharing a washing dream with Genome.
 
S

Spehro Pefhany

Jan 1, 1970
0
Space travel was in my blood.
There was nothing I could do about it.
I'm on another planet with you, with you, with you..... ooo oooo oooo

Look Nigel, if you want a bacon sandwich you can go and make it yourself.
Don't come back. I'll be too busy having a snuggle with the sheets and
sharing a washing dream with Genome.

A pint of Smithwicks..


Best regards,
Spehro Pefhany
 
Top