how to programme using pickit 3

Thread Starter

harami

Joined Jun 20, 2011
66
One thing Harami. You do not need any programming socket in order to program your PIC. With the PICKIT 3 (or clone) it is just a matter of connecting 5 or 6 wires from the PICKIT to the chip. This is something you can do on a bread-board. In fact you can connect the programmer in circuit. If you take some precautions. You have not done so in your project. But that is no big deal. The problem is that your PICKIT can not. For some reason detect any PIC.
As for now forget the programmer socket. And just setup your PIC in an empty bread-board. With the needed 5 or 6 wires connect from your PICKIT to your PIC.
i think you are right.. i tried to programme with new pic and it gave me this error. can you tell me how i can programme a pic without connecting it to a programmer socket. yes i can see that pickit got 6 wires. can u tell me where do i connect those wires.. which 6 pins should i connect it to??
 

Attachments

Thread Starter

harami

Joined Jun 20, 2011
66
have you put resistors in series with leds yet?
yes i got the resistors but i need to programme my pic first. whithout that i cant really test my circuit.. some how pickit 3 is not letting me programme my pic.. it cannot find the target device although i have connected my pic onto the socket.
 

chrisw1990

Joined Oct 22, 2011
551
can you zip up your entire workspace?
i want to see how your settings are, but cant without the entire workspace?
i have the .c and pic.h file where i can notice an issue, but i want the workspace to make sure it is an issue, if this makes sense
 

panic mode

Joined Oct 10, 2011
2,715
thank you, that helps...

pickit3 (as i know it) may not come with the adapter board that your first picture shows, here is what pickit3 here normally looks like (it's just programmer and usb cable):
http://dlnmh9ip6v2uc.cloudfront.net/images/products/09973-_01.jpg

therefore when programming blank chip, one either:
1. makes own adapter (similar to one you have there), or
2. temporarily wires target and pickit using breadboard or
3. designs board for the project and adds ICSP connector.

option1 (adapter) is nice but as you have seen it is not standard with all programmers.

option2 is quick and dirty and potentially problematic if one makes wrong connections or does not follow the guidelines (posted earlier).

option3 is nice because it can be used as final product but still allows you to make program changes using pickit (without using bootloader). i've seen cases where ISCP is added as an after thought and since this is left to user to deal with, mistakes are still possible. for example there are restrictions on resistors and capacitances on few pins.

so far it was not clear which option you tried to use - and this is why you were asked how is target connected.

pictures cleared it up and now we know that you did have adapter/option1 (which is very nice, looks commercially made), and that you did not use option 2 or 3.

now that this is out of way, further suggestions can be made. chrisw1990 already posted suggestion to move away from adapter (for all we know, it could be faulty) and try option 2 (plug target into breadboard, make few connections and try again).

here is an example that should give you an idea (note this example shows 28-pin chip PIC18F2450):
http://diylightanimation.com/wiki/index.php?title=Bare_bones_PIC18F_programmer_interface

here is similar article that shows also 40-pin (PIC18F4550):
http://picspalsandgals.wordpress.com/
 

chrisw1990

Joined Oct 22, 2011
551
is this for real? this workspace has nothing associated with it?
scratch that, workspace isnt up to date

ok BAM here we go,
problem then,
your project file (mcp) proves what someone mentioned earlier,cant remember who it was, not going to look back now, your configuration bits arent set.. have a look at your p18f4520.h, youll notice #define OSCINTIO etc at the top...
now look at the datasheet.. chapter "23.1 Configuration Bits"
your clearly using C, but you can read up on those.. then come back to us?:D
 

Thread Starter

harami

Joined Jun 20, 2011
66
t

now that this is out of way, further suggestions can be made. chrisw1990 already posted suggestion to move away from adapter (for all we know, it could be faulty) and try option 2 (plug target into breadboard, make few connections and try again).
is this how i connect the pic with the pickit? i forget to add a 5v power in onto VDD (pin 11) and ground to pin 19.
 

Attachments

panic mode

Joined Oct 10, 2011
2,715
almost, that looks good but you are missing 10k pull-up between MCLR and Vdd.

this should set you up to read/write pic. you can use clear and verify, then download something (and again verify). for read/write test you don't need to make your own hex file, you can get one from internet too. once you confirm that you can read/write some file, then you can focus on making your own code work.

it is good idea to provide ICSP connector in your design so you don't have to keep on pulling the pic from the board just to program it. this is what pickit3 guideline and poster are for. also check what others have done, for example on 40-pin chip, you have enough of I/O that you can leave PGC and PGD just for programming. and if you are using them for something else, follow guideline and make sure that any circuitry added is sufficiently high impedance.

here is an example of basic circuit:
http://picspalsandgals.files.wordpress.com/2011/04/800px-generic_hid_usb_device.png
 

t06afre

Joined May 11, 2009
5,934
is this how i connect the pic with the pickit? i forget to add a 5v power in onto VDD (pin 11) and ground to pin 19.
http://ww1.microchip.com/downloads/en/DeviceDoc/39622L.pdf
Have you looked at this document. The programming specification stress that all VDD VSS pins must be connected. You can also connect PIN 6 on the PICKIT 3 to the pin 38 (RB5) on your PIC. As other have said. I can not find any MPLAB project file. It could be that you posted the MPLABX project. Anyway this will not have ANY THING to say regarding your problems in connecting the PICKIT to your PIC
 

Thread Starter

harami

Joined Jun 20, 2011
66
you havent defined the configuration bits. and for the life of me, would people stop using mplab x??? its crap!!!
doesn't my modified .h file contain the configuration bits. :/ will you be able to suggest me a configuration bits for my code plz.. or some examples..
 

chrisw1990

Joined Oct 22, 2011
551
i did earlier. your .h only allows you to use words, e,g, OSCINTIO7, means, if you look a tthe header file, that everytime you put OSCINTIO7 it will put 0xfff7 or whatever it is #defined as.
YOU need to set your project up. i recommend strongly that you use MPLAB 8.84. MPLAB X is still under development and is very glitchy and buggy still.
use the old mplab. and set config bits like..
Rich (BB code):
	#pragma config FCMEN = OFF           //Fail-Safe Clock Monitor Disabled
you have the benefit of the fact you have already seen the codes in the header file so you know where to look to define each configuration bit.
and for what each one does you MUST look at the datasheet.
Page 252 helps explain them
 

t06afre

Joined May 11, 2009
5,934
doesn't my modified .h file contain the configuration bits. :/ will you be able to suggest me a configuration bits for my code plz.. or some examples..
As I can see the configuration bits are not set at all in your modified .h file. You can find more about the configuration bits in the "SPECIAL FEATURES OF THE CPU" section in the data sheet. But let us take that problem later. Any luck with your programmer yet?
 

Thread Starter

harami

Joined Jun 20, 2011
66
As I can see the configuration bits are not set at all in your modified .h file. You can find more about the configuration bits in the "SPECIAL FEATURES OF THE CPU" section in the data sheet. But let us take that problem later. Any luck with your programmer yet?
yes im building my own ICSP circuit to programme my pic.. i have also attached an initial design on the previous post. however i havent yet programmed the pic. as you guys mentioned about the configuration bits, i am also having a look at those as well.
 

Thread Starter

harami

Joined Jun 20, 2011
66
the pic wont do anything without the configuration bits. you havent even told it what oscillator to use.
i realised that i havent yet set the configuration bits.. can i ask you a quick question.. do i need to configure bits which i need or do i have to configure every bits??
 
Top