Brent Brown wrote: > On 17 Nov 2009 at 2:09, Forrest W Christian wrote: > >> Well, I am working on a bootloader for the 18f46J11.... >> >> And came across this snipplet: >> >> "To maintain the endurance of the program memory cells, each Flash byte >> should not be programmed more than once between erase operations. Before >> attempting to modify the contents of the target cell a second time, an >> erase of the target page, or a bulk erase of the entire memory, must be >> performed." >> >> Add to that: "The minimum erase block is 512 words or 1024 bytes." >> >> This isn't a big problem for the bootloader (rewriting 1024K at a time >> is ok - a bit dangerous in page 0, but not a big issue). What is bad >> is that this particular pic doesn't have any flash other than the >> program memory, so I in effect get to use the program memory as flash >> data memory to store my nonvolatile settings. >> >> Assuming I am reading my datasheet correctly, that means I get to >> reserve 1024 of the 3776 bytes of RAM so I can read the entire block of >> configuration memory in, make modifications to it, and then re-write >> it. Am I missing something? > > This would indeed be an interesting, and annoying, new feature for program Flash > memory to have. Yes, if you are reading the data sheet correctly (sounds like you > are) then your logic also sounds right that you will have to read a whole block of > Flash into RAM, No, just read the actualy *used* Flash into RAM. > modify RAM, erase Flash block and then write RAM back to Flash. Take the actualy used Flash from the RAM buffer, the rest of the Flash page can be generated from the code as dummy data. > Hopefully you can spare enough RAM (and clock cycles) for this, else you might > have to look for a chip without the same constraints, or add an external EEPROM > chip. > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist