Shop OBEX P1 Docs P2 Docs Learn Events
reading data stored onto a BS2 — Parallax Forums

reading data stored onto a BS2

agentileagentile Posts: 101
edited 2004-12-05 01:33 in BASIC Stamp
Hello,
· I am trying to use a pair of·BS2's to send and receive data transmitted across phone lines.· In order to find out if the data has been sent, I need to read the memory map of the receiving BS2.· It seems that in order to read the memory map, I have to first put a program onto the stamp.· And if I do this, I will over-write the EEPROM, where the data is stored.· Is there a way to read from a stamp without loading a program onto it?

thanks
Andrew

Comments

  • K de JongK de Jong Posts: 154
    edited 2004-11-27 17:40
    Hi Andrew,

    The program is located from the top of the EEPROM (0xFF) down and data are stored bottom up. So as your program and data grow they come more and more together. Finally your data overwrites part of the program. But then you have a considerably large program or a huge amount of data smile.gif.

    Normally it should be not a real problem.

    Regards,

    Klaus
  • gremlingremlin Posts: 6
    edited 2004-11-28 16:03
    Here is what I did in my application.· I wanted to build a simple data logger using the on board BS2 EEprom. I divided the program into two parts, data collection and data dump. In the beginning of the program, ·I start a 5·sec timer,during that time I·check to see if· a line is low ( a button press) if line is high go on to data collection. I line is low, skip the data collection and go to the data dump part of the program.
  • agentileagentile Posts: 101
    edited 2004-11-28 18:58
    gremlin,
    ·This is very similar to a (or several) project(s) I am working on.· Okay, so you have the stamp set up in some remote (away from the PC) location.· The stamp is sampling data for a few minutes, and it stores the data in eeproms 0 through 50.··Now I want to go put the stamp on the computer and read what is stored at those eeprom locations.· If I use a data dump section of my program, I am still away from my computer, and so I would have to reset the program to have it run while hooked up to the computer.· And, in resetting the program, I would overwrite my stored data.· How do I get my data off of the stamp without reprogramming the stamp?· Or, does it matter if I reprogram?

    thanks,
    agentile
  • allanlane5allanlane5 Posts: 3,815
    edited 2004-11-29 21:47
    What he is recommending is that you have a pin on your stamp. Wired high, your stamp acts as a data logger. Wired low, your stamp takes its logged data and sends it out the serial port (to your PC, we assume).

    So, you put your BS2 in the field, with this pin wired high. You log some data.

    You now take your BS2 to your PC. You wire the pin low, start up your PC, then start up your BS2. It sends the logged data to your PC.

    Your EEPROM is only erased when the PC *programs* the stamp. Not when it is 'reset'. So if you have a little:
    · MyEprom VAR BYTE
    · MyAddr VAR BYTE
    · EpromLast CON 50

    · MyAddr = 0
    · WHILE MyAddr < EpromLast
    ··· READ MyAddr, MyEprom
    ··· SEROUT 16, 16384, DEC MyEprom
    ····MyAddr = MyAddr + 1
    · WEND

    then this will 'dump' the EEPROM data from 0 to 50 to your PC.
  • sryansryan Posts: 6
    edited 2004-12-05 01:33
    agentile,

    gremlin's solution is certainly the best, but you can use the DATA statement to reserve EEPROM addresses without writing to them during download. For instance,

    *************************
    'Datalogger program:
    DATA 0 (100) 'clears first 100 bytes of EEPROM memory on download (not powerup!)
    'Other data statements, etc...

    Main: 'Datalogger program follows...

    *************************
    'Datadumper program:
    DATA (100) 'skips first 100 bytes of EEPROM memory on download, thus preserving any data already there
    'Other data statements, etc...

    Main: 'Datadumper program follows...

    *************************

    Check the Programmer's Ref Manual DATA statement for more info.
Sign In or Register to comment.