# designing a if then circuit with exception

Discussion in 'Electronic Basics' started by Clive, Apr 5, 2004.

1. ### CliveGuest

I have come across a problem in my circuit design.

I need to acheive the following

If Fvoltage-Rvoltage=<100mv then output=low UNLESS Fvoltage<300mv

Are the voltages too small to use directly? or would they need
amplification?

How can design to circuit and keep it simple?

2. ### John PopelishGuest

Those voltages are fine when using comparators that have millivolt DC
errors.

Are you saying that you want the output to be low for inputs below 100
mV and also low for inputs > 300 mV, but high for voltages between
those?

If so, a window comparator composed to the two sections of an LM393
connected in parallel to the same pull up resistor might be accurate
enough.

There is a circuit that performs this function shown on page 10 of
this data sheet, labeled as 'Limit Comparator'.
http://cache.national.com/ds/LM/LM193.pdf

If, instead, you are saying that inputs below 100 mV cause an output
low, but inputs above 300 mV cause an output high, and inputs between
these limits produce outputs that have not yet been defined, then you
may be able to make that with just one comparator.

4. ### petrus bitbyterGuest

Rewriting in a pseudo language:

IF F-R<=100 THEN Q=0 UNLESS F<300

UNLESS does not compute that easy so I rewrite again:

IF (F-R<=100) AND (F>=300) THEN Q=0 ELSE Q=1

In this line I see an opamp calculating F-R and amplify it let's say ten
times. The opamp is followed by a comparator that compares the opamps output
signal to 1V. F can be amplified ten times and compared to 3V the same way.
A two inputs NAND makes Q from the outputs of the comparators.

An important point is the hysteresis of the comparators. They need some
hysteresis to prevent oscillations. The amount of hysteresis depends on the
required accuracy of the whole circuit.

petrus

5. ### John FieldsGuest

---  