Continue to Site

# Getting started with pickit2

Status
Not open for further replies.

#### Nick'

##### New Member
I have a pickit2 and would like to programme a code written by me into the PIC16F628A. I have written the code in mplab in assembly language and linked successfully. I have a pickit2 software. My problem now is i do not know how to insert the code into the PIC. What i heard was we have to convert the assembly into hex and insert it into PIC. Please tell me step by step on how to do that. Thank you.

#### bananasiong

##### New Member
Hi,

Have you successfully built the project with MPLAB? If you have the hex file is already generated in the same directory. You can just use MPLAB to program the PIC or PICkit2 software to program the PIC.

#### Nick'

##### New Member
Yes i have the .hex file generated inside the same directory. How can i use the MPLAB and pickit2 program to program?

##### Member
Yes i have the .hex file generated inside the same directory. How can i use the MPLAB and pickit2 program to program?

Hi,

Can / have you actually got the PICKIT2 connected to the microcontroller?

From the MPLAB menu select debugger as PICKIT2 and programmer as NONE.

Then you need to BUILD your project (select build icon in MPLAB) then PROGRAM (select program icon). Your project should include a header file and a linker file for the microcontroller that you are programming.

#### Pommie

##### Well-Known Member
If you just want to program the chip then select pickit2 as a programmer, not debugger. When you program using a debugger extra code is downloaded and the chip will not work while disconnected from the pickit2.

Mike.

#### Nick'

##### New Member
I set my programmer and debugger to pickit2. Is that correct?

After programming successfully, do i have to "release from reset"?

Here is my code.

Code:
list	p=16F628A
include "p16f628a.inc"
__config _INTRC_OSC_NOCLKOUT & _PWRTE_ON & _BODEN_ON & _MCLRE_ON & _WDT_OFF & _CP_OFF
org	0x0000
movlw	0x07              ; I think these should also be added
movwf	CMCON
bsf STATUS,5
movlw 00h
movwf TRISA
bcf STATUS,5
movlw b'00000101'
movwf PORTA
goto \$
end

#### Pommie

##### Well-Known Member
I set my programmer and debugger to pickit2. Is that correct?
It can't be both at the same time, set it to programmer.

After programming successfully, do i have to "release from reset"?

Yes, or disconnect the pickit2, make sure you have the necessary diode and resister on MCLR.

Mike.

#### Nick'

##### New Member
I dont have any resistor now. Why do i need those? Can i not pay around with MCLR? i am still new and dont really want to mess with those resetting things.

#### Pommie

##### Well-Known Member
You should have the pickit2 connected to MCLR and so you will need to do "release from reset". If however, you disconnect the pickit2 then you will need a resistor from MCLR to Vdd or it will keep reseting.

Mike.

#### AllVol

##### New Member
I have a pickit2 and would like to programme a code written by me into the PIC16F628A. I have written the code in mplab in assembly language and linked successfully. I have a pickit2 software. My problem now is i do not know how to insert the code into the PIC. What i heard was we have to convert the assembly into hex and insert it into PIC. Please tell me step by step on how to do that. Thank you.

Hi Nick,

The attachments below should help you get from compiled and hexed program into PICkit 2 and your uP.

After you get a successful build (shown in output window) then select programmer and Pickit 2 (Help_1)

Output window will change to reflect Pickit 2 is located and ready (Help_2)

Then click as indicated in Help_3, and you should get a notification in the output window of successful transfer.

Hope this helps

edits: correct spelling

#### Attachments

• Help_1.PNG
10.8 KB · Views: 120
• Help_2.PNG
6.3 KB · Views: 112
• Help_3.PNG
6.9 KB · Views: 119
Last edited:

#### Nick'

##### New Member
Hi Nick,

The attachments below should help you get from compiled and hexed program into PICkit 2 and your uP.

After you get a successful build (shown in output window) then select programmer and Pickit 2 (Help_1)

Output window will change to reflect Pickit 2 is located and ready (Help_2)

Then click as indicated in Help_3, and you should get a notification in the output window of successful transfer.

Hope this helps

edits: correct spelling

According to this, it means that i do not need the "release from reset"?

This is because whenever i clicked on the "release from reset" It says resetting...... and it did not display "successfully released" or something similar.

#### AllVol

##### New Member
According to this, it means that i do not need the "release from reset"?

This is because whenever i clicked on the "release from reset" It says resetting...... and it did not display "successfully released" or something similar.

There is no need to "release from reset" or anything other than what I have given.

Status
Not open for further replies.

Replies
2
Views
1K
Replies
25
Views
2K
Replies
5
Views
655
Replies
9
Views
1K
Replies
3
Views
540