# Simple analog to digital conversion??

Discussion in 'Electronic Basics' started by [email protected], May 19, 2007.

1. ### Guest

Hi all,

I'm looking for the *simplest* way to convert a 3-state analog input
(-5V, 0V, or +5V) into a 2-channel TTL output, as shown in the
following truth table:

Input Out 1 Out 2
------- -------- --------
-5V L H
0V L L
+5V H L

I'm a noob and have come up with a pretty convoluted way to do this,
but I'm not sure how to do it with a single chip-- it seems simple
enough. Any suggestions?

2. ### PuckdropperGuest

Have you considered looking for a chip to do this for you? You may want
to check out something like the semiconductor reference guide that Radio
Shack had available at one time.

I'd probably start with a couple diodes and a NOT gate. (For 5V
magnitude voltages, output1 & output2 are NOTted.)

Puckdropper

3. ### ChrisGuest

Hi, Vogelito. The classic solution is to use a dual comparator IC to
compare the input voltage with a reference, and output a digital logic
signal. This circuit will fulfill your 1 IC requirement, but will
also require some resistors (view in fixed font or M\$ Notepad):

|
| VCC
| + VCC
| VCC | +
| + .-. |
| | | |10K .-.
| .-. | | VCC | |10K
| 10K| | '-' + | |
| | | | |\| '-' VCC
| '-' o-----|-\ | +
|Vin ___ | | | >--o |
| o-|___|-o----)--o--|+/ 1 .-.
| 10K | | |/ | |10K
| .-. | LM393 | |
| 20K| | | |\ '-'
| | | '--|-\ |
| '-' | >------o
| | .--|+/ 2
| o-- |/|
| | ===
| .-. GND
| | |10K
| | |
| '-'
| |
| ===
| GND
|
(created by AACircuit v1.28.6 beta 04/19/05 www.tech-chat.de)

The two input resistors change the -5V/0V/5V input into a 0V/2.5V/5V
input, which allows you to use a single power supply for the LM393
dual comparator. The two 10K and 20K resistors set the logic level
changes at 1.25V and 3.75V, halfway between the input levels. The two
10K resistors at the outputs of the comparators are necessary to
ensure logic level outputs for TTL, CMOS and all other +5V logic
families.

Here's the datasheet on the IC:

http://www.national.com/ds.cgi/LM/LM193.pdf

Chris

5. ### JamieGuest

you need a window type comparator.
this is basically 2 voltage comparators using the same
input signal.
one is driven via the - input and the other is driven
via the + input.
a common reference voltage is used to bias the remaining
inputs of each comparator.
etc..
Just put a couple of them together.
You can also use an old standby LM339 which has
open collector outputs..

6. ### defaultGuest

Window comparator is the obvious choice with a single quad comparator
chip or op amp to do that.

But what happens if your output is +/- 2.5 volts or exceeds 5 volts?
Do you care about that? If so, it gets more complicated.
--