Joined: Jan 14, 2010
Location: Moon Base
Audio files: 588
|Posted: Sun Sep 02, 2018 11:52 am Post subject:
basic guidelines for digital circuit design
|Here are some basic guidelines that might be useful if you want to design your own digital circuits. This is not an introduction into
electronics and you should already know a bit (or byte) about digital logic. There is an excellent post by Rykhaard with some basic
info about electronics which you can find here and there is of course a lot more in depth information available online.
feel free to add, correct, ask or comment in any other way.
Connecting outputs and inputs together
When you want to connect a single output of a logic chip directly to an input you generally don't need any extra components.
So no pulldown/pullup resistors or diodes. (there are some exceptions but I will get into that later)
Never leave input pins unconnected (floating)
If you leave an input unconnected its state is undetermined (at least for CMOS) which can cause all kinds of odd behaviour in the
circuit. This also goes for unused gates so if you have a circuit that uses a NAND chip like a 4093 but only uses 3 of the available
gates you should not leave the input pins of the unsused gates floating. Eventhough the output is not connected to anything it could
still cause problems internally. Generally unused pins are direclty connected to GND or V+ depending on their purpose, so without
any pulldown/pullup resistors. It doesn't alway have to be GND or V+ though, for example the inputs of an unused logic gate could
be connected to any digital signal which in some case might be easier when designing a PCB.
there are cases in which you might want to leave a pin unconnected. Because of the high impedance of CMOS inputs they can act
like an antenna and if you add a wire to it it can pick up all kinds of electromagnetic 'noise' so you could use this to create some
unpredictable signals. Be careful though, inputs are sensitive to static electricity so they could get damaged.
Never connect outputs directly together
If for example you would combine 2 signals, one being high the other low it'll create a dead short which has the potential to release
some magic smoke and as you might know chips don't work without this magic smoke. Logic gates are the key for combining signals
and simple gates like OR and AND gates can be achieved with some diodes and a resistor. (more about that later). There are some
exceptions: Some chips have what is called a tri-state output. This means that besides being high or low they can also be very high
impedance which basically makes them float. You can connect these pins directly together but you have to be very careful in the
design of the circuit so that they can never be in a state where they would create any shorts. Another somewhat similar exception is
when using analog muxes or switches. Output pins of these (or actually they are bi-directional so pins can be used both as output
and input) can also be high impedance so as with tri-state outputs they could be connected together directly if you design the circuit
When to use pulldown/pullup resistors
pulldown/pullup resistors are used whenever an input pin is connected to a signal but can stil end up in a floating state. An example
of this would be when you want to control an input with a switch. Let's say you have a switch between an input and V+. When this
switch is closed the input wil be high but when the switch is open the input would be floating. By also connecting a resistor to GND
to this input (= pulldown resistor) the input will be held low when the switch is open. You could also have a switch between the
input and GND in which case you would need to add a resistor connected to V+ (= pullup resistor). pullupdown/pullup resistors can
aslo be needed when using analog muxes/switches or chips with tri-state outputs as these can also cause a floating state. The choice
between a pullup or puldown resistor depends on the circuit.
note: the value for these resistors is usually not very critical and values between 10K~1M are most common
Diode OR/AND (mickey mouse logic)
Allthough diodes can serve several purposes the are often used in digital circuits to create simple logic gates to combine signals. You
could use actual OR/AND gates but using some diodes and a resistor can be much more convenient, especially when you need a gate
with a lot of inputs. To make an OR gate with diodes connect all the cathodes together, this will be the output. The anodes will be the
inputs. Whenever one or more of the inputs are high the output wil be high (like a standard OR gate) but if all the inputs are low the
output would be floating (the diodes block the current flow) so usually it also needs a pulldown resistor. To make an AND gate you
connect the anodes together, which will be the output and the cathodes will be the inputs. It's a bit less obvious than an OR gate but
when one of the signals is low (in other words they're not all high) the output will be low. However when all inputs are high the output
would be floating so in this case it needs a pullup resistor on the output. Because the outputs aren't buffererd this method can't always
be used. For example it gets a bit tricky when you would want to use a diode OR to control a diode AND or drive an LED. For this reason
it is also better to avoid using them as an output stage of a circuit, at least without an extra buffer for which a transistor/opamp/
comparator or even another logic gate could be used.
Note that you only need to use diodes for signals that can be both high and low. If for example you want to combine (OR) an output
of a logic gate with a switch connected to V+ you don't need a diode for the switch as it can never be low
As with the diode OR/AND gates you could use an actual inverting logic gate but sometimes a single transistor can be a lot more convenient.
Most commonly used is a standard NPN transistor (BC547, 2N3904 etc) with the Emitter connected to GND. The Collector will be the output
but since it can only provide a low signal in this configuration it also needs a pullup resistor. The base should have a current limiting resistor
in series and be treated as other inputs so not left floating. You could also use a PNP transistor connected to V+ and a pulldown resistor but
this is not used as often. One big advantage of a transistor over an actual logic gate is that it can be used to convert voltages. For example
controllling a logic circuit powered by 12V with 5V signals will usuallly not work but a transistor only needs about 0.7V on the base so 5V is
plenty and with a pullup resistor connected to 12V the output can now switch between GND and 12V with a much lower control voltage.
Although you could just use outputs of CMOS chips as they are it's wise to add a current limiting resistor in series to protect the ouputs
from accidental shorts. Personally I also add diodes in series which makes it possible to connect multiple outputs to one input as they
will form a diode OR together with the pulldown resistors I use on inputs. Downside of this method is that the outputs can only be high
because low signals are blocked by the diodes, so sometimes I have to add an extra pulldown resistor for example when I want to
listen to an output.
I won't go into the details but it is generally good practise to connect a small capacitor (10nF~100nF) between the supply pins of every
chip as close to the V+ pin as possible. Often these lunetta circuits might work fine without them but it can make the difference between
it properly working or not. There are cases where you don't want to use them, for example the Cacophonator which actually creates an
unstable supply voltage on purpose.
* (I might add some images later) *
"My perf, it's full of holes!"
SoundCloud BandCamp MixCloud Stickney Synthyards Captain Collider
Joined: Nov 23, 2015
Audio files: 23