strict warning: Only variables should be passed by reference in /sites/ on line 559.

Microchip PIC

This is work in progress (14-2-2010).

The PIC is a family of microcontrollers developed by Microchip. On this page we will focus on the PIC18F4550 which is a microcontroller with USB support. Back in 2007 I did a lot of work on this, but due to lack of time I was forced to put it aside for a while, until now. In the meantime the development software has changed a bit, as well as the Linux distributions, so we will be going back to square one, which is a good opportunity for newcomers to join in.

First you need the microcontroller itself of course, and you need a programmer in order to program the microcontroller. You can build a programmer for yourself, as I did back then. However nowadays it is not really worth the effort as you can buy the Pickit 2 programmer for under 50 euro's, and it is often more reliable than a low cost self made programmer.

Installing the software for the Pickit 2 programmer

We will install and use pk2cmd which allows you to control your Pickit 2 programmer:

  • install the package libusb-dev:
    aptitude install libusb-dev
  • download the source of pk2cmd from The software is nearly at the bottom of the page, section "Linux & Mac OS X software (Unsupported)".
  • extract it, cd to it, and build it:
    tar zxvf pk2cmdv1.20LinuxMacSource.tar.gz
    cd pk2cmdv1.20LinuxMacSource
    make linux
  • copy 2 files to the bin directory:
    cp pk2cmd PK2DeviceFile.dat /usr/local/bin
    chmod 644 /usr/local/bin/PK2DeviceFile.dat
    According to the readme file, the dat file should be copied to /usr/share/pk2 instead, and that directory should be added to your PATH, but the solution above also works, and it is less dirty IMHO.

Now connect your Pickit 2 and verify it is working by using this command:

pk2cmd '-S#'

The required firmware version on the Pickit 2 is v2.32.00 or later, so if an earlier version is reported, it is time to upgrade the firmware:

  • download the firmware v2.32 from the website
  • unzip it:
  • flash the hex file:
    pk2cmd -DPK2V023200.hex
  • check if it worked:
    pk2cmd '-S#'
    If the firmware version reported is 2.32.00 or higher then you are okay.

Here is a list of commands commonly used:

pk2cmd '-S#' list all connected Pickit 2 devices and their firmware version
pk2cmd -Dfile replace the firmware by the contents of the specified file
pk2cmd -Ppart -R -T power on the target, part is for example PIC18F4550. The -R option is needed to release the Vpp line, which is also the MCLR (reset) on many PIC's.
pk2cmd -Ppart -W power off the target
pk2cmd -Ppart -Ffile -M program the target using specified file

Connecting the programmer to the microcontroller

The pinout of the Pickit 2 is:

1 Vpp (programming voltage)
2 Vdd (target power, often 5V)
3 Vss (Gnd)
4 PGD (program data)
5 PGC (program clock)
6 Aux (not used)

To connect the Pickit 2 to the PIC18F4550:

Pickit 2 PIC18F4550 Optional, if PIC is programmed in application circuit
1 1 pullup 10k to +5V
2 11+32 do not make this connection if using external power
3 12+31  
4 40 10k series resistor to application circuit
5 39 10k series resistor to application circuit
6 n.c.  

It is possible to use the Pickit 2 programmer as (limited) power supply for your application circuit.

Getting and building PUF

The latest release of PUF is at the time of writing from 2007, so you are probably better of using the nightly CVS snapshot which you can find here: To build, first install flex and bison, extract PUF, cd to it, then do the following:

cd device/puf

The pinout of the USB connectors:

1 Vcc
2 D-
3 D+
4 Gnd


host, A: +-----------+
         | --------- |
         |  - - - -  |
            1 2 3 4

slave, B:  ---------
         /  -     -  \
        |   2     1   |
        |   3     4   |
        |   -     -   |
        +-------------+ (chassis part)

(This document is not finished. To be continued...)

A debt of gratitude is in

A debt of gratitude is in order for offering this quality data to us. I truly delighted in perusing. Will clearly going to impart this URL to my companions. video submission

The article has actually

The article has actually peaks my interest. I am going to bookmark your web site and maintain checking for brand new information. geneva tourism


Hey – great blog, just looking around some blogs, seems a really nice platform you are using. I’m currently using WordPress for a few of my blogs but looking to change one of them over to a platform similar to yours as a trial run. Anything in particular you would recommend about it? Mexican restaurants near me

Useful info

I think this piece of information will be useful to all those who are using microcontrollers. From your post, I came to know how to install the software for pickit 2 programmer. Surely I will try to install it. Thank you. internet providers near me

Good post

I hate studying about micro chips. I had a paper in college called micro processors and it was the hardest paper we had in college. I don’t know why we had to learn all that. What is the use of knowing such things? tv providers


Thanks for writing such a good article, I stumbled onto your blog and read a few post. I like your style of writing... facebook

Thanks for the Instructions

Thanks for the detailed instructions. I have used other PIC microcontrollers. This is the first time I am using PIC18F4550 with USB support, never heard of such a microcontroller till I read your blog. Thanks for the information. Surely it’s a great opportunity for newcomers. best internet provider

Positivity in attitude pays

Positivity in attitude pays off rich dividends. As positivity carries confidence in effort and action. It is effort and action which turns dream into a reality. goahoneymoonpackage


I was very pleased to find this site.I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post. facebook

For First Packers and Movers

For Superlative Packers and

ge logiq 400 cl

sonocalc medical mechine Diasonics 7 5 SP/C prostate ultrasound procedure video 1 5 tesla mri machine withinisugly com:35483 aqsskp com:18361 black7comics com:17681 mutualevantecafemax com:16121 palluxomedia com:15006 attributionnoderivativestv com:14573 cancomsolutions com:23228 rockitmp4 com:28232 rockitmp4 com:33226 verduomo com:13761 dvfreak com:33878 cancomsolutions com:38442 4ufieldhockey com:30892 verduomo com:22949 seagreensusa com:26334 palluxomedia com:28034 withinisugly com:20946 seagreensusa com:20633 verduomo com:16425 rockitmp4 com:38899 rockitmp4 com:32875 verduomo com:33543 attributionnoderivativestv com:34607 mutualevantecafemax com:33823 briarskin com:19586 paulhewittbasketballcamp com:33435 maestriaspanama com:38932 thsfda com:21829 rockitmp4 com:20132 seagreensusa com:32566 withinisugly com:16514 rockitmp4 com:38985 verduomo com:18358 maestriaspanama com:27669 cancomsolutions com:18931 cancomsolutions com:30045 withinisugly com:36862 4ufieldhockey com:39425 ebusyet com:41725 attributionnoderivativestv com:21371 ebusyet com:31252 thsfda com:22948 palluxomedia com:15031 briarskin com:22000 maestriaspanama com:29141 3 probe method ultrasound tgc 8 probe scanning eve probe 393 stroker kit probe regalia truth unveiled alokaultrasounds com:42636 alokaultrasounds com:23497 alokaultrasounds com:10966 alokaultrasounds com:20978 alokaultrasounds com:42586 alokaultrasounds com:31087 alokaultrasounds com:23951 alokaultrasounds com:35052 alokaultrasounds com:31226 alokaultrasounds com:33530 alokaultrasounds com:40585 alokaultrasounds com:29809 alokaultrasounds com:29930 alokaultrasounds com:19786 alokaultrasounds com:32778 alokaultrasounds xyz:41869 alokaultrasounds xyz:13830 alokaultrasounds xyz:21200 alokaultrasounds xyz:14374 alokaultrasounds xyz:39715 alokaultrasounds xyz:19334 alokaultrasounds xyz:26905 alokaultrasounds xyz:42747 alokaultrasounds xyz:34698 alokaultrasounds xyz:42248 alokaultrasounds xyz:17709 alokaultrasounds xyz:25954 alokaultrasounds xyz:14789 alokaultrasounds xyz:18079 alokaultrasounds xyz:35890 esaoteultrasound com:41319 esaoteultrasound com:38043 esaoteultrasound com:11269 esaoteultrasound com:19856 esaoteultrasound com:12228 esaoteultrasound com:26646 esaoteultrasound com:21828 esaoteultrasound com:27989 esaoteultrasound com:22654 esaoteultrasound com:37793 esaoteultrasound com:28993 esaoteultrasound com:10556 esaoteultrasound com:25200 esaoteultrasound com:42412 esaoteultrasound com:30645 esaoteultrasound xyz:33071 esaoteultrasound xyz:29338 esaoteultrasound xyz:37249 esaoteultrasound xyz:31546 esaoteultrasound xyz:12448 esaoteultrasound xyz:32484 esaoteultrasound xyz:41194 esaoteultrasound xyz:39574 esaoteultrasound xyz:33000 esaoteultrasound xyz:34452 esaoteultrasound xyz:26136 esaoteultrasound xyz:31459 esaoteultrasound xyz:36732 esaoteultrasound xyz:33848 esaoteultrasound xyz:38422 philipsultrasounds com:40725 philipsultrasounds com:12683 philipsultrasounds com:22012 philipsultrasounds com:35375 philipsultrasounds com:18850 philipsultrasounds com:41784 philipsultrasounds com:14596 philipsultrasounds com:39480 philipsultrasounds com:31342 philipsultrasounds com:13913 philipsultrasounds com:28068 philipsultrasounds com:12166 philipsultrasounds com:28200 philipsultrasounds com:15454 philipsultrasounds com:30136 philipsultrasounds xyz:10436 philipsultrasounds xyz:20531 philipsultrasounds xyz:24524 philipsultrasounds xyz:39917 philipsultrasounds xyz:24464 philipsultrasounds xyz:33558 philipsultrasounds xyz:38044 philipsultrasounds xyz:32373 philipsultrasounds xyz:32267 philipsultrasounds xyz:38324 philipsultrasounds xyz:28437 philipsultrasounds xyz:12920 philipsultrasounds xyz:37165 philipsultrasounds xyz:40905 philipsultrasounds xyz:31084 siemensultrasounds com:30878 siemensultrasounds com:41428 siemensultrasounds com:15775 siemensultrasounds com:41448 siemensultrasounds com:26587 siemensultrasounds com:41070 siemensultrasounds com:18327 siemensultrasounds com:30658 siemensultrasounds com:23287 siemensultrasounds com:34446 siemensultrasounds com:34674 siemensultrasounds com:31295 siemensultrasounds com:18096 siemensultrasounds com:11532 siemensultrasounds com:28435 siemensultrasounds xyz:26942 siemensultrasounds xyz:34399 siemensultrasounds xyz:16508 siemensultrasounds xyz:21882 siemensultrasounds xyz:16513 siemensultrasounds xyz:34661 siemensultrasounds xyz:40982 siemensultrasounds xyz:19535 siemensultrasounds xyz:20339 siemensultrasounds xyz:38282 siemensultrasounds xyz:41263 siemensultrasounds xyz:33034 siemensultrasounds xyz:29431 siemensultrasounds xyz:19620 siemensultrasounds xyz:10291 toshibultrasound com:12592 toshibultrasound com:42015 toshibultrasound com:37604 toshibultrasound com:12504 toshibultrasound com:35032 toshibultrasound com:34810 toshibultrasound com:14661 toshibultrasound com:20724 toshibultrasound com:24615 toshibultrasound com:12117 toshibultrasound com:35912 toshibultrasound com:15775 toshibultrasound com:25960 toshibultrasound com:33886 toshibultrasound com:37632 toshibultrasound xyz:14796 toshibultrasound xyz:40326 toshibultrasound xyz:20470 toshibultrasound xyz:26129 toshibultrasound xyz:30589 toshibultrasound xyz:27855 toshibultrasound xyz:39097 toshibultrasound xyz:24631 toshibultrasound xyz:12290 toshibultrasound xyz:23368 toshibultrasound xyz:38608 toshibultrasound xyz:39889 toshibultrasound xyz:12996 toshibultrasound xyz:12547 toshibultrasound xyz:20251

There are people who seek

There are people who seek changes that easily. Most especially those who already have knowledge on it. - Gary McClure