Hi, I would like to know can I just connect the wires from the Pickit 2 directly to the pins on my Microcontroller? Must I add a pull up resistor or something? I tried to connect the wires directly but I couldn't program it.
Hi, I would like to know can I just connect the wires from the Pickit 2 directly to the pins on my Microcontroller? Must I add a pull up resistor or something? I tried to connect the wires directly but I couldn't program it.
Yes you can.
Pin 1. VPP to MCLR pin on PIC. You need a 10K to 33K pullup resistor on this pin too.
Pin 2. VDD to VDD. The PICkit 2 can supply power to your target (the breadboard), but not too much. I forget the exact amount of current, but it's enough to do small circuits.
Pin 3. Ground to Ground
Pin 4. PGD to PGD pin on PIC.
Pin 5. PGC to PGC pin on PIC.
Here's a typical schematic showing how it's connected. See the upper left area.
![]()
Whats the pull-up for - I regularly connect my pickit2 directly to my breadboarded circuits and they work fine - apart from the times I connect the pins the wrong way round (i really need a keyed socket)
There will come a day when PICs will rule the world!
ahh a good hint there, just thinking - most of my recent projects have used small pics, so ive probably had the mclr disabled and using the pin as an input - thats probably why i havn't had any problems.
There will come a day when PICs will rule the world!
Hi fut, thanks for the verification. I connected as instructed and did a Blank Check on my device using the pickit 2 Programmer. However, it stated "Program Memory is not blank starting at address 0x00000"
I tried to program using the MPLAB Programmer. It shows the following error when I select Pickit2 as the programmer.
PKWarn0003: Unexpected device ID: Please verify that a PIC16F877A is correctly installed in the application. (Expected ID = 0xE20, ID Read = 0x0)
When I try to write, it shows the following error:
PK2Error0027: Failed verify (Address = 0x2007 - Expected Value 0x2FCF - Value Read 0x4B)
Then it's not connecting. Trying to write is pointless until it does.
With the PIC wired properly, hit Programmer/Connect and it should connect to the PIC and tell you what type it is. If you can't get that to happen, the rest is never going to work.
If your project has the wrong target PIC specified that could cause the problem. Confirm that your project has the correct PIC selected.
The above was typed without MPLAB in front of me so I may have misnamed certain menus. Adjust to suit.
Last edited by aaronchay; 9th November 2008 at 02:15 AM.
I can't tell anything from that jumble of wires. I would have to see the PICkit 2 end as well. You should try to get in the habit of wiring your breadboard more like this. Check out one of Pommie's breadboards if you want to see REALLY neat. Mine look sloppy beside his.
Rather than a bunch of loose wires as a programming cable you really should build some proper cables to make your life SO MUCH easier, and programming/debugging much more reliable (like 100%). Like this:
Look about halfway down in this thread for more pictures.
Umm... Why would you connect MCLR to ground?? As long as MCLR is held low the PIC is in reset. Reset means nothing happens until that pin goes high again. Put a pullup resistor (10K to 33K) from MCLR to VCC (5 volts) to make sure MCLR stays high.I tried using the Pickit2 programmer and checked for blank. It Displayed "Device was blank" until I connected the MCLR to ground then after that it coundn't work.
Last edited by futz; 9th November 2008 at 03:30 AM.
Is that a resonator over at the left there? Keep the wires to it as short as possible!.
You should also connect all VDD and VSS pins, even though they usually work fine with just one pair connected.
But judging by a closer look at the picture, assuming the PICkit 2 end is good, it should work.
How long are the wires between the PICkit 2 and the breadboard? Keep them under 12 inches or so (even less if it's practical).
It's unlikely that this is the problem, but you should get in the habit of putting "decoupling" capacitors between the VDD and VSS pins of the PIC, as close as possible to the chip. Use 0.1uF ceramics for this. Sometimes you'll have trouble getting things to run properly without them.
If nothing else works, start up the PICkit 2 software (shut down MPLAB) and connect to the chip. Do an erase. Then shut that off and start MPLAB again and see if it connects normally then.
Last edited by futz; 9th November 2008 at 03:18 AM.
For programming purpose, why at all the resonator is needed, I wonder?Does he/she mean ICSP mode
Last edited by mvs sarma; 9th November 2008 at 04:31 AM.
Regards,
Sarma.
When I run into this sort of problem I like to use the PICkit2 application instead of MPLAB. It seems to make connections work that have failed in MPLAB.
The only thing you should be looking at is connect (in MPLAB) or tools>check_communication in PICkit2. Do not bother with reading or erasing the chip till after these work.
You do not need a crystal or resinator to program the chip.
You do not need the pullup unless you intend to run then you also need a clock source (crystal or resonator).
I would add the 2 missing bypass caps. Check for shorts on the header that connects to the PICkit2.
I have never seen a PIC that was bad from the factory but it is possible but rare to mess one up.
The one thing I did not look at was the ICSP CLK and DATA lines. They could be mixed up.
Please post questions to the forums. PM's are for personal communication.
BCHS/3v0's Tutorials
Junebug USB PIC programmer kit., USB Bit Whacker,
The 15 Minute Printed Circuit Board! (+drill time)