Electric Lunatic
www.ElectricLunatic.net
Flash Analog To Digital Converter
Signed Conversion
Using Discrete ICs
Introduction
This artical is about how an signed four bit flash converter could be implemented using discrete ICs and other components. It runs on a dual +/-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.
This page will discuss the signed flash A to D converter to the priority encoder. After that, the final conversion to either 1's complimanr or 2's compliment notation is discussed on separate pages.
Schematic
A schematic of the circuit including the linear input circuit, comparators and priority encoder is shown below.
Discussion
Input Circuitry
I'll start with discussing the linear input circuitry. This is much more complicated that the input for the un-signed version of this circuit and the 324 op-amps and 311 comparator operate from a dual +/-5V supply. An absolute value converter is used to change a negative input voltage to positive because the 339 comparators operate from a single +5V power supply. A polarity detector is necessary for the two's compliment conversion for negative input values done in the digital section of the circuit.
The illustration below shows the functional units in the linear input section.
Input Buffer
The input is buffered by a 324 op-amp in voltage follower configuration. This presents a lower input impedence that does the inverting gain amplifier.
Input protection isn't shown in the schematic but is advisable, especially if the input voltage values are not always certain. Input voltages should not exceed the +/-5V power supply without risking dammage to the IC. Two back-to-back zener diodes shunted to ground can be used for protection. 3.9V or 4.1V zeners would work well. With a dual +/-5V power supply, I found experimentally that the output of the 324, in voltage follower configuration, can swing from -3.8V to +4.5V. Negative input voltages beyond -3.8V will result in loss of information, so input voltage should be limited to +/-3.8V or less.
Gain Amplifier
The gain amplifier is an inverting amplifier and will allow a gain less than one. Values for Ra and Rg are not specified in the schematic. In the actual build Ra and Rg are 23.7K at 1% tolerance for a gain of -1. Values from 10K to 100K for Ra and Rg are suitable. (I used 23.7K because I have a whole bag full of them.) If a fixed gain is required, 1% tolerance resistors should be used. (Offset voltages aren't so bad with the 324 to where 1% tolerance is irrelevant, unless gain is very high.) Rg can be a potentiometer for variable gain.
Polarity Detector
The polarity detector is a simple zero crossing detector. This is done with a 311 comparator powered by a +/-5V power supply. The input to the comparator is connected to output of the gain amplifier. The gain amplifier is an inverting amplifier so the polarity detector comparator is in the non-inverting comparator configuration. An output of logical 1 means negative polarity. (Even though the 311 is powered by a dual polarity +/-5V supply, with a pull-up resistor, the output swing is from ground to Vcc (+5V in this application), making it TTL compatible.)
Absolute Value Converter
An absolute value converter is necessary because the 339 comparators operate from the single +5V power supply. The polarity detector supplies information to the digital logic to properly convert negative values to a two's compliment binary value for negative voltage inputs.
The values for the resistors Ra and Rb are not given in the schematic, however, they should be 1% tolerance resistors from 10K to 100K. (Again, offset voltages aren't so bad with the 324 to where 1% tolerance is irrelevant, unless gain is very high.) In the actual build Ra is 23.7K at 1% tolerance. Rb, being one half of Ra is simply two 23.7K resistors in parallel. (Again, I used 23.7K because I have a whole bag full of them.) The diodes are common switching diodes - 1N914 or 1N4148.
The operation of the absolute value converter won't be explained here as the information is readily available online and in books about op-amp applications. A simple graph of the input verses output of the absolute value converter is shown below.
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 goes 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.
Copyright 2026, Jon T. Qualey. All Rights Reserved
Back To Flash A to D Converter