On Tue, 19 Nov 2002, William Chops Westfield wrote: > >> - 12c508 is "one shot one kill" and i burned out 2 micros > > You mean "burnt out", or just used up? It IS a one-time programmable > device, but I don't usually equate "correctly executing a program that > doesn't work" with "burned out." (Could be a language issue.) > > On that topic, does anyone care to describe techniques they use to get more > than one try out of an OTP device? Seems like both all-zeros and all-ones > are reasonable harmless instructions to have happen before you start trying > to do real work so you ought to be able to put your program as high as > possible in program memory (so it occupies the top 100 words or so.) Then > when the PIC resets it starts at 0, executes (memsize-100) NOP or ADDLW 0xFF > instructions, and then starts your program proper. If it doesn't work, you > program your next 100 word program starting at memsize-200 and try again. > > (obviously, this doesn't work as well if you start needing interrupt vectors > and so on, but hopefully by the time your program gets that complex you've > got more experience and more flash alternatives. It's the really "trivial" > first time attempts and such that I want to address.) > > There may be difficulties with programmers and verifies and such, which is > why I'm asking for actual experiences... I haven't tried this on an actual chip, so take it with a grain of salt, but I've read an article that discusses "re-using" OTP parts like the 12C508. The "trick" is that an unprogrammed chip is filled with all 1 bits (0xfff for a 12-bit chip), and 0 bits are written where needed to program the chip. Also, the NOP instruction is 0x000. Thus, you initially program your chip starting at the LOWEST address (0). When you want to update the software, program NOPs (0's) over the current code, and follow with the updated code. When the chip starts up, it executes (on the 12C508) the MOVLW calibration instruction at the top of memory, a bunch of NOPs (which are the old, erased code), and then the current program. Bill -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics