PDA

View Full Version : Compare 6 voltages to find highest voltage

metron9
09-07-2006, 11:56 PM
I have 6 voltage lines with voltage of 0V to 1V I want to find the highest voltage line

I am looking for a hardware solution, is there a chip that can accomplish this task?

6 lines in , 6 lines out, the output would have only 1 pin high, or all low if 0V on all iinput lines.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think outside the BOX!

Newzed
09-08-2006, 12:00 AM
A 595 shift register should do the trick nicely.· A HIGH inut gives a LOW output, whuch could turn on an LED.

Sid

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Do you have a Stamp Tester yet?
http://hometown.aol.com/newzed/index.html

·

metron9
09-08-2006, 12:18 AM
I have not used a shift register before, but I thought I would expand on what I am trying to measure by way of an example.

If you have 6 microphones lined up in a row that can provide a signal from 0 to 1 volt
You tap one microphone , you now have 6 voltages from the highest (the one that is just been tapped) and 5 decending voltages.

How would you go about using a shift register to find the result that microphone 1 is the one that has just been struck given that that line would be the highest voltage.

I will have a look at shift registers while I wait for a reply.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think outside the BOX!

Steel
09-08-2006, 12:36 AM
This sounds a lot like an interview question I ask people....so I am pretty reluctant to answer...

...You apply for a job anytime recently?

metron9
09-08-2006, 12:39 AM
I have had a job since I was 15 years old, I started a company with my brother and Dad, I am 48 now and I have never applied for a job anywhere.
My company is C&C Special Products, www.ccspecial.com

I wish I could work in electronics for a full time job though it would be more fun than making stickers.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think outside the BOX!

Mike Green
09-08-2006, 01:41 AM
The Maxim MAX1112 is an 8 channel, 8 bit serial interface (SPI) with an internal 4V reference that runs off 5V and has an internal clock. It's not a hardware solution, but you could use this or a similar chip with a microcontroller like the Stamp for a 2 chip solution. The SX series could probably do the 6 conversions, but someone else would have to chime in here with experience. The PIC16F676 has 8 channels of 10 bit A/D conversion and would be a single chip solution.

You could do pair-wise analog comparisons with the output of the comparator feeding an analog multiplexor that forwards the analog level to the next set of comparators. You'd need 2 quad comparators (5 of 8 used) and a quad analog multiplexor to find the highest signal, then what's effectively a priority encoder to produce the outputs. I'm sure there are some gate arrays that include some simple analog circuitry that could do the whole thing, but it'd be simpler to use a PIC16F676 or SX28.

metron9
09-08-2006, 02:07 AM
I will be using the SX28 in the design (the 6 input lines from the device I am looking to build here)

I was thinking of using comparators, by using 3 comparators i can eliminate 3 of the lowest voltage inputs, but I have not had a chance to put it to paper (i am working on a printing press while I think about this stuff)

So in my hesd when it comes to more than a few connections,and and or gates and comparators all connected to give the output i am seeking, well It is just to much for one little head.

But it sounds like STEEL has the answer, I just need to pry it out of him somehow. Evan if he wont give up the answer, perhaps a few clues and i can go from there, get me pointed in the right direction as it were. I know I have to re-invent the wheel to learn this stuff but the more I learn the harder the questions I seem to ask.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think outside the BOX!

Mike Green
09-08-2006, 02:27 AM
Since you're already using the SX28, why not look in the various manuals for examples of analog to digital conversion. There are two (rather impenetrable) examples of 8 bit A/D conversion on the Parallax download page for the SX series. You don't need external comparators, just do 6 different A/D conversions, store the values, search the table of voltage values for the highest and use the index of the highest entry for the number of the pin to set to one ... bingo!

Mike Green
09-08-2006, 02:32 AM
I did look at one of the manuals and it indicates that there's only one comparator. You could use an external analog multiplexor, but it would be easier to use a whole ADC with 6-8 channels like the MAX1112.

