Oh, and to keep things interesting I want to use Mac OSX and an ICD2 over USB.
So, on to the first challenge, finding a development environment. Sadly Microchip don't as yet appear to provide an environment for operating systems other than W*ndows. A quick search on google came up with a likely contender in piklab. Piklab is free and GPL and appears to have many of the features of MPLab, and it supports ICD2 among others. Installation was greatly eased by using Macports.
sudo port install piklab
And piklab needs a toolchain. I chose GNU PIC Utils (gputils).
sudo port install gputils
This should get you a running piklab installation. You'll need to select the gputils toolchain.
Next up, getting the ICD2 working. This really depends on the version of the ICD2 firmware. Mine was woefully out of date but you might find yours is fine.
Updating the ICD2 firmware. There's a couple of options here.
- Use a W*ndows machine, install MPLab and update from there.
- Install and Run MPLab under Wine, then use piklab to update.
I chose 2 as I have no W*ndows machines in the house. Off to Macports again.
sudo port install wine
Then download and run the MPLab installer:
To install the new firmware just point the piklab firmware directory (Programmer->Settings->Programmer Selection->Specific) to:
Then connect (Programmer->Connect) and piklab will update your firmware.
It should now be possible to create a new project and a stub .asm file which should compile and program.
In the next enthralling instalment I'm going to see if I can get some servo code running.
Meanwhile here are some links to some very useful software.
- piklab: PIC IDE and programming environment
- gputils: GNU Pic Utils, compiler & linker etc.
- Wine: Runs W*ndows programs on Mac OSX or Linux, eg. MPLAB
- MPLAB: Microchip's W*ndows IDE for PIC Development
- PIC 18F2520: Datasheet
- Droids: Supply all kinds of PIC development boards.