Introduction: Intro to PIC Microcontrollers

Picture of Intro to PIC Microcontrollers

a minimum of what you need to get started programming PIC micros for use in electronics projects (robotics, etc)

Step 1: What You Need for the Project

Picture of What You Need for the Project

NOTE: seems like if you have windows XP, there is no free PIC programmer software that can download code to your PIC throught the serial port. This meens you will have to buy or make a more expensive USB programmer circuit. If you have DOS on windows 95, the stuff below will work.

Look at the list of stuff you need below. Then look at the picture I made below. It has everything on it you need to get started with Pic micros. You can see how to make a simple circuit with the PIC and an LED, you can see code for a simple program, and you can see instructions on how to put the code onto your PIC. Once the code is downloaded onto your PIC, put your PIC back into the LED circuit, give it power, and watch the LED blink, whee!

Also, download the It contains a more detailed picture.

==========Stuff used in this project:==========
(I am in no way saying you have to buy the things below, they just happen to be what I used when I started with PICs)

a PIC16F877
This is a PIC microcontroller. It's a mini-computer.

a PIC-PG2B JDM programmer
This is a circuit board which interfaces your computer to your PIC so you can program it (I bought one off ebay for around $15).

This is the compiler used in this demo to (similar to Basic language) program the PIC.
You could also use the -free- PICClite compiler (similar to C language).
You could also use a free assembly language compiler (assembly language is annoying).

This program allows you to download your code to the PIC.

USB to Serial Adapter
If you're using windowsXP you'll probably have problems using your serial ports (I did). A USB to serial converter (I have the 'Aten USB to Serial Adapter') may help.

one LED

one 4mhz chrystal oscillator

two 22pf capacitors

one 4.7k resistor

one 470 ohm resistor

one 5v power supply

Here's a Great PIC Intro Book


jasshopper (author)2014-10-04

can i use a PIC instead of atmega MCs in arduino?

Tbus (author)2014-02-05

