1
\$\begingroup\$

I wrote a program to upload to my PIC16F877A. Initially it uploaded correctly using the PICkit2 programmer and the microcontroller worked fine, but when I tried to change a piece of code and reprogram the same PIC the program was successfully uploaded but when I tried to test the chip it didn't work.

I tried several times without success. What is the possible solution? The code was written on MPLAB XC8 IDE v3.5. Configuration is #pragma config FOSC = HS ,WDTE = OFF ,PWRTE = OFF,BOREN = OFF,LVP = OFF ,CPD = OFF,WRT = OFF,CP = OFF. I'm using an external 8 MHz crystal.

After failure in MPLAB I tried to write a simple "Blinking LED" in MikroC but no success, it still didn't work.

\$\endgroup\$
  • \$\begingroup\$ I'm using external XTAL of 8MHz \$\endgroup\$ – kassim Apr 25 '17 at 9:38
  • \$\begingroup\$ Try a different pic16F877A. Try to clear the memory. \$\endgroup\$ – Decapod Apr 25 '17 at 9:56
  • \$\begingroup\$ Chances are that chip i now dead. Probably need to try a new one \$\endgroup\$ – MCG Apr 25 '17 at 9:57
  • \$\begingroup\$ I tried a new PIC16F877A it worked fine but when I tried to reprogram again it also fail as the first one. does mean my programmer destroys may PICs? \$\endgroup\$ – kassim Apr 25 '17 at 10:50
  • 1
    \$\begingroup\$ Add schematics of all your circuit. It is possible it is not related to programming itself. Your program could cause some short and fry PIC. \$\endgroup\$ – Chupacabras Apr 27 '17 at 5:55
1
\$\begingroup\$

You may have blown the PIC. This has happened to me with a PicKit 3 a few times. The PIC would heat up a rediculous amount while being programmed, so much so, you couldn't touch it.

Try reading back the hex from the PIC and see if you get anything. If it does it with one and not the other then it will have blown. Didn't figure out what was causing it but you may want to look out for any shorts on your board.

\$\endgroup\$
  • \$\begingroup\$ If you program it, it successful upload the program, and if you read you find there is a hex file in it, but when you try to operate it nothing happened, if you check blank, it shows no blank, if you erase and check a blank I saw there is a blank, I re-uploaded again it was successful uploaded. but it does not operate, since my board has DIP socket when I upload the program successful operate but just after reprogramming won't operate again I don't know why? \$\endgroup\$ – kassim Apr 26 '17 at 20:50
0
\$\begingroup\$

I found some where seems as my problem,click here but when I tried to add #pragma config MCLRE=1 the MPLAB didn't recognize it.

\$\endgroup\$
0
\$\begingroup\$

If the same code is causing problems on one of two of the same PIC's then I would suspect it is damaged. Are you using latest version of MPLAB X? It could be a bug in the software as it seems in the link you provided.

What voltage are you programming at? Are you using externally applied voltage or powered from the programmer?

If the two PIC's are on different boards, check all trace and check all connections are secure including your oscillator and programmer.

You may want to also post up your code.

\$\endgroup\$
  • \$\begingroup\$ I'm using Mplab XC8 IDE V3.5, During programming the PIC is powered from the programmer. and the PIC sometime I tried to change the board but nothing. \$\endgroup\$ – kassim Apr 27 '17 at 19:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.