- Published: Thursday, 09 April 2009
- Written by Picem
- Hits: 21744
Good starting place for anyone new to micro's.. Well not completely new, as a general knowledge of what a micro controller is and basic electronic knowledge is assumed.
Just in-case; LED's are Light Emitting Diodes - like a traditional lamp but more efficient and "cutting edge". They can only be powered when biased correctly, that is, one lead is a positive and the other is negative (also known as anode and cathode). Here's what an LED looks like in a wiring diagram;
An LED needs some sort of current limiting device in series as without it, the LED will "burn out", or be over-driven. A standard LED is generally rated for about 20mA, and depending on the forward voltage drop of the LED, well you can calculate how big the resistor should be. It's safe to say that 470 ohm or greater will be suffice for most LED's.
OK, back to the programming. I've chosen to use the ever so popular 16F628 PIC micro. It's cheap, got lots of on-board features, one of them being the internal oscillator that runs at 4Mhz. Keeping in mind that PIC's physically run at 1/4 the OSC speed, this means that with the internal oscillator setup, the PIC will run at 1Million Instructions Per Second (1 MIPS).
To turn the LED on and off in a continual loop would not even make it look like anything was happening, so a delay needs to be incorperated to "burn cycles". This amungst other program features are heaviliy commented below;
And the wiring diagram;