problem with a arrays in arduino programm


i array woth many elements (about 10k)
byte cc[] = {...} - that
and have problem access this. while array less 2.5k programm see elements. , while array more 3k programm read not right.

programm in iddle read first 80 elements - null. , when increase data in array iddle read not null (not first 80 elements)

i think array have restriction lenght, cant read in docs it.

i whant array 100k elements , not understand hapened now...

code: [select]
byte cc[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

8, 4, 16, 8, 36, 16, 8, 36, 8, 4, 16, 8, 36, 16, 8, 36, 8, 4, 16, 8, 36, 16, 8, 36, 8, 4, 16, 8, 36, 16, 8, 36, 8, 4, 16, 8, 36, 16, 8, 36, 8, 4, 16, 8, 36, 16, 8, 36, 8, 4
... , next...};

//======================================================================
void setup()
{
 ddrb = b00111111;
 setline (0);
}

//======================================================================
void loop()
{
 int sensorvalue = 1000 + analogread(5)*10;

 int buttonstate = digitalread(5);

 if (buttonstate == 0)
 {
   for (int k=1; k<=20; k++)
   {
     for (int n=0; n<sensorvalue; n++)
     {
       setline (k*80);
     }
   }
 }
 setline (0);
 //delay(10);
}

//======================================================================
void setline (int pos)
{
 int num;
 for (int j=0; j<10; j++)
 {
   for (int i=0; i<8; i++)
   {
     num = j*8+i+pos;
     portb = 0 + cc[num];
     portb = 2 + cc[num];
   }
   portb = b00000001;
 }
}


what not right?

quote
what not right
you've assumed arduino has more memory has.

quote
i whant array 100k elements

you've wouldn't have enough memory if elements single bits.

typical board spec:
http://arduino.cc/en/main/arduinoboardduemilanove
sram 1k bytes (8192 bits) or 2k bytes (16384 bits)


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > problem with a arrays in arduino programm


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums