PIC Programming with the PICkit 3

From DiyLightAnimation
Jump to: navigation, search

Getting started with the PICkit 3 programmer - a step-by-step PIC programming guide

Preliminary steps

  • 1. Download the latest MPLAB IDE software (see the WIKI Software section for links).
  • 2. Install the software to your system - unzip the downloaded file & double-click on Setup.exe. Follow all instructions, to complete the installation.
  • 3. Download the firmware for the PIC device you wish to program. This should be downloaded from the WIKI Equipment page.


Setting up to program your device

  • 1. Connect the PICkit 3 programmer to the PIC interface adapter (see Bare bones PIC18F programmer interface as an example). Make sure any required jumpers are properly configured for the device to be programmed (this will be specific to your PIC interface adapter). If using the J1SYS boards lookup the Group for the PIC you are using in the manual (Dongle PIC is Group L) and place a jumper wherever that letter is listed. See Pin out for ICSP28 adapter
  • 2. Insert the device into the device socket on your PIC interface adapter. Make sure the device is oriented correctly for your adapter. Close the lever on the socket (if the socket is so equipped).
  • 3. Plug the USB interface cable into the PICkit 3 programmer, and the other end into your PC's USB jack.
  • 4. Start the MPLAB IDE software by double-clicking the icon on your desktop (if you had the installer place an icon there), or by going to the Start menu, and selecting All Programs > Microchip > MPLAB IDE v8.43 [your version may be different] > MPLAB IDE.
  • 5. Import the PIC firmware .HEX file (that you downloaded in Preliminary step #3) by clicking on File > Import... and browsing to the .HEX file. Click on the .HEX file then click "Open". In the "Output" window within MPLAB IDE, you will see that the Build tab now shows that the .HEX file was loaded. You will also see that the file checksum is displayed in the MPLAB status line - confirm that this is the correct value by comparing it to the expected value (which is noted with the firmware file on the WIKI). If the value is not the same, you should re-download the firmware file, as it may have been corrupted during the download.
  • 6. Configure MPLAB IDE for the PIC device you will program by clicking on Configure > Select Device... and then using the "Device:" pull-down to select the correct device number. Click "OK".
  • 7. Configure MPLAB IDE to use the PICkit 3 programmer by clicking on Programmer > Select Programmer > "4 PICkit 3". The "PICkit 3" tab will now open in the Output window, and programmer diagnostics will be executed. Note, the first time the programmer is selected, the programmer firmware may be (automatically) updated. This is nothing to worry about.

At the end of the diagnostic process, an error will probably be displayed saying "You must connect to a target device to use PICkit 3". This error is displayed because the (connected) device can not yet be detected. We'll fix this in a second...

  • 8. Unless the PIC device is in an active (powered) circuit, configure the PICkit 3 to provide the power to the PIC by clicking on Programmer > Settings..., clicking on the Power tab and clicking "Power target circuit from PICkit 3". Leave the voltage setting alone, unless you know for certain that it needs to be set to a different value. For the PIC18F2450 used on the DMX Dongle, this should be "5.000". Click "Apply". A Voltage Caution message will be displayed, suggesting that you check to make certain that the correct device is inserted in the socket. After checking that the connected PIC device is the same as what is reported in the Caution message, click "OK" (if the device does not match the configuration, click "Cancel" and make whatever adjustments are necessary). Click "OK" to dismiss the Programmer Settings dialog. Now, the PICkit 3 tab in the Output window should have reported a Device ID Revision. This indicates that the programmer can actually "see" and "read" the device.


Programming your device

[And here we go...]

  • 1. Now the easy part... Click Programmer > Program. The PICkit 3 tab in the Output window should show "Programming..." and then in a few seconds (depending on the size of the firmware to be programmed) "Programming/Verify complete".

Ta-Da! Your PIC has been programmed.

You can now verify that the device was programmed properly by clicking on Programmer > Read. The PICkit 3 tab in the Output window will show "Reading..." and then (after a few seconds) "Read Complete". The checksum of the firmware read from the device will be displayed in the Checksum field of the status bar. If it matches the checksum of the source .HEX firmware file, the device is properly programmed.