<?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>veys.com &#187; electronics</title>
	<atom:link href="http://veys.com/tag/electronics/feed/" rel="self" type="application/rss+xml" />
	<link>http://veys.com</link>
	<description>if I only had a tagline.</description>
	<lastBuildDate>Tue, 27 Sep 2011 21:35:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Mr. Baybus 2</title>
		<link>http://veys.com/2002/08/24/mr-baybus-2/</link>
		<comments>http://veys.com/2002/08/24/mr-baybus-2/#comments</comments>
		<pubDate>Sun, 25 Aug 2002 05:23:46 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[legacy articles]]></category>
		<category><![CDATA[microcontroller]]></category>
		<category><![CDATA[mr baybus]]></category>
		<category><![CDATA[pic]]></category>

		<guid isPermaLink="false">http://www.veys.com/blog/?p=126</guid>
		<description><![CDATA[After such a good response to Mr. Baybus, I decided to up the ante. I wanted temperature sensing and light control, as well as a more refined interface. I also wanted a chance to write much, much better code as Mr. Baybus was most definitely a kludge. This led to the design of Mr. Baybus [...]]]></description>
			<content:encoded><![CDATA[<p>After such a good response to <a href="http://veys.com/2002/08/20/mr-baybus/" title="Mr. Baybus">Mr. Baybus</a>, I decided to up the ante. I wanted temperature sensing and light control, as well as a more refined interface. I also wanted a chance to write much, much better code as Mr. Baybus was most definitely a kludge. This led to the design of Mr. Baybus 2.</p>
<p>Mr. Baybus had a few problems I wanted to take care of. One being price, it cost way too much compared to its utililty value, which is normal for projects like this, but still&#8230;</p>
<p>Mr. Baybus 2 uses a much more sophisticated microcontroller, a PIC 16F870. This is a 28-pin SDIP style chip, lots more I/O pins, an onboard UART, and even an ADC. This little guy also has twice the instruction memory, so I had more freedom to make the interface somewhat more sleek, and add more features. The benefit of more pins is CHEAPER LCD. The previous serial LCD ran about $42 shipped, which is semi-high for a serial LCD in general, but it was a CrystalFontz so at least it was high quality. Anyways, now I can move to a simple <a href='http://en.wikipedia.org/wiki/HD44780_Character_LCD' target='_blank'>HD44780</a> based parallel LCD (by <a href="http://www.crystalfontz.com">CrystalFontz</a>, of course). These run around $20 shipped, and even less from other places selling generics.</p>
<h3>Features</h3>
<ul>
<li>Three On/Off Fan controls</li>
<li>One 12V Light control (Neons, etc)</li>
<li>Two centrigrade temperature sensors</li>
<li>20&#215;2 screen (any HD44780 compatible will work)</li>
<li>Simple, menu-driven style interface</li>
<li>Stores fan status in non-volatile memory</li>
</ul>
<h3>Display Images</h3>
<table border="0">
<tbody>
<tr>
<td>
<p><div id="attachment_194" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb2_splash.jpg" rel="lightbox[126]"><img class="size-thumbnail wp-image-194" title="Splash screen" src="http://www.veys.com/wp-content/uploads/2008/07/mbb2_splash-150x127.jpg" alt="" width="150" height="127" /></a><p class="wp-caption-text">Splash screen</p></div></td>
<td>
<p><div id="attachment_195" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb2_status.jpg" rel="lightbox[126]"><img class="size-thumbnail wp-image-195" title="Fan status" src="http://www.veys.com/wp-content/uploads/2008/07/mbb2_status-150x136.jpg" alt="Fan status" width="150" height="136" /></a><p class="wp-caption-text">Fan status</p></div></td>
<td>
<p><div id="attachment_196" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb2_status2.jpg" rel="lightbox[126]"><img class="size-thumbnail wp-image-196" title="Fan status w/selection" src="http://www.veys.com/wp-content/uploads/2008/07/mbb2_status2-150x129.jpg" alt="Fan status w/selection" width="150" height="129" /></a><p class="wp-caption-text">Fan status w/selection</p></div></td>
</tr>
<tr>
<td>
<p><div id="attachment_193" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb2_lighting.jpg" rel="lightbox[126]"><img class="size-thumbnail wp-image-193" title="Lighting status" src="http://www.veys.com/wp-content/uploads/2008/07/mbb2_lighting-150x133.jpg" alt="Lighting status" width="150" height="133" /></a><p class="wp-caption-text">Lighting status</p></div></td>
<td>
<p><div id="attachment_197" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb2_temperature.jpg" rel="lightbox[126]"><img class="size-thumbnail wp-image-197" title="Temperatures" src="http://www.veys.com/wp-content/uploads/2008/07/mbb2_temperature-150x127.jpg" alt="Temperatures" width="150" height="127" /></a><p class="wp-caption-text">Temperatures</p></div></td>
</tr>
</tbody>
</table>
<h3>Unit Images</h3>
<table border="0">
<tbody>
<tr>
<td>
<p><div id="attachment_200" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb2_front_up.jpg" rel="lightbox[126]"><img class="size-thumbnail wp-image-200" title="High view of the front" src="http://www.veys.com/wp-content/uploads/2008/07/mbb2_front_up-150x150.jpg" alt="High view of the front" width="150" height="150" /></a><p class="wp-caption-text">High view of the front</p></div></td>
<td>
<p><div id="attachment_198" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb2_back_up.jpg" rel="lightbox[126]"><img class="size-thumbnail wp-image-198" title="High view of the back" src="http://www.veys.com/wp-content/uploads/2008/07/mbb2_back_up-150x150.jpg" alt="High view of the back" width="150" height="150" /></a><p class="wp-caption-text">High view of the back</p></div></td>
</tr>
<tr>
<td>
<p><div id="attachment_199" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb2_backpanel.jpg" rel="lightbox[126]"><img class="size-thumbnail wp-image-199" title="Back view" src="http://www.veys.com/wp-content/uploads/2008/07/mbb2_backpanel-150x150.jpg" alt="Back view" width="150" height="150" /></a><p class="wp-caption-text">Back view</p></div></td>
<td>
<p><div id="attachment_201" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb2_underneath.jpg" rel="lightbox[126]"><img class="size-thumbnail wp-image-201" title="Underneath" src="http://www.veys.com/wp-content/uploads/2008/07/mbb2_underneath-150x150.jpg" alt="Underneath" width="150" height="150" /></a><p class="wp-caption-text">Underneath</p></div></td>
</tr>
</tbody>
</table>
<h3>Version 2.1</h3>
<p>A slight update to the original. I decided I wanted to re-write it in C as an exercise.  While I was at it, I figured I&#8217;d add a feature or two.</p>
<p>Pretty basic, a complete re-write in C, Hi-Tech PICC to be exact. It&#8217;s a great compiler for the PICs and gave me opportunities to re-write the LCD, ADC and DELAY libraries in C.</p>
<h3>New Features</h3>
<ul>
<li>New program-loop idea, worked well</li>
<li>Strobe mode for Light output</li>
<li>Temperatures in Celcius or Fahrenheit</li>
</ul>
<h3>Downloads</h3>
<p>All files for Mr. Baybus 2 are distributed under a <a href="http://www.opensource.org/licenses/bsd-license.php">BSD</a>-style license.</p>
<ul>
<li>Original
<ul>
<li><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb2-src.zip">Assembly source code, and assembled HEX file (built for 16F870)</a> (zip)</li>
<li><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb2_parts.sxc">Parts list</a> (<a href="http://www.openoffice.or">OOo</a> spreadsheet)</li>
<li><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb2_screens.sxc">Screen prototypes</a> (OOo spreadsheet)</li>
</ul>
</li>
<li>v2.1
<ul>
<li><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb21-src.zip">C source code, and compiled HEX file (built for 16F870)</a> (zip)</li>
<li><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb21_screens.sxc">Screen prototypes</a> (OOo spreadsheet)</li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://veys.com/2002/08/24/mr-baybus-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PIC buttons (interrupt-based)</title>
		<link>http://veys.com/2002/08/23/pic-buttons-interrupt-based/</link>
		<comments>http://veys.com/2002/08/23/pic-buttons-interrupt-based/#comments</comments>
		<pubDate>Sat, 24 Aug 2002 05:08:56 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[howtos]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[interrupts]]></category>
		<category><![CDATA[legacy articles]]></category>
		<category><![CDATA[microcontroller]]></category>
		<category><![CDATA[pic]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.veys.com/blog/?p=124</guid>
		<description><![CDATA[Previously, in PIC buttons (polling) we saw how to poll for the state of a line connect to a button, that is all fine and good but really that is not the best way to do them. The &#8220;real&#8221; way to interface with external components like that is through interrupts, a slick feature. Interrupts provide [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_250" class="wp-caption alignright" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/interrupt_schematic.gif" rel="lightbox[124]"><img class="size-thumbnail wp-image-250" title="Schematic" src="http://www.veys.com/wp-content/uploads/2008/07/interrupt_schematic-150x150.gif" alt="Schematic" width="150" height="150" /></a><p class="wp-caption-text">Schematic</p></div>
<p>Previously, in <a href="http://veys.com/2002/08/22/pic-buttons-polling/" title="PIC buttons (polling)">PIC buttons (polling)</a> we saw how to poll for the state of a line connect to a button, that is all fine and good but really that is not the best way to do them. The &#8220;real&#8221; way to interface with external components like that is through interrupts, a slick feature.</p>
<p>Interrupts provide you with lots of freedom in your code. They allow you to sit back, relax, and be told when an event occurs, and not be forced to sit and wait for it to happen.</p>
<p>For this program, the schematic and circuit are practically the same, the only thing that changed location is the button.</p>
<p>Instead of looping over and over again, we simply wait, using a goto $ we are essentially goto&#8217;ing the same address over and over, &#8220;goto here, goto here, goto here&#8230;&#8221; ad nauseum. A common technique is also to use a SLEEP command, which puts the PIC in a low power mode and halts the program counter. Same effect to the user though. You of course could do &#8216;real&#8217; work too instead of just burn cycles.</p>
<p>Once the button is pressed and released, the PIC will generate an interrupt, forcing the program to goto memory location 4. This is labeled in the code as ISR (Interrupt Service Routine).</p>
<p>For this program we are using the RB0/INT Interrupt. This interrupt occurs when there is a low-high change in PORTB,0. It can also be configured for high-low as well.</p>
<p>To enable this, we set INTCON,INTE. This bit says we want to know if a change occurs. To enable interrupts in general, we must then set INTCON,GIE. This lets all enabled interrupts occur.</p>
<p>We then wait for the interrupt. Once it occurs, GIE is automatically cleared so we can&#8217;t have them inside each other, and blink the LED a couple times. We then clear the interrupt flag, saying we&#8217;ve handled the interrupt (INTCON,INTF). We then re-enable interrupts and return from the interrupt: retfie.</p>
<p>It should be noted that if we were using more than one interrupt type, we would have needed to check the flag bits to find out which one interrupted us. We then handle it, and clear its flag. The PIC is somewhat crippled in this manner. Any and all interrupts generated and thrown into address 4 and &#8220;we&#8221; have to figure out which one occured. Many higher end MCU&#8217;s will have a table of addresses to jump to for each particular interrupt type, we then code in each location the correct routine and the processor knows which to call based on what happens.</p>
<h3>Downloads</h3>
<ul>
<li><a href="http://www.veys.com/wp-content/uploads/2008/07/interrupts.zip">Source Code</a> (zip)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://veys.com/2002/08/23/pic-buttons-interrupt-based/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PIC buttons (polling)</title>
		<link>http://veys.com/2002/08/22/pic-buttons-polling/</link>
		<comments>http://veys.com/2002/08/22/pic-buttons-polling/#comments</comments>
		<pubDate>Fri, 23 Aug 2002 05:07:52 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[howtos]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[legacy articles]]></category>
		<category><![CDATA[microcontroller]]></category>
		<category><![CDATA[pic]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.veys.com/blog/?p=122</guid>
		<description><![CDATA[Polling for button input, how useful! This is pretty brief and gives a good idea how to let buttons control your programs execution. In this tutorial I&#8217;ve switched from using an oscillator to using a crystal. This changes the design a bit. Using the 2 OSC pins, OSC1/OSC2 (CLKOUT/CLKIN) they hook to the crystal in [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_243" class="wp-caption alignright" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/polling_schematic.gif" rel="lightbox[122]"><img class="size-thumbnail wp-image-243" title="Schematic" src="http://www.veys.com/wp-content/uploads/2008/07/polling_schematic-150x150.gif" alt="" width="150" height="150" /></a><p class="wp-caption-text">Schematic</p></div>
<p>Polling for button input, how useful! This is pretty brief and gives a good idea how to let buttons control your programs execution.</p>
<p>In this tutorial I&#8217;ve switched from using an oscillator to using a crystal. This changes the design a bit. Using the 2 OSC pins, OSC1/OSC2 (CLKOUT/CLKIN) they hook to the crystal in parallel. Then the two sides of the crystal are connected to ground via two capacitors, in this case 18pF. The speed and capacitance needed varies, and can be seen in most any PIC MCU datasheet as to how to lay it out. It will also be in my schematic.</p>
<p>Please note this is essentially NO DIFFERENT than the oscillator. It is simply a different means of providing a clock signal. You can swap in the oscillator to the normal CLKIN pin and it will work just fine.</p>
<p>For this program, we&#8217;ll start the processor, and wait for a button to be pressed. After it has been pressed we&#8217;ll essentially execute the LED blinker from before.</p>
<p>Polling is extremely simple. Polling is the act of checking something for a certain state to occur. In our case, we poll PORTB,4 waiting for it to go low. Once it does, we continue on and start blinking.</p>
<div id="attachment_242" class="wp-caption alignright" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/polling_circuit.jpg" rel="lightbox[122]"><img class="size-thumbnail wp-image-242" title="Circuit Image" src="http://www.veys.com/wp-content/uploads/2008/07/polling_circuit-150x150.jpg" alt="Circuit Image" width="150" height="150" /></a><p class="wp-caption-text">Circuit Image</p></div>
<p>Another topic that needs to be covered is that of Pull-Up resistors. In order for a button to be able to change from 0 to 1 (Ground to 5V) we need a way to protect everything from a short circuit. We do this with a Pull-Up (or Pull-Down in some cases) resistor. For our case, we connect PORTB,4 to +5V via a 10k resistor. So when we fire up the program, the PIC sees PORTB,4 as HIGH. We then connect our button to PORTB,4 on one side, and Ground on the other. Now, when we press the button, PORTB,4 is connected to ground and is now LOW. A short circuit between +5 and Ground would occur if not for the resistor, which being 10k limits the current to a measly 500uA, nothing to worry about. Once the button is released, Ground is disconnected and the pin returns to a HIGH state.</p>
<p>Reading the code, you may also notice the _BANK macro has changed a bit. I&#8217;ve simply modified it to encompass all possible BANK configs instead of using 4 different macros for each. Reading through it can give you a little insight as to how the conditional assembler works. It&#8217;s a bit like C/C++ and a bit like BASIC. Quite nice and handy.</p>
<p>A final new bit is the _MCLRE_OFF in the __CONFIG line at the beginning. This frees us from having to pull _MCLR high to keep from a RESET condition. Just keeps our parts count down. <img src='http://veys.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Now for the new section of code.</p>

<div class="wp_syntax"><div class="code"><pre class="asm" style="font-family:monospace;">  btfsc PORTB<span style="color: #339933;">,</span><span style="color: #0000ff;">4</span>
    <span style="color: #000000; font-weight: bold;">goto</span> $<span style="color: #339933;">-</span><span style="color: #0000ff;">1</span></pre></div></div>

<p>That&#8217;s polling, yup, that&#8217;s it. All it is doing is a bit test on PORTB,4, waiting for it to become clear (Ground). The goto line is telling it to go 1 instruction back ($ means the address of the current instruction, $-1 means one before, the btfsc). Once that pin becomes 0 it skips the loop forcing it to check, and lets it continue on down to the blinker!</p>
<h3>Downloads</h3>
<ul>
<li><a href="http://www.veys.com/wp-content/uploads/2008/07/poll.zip">Source Code</a> (zip)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://veys.com/2002/08/22/pic-buttons-polling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PIC LED blinker (busy-wait)</title>
		<link>http://veys.com/2002/08/21/pic-led-blinker-busy-wait/</link>
		<comments>http://veys.com/2002/08/21/pic-led-blinker-busy-wait/#comments</comments>
		<pubDate>Thu, 22 Aug 2002 04:18:18 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[howtos]]></category>
		<category><![CDATA[blinker]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[led]]></category>
		<category><![CDATA[legacy articles]]></category>
		<category><![CDATA[microcontroller]]></category>
		<category><![CDATA[pic]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.veys.com/blog/?p=120</guid>
		<description><![CDATA[Beyond all doubt, the #1 beginning program in microcontrollers is the LED blinker. It&#8217;s super simple, and teaches the concept of pin voltages and busy-waits. Here is a busy-wait LED blinker program, and a walkthrough building it in MPLab. First, the delay. This is a busy-wait delay program, busy-wait means you just burn instruction cycles [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_226" class="wp-caption alignright" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/pic16_blinker_schem.jpg" rel="lightbox[120]"><img class="size-thumbnail wp-image-226  " title="LED blinker #1 circuit schematic" src="http://www.veys.com/wp-content/uploads/2008/07/pic16_blinker_schem-150x150.jpg" alt="LED blinker #1 circuit schematic" width="150" height="150" /></a><br />
<p class="wp-caption-text">Schematic</p></div>
<p>Beyond all doubt, the #1 beginning program in microcontrollers is the LED blinker. It&#8217;s super simple, and teaches the concept of pin voltages and busy-waits.  Here is a busy-wait LED blinker program, and a walkthrough building it in MPLab.</p>
<p>First, the delay. This is a busy-wait delay program, busy-wait means you just burn instruction cycles for the delay, keeping the MCU &#8220;busy&#8221;. There&#8217;s a tiny bit of math behind them. First, the clock speed is 20MHz, the instruction frequency is (clock/4) so our instructions are executing at 5MHz. This gives us a period of 200ns per cycle.</p>
<p>I created two delay functions, for versatility, and for LCD stuff which will come later but it&#8217;s handy here. One is a &#8220;DELAY_US&#8221; which will delay a specified amount of microseconds. This is done by wasting 5 cycles (5*200ns = 1us) a specified amount of times (less than or equal to 255us, since I only made an 8-bit &#8220;delay&#8221; variable). We can learn the cycle times from the data sheet, and make it work from there.</p>
<p>Next, I created a &#8220;DELAY_MS&#8221; which delays a specified amount of milliseconds. Same 8-bit limitation of max 255ms, but that&#8217;s enough to have fun with&#8230; It simply calls DELAY_US a few times with specified amounts of delay, adding up to 1000us (=1ms) and repeats as many times as we tell it to.</p>
<p>These delays are used to make the LED blinking visible, otherwise it would blink faster than we could see (if at all, it takes a cycle or two for the pin to change state so it might not even change if we just toggle it every other cycle).</p>
<p>Here&#8217;s a little more PIC architecture information. The PIC&#8217;s data registers are broken into &#8220;banks&#8221; (bank 0, 1, 2, 3). Meaning you cannot get at them all at the same time, although some are mapped to all banks so you CAN get at them, important ones. We usually hang out in bank 0&#8230; This usually isn&#8217;t a problem, just something you need to remember. The data sheet illustrates it pretty well. When it comes up I&#8217;ll clarify things about it.</p>
<p>Also, for the I/O pins. Since they&#8217;re bi-directional, you need to choose which direction to set them to. Input or output. This is done by setting the tri-state register for the given port, for example PORTA&#8217;s tris register is called TRISA (not tough!). You set the direction of a specific bit, by setting the bit of the TRIS register to either 0 or 1, 0 meaning OUTPUT and 1 meaning INPUT. Not tough to remember: 0 = Out and 1 = In.</p>
<h3>Source Code</h3>
<p>Ok, first you need to make sure you have MPLab from Microchip.com</p>
<p>Once you have MPLab, download the LED Blinker (busy-wait) source code.</p>
<p>MPLab is a nice IDE, you&#8217;ll need to create a &#8220;project&#8221; and then pick your chip, and add the asm file to it (called a &#8220;node&#8221;). All code is going to be indented 2 spaces, labels will not be indented at all, assembler directives are either 1 or 2 spaces in&#8230;</p>
<p>First few lines are kinda simple, the title directive just sets a title for your project&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="asm" style="font-family:monospace;"> <span style="color: #000000; font-weight: bold;">title</span>  <span style="color: #7f007f;">&quot;LED Blinker Tutorial 1&quot;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">LIST</span> R=<span style="color: #00007f; font-weight: bold;">DEC</span>
  <span style="color: #000000; font-weight: bold;">INCLUDE</span> <span style="color: #7f007f;">&quot;p16f628.inc&quot;</span>
 __CONFIG _CP_OFF &amp; _WDT_OFF &amp; _HS_OSC &amp; _PWRTE_ON &amp; _LVP_OFF &amp; _MCLRE_ON</pre></div></div>

<p>LIST R = DEC sets the default &#8220;radix&#8221; for the program, meaning the number base. So if I put 100 in a line somewhere, it means 100 DECIMAL. If I changed it to LIST R = HEX, then if I put 100 in somewhere, it means 0&#215;100, TOTALLY different. I find DEC easier to work with, and you can still use 0x whatever and it means HEX so you get the best of both worlds.</p>
<p>Next we INCLUDE the &#8220;p16f628.inc&#8221; which will give us nice little names for our registers so we don&#8217;t need to remember their addresses, how nice of Microchip.</p>
<p>Then the __CONFIG line, arguably the ugliest line of code while still being fairly simple. You can see the list of __CONFIG&#8217;s in the &#8220;p16f628.inc&#8221; file, they&#8217;re simply setting the configuration of certain chip features, the ones I have listed do this: _CP_OFF copyprotect OFF, you can set the copyprotect bits to make your chip unreadable, this is only good for a production product, don&#8217;t use it. _WDT_OFF, watchdog timer off, watchdog timer is there for mission-critical applications, it&#8217;s constantly running and needs to be reset constantly, if it isn&#8217;t reset it will reset the chip (assuming your program has locked up), we don&#8217;t need it here. _HS_OSC specifies a high speed oscillator, it&#8217;s in the data sheet. _PWRTE_ON turns on the power up timer delay, it&#8217;ll make the MCU wait a bit before executing to make sure voltage is stable, oscillator is stable, etc&#8230; _LVP_OFF &#8211; low voltage programming, dun&#8217;need it&#8230; _MCLRE_ON makes us hold MCLR high, instead of letting the chip do it&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="asm" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">;----------------------------------------------------------------------------------------</span>
<span style="color: #666666; font-style: italic;">; Variable declarations</span>
<span style="color: #666666; font-style: italic;">;----------------------------------------------------------------------------------------</span>
 CBLOCK <span style="color: #0000ff;">0x20</span>
DELAY<span style="color: #339933;">,</span>DELAYTMP			<span style="color: #666666; font-style: italic;">; delay function variables...</span>
 ENDC</pre></div></div>

<p>Now to the variable declarations, the CBLOCK directive lets us just list out our variable names, and the assembler will assign addresses for us, this is handy. The 0&#215;20 is the starting address of general-purpose registers in BANK 0. We list em out, then end it with ENDC.</p>

<div class="wp_syntax"><div class="code"><pre class="asm" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">;----------------------------------------------------------------------------------------</span>
<span style="color: #666666; font-style: italic;">; Macro declarations</span>
<span style="color: #666666; font-style: italic;">;----------------------------------------------------------------------------------------</span>
BANK0 <span style="color: #000000; font-weight: bold;">macro</span>           		<span style="color: #666666; font-style: italic;">; Switch to BANK0</span>
  bcf STATUS<span style="color: #339933;">,</span>RP1
  bcf STATUS<span style="color: #339933;">,</span>RP0
  <span style="color: #000000; font-weight: bold;">endm</span>
&nbsp;
BANK1 <span style="color: #000000; font-weight: bold;">macro</span>           		<span style="color: #666666; font-style: italic;">; Switch to BANK1</span>
  bcf STATUS<span style="color: #339933;">,</span>RP1
  <span style="color: #00007f; font-weight: bold;">bsf</span> STATUS<span style="color: #339933;">,</span>RP0
  <span style="color: #000000; font-weight: bold;">endm</span>
&nbsp;
DELAY_MILLI <span style="color: #000000; font-weight: bold;">macro</span> TIME
  movlw TIME
  movwf DELAY
  <span style="color: #00007f; font-weight: bold;">call</span> DELAY_MS
  <span style="color: #000000; font-weight: bold;">endm</span>
&nbsp;
DELAY_MICRO <span style="color: #000000; font-weight: bold;">macro</span> TIME
  movlw TIME
  movwf DELAY
  <span style="color: #00007f; font-weight: bold;">call</span> DELAY_US
  <span style="color: #000000; font-weight: bold;">endm</span></pre></div></div>

<p>Next the Macro&#8217;s&#8230; Macro&#8217;s are one of the coolest features of MPLab, it&#8217;s kinda like an inline C function, and kinda like a #define. When called, the code is dumped into where it was called from, but you can use variables in it, and even arguments to customize it&#8217;s compiling, stuff I&#8217;ll show in later programs.</p>
<p>Anyways, you make one by saying: NAME macro in the first column, then code. End it w/a endm. The ones I have are fairly simple and re-usable. BANK0 sets the bank bits to get us into BANK 0, go figure. BANK1 sets them to get us into BANK1, crazy!</p>
<p>DELAY_MILLI takes the TIME argument and loads it into W, next it moves W to the register labeled DELAY. Then it calls our illustrious DELAY_MS function which will be explained in detail down below&#8230; DELAY_MICRO does the same damn thing with DELAY_US!</p>

<div class="wp_syntax"><div class="code"><pre class="asm" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">;----------------------------------------------------------------------------------------</span>
<span style="color: #666666; font-style: italic;">; Program code</span>
<span style="color: #666666; font-style: italic;">;----------------------------------------------------------------------------------------</span>
  <span style="color: #000000; font-weight: bold;">PAGE</span>
&nbsp;
 <span style="color: #000000; font-weight: bold;">org</span> <span style="color: #0000ff;">0</span>
  <span style="color: #000000; font-weight: bold;">goto</span> MAIN
&nbsp;
 <span style="color: #000000; font-weight: bold;">org</span> <span style="color: #0000ff;">4</span>
ISR
  <span style="color: #666666; font-style: italic;">; interrupt handler</span>
  retfie</pre></div></div>

<p>PAGE is a pagebreak for printing, though it doesn&#8217;t work for me. <img src='http://veys.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>org 0 tells the assembler to start assembly at address 0, our first instruction is to jump (goto) the label MAIN.</p>
<p>org 4 starts us in the Interrupt address of PIC&#8217;s&#8230; This is kind of strange and will be explained later on, for now just accept it as fact&#8230;</p>
<p>And if you&#8217;re wondering if we lost space for 3 instructions between 0 and 4, you&#8217;re right. <img src='http://veys.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<div class="wp_syntax"><div class="code"><pre class="asm" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">;----------------------------------------------------------------------------------------</span>
<span style="color: #666666; font-style: italic;">; Subroutines</span>
<span style="color: #666666; font-style: italic;">;----------------------------------------------------------------------------------------</span>
DELAY_US			<span style="color: #666666; font-style: italic;">; busy wait of DELAY us</span>
				<span style="color: #666666; font-style: italic;">; 200ns instruction period assumed</span>
  <span style="color: #00007f; font-weight: bold;">nop</span>				<span style="color: #666666; font-style: italic;">; (1)</span>
  <span style="color: #00007f; font-weight: bold;">nop</span>				<span style="color: #666666; font-style: italic;">; (2)</span>
  decfsz DELAY<span style="color: #339933;">,</span>f		<span style="color: #666666; font-style: italic;">; test DELAY count (3)</span>
    <span style="color: #000000; font-weight: bold;">goto</span> DELAY_US		<span style="color: #666666; font-style: italic;">; loop if not done (4,5)</span>
  return			<span style="color: #666666; font-style: italic;">; gtfo (4,5)</span>
&nbsp;
DELAY_MS			<span style="color: #666666; font-style: italic;">; busy wait of DELAY ms</span>
				<span style="color: #666666; font-style: italic;">; dependant upon DELAY_US being accurate</span>
  movf DELAY<span style="color: #339933;">,</span>w
  movwf DELAYTMP		<span style="color: #666666; font-style: italic;">; save DELAY time</span>
DELAY_MS_LOOP			<span style="color: #666666; font-style: italic;">; inner loop</span>
  movlw <span style="color: #0000ff;">245</span>			<span style="color: #666666; font-style: italic;">; load 245 (1)</span>
  movwf DELAY			<span style="color: #666666; font-style: italic;">; into DELAY (2)</span>
  <span style="color: #00007f; font-weight: bold;">call</span> DELAY_US			<span style="color: #666666; font-style: italic;">; wait 245us (3-249)</span>
  movlw <span style="color: #0000ff;">245</span>			<span style="color: #666666; font-style: italic;">; load 245 (250)</span>
  movwf DELAY			<span style="color: #666666; font-style: italic;">; into DELAY (251)</span>
  <span style="color: #00007f; font-weight: bold;">call</span> DELAY_US			<span style="color: #666666; font-style: italic;">; wait 245us (252-498)</span>
  movlw <span style="color: #0000ff;">245</span>			<span style="color: #666666; font-style: italic;">; load 245 (499)</span>
  movwf DELAY			<span style="color: #666666; font-style: italic;">; into DELAY (500)</span>
  <span style="color: #00007f; font-weight: bold;">call</span> DELAY_US			<span style="color: #666666; font-style: italic;">; wait 245us (501-747)</span>
  movlw <span style="color: #0000ff;">246</span>			<span style="color: #666666; font-style: italic;">; load 246 (748)</span>
  movwf DELAY			<span style="color: #666666; font-style: italic;">; into DELAY (749)</span>
  <span style="color: #00007f; font-weight: bold;">call</span> DELAY_US			<span style="color: #666666; font-style: italic;">; wait 246us (750-997)</span>
  decfsz DELAYTMP<span style="color: #339933;">,</span>f		<span style="color: #666666; font-style: italic;">; test DELAYTMP count (998)</span>
    <span style="color: #000000; font-weight: bold;">goto</span> DELAY_MS_LOOP		<span style="color: #666666; font-style: italic;">; loop if not done (999,1000)</span>
  return			<span style="color: #666666; font-style: italic;">; gtfo (999,1000)</span></pre></div></div>

<p>Next we have our subroutines, the delays, I have these before the main lines of code just out of habit, it&#8217;s not required.</p>
<p>DELAY_US&#8230; Pretty simple really, we start out by burning 2 cycles, so we&#8217;ve waited 400ns so far, next we decrement our counter, and test if it&#8217;s zero, if it isn&#8217;t, we goto DELAY_US, looping again, if not, we return. The test itself takes one cycle (600ns so far) and either the goto or return take 2 cycles (1000ns = 1us) so we have our microsecond delay!</p>
<p>DELAY_MS works on the same principle, it&#8217;s accurate enough for this! <img src='http://veys.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<div class="wp_syntax"><div class="code"><pre class="asm" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">;----------------------------------------------------------------------------------------</span>
<span style="color: #666666; font-style: italic;">; Mainline of code</span>
<span style="color: #666666; font-style: italic;">;----------------------------------------------------------------------------------------</span>
MAIN
  BANK1
  bcf TRISA<span style="color: #339933;">,</span><span style="color: #0000ff;">2</span>			<span style="color: #666666; font-style: italic;">; PORT A, bit 2 is our output pin.</span>
  BANK0
&nbsp;
LOOP_BEGIN
  <span style="color: #00007f; font-weight: bold;">bsf</span> PORTA<span style="color: #339933;">,</span><span style="color: #0000ff;">2</span>  			<span style="color: #666666; font-style: italic;">; set her.</span>
  DELAY_MILLI <span style="color: #0000ff;">250</span>		<span style="color: #666666; font-style: italic;">; wait 1/4 sec</span>
  bcf PORTA<span style="color: #339933;">,</span><span style="color: #0000ff;">2</span>			<span style="color: #666666; font-style: italic;">; clear her!</span>
  DELAY_MILLI <span style="color: #0000ff;">250</span>		<span style="color: #666666; font-style: italic;">; wait 1/4 sec!!!!</span>
  <span style="color: #000000; font-weight: bold;">goto</span> LOOP_BEGIN		<span style="color: #666666; font-style: italic;">; forever... :o</span>
&nbsp;
 <span style="color: #000000; font-weight: bold;">end</span></pre></div></div>

<p>MAIN is our label for the beginning of the code, jumped to by the first line up @ org 0. BANK1 gets us into BANK 1 so we can set our bit direction, we clear bit 2 of TRISA making bit 2 of PORTA our output pin, then we hop back to BANK 0&#8230;</p>
<p>Then our introductory programming teachers worst nightmare, a purposely created infinite loop. We label the beginning, then set our pin high, shutting off the LED (as you&#8217;ll see in the wiring diagram). We wait 250ms via our handy delay function, then clear the bit, turning the LED on, we wait again and loop ad nauseum.</p>
<p>&#8216;end&#8217; tells the assembler to give up&#8230;</p>
<h3>Building</h3>
<p>Alright, so we have our program, we run the assembler by clicking the weird funnel icon or by going to Project -&gt; Build Node (or All). It&#8217;ll crunch and come up with no errors (of course).  Then just toss it into the programmer and feed the chip your tasty code.</p>
<h3>Schematic</h3>
<div id="attachment_225" class="wp-caption alignright" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/pic16_blinker.jpg" rel="lightbox[120]"><img class="size-thumbnail wp-image-225" title="The assembled circuit" src="http://www.veys.com/wp-content/uploads/2008/07/pic16_blinker-150x150.jpg" alt="The assembled circuit" width="150" height="150" /></a><p class="wp-caption-text">The assembled circuit</p></div>
<p>Wire up the circuit as in the schematic at the top of the page.  Hopefully it illustrates to you why the LED is on when the bit is off, and off when the bit is on&#8230; The LED is a typical ~2V yellow LED&#8230;  Wired up it should look something like the image.</p>
<h3>Running</h3>
<p>Hook up +5V and Gnd, and fire it up! If everything is set up correctly you&#8217;ll get a steady blinking LED!</p>
<h3>Something to try</h3>
<p>Connect a momentary switch to the _MCLR line, wired to Ground on the other side. Pushing the button will reset the chip, releasing it will start it over from the beginning of the program, of course it will do the same stuff, but this demonstrates how the reset buttons work. I also highly recommend changing the code to add a more interesting blink pattern, longer/shorter delays, and other stuff to get used to modifying code&#8230;</p>
<h3>Downloads</h3>
<ul>
<li><a href="http://www.veys.com/wp-content/uploads/2008/07/busyblinker.zip">Source Code</a> (zip)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://veys.com/2002/08/21/pic-led-blinker-busy-wait/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mr. Baybus</title>
		<link>http://veys.com/2002/08/20/mr-baybus/</link>
		<comments>http://veys.com/2002/08/20/mr-baybus/#comments</comments>
		<pubDate>Wed, 21 Aug 2002 04:17:26 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[legacy articles]]></category>
		<category><![CDATA[microcontroller]]></category>
		<category><![CDATA[mr baybus]]></category>
		<category><![CDATA[pic]]></category>

		<guid isPermaLink="false">http://www.veys.com/blog/?p=118</guid>
		<description><![CDATA[Mr. Baybus is a microcontroller-based fan control system. It is a completely stand-alone unit, with no computer-control whatsoever. Control comes from momentary switches on the front panel. You have 4 switches to toggle your fans on/off, and a brightness/contrast button, which switches you into a screen to alter those settings. Another press gets you back [...]]]></description>
			<content:encoded><![CDATA[<p>Mr. Baybus is a microcontroller-based fan control system. It is a completely stand-alone unit, with no computer-control whatsoever.</p>
<p>Control comes from momentary switches on the front panel. You have 4 switches to toggle your fans on/off, and a brightness/contrast button, which switches you into a screen to alter those settings. Another press gets you back to the fan status display.</p>
<p>All settings are saved in EEPROM memory on-chip. So when you shut your system down, then power back up, your fans will be running the same as they were before, and your brightness and contrast will remain unchanged as well.</p>
<p>The display is a <a href="http://www.crystalfontz.com/">CrystalFontz</a> 16&#215;2 Serial LCD. This unit is EXCELLENT. It supports SPI transfers which is what Mr. Baybus prefers!</p>
<p>The fans are switched by power MOSFETs. IRL3102&#8242;s to be exact. They are rated to handle up to around 7A for a 12V circuit like this. This is of course far beyond anything I would ever want to throw at it, but it&#8217;s nice to know you have the room to expand.</p>
<p>Connections to the system are made via a small 4-pin connector. This facilitates 2 fans per circuit, 4 circuits in all. The connector is the same as the CD-Audio connector on your CD-Rom&#8217;s so it&#8217;s quick and easy to remove the fans.</p>
<p>The brains of the system come in the form of an 18-pin microcontroller. A very basic PIC16F84a. At 4MHz this little guy is going way faster than this system needs but hey, if you got it, why not. All 912 lines of code were written in assembly over the course of a few nights.</p>
<p>Full source code, schematics and PCB layouts are available, enjoy!</p>
<h3>Screen Images</h3>
<table border="0">
<tbody>
<tr>
<td>
<p><div id="attachment_169" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb_splash.jpg" rel="lightbox[118]"><img class="size-thumbnail wp-image-169" title="Startup Splash" src="http://www.veys.com/wp-content/uploads/2008/07/mbb_splash-150x150.jpg" alt="Startup Splash" width="150" height="150" /></a><p class="wp-caption-text">Startup Splash</p></div></td>
<td>
<p><div id="attachment_167" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb_main.jpg" rel="lightbox[118]"><img class="size-thumbnail wp-image-167" title="Main Screen" src="http://www.veys.com/wp-content/uploads/2008/07/mbb_main-150x150.jpg" alt="Main Screen" width="150" height="150" /></a><p class="wp-caption-text">Main Screen</p></div></td>
<td>
<p><div id="attachment_168" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb_options.jpg" rel="lightbox[118]"><img class="size-thumbnail wp-image-168" title="Options" src="http://www.veys.com/wp-content/uploads/2008/07/mbb_options-150x150.jpg" alt="Options" width="150" height="150" /></a><p class="wp-caption-text">Options</p></div></td>
</tr>
</tbody>
</table>
<h3>Unit Images</h3>
<table border="0">
<tbody>
<tr>
<td>
<p><div id="attachment_171" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb_blankpcb.jpg" rel="lightbox[118]"><img class="size-thumbnail wp-image-171" title="Blank PCB" src="http://www.veys.com/wp-content/uploads/2008/07/mbb_blankpcb-150x150.jpg" alt="Blank PCB" width="150" height="150" /></a><p class="wp-caption-text">Blank PCB</p></div></td>
<td>
<p><div id="attachment_172" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb_complete.jpg" rel="lightbox[118]"><img class="size-thumbnail wp-image-172" title="Mr. Baybus" src="http://www.veys.com/wp-content/uploads/2008/07/mbb_complete-150x150.jpg" alt="Mr. Baybus" width="150" height="150" /></a><p class="wp-caption-text">Mr. Baybus</p></div></td>
<td>
<p><div id="attachment_173" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb_complete_labeled.jpg" rel="lightbox[118]"><img class="size-thumbnail wp-image-173" title="Labeled Close-up" src="http://www.veys.com/wp-content/uploads/2008/07/mbb_complete_labeled-150x150.jpg" alt="Labeled Close-up" width="150" height="150" /></a><p class="wp-caption-text">Labeled Close-up</p></div></td>
</tr>
<tr>
<td>
<p><div id="attachment_175" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb_installed_front.jpg" rel="lightbox[118]"><img class="size-thumbnail wp-image-175" title="Front view, installed" src="http://www.veys.com/wp-content/uploads/2008/07/mbb_installed_front-150x150.jpg" alt="" width="150" height="150" /></a><p class="wp-caption-text">Front view, installed</p></div></td>
<td>
<p><div id="attachment_174" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb_installed_back.jpg" rel="lightbox[118]"><img class="size-thumbnail wp-image-174" title="Rear view, installed" src="http://www.veys.com/wp-content/uploads/2008/07/mbb_installed_back-150x150.jpg" alt="Rear view, installed" width="150" height="150" /></a><p class="wp-caption-text">Rear view, installed</p></div></td>
</tr>
</tbody>
</table>
<h3>Downloads</h3>
<p>All files for Mr. Baybus are distributed under a <a href="http://www.opensource.org/licenses/bsd-license.php">BSD</a>-style license.</p>
<ul>
<li><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb-src.zip">Assembly source code, and assembled HEX file (built for PIC16F84a)</a> (zip)</li>
<li><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb_pcb.gif" rel="lightbox[118]">PCB Layout</a> (gif)</li>
<li><a href="http://www.veys.com/wp-content/uploads/2008/07/mbb_schematic.pdf">Schematic</a> (pdf)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://veys.com/2002/08/20/mr-baybus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Basic PIC16 hardware setup</title>
		<link>http://veys.com/2002/08/19/basic-pic1-hardware-setup/</link>
		<comments>http://veys.com/2002/08/19/basic-pic1-hardware-setup/#comments</comments>
		<pubDate>Tue, 20 Aug 2002 04:16:21 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[howtos]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[legacy articles]]></category>
		<category><![CDATA[microcontroller]]></category>
		<category><![CDATA[pic]]></category>

		<guid isPermaLink="false">http://www.veys.com/blog/?p=116</guid>
		<description><![CDATA[Your basic PIC16 microcontroller can&#8217;t hold down the fort by itself, it needs a little help from a few components. I use a prototyping breadboard, the white kind you can just plug &#38; unplug stuff to all day long. It makes life prototyping a whole lot easier. Ok, now on to the PIC stuff. First [...]]]></description>
			<content:encoded><![CDATA[<p>Your basic PIC16 microcontroller can&#8217;t hold down the fort by itself, it needs a little help from a few components.</p>
<div id="attachment_134" class="wp-caption alignright" style="width: 110px"><a href="http://www.veys.com/wp-content/uploads/2008/07/breadboard.jpg" rel="lightbox[116]"><img class="size-thumbnail wp-image-134" title="Solderless Breadboard" src="http://www.veys.com/wp-content/uploads/2008/07/breadboard-100x150.jpg" alt="Breadboard" width="100" height="150" /></a><p class="wp-caption-text">Breadboard</p></div>
<p>I use a prototyping breadboard, the white kind you can just plug &amp; unplug stuff to all day long. It makes life prototyping a whole lot easier.</p>
<p>Ok, now on to the PIC stuff. First and foremost, you need an oscillator, the oscillator is what keeps the PIC moving, it provides the clock signal for the chip. For our 16F628, I used a 20MHz oscillator in a &#8220;half-can&#8221; package. Many people like to use crystals and capacitors, etc, I use them on simpler designs, but they&#8217;re a bit harder to understand at first.</p>
<p>These oscillators are powered by +5V, and the output goes into the pin labeled OSC1/CLKIN on the 16F628. You can get these oscillators at Digi-Key (part#: CTX169-ND).</p>
<p>The other key part is the reset line. We need to hold this line HIGH (+5V) and drop to it 0V to reset the chip, which we won&#8217;t need for a while. To tie it high you use a &#8220;pull-up&#8221; resistor (10k is good for this) to the +5V line, connected to the _MCLR pin of the chip (reset pin). I like to use the outside rails for Ground, and inside rails for +5V as you&#8217;ll see in the pictures&#8230; This isn&#8217;t *required* as our chip is smart enough to pull up it&#8217;s own _MCLR pin, but for the first few projects we&#8217;ll explicitly do it so you get used to it. <img src='http://veys.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div id="attachment_135" class="wp-caption alignright" style="width: 110px"><a href="http://www.veys.com/wp-content/uploads/2008/07/halfcanoscillator.jpg" rel="lightbox[116]"><img class="size-thumbnail wp-image-135" title="Half can oscillator" src="http://www.veys.com/wp-content/uploads/2008/07/halfcanoscillator.jpg" alt="Oscillator" width="100" height="113" /></a><p class="wp-caption-text">Oscillator</p></div>
<p>Also connect Vss and Vdd to Gnd and +5 respectively to power the PIC.</p>
<p>After wiring these parts up, your breadboard should look something like this:</p>
<div id="attachment_133" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/basicsetup.jpg" rel="lightbox[116]"><img class="size-thumbnail wp-image-133" title="Basic Setup" src="http://www.veys.com/wp-content/uploads/2008/07/basicsetup-150x150.jpg" alt="Basic PIC16 wired up" width="150" height="150" /></a><p class="wp-caption-text">Basic PIC16 wired up</p></div>
<p>We also need a power supply. I use an old AT power supply, taking the red and black lines for +5 and Gnd respectively. You can use a 5V bench supply, batteries, wall-wart, anything 5V (but make sure it&#8217;s regulated).</p>
<p>Another smart part to use is a bypass capacitor, this lets the PIC draw power from the cap instead of the power supply during an increased power draw time, these are usually brief, but the power is needed quickly and a voltage drop would be bad, so you place a small, fast capacitor nearby the IC to provide the instant power and keep everyone happy. Typical values are a .1uF Tantalum capacitor.</p>
<p>Also handy are a pair of IC chip pullers, available in most little toolkits, they&#8217;ll help you avoid damaging the chip as you pull it out of the breadboard&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://veys.com/2002/08/19/basic-pic1-hardware-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making Home-Made PCBs</title>
		<link>http://veys.com/2001/11/21/making-home-made-pcbs/</link>
		<comments>http://veys.com/2001/11/21/making-home-made-pcbs/#comments</comments>
		<pubDate>Thu, 22 Nov 2001 05:34:15 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[howtos]]></category>
		<category><![CDATA[diy]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[legacy articles]]></category>
		<category><![CDATA[pcb]]></category>
		<category><![CDATA[printed circuit board]]></category>

		<guid isPermaLink="false">http://www.veys.com/blog/?p=21</guid>
		<description><![CDATA[A PCB is much more desirable than just a mess of wires, or even the little breadboards you can get @ Radio Shack. They&#8217;re not always the best way to do it, might not be worth the effort, but when you have a fairly complex wiring project, a PCB is VERY HANDY. So, what do [...]]]></description>
			<content:encoded><![CDATA[<p>A PCB is much more desirable than just a mess of wires, or even the little breadboards you can get @ Radio Shack. They&#8217;re not always the best way to do it, might not be worth the effort, but when you have a fairly complex wiring project, a PCB is VERY HANDY.</p>
<p>So, what do we need to make a PCB? Well, it&#8217;s not TOO much stuff&#8230; This method is the Iron Transfer method of making a home made PCB or PC Board.</p>
<h2>Supplies</h2>
<div id="attachment_28" class="wp-caption alignright" style="width: 160px"><img class="size-thumbnail wp-image-28 " title="Glossy Photo Paper" src="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_glossy_paper-150x150.jpg" alt="" width="150" height="150" /><p class="wp-caption-text">El-cheapo glossy inkjet paper</p></div>
<ul>
<li>Some way to draw the board. I use Eagle from CadSoft. It has a great free version available for download at their site.</li>
<li>Copper-clad board (we&#8217;re doing single-sided, 1oz.) these run around $5 @ Radio Shack or online for a single/double sided, 6&#8243;x6&#8243; board</li>
<li>Glossy Ink Jet paper (I use JetPrint Photo, HP Glossy does &#8221;&#8217;NOT&#8221;&#8217; work)</li>
<li>Laser Printer or Photocopier (need the toner to transfer)</li>
<li>Iron (normal, household iron) &amp; Ironing board</li>
<li>PCB Etchant Solution (there are several)
<ul>
<li>Ferric Chloride</li>
</ul>
<ul>
<li>Ammonium Persulphate</li>
</ul>
</li>
<li>A &#8221;&#8217;PLASTIC&#8221;&#8217; tray (metal is a BAD IDEA)</li>
<li>A drill of some kind (Dremel Tools work great)</li>
<li>Some little tiny drill bits (hobby stores have &#8216;em for like $5)</li>
</ul>
<h2>Process</h2>
<h3>Design and print the PCB Layout</h3>
<div id="attachment_34" class="wp-caption alignright" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_layout.gif" rel="lightbox[21]"><img class="size-thumbnail wp-image-34" title="Sample layout" src="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_layout-150x150.gif" alt="An example layout" width="150" height="150" /></a><p class="wp-caption-text">An example layout</p></div>
<div id="attachment_35" class="wp-caption alignright" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_printed.jpg" rel="lightbox[21]"><img class="size-thumbnail wp-image-35" title="Printed layouts" src="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_printed-150x150.jpg" alt="2-up sample layouts" width="150" height="150" /></a><p class="wp-caption-text">2-up sample layouts</p></div>
<p>First you draw your board, with whatever software you want. If you are using a PCB layout software package, then you already know what to do.  You can also just use any old drawing program, but I&#8217;d stick to 1 layer for that.  If simply drawing it, keep in mind you are drawing the BOTTOM of the PCB, so all pinouts, and arrangements are REVERSED (Unless you are making stuff for SMT parts, in which case, you probably don&#8217;t need this tutorial!). It&#8217;ll take practice and patience&#8230; Measure, draw, print on plain paper and see how your parts fit&#8230; Check, check, check, and check again to make sure all the lines you have drawn will mimic your wiring, you can&#8217;t change it without being sloppy once it&#8217;s etched&#8230;</p>
<p>Tip: Make sure your components have holes for each pad, once etched, it&#8217;ll make drilling much easier.</p>
<p>After we have that done, we&#8217;re ready to print it on our glossy paper. One thing you must remember to do, is to print this image flipped. You will be printing it to the page, then ironing it on, so to get it the right way, you must mirror it.</p>
<p>My laser printer doesn&#8217;t like the glossy paper, so I print it on a plain sheet of paper, then run it through a photocopier&#8230; Same result. You just need a flipped image of your board in toner on the glossy paper. The glossy paper lets the toner come off easier when you iron it.</p>
<h3>Transfer the Image</h3>
<div id="attachment_32" class="wp-caption alignleft" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_copper_clad.jpg" rel="lightbox[21]"><img class="size-thumbnail wp-image-32" title="Copper clad PCB" src="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_copper_clad-150x150.jpg" alt="Pre-etch copper clad" width="150" height="150" /></a><p class="wp-caption-text">Pre-etch copper clad</p></div>
<div id="attachment_33" class="wp-caption alignright" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_iron.jpg" rel="lightbox[21]"><img class="size-thumbnail wp-image-33" title="An iron" src="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_iron-150x150.jpg" alt="An iron!" width="150" height="150" /></a><p class="wp-caption-text">An iron!</p></div>
<p>Cut the paper to size to make it easier to handle and position on the copper-clad. You may also want to cut the copper-clad if don&#8217;t plan on using all of it for this board.</p>
<p>Really quick we need to prep the copper-clad to take the transfer. You simply scratch it up a bit, not gouge, just scratch. I usually wet-sand it with super-uber-fine grit sandpaper, or an abrasive sponge pad. It should be nice and shiny and dry when you are done.</p>
<p>Now we break out the Iron.</p>
<p>Turn it up to a medium temperature. I only put mine up about 1/3 of the way, too hot and it&#8217;ll smear the toner and burn the paper, no need for that.</p>
<p>Place the image on the copper-clad and line it up. Rub the iron across it holding firmly down til it starts to stick, once you have good contact you don&#8217;t need to worry about it moving around.</p>
<p>I usually put a piece of paper or two in between the iron and the transfer paper, so I can run the iron over easier. It helps diffuse both the heat and the pressure more evenly, but will slow the process down a bit.  Check every so often to see if it is transferring. Some areas like the edges might need special attention with the tip of the iron. I usually push down real hard to ensure good contact, and leave it on, moving around for a few minutes. Whatever feels right. If you mess up you can just scrape it off (re-sand as per the prep instructions), so experiment and find what works for you.</p>
<p>Once you think you&#8217;re done, remove the iron. Take the board (using hot pads or something so you don&#8217;t singe your fingers) and put it in your sink. I use it to cover the drain hole, then turn on a light stream of water.  This will make the sink fill, and let the board soak.</p>
<table border="0">
<tbody>
<tr>
<td>
<p><div id="attachment_41" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_ironed.jpg" rel="lightbox[21]"><img class="size-thumbnail wp-image-41" title="Ironed onto PCB" src="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_ironed-150x150.jpg" alt="Stuck on" width="150" height="150" /></a><p class="wp-caption-text">Stuck on</p></div></td>
<td>
<p><div id="attachment_42" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_soaking.jpg" rel="lightbox[21]"><img class="size-thumbnail wp-image-42 " title="PCB soaking" src="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_soaking-150x150.jpg" alt="Soakin' it..." width="150" height="150" /></a><p class="wp-caption-text">Soakin&#39; it...</p></div></td>
<td>
<p><div id="attachment_43" class="wp-caption alignright" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_transferred.jpg" rel="lightbox[21]"><img class="size-thumbnail wp-image-43" title="PCB Transferred" src="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_transferred-150x150.jpg" alt="Transferred" width="150" height="150" /></a><p class="wp-caption-text">Transferred</p></div></td>
</tr>
</tbody>
</table>
<p>After a while, the glossy material gets goopy and slimy and starts to come off, it can be a bit messy but it&#8217;s tolerable.</p>
<p>Once it&#8217;s pretty loose you can peel off a layer of paper&#8230; Some might stay on, it&#8217;s fine, just leave it in running water. Eventually it will lose it&#8217;s grip and just come right off, leaving (ideally) a perfect image of your PCB layout on the copper-clad.</p>
<h3>Etch</h3>
<div id="attachment_49" class="wp-caption alignright" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_etchant_and_tray.jpg" rel="lightbox[21]"><img class="size-thumbnail wp-image-49" title="PCB Etchant and Tray" src="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_etchant_and_tray-150x150.jpg" alt="Etchant and Tray" width="150" height="150" /></a><p class="wp-caption-text">Etchant and Tray</p></div>
<div id="attachment_50" class="wp-caption alignright" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_etching.jpg" rel="lightbox[21]"><img class="size-thumbnail wp-image-50" title="PCB Etching" src="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_etching-150x150.jpg" alt="Etching the PCB" width="150" height="150" /></a><p class="wp-caption-text">Etching the PCB</p></div>
<p>Now that the image is transferred on, we can start to etch. The etchant solution eats away all the copper it can react with, but the toner on there stops it from getting our pattern, the result? An etched PCB.</p>
<p>You want to use a plastic tray of some kind, something you won&#8217;t be putting food in or anything. Rinse it out and dry it, then set the PCB in there. Pour in some solution and watch it work. </p>
<p>Tip: The hotter the solution, the faster it works&#8230; Outside in the summer sun really makes it go fast.</p>
<p>Warning: Don&#8217;t do this in a closed area, breathing this is bad&#8230; Also try not to touch it, it stains quite effectively.</p>
<p>Agitate the solution as much as you can tolerate. <img src='http://veys.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  It gets kinda boring so do it off and on. Just simply lift and set down one end to slosh the solution around so fresh solution can get at the board and continue the reaction.</p>
<p>Keep an eye on the board, I use plastic tongs to take it out every so often and check it, rubber gloves also work well.  Eventually you&#8217;ll be able to see how it&#8217;s eating away the copper and your board is appearing.</p>
<p>Once you feel it&#8217;s done, flood the tray with water, be careful not to spill it, you&#8217;ll be quite unhappy if you do. I usually fill it up w/water, then pour it into a bucket. This stuff is hazardous waste, so you might want to find out where to dispose of it with whatever local agency deals w/that in your area. Once you rinse a few times to dilute the solution, take the pcb out, and run that under water for a minute or so to make absolutely sure the  chemical reaction is neutralized.</p>
<p>Once you have that out of the way, you should have something that looks like this:</p>
<table border="0">
<tbody>
<tr>
<td>
<p><div id="attachment_47" class="wp-caption alignnone" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_etched_bottom.jpg" rel="lightbox[21]"><img class="size-thumbnail wp-image-47" title="Etched PCB Bottom" src="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_etched_bottom-150x150.jpg" alt="Etched PCB, bottom" width="150" height="150" /></a><p class="wp-caption-text">Etched PCB, bottom</p></div></td>
<td>
<p><div id="attachment_48" class="wp-caption alignnone" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_etched_top.jpg" rel="lightbox[21]"><img class="size-thumbnail wp-image-48" title="Etched PCB Top" src="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_etched_top-150x150.jpg" alt="Etched PCB, top" width="150" height="150" /></a><p class="wp-caption-text">Etched PCB, top</p></div></td>
</tr>
</tbody>
</table>
<h3>Drill</h3>
<div id="attachment_45" class="wp-caption alignleft" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_drill_bits.jpg" rel="lightbox[21]"><img class="size-thumbnail wp-image-45" title="PCB Drill Bits" src="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_drill_bits-150x150.jpg" alt="Itty Bitty Bits" width="150" height="150" /></a><p class="wp-caption-text">Itty Bitty Bits</p></div>
<div id="attachment_46" class="wp-caption alignright" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_drilled_bottom.jpg" rel="lightbox[21]"><img class="size-thumbnail wp-image-46" title="PCB Drilled Bottom" src="http://www.veys.com/wp-content/uploads/2008/07/pcb_howto_drilled_bottom-150x150.jpg" alt="Completed PCB" width="150" height="150" /></a><p class="wp-caption-text">Completed PCB</p></div>
<p>Ok lets drill. I have a little set of bits I found at Hobby Lobby. They&#8217;re for crafts or something, anyway they work really well and were cheap. You can also get a Dremel bit set from hardware stores.</p>
<p>Using these with a Dremel makes this process super easy, as the Dremel is easy to handle and nimble. But a normal hand drill should work fine too. Some people even go so far as to use a Dremel with a drill press, I&#8217;ve tried it, it&#8217;s neat, but no easier than by hand.</p>
<p>Just find the bit that fits your parts, and drill away, using the holes you left in your PCB layout to guide the bit. The material making up most of the board is super soft and cuts like butter w/the drill bits. </p>
<p>Warning: Hazardous Materials! Be careful not to breathe the dust, it&#8217;s fibreglass and some of its other nasty friends, not something you want in your lungs.  Use appropriate masks/ventilation.</p>
<p>After you&#8217;re done drilling, I like to wet-sand again with super-fine sandpaper&#8230; The toner is VERY hard to get off with a simple scotch pad or other abrasive&#8230; But wet-sanding takes it right off and you have nice shiny copper underneath&#8230; Acetone (the nail polish remover kind, no need to go industrial here) will also work to remove the toner but some PCB materials may not particularly care for Acetone.</p>
<p>That&#8217;s all!  An optional final step is tinning the PCB.  Tinning puts a very thin layer of tin over the remaining copper, reducing oxidization problems you&#8217;ll get with exposed copper, and it also helps soldering a bit. You can find tinning solution from electronics shops online or in reality.</p>
]]></content:encoded>
			<wfw:commentRss>http://veys.com/2001/11/21/making-home-made-pcbs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making Home-Made IDE and Floppy Cables</title>
		<link>http://veys.com/2001/11/12/making-home-made-ide-and-floppy-cables/</link>
		<comments>http://veys.com/2001/11/12/making-home-made-ide-and-floppy-cables/#comments</comments>
		<pubDate>Tue, 13 Nov 2001 03:05:20 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[howtos]]></category>
		<category><![CDATA[cables]]></category>
		<category><![CDATA[computers]]></category>
		<category><![CDATA[diy]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[legacy articles]]></category>
		<category><![CDATA[modding]]></category>

		<guid isPermaLink="false">http://www.veys.com/blog/?p=66</guid>
		<description><![CDATA[After having an electrical tape rounding job for a while, I decided it was time to have something nice looking if I was going to window my case. I don&#8217;t really care for any of the pre-made cable solutions available so I figured why not make my own. Turns out they&#8217;re super easy, look great, [...]]]></description>
			<content:encoded><![CDATA[<p>After having an electrical tape rounding job for a while, I decided it was time to have something nice looking if I was going to window my case. I don&#8217;t really care for any of the pre-made cable solutions available so I figured why not make my own. Turns out they&#8217;re super easy, look great, and can be totally customized to fit your case!</p>
<p>First off you need to find your cable&#8230; There&#8217;s 2 kinds (probably more, that&#8217;s all I bothered looking at) you got your gray ribbon and your rainbow ribbon. Depending on the purpose you need different conductor amounts, 34 for floppy, 40 for up to ATA33, and 80 for ATA66+. There are also different spacing, .050&#8243; for Floppy and ATA33, and .025&#8243; for ATA66+. Of course you have different widths for different flavors of SCSI, etc, pick what ya need&#8230;</p>
<p>I have yet to find a decent supplier for 80-conductor .025&#8243; center ribbon. If anyone knows of any, let me know.</p>
<table style="text-align: left;" border="1" cellpadding="2">
<tbody>
<tr>
<td>Jameco #</td>
<td>Description</td>
</tr>
<tr>
<td><a href="http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&amp;storeId=10001&amp;catalogId=10001&amp;pa=643655&amp;productId=643655">643655</a></td>
<td>34-conductor flat rainbow</td>
</tr>
<tr>
<td><a href="http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&amp;storeId=10001&amp;catalogId=10001&amp;productId=644033">644033</a></td>
<td>34-conductor flat gray</td>
</tr>
<tr>
<td><span style="text-decoration: underline;"><a href="http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&amp;storeId=10001&amp;catalogId=10001&amp;productId=643697">643697</a></span></td>
<td>40-conductor flat rainbow</td>
</tr>
<tr>
<td><a href="http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&amp;storeId=10001&amp;catalogId=10001&amp;productId=644113">644113</a></td>
<td>40-conductor flat gray</td>
</tr>
</tbody>
</table>
<p style="text-align: left;">Next you need your IDC&#8217;s (insulation displacement connectors)&#8230; Pretty cut and dry, you need either 34, 40, or 80 contact ones to match the cable.</p>
<p style="text-align: left;">And again I&#8217;m still looking for the 80 contact ones. I&#8217;ve heard places like Fry&#8217;s have them, but we don&#8217;t have Fry&#8217;s out here, nor is that too useful since I usually mail order, so if someone finds them somewhere online, please let me know!</p>
<table style="text-align: left;" border="1" cellpadding="2">
<tbody>
<tr>
<td>Jameco #</td>
<td>Description</td>
</tr>
<tr>
<td>32768</td>
<td>IDC plug for 40-conductor</td>
</tr>
<tr>
<td><a href="http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&amp;storeId=10001&amp;catalogId=10001&amp;productId=32644">32644</a></td>
<td>IDC plug for 34-conductor</td>
</tr>
</tbody>
</table>
<p style="text-align: left;">And finally you need some type of crimper&#8230; You *can* use a normal table vise for this, maybe even vise grips and maybe maybe maybe maybe pliers but I wouldn&#8217;t recommend it since you&#8217;ll get uneven pressure. The best thing to do is to use IDC crimpers.</p>
<table style="text-align: left;" border="1" cellpadding="2">
<tbody>
<tr>
<td>Jameco #</td>
<td>Description</td>
</tr>
<tr>
<td><a href="http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&amp;storeId=10001&amp;catalogId=10001&amp;productId=73252">73252</a></td>
<td>Insulation Displacement Crimper</td>
</tr>
</tbody>
</table>
<p style="text-align: left;">Here are some pictures of the stuff I got&#8230;</p>
<table style="text-align: left;" border="0">
<tbody>
<tr>
<td><div id="attachment_70" class="wp-caption alignnone" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/cable_parts.jpg" rel="lightbox[66]"><img class="size-thumbnail wp-image-70" title="Cable Parts" src="http://www.veys.com/wp-content/uploads/2008/07/cable_parts-150x150.jpg" alt="Most of the stuff I used" width="150" height="150" /></a><p class="wp-caption-text">Most of the stuff I used</p></div></td>
<td><div id="attachment_69" class="wp-caption alignnone" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/cable_idc.jpg" rel="lightbox[66]"><img class="size-thumbnail wp-image-69" title="IDC Connector" src="http://www.veys.com/wp-content/uploads/2008/07/cable_idc-150x126.jpg" alt="IDC Connector (40-contact)" width="150" height="126" /></a><p class="wp-caption-text">IDC Connector (40-contact)</p></div></td>
<td><div id="attachment_68" class="wp-caption alignnone" style="width: 159px"><a href="http://www.veys.com/wp-content/uploads/2008/07/cable_crimpers.jpg" rel="lightbox[66]"><img class="size-thumbnail wp-image-68" title="IDC Crimper" src="http://www.veys.com/wp-content/uploads/2008/07/cable_crimpers-149x150.jpg" alt="IDC Crimpers" width="149" height="150" /></a><p class="wp-caption-text">IDC Crimpers</p></div></td>
</tr>
</tbody>
</table>
<p style="text-align: left;">For an IDE cable, we need not modify the cable to get it to work, but for a floppy cable we need to do a small tweak. If you want to have a 1 floppy drive cable, then you must put a twist in somewhere between the two connectors. The twist consists of wires 10-16 being swapped: 10 -&gt; 16, 11 -&gt; 15, 12 -&gt; 14. These images will provide more detail:</p>
<table style="text-align: left;" border="0">
<tbody>
<tr>
<td>
<div id="attachment_80" class="wp-caption alignnone" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/cable_flop_single_drawing.gif" rel="lightbox[66]"><img class="size-thumbnail wp-image-80" title="Single Floppy Drive Cable" src="http://www.veys.com/wp-content/uploads/2008/07/cable_flop_single_drawing-150x150.gif" alt="Single floppy drive cable" width="150" height="150" /></a><p class="wp-caption-text">Single floppy drive cable</p></div></td>
<td>
<div id="attachment_78" class="wp-caption alignnone" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/cable_flop_dual_drawing.gif" rel="lightbox[66]"><img class="size-thumbnail wp-image-78" title="Dual Floppy Drive Cable" src="http://www.veys.com/wp-content/uploads/2008/07/cable_flop_dual_drawing-150x150.gif" alt="Dual floppy drive cable" width="150" height="150" /></a><p class="wp-caption-text">Dual floppy drive cable</p></div></td>
<td>
<div id="attachment_79" class="wp-caption alignnone" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/cable_flop_single.jpg" rel="lightbox[66]"><span style="color: #000000; text-decoration: none;"><img class="size-thumbnail wp-image-79" title="Single floppy drive cable" src="http://www.veys.com/wp-content/uploads/2008/07/cable_flop_single-150x125.jpg" alt="Single floppy drive cable" width="150" height="125" /></span></a><p class="wp-caption-text">Single floppy drive cable</p></div></td>
<td>
<div id="attachment_77" class="wp-caption alignnone" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/cable_flop_dual.jpg" rel="lightbox[66]"><span style="color: #000000; text-decoration: none;"><img class="size-thumbnail wp-image-77" title="Dual floppy drive cable" src="http://www.veys.com/wp-content/uploads/2008/07/cable_flop_dual-150x127.jpg" alt="Dual floppy drive cable" width="150" height="127" /></span></a><p class="wp-caption-text">Dual floppy drive cable</p></div></td>
</tr>
</tbody>
</table>
<div id="attachment_75" class="wp-caption alignright" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/cable_barecable.jpg" rel="lightbox[66]"><img class="size-thumbnail wp-image-75" title="Bare cable" src="http://www.veys.com/wp-content/uploads/2008/07/cable_barecable-150x90.jpg" alt="Bare ribbon cable" width="150" height="90" /></a>  <br />
<p class="wp-caption-text">Bare ribbon cable</p></div>
<p>As far as the maximum length for an IDE cable goes, it would seem 18&#8243; is the max IDE/ATA spec. although I&#8217;ve seen 36&#8243; and higher work so it&#8217;s trial and error. Also it really doesn&#8217;t matter how close your two drive connectors are to each other, so just put them where you want them to be for your particular need.</p>
<p>I basically measured up the distances between my IDE connectors on my mobo and added a little for slack and to account for a bit of shortening due to rounding the cables later on. Here&#8217;s what I got for one of my IDE chains. It&#8217;s about 10&#8243; or so (the perspective is skewed a bit).</p>
<p style="text-align: left;">Now we clamp on the IDC connectors, these little guys have 80 little teeth (2 for each wire) that penetrate the insulation (displace it as it were) and make contact with the wire inside, pretty slick if you ask me, just line them up and crunch &#8216;em down.</p>
<p style="text-align: left;">Here are some pics of the cables as they were added into my case. You can even see the remnants of the electrical tape rounded cable that were being replaced.</p>
<div id="attachment_82" class="wp-caption alignright" style="width: 142px"><a href="http://www.veys.com/wp-content/uploads/2008/07/cable_partialcable.jpg" rel="lightbox[66]"><img class="size-thumbnail wp-image-82" title="Partial cable" src="http://www.veys.com/wp-content/uploads/2008/07/cable_partialcable-132x150.jpg" alt="Partially complete cable" width="132" height="150" /></a><p class="wp-caption-text">Partially complete cable</p></div>
<table style="text-align: left;" border="0">
<tbody>
<tr>
<td> </p>
<p><div id="attachment_71" class="wp-caption alignnone" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/cable_1done.jpg" rel="lightbox[66]"><img class="size-thumbnail wp-image-71" title="1 Done" src="http://www.veys.com/wp-content/uploads/2008/07/cable_1done-150x150.jpg" alt="" width="150" height="150" /></a><p class="wp-caption-text">Floppy done</p></div></td>
<td> </p>
<p><div id="attachment_72" class="wp-caption alignnone" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/cable_1doneclose.jpg" rel="lightbox[66]"><img class="size-thumbnail wp-image-72" title="Floppy (close)" src="http://www.veys.com/wp-content/uploads/2008/07/cable_1doneclose-150x150.jpg" alt="Floppy (close)" width="150" height="150" /></a><p class="wp-caption-text">Floppy (close)</p></div></td>
</tr>
<tr>
<td> </p>
<p><div id="attachment_73" class="wp-caption alignnone" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/cable_2done.jpg" rel="lightbox[66]"><img class="size-thumbnail wp-image-73" title="2 Done" src="http://www.veys.com/wp-content/uploads/2008/07/cable_2done-150x150.jpg" alt="Floppy + 1 IDE (Zip)" width="150" height="150" /></a><p class="wp-caption-text">Floppy + 1 IDE (Zip)</p></div></td>
<td> </p>
<p><div id="attachment_74" class="wp-caption alignnone" style="width: 160px"><a href="http://www.veys.com/wp-content/uploads/2008/07/cable_alldone.jpg" rel="lightbox[66]"><img class="size-thumbnail wp-image-74" title="All Done" src="http://www.veys.com/wp-content/uploads/2008/07/cable_alldone-150x150.jpg" alt="Done, 1 Floppy, 3 IDE Cables" width="150" height="150" /></a><p class="wp-caption-text">Done, 1 Floppy, 3 IDE</p></div></td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://veys.com/2001/11/12/making-home-made-ide-and-floppy-cables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  veys.com/tag/electronics/feed/ ) in 0.90920 seconds, on May 19th, 2012 at 2:36 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on May 19th, 2012 at 2:38 pm UTC -->
