memory limit attiny 45

Hi All,

I'm working on a 4x4 led array driven by a attiny 45.
I seem to run into some memory issues.

I've defined a multidimensional array "scroll_text" wich holds the data to scroll over the 4x4 screen.
All seems to be working fine if i keep the size of this array below [4][19], a larger array results in a blank screen. The size of the compiled script is about 1550 bytes, which i think is well below the 4096 (??) limit of the attiny45.

(if i run the same script on my uno it CAN handle a larger arra)

Where am i gooing wrong?

test7tiny.ino (4.34 KB)

The Tiny45 only has 256 bytes of ram.

Hi KingBee

You are running out of SRAM rather than Flash (program) memory. The ATtiny45 has 256 bytes of SRAM.

More information here: Arduino Memories | Memories of an Arduino | Adafruit Learning System

Regards

Ray

Thanks for the replies.

I must admit im not really sure what mem I use.
after compiling and uploading with my arduino uno i get the message:
1.514 bytes (of 4.096-byte maximum)

Ok, had to read it twice to get it apperently.
So the data I use for variables is to large..
Is there a work around for that?

Is the array going to be used to store constant data (i.e. defined at compile time) which you are only going to read? Or is it going to be updated while the program is running?

If it is the former, then there is a way to hold the array in Flash memory and functions to read out the data when you need it.

Take a look here: Gammon Forum : Electronics : Microprocessors : Putting constant data into program memory (PROGMEM)

It is indeed going to store constant data, i'll have a look at the link.
Thanks

I'm not really understandig how to implement the trick from gammon;

I've made a simple script that (should) store a large array in PROGMEM, and then print each component of it.
As far as i can see it does store the array in PROGMEM as the memory RAM usage is low (only couple of bytes extra).
Only the values that are printed are in the range 100~800, instead of 1's and 0's.

I did get a message "invalid conversion from 'const int*' to int; I therefore added the "int" in line:

value = int(scroll_text[j]);
[/quote]
apperently there is a type mixup that I don't understand, can annyone assist?
Thanks,
sketch_nov21a.ino (1000 Bytes)

If your array is only going to store 0 or 1, change the declaration to:

const byte scroll_text[4][64] PROGMEM = {
etc

Then to access the elements, try this:

byte value = 0;
...
value = pgm_read_byte(&(scroll_text[j][i]));

Tanks, it works!