NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » 2 Dimensional Arrays

July 23, 2011
by lavared
lavared's Avatar

Hi,

I'm getting an error when i'm trying to compile my program containing 2 dimensional arrays (defined uint8_t type). My array definition and initialization function is given below:

uint8_t brightness_red[__rows][__leds_per_row] ; 
uint8_t brightness_green[__rows][__leds_per_row];
uint8_t brightness_blue[__rows][__leds_per_row];

void init_brightness(void){
 uint8_t row;
 uint8_t led;
    for(row = 0; row <= __max_row; row++) {    
      for(led = 0; led <= __max_led; led++) {
        brightness_red[row][led]=0;
        brightness_blue[row][led]=0;
        brightness_green[row][led]=0;
      }
    }
}

My program will keep updating this array.The error message while compiling is given below: "Compile Error"

Kindly specify if i'm doing anything wrong with the arrays definition. I have checked and ruled out other error sources in my code and strongly suspect something acting fishy in my array data.

thanks

July 24, 2011
by Noter
Noter's Avatar

It looks like you have exceeded the size of available memory and are attempting to write into the bootloader section. I would have to see your fuse settings to be sure but 0x3800 is the starting address for a 2k bootloader.

If you can, reduce the size of your program. Or get a bigger chip like the 328p that has twice the memory.

Post a Reply

Please log in to post a reply.

Did you know that a flyback diode is important when driving a motor or any inductive load? Learn more...