Shop OBEX P1 Docs P2 Docs Learn Events
How to implement the SD card object? Where to even begin using it? — Parallax Forums

How to implement the SD card object? Where to even begin using it?

ElectricAyeElectricAye Posts: 4,561
edited 2008-08-27 20:40 in Propeller 1
I've been contemplating storing data on an SD card and I have downloaded the highly acclaimed SD card object from the Object Exchange (Thank you, rokicki) and I have studied it for several hours. I have read general descriptions on how SD cards do what they do. And I have approached Oneness with Spin and all its glory. Problem is, I still can't figure out how to actually use the SD card object. I mean, I know this sounds utterly stupid, but where do I plug in my data so it goes to the card?

Let's assume I have a bunch of variables, some of which contain integers, others that contain decimals, and maybe some others that have things like a date stored in them. For example, let's call them

Decimal1, Decimal2, Decimal3
IntegerA, IntegerB, IntegerC
Date2, Date7, Date8

So what methods do I call in which of the many objects that are listed in the SD card object? Frankly, I can't even tell which of the versions is the "beginning"... if there is such a thing. And I have yet to learn (choke) assembly language so... I know I'm exposing myself here, how shallow my knowledge of everything Spin is. But a concrete example of how this SD card object is actually employed would really help clear the fog from my brain... I hope*.

many thanks,
(and desperate as usual)
Mark

*At least insofar as SD cards are concerned. smile.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
It might be the Information Age but the Eon of Ignorance has yet to end.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-08-27 02:52
    Download DongleBasic and look at the modified version of Rokicki's routines called BB_massStorage.spin. This includes the usual display / output device methods (dec, hex, bin, out) and a getByte method. The DongleBasic routines also use a different low level I/O package that supports I2C and SPI in one cog and BB_massStorage supports named 32K EEPROM files if you have more than 32K of EEPROM (like on the Protoboard or Hydra).

    The formatted output methods are really simple and you can adapt them easily to Rokicki's routines as provided in the Object Exchange.
  • ElectricAyeElectricAye Posts: 4,561
    edited 2008-08-27 03:08
    Oh, Mike, thank you! Thank you!
    I will definitely look into this. The sooner I get my SD cards up and running, the sooner I can finish my photon pulse height analyzer and get on with more important things, like The Cow Compass Challenge!


    smile.gif
    Mark

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    It might be the Information Age but the Eon of Ignorance has yet to end.
  • ElectricAyeElectricAye Posts: 4,561
    edited 2008-08-27 05:04
    I found this document concerning the general operation of SD cards

    http://www.sdcard.org/about/memory_card/pls/Simplified_Physical_Layer_Spec.pdf

    I suppose it might be of use to somebody who already knows how they work.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    It might be the Information Age but the Eon of Ignorance has yet to end.
  • Ron SutcliffeRon Sutcliffe Posts: 420
    edited 2008-08-27 09:55
    The zip file should point you in the right direction.

    ·I am surprised that it is not included in the OBEX SD stuff.

    The test file demonstrates a write file (writes 300 "R" ) to file. Re_opens the file and reads the file back.

    It also demonstrates a simple file listing

    Ron




    Post Edited (Ron Sutcliffe) : 8/27/2008 10:22:43 AM GMT
  • ElectricAyeElectricAye Posts: 4,561
    edited 2008-08-27 13:00
    Thanks, Ron, I'll work on this today. I really appreciate your helping me out.

    cheers,
    Mark

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    It might be the Information Age but the Eon of Ignorance has yet to end.
  • ElectricAyeElectricAye Posts: 4,561
    edited 2008-08-27 14:43
    Thanks to those who have pointed me to all the code concerning SD cards. But I guess what I'm looking for is something that explains in english what the code is doing and how it gets incorporated into a larger data acquisition program. I've scoured the web in search of a dummies guide to FAT16 and so forth, but I haven't found anything dumbed down enough for me to get a handle on. I'm guessing that this sort of file stuff is something EE's are so familiar with that they can't understand why it's not intuitively obvious to the most casual of observers. Perhaps my part of the human genome that would normally have the ability to work with file systems got hit by a cosmic ray when I was but a mere gamete, and so I'm forever blind to all things FAT and thus lost in the thinness of a perfect vacuum, stark, dark and dataless.


    sad.gif
    Mark
  • Mike GreenMike Green Posts: 23,101
    edited 2008-08-27 15:07
    You need to buy Andre's SD expansion card so you get his book on SD cards which comes on the CD with it.
    www.parallax.com/Store/Microcontrollers/PropellerProgrammingKits/tabid/144/CategoryID/73/List/0/Level/a/ProductID/505/Default.aspx?SortField=ProductName%2cProductName

    You could use the expansion card with other Propeller boards since it just provides an EEPROM (128K bytes) and the usual SD card connections. The book itself is worth the price.

    Post Edited (Mike Green) : 8/27/2008 3:13:12 PM GMT
  • ElectricAyeElectricAye Posts: 4,561
    edited 2008-08-27 16:32
    Mike Green said...
    You need to buy Andre's SD expansion card so you get his book on SD cards...

    Well, I guess I'll have to break down and do just that. But if my photon counting system starts playing Doggy Kong with itself, my suspicions of a conspiracy here will be immediately confirmed.

    thanks for your help again,
    Mark smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    It might be the Information Age but the Eon of Ignorance has yet to end.
  • simonlsimonl Posts: 866
    edited 2008-08-27 20:40
    Hi Mark,

    Please see my example code in your other thread on this topic (http://forums.parallax.com/showthread.php?p=746324)...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheers,

    Simon
    www.norfolkhelicopterclub.co.uk
    You'll always have as many take-offs as landings, the trick is to be sure you can take-off again ;-)
    BTW: I type as I'm thinking, so please don't take any offense at my writing style smile.gif
Sign In or Register to comment.