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?
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.
Hi, I'm just wondering if anyone can show me how to bulk erase a pic16f873, because there is code protection on it and i cant reprogram the chip. When i use mplab, i set the config bits to code protect=disable but i didnt actually put the config line in the program (thinking setting it in mplab would be enough) and the code protect got enabled some how when i programmed my chip :( Can someone please explain to me how i could avoid this when i do it next time? I'm still very new with programming micros so some help would be greatly appreciated. Thanks.+
|file: /Techref/microchip/16f877cpde.htm, 4KB, , updated: 2006/4/14 19:35, local time: 2014/4/19 13:30,
|©2014 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?|
<A HREF="http://www.piclist.com/techref/microchip/16f877cpde.htm"> Can't re-program chip after code protecting the data eeprom</A>
|Did you find what you needed?|
PICList 2014 contributors:
o List host: MIT, Site host massmind.org, Top posters @20140419 RussellMc, Josh Koffman, alan.b.pearce, IVP, Isaac Marino Bavaresco, cdb, Bob Axtell, Dwayne Reid, Robert Dvoracek, Byron Jeff,
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
Welcome to www.piclist.com!