<?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>Last Ray of Hope &#187; Electronics</title>
	<atom:link href="http://www.lastrayofhope.com/category/electronics/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lastrayofhope.com</link>
	<description>Home of Kaluriel Hargrove</description>
	<lastBuildDate>Thu, 02 Feb 2012 00:21:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>First SMD Reflow</title>
		<link>http://www.lastrayofhope.com/2012/02/02/first-smd-reflow/</link>
		<comments>http://www.lastrayofhope.com/2012/02/02/first-smd-reflow/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 00:12:08 +0000</pubDate>
		<dc:creator>Kaluriel</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[ADC]]></category>
		<category><![CDATA[DAC]]></category>
		<category><![CDATA[prototype adaptor]]></category>
		<category><![CDATA[reflow]]></category>
		<category><![CDATA[SMD]]></category>

		<guid isPermaLink="false">http://www.lastrayofhope.com/?p=4013</guid>
		<description><![CDATA[My iOS development license expired yesterday after I forgot to renew it. Since I hadn't received word back from Apple about it being reactivated, I decided to do some electronics. Having recently buying an analog to digital converter and a prototype adaptor board for an SOIC, I decided to use my reflow tool I bought [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.lastrayofhope.com/wp-content/uploads/2012/02/IMG_0278.jpg"><img class="alignleft size-thumbnail wp-image-4016" title="AD7401 Analog to Digital" src="http://www.lastrayofhope.com/wp-content/uploads/2012/02/IMG_0278-150x150.jpg" alt="" width="150" height="150" /></a>My iOS development license expired yesterday after I forgot to renew it. Since I hadn't received word back from Apple about it being reactivated, I decided to do some electronics.</p>
<p>Having recently buying an <a href="https://uk.farnell.com/jsp/search/productdetail.jsp?SKU=1274242" target="_blank">analog to digital converter</a> and a prototype adaptor board for an SOIC, I decided to use my reflow tool I bought a few month back. One thing I didn't take into account was that my solder paste was out of date in November 2011, making it fairly thick and hard to separate.</p>
<p>Also it turns out the display on my reflow tool is in Fahrenheit, not Celsius.</p>
<p><a href="http://www.lastrayofhope.com/wp-content/uploads/2012/02/IMG_0280.jpg"><img class="alignright size-thumbnail wp-image-4015" title="DAC8580IPW Digital to Analog" src="http://www.lastrayofhope.com/wp-content/uploads/2012/02/IMG_0280-150x150.jpg" alt="" width="150" height="150" /></a>I think it turned out rather well for my first one.</p>
<p>The second one however, a <a href="http://uk.farnell.com/jsp/search/productdetail.jsp?SKU=1754809" target="_blank">digital to analog converter</a>, turned out far worse of a job. It is a TSSOP package - a fraction the size of the SOIC, and I have trouble with bridges being formed between pins, and my cheap solder wick was failing to remove them.</p>
<p>I'm unsure if the chips still work, as I took quite a while to get them in the correct position, but I was 40-60 degrees lower than the maximum soldering temperature. Hopefully I will have time to test them tomorrow.</p>
<p><a href="http://uk.farnell.com/jsp/search/productdetail.jsp?SKU=1426182" target="_blank">TSSOP16 Adaptor</a></p>
<p><a href="http://uk.farnell.com/jsp/search/productdetail.jsp?SKU=1426173" target="_blank">SOIC16 Adaptor</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lastrayofhope.com/2012/02/02/first-smd-reflow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sonic Screwdriver</title>
		<link>http://www.lastrayofhope.com/2011/08/07/sonic-screwdriver/</link>
		<comments>http://www.lastrayofhope.com/2011/08/07/sonic-screwdriver/#comments</comments>
		<pubDate>Sun, 07 Aug 2011 23:57:15 +0000</pubDate>
		<dc:creator>Kaluriel</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Radio]]></category>
		<category><![CDATA[RFID]]></category>
		<category><![CDATA[Sonic Screwdriver]]></category>

		<guid isPermaLink="false">http://www.lastrayofhope.com/?p=3883</guid>
		<description><![CDATA[Over the weekend I thought up a project to do in the future. Basically I would like to make a sonic screwdriver that actually unlocks doors. More specifically, passive RFID card doors. Currently I need to swipe my card to enter my work building, but if I was able to read the signal from the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.lastrayofhope.com/wp-content/uploads/2011/08/sonic.jpeg"><img class="alignleft size-thumbnail wp-image-3884" title="Sonic Screwdriver" src="http://www.lastrayofhope.com/wp-content/uploads/2011/08/sonic-150x150.jpg" alt="" width="150" height="150" /></a>Over the weekend I thought up a project to do in the future. Basically I would like to make a sonic screwdriver that actually unlocks doors.</p>
<p>More specifically, passive RFID card doors. Currently I need to swipe my card to enter my work building, but if I was able to read the signal from the RFID when it has power supplied to it, I could store the signal.</p>
<p>Then I just need to buy a sonic screwdriver toy, build a radio transmitter circuit that will take the stored signal and transmit it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lastrayofhope.com/2011/08/07/sonic-screwdriver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Really bad transistor joke</title>
		<link>http://www.lastrayofhope.com/2011/07/16/really-bad-transistor-joke/</link>
		<comments>http://www.lastrayofhope.com/2011/07/16/really-bad-transistor-joke/#comments</comments>
		<pubDate>Sat, 16 Jul 2011 12:27:55 +0000</pubDate>
		<dc:creator>Kaluriel</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Transistor]]></category>

		<guid isPermaLink="false">http://www.lastrayofhope.com/?p=3774</guid>
		<description><![CDATA[What did the NPN transistor say when it heard someone whisper 'hey'? 'HELLO!!!!!']]></description>
			<content:encoded><![CDATA[<p>What did the NPN transistor say when it heard someone whisper 'hey'?</p>
<p>'HELLO!!!!!'</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lastrayofhope.com/2011/07/16/really-bad-transistor-joke/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Processor Memory</title>
		<link>http://www.lastrayofhope.com/2011/06/21/processor-memory/</link>
		<comments>http://www.lastrayofhope.com/2011/06/21/processor-memory/#comments</comments>
		<pubDate>Tue, 21 Jun 2011 23:48:16 +0000</pubDate>
		<dc:creator>Kaluriel</dc:creator>
				<category><![CDATA[8 Bit Processor]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Flip Flop]]></category>
		<category><![CDATA[LDR]]></category>
		<category><![CDATA[RAM]]></category>

		<guid isPermaLink="false">http://www.lastrayofhope.com/?p=3570</guid>
		<description><![CDATA[Storing variables on registers is fine, but eventually another operation will need to happen and the contents needs to be moved somewhere else more permanent. For this, the processor will also need memory. Building on using flip flops for storing data for registers, I decided that if I could create an enable flag that could be [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0036.jpg"><img class="alignleft size-thumbnail wp-image-3571" style="border: 1px solid black;" title="Memory Address 0x00" src="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0036-150x150.jpg" alt="Memory Address 0x00" width="150" height="150" /></a>Storing variables on registers is fine, but eventually another operation will need to happen and the contents needs to be moved somewhere else more permanent.</p>
<p>For this, the processor will also need memory.</p>
<p>Building on using flip flops for storing data for registers, I decided that if I could create an enable flag that could be AND'd with the value in the flip flop, I could create a logic gate sequence for each address as to whether the input address is valid for that block.</p>
<p>All other addresses won't accept the address and so won't output anything.</p>
<p><strong>RAM</strong></p>
<p>In the image is a basic design for reading two bits from memory. There are a total of four bits worth of memory, two bits on address 0x00, and two bits on address 0x01.</p>
<p>I've hardcoded the values contained within that memory into the flip flops. Using a series of logic gates, each address of memory enables the transistor to return the value from the flip flops.</p>
<p><a href="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0035.jpg"><img class="size-thumbnail wp-image-3572 alignright" style="border: 1px solid black;" title="Memory Address 0x01" src="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0035-150x150.jpg" alt="Memory Address 0x01" width="150" height="150" /></a>Using a unique logic gate sequence for each memory address means only one return set can be active at a time.</p>
<p>As you can see in the image to the right, changing the memory address to be 0x01 returns the data from the other flip flops.</p>
<p>I still need to add another input so I can write to memory as well, I could probably use the same data lines as the output and AND it with the write input flag.</p>
<p>How much RAM I haven't decided yet, I think maybe 4 addresses worth might be enough for such a basic system. The nice thing about this system is that more can be added at any time.</p>
<p><strong>Removable Storage Media</strong></p>
<p>I was thinking about making a version of removable storage as well, the idea is based on reading data from CDs, a piece of memory with black and white markers that can be read by LDRs.</p>
<p>I could also add some kind of paper feed system, then it could random access previous pages.. heh <a href="http://en.wikipedia.org/wiki/Paging" target="_blank">pages</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lastrayofhope.com/2011/06/21/processor-memory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Processor Register</title>
		<link>http://www.lastrayofhope.com/2011/06/20/processor-register/</link>
		<comments>http://www.lastrayofhope.com/2011/06/20/processor-register/#comments</comments>
		<pubDate>Mon, 20 Jun 2011 22:08:19 +0000</pubDate>
		<dc:creator>Kaluriel</dc:creator>
				<category><![CDATA[8 Bit Processor]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Flip Flop]]></category>
		<category><![CDATA[Full Adder]]></category>
		<category><![CDATA[NOR Gate]]></category>

		<guid isPermaLink="false">http://www.lastrayofhope.com/?p=3529</guid>
		<description><![CDATA[With my full adder complete and working in emulation, I just need to build it on a breadboard to make sure it works in practice. The next step would be to etch and build a prototype before outsourcing for eight of them to be made (my processor will be 8bit), I might use surface mount [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0027.jpg"><img class="alignleft size-thumbnail wp-image-3530" style="border: 1px solid black;" title="Full Adder" src="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0027-150x150.jpg" alt="Full Adder" width="150" height="150" /></a>With my full adder complete and working in emulation, I just need to build it on a breadboard to make sure it works in practice.</p>
<p>The next step would be to etch and build a prototype before outsourcing for eight of them to be made (my processor will be 8bit), I might use surface mount components to keep down costs and size.</p>
<p>Okay, so I can add two numbers together, but where do I get those numbers from, and where can I store the result. Now I need memory, specifically for registers.</p>
<p><a href="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0029.jpg"><img class="alignleft size-thumbnail wp-image-3533" style="border: 1px solid black;" title="Flip Flop" src="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0029-150x150.jpg" alt="Flip Flop" width="150" height="150" /></a><span style="text-decoration: underline;"><strong>Flip Flop</strong></span></p>
<p><strong> </strong>So how do I write and read bit states. The answer is a <a href="http://en.wikipedia.org/wiki/Flip-flop_(electronics)" target="_blank">Flip Flop</a>.</p>
<p>To read from it is easy, neither input should be set as high, and the output will be the value stored.</p>
<p>To write a state, first the <strong>Reset</strong> input must be set high, this sets the value stored to low, now before a new value is set, <strong>Reset</strong> must be set to low.</p>
<p>With reset set to low, the <strong>Set</strong> input should be set high to store a high value. One problem with however is that giving an input of low, will not store a low signal.</p>
<p><a href="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0030.jpg"><img class="alignleft size-thumbnail wp-image-3538" style="border: 1px solid black;" title="Flip Flop with Enable" src="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0030-150x150.jpg" alt="Flip Flop with Enable" width="150" height="150" /></a><span style="text-decoration: underline;"><strong>1-Bit Dynamic Memory</strong></span></p>
<p>One way around this is to use a third input, <strong>Enable</strong>. We can AND this input with each input.</p>
<p>Now whenever we want to set a value, we must set the reset to high, then toggle the <strong>Enable</strong> input between high and low.</p>
<p>For setting a value, we set the <strong>Input</strong> to the value we want stored, and toggle the <strong>Enable</strong> input between high and low.</p>
<p>This will prevent accidentally setting the value stored until we are ready.</p>
<p><a href="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0033.jpg"><img class="alignleft size-thumbnail wp-image-3560" style="border: 1px solid black;" title="NOR Gate" src="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0033-150x150.jpg" alt="NOR Gate" width="150" height="150" /></a><span style="text-decoration: underline;"><strong>The NOR Gate</strong></span></p>
<p>Now I just need to breakdown the logic gates in the flip flop into discrete components. The AND Gate I already have a circuit for, so all I need a NOR Gate.</p>
<p>A NOR Gate works in the reverse of an OR Gate, so I just switched the PNP for an NPN, however the voltage dropped again so I added another signal booster.</p>
<p>I only quickly put this circuit together and will look at reducing the amount of transistors being used for it later. For three registers, two for input and one for output, an 8-bit processor will need a total of 24 flip flops.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lastrayofhope.com/2011/06/20/processor-register/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More Discrete Logic</title>
		<link>http://www.lastrayofhope.com/2011/06/20/more-discrete-logic/</link>
		<comments>http://www.lastrayofhope.com/2011/06/20/more-discrete-logic/#comments</comments>
		<pubDate>Mon, 20 Jun 2011 19:39:00 +0000</pubDate>
		<dc:creator>Kaluriel</dc:creator>
				<category><![CDATA[8 Bit Processor]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[PNP]]></category>
		<category><![CDATA[XOR Gate]]></category>

		<guid isPermaLink="false">http://www.lastrayofhope.com/?p=3511</guid>
		<description><![CDATA[I have wondered why I haven't found any other 2 transistor XOR Gates, and only now do I think I know the reason why. There was a slight flaw in my Full Adder where one of the output bits was being set when it shouldn't. The cause, a slightly lower voltage caused by the diode [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0024.jpg"><img class="alignleft size-thumbnail wp-image-3512" title="XOR Gate Flaw" src="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0024-150x150.jpg" alt="XOR Gate Flaw" width="150" height="150" /></a>I have wondered why I haven't found any other 2 transistor XOR Gates, and only now do I think I know the reason why.</p>
<p>There was a slight flaw in my Full Adder where one of the output bits was being set when it shouldn't.</p>
<p>The cause, a slightly lower voltage caused by the diode in my OR Gate. Without the same voltage at the base of the PNP as in the emitter, one of the PNP will always remain active.</p>
<p>Because of this, I'm going to have to rework my OR gate as well, or the signal 'booster' circuit I added to my XOR gate to guarantee that it remains the same for both inputs.</p>
<p><a href="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0025.jpg"><img class="alignleft size-thumbnail wp-image-3516" style="border: 1px solid black;" title="AND Gate" src="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0025-150x150.jpg" alt="AND Gate" width="150" height="150" /></a></p>
<p>&nbsp;</p>
<p>Slightly modifying the AND gate, removing a resistor and replacing the right NPN with a PNP, I get a high signal whenever both inputs have enough voltage to trigger the NPN transistors.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0026.jpg"><img class="alignleft size-thumbnail wp-image-3523" style="border: 1px solid black;" title="OR Gate" src="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0026-150x150.jpg" alt="OR Gate" width="150" height="150" /></a></p>
<p>&nbsp;</p>
<p>The OR gate is similar to the AND gate, only either transistor should short circuit the base of the PNP to ground.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lastrayofhope.com/2011/06/20/more-discrete-logic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Discrete Logic continued</title>
		<link>http://www.lastrayofhope.com/2011/06/12/discreet-logic-continued/</link>
		<comments>http://www.lastrayofhope.com/2011/06/12/discreet-logic-continued/#comments</comments>
		<pubDate>Sun, 12 Jun 2011 19:48:31 +0000</pubDate>
		<dc:creator>Kaluriel</dc:creator>
				<category><![CDATA[8 Bit Processor]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[NPN]]></category>
		<category><![CDATA[PNP]]></category>
		<category><![CDATA[Transistor]]></category>

		<guid isPermaLink="false">http://www.lastrayofhope.com/?p=3494</guid>
		<description><![CDATA[See previous post Discrete Logic. EDIT: There is a flaw with this XOR circuit, see More Discrete Logic. In my previous post I used two PNP transistors to perform of the job of XOR gate, however after building and test, the drop in voltage was too much over just a single full-adder. Using a circuit [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0023.jpg"><img class="alignleft size-thumbnail wp-image-3506" title="New XOR Gate" src="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0023-150x150.jpg" alt="New XOR Gate" width="150" height="150" /></a>See previous post <a title="Discreet Logic" href="http://www.lastrayofhope.com/2011/06/10/discreet-logic/">Discrete Logic</a>.</p>
<p>EDIT: There is a flaw with this XOR circuit, see <a title="More Discrete Logic" href="http://www.lastrayofhope.com/2011/06/20/more-discrete-logic/">More Discrete Logic</a>.</p>
<p>In my previous post I used two PNP transistors to perform of the job of XOR gate, however after building and test, the drop in voltage was too much over just a single full-adder.</p>
<p>Using a circuit I got from the EEV Forums, I got help when I needed to supply 14V to my OLED but the open drain on my chip supply a maximum of 2.5V, the <strong>XOR</strong> will now supply 5V from its output when it is high.</p>
<p>The 1k resistor represents the load. I've also added diodes onto the inputs since I had a problem with my <strong>AND</strong> circuit getting power from the base of the <strong>PNP</strong>s.</p>
<p>It requires an additional NPN and PNP transistor and a couple more resistors.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lastrayofhope.com/2011/06/12/discreet-logic-continued/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Discrete Logic</title>
		<link>http://www.lastrayofhope.com/2011/06/10/discreet-logic/</link>
		<comments>http://www.lastrayofhope.com/2011/06/10/discreet-logic/#comments</comments>
		<pubDate>Fri, 10 Jun 2011 10:10:13 +0000</pubDate>
		<dc:creator>Kaluriel</dc:creator>
				<category><![CDATA[8 Bit Processor]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Farnell]]></category>

		<guid isPermaLink="false">http://www.lastrayofhope.com/?p=3463</guid>
		<description><![CDATA[EDIT: There is a flaw with the XOR circuit, see More Discrete Logic. Continuing on from Sum of Two Bits, I now need to make logic using only discrete components. Addition of one bit requires two AND gates, two XOR gates, and one OR gate. OR Gate Originally I had planned to make the OR gates using [...]]]></description>
			<content:encoded><![CDATA[<p>EDIT: There is a flaw with the XOR circuit, see <a title="More Discrete Logic" href="http://www.lastrayofhope.com/2011/06/20/more-discrete-logic/">More Discrete Logic</a>.</p>
<p>Continuing on from <a title="Sum of Two Bits" href="http://www.lastrayofhope.com/2011/06/09/sum-of-two-bits/">Sum of Two Bits</a>, I now need to make logic using only discrete components. Addition of one bit requires two AND gates, two XOR gates, and one OR gate.</p>
<p><a href="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0301.jpg"><img class="alignleft size-thumbnail wp-image-3466" title="OR Gate" src="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0301-150x150.jpg" alt="OR Gate" width="150" height="150" /></a></p>
<p><strong>OR Gate</strong></p>
<p>Originally I had planned to make the OR gates using transistors, I had already ordered 500 NPN and 500 PNP from Farnell so I have plenty to spare for a while. But with my new found love of pull down resistors, I realised that using diodes I could make OR gate.</p>
<p>If <strong>A</strong> or <strong>B</strong> are high then <strong>Out</strong> will be high too. If neither are high, then the pull down resister will pull <strong>Out</strong> down to ground.</p>
<p>&nbsp;</p>
<p><a href="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0303.jpg"><img class="size-thumbnail wp-image-3467 alignleft" title="AND Gate" src="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0303-150x150.jpg" alt="AND Gate" width="150" height="150" /></a><strong>AND Gate</strong></p>
<p>When <strong>A </strong>and <strong>B</strong> are low, voltage on the right transistor will be pulled up to high, turning it 'on', causing <strong>Out</strong> to be grounded.</p>
<p>When both <strong>A</strong> and <strong>B</strong> are high, a circuit is formed and the base of the right transistor is grounded, turning it 'off', allowing <strong>Out</strong> to be pulled up to high.</p>
<p>If only <strong>A</strong> or only <strong>B</strong> is on, a circuit to ground won't be formed so the right transistor will remain 'on'.</p>
<p><strong><a href="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0018.png"><img class="alignleft size-thumbnail wp-image-3485" style="border: 1px solid black;" title="XOR Gate" src="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0018-150x150.png" alt="XOR Gate" width="150" height="150" /></a></strong><strong>XOR</strong></p>
<p>This one I used iCircuit on iOS to design. It uses two PNP transistors.</p>
<p>If the left switch is high and the right switch is low, the left transistor is turned 'on'. If the right switch is on, the left transistor turn off, with a pull down resister added it can be pulled to ground.</p>
<p>If both switches are high, neither transistor will allow the circuit to complete.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lastrayofhope.com/2011/06/10/discreet-logic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sum of Two Bits</title>
		<link>http://www.lastrayofhope.com/2011/06/09/sum-of-two-bits/</link>
		<comments>http://www.lastrayofhope.com/2011/06/09/sum-of-two-bits/#comments</comments>
		<pubDate>Thu, 09 Jun 2011 08:31:39 +0000</pubDate>
		<dc:creator>Kaluriel</dc:creator>
				<category><![CDATA[8 Bit Processor]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Full Adder]]></category>
		<category><![CDATA[Half Adder]]></category>

		<guid isPermaLink="false">http://www.lastrayofhope.com/?p=3447</guid>
		<description><![CDATA[A while back I read a blog that claimed that no one knows how to build a processor because of the complexity and computers do all the work today, so I've decided to see if I can make one using only discrete components. Before working on the actual instruction parsing, I will work on the individual [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0295.jpg"><img class="alignleft size-thumbnail wp-image-3450" title="Half Adder" src="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0295-150x150.jpg" alt="Half Adder" width="150" height="150" /></a>A while back I read a blog that claimed that no one knows how to build a processor because of the complexity and computers do all the work today, so I've decided to see if I can make one using only discrete components.</p>
<p>Before working on the actual instruction parsing, I will work on the individual instructions. So the first instruction I'm going to make is ADD. The image to the left adds two bits together.</p>
<p><strong>Out</strong> is only set when A or B are set, but never at the same time, so it is <strong>A XOR B</strong>.<br />
<strong>Carry</strong> is only set when A and B are both set, so it is <strong>A AND B</strong>.</p>
<p>&nbsp;</p>
<p><a href="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0299.jpg"><img class="alignright size-thumbnail wp-image-3457" title="Full Adder" src="http://www.lastrayofhope.com/wp-content/uploads/2011/06/IMG_0299-150x150.jpg" alt="Full Adder" width="150" height="150" /></a>Easy. However, a carry can happen, so this diagram needs to take a third input for the carry for the previous stage. In the first stage, <strong>Cin</strong> (Carry In) will be zero.</p>
<p>Since it is built on the previous adder, <strong>A XOR B</strong> and <strong>A AND B</strong> will still be a part of this circuit.</p>
<p><strong>Out</strong> is just an extension of the previous stage, combining the output of the previous adder with the carry, <strong>( A XOR B ) XOR Cin</strong>.</p>
<p>Since <strong>Out</strong> was just another XOR operation, another carry has the possibility of being generated. It is impossible for both carry's to be true at the same time, so we can just OR them together. <strong>Cout</strong> is<strong> ( A AND B ) OR ( ( A XOR B ) AND Cin )</strong>.</p>
<p>A quick console app to test the logic</p>
<div id="wpshdo_1" class="wp-synhighlighter-outer"><div id="wpshdt_1" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_1"></a><a id="wpshat_1" class="wp-synhighlighter-title" href="#codesyntax_1"  onClick="javascript:wpsh_toggleBlock(1)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_1" onClick="javascript:wpsh_code(1)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.lastrayofhope.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_1" onClick="javascript:wpsh_print(1)" title="Print code"><img border="0" style="border: 0 none" src="http://www.lastrayofhope.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.lastrayofhope.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.lastrayofhope.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_1" class="wp-synhighlighter-inner" style="display: block;"><pre class="c" style="font-family:monospace;"><span class="co1">//</span>
<span class="co1">//</span>
<span class="co2">#include &lt;stdio.h&gt;</span>
&nbsp;
<span class="co1">//</span>
<span class="co1">//</span>
<span class="kw4">unsigned</span> <span class="kw4">int</span> AddTwoBits<span class="br0">&#40;</span> <span class="kw4">const</span> <span class="kw4">unsigned</span> <span class="kw4">int</span> inA<span class="sy0">,</span> <span class="kw4">const</span> <span class="kw4">unsigned</span> <span class="kw4">int</span> inB<span class="sy0">,</span> <span class="kw4">const</span> <span class="kw4">int</span> inCin<span class="sy0">,</span> <span class="kw4">unsigned</span> <span class="kw4">int</span> <span class="sy0">*</span> outCout <span class="br0">&#41;</span>
<span class="br0">&#123;</span>
	<span class="kw4">unsigned</span> <span class="kw4">int</span> out <span class="sy0">=</span> <span class="br0">&#40;</span> inA <span class="sy0">^</span> inB <span class="br0">&#41;</span> <span class="sy0">^</span> inCin<span class="sy0">;</span>
&nbsp;
	<span class="co1">// Output new carry if needed</span>
	<span class="kw4">unsigned</span> <span class="kw4">int</span> <a href="http://www.opengroup.org/onlinepubs/009695399/functions/cout.html"><span class="kw3">cout</span></a> <span class="sy0">=</span> <span class="br0">&#40;</span> inA <span class="sy0">&amp;</span> inB <span class="br0">&#41;</span> <span class="sy0">|</span> <span class="br0">&#40;</span> <span class="br0">&#40;</span> inA <span class="sy0">^</span> inB <span class="br0">&#41;</span> <span class="sy0">&amp;</span> inCin <span class="br0">&#41;</span><span class="sy0">;</span>
	<span class="kw1">if</span><span class="br0">&#40;</span> outCout <span class="br0">&#41;</span>
	<span class="br0">&#123;</span>
		<span class="br0">&#40;</span><span class="sy0">*</span>outCout<span class="br0">&#41;</span> <span class="sy0">=</span> <a href="http://www.opengroup.org/onlinepubs/009695399/functions/cout.html"><span class="kw3">cout</span></a><span class="sy0">;</span>
	<span class="br0">&#125;</span>
&nbsp;
	<span class="co1">//</span>
	<a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span class="kw3">printf</span></a><span class="br0">&#40;</span> <span class="st0">&quot;%d<span class="es1">\t</span>%d<span class="es1">\t</span>%d<span class="es1">\t</span>%d<span class="es1">\t</span>%d<span class="es1">\n</span>&quot;</span><span class="sy0">,</span> inA<span class="sy0">,</span> inB<span class="sy0">,</span> inCin<span class="sy0">,</span> out<span class="sy0">,</span> <a href="http://www.opengroup.org/onlinepubs/009695399/functions/cout.html"><span class="kw3">cout</span></a> <span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
	<span class="co1">//</span>
	<span class="kw1">return</span> out<span class="sy0">;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="co1">//</span>
<span class="co1">//</span>
<span class="kw4">int</span> main<span class="br0">&#40;</span><span class="br0">&#41;</span>
<span class="br0">&#123;</span>
	<a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span class="kw3">printf</span></a><span class="br0">&#40;</span> <span class="st0">&quot;A<span class="es1">\t</span>B<span class="es1">\t</span>Cin<span class="es1">\t</span>Out<span class="es1">\t</span>Cout<span class="es1">\n</span>&quot;</span> <span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
	AddTwoBits<span class="br0">&#40;</span> 0<span class="sy0">,</span> 0<span class="sy0">,</span> 0<span class="sy0">,</span> NULL <span class="br0">&#41;</span><span class="sy0">;</span>
	AddTwoBits<span class="br0">&#40;</span> 1<span class="sy0">,</span> 0<span class="sy0">,</span> 0<span class="sy0">,</span> NULL <span class="br0">&#41;</span><span class="sy0">;</span>
	AddTwoBits<span class="br0">&#40;</span> 0<span class="sy0">,</span> 1<span class="sy0">,</span> 0<span class="sy0">,</span> NULL <span class="br0">&#41;</span><span class="sy0">;</span>
	AddTwoBits<span class="br0">&#40;</span> 1<span class="sy0">,</span> 1<span class="sy0">,</span> 0<span class="sy0">,</span> NULL <span class="br0">&#41;</span><span class="sy0">;</span>
	AddTwoBits<span class="br0">&#40;</span> 0<span class="sy0">,</span> 0<span class="sy0">,</span> 1<span class="sy0">,</span> NULL <span class="br0">&#41;</span><span class="sy0">;</span>
	AddTwoBits<span class="br0">&#40;</span> 1<span class="sy0">,</span> 0<span class="sy0">,</span> 1<span class="sy0">,</span> NULL <span class="br0">&#41;</span><span class="sy0">;</span>
	AddTwoBits<span class="br0">&#40;</span> 0<span class="sy0">,</span> 1<span class="sy0">,</span> 1<span class="sy0">,</span> NULL <span class="br0">&#41;</span><span class="sy0">;</span>
	AddTwoBits<span class="br0">&#40;</span> 1<span class="sy0">,</span> 1<span class="sy0">,</span> 1<span class="sy0">,</span> NULL <span class="br0">&#41;</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></div></div>
<p>And the output gives what I expected.</p>
<div id="wpshdo_2" class="wp-synhighlighter-outer"><div id="wpshdt_2" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_2"></a><a id="wpshat_2" class="wp-synhighlighter-title" href="#codesyntax_2"  onClick="javascript:wpsh_toggleBlock(2)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_2" onClick="javascript:wpsh_code(2)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.lastrayofhope.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_2" onClick="javascript:wpsh_print(2)" title="Print code"><img border="0" style="border: 0 none" src="http://www.lastrayofhope.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.lastrayofhope.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.lastrayofhope.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_2" class="wp-synhighlighter-inner" style="display: block;"><pre class="text" style="font-family:monospace;">A	B	Cin	Out	Cout
0	0	0	0	0
1	0	0	1	0
0	1	0	1	0
1	1	0	0	1
0	0	1	1	0
1	0	1	0	1
0	1	1	0	1
1	1	1	1	1</pre></div></div>
<p>Now I just need to create the logic using discreet components.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lastrayofhope.com/2011/06/09/sum-of-two-bits/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accelerometer</title>
		<link>http://www.lastrayofhope.com/2011/05/31/accelerometer/</link>
		<comments>http://www.lastrayofhope.com/2011/05/31/accelerometer/#comments</comments>
		<pubDate>Tue, 31 May 2011 22:56:19 +0000</pubDate>
		<dc:creator>Kaluriel</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Farnell]]></category>

		<guid isPermaLink="false">http://www.lastrayofhope.com/?p=3442</guid>
		<description><![CDATA[My accelerometer arrived. It's not a part of my Programmer Calculator, but just something to play around with. It was a lot smaller than I thought, I knew it was gonna be around 3mm, not sure I will be able to just solder some legs onto it to testing, I will probably have to make [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.lastrayofhope.com/wp-content/uploads/2011/05/IMG_0271.jpg"><img class="alignleft size-thumbnail wp-image-3443" title="Accelerometer next to 5mm LED" src="http://www.lastrayofhope.com/wp-content/uploads/2011/05/IMG_0271-150x150.jpg" alt="Accelerometer next to 5mm LED" width="150" height="150" /></a>My accelerometer arrived. It's not a part of my Programmer Calculator, but just something to play around with. It was a lot smaller than I thought, I knew it was gonna be around 3mm, not sure I will be able to just solder some legs onto it to testing, I will probably have to make an adaptor board for it.</p>
<p>In the picture to the left, I've placed a standard 5mm LED next to it so you can see just how small it is.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lastrayofhope.com/2011/05/31/accelerometer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

