Shop OBEX P1 Docs P2 Docs Learn Events
Retrieving information from program — Parallax Forums

Retrieving information from program

milton hachemilton hache Posts: 6
edited 2009-03-30 22:30 in BASIC Stamp
Hello every one.

I would like to include in this Program a way to retrieve the program information after run time. Basically I would like to retrieve the data that was recorded in the program.

This is a program that reads the distance from a sonar device connected to the Basic Stamp2 and depending on the distance some switches are activated.

This program reads the distance of an object falling from a high altitude. I would like to retrieve the distances recorded by The Basic Stamp from the Sonar and the speed at what the object was falling.

This program so far detects the distance and activates the desire ouputs. The part that is missing is the retrieving information part. I started with a Read and Write commands to try to accomplish this goal.

In my program I named the variable that reads the distances (xDist). So I tried to start a Read and Write command base on the information provided by the (xDist) variable. I wonder if I am in right track.

I am also worry about some pauses in my code that make the reading of the sonar stop for a little while. This situation doesn’t affect the execution of the program to activate the selected outputs but I wonder if it does affect the final reading when I retrieve the program.

I have read the Syntax and reference manual but those programming instructions are beyond my programming skills. Any help leading me in the right direction to retrieve the program information after run time will be appreciated.

Thanks in advance.

Note: Program is being attached in my next·posting below.

Post Edited (milton hache) : 3/30/2009 10:36:08 PM GMT

Comments

  • Craig EidCraig Eid Posts: 106
    edited 2009-03-28 20:06
    Milton,

    I downloaded your code and did not see a WRITE or READ command. You can use the WRITE and READ commands to save data to the onboard EEPROM but note that this EEPROM is also used for program storage. A simple and low cost·solution·is to use a separate EEPROM·(an example is the Microchip 24LC128 - http://www.parallax.com/Store/Components/IntegratedCircuits/EEPROM/tabid/614/CategoryID/79/List/0/SortField/0/Level/a/ProductID/25/Default.aspx)·that has existing documentation and code examples.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ························ Craig Eid


    ··········· Triad Research and Development
    Electical Engineering Design and Consulting Services

    ··················· www.TriadRD.com
  • milton hachemilton hache Posts: 6
    edited 2009-03-30 22:30
    Greg you are right I downloaded·one of my·programs·with out the Write or Read command, my bad. Here is a program with what I tried to make of·a Read Write command. Thanks for let it me know.
    I looked at those example code but expressions like:
    I2COUT SDA, $A0,eeprom_add.HIGHBYTE\eeprom_add.LOWBYTE, [noparse][[/noparse]value].···
    I2CIN SDA, $A1,eeprom_add.HIGHBYTE\eeprom_add.LOWBYTE, [noparse][[/noparse]value].
    ·I don't understand very well.··I'll try to see if I can write something similar for my code but any guidance will be appreciated.
    Also I would like to know if my code some how will activate the outputs immediately or for some reason it will delay the activation of the outputs. We were doing some tests and if the sensor is moving to fast the outputs activate a little late. I commented out all the pauses to eliminate any delays in the loop. If there is any reason why the·outputs may delay to activate I would like to know to fix it.· I need those outputs to activate as soon as the: IF (xDist < a number) THEN, statement is reach.
    Thanks in advance for any inputs.
    ·
Sign In or Register to comment.