IC implementation of min function (looking for)

Hi all,

I'm trying to find an integrated circuit that implements the min function, as in min(3, 4, 6) = 3 I'm having trouble with my search because the terms "min" and "minimum" are so heavily overloaded. Can someone please help me find either the IC itself, or the right search keywords?

I want to find a chip that maps N digital input pins to a smaller number of output pins that will carry the number of the lowest HIGH input pin. So, for instance, if it has 10 input pins and let's say that pins 3, 4, and 6 are all HIGH, the output will be 3 (which I can imagine would use either 4 digital output pins or a single analog pin).

The problem could also be that I'm thinking about this the wrong way. Here's some more context, if it helps:

I'm designing my first arduino project and I would like to make a USB midi controller. Specifically, I would like to make one that emulates an old monophonic synthesizer, meaning that even though it has 44 keys only one note will sound at a time. When multiple notes are pressed simultaneously only the lowest note will sound.

It seems like a shame to waste 44 inputs on the keys when only the lowest one will be active at any time. If I could find a solution to output the minimum HIGH pin out the 44 then I could reduce those 44 digital inputs down to 6 digital inputs or a single analog input. I realize that I can just buy a multiplexer and read all 44 pins through that, but I'm already buying a mux shield and an arduino mega in order to handle the huge number of inputs I will have (29 continuous and 59 discrete) so I would like to take advantage of the monophonic nature of the synth in hardware, rather than waste the inputs.

Thank you very much for your time!

It's called a "Priority Encoder":

74HC147 = 10-input -> 4-bit Priority Encoder http://www.nxp.com/documents/data_sheet/74HC_HCT147_CNV.pdf

74148 = 8-input -> 3-bit Priority Encoder http://www.jameco.com/Jameco/Products/ProdDS/49496TI.pdf

Either a priority encoder (74LS148) or a comparator (74LS85) ?

It’s called a “Priority Encoder”:

Thanks, johnwasser! I really appreciate the help.

AWOL: Either a priority encoder (74LS148) or a comparator (74LS85) ?

A quick scan through the wikipedia entries for pritority encoder and comparator makes me think that the priority encoder is going to be the winner for my problem, but I'm going to dig deeper to find out for sure. I'll post an update once I figure it out.

I really appreciate the help - thank you!

This is what I love about this community.
It’s hard to find something when you don’t know what it’s called, but there is always somebody around that has more experience in a relevant area.

Shpaget: This is what I love about this community. It's hard to find something when you don't know what it's called, but there is always somebody around that has more experience in a relevant area.

No kidding. I could have wasted my whole day off just trying to figure out the right name, but now I can push forward on my project design and feel good at the end of the day. A healthy user community is a beautiful thing!

So, from what I've learned today the Priority Encoder is the best solution to my problem. The Comparator will compare two quantities and tell me how they relate to each other, eg. a>b. The Priority Encoder will tell me which pin was the high pin, which is equivalent to the max function. I can convert that to a min function with a logic inverter.

It seems that the 10->4 Priority Encoder has the most input pins of all of those available. This means that I would have to construct a larger one out of the smaller ones. The data sheets for the chips that I looked at all explain how to do this.

I also found people online suggesting that it would be better to use a Complex Programmable Logic Device (CPLD) to construct the 64->6 Priority Encoder that I'm looking for, but after a quick look around the web I found that the cost of a development kit for a CPLD is prohibitive.

So, that's what I've got, in case anyone else finds it useful. I feel like I can proceed now. Thanks again for the help!