+ Reply to Thread
Page 1 of 4
1 2 3 4 Last
Results 1 to 15 of 55

Thread: Breadboard Programming for PIC16F877A

  1. #1
    aaronchay Newbie
    Join Date
    Aug 2008
    Posts
    37

    Default Breadboard Programming for PIC16F877A

    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.


  2. #2
    futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent
    Join Date
    Sep 2007
    Location
    Vancouver, B.C.
    Posts
    1,980

    Default

    Quote Originally Posted by aaronchay View Post
    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.
    =========================
    Futz's Microcontrollers & Robotics
    =========================

  3. #3
    SMUGangsta Good SMUGangsta Good
    Join Date
    Oct 2008
    Location
    Wales, Centre of the Universe
    Posts
    219

    Default

    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!

  4. #4
    futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent
    Join Date
    Sep 2007
    Location
    Vancouver, B.C.
    Posts
    1,980

    Default

    Quote Originally Posted by SMUGangsta View Post
    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 )
    The pullup is for when you try to run the circuit without the PICkit 2 connected. Keeps the reset pin from floating, which can cause random resets. As long as the PICkit 2 is connected it controls the pin. So it's just a good habit to get into.
    =========================
    Futz's Microcontrollers & Robotics
    =========================

  5. #5
    SMUGangsta Good SMUGangsta Good
    Join Date
    Oct 2008
    Location
    Wales, Centre of the Universe
    Posts
    219

    Default

    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!

  6. #6
    aaronchay Newbie
    Join Date
    Aug 2008
    Posts
    37

    Default

    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"

  7. #7
    futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent
    Join Date
    Sep 2007
    Location
    Vancouver, B.C.
    Posts
    1,980

    Default

    Quote Originally Posted by aaronchay View Post
    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"
    It connects then? If so then try an erase. If all seems normal, program the chip with your hex file and continue.
    =========================
    Futz's Microcontrollers & Robotics
    =========================

  8. #8
    aaronchay Newbie
    Join Date
    Aug 2008
    Posts
    37

    Default

    Quote Originally Posted by futz View Post
    It connects then? If so then try an erase. If all seems normal, program the chip with your hex file and continue.
    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)

  9. #9
    futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent
    Join Date
    Sep 2007
    Location
    Vancouver, B.C.
    Posts
    1,980

    Default

    Quote Originally Posted by aaronchay View Post
    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)
    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.
    =========================
    Futz's Microcontrollers & Robotics
    =========================

  10. #10
    aaronchay Newbie
    Join Date
    Aug 2008
    Posts
    37

    Default

    I tried to wire my P16F877A like this:



    However, I am still getting the same error.

    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 aaronchay; 9th November 2008 at 02:15 AM.

  11. #11
    futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent
    Join Date
    Sep 2007
    Location
    Vancouver, B.C.
    Posts
    1,980

    Default

    Quote Originally Posted by aaronchay View Post
    I tried to wire my P16F877A like this:
    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.

    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.
    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.
    Last edited by futz; 9th November 2008 at 03:30 AM.
    =========================
    Futz's Microcontrollers & Robotics
    =========================

  12. #12
    futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent
    Join Date
    Sep 2007
    Location
    Vancouver, B.C.
    Posts
    1,980

    Default

    Quote Originally Posted by aaronchay View Post
    I tried to wire my P16F877A like this:
    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.
    =========================
    Futz's Microcontrollers & Robotics
    =========================

  13. #13
    mvs sarma Excellent mvs sarma Excellent mvs sarma Excellent mvs sarma Excellent mvs sarma Excellent mvs sarma Excellent mvs sarma Excellent mvs sarma Excellent mvs sarma Excellent
    Join Date
    Oct 2006
    Location
    Hyderabad, India.
    Posts
    2,476
    Blog Entries
    1

    Default

    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.

  14. #14
    aaronchay Newbie
    Join Date
    Aug 2008
    Posts
    37

    Default

    I've redone the wiring today and I'm still getting the same error message as before. Could it be a bad chip? It's quite difficult to get a damaged chip right?







    I've removed the Resonator too and wires are 4.1 Inch or 10.5cm
    Last edited by aaronchay; 9th November 2008 at 09:45 AM.

  15. #15
    3v0
    3v0 is offline
    3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent
    Join Date
    Jul 2006
    Location
    USA
    Posts
    6,464
    Blog Entries
    11

    Default

    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)

+ Reply to Thread
Page 1 of 4
1 2 3 4 Last

Similar Threads

  1. The Breadboard
    By ElectroMaster in forum Electronic Theory
    Replies: 22
    Latest: 15th October 2008, 01:51 AM
  2. Where can i get one of these? ISA Breadboard...
    By Marks256 in forum General Electronics Chat
    Replies: 4
    Latest: 13th April 2008, 06:40 PM
  3. need help on programming a pic16f877a
    By rossu704 in forum Micro Controllers
    Replies: 3
    Latest: 5th April 2007, 07:09 PM
  4. Programming in PIC16F877a
    By jambulov in forum Micro Controllers
    Replies: 1
    Latest: 23rd April 2004, 12:29 PM
  5. Programming in PIC16F877a
    By jambulov in forum Micro Controllers
    Replies: 1
    Latest: 23rd April 2004, 11:12 AM

Tags for this Thread