Thank you for the PIC project. I am taking a home-study Into to Microcontrollers course ( and it's nice to know a lot of what I'm learning can be applied here and in other instructable projects!

goldenshuttle (author)2012-04-26

I need a 5 PICs each that is programmed to give randon ( or psuedo random) movement to 4 small servo's. I am uing to built a turtle prop. I can build electronic circuits and do soldeing, but I do not know PIC programming. Please anyone can program and send me these PIC's together with the schematic to make it work, I will pay for it. and Many thanks for reading.

VIRON (author)2006-08-05

This looks interesting...
But windows just keeps getting sicker and less useful.
I'm searching for a technical bootable-linux-CDROM-distro. For free, of course!

leevonk (author)VIRON2006-10-30

puppy linux, look it up. You don't even need a hard drive. Check out the instructions on the website for how to install it etc, it's very very easy but they have great animated instructions. I put it on a cd, rebooted the computer (after changing the bios settings) and it worked beautifully.

Win7Maniac (author)leevonk2009-10-04

Running from a live CD is a lot slower, though, and if you only have 1 CD drive (like me), you can't use CDs or DVDs. I love linux, though.

roland985 (author)Win7Maniac2010-05-06

Puppy Linux boots to ram, so the apps start up lighting fast, and you can take the CD out. Try it, you will be surprised...

Win7Maniac (author)roland9852010-05-07

Cool, I will definitely try it out!

roland985 (author)Win7Maniac2010-05-07

Let me know how it goes...

mattameo213 (author)leevonk2008-08-07

I like to use Suse linux with KDE. Its a little harder to get customized but has a lot of power.

omnibot (author)VIRON2009-10-14

For Linux there is <a href="">PikLab</a>.<br />

Win7Maniac (author)2009-10-04

What does the 4MhZ crystal do? Does it set the frequency for the controller? I've seen this used in many platforms, such as Arduino (except 16MhZ), but I don't know what it does.

12V (author)2009-08-13

i used a velleman k8048 and it works on xp with out paid software.

dude6657455 (author)2009-04-08

could you buy these at radio shack?

lasermaster3531 (author)leevonk2009-05-04

does anyone know about an open source pic programmer that will run on vista? will this one? thanks for the info in advance.

yourcat (author)2009-01-28

I think the PICAXE programming software can also do PICs, and that's free.

FlyByPC (author)2009-01-03

If you use a newer microcontroller (the direct replacement would be the 16F887), you don't need the resonator unless you want to run at more than 8MHz. A 12F683 is great for small (4-I/O, 1-input) projects. There are several WinXP-compatible PIC programmer applications. If you do go the USB route, spend a little more and get an In-Circuit Debugger; it can work directly with MPLab, and can both program and debug instruction-by-instruction.

Oldrunk (author)2008-12-25

There is free windows PIC programmer software called WinPIC for flashing the PIC with just about any programmer and a number of OpenSource compilers for C and Basic that work under windows and can be used with MPLAB IDE

collard41 (author)2008-06-29

its quite funny that you mention the PIC (personal introductory course) book, my friend wrote it.

deviance (author)2007-11-08

I still find this stuff somewhat confusing. After going through a lot of websites I'm going to attempt to make a programmer and buy some chips. Hopefully they're the right ones. While I do appreciate the effort I wish someone would write a Pic Programming Instructable for the complete newb including some exact part numbers of a chip to start with, a step-by-step guide for hookup, writing code, sending code to the chip and then hooking the chip up to a breadboard to test it... and maybe some simple code for an LED flasher with a walkthrough of what the lines of code mean. No I don't want someone writing projects for me as I fully intend on learning assembly language once I get my programmer working but a simple example would be a great start.

emilk (author)deviance2008-03-02
here is some pic asm tutorials to get you started. if you hawe some other chip then you only hawe to change som file registers according to data sheets.

numeroprime (author)deviance2008-02-14

Not that I like radio shack but they sell a complete pic programming kit with chips etc for about $80, there are also many online sites that do the same. it may help and avoid aggravation.

leevonk (author)deviance2007-11-08

everything you're asking for is on the next page: exact part number of the PIC and the programmer I used hook-up diagram (if you have any knowledge of breadboard this should be very easy to implement) code how to program the PIC via DOS At the time I when I wrote this instructable I didn't know of any easy, standard way to program PICs from a windows environment, I was using DOS, which most people don't have access to anymore. But I recently bought a cheap programmer (PicKit from mplabs) that makes programming PIC easy from windows, I'll add instructions on how to use it. I'll also put assembly code of the blink program on there, although this should be pretty easy to find on the web. assembly is a major major major pain in the ass, it's well worth the money/effort to get PICBasic or another higher level language compiler.

deviance (author)leevonk2007-11-09

Thanks! Sorry for all the
newb' questions but what can I say, Imanewbie at this stuff =) Appreciate the input and will let ya know how my 'first attempt' goes ;)

deviance (author)deviance2007-11-08

This is the programmer I'm going to try building.

TheMadScientist (author)2007-11-09

sorry for the odd question, but is that reprogrammable? i've been so confused by these things lately, some being OTP or one time programmable, and others not. and the difference seems to be weather they have a screen to let UV light in or not. that chip seems to not have that screen, can someone correct me if i'm mistaken?

leevonk (author)TheMadScientist2007-11-09

yeah it's reprogrammable, any of the chips with 'flash' memory (go to and look at their PIC lists, for instance the 40 pin 16-bit list: are reprogramable

TheMadScientist (author)leevonk2007-11-10

ohhhh, I get it... man it sucks to lack buy online capability... i'm trying to get by with chips that have ROM or EEPROM normally, but can access external memory banks...

No need! Most major chip vendors will send you free samples. Try it out! Also, google for LadyAda's website. She has a fabulous guide on getting silicon stuff for free, and a review of most major vendors who give out samples.

WilderLust (author)2007-10-31

if you look at the first pic you can see the PIC16F877 right on it... that is how you will id chips usually. the reason you may find many variety of chips under the same family is that they come in different packages. this is the same as most ICs... you will usually see them in at least two packages... one is usually a DIP package like pictured above and then there are smaller high density chips that us engineers use for our production. sometimes there are different specs for the different versions as well for example when we design for the military, we use mil spec chips that tolerate more extreme temperatures. there are many different companies that make PIC like chips... another big player are the AVRs. i would browse IC catalogs a bit and pay attention to the packaging and different specs and you will see that there may be up to half dozen different chips that have the same number with a small different character or two at the end like the (A) you found. if you are a beginner, i would recommend you stay with DIP packages but if you download the DataSheets for the chips you will see the different packages available and many even have pictures of the packages but most have the layout. i hope this helps :-) cheers, WL

green rose (author)2007-08-09

hi im new here and im new to picmicro i just wana ask can you introduce me to this technology?we have our research and its about automated chicken feeder where the feeding time is programmed by picmicro pls help me what should i learn first before starting any project?im really at lost and can you help me regarding pic programming?thanks alot

mojomoney (author)2006-11-02

Have you ever attempted to run the programming software for Win 95 on an XP machine with the compatability mode set to simulate Win 95? You do so by right clicking on the executable file and opening the properties; inside the compatability tab there is an option to set the compatability mode to: Win 95, Win 98, NT 4.0 and Win 2000. I've had to use this in the past on PC's when XP first came out and few programs were written for it.

leevonk (author)mojomoney2006-11-06

