Out of variable space?
techstudent
Posts: 21
I am working on a program that has 25 CONstants and 23 VARiables... The program has many elements including LCD, RTC, temp/humidity, and more.. I am getting the error msg "Out of Variable Space" I still have a way to go and may need up to 18 or so more variables before I am done.. My question is would adding more EEPROM help? or maybe linking two Basic stamps and dividing tasks between them? Thanks for any ideas....
techstudent
techstudent
Comments
Now, that memory can be VERY flexibly used, as bits, nibs, bytes, or words. Also, that memory can be 'reused' -- assign a couple of words as "temp" variables, and re-use them in subroutines.
Note that a "CON' declaration takes up no space in the BS2 -- basically that is a 'compiler directive', and when you use a CON variable in your BS2 code it's replaced with the constant value. So you can have LOTS of CON declarations.
One more thing you can do, is use READ/WRITE/DATA statements to store data in the 2K eeprom space. If you do that, you must be careful not to WRITE to the eeprom very often, because the eeprom only supports 1 million writes or so. This is a large number, but you can 'wear it out' with writing once a millisecond in about a week.
You COULD add an external SPI interfaced eeprom, and use SHIFTOUT/SHIFTIN to write and read it. That can be very slow, however.
Bottom line -- the "VAR" space is NOT expandable at all, nor is the "Code" eeprom space. Some BS2 'flavors' support multiple 2K byte EEPROM program "slots", if that seems helpful.
The first thing I would look at is reusing variables. Show us your code and we may be able to help.
You can add EEPROM. However, it is slow and has write limitations, so you can't use it as RAM per se. You can store data in it and retrieve it later, of course. With a write limit between 100k and 1M, if you are using it at any rate you will burn it's data storage. For example, one sample per second would be 86.4K uses per day.
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
thanks for the info
techstudent
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
~techstudent