Shop OBEX P1 Docs P2 Docs Learn Events
sd card read-modify-write back. possible? — Parallax Forums

sd card read-modify-write back. possible?

giannissamgiannissam Posts: 22
edited 2009-03-17 11:39 in Propeller 1
Hi all.
I've been searching the forum for some days and i cant find a way to read a file from an sd manipulate it and write it back to sd.
Porthos os says it can copy files but i cant see the "copy" routine in the spin code nono.gif
is there a way to do it?
thanx in advance.

Post Edited (giannissam) : 3/10/2009 10:43:53 PM GMT

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-03-10 21:37
    Read-Modify-Write doesn't isn't really read/write at the same time. Your subject is a little misleading. =)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • giannissamgiannissam Posts: 22
    edited 2009-03-10 21:43
    Sorry. i changed it.
  • mctriviamctrivia Posts: 3,772
    edited 2009-03-10 22:10
    check out http://obex.parallax.com/objects/92/ I have used this with great suces reading files off uSD cards on my modules. I know it can write also just have not played with that yet

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Need to make your prop design easier or secure? Get a PropMod has crystal, eeprom, and programing header in a 40 pin dip 0.7" pitch module with uSD reader, and RTC options.
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-03-10 22:16
    Here's a thread with a little tutorial that might help too

    http://forums.parallax.com/showthread.php?p=747794

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Check out: Protoboard Introduction , Propeller Cookbook 1.4 & Software Index
    Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us
    Got an SD card connected? - PropDOS
  • giannissamgiannissam Posts: 22
    edited 2009-03-16 23:57
    hello again.
    i tried to make a file-copy program (attached).
    Steps:

    1. Read the source file character by character.
    2. Save each character temporarily in a variable (read_buf)
    3. Close the source file
    4. At the first time open the target file in write mode and then append mode. Each time writing the read_buf contents.

    Good thing: it works for small text files
    Bad thing: you better make plans for the next week (or perhaps a month) before trying to copy more than 5Mbytes

    I tried to copy a wav file (windows xp start up sound) in mono (about 212Kb) and it took several hours to copy 14Kb

    thinking to make read_buf bigger (to store more characters) in order to have less openings and closings of files.

    Any ideas?
    can "Pread" and "Pwrite" routines be used for my perpose?

    thx in advance.
  • Harrison.Harrison. Posts: 484
    edited 2009-03-17 00:47
    Try using the modified fsrw object I posted here: http://forums.parallax.com/showthread.php?p=751612.
  • RaymanRayman Posts: 15,392
    edited 2009-03-17 01:12
    Nice one Harrison! I was hoping someone would tackle the multiple files from SD problem...
  • giannissamgiannissam Posts: 22
    edited 2009-03-17 11:39
    Can you please give me some info for your code?
    what does Fullduplexserial do?
Sign In or Register to comment.