Making Gates

From BEAM Robotics Wiki

Jump to: navigation, search

We apologize for the need to display ads on this wiki. But somehow we must pay for hosting.

Sometimes it is necessary (even in BEAM robots to use some type of digital logic to make a robot (or at least the circuit used to control that robot) do exactly what a builder intends for it to do. But having to add an additional chip to the circuit is something that BEAMers typically try to avoid. In that spirit, the following will present some easy ways to implement simple gates using only a resistor, one or more diodes and maybe an extra inverter or two.


Contents

[edit] AND with that said…

Figure 1 :A simple Diode Logic AND gate circuit
Figure 1 :
A simple Diode Logic AND gate circuit

The schematic in Figure 1 shows a simple AND gate made using an old technique called Diode Logic. Basically the AND circuit consists of a resistor (at least 10 K) connected to the positive power supply rail, and two diodes that act as the inputs (The diodes shown in gray represent any number of additional inputs. As many as are needed can be incorporated into the circuit).

As long as one or more of the inputs is pulled low, the associated input diode(s) will be forward biased, allowing the low signal(s) to pass through the diode(s). Any incoming low signal will overwhelm the current passing from the positive power supply rail through the resistor. As a result the output of this simple AND circuit is pulled down to (within approximately .7v of) the negative power supply rail, making the AND output low.

When an input line is pulled high, that input’s diode will be reversed biased. As a result no current can pass through that diode. This prevents the kind of dead shorts that would otherwise occur whenever one input was pulled high while another input was being held low.

If all of the inputs are pulled high at the same time, there will of course be no low signal to overwhelm the current passing through the resistor from the positive rail of the power supply. Consequently the AND circuit output will be high.

Figure 2: A simplified Diode Logic AND/NAND gate circuit
Figure 2:
A simplified Diode Logic AND/NAND gate circuit

The circuit in Figures 2 uses the same concept, but in a slightly simpler configuration. Rather than connecting one side of the resistor to the positive power supply rail, the resistor is used in place of one of the input diodes. The behavior of the circuit is identical to the circuit in Figure 1, but is accomplished using one less component.

Figure 2 also shows how by adding an inverter to the output of the circuit, turns it into a NAND gate.


[edit] OR how about this…

Figure 3:A simple Diode Logic OR/NOR gate circuit
Figure 3:
A simple Diode Logic OR/NOR gate circuit

If an OR gate is needed, the same basic circuit describer above can easily be adapted to this purpose. As shown in Figure 3, all that must be done is to reverse the direction of all of the input diodes.


In this configuration the behavior of the circuit is such that any time all of the inputs are pulled low, the diodes will all be reverse biased, so no current will pass through them. However the low signal on Input 1 can and does flow through the resistor (again at least 10k) used instead of a diode and will thus pull the OR output low.

If Input 1 is pulled high, while the other inputs remain low, the OR output will also be pulled high by the current flowing through the resistor.

Conversely, even if Input 1 continue to be held low, if the signal(s) on any other input(s) goes high, then the associated input diode(s) will be forward biased. Consequently the high signal(s) will pass through the diode(s) and overwhelm the current flowing through the Input 1 resistor. This means that the OR output will be pulled to (within approximately .7v of) the positive side of the power supply and thus be high.


As with the AND circuit, describe above, the diodes prevent a short circuit from occurring whenever any input is pulled low at the same time that another input is being pulled high. And of course adding an inverter to the output of the OR circuit turns it into a NOR gate.


[edit] An X-ORbitant use of inverters

Figure 4:A simple X-OR circuit
Figure 4:
A simple X-OR circuit

In this segment a simple X-OR gate is described. It involves combining both of the gate circuits described above, and is therefore only slightly more elaborate than what has been covered up to this point.


A version of the circuit shown in Figure 3 was first introduced in to the BEAM community in Message # 41754. Presented in response to an earlier post seeking an X-OR circuit made with and schmitt inverter. Droidmakr answered the request with the circuit shown in Figure 4. It is made by connecting the inputs of a AND circuit in parallel with those of an OR circuit. An inverter (is added to the output of the AND circuit (making it a NAND circuit). The inverter can be a Schmitt or non-schmitt type.

Two additional passive components are then used to connect the outputs of these two gate circuits together. A resistor (RX) is placed in series with the OR output line. And a diode (DX) is used to connect the output of the inverter, to the free end of resistor RX. The junction between resistor RX and diode DX becomes the X-OR output.

As long as at least one of the inputs is held low, the output of the inverter will remain high. This means that diode DX will be reverse biased and no current will pass from the inverter output to the OR output line. Therefore the NAND circuit will have no effect on the X-OR output. Instead, the X-OR output will be that of the OR circuit.

So if both of the X-OR inputs are held Low the X-OR output be low. And if of the inputs is pulled [high]], while the other input is held low, the X-OR output will be high.

Now if both of the X-OR inputs are pulled high, the output of the OR circuit will be high, but the output of the inverter in the NAND circuit will go low, and diode DX will be forward biased. Therefore it will allow the low signal from the inverter output to reach the OR output and overwhelm the current passing through resistor RX. As a result the X-OR output line will be pulled low.

So put simply, any time both of the X-OR inputs are pulled low, or both are pulled high, the X-OR output will be low. But if one, and only one of the X-OR input is pulled high, then the output of the X-OR will also be high.

It should probably be pointed out that the circuit originally posted had an additional inverter and was presented as an X-NOR gate.


[edit] X-NORing the Possibilities

Figure 5:A simple X-NOR circuit
Figure 5:
A simple X-NOR circuit

In a later post (Message #43863), Wilf Rigter pointed out that by turning all of the diodes in the opposite direction (as seen in Figure 5) the X-OR circuit could be made to act as an X-NOR gate instead.


A close examination of the schematic in Figure 5 will reveal that whereas the X-OR was made up of a NAND circuit connected in parallel with an OR circuit, turning the diodes around means that the X-NOR is in fact an AND circuit connected in parallel with a NOR circuit.

X-OR and X-NOR gates can be quite useful. For instance, they can be used to allow one signal to invert the state of another signal as needed. Basically, one of the inputs would be used as a Signal Input, while the other input would act as the Control Input.

If an X-OR is used for this purpose, then as long as the Control Input is held low, the output state of the X-OR will be identical to that found on the Signal Input. If on the other hand, the Control Input is pulled high, the signal on the output would be opposite that of the signal on the Signal Input.

If an X-NOR is used instead, then the state of the X-NOR output will be the same as that on the Signal Input only when the Control Input is held high. If the Control Input is pulled low, then the output of the X-NOR will be the inverse of the signal on the Signal Input.


[edit] In Conclusion

The above article describes how to use a resistor, two or more diode, and in some cases an inverter, to make the most basic and common types of digital logic gates. But there will be times when a BEAM robot will require something capable of more specialized kinds gating functions. Fortuunately, BEAMers tend to be quite creative, and they have managed to come up with some elequent solutions for dealing with these situations. The following articles represent a few good examples.

[edit] Special Purpose Logic Circuits

[edit] External Links

[edit] Play-Hooky.com Articles

[edit] Wikipedia Articles


This wiki is sponsored and hosted by Interactive Matter
Personal tools
Ads to finance this wiki