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

DAT on SD

dondedonde Posts: 51
edited 2009-12-07 19:58 in Propeller 1
Can I move data, that is now on the DAT block, onto an SD card, and then access it from from the program? I have gone through test reading a file OK an a SD using fsrw. Have no idea how to get to the data on the SD. I'll keep "ftable" symbol on the DAT block, and just move the stuff to the right.
donde

DAT
ftable byte SUNNY_IMG_ID, "Clear", "|"
byte CLOUDY_IMG_ID, "Cloudy", "|"
etc

Comments

  • MagIO2MagIO2 Posts: 2,243
    edited 2009-12-07 07:45
    May I suggest to have a look at the virtual memory thread?!

    There is a test program showing how to move the data from dat into swap.sys and back for usage.
  • CassLanCassLan Posts: 586
    edited 2009-12-07 13:59
    donde,

    I am unclear what your goal is....is it

    A) To move the data from DAT into a file during your program?

    B) To move the data into the file so that it doesn't have to be in DAT at all?

    or some combination of these?

    Rick

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    NYC Area Prop Club

    Prop Forum Search (Via Google)

    ·
  • dondedonde Posts: 51
    edited 2009-12-07 16:16
    The program is a weather station I'm working on. Just about out of RAM/EEPROM to add anything. There are 10's of weather statements in DAT. Many are never used, but still would like to retain them. The program accesses one or two in DAT during weather update. A memory pointer system is used. A pipe delimited stream of data is sent from WeatherBug and the program parses it. It matches a pointer to the weather statements in DAT. I would like to move this data, now in DAT onto an SD card and read it like it is in the DAT block. I can write the DAT data to the SD by using my PC. But during run time, not sure how to get the program to read the data on the SD, and consider it a DAT block.
    donde
  • Mike GreenMike Green Posts: 23,101
    edited 2009-12-07 16:39
    You can't do it the way you want. The SD card routines currently in the Object Exchange don't have a SEEK routine and they're pretty large. You already have a memory problem. There are ways to open a file, get the address of the file on the SD card, then use that for random access using the low-level SD card driver, but there's a simpler solution.

    You didn't say what kind of Prop board you're using. If you're using a Protoboard, you already have another 32K of EEPROM that's not being used and you could write an initialization program that's run once from RAM and simply initializes the 2nd 32K of EEPROM with the DAT tables that you're currently using. Your program could then read the tables from EEPROM as it needs them. Your initialization program would add a pointer table to the beginning of the EEPROM that would contain the EEPROM addresses of the weather statements in the EEPROM. The easiest and smallest object to use for reading and writing EEPROM would be "Basic I2C Driver". That has routines for reading and writing bytes, words, longs, and blocks of memory given an address in the EEPROM.

    If you're not using a Protoboard, you may be able to replace the EEPROM with a larger one or add an additional EEPROM to I/O pins 28/29 or some other pair of I/O pins.
  • rokickirokicki Posts: 1,000
    edited 2009-12-07 16:59
    The current release of fsrw (which is in the forums, but not yet in the Obex) does indeed have read seek.
  • dondedonde Posts: 51
    edited 2009-12-07 17:33
    Mike,

    I have a PropModule, which indeed has a 512K EEPROM (64K). I never thought of how to use the rest till now. How do you initialize the 2nd section? I have tried the Basic I2C Driver a while back, but did not connect the dots for the memory problem in the current project. Now, I hope to apply this I2C object to put data in the other 32K.

    By the way the keypad plus encoder works great to input any ZIP and get weather.
    Thanks, donde
  • Mike GreenMike Green Posts: 23,101
    edited 2009-12-07 17:47
    The EEPROM is just 64K bytes of memory with addresses from $0000 to $FFFF. The 2nd half ($8000 to $FFFF) is completely unused.

    The comments at the beginning of the Driver show how to use it to read and write EEPROM data.

    For initialization, you're just going to make another program that's downloaded to RAM for execution. This program contains your tables in DAT form and a small program (a simple loop would do) that writes the DAT tables to the EEPROM starting at location $8000 using the Basic I2C Driver.

    To simplify the EEPROM use, you might want to include an address table at the beginning of the DAT information like:

    DAT
    table word entry1-table, entry2-table, 0
    
    entry1 byte "some text",0
    entry2 byte "more text",0
    



    Each word has the offset from the start of the table to the start of the string. The last table entry is zero to mark the end of the table.

    Post Edited (Mike Green) : 12/7/2009 5:53:04 PM GMT
  • RaymanRayman Posts: 14,876
    edited 2009-12-07 17:59
    Anybody know how the read rate from EEPROM compares to SD (FSRW 2.4)?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2009-12-07 18:18
    Rayman said...
    Anybody know how the read rate from EEPROM compares to SD (FSRW 2.4)?
    The basic I2C driver will be quite slow due to being written in SPIN. I think it takes about 4 seconds to write the entire 32K of memory space (if you have a pre-filled buffer). Though there are PASM I2C drivers on the Obex.
    FSRW at least has portions of PASM that it uses, so I would imagine it would be much faster than the basic I2C driver.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    April, 2008: when I discovered the answers to all my micro-computational-botherations!

    Some of my objects:
    MCP3X0X ADC Driver - Programmable Schmitt inputs, frequency reading, and more!
    Simple Propeller-based Database - Making life easier and more readable for all your EEPROM storage needs.
    String Manipulation Library - Don't allow strings to be the bane of the Propeller, bend them to your will!
    Fast Inter-Propeller Comm - Fast communication between two propellers (1.37MB/s @100MHz)!
  • dondedonde Posts: 51
    edited 2009-12-07 18:22
    Thanks Mike. Think have enough to get started. May call you again.
    donde
  • dondedonde Posts: 51
    edited 2009-12-07 18:30
    To Bobb
    In my case, I'll only be periodically reading a short string or two from DAT on the 2nd half of the 64K EEPROM.
    donde
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2009-12-07 19:58
    Have you looked at Simple Propeller-based Database? I don't know if it is too robust for your specific applications, but it contains methods to read and write strings to/from EEPROM (at any location, like on the second half of a 64K EEPROM) and takes into consideration the EEPROM's blocks (or whatever you call them), thus allowing extremely long strings.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    April, 2008: when I discovered the answers to all my micro-computational-botherations!

    Some of my objects:
    MCP3X0X ADC Driver - Programmable Schmitt inputs, frequency reading, and more!
    Simple Propeller-based Database - Making life easier and more readable for all your EEPROM storage needs.
    String Manipulation Library - Don't allow strings to be the bane of the Propeller, bend them to your will!
    Fast Inter-Propeller Comm - Fast communication between two propellers (1.37MB/s @100MHz)!
Sign In or Register to comment.