Shop OBEX P1 Docs P2 Docs Learn Events
Concurrent file operations using FSRW? — Parallax Forums

Concurrent file operations using FSRW?

HughHugh Posts: 362
edited 2013-04-30 23:24 in Propeller 1
Hi,

Ideally I would like to write to two files on an SD card concurrently. I'm a bit tight for cogs so can't afford to have two instances of FSRW, so I wondered whether it would be realistic to alternate between two files, closing and opening each in turn? If feasible, if this going to be too dependent upon the SD cards used?

Any thoughts appreciated,
Hugh

Comments

  • RaymanRayman Posts: 14,665
    edited 2013-04-30 03:39
    I believe FSRW will let you read from 2 different files or read from 1 and write to another.
    I think you can write to 2 files to, but maybe you have to make a minor change to the driver...
    If you look at the top of the fsrw file, there are some notes about this.
    I think you have to change some variables from being in a "DAT" section to being in a "VAR" section (or vice versa)...
  • Dave HeinDave Hein Posts: 6,347
    edited 2013-04-30 08:13
    FSRW allows for multiple open files at the same time by accessing them as separate objects. Just use something like this
    obj
      fsrw[2] : "fsrw"
    
    This will allow you to read or write 2 files at the same time. If you need more simultaneous opened file just increase the object array size.
  • Mike GreenMike Green Posts: 23,101
    edited 2013-04-30 08:40
    You cannot write to 2 files simultaneously from two different cogs. FSRW is not written to allow this.
  • Dave HeinDave Hein Posts: 6,347
    edited 2013-04-30 09:07
    Actually, you can use FSRW from different cogs, but you need to use a lock so they don't step on each other.
  • HughHugh Posts: 362
    edited 2013-04-30 23:24
    Thanks. I'll give it a go. Hugh
Sign In or Register to comment.