Loading external text file into BASIC Stamp
bob800
Posts: 2
Hello,
I'm trying to program a parallel EEPROM with my Basic Stamp 2. I've successfully written a single byte to the EEPROM and read from it via the Stamp, but the only way I could accomplish this was through a million hand-written "HIGH x" "LOW x" statements. Instead, I'd like to load a text file with the 0's and 1's pre-written (or, better, in hexadecimal, if that's possible).
As someone who only programs occasionally in C, I have no idea of how to accomplish this in BASIC. Any suggestions\examples would be greatly appreciated!
Thanks,
bob800
I'm trying to program a parallel EEPROM with my Basic Stamp 2. I've successfully written a single byte to the EEPROM and read from it via the Stamp, but the only way I could accomplish this was through a million hand-written "HIGH x" "LOW x" statements. Instead, I'd like to load a text file with the 0's and 1's pre-written (or, better, in hexadecimal, if that's possible).
As someone who only programs occasionally in C, I have no idea of how to accomplish this in BASIC. Any suggestions\examples would be greatly appreciated!
Thanks,
bob800
Comments
Using bunches of HIGH and LOW statements to set I/O pins uses a lot of the limited (2K) program memory available.
For loading text as part of a program, read the descriptions of the DATA and READ statements in the Reference Manual. The DATA statement will allow you to compile text strings or sequences of hex values into part of the program EEPROM and the READ statement will allow you to access this stored data. Remember that there's limited memory available and it has to be shared with the program itself. Other stamp models have larger EEPROMs that can be used for storing data. The BS2pe is the largest (16 x 2K = 32K).