please dont rip this site

Problem:

Whenever I program a 16f877 (40 pin dip) with the config fuses set to
__CONFIG(BKBUG|CP1|CP0|WRT|BODEN|PWRTE|WDTE|FOSC1|LVP);

and the following code,

#asm
psect absdata,abs,ovrld,delta=2
org 0x2100
dw 00,02,03,04
#endasm

the chip NEVER can be re-programmed again. (well, at least with my picstart plus anyway). Can anyone help shed some light on what might be happening? I was __trying to put some initial values in the chips EEprom, while programming in MPlab, using hi-tec's C compiler. Now I have 3 dead $10 chips -- all with working (but not quite finished) code, that I cant re-program over. What have I done?

Answer

from:

Jim Robertson
NEWFOUND ELECTRONICS
Email: spamnewfound at TakeThisOuTpipeline.com.au
http://www.new-elect.com
MPLAB compatible PIC programmers.
Set code protection to "ALL" and program just the config bits by using the PICSTART PLUS menu -> program/verify. Uncheck the program, ID and Data EEPROM options. and click program.

Now select code protection to "OFF" AND make sure the Data EE protect option is ALSO "OFF." Now reprogram the config bits just as you did above. You will now be able to rewrite to the DATA EEPROM and your $10 chips are saved.

Your config bit options need to set the CPD bit and this will prevent the problem occuring again.

__CONFIG(BKBUG|CP1|CP0|WRT|BODEN|PWRTE|WDTE|FOSC1|CPD)

(Delete the LVP mode if you are using the picstart plus)

This is just a guess at the syntax used. I am not farmiliar with the hi-tech compiler __Config directive. It seems to use OR and not AND like MPASM. If this is the case then it sucks bad!

What is happening is this. You are code protecting the data eeprom and therefore MPLAB will not be able to program new data into the data eeprom. To disable the data protection you need to MPLAB to issue the special break code protection command. This will break the program AND data protection. However MPLAB will only do this when it sees the program memory protection is enabled and not just when the data protection is enabled. The sequence I gave you turns on the program memory code protection and then MPLAB is forced to break the code protection before it can program the config bits second time around.

Questions:


file: /Techref/microchip/16f877cpde.htm, 4KB, , updated: 2006/4/14 18:35, local time: 2024/11/5 04:47,
TOP NEW HELP FIND: 
18.118.184.91:LOG IN
©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://linistepper.com/Techref/microchip/16f877cpde.htm"> Can't re-program chip after code protecting the data eeprom</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?