Introduction

The PIC microcontroller is one of the most successful programmable processor parts in existance, produced in their millions by Arizona Microchip. The parts are serially programmed, and a variety of programmers exist, from parallel port ones, serial ones to usb ones. The PicKit2 is one such usb device.

Integrated development environments exist for most operating systems, and for linux, there are several to choose from. KTechlab is a basic interactive simulator, and PICdev and PIClab are very similar - as PIClab is available via the Mandriva software manager, we will be using this.

Installing Software

PIClab

Install the piclab package through the Mandriva Software Manager.
This program provides the integrated development framework, including programming and hardware debugging, although it can be a little unstable when accessing the USB interface - you will soon no longer need to use pk2cmd.

PIClab does not, however, include any compilers - these have to be installed separately.

gputils

Install GPUtils through the Mandrive Software Manager. This package includes the assembler gpasm, which is needed to build the PIC code.

If you want a C compiler, take a look at SDCC - it's an open source cross-compiler suite for embedded processors. It can be installed through the Mandriva Software Manager, although currently, support for PICs is in development.

gpsim

Install GPSim through the Mandriva Software Manager. This package includes the simulator, which is used by the XXX.

PK2CMD


PK2CMD is a program provided by Arizona Microchip for programming your hardware.

Download package from arizona microchip's website, and as root, copy the pk2cmd executable into /usr/local/bin, and ensure that it has executable access, and copy the PK2DevceFile.dat into /usr/share/pk2.

As a non-root user,plug the USB cable from the PICKit into the computer, and the test board (mine came with a PIC16F690), and extract the contents to a file with the pk2cmd command:
pk2cmd -P -GFoutputfile.hex - dump device contents to outputfile.hex
Other pk2 commands include:
pk2cmd -P -Fflash.hex -MP - program flash.hex into device
pk2cmd -P -Fflash.hex -YP - verify device contains flash.hex
pk2cmd -P -T - power on pic
pk2cmd -P - power off pic