Shop OBEX P1 Docs P2 Docs Learn Events
EEPROM read speed for BS2P40 — Parallax Forums

EEPROM read speed for BS2P40

Piper984Piper984 Posts: 74
edited 2005-08-02 14:10 in BASIC Stamp
I am currently using READ commands to get data from DATA statements loaded into the 2nd and 3rd program slots of a BS2P40. This is working fine. My question to all of you BS2 gurus out there is how 'slow' is the READ statement on a BS2P40? There is too much data to load into variable arrays, so I have to use the EEPROM. Like I said, it is working great for my application right now, but I'd like to know how far I can push this approach before I start to see a performance issue. My current program is reading one byte per main loop, but I'll need to retrieve 4 bytes of data per loop in the near future. Any performance issue doing this? Does anyone know how long it takes to retrieve one byte from EEPROM on a BS2P40?

Regards!

Chris

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-08-01 18:33
    Hello,

    ·· For the BS2 someone (Dr. Tracy Allen) has already figured this out.· For the BS2p, nobody that I know of has any real timing info.· But you can use the BS2 data and the differences between the chips to come close.· Tracy's website is at www.emesystems.com and includes a wealth of BS2 information.· I learn something everytime I go there!


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com


    Post Edited (Chris Savage (Parallax)) : 8/1/2005 10:36:27 PM GMT
  • Piper984Piper984 Posts: 74
    edited 2005-08-01 18:41
    Hi Chris,

    Thanks for the link. The BS2 data should help me guess how long the BS2P40 will take (using an average of the bs2:bs2p24/40 ratios of the other commands).

    Regards,

    Chris
  • dandreaedandreae Posts: 1,375
    edited 2005-08-01 22:38
    The BS2p (12,000 instruction per second on average)·is 3 times faster than the BS2 (4,000 instruction per second on average).

    Dave

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Tech Support
    dandreae@parallax.com
    Http://www.parallax.com

    ·
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2005-08-02 05:22
    Often the quickest way to get at questions like that is to ask the Stamp directly. First run a loop like this:

    PAUSE 2000
       HIGH led
         FOR idx=0 to 10000
         NEXT
       LOW led
    



    so that you can observe the led and time the interval taken by 10000 iterations of the FOR-NEXT loop on a stopwatch. My guess would be around 7.5 seconds on a BS2, or around 2 seconds on a BS2p.

    Then insert a READ in the loop:

    PAUSE 2000
       HIGH led
         FOR idx=0 to 10000
            READ idx,myByte   '<--- instruction to be timed
         NEXT
       LOW led
    



    and time it again. It will be longer. Subtract the first time (FOR-NEXT without READ) from the second time (same but with READ), divide by 10000, and that gives you approximately the time it takes the Stamp 2p to execute one READ. Another way to do it is with an oscilloscope or pulse measurement device (such as another Stamp!), measuring the time it takes to execute a READ sandwiched between two externally visible output commands.

    READ is a relatively slow command, about 550 microseconds on a BS2, and around 200 microseconds on a BS2p. It makes sense that READ is relatively slow. The processor must save ithe interpreter program pointer, then readdress and retrieve data from a different position in the eeprom, and then restore the interpreter program pointer.

    An aside, WRITE is very slow, as it takes as much as 6000 microseconds to write one byte.

    Another pointer, GET from the scratchpad RAM is quite a bit faster than READ.

    If you have to read or write blocks of data (such as your 4 at a time), it can be faster with an external I2C or SPI eeprom, because you can read and write blocks of memory in one I2CIN or one SHIFTIN command.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Piper984Piper984 Posts: 74
    edited 2005-08-02 13:23
    Dave, Tracy, Chris, et all,

    Thanks for the follow up information. You have given me enough data to move forward with 'eyes wide open' since stacking the READs can add almost 1 ms to my loop. Should I start to have an issue with this delay, I'll look to source an external eeprom.

    Best regards!

    Chris
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-08-02 14:10
    Told you he had a wealth of information!· =)· Thanks Tracy!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.