On Fri, 2007-12-28 at 20:10 -0800, Vasile Surducan wrote: > On 12/28/07, Herbert Graf wrote: > > > > On Fri, 2007-12-28 at 12:06 -0800, Rob Susmilch wrote: > > > Hello everyone, > > > > > > First some background. I'm going to be building a simple stand > alone data > > > logger for personal use (and the fun of creating it of course) > since most stand > > > alone loggers are hundreds of dollars. I will most likely be using > a pic18f4553 > > > IIRC, and either interfacing to a ADC chip or using the on-board > A/D. I also am > > > going to be interfacing to SD card since from what I've read they > are easy to > > > do. > > > > > > My question is, and I've searched high and low, how to implement > compression on > > > this little bugger. Granted I suppose getting a jumbo SD card > could negate any > > > compression done, but I may perhaps go to a simple serial EEPROM > instead. All > > > > Frankly, once you get the init done, an SD card in SPI mode is not > > really much more complicated to use then a serial EEPROM. > > If you don't implement the FAT. Else... You don't have to do any FAT stuff. For example, my carmon project doesn't even use the FAT: http://repatch.dyndns.org:8383/pic_stuff/carmon Once you have the actual sector that the file you want to write to starts, you don't have to worry anymore about FS stuff if you set things up correctly. In my case, I simply write a file to the flash card (in my case a CF card, I've done the same with an SD card, I can post that code if anyone is interested) with a computer that fills the whole card. The file contains all zeros. The PIC simply scans the file, finds the first sector that doesn't have zeros, and continues writing. On the PC side I simply scan the file for all non zero data. The only limitation to this method is you can't write zero to the file, usually not an issue (I just write all ASCII). The "init" portion consists of reading the partition table (one sector, fixed location), reading the boot sector of the first partition (to find the location of the root directory) and then scanning the root directory for your file. It all sounds more complicated then it really is. The actually "writing" code simply keeps track of how close to the end of the card I am, and what sector I want to write to next, barely more complicated then writing to an EEPROM. TTYL -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist