At 16:26 11/27/2001 +0000, Alan Gorham wrote: >->Let's say you want your signal go high when the absolute value of the > >difference btween the signals A and B is less than d. Comparator 1 goes > >high when A>(B-d) and comparator 2 goes high when A<(B+d). After ANDing the > >comparator outputs, the output of this AND operation goes high when > >(B-d) > > >Of course, you have to wire the comparators so that you include the d > >appropriately. How todo this depends on what exactly you want to do... > >gotta tell more about what your objectives are, nature of the signals you > >want to compare, speed requirements, ... > >I want to compare a given value of resistor with an unknown resistor. >I was thinking of doing this by having two potential dividers, one with two >known resistors and the other >with one known resistor and the other would be the resistor under test. That >was difficult to write, so I've attached a schematic. > >I only need to set or clear a pin depeding upon the result of the test and >the speed is not critical. There are a few alternatives (again depending on some unknown specs... :) Some of them are: 1- Instead of the comparator in your circuit, you can use an opamp wired as difference amp and read the output with an ADC input. 2- You can add a second comparator, with the resistor divider set like I explained above, to create a small "middle ground" where both comparators are in the same state. 3- Depending on the needed precision, you may also be able to read the voltages of the two dividers directly with an ADC input and do the comparison in firmware. This is probably the least external parts count, but it's also the least sensitive option. ge -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu