Shop OBEX P1 Docs P2 Docs Learn Events
Logging data on SD — Parallax Forums

Logging data on SD

engineearengineear Posts: 4
edited 2013-07-06 15:02 in Propeller 1
Hello, I am new to the propeller chip environment.
I am logging data through I2c Sensors and writing the data to an SD card. I would like to log the data for an undefined period of time, is there a save as you go option or do i have to close the file safe it and append.
I am using the FSRW object to write the data to a CSV file.

Thanks

Peter

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-07-05 19:44
    The only built-in functionality is to close the file, then re-open it to append new data. Some people keep track of the date and time and incorporate that into the file name opening a distinct file each time. FSRW doesn't handle subdirectories, but Kye's SD card driver (available both through the Object Exchange and via an Application Note) does. You could create a new subdirectory for each date or month or whatever and populate that with further subdirectories and files depending on the amount and size of your log data.

    The advantage of breaking up a large file this way is that it's easier to organize the data since you can process discrete time periods' data without going through all of it.
  • HughHugh Posts: 362
    edited 2013-07-06 07:20
    I always thought that was what the 'pflush' method was for? I could be (and probably am) wrong...
  • Mike GreenMike Green Posts: 23,101
    edited 2013-07-06 15:02
    Nope, you're right and I was wrong. Sorry. 'pflush' indeed writes the current output buffer to disk and writes the current directory / FAT to disk if changed. I still like the idea of multiple output files organized by date and time or something similar.
Sign In or Register to comment.