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.
What's not working?
Could we see a code fragment?
If we are not supposed to eat animals, why are they made out of meat?
...If you have them declared within main(), then ...
... a large array could very well cause stack problems.
You can put lipstick on a pig, but it is still a pig.
I've never met a pig I didn't like, as long as you have some salt and pepper.
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?
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?
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; 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,
A char, unsigned or not, occupies only 1 byte on the Avr.
You might be right but that is not quite the issue
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).
VA3 YHZ - http://www.newae.com
Ok, I use the IAR compiler and the problem is in the memory type, it was on TINY and should be on SMALL for the large array to work.
I've read out the eeprom and this are the values put in an excell thingy.
It's a 1kHz signal AD-converted and stored in the EEPROM.
© 2021 Microchip Technology Inc.