Steel
09-08-2006, 03:09 AM
^

Sorry about that...I actually had one person ask on 3 different forums how to solve the problem and try to weasel into a design position...

I would agree with the MAX1112 interface.· Just connect the REF voltage to 1 Volt.

Connect /CS,SCLK,DIN,/SHDN,DOUT, and SSTRB to the SX...Or just connect what you need (/CS, SCLK, DIN, DOUT)

That way, you can connect all 6 inputs to this chip, use the SX to send the chip what channel you want to look at into DIN,(see documentation:http://datasheets.maxim-ic.com/en/ds/MAX1112-MAX1113.pdf) and SHIFTIN·DOUT,·SCLK, Variable·then you have the values in the SX.

Save the values as variables.· Compare the Variables to see which one is greatest/Least.·

At that point, you can use a D/A converter to spit those values back out, or you can send a message anywhere...

hope that helps.

Shaun

pjv
09-08-2006, 07:08 AM
Hi All;

The simplest answer here is to use an SX with 6 virtual A/Ds; it will even work when the signal is AC, provided the input frequency is not too high (say 10 KHz).

And, I believe the intent was to have an SX for further processing anyway, so 12 resistors, 6 small capacitors, a few dozen lines of assembler, and you're done, everything in one chip. It will consume 12 I/O pins for frequencies near the top end, and could be only 6 pins for lower frequencies, up to, say, 100 Hz.

Cheers,

Peter (pjv)

Mike Green
09-08-2006, 08:20 AM
Peter,

For my information, where's there information on doing multiple virtual A/D converters with the SX chips?· I could only find source code for a single A/D converter and the SX user's manual talks about a single comparator on one pin of the B or E port.· I'm sure this would be a good fit for this project, but I don't know how it works on the SX.

Mike

metron9
09-08-2006, 10:13 AM
Thanks for the input on this one, I had the idea floating in my head that if comparing two voltages with a comparator was simple there must be an equally simple solution to compare six. Should be very fast frequency response time depending on the speed of the comparators.

My solution fully hardware for about \$8.00.

I realize that with this solution I will need to increase the voltage on the sense resistor part of the circuit but that is not a problem.

The ADC solution would work as well but I am having more fun designing hardware solutions vs software.

Of course I don't know if this will work, the minus input may have to be biased, some comparators would require pullups on the output, I have some that don't require pullups.

No luck on DIGIKEY in their search for diode... arrays filter but that is a science in itself finding parts that digikey has without knowing the part number.

Just for fun what are your thoughts on this potential solution. Any design recommendations?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think outside the BOX!

pjv
09-08-2006, 11:00 AM
Hi Again;

Mike, the comparator is not (or rather need not be) used in the virtual A/D design. What is done instead is the switching level of an input pin is used; it's half of the supply voltage when using the CMOS intut mode. There are two rather similar designs, one uses two port pins, runs a little faster, and takes a little less software.... about 8 or 12 instructions for one A/D. The other design uses only one port pin, is a little slower, and has slightly more complicated software. Multiple A/D's are simply a minor extension in the software. You can have as many as you have port pins available plus two resistors and one small capacitor each.

I owe an explanantion and some schematics to another poster (Joshua), and I now finally have some time to dedicate to this, so in the next while I will attend to it. In fact, one of my current contest entries uses 8 single bit A/D's for sensing analog and digital input levels.

Metron9; I'm curious why anyone would opt for a more complicated (my opinion) solution than a simpler/more elegant one, especially if you already have an SX in the circuit. Depending on what your application is. your circuit may not be adequate..... latching outputs for example in case the signal is AC.

Anyhow, if your preference is hardware over minimal component count (always my preference), then have at it.

Your approach would NOT be how I would tackle your quest..... but then only you know what you're trying to achieve with this application. The rest of us are just guessing.

Cheers,

Peter (pjv)

Post Edited (pjv) : 9/8/2006 4:04:03 AM GMT