<?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>Beginner Micro</title>
	<atom:link href="http://beginnermicro.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://beginnermicro.com</link>
	<description></description>
	<lastBuildDate>Mon, 17 May 2010 15:32:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Check out our Breadboard Modules</title>
		<link>http://beginnermicro.com/blog/check-out-our-breadboard-modules/</link>
		<comments>http://beginnermicro.com/blog/check-out-our-breadboard-modules/#comments</comments>
		<pubDate>Mon, 17 May 2010 15:26:12 +0000</pubDate>
		<dc:creator>Rich</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[breadboard]]></category>
		<category><![CDATA[modules]]></category>

		<guid isPermaLink="false">http://beginnermicro.com/?p=1476</guid>
		<description><![CDATA[Head on over to the Beginner Micro store and check out these cool breadboard modules. These are designed to fit on your breadboard and save you tons of time prototyping your project.  Just imagine having the instant functionality of RS232 to interface your project to your PC or being able to instanly interface to the real [...]]]></description>
			<content:encoded><![CDATA[<div class="mceTemp mceIEcenter">Head on over to the <a href="http://beginnermicro.com/store/index.php?main_page=index&amp;cPath=2" target="_self">Beginner Micro store </a>and check out these cool breadboard modules. These are designed to fit on your breadboard and save you tons of time prototyping your project.  Just imagine having the instant functionality of RS232 to interface your project to your PC or being able to instanly interface to the real world with the relay module.</div>
<div class="mceTemp mceIEcenter"><a href="http://beginnermicro.com/store/index.php?main_page=index&amp;cPath=2" target="_self"><img class="aligncenter size-full wp-image-1486" title="bread-board-modules" src="http://beginnermicro.com/wp-content/uploads/2010/05/bread-board-modules.jpg" alt="" width="400" height="200" /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://beginnermicro.com/blog/check-out-our-breadboard-modules/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Beginner Micro Launches new Electronics Store</title>
		<link>http://beginnermicro.com/news/beginner-micro-launches-new-electronics-store/</link>
		<comments>http://beginnermicro.com/news/beginner-micro-launches-new-electronics-store/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 16:41:11 +0000</pubDate>
		<dc:creator>Rich</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://beginnermicro.com/?p=1470</guid>
		<description><![CDATA[We just launched our store here at Beginner Micro. Use the Products link in the main menu or just go HERE. We currently are offering several products designed to make life a little easier in the lab and several books on embedded programming by Chuck Hellebuyck. For those folks looking for a place to get [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">We just launched our store here at Beginner Micro. Use the Products link in the main menu or just go <a href="http://beginnermicro.com/store">HERE</a>. We currently are offering several products designed to make life a little easier in the lab and several books on embedded programming by Chuck Hellebuyck.</p>
<p style="text-align: center;"><a class="aligncenter" title="Beginner Micro Store" href="http://beginnermicro.com/store" target="_self"><img class="size-medium wp-image-1473  aligncenter" title="Beginner Micro Store" src="http://beginnermicro.com/wp-content/uploads/2010/04/bm-store-300x251.jpg" alt="" width="300" height="251" /></a></p>
<p>For those folks looking for a place to get started with developing electronic products, check out our starter kits that have everything you need. started.</p>
]]></content:encoded>
			<wfw:commentRss>http://beginnermicro.com/news/beginner-micro-launches-new-electronics-store/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello World for your PICKit 2</title>
		<link>http://beginnermicro.com/blog/hello-world-for-your-pickit-2/</link>
		<comments>http://beginnermicro.com/blog/hello-world-for-your-pickit-2/#comments</comments>
		<pubDate>Thu, 21 May 2009 21:02:32 +0000</pubDate>
		<dc:creator>Rich</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[C Programming]]></category>
		<category><![CDATA[PICC]]></category>
		<category><![CDATA[led]]></category>
		<category><![CDATA[pickit 2]]></category>

		<guid isPermaLink="false">http://beginnermicro.com/?p=354</guid>
		<description><![CDATA[If you need a little help getting your PicKit 2TM LED&#8217;s to blink, here&#8217;s a little program that will get you started.  You&#8217;ll see after you run it that I&#8217;ve toggled all 4 of the LED&#8217;s in two different sequences.  You can play with the different outputs and durations to get familiar with how this is [...]]]></description>
			<content:encoded><![CDATA[<p>If you need a little help getting your PicKit 2<sup>TM</sup> LED&#8217;s to blink, here&#8217;s a little program that will get you started.  You&#8217;ll see after you run it that I&#8217;ve toggled all 4 of the LED&#8217;s in two different sequences.  You can play with the different outputs and durations to get familiar with how this is done in C.  I&#8217;m using PICC Lite here so don&#8217;t forget to &#8220;include&#8221; the pic.h file into MPLAB<sup>TM</sup>, otherwise it won&#8217;t work. </p>
<p>#include &lt;pic.h&gt;<br />
 __CONFIG(FCMDIS &amp; IESODIS &amp; BORDIS &amp; UNPROTECT &amp; MCLRDIS &amp; PWRTEN &amp; WDTDIS &amp; INTIO);<br />
int i;<br />
int j;<br />
main()<br />
{<br />
PORTC = 0;<br />
TRISC0 = 0;<br />
TRISC1 = 0;<br />
TRISC2 = 0;<br />
TRISC3 = 0;<br />
 j=0;<br />
 while (j&lt;3)<br />
 {<br />
     for (i = 0; i &lt; 5500; i++);<br />
          RC0 = 0;<br />
     for (i = 0; i &lt; 5500; i++);<br />
          RC0 = 1;<br />
     for (i = 0; i &lt; 5500; i++);<br />
          RC1 = 0;<br />
     for (i = 0; i &lt; 5500; i++);<br />
          RC1 = 1;<br />
      for (i = 0; i &lt; 5500; i++);<br />
          RC2 = 0;<br />
     for (i = 0; i &lt; 5500; i++);<br />
          RC2 = 1;<br />
     for (i = 0; i &lt; 5500; i++);<br />
          RC3 = 0;<br />
     for (i = 0; i &lt; 5500; i++);<br />
          RC3 = 1;<br />
     for (i = 0; i &lt; 5500; i++);<br />
          RC2 = 0;<br />
     for (i = 0; i &lt; 5500; i++);<br />
          RC2 = 1;<br />
     for (i = 0; i &lt; 5500; i++);<br />
          RC1 = 0;<br />
     for (i = 0; i &lt; 5500; i++);<br />
          RC1 = 1;<br />
     j=j+1;<br />
 }</p>
<p>j=0;<br />
while (j&lt;5)<br />
{<br />
     for (i = 0; i &lt; 8500; i++);<br />
          PORTC=0b001001;<br />
     for (i = 0; i &lt; 8500; i++);<br />
          PORTC=0b000110;<br />
     for (i = 0; i &lt; 8500; i++);<br />
          PORTC=0b001001;<br />
     for (i = 0; i &lt; 8500; i++);<br />
          PORTC=0b000110;<br />
j=j+1;<br />
}</p>
<p>}</p>
]]></content:encoded>
			<wfw:commentRss>http://beginnermicro.com/blog/hello-world-for-your-pickit-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Timer Talk</title>
		<link>http://beginnermicro.com/articles/timer-talk/</link>
		<comments>http://beginnermicro.com/articles/timer-talk/#comments</comments>
		<pubDate>Thu, 21 May 2009 20:23:10 +0000</pubDate>
		<dc:creator>Rich</dc:creator>
				<category><![CDATA[C Programming]]></category>
		<category><![CDATA[Featured Articles]]></category>
		<category><![CDATA[CCS]]></category>
		<category><![CDATA[microchip]]></category>
		<category><![CDATA[timers]]></category>
		<category><![CDATA[tmr0]]></category>
		<category><![CDATA[tmr1]]></category>
		<category><![CDATA[tmr2]]></category>

		<guid isPermaLink="false">http://beginnermicro.com/?p=347</guid>
		<description><![CDATA[After writing about the PIC hardware PWM module it occurred to me that a little more information about the onboard timers would be in order.  Just about every PIC has a timer and many have several.  The PIC16F777 that we I used in the hardare PWM article has three of them called TMR0, TMR1, TM2 [...]]]></description>
			<content:encoded><![CDATA[<p>After writing about the PIC hardware PWM module it occurred to me that a little more information about the onboard timers would be in order.  Just about every PIC has a timer and many have several.  The PIC16F777 that we I used in the hardare PWM article has three of them called TMR0, TMR1, TM2</p>
<p>The three timers are similar to each other in many ways but are different in some respects.  Below is a list of each of the timer features from the datasheet.</p>
<p><strong>TRM0</strong></p>
<ul>
<li>8-bit timer/counter</li>
<li>Readable and writable</li>
<li>8-bit software programmable prescaler</li>
<li>Internal or external clock select</li>
<li>Interrupt on overflow from FFh to 00h</li>
<li>Edge select for external clock</li>
</ul>
<p><strong>TMR1</strong></p>
<ul>
<li>16-bit timer/counter which consists of two 8-bit registers</li>
<li>Readable and writable (TMR1H:TMR1L)</li>
<li>4-bit software programmable prescaler</li>
<li>Internal or external clock select</li>
</ul>
<p> </p>
<p><strong>TMR2</strong></p>
<ul>
<li>8-bit timer/counter</li>
<li>Readable and writable</li>
<li>4-bit software programmable prescalerInternal or external clock select</li>
<li>Prescale options include 1:1, 1:4, 1:16</li>
<li>Postcale options include 1:1, 1:2, 1:3, 1:16</li>
<li>Internal clock only</li>
<li>Output (before prescaler) is fed to the SSP module for an optional shift clock.</li>
<li>Can be set to automatically compare it to a value you determine.</li>
</ul>
<p>Each of the timers can be configured separately and can be used for different purposes within your application.  One of the nice things about these is that they run on their own in the background while your code is off doing something else.  They &#8220;tap you on the shoulder&#8221; in the form of an interrupt to remind you to go and do something.  You can also read them or reset them at any time.  These timers are essentially binary counters that start at a value you determine and keep running until you shut them off.  If you&#8217;re not familiar with a binary counter it looks much like this&#8230;</p>
<p>clock pulse 1  00000000<br />
clock pulse 2  00000001<br />
clock pulse 3  00000010<br />
clock pulse 4  00000011<br />
clock pulse 5  00000100<br />
clock pulse 6  00000101</p>
<p>and so on</p>
<p>The counter keeps increasing after every clock pulse until it &#8220;overflows&#8221;.  Overflows means that when the counter is all 1&#8242;s and another 1 is added, there is no place for the carry bit to go.  This generates and interrupt and the timer is reset to all 0&#8242;s again.</p>
<p>Now lets write a little routine that uses one of our timers to blink an LED at 1 second intervals.  We&#8217;re going to use the CCS compiler for this example and once again use the PIC16F777.  We&#8217;ll use TMR1 for this task and take I&#8217;ll take a moment to point out a couple of things before we get to coding.</p>
<p>- TMR1 counts from 0 to 65535</p>
<p>- On the next count it resets back to zero and sets a bit in the TMR1IF (Timer 1 Interupt Flag) on the PIR1 register.</p>
<p>- If we run the internal clock at 20Mhz we know that the program counter and the pulses that drive the clock are equal to 1/4 of the internal clock speed of each clock count.  That means that the TMR1 clock runs a 20Mhz/4=5Mhz.</p>
<p>- A little more math and we find that each clock pulse take 1/5Mhz seconds to comple.Â  That&#8217;s .2us for each count of TMR1</p>
<p>- Another piece we need is how long until the timer overflows.  From what we know so far it&#8217;s .2us x 65536 = 0.0131</p>
<p>- Since the last piece resulted in such a short time until overflow, we could probably use a prescaler to slow it down a bit. Using the 1:8 prescale which divides our clock we get 5Mz/8 = 625KMz which is 1.6us per count of TMR1.Â  With that we have 1.6us x 65536 = 0.104856s wich is how long it takes to overflow the clock.</p>
<p>Now, with that information we know that if it takes 0.104856s to overflow the clock.  If we let the clock overflow 10 times we will have taken up 1.04856s.  Well that&#8217;s pretty close to what we wanted but lets say we had to get that close to 1s.  What could we do?  Well, remember that TMR one is writable.  That means we can preload a value into TMR to get us a little close.  I&#8217;m not going to show all the math on this part but if you solve this equation &#8230;</p>
<p>clock cycles = (0.1s)/((20Mhz)(1/4)(1/8)) = 62500</p>
<p>You&#8217;ll see that if we could overflow the clock after 62500 cycles rather than 65536 we would have consumed exactly .10 seconds.  So the value we need to preload in is (65335-62500) = 3035.</p>
<p><strong>The code that puts it all together&#8230;</strong> </p>
<p>#include &lt;16F777.h&gt;<br />
#fuses INTRC,NOWDT,NOPROTECT<br />
#use delay(clock=2000000)<br />
unsigned int counter = 0;<br />
setup_port_b (ALL_DIGITAL);<br />
#int_timer1</p>
<p>void timer1_isr() {<br />
disable_interrupts(INT_TIMER1); //Turn off interrupts<br />
set_timer1(3035);                                 //Load preset<br />
counter = counter +1;                           //Increment Counter<br />
clear_interrupt(INT_TIMER1);<br />
enable_interrupts(INT_TIMER1);  //Enable the TMR1 Interrupt<br />
}</p>
<p>void main(void){<br />
Â SET_TRIS_B( 0&#215;00 );                       //Set Port B to all Outputs<br />
Â setup_timer_1(T1_INTERNAL|T1_DIV_BY_8);  //Timer with internal clock and 1:8 prescaler<br />
Â enable_interrupts(GLOBAL);<br />
Â enable_interrupts(INT_TIMER1);</p>
<p>test:Â <br />
if (counter == 10){<br />
Â counter = 0;                                              //Reset the counter<br />
Â OUTPUT_TOGGLE(PIN_B1);<br />
}</p>
<p>goto test; </p>
<p>} </p>
<p>We start out telling the CCS compiler which device we&#8217;re using and set some of the config bits.  We also set port B to all outputs, initalize the variable COUNTER, and declare out timer1 interrupt.  The main part of the program sets up the timer with the internal clock and the prescaler we talked about.  The interrupt is enabled and then we begin the testing of the variable COUNTER.  Remember that the TMR1 clock is running all the time now that we&#8217;ve set it up.  The test loop checks to see if we&#8217;ve overflowed it 10 times.  We know how many times it overflowed because we&#8217;ve set up an interrupt routine which increments COUNTER each time if overflows.  When COUNTER reaches ten, we toggle B1.  So with an LED and appropriately sized resister on B1 we would see the LED light up for 1s and then turn off for 1s.</p>
<p>In CCS there are simpler ways of accomplishing this task of lighting the LED for 1s on and 1s off.  We could use the delay function build into CCS to simplify our code.  We only did it this way to demonstrate how the TMR1 operates. Hopefully I&#8217;ve shed a little light into the world of PIC timers using CCS and you can feel comfortable using them in your designs.</p>
]]></content:encoded>
			<wfw:commentRss>http://beginnermicro.com/articles/timer-talk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Common Capacitor Values</title>
		<link>http://beginnermicro.com/blog/common-capacitor-values/</link>
		<comments>http://beginnermicro.com/blog/common-capacitor-values/#comments</comments>
		<pubDate>Thu, 21 May 2009 19:43:49 +0000</pubDate>
		<dc:creator>Rich</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[capacitors]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[values]]></category>

		<guid isPermaLink="false">http://beginnermicro.com/?p=342</guid>
		<description><![CDATA[It's always helpful to have a list of commonly available capacitors values handy.  If you don't see what you want here, you may have to put a couple caps in parallel to get what you want.  Here's a listing of common capacitor values for polarized, non-polarized, and surfacemount caps. ]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s always helpful to have a list of commonly available capacitors values handy.  If you don&#8217;t see what you want here, you may have to put a couple caps in parallel to get what you want.  Here&#8217;s a listing of common capacitor values for polarized, non-polarized, and surfacemount caps. </p>
<p style="text-align: center;"><strong>Non-Polarized Capacitors</strong></p>
<table border="1" align="center">
<tbody>
<tr>
<td>10pF</td>
<td>100pF</td>
<td>1000pF</td>
<td>.01uF</td>
<td>.1uF</td>
</tr>
<tr>
<td>12pF</td>
<td>120pF</td>
<td>1200pF</td>
<td>.012uF</td>
<td>.12uF</td>
</tr>
<tr>
<td>15pF</td>
<td>150pF</td>
<td>1500pF</td>
<td>.015uF</td>
<td>.15uF</td>
</tr>
<tr>
<td>18pF</td>
<td>180pF</td>
<td>.0018uF</td>
<td>.018uF</td>
<td>.18uF</td>
</tr>
<tr>
<td>22pF</td>
<td>220pF</td>
<td>.0022uF</td>
<td>.022uF</td>
<td>.22uF</td>
</tr>
<tr>
<td>27pF</td>
<td>270pF</td>
<td>.0027uF</td>
<td>.027uF</td>
<td>.27uF</td>
</tr>
<tr>
<td>33pF</td>
<td>330pF</td>
<td>.0033uF</td>
<td>.033uF</td>
<td>.33uF</td>
</tr>
<tr>
<td>39pF</td>
<td>390pF</td>
<td>.0039uF</td>
<td>.039uF</td>
<td>.39uF</td>
</tr>
<tr>
<td>47uF</td>
<td>470pF</td>
<td>.0047uF</td>
<td>.047uF</td>
<td>.47uf</td>
</tr>
<tr>
<td>56pF</td>
<td>560pF</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>68pF</td>
<td>680pF</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>82pF</td>
<td>820pF</td>
</tr>
</tbody>
</table>
<p style="text-align: center;"><strong>Polarized Capacitors</strong></p>
<p style="text-align: left;">
<table border="1" align="center">
<tbody>
<tr>
<td>1.0uF</td>
<td>10uF</td>
<td>100uF</td>
<td>1000uF</td>
</tr>
<tr>
<td>1.5uF</td>
<td>15uF</td>
<td>150uF</td>
<td>1500uF</td>
</tr>
<tr>
<td>2.2uF</td>
<td>22uF</td>
<td>220uF</td>
<td> </td>
</tr>
<tr>
<td>3.3uF</td>
<td>33uF</td>
<td>330uF</td>
<td> </td>
</tr>
<tr>
<td>4.7uF</td>
<td>47uF</td>
<td>470uF</td>
<td> </td>
</tr>
<tr>
<td>6.8uF</td>
<td>68uF</td>
<td>680uF</td>
<td> </td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://beginnermicro.com/blog/common-capacitor-values/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>14 Bit PIC Instruction Set</title>
		<link>http://beginnermicro.com/blog/14-bit-pic-instruction-set/</link>
		<comments>http://beginnermicro.com/blog/14-bit-pic-instruction-set/#comments</comments>
		<pubDate>Thu, 21 May 2009 16:52:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[devices]]></category>
		<category><![CDATA[instruction set]]></category>
		<category><![CDATA[microchip]]></category>
		<category><![CDATA[midrange]]></category>
		<category><![CDATA[opcodes]]></category>

		<guid isPermaLink="false">http://beginnermicro.com/?p=334</guid>
		<description><![CDATA[The majority of devices in the PIC12 and PIC16 Midrange devices use this instruction set. It's very similar to the 12 Bit PIC Instruction Set but the increased opcode width allows 128 registers and 2048 words of code to be directly addressed.
]]></description>
			<content:encoded><![CDATA[<p>The majority of devices in the PIC12 and PIC16 Midrange devices use this instruction set. It&#8217;s very similar to the 12 Bit PIC Instruction Set but the increased opcode width allows 128 registers and 2048 words of code to be directly addressed.</p>
<table border="1">
<tbody>
<tr>
<th>Opcode (binary)</th>
<th>Mnemonic</th>
<th>Description</th>
</tr>
<tr>
<td><code>00 0000 0000 0000</code></td>
<td>NOP</td>
<td>No operation</td>
</tr>
<tr>
<td><code>00 0000 0000 1000</code></td>
<td>RETURN</td>
<td>Return from subroutine, W unchanged</td>
</tr>
<tr>
<td><code>00 0000 0000 1001</code></td>
<td>RETFIE</td>
<td>Return from interrupt</td>
</tr>
<tr>
<td><code>00 0000 0110 0010</code></td>
<td>OPTION</td>
<td>Write W to OPTION register</td>
</tr>
<tr>
<td><code>00 0000 0110 0011</code></td>
<td>SLEEP</td>
<td>Go into standby mode</td>
</tr>
<tr>
<td><code>00 0000 0110 0100</code></td>
<td>CLRWDT</td>
<td>Reset watchdog timer</td>
</tr>
<tr>
<td><code>00 0000 0110 01ff</code></td>
<td>TRIS f</td>
<td>Write W to tristate register f</td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td><code>00 0000 1 fffffff</code></td>
<td>MOVWF f</td>
<td>Move W to f</td>
</tr>
<tr>
<td><code>00 0001 0 xxxxxxx</code></td>
<td>CLRW</td>
<td>Clear W to 0 (W = 0)</td>
</tr>
<tr>
<td><code>00 0001 1 fffffff</code></td>
<td>CLRF f</td>
<td>Clear f to 0 (f = 0)</td>
</tr>
<tr>
<td><code>00 0010 d fffffff</code></td>
<td>SUBWF f,d</td>
<td>Subtract W from f (d = f − W)</td>
</tr>
<tr>
<td><code>00 0011 d fffffff</code></td>
<td>DECF f,d</td>
<td>Decrement f (d = f − 1)</td>
</tr>
<tr>
<td><code>00 0100 d fffffff</code></td>
<td>IORWF f,d</td>
<td>Inclusive OR W with F (d = f OR W)</td>
</tr>
<tr>
<td><code>00 0101 d fffffff</code></td>
<td>ANDWF f,d</td>
<td>AND W with F (d = f AND W)</td>
</tr>
<tr>
<td><code>00 0110 d fffffff</code></td>
<td>XORWF f,d</td>
<td>Exclusive OR W with F (d = f XOR W)</td>
</tr>
<tr>
<td><code>00 0111 d fffffff</code></td>
<td>ADDWF f,d</td>
<td>Add W with F (d = f + W)</td>
</tr>
<tr>
<td><code>00 1000 d fffffff</code></td>
<td>MOVF f,d</td>
<td>Move F (d = f)</td>
</tr>
<tr>
<td><code>00 1001 d fffffff</code></td>
<td>COMF f,d</td>
<td>Complement f (d = NOT f)</td>
</tr>
<tr>
<td><code>00 1010 d fffffff</code></td>
<td>INCF f,d</td>
<td>Increment f (d = f + 1)</td>
</tr>
<tr>
<td><code>00 1011 d fffffff</code></td>
<td>DECFSZ f,d</td>
<td>Decrement f (d = f − 1) and skip if zero</td>
</tr>
<tr>
<td><code>00 1100 d fffffff</code></td>
<td>RRF f,d</td>
<td>Rotate right F (rotate right through carry)</td>
</tr>
<tr>
<td><code>00 1101 d fffffff</code></td>
<td>RLF f,d</td>
<td>Rotate left F (rotate left through carry)</td>
</tr>
<tr>
<td><code>00 1110 d fffffff</code></td>
<td>SWAPF f,d</td>
<td>Swap 4-bit halves of f (d = f&lt;&lt;4 | f&gt;&gt;4)</td>
</tr>
<tr>
<td><code>00 1111 d fffffff</code></td>
<td>INCFSZ f,d</td>
<td>Increment f (d = f + 1) and skip if zero</td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td><code>01 00 bbb fffffff</code></td>
<td>BCF f,b</td>
<td>Bit clear f (Clear bit b of f)</td>
</tr>
<tr>
<td><code>01 01 bbb fffffff</code></td>
<td>BSF f,b</td>
<td>Bit set f (Set bit b of f)</td>
</tr>
<tr>
<td><code>01 10 bbb fffffff</code></td>
<td>BTFSC f,b</td>
<td>Bit test f, skip if clear (Test bit b of f)</td>
</tr>
<tr>
<td><code>01 11 bbb fffffff</code></td>
<td>BTFSS f,b</td>
<td>Bit test f, skip if set (Test bit b of f)</td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td><code>10 0 kkkkkkkkkkk</code></td>
<td>CALL k</td>
<td>Save return address, load PC with k</td>
</tr>
<tr>
<td><code>10 1 kkkkkkkkkkk</code></td>
<td>GOTO k</td>
<td>Jump to address k (11 bits)</td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td><code>11 00xx kkkkkkkk</code></td>
<td>MOVLW k</td>
<td>Move literal to W (W = k)</td>
</tr>
<tr>
<td><code>11 01xx kkkkkkkk</code></td>
<td>RETLW k</td>
<td>Set W to k and return</td>
</tr>
<tr>
<td><code>11 1000 kkkkkkkk</code></td>
<td>IORLW k</td>
<td>Inclusive or literal with W (W = k OR W)</td>
</tr>
<tr>
<td><code>11 1001 kkkkkkkk</code></td>
<td>ANDLW k</td>
<td>AND literal with W (W = k AND W)</td>
</tr>
<tr>
<td><code>11 1010 kkkkkkkk</code></td>
<td>XORLW k</td>
<td>Exclusive or literal with W (W = k XOR W)</td>
</tr>
<tr>
<td><code>11 110x kkkkkkkk</code></td>
<td>SUBLW k</td>
<td>Subtract W from literal (W = k − W)</td>
</tr>
<tr>
<td><code>11 111x kkkkkkkk</code></td>
<td>ADDLW k</td>
<td>Add literal to W (W = k + W)</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://beginnermicro.com/blog/14-bit-pic-instruction-set/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>12 Bit PIC Instruction Set</title>
		<link>http://beginnermicro.com/blog/12-bit-pic-instruction-set/</link>
		<comments>http://beginnermicro.com/blog/12-bit-pic-instruction-set/#comments</comments>
		<pubDate>Thu, 21 May 2009 16:32:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[asm]]></category>
		<category><![CDATA[assembly]]></category>
		<category><![CDATA[instruction set]]></category>
		<category><![CDATA[microchip]]></category>
		<category><![CDATA[PIC]]></category>

		<guid isPermaLink="false">http://beginnermicro.com/?p=324</guid>
		<description><![CDATA[Here's the instruction set for Microchip's Baseline devices.  These include the PIC10 series as well as some of the PIC12 and PIC16.]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s the instruction set for Microchip&#8217;s Baseline devices.  These include the PIC10 series as well as some of the PIC12 and PIC16.</p>
<table border="1">
<tbody>
<tr>
<th>Opcode (binary)</th>
<th>Mnemonic</th>
<th>Description</th>
</tr>
<tr>
<td><code>0000 0000 0000</code></td>
<td>NOP</td>
<td>No operation</td>
</tr>
<tr>
<td><code>0000 0000 0010</code></td>
<td>OPTION</td>
<td>Load OPTION register with contents of W</td>
</tr>
<tr>
<td><code>0000 0000 0011</code></td>
<td>SLEEP</td>
<td>Go into standby mode</td>
</tr>
<tr>
<td><code>0000 0000 0100</code></td>
<td>CLRWDT</td>
<td>Reset watchdog timer</td>
</tr>
<tr>
<td><code>0000 0000 01ff</code></td>
<td>TRIS f</td>
<td>Move W to port control register (f=1..3)</td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td><code>0000 001 fffff</code></td>
<td>MOVWF f</td>
<td>Move W to f</td>
</tr>
<tr>
<td><code>0000 010 xxxxx</code></td>
<td>CLRW</td>
<td>Clear W to 0 (a.k.a CLR x,W)</td>
</tr>
<tr>
<td><code>0000 011 fffff</code></td>
<td>CLRF f</td>
<td>Clear f to 0 (a.k.a. CLR f,F)</td>
</tr>
<tr>
<td><code>0000 10d fffff</code></td>
<td>SUBWF f,d</td>
<td>Subtract W from f (d = f − W)</td>
</tr>
<tr>
<td><code>0000 11d fffff</code></td>
<td>DECF f,d</td>
<td>Decrement f (d = f − 1)</td>
</tr>
<tr>
<td><code>0001 00d fffff</code></td>
<td>IORWF f,d</td>
<td>Inclusive OR W with F (d = f OR W)</td>
</tr>
<tr>
<td><code>0001 01d fffff</code></td>
<td>ANDWF f,d</td>
<td>AND W with F (d = f AND W)</td>
</tr>
<tr>
<td><code>0001 10d fffff</code></td>
<td>XORWF f,d</td>
<td>Exclusive OR W with F (d = f XOR W)</td>
</tr>
<tr>
<td><code>0001 11d fffff</code></td>
<td>ADDWF f,d</td>
<td>Add W with F (d = f + W)</td>
</tr>
<tr>
<td><code>0010 00d fffff</code></td>
<td>MOVF f,d</td>
<td>Move F (d = f)</td>
</tr>
<tr>
<td><code>0010 01d fffff</code></td>
<td>COMF f,d</td>
<td>Complement f (d = NOT f)</td>
</tr>
<tr>
<td><code>0010 10d fffff</code></td>
<td>INCF f,d</td>
<td>Increment f (d = f + 1)</td>
</tr>
<tr>
<td><code>0010 11d fffff</code></td>
<td>DECFSZ f,d</td>
<td>Decrement f (d = f − 1) and skip if zero</td>
</tr>
<tr>
<td><code>0011 00d fffff</code></td>
<td>RRF f,d</td>
<td>Rotate right F (rotate right through carry)</td>
</tr>
<tr>
<td><code>0011 01d fffff</code></td>
<td>RLF f,d</td>
<td>Rotate left F (rotate left through carry)</td>
</tr>
<tr>
<td><code>0011 10d fffff</code></td>
<td>SWAPF f,d</td>
<td>Swap 4-bit halves of f (d = f&lt;&lt;4 | f&gt;&gt;4)</td>
</tr>
<tr>
<td><code>0011 11d fffff</code></td>
<td>INCFSZ f,d</td>
<td>Increment f (d = f + 1) and skip if zero</td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td><code>0100 bbb fffff</code></td>
<td>BCF f,b</td>
<td>Bit clear f (Clear bit b of f)</td>
</tr>
<tr>
<td><code>0101 bbb fffff</code></td>
<td>BSF f,b</td>
<td>Bit set f (Set bit b of f)</td>
</tr>
<tr>
<td><code>0110 bbb fffff</code></td>
<td>BTFSC f,b</td>
<td>Bit test f, skip if clear (Test bit b of f)</td>
</tr>
<tr>
<td><code>0111 bbb fffff</code></td>
<td>BTFSS f,b</td>
<td>Bit test f, skip if set (Test bit b of f)</td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td><code>1000 kkkkkkkk</code></td>
<td>RETLW k</td>
<td>Set W to k and return</td>
</tr>
<tr>
<td><code>1001 kkkkkkkk</code></td>
<td>CALL k</td>
<td>Save return address, load PC with k</td>
</tr>
<tr>
<td><code>101 kkkkkkkkk</code></td>
<td>GOTO k</td>
<td>Jump to address k (9 bits!)</td>
</tr>
<tr>
<td><code>1100 kkkkkkkk</code></td>
<td>MOVLW k</td>
<td>Move literal to W (W = k)</td>
</tr>
<tr>
<td><code>1101 kkkkkkkk</code></td>
<td>IORLW k</td>
<td>Inclusive or literal with W (W = k OR W)</td>
</tr>
<tr>
<td><code>1110 kkkkkkkk</code></td>
<td>ANDLW k</td>
<td>AND literal with W (W = k AND W)</td>
</tr>
<tr>
<td><code>1111 kkkkkkkk</code></td>
<td>XORLW k</td>
<td>Exclusive or literal with W (W = k XOR W)</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://beginnermicro.com/blog/12-bit-pic-instruction-set/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Resistor Color Code Software</title>
		<link>http://beginnermicro.com/blog/resistor-color-code-software/</link>
		<comments>http://beginnermicro.com/blog/resistor-color-code-software/#comments</comments>
		<pubDate>Thu, 21 May 2009 15:36:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[resistors]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://beginnermicro.com/?p=318</guid>
		<description><![CDATA[There are three different types of resistor color coding.  They vary by providing different information in a different number of color bands.  I&#8217;ve looked around for a decent chart that I could share and stumbled upon this freeware.  It&#8217;s provided by moyerelectronics.com.  I&#8217;ve installed it and played with it and found it to be accurate.   Here&#8217;s a screenshot [...]]]></description>
			<content:encoded><![CDATA[<p>There are three different types of resistor color coding.  They vary by providing different information in a different number of color bands.  I&#8217;ve looked around for a decent chart that I could share and stumbled upon this freeware.  It&#8217;s provided by <a title="Moyer Electronics" href="http://moyerelectronics.com" target="_blank">moyerelectronics.com</a>.  I&#8217;ve installed it and played with it and found it to be accurate.   Here&#8217;s a screenshot and a download link.</p>
<p><a href="http://beginnermicro.com/wp-content/uploads/2009/05/resistor-color-code-screenshot.jpg"><img class="aligncenter size-full wp-image-319" title="Resistor Color Code" src="http://beginnermicro.com/wp-content/uploads/2009/05/resistor-color-code-screenshot.jpg" alt="Resistor Color Code" width="514" height="480" /></a></p>
<p><a href="http://beginnermicro.com/wp-content/uploads/2009/05/resistorcolorcode24.zip">resistorcolorcode24</a></p>
<p>Create a folder, and extract the contents of the zip file into it.  Double click the setup.exe file and you&#8217;re all set.</p>
]]></content:encoded>
			<wfw:commentRss>http://beginnermicro.com/blog/resistor-color-code-software/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RS232 Interface Module Project</title>
		<link>http://beginnermicro.com/articles/rs232-interface-module-project/</link>
		<comments>http://beginnermicro.com/articles/rs232-interface-module-project/#comments</comments>
		<pubDate>Thu, 21 May 2009 14:00:05 +0000</pubDate>
		<dc:creator>Chuck</dc:creator>
				<category><![CDATA[Featured Articles]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[pc]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[rs232]]></category>

		<guid isPermaLink="false">http://beginnermicro.com/?p=297</guid>
		<description><![CDATA[ There are times when you want to connect your microcontroller project to a PC. By sending data as serial information using the RS232 communication format you can talk to a terminal program on the computer such as hyperterminal. This project shows you how to build a simple interface module to connect you microcontroller to a [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;"> There are times when you want to connect your microcontroller project to a PC. By sending data as serial information using the RS232 communication format you can talk to a terminal program on the computer such as hyperterminal. This project shows you how to build a simple interface module to connect you microcontroller to a PC serial port. The MAX232 circuit can be built into a module to make the connection from PIC to PC very easy.</p>
<p> <a href="http://beginnermicro.com/wp-content/uploads/2009/05/rs232modulepc.jpg"><img class="alignnone size-full wp-image-295" title="rs232modulepc" src="http://beginnermicro.com/wp-content/uploads/2009/05/rs232modulepc.jpg" alt="rs232modulepc" width="600" height="391" /></a></p>
<p><strong>Circuit Board<br />
</strong>The circuit board can be made with any of the freeware PCB software programs such as expresspcb.com. Just copy the layout below. The traces can all fit on the bottom side of the board.</p>
<p style="TEXT-ALIGN: center"><img class="size-full wp-image-296    aligncenter" title="rs232pcb" src="http://beginnermicro.com/wp-content/uploads/2009/05/rs232pcb.jpg" alt="rs232pcb" width="288" height="385" /></p>
<p><a href="http://beginnermicro.com/wp-content/uploads/2009/05/maximic.jpg"></a>  The parts list is short and most of these parts are available from various<br />
sources such as jameco.com or digikey.com.</p>
<p><strong>Parts List<br />
</strong>U3 &#8211; MAX232N Serial Chip<br />
C1, C2, C3, C4 – 1uf 100v Electrolytic Capacitor<br />
J1 – DB9 9-pin D-Sub connector<br />
5 pin, SIP header<br />
2 pin, SIP header<br />
RS232 Circuit Board</p>
<p><strong>Assembly Instructions</strong><br />
1. Insert C1, C2 C3 and C4 into the board as shown below and solder in place.</p>
<p style="TEXT-ALIGN: center" align="left"><a href="http://beginnermicro.com/wp-content/uploads/2009/05/rs232cap.jpg"><img class="size-full wp-image-298   aligncenter" title="rs232cap" src="http://beginnermicro.com/wp-content/uploads/2009/05/rs232cap.jpg" alt="rs232cap" width="161" height="225" /></a></p>
<p>2. Insert J1 9 pin DB9 connector and solder leads in place.</p>
<p>3. Insert the 16 pin socket. Make sure the “U” shape in the top of the socket lines up with the tiny “u” in the circuit board outline. Per the drawing below. Solder the leads in place. Insert the 16 pin MAX232 chip in place<br />
making sure the “u” lines up per the picture below.</p>
<p><a href="http://beginnermicro.com/wp-content/uploads/2009/05/maximic.jpg"><img class="aligncenter size-full wp-image-299" title="maximic" src="http://beginnermicro.com/wp-content/uploads/2009/05/maximic.jpg" alt="maximic" width="290" height="267" /></a></p>
<p><a href="http://beginnermicro.com/wp-content/uploads/2009/05/maximic.jpg"></a></p>
<p>4. Insert the 5 pin SIP header at the end of the board and solder<br />
5. Insert the 2 pin header at the side of the board and solder.</p>
<p>Now you are ready to connect your PIC to your PC.</p>
]]></content:encoded>
			<wfw:commentRss>http://beginnermicro.com/articles/rs232-interface-module-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LED Tutorial</title>
		<link>http://beginnermicro.com/articles/led-tutorial/</link>
		<comments>http://beginnermicro.com/articles/led-tutorial/#comments</comments>
		<pubDate>Thu, 21 May 2009 13:27:46 +0000</pubDate>
		<dc:creator>Rich</dc:creator>
				<category><![CDATA[Featured Articles]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[current]]></category>
		<category><![CDATA[diode]]></category>
		<category><![CDATA[led]]></category>
		<category><![CDATA[micro]]></category>

		<guid isPermaLink="false">http://beginnermicro.com/?p=288</guid>
		<description><![CDATA[As I was trying to think of a topic to write on this week, I noticed my ten year old son was playing on my bench trying to light up an LED with a battery.  I was mildly entertained as he would smile when the light came on and then frown when it would turn [...]]]></description>
			<content:encoded><![CDATA[<p>As I was trying to think of a topic to write on this week, I noticed my ten year old son was playing on my bench trying to light up an LED with a battery.  I was mildly entertained as he would smile when the light came on and then frown when it would turn off.  “What happened?” he would say.  I let him continue for a little while until I realized he was quickly working his way through my inventory of red LED’s.  What my son didn’t realize is that he was either connecting them backwards and/or not properly limiting the current to the LED in which case he was burning them out.  So yes, an idea on what to write about was born.</p>
<p>As with most things that we set out to do, we need to understand the components that we’re working with.  We don’t need to become an expert on LED’s to use one but some basic understanding is helpful.  A good place to start with understanding an electrical component is the datasheet.  A popular LED is the red 4mm leaded package so we’ll work with that one.</p>
<p>Before we get started, it’s important to point out that an LED is a Light Emitting Diode.  This means that it is essentially a diode that lights up.  And with diodes we know that current can only flow in one direction, that is, the direction the diode is pointing.  If you turn it around, no current will flow, and it will not light up.  When it’s used in its proper orientation, it will pass current, have a voltage drop, and give off light.</p>
<p>The first thing you’ll see in the datasheet is the package drawing.  This is, of course, helpful in giving you a feel for the size of the key features of the component but I’d also like you to notice the leads.  LED’s have two leads called the Anode and the Cathode.  The Anode is the positive terminal and the Cathode is the negative terminal.  The longer lead is the Anode.  This will help you to properly insert your LED into your breadboard or PCB with the correct polarity.</p>
<p style="text-align: center;"> </p>
<p style="text-align: center;"> </p>
<p style="text-align: center;"><a href="http://beginnermicro.com/wp-content/uploads/2009/05/led-drawing-color.jpg"><img class="size-full wp-image-279 aligncenter" title="led-drawing-color" src="http://beginnermicro.com/wp-content/uploads/2009/05/led-drawing-color.jpg" alt="led-drawing-color" width="171" height="228" /></a></p>
<p>Another feature of the package is that when you look at the LED from the top, you’ll notice there’s a flat side which corresponds with the shorter lead or Cathode.  The schematic for an LED is shown below.  Sometimes an LED schematic symbol will be circled but I’m showing the default symbol used in PCB Express Schematic.</p>
<p style="text-align: center;"><a href="http://beginnermicro.com/wp-content/uploads/2009/05/led-symbol.jpg"><img class="size-full wp-image-280 aligncenter" title="led-symbol" src="http://beginnermicro.com/wp-content/uploads/2009/05/led-symbol.jpg" alt="led-symbol" width="68" height="45" /></a></p>
<p>I’m not going to go into such topics as Luminous Intensity and Wavelengths in this tutorial but may discuss it in a future article.   It’s not that these topics aren’t important, it’s just that my goal here is to get you up and running.  With that said, lets move on to sizing your current limiting resistor.</p>
<p>What’s a current limiting resistor?  Well, it’s the resistor in the small circuit shown below.</p>
<p style="text-align: center;"><a href="http://beginnermicro.com/wp-content/uploads/2009/05/diode-circuit.jpg"><img class="size-full wp-image-277 aligncenter" title="diode-circuit" src="http://beginnermicro.com/wp-content/uploads/2009/05/diode-circuit.jpg" alt="diode-circuit" width="121" height="77" /></a></p>
<p style="text-align: left;">Its purpose is to “limit” the current in the circuit so that the LED is fed the proper level for operation.  So how does it do that?  Let’s take a look at this equation referred to as Ohm’s Law.</p>
<p>V = IxR</p>
<p>V = Voltage expressed in Volts<br />
I = Current expressed in Amps<br />
R = Resistance expressed in  Ohms</p>
<p>A slight modification to this equation results in the expression …</p>
<p>R = V / I</p>
<p>So if you know the voltage and the desired current, you can calculate the resistance needed to make that happen.</p>
<p>So how do I know what V and I are?  Well, let’s go back to the datasheet.  You should see a chart similar to the one below.</p>
<p style="text-align: center;"><a href="http://beginnermicro.com/wp-content/uploads/2009/05/diode-chart.jpg"><img class="size-full wp-image-276 aligncenter" title="diode-chart" src="http://beginnermicro.com/wp-content/uploads/2009/05/diode-chart.jpg" alt="diode-chart" width="204" height="228" /></a></p>
<p style="text-align: center;">This chart shows the LED’s characteristic relationship between Forward Voltage and Forward Current.  These two values are exactly what we’re looking for.  This not only shows the operating range of current and voltage but shows how one affects the other.</p>
<p>One good practice when picking values is to pick values near the middle of the range.  This will give you a nice safety margin on both sides.   Let’s go back to our LED circuit for a moment.  This time, I’ve declared what my battery voltage is.  You need to know what this is going to be to select an appropriate resistor.  For our circuit, we have selected 5 Volts for the battery.</p>
<p style="text-align: center;"><a href="http://beginnermicro.com/wp-content/uploads/2009/05/diode-circuit.jpg"><img class="size-full wp-image-277 aligncenter" title="diode-circuit" src="http://beginnermicro.com/wp-content/uploads/2009/05/diode-circuit.jpg" alt="diode-circuit" width="121" height="77" /></a></p>
<p>Now keep in mind that your circuit may not look exactly like this one.  Yours may look like the one below.</p>
<p style="text-align: center;"><a href="http://beginnermicro.com/wp-content/uploads/2009/05/diode-pic-circuit.jpg"><img class="size-full wp-image-278 aligncenter" title="diode-pic-circuit" src="http://beginnermicro.com/wp-content/uploads/2009/05/diode-pic-circuit.jpg" alt="diode-pic-circuit" width="112" height="190" /></a></p>
<p style="text-align: left;">If your output pins on your PIC are running at 5 volts then your circuit is essentially the same as the one with the battery.  If we’re talking about a PIC though, I know one more piece of information which is important.  I know that the max current we should have is 20mA.  This is the datasheet max for PIC devices.  If we go beyond this value for too long, our PIC can get a little toasty.</p>
<p>So after we know our voltage we know all the following…</p>
<p>-    Our source voltage is 5 Volts<br />
-    Our max current is 20 mA<br />
-    The resistor will have a current drop<br />
-    Our LED will have a voltage drop<br />
-    I know that the sum of the drop of the Voltage across the Resistor and the LED will equal 5 Volts.</p>
<p>Let’s go back to our LED Datasheet chart above.  If I pick a value in the middle of the range, say 2 Volts, what is our current (I)?  I’m seeing about 8mA which is well within our max of 20mA.</p>
<p>So, with a voltage drop across the LED of 2 volts that gives us a voltage drop across the resistor of 3V (5 V – 2 V = 3V).  Now we can use our equation for Ohms Law to calculate the value of the resistor that will give is a 3 V drop.</p>
<p>R = V /  I<br />
R = 3 V/  8 mA<br />
R =  375 Ohms</p>
<p>So what we’re looking for is a 375 Ohm resistor, which I can tell you without even looking that it doesn’t exist.  What we need to do is find the closest value that does exist and recalculate our values to make sure we don’t exceed our requirements.</p>
<p>The closest standard resistor value to 375 Ohms is 360 Ohms for a ¼ Watt 5% tolerance resistor.  Let’s recalculate using that value and make sure our current is within our operating range.</p>
<p>I = V / R<br />
I = 3 / 360<br />
I  = 8.33ma (Good)</p>
<p>Even though I’m pretty sure we’re OK, let’s go ahead and calculate the power that will be consumed by the Resistor in the circuit.  The equation for that is…</p>
<p>P = VxI<br />
P = 3V x 8.33mA<br />
P = 0.025 W (Good since limit is 0.25)</p>
<p>Now keep in mind that that if you consistently use the same power source and similar PIC’s, you don’t need to recalculate this every time.  Just use the same type of LED for most of your projects and buy a bag of resistors of the appropriate value.</p>
<p>I tried to explain all this stuff to my son after he systematically worked through a chunk of my red LED’s.  He nodded and smiled as I worked through the math but clearly he just wanted me to tell him what resistor to use.  I handed him a bag of 360 Ohm resistors and went on my way.</p>
]]></content:encoded>
			<wfw:commentRss>http://beginnermicro.com/articles/led-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
