Claim Your: Useful

"Arduino Software Guide"

   Right Now...

Enter Your E-mail Address
Enter Your First Name (optional)
Then



Which Pic Programmer Do You Need?


There are 4 types of programmer; Serial, Parallel, USB and Bootloader.


Here you can find essential information for choosing or building your own pic programming circuit.

Modern programmers

The best way to program your PIC chips is to use a USB programmer and that communicates to your hardware via a USB interface.  These are reliable and easy to use (much easier than serial or parallel port programmers).

All you really have to make sure is that it supports your devices and that you have an ICSP interface. The difference is that some programmers allow you to insert the PIC chip into an IC holder to program it and then take it out and place it in a circuit. Using ICSP means that you can leave the PIC chip in the circuit and still program it easily.

Suggested programmers are the pickit2 or pickit3.

Older PIC programmer information

You can build your own programmer if you have an older computer with either a serial port or parallel port.  (I expect you could also attach a serial programmer - using RS232 - to a USB to serial converter but I have not tried this at all.



You can also find information on ICSP, LVP and bootloading.

Is your programmer not working or showing random data on verify? If you are using long cables then its probably because the cable is behaving as a transmission line. If you don't know what this means then follow this link.

Important note: If you are using a laptop then don't use a pic programmer that is powered from the serial port itself as there may not be enough power/voltage available from it.

Here is an example of a parallel port programmer.

I use the ICPROG programmer which is free software running on my spare computer (i.e. really old computer - running Windows95). Its actually quite useful and it saves blowing up a laptop!

You can find ICPROG here [opens new window].

What is a PIC programmer ?

A pic programmer is a circuit which interfaces the PC to the microcontroller using the PC's parallel,serial or USB port. It can write data to the microcontroller and read it back for verification.

The pic programmer translates digital logic levels from the PC to suitable logic levels for the microcontroller - most levels are ok as they are, but for 'normal' (or high volt) programming of a pic microcontroller the following voltage at the MCLR pin is needed:

  • Maximum : 13.5V

source : PIC application note ICSP (DS30277)

Note: the maximum input voltage to the pin is (MCLR) 14V but on some newer PIC micros this is lowered to 13V so be careful of this specification.

The 13.5 volt level complicates the interface circuit since the voltages from the parallel port or USB port are not that high. Typical digital logic levels are nominally 5v so usually these programmers require use of an external power supply to generate the higher voltage.

The serial port generates higher voltages and this fact is used by programmers such as a JDM pic programmers.

To program older pic devices you need a high voltage programmer.

The programmer should isolate the microcontroller so you can test the microcontroller program while the programmer is still attached.


Sidebar

JDM 'type' serial port programmer details.

The JDM serial port pic programmer cleverly uses the serial port to provide a high voltage programmer that does not require an external power supply. Its cheap and easy to construct and is useful for programming one off chips but you have to insert and remove the chip that you are programming moving from the programmer to the development board.

Personally I don't like doing this as I just want to connect the programmer to my dev board, leave the chip in place, and get on with solving the task.

The problem with these programmers is that they reference the programmer's ground to the -ve serial output voltage. So the programmer's ground reference (to the PIC chip) is -8V (or whatever negative voltage the serial port generates). This is done to get a voltage swing of >13V that can be regulated by a zener to about 13V.

In practice this means that you can not make any ICSP connection to your development hardware as you can not connect development ground to -8V! so you have to remove and insert the chip.

I recommend that you use a pic programmer that needs a power block.


How does a pic programmer work ?

All pic programmers work the same way (except the bootloader - see later) - they generate a serial data stream using two signal lines clock and data. Another pin controls the programming voltage (at MCLR) and two others supply power and ground.

Another program running on the PC (the programming software) takes the hex file generated from your compiler translating it into a serial data stream. This is routed to your programmer through the correct interface (Serial,Parallel or USB). From there the programmer presents the signals to the microcontroller.

After all the data is sent, a serial configuration word is sent, and voila - the microcontroller is programmed ready for use.

Serial or parallel programmer

Serial or Parallel programmers describe the PC interface used not the programming method - all pic microcontrollers are programmed serially. Serial programmers connect to the Serial port and Parallel programmers connect to the parallel port.

The signals used at the parallel port interface still generate serial data - this is why a parallel port programmer is no faster than a serial port programmer.

In fact the speed of programming is determined by the pic programming algorithm and is much slower than any of the PC interfaces. In general programming a Flash pic device is quite slow (16F877A 30 seconds).

Note: This also depends on the PC speed and the hardware capability -I tried using the 1GHz machine and the program cycle was much faster - but you need to have hardware that allows you to go fast.

Programming seems slow when you make minor code changes and want to see the result quickly but compare this to old style EPROMs - you used to remove the chip from the board and put it under a UV light for 30 minutes!

At university the eraser broke down so we put the EPROMS in the photocopier and photocopied for a while to erase!

LVP

A method called LVP (or Low Volt Programming) is available for newer PIC devices - as it suggests you don't need the higher voltage. The disadvantage is that you loose one pin which may be ok for larger 40 pin devices but probably not for 18 pin devices. It would depend on your circuit requirements. See discussion on LVP, for more information.

Note: You can only change from LVP to HVP (High Volt Programming - normal ICSP programmer) if you have an HVP programmer. The parts that are LVP capable are factory shipped with LVP enabled. So always pull the PGM line low with 10k (approx.) when first programming (with HVP).

Bootloading

There is one other way of programing a pic device and this is using a piece of software called a bootloader. This method is only usable on the newer devices that can re-program parts of their own FLASH memory - these days that is loads of them and it is now more common to expect this self-programming action rather than thinking of it as unusual e.g. 18F2550.

It is a small program that typically monitors the USART receive data line (RX) and activates itself if there is any activity on this line within a set time period after reset e.g. one second from power up.

When activated it accepts data from the Rx line using it to program the rest of the FLASH memory i.e. it does not overwrite itself. When all data has been loaded and programmed it starts up the new program or boots (starts up) and loads hence Bootloader.

Interestingly it is called a bootloader referring to a legend about Baron Münchhausen who was able to pull himself up by his boot straps; an impossible task. The process of booting (bootstrapping or starting a system) also seems like an impossible task if you ask the question how can I load and start my program if there is no program in the device to load and start my program!

The answer is that you use a simple piece of software to load the more complex one. This simple program then transfers control to the new program. In a PC this is the BIOS bootstrap code. For the PIC micro you program the bootloader code using a standard (high volt) pic programmer.

Why use a bootloader ?

Since you need a normal pic programmer (or High Volt programmer) to get the bootloader into the microcontroller in the first place why bother with it?...

Answer 1: It is can be faster than serial programming using ICSP - depends on internal Flash programming speed.

Answer 2: You can load code into a fully built system - without using ICSP so there are no pins that need to be considered for Vpp, PGD or PGC - also a high volt programmer is not needed. 

The bootloader lets you use any interface (depending on how you program the microcontroller) to load code. Its main use is infinished equipment where software updates are needed (without opening the box up and plugging in a pic programmer). Equipment that normally uses an RS232 port could be bootloaded through that port. All you would need is a serial cable and hyperterminal (available in Windows). Note other interfaces can be used e.g. I2C, SPI, Ethernet, Wifi etc.

Note: Bootloading is not limited to any specific interface - you could bootload over a network interface or an infrared IRDA interface.

Bootloader advantage

  • No programming hardware - simple programming.

bootloader disadvantage

  • Uses up some resources - less Flash memory available for main program.
  • You have to use a microcontroller that can re-program its own flash memory

There are tons of pic programmer circuits.

This is a list of some of the programmers available as circuits that you can search for on the web.

  • JDM Programmer (Ludipipo)
  • Conquest programmer
  • TAFE Programmer
  • TAIT 'Classic' Programmer
  • Parallel TAIT programmer
  • Fun-card Programmer
  • SCHAER Programmer
  • ProPic II Programmer
  • STK200 Programmer
  • AN589 Programmer
  • WILLEPRO Programmer
  • Fluffy2 Programmer
  • DL2TM Programmer
  • ER1400 Programmer

The above list shows programmer types supported by
ICPROG
[opens new window]

There are many more circuits! but - they all do more or less the same thing!

What you really need in a programmer.

There are several elements to a programmer but the most important is the ICSP connection.

Possible programmer features...

  • ICSP connection.
  • Stand alone programmer - DIL socket.
  • Stand alone programmer - ZIF socket.
  • Serial port powered.
  • USB port powered.
  • Power brick powered.

Don't buy a Serial port powered programmer if you use a laptop as its output power may not be good enough to operate the programmer (laptops like to make power savings to save their batteries!).

Some also use only +/-5V outputs as this level is still within the RS232 standard (although it will not work over large distances). The minimum high and low voltage for receiving RS232 is +/- 3V (normally the transmitter generates +/- 12V). The manufacturers get away with this as most uses of RS232 are short distances on the desk. For a programmer it means there may not be enough voltage to create the 13V for the Vpp signal!

Note: If you want to program chips by removing them from the target board you will want a stand alone programmer. To save money you could buy one with a DIL socket - just make sure to remove the chip using a chip extractor and not your fingers and thumb otherwise you may end up using your thumb as a rather nice pin cushion - believe me it hurts. Perhaps the ZIF (Zero Insertion Force) socket is a better choice!

If you have not got a chip extractor then use a screwdriver - alternately lever up each end of the chip - don't just lever one end up as you will bend all the pins at the other end.

The single most important feature you need in a pic programmer is the pic ICSP connection.

ICSP - In Circuit Serial Programmer.

This is a set of connections that let you program the pic microcontroller while it is in your circuit - there is no need to remove the chip just program it.

This is the most convenient way of developing a prototype (apart from bootloading - see earlier) as all of the hardware once connected is just left as it is on the bench i.e. no removing of chips between programmer and prototype.

You can also connect the ICSP wires to a solderless plug block breadboard so this is also quite an easy way to develop circuitry but be careful where the Vpp wire is placed (13V) - not all the pins can withstand this voltage so make sure it is at the MCLR pin.

If you buy a programmer with just ICSP then you can program most PIC devices.

Usual connections for ICSP:

  • VPP - Programming voltage (usually 13V).
  • VDD - POWER (usually 5V).
  • VSS - GROUND.
  • PGD - DATA usual port and connection RB7.
  • PGC - CLOCK usual port and connection RB6.
  • PGM - LVP ENABLE usual port and connection RB3.

For more details on ICSP click here.

Build your own parallel port programmer.

To be honest I got fed up with the amount of circuits available as there are so many to look at and I also wanted something that was going to work. I decided to follow the one recommended by microchip themselves. It follows the AN589 application and gives you a programmer with an ICSP output connection.

Note: Not all the controls from the parallel port for this circuit are used by ICPROG - but this does not matter. It performs well if you add a transmission line terminator - a capacitor and resistor!.

See the following link for building your own parallel port programmer circuit including the transmission line terminator which allows it to work using a six foot parallel port cable.

PIC Programmer

Recommendations

You should use a USB based programmer either PicKit2 or PicKit3 as this is the easiest way to get started. These USB PIC Programmers are programmed using the software MPLAB X IDE (free).



Jump from PIC Programmer page
to Best Microcontroller Projects Home Page.


Privacy Policy | Contact | About Me

Site Map | Terms of Use | Links




Google

Recent Articles

  1. A short pic C compiler tutorial on compiling mikroelectronika C files.

    Oct 21, 14 02:06 AM

    Simple PIC C Compiler instructions for quickly compiling MikroC hex files from C source code.

    Read more

  2. A frequency counter using timers built into microcontrollers.

    Oct 15, 14 02:54 PM

    How to make a frequency counter working up to about 50MHz, using a pic microcontroller.

    Read more

  3. Color Sensing Circuit

    Oct 08, 14 05:07 AM

    Color sensing circuit : How to use three LEDs to detect color using a microcontroller

    Read more

Custom Search

Sign up for MicroZine:
''The'' Microcontroller Newsletter


Enter your first Name and primary email address in the form below:

And receive absolutely FREE a full project for:


"Measuring Analogue Voltages
Without An ADC"

(Using only one pin).

Instant Download:
You Can
Get It Right Now

Warning: This project could be Removed
at any time.  

It will NOT be
available indefinitely SO

To avoid
disappointment get it:

Now



:
:
Don't worry -- your e-mail address is totally secure. I promise to use it only to send you MicroZine
Remember this is a project with full description and fully debugged C Source code - and it's not available from the main website.

You can only get it through this newsletter.


To get exclusive access Enter your first name Name and primary email address Now in the form above.:

But wait !

There's more...

You'll receive more
free and exclusive reports as well as site information and site product updates.

Scroll up to the form above and sign up NOW.  Don't forget it's FREE and if you don't like it you can unsubscribe at any time.

Click Here Now to use the form above to get your Valuable information absolutely free.



Social Bookmarking
Click & Add:
add to BlinkBlink
add to Del.icio.usDel.icio.us
add to DiggDigg
add to FurlFurl
add to GoogleGoogle
add to SimpySimpy
add to SpurlSpurl
Bookmark at TechnoratiTechnorati
add to YahooY! MyWeb
Readers comments

"I wanted to thank
you so so so much
for all the information
you have provided in
your site it's

SUPERB and FANTASTIC."


- Ranish Pottath


"This site really is
the best and my favorite.
I find here many useful
projects and tips."

- Milan

bursach<at>gmail.com

Learn PIC C Now
Wondering how to program your next project using C and need a great start?


"Awesome site,
very, very easy and nice
to navigate!"


- Matt
matt_tr<at>
wolf359.cjb.net


"I am a newbie to PIC
and I wanted to say
 how great your
site has been for me."


- Dave

de_scott<at>bellsouth.net

Learn Microcontrollers
"Interested in
Microcontrollers?"


Sign up for The
Free 7 day guide:

FREE GUIDE : CLICK HERE

"Your site is a great
and perfect work.
congratulations."


- Suresh

integratredinfosys<at>
yahoo.com

"I couldn't find the correct
words to define
yourweb site.

Very useful, uncovered,
honest and clear.

Thanks so much for
your time and works.
Regards."


- Anon