Harold, It sounds like similar to what I was thinking to do. Can you share the code= ?=20 I just want to see how things are done. how do you keep track of counts and= =20 locate next log? are you using FAT file system? thanks Andre ________________________________ From: Harold Hallikainen To: Microcontroller discussion list - Public. Sent: Wed, March 30, 2011 8:18:27 PM Subject: Re: [PIC]: what's the best way to save large data in flash memory I'm doing something like what you described. I'm suing a 2MB SPI flash to do logging in a system. I save 64 byte records sequentially. I keep track of the address I'm going to write the next record to. I have a function called FlashStreamProgram. I pass in the starting address, a pointer to the data I want to write, and the number of bytes to write. Every time the FlashStreamProgram detects we have gone over a sector boundary and need to erase, it does so before moving on. I pull the data back by reading an array similarly. When reading the log, I specify a log record number, which converts to an address, then gets the log record. On power up, when the system does not know where the next log record would go, it scans through memory starting from the bottom looking for the first erased record (0xff in all bytes). It then uses this as its next llog address. Harold --=20 FCC Rules Updated Daily at http://www.hallikainen.com - Advertising opportunities available! --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist =20 --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .