1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Programming all PIC chips with PICkit 2

Discussion in 'Microcontrollers' started by richacm, Jun 5, 2008.

  1. richacm

    richacm New Member

    Joined:
    May 19, 2008
    Messages:
    148
    Likes:
    0
    Location:
    Hamilton, New Zealand
    Hi,

    I have been playing around with the PICkit 2 programmer I bought and it comes with a 20 pin PIC16F690 microchip. However it appears that 20pin microchips are the maximum I can program on this board.

    Is there a way for me to program a PIC16F887 or something similar using this board?

    Thanks,

    Craig
     
  2. futz

    futz Active Member

    Joined:
    Sep 15, 2007
    Messages:
    2,043
    Likes:
    24
    Location:
    Vancouver, B.C.
    Just use a solderless breadboard. Simple, inexpensive and flexible. Excellent for experimenting and prototyping. For lots of photos and examples, have a look at my site.

    This one is getting a tad crowded. :D I have bigger ones...
    blehsm.jpg

    The PICkit 2 (Junebug too) can program/debug almost the full line of PICs.
     
    Last edited: Jun 5, 2008
  3. Krumlink

    Krumlink New Member

    Joined:
    Aug 10, 2007
    Messages:
    2,080
    Likes:
    20
    Location:
    Michigan, USA
    Except the 3.3V ones :) I hear that bill is or you is possibly working on a 3.3VDC one?
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. richacm

    richacm New Member

    Joined:
    May 19, 2008
    Messages:
    148
    Likes:
    0
    Location:
    Hamilton, New Zealand

    Sweet - thats good to know!

    I have a breadboard already...just briefly do you have a circuit diagram of what pins I attach to what?

    I see in one of your photo's you have resistors and capacitors across the values from the pin as well....its just a bit hard to see what pin number from the PICkit 2 kit goes to what terminals on the PIC chip.

    I suppose P6 goes to Vdd for starters.

    Thanks,

    Craig
     
  6. futz

    futz Active Member

    Joined:
    Sep 15, 2007
    Messages:
    2,043
    Likes:
    24
    Location:
    Vancouver, B.C.
    What the hell is P6? :p

    Looking at the PICkit 2 from the top side, starting at the arrow (pin 1):
    1. VPP - goes to MCLR (don't forget a 10K to 33K pullup resistor on MCLR)
    2. 5V - goes to VDD
    3. GND - ground
    4. PGD - to PGD pin on the PIC
    5. PGC - to PGC pin on the PIC
    6. Not used
     
    Last edited: Jun 5, 2008
  7. richacm

    richacm New Member

    Joined:
    May 19, 2008
    Messages:
    148
    Likes:
    0
    Location:
    Hamilton, New Zealand
    Fantastic - thanks heaps. I think I will go out and buy a 16F887 now :)

    Sorry about P6....I saw a little P1 beside the right most pin, I assumed that was Pin 1. You've put me right though.

    Cheers,

    Craig
     
  8. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    168
    Location:
    Toronto, Canada
    The PICkit2 can program 3.3V PICs just fine, my Junebug version of the PICkit2 does not have the 3.3V clamps.
    If your target 3.3V PIC has its own power supply and the PGC & PCD pins are not analog you can just program directly with the Junebug.
     
    • Like Like x 1
  9. richacm

    richacm New Member

    Joined:
    May 19, 2008
    Messages:
    148
    Likes:
    0
    Location:
    Hamilton, New Zealand
    OK, I have bought a PIC16F877A chip and I have wired it up as you described to the PICkit2 controller (see diagram for a schematic).

    I start up the PICKit2 programmer and it recognises the PIC16F877A which is great.

    I then Import the Hex (after compiling it for the PIC16F877A) and go to write it to the microchip...I then get an error message back "Programming failed at Program Memory address 0x000024". The number changes everytime I try to write.

    Any ideas?

    Thanks,

    Craig
     

    Attached Files:

  10. richacm

    richacm New Member

    Joined:
    May 19, 2008
    Messages:
    148
    Likes:
    0
    Location:
    Hamilton, New Zealand
    Ah, I didn't connect the Vss to GND on the PIC. I did that and it now worked.

    Thanks again for the help guys.
     
  11. dusko

    dusko New Member

    Joined:
    Jul 15, 2007
    Messages:
    9
    Likes:
    0
    I am not sure, but I think that you should connect pins 12 & 31 (Vss) to ground. Also, the 20k resistor is a "pull-up" -- to be connected to +5V (although this is probably not critical).
     
  12. futz

    futz Active Member

    Joined:
    Sep 15, 2007
    Messages:
    2,043
    Likes:
    24
    Location:
    Vancouver, B.C.
    Yes, connect ALL VSS and VDD pins.

    This IS critical. It must be a pullup. If you pull it down the PIC is in reset and halted. Nothing will happen until that MCLR pin gets pulled high. The only reason it works at all is that the PICkit 2 is connected and controlling it (overriding the pulldown).
     
    Last edited: Jun 5, 2008
  13. BaCaRdi

    BaCaRdi Member

    Joined:
    Apr 7, 2008
    Messages:
    233
    Likes:
    2
    Location:
    Hoboken / NYC
    Well seems the outage screw up all the uploaded attachments, hate when that happens!

    -BaC
     
  14. futz

    futz Active Member

    Joined:
    Sep 15, 2007
    Messages:
    2,043
    Likes:
    24
    Location:
    Vancouver, B.C.
    What do you mean?
     
  15. BaCaRdi

    BaCaRdi Member

    Joined:
    Apr 7, 2008
    Messages:
    233
    Likes:
    2
    Location:
    Hoboken / NYC
    Yep it's me doesn't work in FireFox now, just in IE..damn this computer...sorry about that should have checked first!


     
    Last edited: Jun 5, 2008
  16. futz

    futz Active Member

    Joined:
    Sep 15, 2007
    Messages:
    2,043
    Likes:
    24
    Location:
    Vancouver, B.C.
    There's something wrong with your browser. Works fine for me in both Firefox and IE6.
     
  17. richacm

    richacm New Member

    Joined:
    May 19, 2008
    Messages:
    148
    Likes:
    0
    Location:
    Hamilton, New Zealand
    OK so do to the pullup I need to attach the 20k resistor between the Vdd (5V) and the MCLR - thats what a pullup is isn't it?

    Thanks
     
  18. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    168
    Location:
    Toronto, Canada
    20K will work fine on MCLR
     
  19. futz

    futz Active Member

    Joined:
    Sep 15, 2007
    Messages:
    2,043
    Likes:
    24
    Location:
    Vancouver, B.C.
    Yes. A pullup "pulls" up to VDD. A pulldown "pulls" down to ground.
     
  20. richacm

    richacm New Member

    Joined:
    May 19, 2008
    Messages:
    148
    Likes:
    0
    Location:
    Hamilton, New Zealand
    Just for completeness here is the final circuit to program the PIC16F877A (in my case) from the PICkit 2 for anyone interested in doing the same.

    Cheers,

    Craig
     

    Attached Files:

  21. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    168
    Location:
    Toronto, Canada
    I've got a similar connection diagram in the downloads section of my site.
    [​IMG]
     
    • Like Like x 1

Share This Page