Shop OBEX P1 Docs P2 Docs Learn Events
Edit DAT — Parallax Forums

Edit DAT

dondedonde Posts: 51
edited 2009-10-22 03:41 in Propeller 1
I would like to edit a DAT block with numbers in it, during run time. The numbers are a string. Then reboot, using the new numbers. Is this possible at all?
donde

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-10-20 22:30
    Yes, it can be done. Your program will have to write the new numbers back to EEPROM before you reboot.

    -Phil
  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-20 22:57
    Download "Basic I2C Driver" from the Propeller Object Exchange. You can use the routines in that to write your numbers to the EEPROM.
  • dondedonde Posts: 51
    edited 2009-10-21 00:14
    Mike, I can't use the 12C for using the PropModule and has both SCL and SDA pulled up with 10K. And I guess I don't want to cut the trace. And, I really don't know how to use the 12C driver. Is there any other simple way to address the EEPROM and change the data numbers, during run time, and then reboot (re-compile)? I know the address of the data numbers on the EEPROM, using View Info.
    donde
  • StefanL38StefanL38 Posts: 2,292
    edited 2009-10-21 06:33
    As the EEPROM is an I2C-device you have to use any kind of code doing the bitbanging according to the I2C-specs.
    Only other way I can think of (VERY crippled way to do it):
    keep the prop connected to your PC send the numbers you want to change to the PC
    comunicate between the terminalprogram and propellertool to paste the new numbers into sourcecode
    and load up to propeller-chip again. Like already mentioned very crippled way to do so.

    best regards

    Stefan
  • BradCBradC Posts: 2,601
    edited 2009-10-21 07:04
    donde said...
    Mike, I can't use the 12C for using the PropModule and has both SCL and SDA pulled up with 10K. And I guess I don't want to cut the trace.

    If you can't use the I2C due to a pair of pull up resistors, then how does the Propeller load it's program when you start it up?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    lt's not particularly silly, is it?
  • dondedonde Posts: 51
    edited 2009-10-21 19:55
    No, the pullups are there. That's not the point. The Basic12C Object info says they should not be there. But, reading further, I see it says most of the time pullups can be left connected, especially for the type EEPROM used with the Propeller Demo or PropModule. So, I'm going to go ahead and use the Basic 12C Object to do what what my question was.
    donde
  • photomankcphotomankc Posts: 943
    edited 2009-10-21 20:24
    I don't see how the pull-ups could hurt. The danger with basicI2C is if the other device clock-stretches since basicI2C drives the clock line low AND high and if another device holds the line low when the Prop goes on it's merry way and flips the line high then you have a short. That is not the case for the EEPROM. Really BasicI2C is dead simple to use.
  • Bobb FwedBobb Fwed Posts: 1,119
    edited 2009-10-21 20:30
    As I am unclear as to how your program is setup to operate, if you are just trying to store values to and from EEPROM, a possibly easier way to do it (if the DAT section is not required) is this: Memory Storage Management. It acts like a simple database system to store and recall values from the EEPROM. The first time you run the program, you could have the DAT values stored to the database, then after they are stored, they can just be accessed from the database directly (even after reboot). All the storage protocols are worked out for you.

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

    Some of my objects:
    MCP3X08/4 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 make strings the bane of the Propeller, bend them to your will!
  • dondedonde Posts: 51
    edited 2009-10-21 23:14
    Bobb
    Thanks for your idea to use Memory Storage Management object. My program has to use the DAT block. I only need to write 5 numbers as a string to the EEPROM. The numbers replace what was there before. I know the start address of the EEPROM where the numbers reside. This only happens upon my request, and very infrequently.
    So, I think I'll first try the Basic 12C object, and see what happens.
    donde
  • JamesxJamesx Posts: 132
    edited 2009-10-22 03:41
    I was just looking at some old posts about this issue earlier today. It's been done, and it's well described. I got some good ideas and a download from a thread called "EEPROM Datalogging and I2C" from 9/07.

    http://forums.parallax.com/forums/default.aspx?f=25&m=219237

    It's actually part of a sticky thread about Education Kits at the top of the forum.

    Jim C.
Sign In or Register to comment.