Andre Abelian wrote: > From: Gerhard Fiedler=20 >=20 >> Andre Abelian wrote:=20 >>=20 >>> I started writing a test code for SST25VF032 32mb flash the >>> problem I am facing is the counter I am using to add counts each >>> time if I want to update I have to erase 4k block of memory so I >>> have to waist 4k to keep counter going from 0 to 5000. Microchip >>> eeproms any individual memory can be read or write. what would you >>> guys do?=20 >>=20 >> Put the counter on a different storage (e.g. an on-chip EEPROM)?=20 > > that was my mistake I did. pic24 doesn't have internal memory and I > put external eeprom first but I removed it. my next update I will put > small size eeprom. Well, then you have to use one page of the flash for that. There are several ways to do this that don't require erasing and rewriting the page all the time.=20 For example, you can erase it (all bits set), then clear one bit after the other as you write your record -- one bit per record. That gives you in one 4k page 4k x 8 =3D 32k records. Not quite enough to fill the whole 32MB flash with records. You'd need 7 pages for this.=20 As a variant, you can use the first byte as a "page counter". Set it to 0 the first time, then increment it with each time you reach the end of the index page and have to start over. Or you store the index number of the last record written in the first page. The next time you write a record you search for the first free position and store the next index number there. When you reach the end of the first page, you erase it and start over at the first position of the page.=20 There are other variants of this type. It all depends on your constraints. Gerhard --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .