Getting into PIC Microcontrollers

2 February, 2008

There are lots of hobbyist ‘computer on a chip’ type processors which take much of the hard work out of programming and interfacing, such as the Basic Stamp, the OOPic, and the BasicX processor that I’m using on my tracked robot. The downside of using these is that they aren’t the cheapest way of doing things. The great thing about distributed computing is that it should be cheap – use lots of processors to take away complexity from your central processor or computer. I still plan to use my BasicX chip but hand off much of the difficulties of motor control and some of the sensor functions to cheap PIC chips from Microchip.

The downside of doing this is the learning curve. You need a programmer, a compiler, sometimes a few extra components (such as an oscillator), and there is an incredible number of chips to choose from.

So off I went and bought a USB programmer off eBay and some PICs from Maplins. I went for some 16F84As which have tutorials all over the web. Unfortunately this chip is becoming obsolete and there are alternatives which are much better and cheaper! I went this route simply due to the amount of support out there. Then I realised that compilers aren’t as freely available as I would have liked. The book I was reading at the time used PicBasic and PicBasic Pro compilers which cost a bit from Microchip or elsewhere. Of course you could program in assembler but that looks like hard work! Eventually I found an open source basic compiler called Great Cow Basic (GCBasic) which uses enough commands to be getting on with. I use notepad++ to write the code, you drag the file onto the compile.exe and the assembly and hex files are produced. You can then load the hex file into the software that comes with the programmer and you’re done!

I’m currently using this to manage a stepper motor with little input (other than enable, speed, and direction commands). Once I’ve cracked it I shall upload the details.


So I’m using:

  • Notepad++ to write the code on my XP machine (useful as a general notepad replacement)
  • GCBasic for compiling
  • A PIC16F84A processor
  • and my “DIY ” programmer from ebay

USB PIC programmer