<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Design and Technology &#187; Logic Gates</title>
	<atom:link href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/?feed=rss2&#038;tag=logic-gates" rel="self" type="application/rss+xml" />
	<link>http://www.resistors-and-diodes-and-picchips-oh-my.co.uk</link>
	<description>My Own Personal Yellow Brick Road</description>
	<lastBuildDate>Tue, 24 May 2011 23:47:04 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=3.8.41</generator>
	<item>
		<title>Returning to Logic Gates</title>
		<link>http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/?p=707</link>
		<comments>http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/?p=707#comments</comments>
		<pubDate>Mon, 07 Mar 2011 10:23:46 +0000</pubDate>
		<dc:creator><![CDATA[Lullabel]]></dc:creator>
				<category><![CDATA[Explorations]]></category>
		<category><![CDATA[Logic Gates]]></category>

		<guid isPermaLink="false">http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/?p=707</guid>
		<description><![CDATA[I&#8217;ve moved on a bit since the last time I looked at logic gates so I think it&#8217;s about time to revisit&#8230; I&#8217;ve found out a bit more on NOT gates, they are actually called inverters, not surprisingly as they &#8216;invert&#8217; the input into the output. When you connect up two inverters in series you [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve moved on a bit since the last time I looked at logic gates so I think it&#8217;s about time to revisit&#8230;</p>
<p>I&#8217;ve found out a bit more on NOT gates, they are actually called inverters, not surprisingly as they &#8216;invert&#8217; the input into the output. When you connect up two inverters in series you get a &#8216;buffer. All this does is take the output of the first NOT gate and feeds it into the input of the next one. The two cancel each other out so you the final output is the same as the first input:</p>
<p><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/buffer.jpg"><img class="alignnone size-full wp-image-959" title="buffer" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/buffer.jpg" alt="" width="363" height="137" /></a><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/buffer.jpg"></a></p>
<p>Possibly pointless? Not really, it does have a practical use. Logic gate circuits are <strong>signal amplifiers </strong>(remember logic gates are made up of those lovely signal boosting <a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/?p=672">transistors</a>&#8230;), a weak signal can be boosted using this combination of two inverters. The logic level isn&#8217;t changed, you still get a high output from a high input but the final signal is stronger than the initial one. The symbol is the same as for a NOT gate just without the little bubble on the end.</p>
<p><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/buffer-gate.jpg"><img class="alignnone size-full wp-image-960" title="buffer gate" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/buffer-gate.jpg" alt="" width="210" height="166" /></a></p>
<p>With additional inputs logic gates can process more complex information, for example a 2 input gate has 4 output possibilities, a 3 input gate has 8 output possibilities etc.</p>
<p><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/2-input-AND-3-input-AND.jpg"><img class="alignnone size-full wp-image-963" title="2 input AND 3 input AND" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/2-input-AND-3-input-AND.jpg" alt="" width="538" height="140" /></a></p>
<p><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/AND-table.jpg"><img class="alignnone size-full wp-image-807" title="AND table" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/AND-table.jpg" alt="" width="295" height="100" /></a></p>
<p><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/3-input-and-table.jpg"><img class="alignnone size-full wp-image-962" title="3 input and table" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/3-input-and-table.jpg" alt="" width="382" height="182" /></a></p>
<p>The equation for working out number of possibilities is&#8230;</p>
<p>Number of possible input states = 2<sup>n</sup> </p>
<p>Where n = number of inputs</p>
<p>This means that your gates can control much more complex systems.</p>
<p>I had a go at prototyping a logic gate circuit using a NAND gate chip but first I should probably say how to interpret/draw logic gates in circuit diagrams. You can do it in one of two ways either by drawing in the IC (labeling it with the chip number) and numbering the pins:</p>
<p><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/Figure1_18-QuadNandIC.gif"><img class="alignnone size-full wp-image-884" title="Figure1_18-QuadNandIC" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/Figure1_18-QuadNandIC.gif" alt="" width="454" height="329" /></a></p>
<p>Or by using the logic gate symbol and labeling the inputs and outputs. The label on the symbol below indicates that it is 1/4 of a 4011 chip, so only using one of the 4 NAND gates contained in this chip.</p>
<p><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/NAND-circuit1.jpg"><img class="alignnone size-full wp-image-972" title="NAND circuit" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/NAND-circuit1.jpg" alt="" width="408" height="394" /></a><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/NAND-circuit1.jpg"></a></p>
<p><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/NAND-circuit.jpg"></a><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/NAND-circuit.jpg"></a></p>
<p>(Please excuse the clumsy editing, I couldn&#8217;t find how to edit the circuit symbol in circuit wizard&#8230;) </p>
<p>Here&#8217;s my circuit in action:</p>
<p><iframe title="YouTube video player" width="640" height="390" src="http://www.youtube.com/embed/Rfye9I0HRUk" frameborder="0" allowfullscreen></iframe></p>
<p>I also found out that NAND and NOR gates have a cool capability, they are universal gates. This means that by arranging NAND and NOR gates in specific ways you can get them to mimic any other gate:</p>
<p>So to make an OR gate you need to connect up the gates in your IC like this:</p>
<p><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/nandor.gif"><img class="alignnone size-full wp-image-973" title="nandor" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/nandor.gif" alt="" width="254" height="164" /></a></p>
<p><iframe title="YouTube video player" width="640" height="390" src="http://www.youtube.com/embed/6eFrynvsRE0" frameborder="0" allowfullscreen></iframe></p>
<p>(All truth tables can be found <a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/?p=670">here</a>)</p>
<p>There are also complementary output gates, this basically means that you have a gate that can produce inverted and non-inverted outputs. So you could have an AND gate that could give you an AND gate out put or a NAND gate output:</p>
<p><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/Complementary-gates.jpg"><img class="alignnone size-full wp-image-974" title="Complementary gates" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/Complementary-gates.jpg" alt="" width="233" height="220" /></a></p>
<p>So why would you need a gate that can do this if you could just hook up a NOT gate off the output lead? For two reasons, 1) it saves space and 2) adding in a seperate NOT causes a time delay so if your inputs were alternating high and low your non-inverted output and your inverted outputs would change at slightly different times. </p>
<p>Again this is getting a bit far afield from what I&#8217;m aiming for but would be interesting to look at in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/?feed=rss2&#038;p=707</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Digital Logic &#8211; Logic Gates and Truth Tables</title>
		<link>http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/?p=670</link>
		<comments>http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/?p=670#comments</comments>
		<pubDate>Thu, 03 Mar 2011 10:10:11 +0000</pubDate>
		<dc:creator><![CDATA[Lullabel]]></dc:creator>
				<category><![CDATA[Explorations]]></category>
		<category><![CDATA[Logic Gates]]></category>

		<guid isPermaLink="false">http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/?p=670</guid>
		<description><![CDATA[One thing you can&#8217;t get away from when investigating digital circuits is logic. I already had a vague inkling of what logic and logic gates were when I started this investigation but boy did I underestimate the scope! Here&#8217;s what I found out&#8230; Digital circuits are made up of digital switches called gates or logic [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>One thing you can&#8217;t get away from when investigating digital circuits is logic.</p>
<p>I already had a vague inkling of what logic and logic gates were when I started this investigation but boy did I underestimate the scope! Here&#8217;s what I found out&#8230;</p>
<p>Digital circuits are made up of digital switches called gates or logic gates, a logic gate is a cool little circuit designed to accept and generate voltage signals that correspond to binary 1s and 0s. If you use lots of gates together they can be used for binary number storage (memory circuits) or manipulation (computing circuits), each gate&#8217;s output can represent one bit (binary digit) of a larger binary number (again with the binary, I won&#8217;t be able to put this off for much longer&#8230;).</p>
<p>Logic gates process the two state signals I wrote about in my previous <a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/?p=584">post</a>, these can represent just about any two-state or binary thing: a light switching on or off, password accepted or denied, DVD laser pit or an absence of one. By assigning logical values of 1 and 0 to the two sides of these events you can use these bits to carry information about stuff that&#8217;s happening in the real world and use them to control other things by processing them in a digital circuit.</p>
<p>Logical 1 and 0 can also be called true and false or high and low (like when looking at the <a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/?p=200">programming of a PIC chip</a>, high means on and low means off). Typical voltage levels used to represent these two states are 5V for logical 1 (high) and 0V for logical 0 (low) these voltages are controlled and passed on by transistors which I&#8217;ll go into <a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/?p=672">later</a>.</p>
<p><span style="color: #ff0000;"><span style="color: #000000;">There are quite a few different logic gates but they are all made up of a combination of the 3 most simple ones; the AND, OR and NOT gates. To get a really good idea of what the AND and OR gates can do you can represent the circuits mechanically:</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;"><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/AND-copy.jpg"><img class="alignnone size-full wp-image-951" title="AND copy" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/AND-copy.jpg" alt="" width="348" height="244" /></a></span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">An AND gate can be made by connecting two switches and a bulb in series, in this circuit the bulb will only turn on once both A AND B have been switched on.</span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;"><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/OR-copy.jpg"><img class="alignnone size-full wp-image-950" title="OR copy" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/OR-copy.jpg" alt="" width="386" height="308" /></a></span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">An OR gate can be made by connecting connecting the switches in parallel, in this circuit the bulb will be lit if either A OR B is switched on. </span></span></p>
<p><span style="color: #ff0000;"><span style="color: #000000;">A electronic logic gates work just like this but use lots of <a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/?p=672">transistors</a>, diodes and resistors arranged in just the right way so when you apply certain input voltages you get the correct output voltage.</span></span></p>
<p><strong><span style="color: #000000;">Logic Gates and Truth Tables</span></strong></p>
<p><span style="color: #000000;">I&#8217;ve already mentioned the 3 simplest gates so now I&#8217;ll go into a bit more detail&#8230;</span></p>
<p><span style="color: #000000;">A single digital signal can be either on or off but if you start adding more signals you can get more combinations, e.g. with 2 signals there can be 4 possible outcomes, when these combinations are processed using the logic gates rules (AND, OR, NOT) each combination will have a different outcome. </span>To keep track of these inputs and outcomes we can use a tool called the truth table, you list the various combinations of inputs in one column and, using the rule of the gate in question, work out each possible outcome.</p>
<p><strong><span style="color: #000000;">AND Gate</span></strong></p>
<p><span style="color: #000000;"><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/AND.jpg"><img class="alignnone size-full wp-image-800" title="AND" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/AND.jpg" alt="" width="315" height="105" /></a><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/AND-table.jpg"><img class="alignnone size-full wp-image-807" title="AND table" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/AND-table.jpg" alt="" width="295" height="100" /></a></span></p>
<p><span style="color: #000000;">You can see that the truth table shows that when using an AND gate the out put will only go high when both inputs are high (a symbol is used to represent logic gates as to recreate the arrangement of components that go into one each time would be time consuming and use up loads of space).</span></p>
<p><span style="color: #000000;">Here are the symbols and tables for the rest of the gates I have investigated:</span></p>
<p><strong><span style="color: #000000;">OR Gate</span></strong></p>
<p><span style="color: #000000;"><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/OR.jpg"><img class="alignnone size-full wp-image-804" title="OR" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/OR.jpg" alt="" width="315" height="105" /></a><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/OR-table.jpg"><img class="alignnone size-full wp-image-811" title="OR table" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/OR-table.jpg" alt="" width="293" height="100" /></a></span></p>
<p><span style="color: #000000;"><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/AND.png"></a></span></p>
<p><strong>NOT Gate</strong></p>
<p><strong><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/NOT.jpg"><img class="alignnone size-full wp-image-803" title="NOT" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/NOT.jpg" alt="" width="315" height="105" /></a><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/NOT-table.jpg"><img class="alignnone size-full wp-image-810" title="NOT table" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/NOT-table.jpg" alt="" width="208" height="63" /></a></strong></p>
<p>A not gate can also be called an inverter, what ever input goes into is is reversed as it comes out of it, the little dot on the end of the triangle represents this inversion. You&#8217;ll recognise this in the next couple of gates&#8230;</p>
<p><strong>NAND Gate</strong></p>
<p><strong><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/NAND.jpg"><img class="alignnone size-full wp-image-801" title="NAND" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/NAND.jpg" alt="" width="315" height="105" /></a><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/NAND-table.jpg"><img class="alignnone size-full wp-image-808" title="NAND table" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/NAND-table.jpg" alt="" width="295" height="100" /></a></strong></p>
<p>This looks just like and AND gate but with the little dot of the NOT gate, this means that this gate works as an AND gate but that the output signal will be inverted, so it&#8217;s called a NOT AND or a NAND, you can see that it is the exact opposit of the results for the AND gate above.</p>
<p><strong>NOR Gate</strong></p>
<p><strong><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/NOR.jpg"><img class="alignnone size-full wp-image-802" title="NOR" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/NOR.jpg" alt="" width="315" height="105" /></a><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/NOR-table.jpg"><img class="alignnone size-full wp-image-809" title="NOR table" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/NOR-table.jpg" alt="" width="296" height="98" /></a></strong></p>
<p>This gate is just like the one above but it&#8217;s based around an OR gate, again the contents of the truth table are the exact opposite of the OR gate so this is a NOT OR gate or a NOR gate.</p>
<p><strong>XOR Gate</strong></p>
<p><strong><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/XOR.jpg"><img class="alignnone size-full wp-image-806" title="XOR" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/XOR.jpg" alt="" width="315" height="105" /></a><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/XOR-table.jpg"><img class="alignnone size-full wp-image-813" title="XOR table" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/XOR-table.jpg" alt="" width="296" height="101" /></a></strong></p>
<p>The X in the name of this gate stands for exclusive so this is an exclusive OR gate. All this means is that the gate will only give a high output if only one or the other of the inputs are high, if both are high the input will be low.</p>
<p><strong>XNOR Gate</strong></p>
<p><span style="color: #000000;"><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/XNOR.jpg"><img class="alignnone size-full wp-image-805" title="XNOR" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/XNOR.jpg" alt="" width="315" height="105" /></a><a href="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/XNOR-table.jpg"><img class="alignnone size-full wp-image-812" title="XNOR table" src="http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/wp-content/uploads/2011/03/XNOR-table.jpg" alt="" width="293" height="99" /></a></span></p>
<p><span style="color: #000000;">I think by this point you don&#8217;t need me to tell you how to work this one out&#8230; you do? Ok then. That symbol shows that it&#8217;s an OR gate, the curved line at the back shows that it&#8217;s exclusive and the little dot at the end shows that it&#8217;s inverted, so&#8230; an X NOT OR gate or a XNOR!</span></p>
<p><span style="color: #000000;"> </span><span style="color: #000000;">Now that I know what they are, what are they used for? </span></p>
<p><span style="color: #000000;">An application for an AND gate might be a gas fired central heating system. You set a temperature that you want your house to stay at, one input of the gate would be a temperature sensor in the house, the other would be a temperature sensor to indicate that the pilot light is on. When the room sensor detects a temperature below your settings it triggers a high signal to the logic gate, if the signal from the pilot light is also high (indicating that the pilot light is lit) then the logic gate can pass on a high signal to the output, namely the gas valve in the boiler. You can see the system will only work if both inputs are high.</span></p>
<p><span style="color: #000000;">An OR gate might be used in a burglar alarm, the inputs could be sensors in the door frame and the window glass and the output would be an alarm, if one OR the other is disturbed the alarm would sound.</span></p>
<p><span style="color: #000000;">These are two very simple uses for logic gates, they are also used for computing processes, these consist of lots and lots of logic gates arranged in very specific ways to give an outcome, like detecting which keys have been pressed on a keyboard (thinking about this while typing is odd, like your actually really aware for the first time of the complex processes that go on just by typing a word like and). Without digital logic we wouldn&#8217;t have devices such as computers, mobile phones and even calculators.</span></p>
<p><span style="color: #000000;">Phew! looking at all those ones and zeros has made me see double (ha, ha, double, did you see what I did there&#8230; no? oh well) I think this would be a good time to delve into the wonderful (and totally terrifying (at the moment at least)) world of binary code.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.resistors-and-diodes-and-picchips-oh-my.co.uk/?feed=rss2&#038;p=670</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
