EEPROM read speed for BS2P40
Piper984
Posts: 74
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
Regards!
Chris
Comments
·· 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
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
Dave
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dave Andreae
Tech Support
dandreae@parallax.com
Http://www.parallax.com
·
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:
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
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 Savage
Parallax Tech Support
csavage@parallax.com