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

Breadboard Programming for PIC16F877A

Discussion in 'Microcontrollers' started by aaronchay, Nov 6, 2008.

  1. arhi

    arhi Member

    Joined:
    Apr 17, 2008
    Messages:
    887
    Likes:
    12
    Location:
    Belgrade, .rs
    have you checked the "power" settings in the pickit app?
     
  2. aaronchay

    aaronchay New Member

    Joined:
    Aug 30, 2008
    Messages:
    37
    Likes:
    0
    I have used a multimeter to check the power output across the rails and it stated 4.71V
     
  3. arhi

    arhi Member

    Joined:
    Apr 17, 2008
    Messages:
    887
    Likes:
    12
    Location:
    Belgrade, .rs
    in the pic it looks ok, maybe you can try without the pull-up resistor, afaik it is not needed for the programming part, but should not make problems ...

    Have you tried putting there 5V from external source, it can help, set the power to auto, leave connections as is and add 5V stabilised source to the breadboard, used to help few times I had similar problems..
     
  4. dave

    Dave New Member

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


     
  5. mvs sarma

    mvs sarma Well-Known Member

    Joined:
    Oct 29, 2006
    Messages:
    3,512
    Likes:
    76
    Location:
    Hyderabad, India.

    perhaps you need to put a 0.1uF disc cap across thee Vdd and Vss pins across pins 11&12 or 31&32.
    also you need to put a 1N4148 diode in series to the 10K resistor Vdd going to Mclr . also another 0.1uF helps decouling at bottom of 10K resistor before diode.
     
  6. aaronchay

    aaronchay New Member

    Joined:
    Aug 30, 2008
    Messages:
    37
    Likes:
    0
    Tried adding the caps but to no avail. Also added external power source but also to no avail.
     
  7. mvs sarma

    mvs sarma Well-Known Member

    Joined:
    Oct 29, 2006
    Messages:
    3,512
    Likes:
    76
    Location:
    Hyderabad, India.
    As suggested by FUTZ, remove the mplab link, put the chip alone and try to erase it once and have a blank check. let us see what happens



    DON't apply external power. It would be fed back to PICKIT2
     
    Last edited: Nov 9, 2008
  8. aaronchay

    aaronchay New Member

    Joined:
    Aug 30, 2008
    Messages:
    37
    Likes:
    0
    Tried it. Open up only the pickit 2 programmer and try to erase it right? I'll get back the same error message that Program memory does not start at address 0x000000.
     
  9. arhi

    arhi Member

    Joined:
    Apr 17, 2008
    Messages:
    887
    Likes:
    12
    Location:
    Belgrade, .rs
    not sure how it goes with pickit2, I had a problem with pic I programmed with easypic4 that was unreadable, unrecognisable, unusable .. after multiple tries to make it work, I used some parport programmer that uses 13V to program chip (not lvp but the other type, not sure how it is called) and when I erased it using that, it was working ok... not sure if pickit2 is using this 13V programming or lvp but noticed with easypic - that can only do lvp, if I disable lvp on pic while programming it, I cannot program it on easypic any more) ...

    iirc, pickit2 makes 13V on the mclr pin so it should program it anyhow .. but, not sure, maybe someone can confirm
     
  10. 3v0

    3v0 Coop Build Coordinator Forum Supporter

    Joined:
    Jul 14, 2006
    Messages:
    9,404
    Likes:
    227
    Location:
    OKLAHOMA USA
    I do not have an original PICkit2 but I do have a Junebug or two. Both of these do high voltage programming.

    Both MPLAB and PICkit2 software need to connect to the chip. It makes not sense to try to erase or program the chip if you can not make a connection to the onboard monitor.

    You do not need any pullups or diodes on MCLR to connect program or verify.

    You do need the decoupling/bypass caps between power and ground.

    At this point it looks like you are doing everything right. Although not likely it is equally possible that the 16F877A or the PICkit2 are bad.

    Unhook the PICkit and run the trouble shooting steps under tools. TOOLS>TROUBLESHOOT...

    It will allow you to check VDD, VPP, CLK and DATA lines.
     
    Last edited: Nov 9, 2008
  11. aaronchay

    aaronchay New Member

    Joined:
    Aug 30, 2008
    Messages:
    37
    Likes:
    0
    You're right, I opened up MPLAB and Pickit 2 Programmer.

    When I select a device on the Pickit 2 Programmer, MPLAB would show

    -------------
    Found PICkit 2 - Operating System Version 2.32.0
    Target power not detected - Powering from PICkit 2 ( 5.00V)
    PKWarn0003: Unexpected device ID: Please verify that a PIC16F877A is correctly installed in the application. (Expected ID = 0xE20, ID Read = 0x0)
    PICkit 2 Ready
    ---------------

    However, I closed everything, opened up MPLAB and Pickit 2 without selecting the Device. I went to MPLAB and chose Pickit2 Programmer and
    -----------
    Initializing PICkit 2 version 0.0.3.30
    Found PICkit 2 - Operating System Version 2.32.0
    Target power not detected - Powering from PICkit 2 ( 5.00V)
    PIC16F877A found (Rev 0x8)
    PICkit 2 Ready
    ----------------------------

    So is this what I'm supposed to get?
     
  12. 3v0

    3v0 Coop Build Coordinator Forum Supporter

    Joined:
    Jul 14, 2006
    Messages:
    9,404
    Likes:
    227
    Location:
    OKLAHOMA USA
    YES Not try to erase and blank check it using PICkit2 software. If that works you can start MPLAB and it should connect there too.
     
  13. aaronchay

    aaronchay New Member

    Joined:
    Aug 30, 2008
    Messages:
    37
    Likes:
    0
    I'm getting back the same error now.
     
  14. 3v0

    3v0 Coop Build Coordinator Forum Supporter

    Joined:
    Jul 14, 2006
    Messages:
    9,404
    Likes:
    227
    Location:
    OKLAHOMA USA
    What exactly did you do? Starting from when it connected.
     
  15. aaronchay

    aaronchay New Member

    Joined:
    Aug 30, 2008
    Messages:
    37
    Likes:
    0
    I on MPLAB and Pickit 2 Program. Then I selected the PIC16F877A from the device and tried to erase it and did a blank check. Then it went back to what it was before.
     
  16. mvs sarma

    mvs sarma Well-Known Member

    Joined:
    Oct 29, 2006
    Messages:
    3,512
    Likes:
    76
    Location:
    Hyderabad, India.
    can we seek a check of Vpp voltage as I doubt, whether it is due to low Vpp
     
  17. aaronchay

    aaronchay New Member

    Joined:
    Aug 30, 2008
    Messages:
    37
    Likes:
    0
    I've use the DMM to check the voltage of MCLR with respect to ground and i'm given a reading of 1.3Volts.
     
    Last edited: Nov 9, 2008
  18. 3v0

    3v0 Coop Build Coordinator Forum Supporter

    Joined:
    Jul 14, 2006
    Messages:
    9,404
    Likes:
    227
    Location:
    OKLAHOMA USA
    For now stay out of MPLAB.

    Use the PICkit2 software until you are able to connect erase program and verify the 16F877A. If a connect works try several times it a row. It should work consistantly.

    If you get ID Read = 0x0 it is not talking to the PIC.

    Use the TOOLS>TROUBLESHOOT.. to see what it says about VDD, VPP and then check PGC and PGD
     
  19. aaronchay

    aaronchay New Member

    Joined:
    Aug 30, 2008
    Messages:
    37
    Likes:
    0
    noted, will keep trying and get back tomorrow! Thanks!
     
  20. mvs sarma

    mvs sarma Well-Known Member

    Joined:
    Oct 29, 2006
    Messages:
    3,512
    Likes:
    76
    Location:
    Hyderabad, India.
    this would raise to 13.4 or so only when a programming or read or verify mode is enabled, i feel or when the test mode of PICKIT.

    The PICKIT2 user manual shows 10K pull up decoupled with 0.1uF, and connected to MCLR* either by 470 ohms or a diode placed in such a way that later Vpp would not travel back.

    They haven't however shown the much needed 0.1uF power line decoupling at the Device under program mode
     
    Last edited: Nov 10, 2008
  21. aaronchay

    aaronchay New Member

    Joined:
    Aug 30, 2008
    Messages:
    37
    Likes:
    0
    But i doubt it would affect the programming.
    One thing i'm not sure of is why are people able to program their chips smoothly by just connecting the wires but not for me?
     

Share This Page