Tutorial 17 - PIC Programming (Mac OS X)
  • Tutorial 17 - PIC Programming (Mac OS X)

Tutorial 17 - PIC Programming (Mac OS X)

Qty

This tutorial shows how to use iCP01 and iCP02 under Mac OS X.


This tutorial shows how to use iCP01 and iCP02 under Mac OS X with Terminal or GUI form. Support is NOT provided for this Mac OS X programming. 

The following information is quoted from 'Readme For PK2CMD MacOSX.txt'

 

Supported Operating System:

MacOS 10.4 and 10.5, on Intel or PowerPC based machines.

 

Software installation (Terminal form):


  • After extracting the files into your chosen directory, open the MacOS Terminal in 'Applications > Utilities' to run 'PK2CMD'.
    • !!IMPORTANT!! Make sure the Terminal shell is set to 'bash", or help options with '?'will not work.  Select 'Terminal > Preferences', click "Execute this command"and type "/bin/bash" in the textbox.

  • Using sudo, copy the file pk2cmd to '/usr/local/bin' and the filePK2DeviceFile.dat to '/usr/share/pk2'.

  • Your user PATH environment variable should include /usr/share/pk2. If using bash, edit the file .bashrc (/bin/bash) to include:  PATH=$PATH:/usr/share/pk2  export PATH

  • NOTE: If .bashrc does not exist: Create in the home directory using "pico .bashrc" and add the PATH linesabove. (Use "pico ~/.bashrc" to create in the home directory regardless ofthe current working directory. 

  • Ctrl+X then Y (return) to save.
    Other command line interfaces should have a similar mechanism for settingyour PATH variable.

 

Command Line Option:

The following commands are available in the command line interface:

Options Description 
C   Blank Check Device 
E   Erase Flash Device
 F<file>  Hex File Selection
 G<Type><range/path>

  Read functions                                            

Type F: = read into hex file, path = full file path, range is not used           Types P,E,I,C: = ouput read of Program, EEPROM, ID and/or Configuration Memory to the screen. P and E must be followed by an address range in the form of x-y where x is the start address and y is the end address both in hex, path is not used 

 K Display Hex File Checksum 
 L<rate>

Set programming speed

<rate> is a value of 1-16, with 1 being the fastest

 M<memory region>

Program Device 

Memory regions: 

P = Program memory, E = EEPROM, I = ID memory

C = Configuration memory

If no region is entered, the entire device will be erased & programmed.   

If a region is entered, no erase is performed and only the given region is programmed.

 P<part> Part Selection. Example: -PPIC16f887 
 P Auto-Detect in all detectable families 
 PF List auto-detectable part families 
 R Release /MCLR after operations 
 U<value> Program OSCCAL memory, where: <value> is a hexidecimal number representing the OSCCAL value to be programmed. This may only be used in conjunction with a programming operation.
 V<value> Vpp override 
 X Use VPP first Program Entry Method  
 Y<memory region>

Verify Device:

P = Program memory, E = EEPROM, I = ID memory

C = Configuration memory                         

If no region is entered, the entire device will be verified

 Z Preserve EEData on Program 
 ? Help Screen


Each option must be immediately preceeded by a switch, which can be either a dash <-> or a slash </> and options must be separated by a single space.
Example:

PK2CMD /PPIC16F887 /Fc:mycode /M                  

PK2CMD -PPIC16F887 -Fc:mycode -M

 

Command Line Example:

PK2CMD /PPIC16F887 /FC:PROJECTPROGRAM.HEX /MPC

PICkit2 set to a PIC16F887. File PROGRAM.HEX is loaded. The device's program memory and configuration memory are programmed.

 

 Software installation (GUI form):

  PICkit2 GUI (OSX)
  • Mac OSX 10.5 is required to run it along with the latest version of Java.
  • You need to downlaod the PicKit2-Programmer-GUI-1.2-OSX.zip and copy pk2cmd and PK2DeviceFile.dat files into '/bin' folder [NOT /usr/local/bin], even if you have manually installed pk2cmd before.
  • To do that, open a Finder window and press CMD+SHIFT+G then type in '/bin'. 
  • Drag and drop the 2 files, enter your admin password and you're done.
  • To run the software, launch the .jar file.
  • For more information, please visit Microchip Forum: Link
  • Please feel free to contact François Gilbert (gosmonaute@gmail.com) for any help or have comments on the GUI.

 Download:

  • PK2CMD V1.20 Mac OS 10.4 & 10.5 Universal Binary: .zip
  • PicKit2-Programmer-GUI-1.2-OSX: .zip
  • Latest PIC devices list, PK2DeviceFile: .dat
  • pk2cmd MD5 hash: 60947cf9ec4d96581dd82bcad51b66dc

 Special Thanks to:

  • François Gilbert for providing the GUI for pk2cmd
  • cubytus32 for providing updates
FEATURED PRODUCT