More Memory
EMPTY_C
Posts: 29
Hey all,
···· I am trying to save data that is coming from the BS2 chip onto an external eeprom such that i can read the data later...·i was wondering if there was some well written and understandable code such that i can program it to work?
···· I was also wondering if it were possible to use an external eeprom to store my code on and run.· Lets say i run out of room on the chip is it possible to just have it read the code from the external chip? (if i had more $ i would buy a better stamp but all i am stuck with right now is the BS2)
Thanks
MT
···· I am trying to save data that is coming from the BS2 chip onto an external eeprom such that i can read the data later...·i was wondering if there was some well written and understandable code such that i can program it to work?
···· I was also wondering if it were possible to use an external eeprom to store my code on and run.· Lets say i run out of room on the chip is it possible to just have it read the code from the external chip? (if i had more $ i would buy a better stamp but all i am stuck with right now is the BS2)
Thanks
MT
Comments
And no, you can't expand internal eeprom -- the BS2 run-time only knows about 2KBytes at a time. 'Bigger' BS2's have multiple 2K 'pages' you can use with the "RUN" keyword.
You can't really use external EEPROM for storing programs. Theoretically, you could copy code from external EEPROM to the internal EEPROM for execution, but it's a very slow process and only works on the Stamps with several "banks" of program memory (called "slots"). Even with the Stamps with more memory, you're still limited to 2K bytes per "slot".
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
MT
Yes, you CAN read and write data from external eeprom, but you can't effectively execute them.
The BS2 runs using a "PBasic" run-time interpreter, with tokens kept in eeprom. The run-time interpreter is hard-coded to know what to do with 2k of external eeprom -- that's about it.
So, bottom line, if you want to use the PBasic run-time, you're limited to those 2K byte pages.
Writing data to an EEPROM takes about the same time (roughly 5ms per byte). There are some speedups where you can write more than one byte at a time to a buffer in the EEPROM, then commit it to the memory array. The buffers vary from 64 to 256 bytes in size depending on the EEPROM capacity and the manufacturer and the whole buffer gets written at once (in roughly 5ms).
Reading is faster, limited by the I2C serial protocol and the execution speed of the program being used. The Stamp Manual gives some I2C speeds for those Stamps that have I2C statements built-in (like the BS2p/pe/px). For the others, you'd have to figure out the subroutine execution speed yourself.