Hello,
I'm trying to use large arrays of data on a Atmega8515 but it doesn't seem to work. Those arrys are passed to a function. Is there a better way to do it.
I'm using the avr-gcc compiler.
Hello,
I'm trying to use large arrays of data on a Atmega8515 but it doesn't seem to work. Those arrys are passed to a function. Is there a better way to do it.
I'm using the avr-gcc compiler.
Depending on where the arrays are declared they could be global and would be seen by the function (ie: if they are declared outside main(). If you have them declared within
main(), then you should be able to just pass a pointer.
Dave
What's not working?
Could we see a code fragment?
/A
...If you have them declared within main(), then ...
... a large array could very well cause stack problems.
Lee
Your internal SRAM is 512 bytes. How large is your large array?
The problem ios exactly that. The large array is 256 bytes and i think it is messing up the stack.
what can be done to avoid it?
The problem ios exactly that. The large array is 256 bytes and i think it is messing up the stack.
what can be done to avoid it?
Either use a bigger device or less data. :wink:
I don't know offhand if the mega8515 allows you to attach external memory, but that's usually another route.
What are you using the data for?
Hi there,
I am facing the same problem. Need an Array of 512 variables. To sample a analog signal of 15 ms long. (240 samples)
Letting the ADC sample and store in an Array, and later write it to EEPROM. Note that the whole thing works for Arrays under the 110.
Using a Atmega32 with 2048 bytes SRAM.
Declaring the array as followed:
unsigned char ucArray[512]; in the global variables.
With 110 i'm getting problems. My thought was: 2048 bytes SRAM, a unsigned char is 2 bytes. So I need 1024 Bytes of memory. Half of wat is available.
Any suggestions how I should face this problem?
Thanks a lot,
Daniël Hullie
A char, unsigned or not, occupies only 1 byte on the Avr.
/A
You might be right but that is not quite the issue
Hi,
I would simulate your code on AVR Studio - check that you don't do anything crazy by accident, like accidently pass that array on the stack (and not a pointer) or something to that effect... because you should have lots of room!
Just monitor the memory, see how far it is written up to. You could also check the output of your compiler, it should tell you SRAM useage (not including stack though).
Regards,
-Colin