Shop OBEX P1 Docs P2 Docs Learn Events
Parallax Memory Stick DataLogger — Parallax Forums

Parallax Memory Stick DataLogger

BeanBean Posts: 8,129
edited 2007-08-10 11:17 in General Discussion
Has anyone played around with this yet ?

When I open a file for writing and write some data it puts it at the end of the file. Okay that's cool.

But if I seek to the beginning of the file and write some data, the file gets truncated after the data I wrote. I'm wondering if that is normal, or am I doing something wrong ?

Bean.


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Teacher: What is the difference between ignorance and apathy ?
Student: I don't know and I don't care
Teacher: Correct !
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·

Comments

  • WhitWhit Posts: 4,191
    edited 2007-08-03 19:15
    Bean,

    Is this Parallax product similar to your SD Data Logger? Just kind of a different way of doing the same thing or is there more to it than that?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Whit+


    "We keep moving forward, opening new doors, and doing new things, because we're curious and curiosity keeps leading us down new paths." - Walt Disney
  • BeanBean Posts: 8,129
    edited 2007-08-04 15:35
    Whit, They are pretty much the same. The Parallax product uses a USB memory stick, and mine uses an SD memory card.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Teacher: What is the difference between ignorance and apathy ?
    Student: I don't know and I don't care
    Teacher: Correct !
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.hittconsulting.com
    ·
  • Mike GreenMike Green Posts: 23,101
    edited 2007-08-04 15:49
    Bean,
    I think the behavior you're seeing is normal for the current Vinculum firmware and, in fact, is how you're supposed to truncate a file (open in write mode, position somewhere, then close the file to truncate after the current position). There are no provisions for random updating yet.
  • BeanBean Posts: 8,129
    edited 2007-08-04 16:23
    Thanks, Mike. I even tried seeking to the write position, then doing the write, then seeking to the end before closing the file. But that didn't work either.

    Just for the record, my datalogger doesn't allow random write either.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Teacher: What is the difference between ignorance and apathy ?
    Student: I don't know and I don't care
    Teacher: Correct !
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.hittconsulting.com
    ·
  • DgswanerDgswaner Posts: 795
    edited 2007-08-09 06:17
    does the Parallax data logger allow for random writing? or does it function the same way?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    A complex design is the sign of an inferior designer. - Jamie Hyneman, Myth Buster
  • BeanBean Posts: 8,129
    edited 2007-08-09 11:36
    No, that is what this thread was started asking.

    When you seek to a certain position and perform a WRITE, the file is truncated after the
    data you write. Therefore you can only write data to the end of the file.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Teacher: What is the difference between ignorance and apathy ?
    Student: I don't know and I don't care
    Teacher: Correct !
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.hittconsulting.com
    ·
  • DgswanerDgswaner Posts: 795
    edited 2007-08-09 14:18
    my bad I thought you had a SD data logger not the parallax Version,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    A complex design is the sign of an inferior designer. - Jamie Hyneman, Myth Buster
  • UnsoundcodeUnsoundcode Posts: 1,530
    edited 2007-08-09 15:48
    It's not mentioned why you would want to insert text into a string/file but I know of·at least one instance·when you would want to do that and how to work around it.

    I had a small database on a Vdrive which I would access from a BS2. The database was an inventory of goods and some of the fields were variable like price and quantity.

    Each goods item had its own folder on the drive and each field was a seperate file. So if I wanted to adjust the price or quantity of an item for example I would simply address the path and overwrite the file Folder1/price.txt.....Folder2/price.txt .....Folder1/quantity.txt etc.

    When I wanted to view·a database entry I would loop through·a folder and debug each field to the monitor as one continuous string.

    A little more costly on disk space but it was never an issue for my application and access was very quick. I·feel·sure the same can be done with the SD logger and the Parallax logger (and probably has).

    Just an additional thought, using the method above would make a great·way·of mapping an area into a grid. Using a folder as x,y coordinates and the files within the folder containing terrain description. An option, maybe,·for those wanting to use mapping in their robot apps.

    Jeff T.
  • DgswanerDgswaner Posts: 795
    edited 2007-08-09 22:46
    your a mind reader or you've read my other post.... let me see if I understand so would I need to make a folder for every part of the grid or say one folder for ever column or row, or a folder for ever column and a sub folder for each row. each folder could contain several files for the info, I like that. I was wondering how to set up a single file to handle the changing data of map grid.
    well I'll be ordering one this week, so we'll see what happens.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    A complex design is the sign of an inferior designer. - Jamie Hyneman, Myth Buster
  • UnsoundcodeUnsoundcode Posts: 1,530
    edited 2007-08-10 05:51
    Hi Dgswaner, the mapping was just a thought but it would be interesting to see how it would work out. The way I was thinking was to predefine the structure of·a grid on the thumbdrive, creating each grid square as folder named by·a row letter and a column number. With only one file in·a folder the exit(s) from a square could be logged as a 4 bit binary number representing NSEW. So if the start square was the most south easterly the folder would be named A1, the file inside each folder could have the same name and be referenced by the Stamp easier. Say the file was named exit.txt , reading A1/exit.txt the contents could be 0110 (south and east no exit). Moving left one square the read becomes A2/exit.txt and the contents 0100.

    I am sure you have thought about this and thought of much betters ways to do the same thing. The directory structure is fast to access and although I havn't read the Parallax logger specs I have an idea it can support a 4G thumbdrive.

    sorry for getting off topic, but after starting with the short comings of writing randomly to a file a little discussion shows that the Parallax logger has more going for it than against.

    Jeff T.
  • BeanBean Posts: 8,129
    edited 2007-08-10 11:17
    Unsoundcode said...

    Each goods item had its own folder on the drive and each field was a seperate file. So if I wanted to adjust the price or quantity of an item for example I would simply address the path and overwrite the file Folder1/price.txt.....Folder2/price.txt .....Folder1/quantity.txt etc.

    A little more costly on disk space but it was never an issue for my application and access was very quick. I·feel·sure the same can be done with the SD logger and the Parallax logger (and probably has).

    The SD Data Logger does not support folders, so that method wouldn't work for it.

    It was designed to be only a data logger, and there is no code space left to add features [noparse]:([/noparse]

    Bean.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Teacher: What is the difference between ignorance and apathy ?
    Student: I don't know and I don't care
    Teacher: Correct !
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    www.hittconsulting.com
    ·
Sign In or Register to comment.