Image 1   index

Clone of PICkit2                                   PIC Flasher board

Image 6     image

         MICROCHIP  PICkit2                                PIC 16F877A chip

To start with ,collect following software/hardware tools to program a PIC microcontroller

Softwares

1. MPLAB IDE  from www.microchip.com

2. Standalone   PICkit 2 Programmer version 2.61 generally installed along with .Net framework from

http://ww1.microchip.com/downloads/en/DeviceDoc/PICkit%202%20v2.61.00%20Setup%20dotNET%20A.zip

Hardware

3. Buy a clone of PICkit2 with flasher board .In this workshop we are going to use the clone made by NSK Electronics,Bangalore and available at Saravana Electronis,Coimbatore (alselectro@gmail.com).

4. Select a PIC IC for your project, say PIC 16F877A.

The current version of MPLAB IDE is version 8.76 (sept.2011) . It is a 32-bit application on Microsoft Windows and includes several free software components for application development, hardware emulation and debugging.

Both Assembly and C programming languages can be used with MPLAB IDE v8. Others may be supported through the use of third-party programs.. MPLAB IDE v8 does not support Linux, Unix or Macintosh operating systems.

MPLAB IDE installation

Go to www.microchip.com/

Under DESIGN –>select  MPLAB IDE

Image 3

scroll down to see the download list

Image 2

Select MPLAB IDE V8.6 (4th from bottom) and download the 126 mb installation file.

PICKIT2

The PICkit 2 is an in-circuit programmer & it  has a connector for a 6-pin or 10 pin header, which you must connect to the target chip.The target chip (the chip to be programmed) is plugged in  ZIF  socket provided in PIC Flasher board.The clone of PICkit2 is provided with a boot loader unit connected to PIC Flasher with a 10 pin header  FRC connector.

The PICkit 2 contains a bootloader that will take control when the PICkit 2 is powered.

A bootloader is a small program, which loads another program (the application) into memory (and probably to start that application). When the bootloader is in control it will blink the USB ON/Busy LED.

 

Start the MPLAB IDEv8.76 program

The IDE opens with an output window and a small untitled window (Project window).

The grey background is the Workspace.

pic3

Select Project –> Project Wizard –> Next

and then select the device you are going to use (PIC16F877A in our case)

click Next to land on Step two window .Here you select

Microchip MPSAM Toolsuite and then under Toolsuite contents select

MPASM Assembler(mpasmwin.exe)v5.39

pic2

click Next and then provide a location for your project by clicking Browse or typing it directly and click Next.

The MPASM assembler cannot handle file path name larger than 62 characters.So avoi using a directory in ‘My Documents’.Instead create one off the root at C:\PIC\Projectname

For now, click Next again, as we have no files to add at this moment.Summary of your actions are listed in the next window.

PIC7

Click Finish , you will be presented with the project window with all file folders.

Image9

Now click File –> Add New File To Project

and create a file with extension .asm   for e.g  test1.asm and save.

This file now opens in the workspace and here is where you write your code. After completing the code click ctrl+F4 to save it to test1.asm. Any unsaved file is indicated with an * mark.

Image 5

In the Project window under Source files you can see your test1.asm file where your code resides.

You can save both your project & workspace  by clicking File->Save Workspace.

Now click  Project –> Build All     OR press CTRL+F10 to build the project.

Image 10

After you get BUILD SUCCEEDED message you can go to your project file location (in our case C:\PIC\Projectname)  to see a test1.HEX file  among various other files.

This .HEX file is the file that is fused into your PIC IC.

Connect the USB cable of PICkit2 unit to your PC or Laptop.

Now start the PICKIT2 software

Image 7

The PICkit2 detects the hardware connected and displays the IC connected to it.

Please take care to insert the IC in the ZIF socket of Flasher board properly and select the IC pin selection switch (in this case 40 pin for PIC16F877A).

Click Blank Check to check if the IC is fresh.If not, press Erase to make it blank.

Now click File –> Import Hex  and browse to the project file where your .HEX file is stored.

Select the test1.HEX file and click open to see the file successfully imported.

Image 11

Now click WRITE   or ctrl+W to fuse your program into the chip.

This can be done from your MPLAB IDE itself

Programmer –> Select Programmer –> PICkit2

But generally the standalone PICkit2 software is preferred as it is more effective and has more tools.

For more Details contact :

Saravana Electronics, 10,Edayar Street,Coimbatore 641001

91422 2398827

alselectro@gmail.com