View Full Version : Program size and large vectors
Two questions about memory.
Q1: Is there any way to tell how large my program is?
Q2: Unable to make 3 arrays.
Two of the vectors are 32 bit floats.
The other is of type 16 bit.
Each array is about 800 elements of their
data type in size.
The compiler goes nuts after the firts line of the following
code:
FVARIABLE LATDAT DECIMAL 800 ALLOT EEWORD
FVARIABLE LONDAT DECIMAL 800 ALLOT EEWORD
VARIABLE UTC DECIMAL 800 ALLOT EEWORD
SAVE-RAM
\ *****************
Arrays are written to 1 location per second,
so their is no need to load all 3 arrays in RAM. (??)
Any suggestions?
Thanks
nmitech
05-25-04, 11:27 AM
Is there any way to tell how large my program is?
AVAIL U. ( return the available data ram size
PAVAIL U. ( return the available program ram size
EEAVAIL U. ( return the available data flash size
PFAVAIL U. ( return the available program flash size
Each array is about 800 elements of their data type in size.
COLD
IsoMax V0.6
DECIMAL AVAIL U. 1465 OK
The user data ram available is 1465 words. Each float takes two words. So it will not even fit one array.
The compiler goes nuts after the firts line of the following
code:
FVARIABLE LATDAT DECIMAL 800 ALLOT EEWORD
Yes, you allot more RAM than exists, so there is no room for the language to work anymore. So to fit your application, you need an IsoPodX instead.
If I have enough rom, can I reserve a rom block
knowing the top adress and increment the adress??
nmitech
05-26-04, 10:36 AM
Two comments.
1. FVARIABLE LATDAT DECIMAL 800 ALLOT won't work, because ALLOT works in 16-bit words and not in 32-bit floats. So, this will allocate 800 words, which is only enough room for 400 floats.
2. On the standard IsoPod there are 2048 words of Flash data ROM available to the user (in addition to the 1465 words of data RAM). The next available address ("top address") is kept in the variable EDP. You can allocate Flash data ROM by incrementing EDP. For example, you could define
: EEALLOT ( n -- ) EDP +! ;
To write data to this space you need to use the words EE! and EEC! . There is no EE equivalent to F!, so you'll need to write a word that stores a float into two words of Flash. (You can do this by storing to RAM with F!, and then copying those two words from RAM to Flash.)
Note, however, that this is not true EEPROM. You can't rewrite a given Flash location. To store new data in Flash, you need to erase it with EEERASE. You must supply an address to EEERASE, and it will erase ALL 256 WORDS in that Flash "page". For example, if you say
HEX 1923 EEERASE
it will actually erase all locations $1900 to $19FF. (The low 8 bits of the address you supply to EEERASE are ignored; the high 8 bits specify the Flash "page".)
To read data in Flash you can use @ and C@, and even F@ if the data was stored in the same word order as in RAM.
Even with the Flash data ROM, though, there simply isn't room for the 4000 words of data you're trying to store. For this application you really need a ServoPod, which has twice the RAM and twice the Flash, or an IsoPodX which has additional RAM.
vBulletin v3.0.7, Copyright ©2000-2012, Jelsoft Enterprises Ltd.