I tried something similar to that, but not that exactly. It's not just a compatibility problem, xp prevents progs from accessing ports for security reasons, so it's actively inhibiting the functionality. Commercial programs can access the ports (obviously), I don't know how though.

TechnoMancer (author)leevonk2007-07-15

if you go to:
and download the software(it is PIC programming software!!! for PIC18 family) there is a program callled allowIO.exe that uses porttalk to allow programs to use IO ports under NT/XP/Vista
here is a segment from the installation instructions for the program: INSTALLING PP18 under Windows 2000/NT/XP:

- Copy "porttalk.sys" to your "C:\WINDOWS\system32\driver" directory.
- Execute "porttalk.reg" to register the new driver.
- Reboot your computer to start the driver after booting.
- Copy AllowIo.exe in the same directory than PP18.exe.
- Open a DOS window at this directory.
- Type "AllowIo.exe 0x378 PP18.exe" to allow PP18 a full access to LPT1.

Note :
During installation process you must have root privileges.
You can creat a batch file to launch AllowIO.exe and PP18.exe.
this will work with ne program just as long as you run it from a batch script and you know the port addressin hex!!!
hope this helps!!!

Brennn10 (author)2007-04-27

Is the chip mentioned here, a reprogrammable chip? Meaning that it can be used over and over again? With taking information off of it and putting different on.

leevonk (author)Brennn102007-04-27

yeah, it has flash memory, so its reprogrammable

Brennn10 (author)leevonk2007-04-29

What PIC programmer do you recommend?

leevonk (author)Brennn102007-04-30

for DOS programming at home, I'm using a cheap $15 programmer from ebay, works fine, just find one that has the PIC # you want to use listed as compatible. for windows programming at work I use an 'MPLAB ICD 2' connected to a 'demonstration board', they work well and the ICD 2 allows in circuit debugging (stepping the PIC through a program step by step to find a bug).
haven't used anything other than those.

Brennn10 (author)leevonk2007-04-30

Thanks alot. One more question. There are PIC programmers, and then there are micro-controllers. What is the difference?

flywoodkb (author)2006-03-23

What do you think the cost of these starter project materials would be, roughly?

leevonk (author)flywoodkb2006-03-23

usb to serial adapter (if you have a computer with windows 95 or earlier, don't need it) costs around $20 PIC microcontroller costs around $7 JDM programmer costs around $20 compiler options: PICClite is free PICBasic costs $99 PICC costs $950

leevonk (author)leevonk2006-03-23

IC-Prog is free

electronic components are almost nothing

regulated 5v power supply can be around $20 but you can use batteries, or probably find a good 5v wall-wart (those transformers that come with your electronic gadgets) sitting around somewhere.

You could also use any wall-wart (regarless of voltage) and a very cheap LM7805 regulator (see URL below)

fat_strat_cat (author)leevonk2007-03-10

or use an usb cable the red wire is +5v and the black is ground thats what i did to make a masgaer

roboguy (author)leevonk2006-11-23

Hey all. This is my first reply to a post... I use PIC ucontrollers in my research robotics projects. A lot of people get started with the 16F84 or the 877. I'd like to point people in the direction of the 18F series chips, specifically the 18Fxx31 series (I really like the 18F4431). These chips have all of the basic functionality, but they have great peripherals of use to home experimenters. Specifically, they have 8 channels (4 pairs) of PWM and a quadrature encoder input that is great for motor interfacing. I use MPLAB along with either the C18 compiler or MPASM for assembler for most of my work. BTW, I don't represent Microchip in any way, I just really like their stuff!

theprofessor (author)2007-01-21

mplab is free and you can build an ICD2 clone by going to, i wouldnt knock assembly language, its syntax may be tricky, but i can do whatever your doing in c or basic in 1/4 of the memory and have it run many times faster.

leevonk (author)theprofessor2007-01-21

yeah, and it will take you ten times as long to do it. I've used assembly language too, but I usually don't do applications that require its speed and efficiency of execution. So instead I prefer speedy and efficient programming.

Crash2108 (author)2006-08-30

You can get free chips off of the microchip website..

Relativity (author)2006-08-13

I'd like to get a multi programmer to program more then one processor . Links anyone? Or infact links to where I could buy like a starter set or each piece individually ?

Omegas (author)2006-03-24

It's not that hard to build a programmer yourself either. Basically there are three types of programmers that are most often used: JDM, TAIT and ICSP (single supply). I suggest having a look at the PICPgm software page at and navigating to the Hardware section. I began my PIC experiments by building a JDM circuit on a breadboard and it worked just fine for my purposes...

About This Instructable




More by leevonk:WolfPack: Large-Dog CarrierVortex-Drive Micro ROV (ROVVor)Squintasaurus: cybernetic dynamically adjustable vision enhancement system
Add instructable to: