Electric Lunatic
www.ElectricLunatic.net
Flash Analog To Digital Converter
Unsigned Conversion
Using Discrete ICs
Introduction
This artical is about how an unsigned three bit flash converter could be implemented using discrete ICs and other components. It runs on a single +5V power supply. 74LS TTL logic is used and is fully compatible with TTL and 5V CPU systems.
Seven comparators are used to to detect seven levels, the level increment being 12.5% of the reference voltage. The eighth comparator in one of the quad camparator ICs is not used because of the behavior of the 74LS148 priority encoder that is explained later.
Below is a graphic illustrating the threshold levels of the comparators.
Schematic
A full schematic of the circuit is shown below.
Discussion
Input Amplifier
The op-amp used as the input amplifer is a 358. This is a dual op-amp designed to operate from a single polarity power supply. A 324 can be used as well. The input amplifier is in the non-inverting configuration because it is operating from a single +5V supply.
The resistor Rb is connected to the inverting input and Rg is the gain resistor in the feedback loop. The gain of a non-inverting amplifier is 1 + Rg / Ra. Of course, the gain of the input amplifier cannot be less than one. If a gain of one is desired, the input amplifier can simply be a voltage follower and will have a higher input impedence than if the input were to be connected to all seven comparators. If a specific gain is desired, resistor values can be chosen accordingly and 1% tolerance resistors are recommended. Rg may also be a potentiometer if so desired.
Input protection isn't shown in the schematic but is advisable, especially if the input voltage values are not always certain.
The input voltage must not go negative (beyond specified limit) when using a single positive power supply, otherwise the op-amp may be damaged. A simple silicon blocking diode may be used at the input but you will have to deal with the 0.7V voltage drop of the diode when forward biased. When the blocking diode is reverse biased (and blocking negative voltage to the op-amp), the op-amp input will float, which is problematic but will protect the op-amp from damage.
The inputs of the 358 (and 324) are specified to tolerate minus 0.3V when powered by a single positive power supply. A germanium signal diode can be used to shunt negative voltages at the input to ground because it's forward bias voltage is typically 0.2V. However, most germanium signal diodes can tolerate only 40mA to 50mA of forward bias current.
If a positive voltage at the input exceeds the positive power supply voltage (+5V), the op-amp may be damaged. Also, the output of the 358 (and 324) won't swing to the positive power supply, so the input voltage shouldn't exceed +4V when operating with a +5V power supply. A zener diode shunt to ground on the input will limit the positive input swing (3.9V or 4.1V zener will do).
Voltage Reference and Divider
As can be seen, there is a stack of resistors (Rdr) used as a voltage divider for the threshold values of the comparators. At the top of the resistor stack is a potentiometer (Rra) used to adjust the range of the voltage divider. This is useful when a fixed gain is used in the input amplifier. Values are not given for these resistors as it depends on which resistor values are to be used and the input bias current limits of the 339. All resistors in the dividers (Rrd) must be the same and should be 1% tolerance.
Now, in the actual build on a solderless breadboard, the potentiometer (Rra) is 2K and the resistors in the divider (Rrd) are 300 at 5% tolerance (I used 300 Ohms at 5% tolerance because I have a whole bag full of them and accuracy of the prototype doesn't matter - it just has to work correctly). There are eight resistors in the voltage divider and at 300 Ohms, thats a total of 2400 Ohms. With Rra set to zero, thats about a 2mA draw from the power supply. When Rra is set to 2K, there is about 1mA of current available at the input of the comparator at the bottom of the stack.
The specified typical minimum input bias current required by the 339 is 25nA. With this being said, much higher resistor values for Rra and Rrd can be used. However, in the interest of eliminating potential problems with noise, I would recommend values for Rrd be no higher than 4.7K and Rra be no higher than 500K. There is a .1uf decoupling capacitor between Rra and the voltage divider to eliminate noise originating from the digital circuitry.
Comparators
The comparators used are the 339. This is a quad comparator IC and is a legacy device that is readily available. If the reader chooses to build this circuit with the 339 and doesn't have experience with the 339, note that the pinout of the IC is not symetrical left to right.
The comparators are used as inverting comparators. The output is pulled low when the input exceeds the reference voltage. This is done because the the inputs of the 74LS148 are inverted, or active low. (The 74LS148 is usually used as a CPU interrupt priority encoder. Interrupt signals are usually active low to prevent false triggering by noise.)
Why not use all eight comparators available for increased resolution? Because of the behavior of the 74LS148 priority encoder. This is explained in the next section.
A pull up resistor is required on the output of each 339 comparator to interface with TTL. A 1K pull up resistor is used in this circuit and the current sink is well within the limts of the 339.
The graphic below shows the output table of the comparators per percentage of reference input.
Priority Encoder
The seven outputs of the comparators are converted into a three bit binary valuw with a 74LS158 priority encoder. Like the inputs, the data outputs of the 74LS148 are inverted as well (I don't know why it was implemented this way). The outputs will have to be inverted to get the desired binary output and this is explained in the next section.
A complete function table for the 74LS148 is readily available online or from manufacture's databooks. Below, a similar table is shown for the 74LS148 when used in this particular application. (The output value is of the highest order input set to active and this can be one input only. However, in this application, all inputs below the highest order active input are set to active as well.)
The EI input (enable inputs) is set to zero. Input line zero is also set to zero. This brings us back to the question "Why not use all eight available comparators and connect them to all eight inputs on the priority encoder?". The answer is that the output value of the 74LS148 is 111 when all eight inputs are set to logic 1 (inactive) and when input zero is logic 0 (active) and the remaining seven inputs are inactive. The outputs for these two input cases are ambiguous. An excerpt from the actual 74LS148 function table is shown below :
Inputs Outputs
0 1 2 3 4 5 6 7 D2 D2 D0
-------------------------------------------------
1 1 1 1 1 1 1 1 1 1 1
0 1 1 1 1 1 1 1 1 1 1
X 0 1 1 1 1 1 1 1 1 0
X = Input Irrelevant
As can be seen, using the data shown, there is no way to determine whether all input lines are inactive or only input line zero is active.
The reason for this is so that two or more 74LS148s can be cascaded using the two additional outputs GS and EO (not shown here). With that being said, the GS and EO outputs could be used with additional digital logic to add one to the output value when at least one of the input lines is active. This would be done with a four bit adder (such as the 74LS283). This would allow all eight comparators and input lines to be used. I didn't implement this to keep things simple in this example.
Data Latch
I chose to put a latch on the output of the priority encoder so that the encoder output could be latched at any time and retained until the data is read.
For this I chose the 74LS175 quad D flip-flop. The 74LS175 is able to latch and hold input data. It also offers complimentary outputs that will invert the output of the priority encoder to give the correct binary value.
If this circuit were to be interfaced to a CPU bus or any other digital bus, a tri-state buffer would be used on the output of the latch. Buffers such as the 74LS125, 74LS244, 74LS541 or 74LS365 could be used.
Copyright 2026, Jon T. Qualey. All Rights Reserved
Back To Flash A to D Converter