You'll need a programmer — for those who are new to this, a programmer is a little device that plugs into your computer and your circuit, and transfers your compiled program onto the PIC/AVR. There are plenty of 'official' and unofficial programmers — I'm using a PICKIT 2 clone by Sure Electronics (They're an amusing Chinese company who print "Have fun with us" on their product boxes"), but you can use almost any programmer. The important thing is that it has a terminal interface, i.e. you can control it via the terminal. Examples of this include usbpicprog, which looks like a great little low cost PIC ICSP programmer.
For the PK2, this software is called pk2cmd, and can be downloaded from the 'Downloads' section of Microchip's PK2 Page
Install whatever software you need for your programmer. You'll probably have to use Terminal for this section (Applications/Utilities/Terminal
). Follow the instructions in the readme or install files, and you can always post a comment if you get stuck!Compiler
You'll also need a compiler. This is a piece of software that turns your assembly language or C into machine code (raw hex values) that the MCU can understand. I'm using gputils's gpasm
, an open-source clone of Microchip's mpasm. I hear that mpasm can be run on OS X, as can student versions of Hi-Tech C's C compilers.
Same deal as with the programmer software — download whatever compiler you want from respective websites (I can recommend gputils, and I'll be using that for this tutorial) and follow the installation instructions. I'm not going to go over every single problem that could occur, so post a comment if you need a hand.Editor
You'll need a plain text editor that you can customise to run AppleScripts through a menu or button. Textwrangler
is great because it's free, allows you to add AppleScripts to a menu, and is fully scriptable, which gives benefits you'll see later. It also does some syntax highlighting. Unless you know your way round AppleScript, use TextWrangler.Progress Check:
At this point you should be able to compile and download a program. If you can, check now and solve any problems before moving on to the next stage. At the very least, try to run both programs from the Terminal (by typing their names and pressing return. For example, "pk2cmd", and "gpasm".