Shop OBEX P1 Docs P2 Docs Learn Events
newbie having trouble writing and reading to eprom — Parallax Forums

newbie having trouble writing and reading to eprom

HBROWNHBROWN Posts: 2
edited 2005-11-05 06:34 in Learn with BlocklyProp
Anyone please help.· I am currently using a AD592 to take temperature measurements and am getting adequate readings however when I go back to retrieve data prior data changes to more current data before I can retrieve it.· Any ideas????

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-11-04 06:41
    HBROWN -

    My guess is that the PAUSE in the WriteMemory routine is killing you, timewise:

    ·WRITEMEMORY:
    FOR LOCATION = 0 TO 2
    LOW 0
    PAUSE 5
    RCTIME 0,0, RCT
    TEMP=RCT
    WRITE LOCATION, TEMP
    PAUSE 5000· '<<
    Change this PAUSE
    NEXT
    RETURN

    I see no requirement for a PAUSE after a WRITE command in the PBASIC Help File, and if the wait is designed to PAUSE after the latest RCTIME command, it needn't be any longer than the others, presuming they are sufficiently long as they are presently coded. Therein, change the

    PAUSE 5000

    to (say)

    PAUSE 500

    or even something·less. That should add substantial speed to your progam. There are other possible areas where speed might be gained, but let's start there first to see if that gives you·the execution speed increase·you seem to be requesting.

    You may also want to look carefully at:

    WHAT you are storing in the various EEPROM locations,
    WHERE you are storing it,
    HOW you are storing it and·lastly,
    WHY you are storing it when you are.

    I have a sneaking suspicion that you're not doing what you think you are, although I certainly don't know from the program what the exact goal is. Remember also that a "wild" STORE can ruin your whole day by overwriting the USER PROGRAM AREA with USER DATA!

    P.S. I'm not trying to nitpick, honestly. You may want to change your references to "Kalvin" to read "Kelvin" if it is Kelvin Termperature you're working with, just for understandability, and the future reference of others.

    Regards,

    Bruce Bates
  • HBROWNHBROWN Posts: 2
    edited 2005-11-04 16:04
    thank you I appreciate the responce. What I'm actually tring to do is get a sample program that I can test and ensure it is working properly then I will have to change it slightly so I can take temperature measurements every 10 minutes for a 12 hr. period then conect the stamp back to a PC and retrieve the data therefore I am eventually going to have to change the pause in the writememory routine to be 10 min long

    Thanks,
    heather
  • edited 2005-11-05 06:34
    Hi Heather,

    There are two Stamps in Class books with example programs you can try.· Both are available for download from www.parallax.com -> Downloads -> Stamps in Class Tutorials:·
    1. Chapter 7, Activity #3 in What's a Microcontroller datalogs light readings with one program and sends the readings back to your PC with a second program.· You can actually replace the RCTIME command in Activity #3's first example program with the one you're using to measure temperature, and the whole system should work.· Start with the raw values before attempting to incorporate all that temperature conversion code.· Alternately, you might be able do the temperature conversion in a spreadsheet after you have the BASIC Stamp send the logged data to the PC.
    2. Applied Sensors has numerous datalogging examples, starting with temperature datalogging with the DS16204 temperature sensor in Chapter 2, and there are some examples with the AD592 starting in Chapter 3.· Tracy Allen, the author of Applied Sensors, develops and deploys custom environmental and datalogging stations all over the world.· You will learn a lot going through his book.

    Regards, Andy
Sign In or Register to comment.