SparkFun Forums 

Where electronics enthusiasts find answers.

Topics pertaining to the Arduino Core & software used with the Artemis module and Artemis development boards.
User avatar
By jbernard
#207988
I am trying to use a large array with the Artemis Arduino Core and when I define my array to have more than 255 elements (e.g a 256 element array of int), the code freezes up when it tries to use the array.

With 255 elements or less the code runs fine.

My guess is that the array structure is only allowing an 8 bit index for some reason. If so, has anyone found a way around the 255 array index limit?
Is there something else I may be missing?
Thanks,
jbernard
User avatar
By jbernard
#207989
Ooops!! - found the problem, my array index was using byte, changing this to int fixes the problem.
User avatar
By jbernard
#207999
Ok, I was able to make two 350 element arrays [one is float and one is int] (total of 2100 bytes).
But the code freezes up when I try to make larger arrays (e.g. 500 elements, with total size of 3000 bytes of RAM).
With its 384kB of RAM, the Artemis module should be capable very large arrays (at least to the limit of the compiler used in the background).
Anyone find a similar problem and or discover a solution?

Thanks,
-jbernard
User avatar
By jbernard
#208001
Update: if I define the arrays as global variables, I can make them large.
In previous post, the arrays were defined locally (within loop{}), and there appears to be a limit to the size of a locally defined array.
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum