chipKIT® Development Platform

Inspired by Arduino™

management const string

Created Thu, 27 Nov 2014 21:36:43 +0000 by Davileo60


Davileo60

Thu, 27 Nov 2014 21:36:43 +0000

Hi. In the management of a menu in the LCD display 20x4 I have the need to store a large number of const string in program memory. Unfortunately when I select a string above the item 62 println function no longer works and writes a null string. I don't understand why. anyone can explain it. thank you.


majenko

Thu, 27 Nov 2014 21:56:20 +0000

Not without seeing your code, and knowing what board you're trying to run it on, no.


Davileo60

Sat, 29 Nov 2014 08:41:08 +0000

HI excuse me, but I am new to the forum. I have a board Chipkit UNO32 software Mpide 0023 vers. 20140821- windows this below is the code. Thank.

const String row[]=          
{ "00000000000000000000",
  "11111111111111111111",
  "22222222222222222222",
  "33333333333333333333",
  "44444444444444444444",
  "55555555555555555555",
  "66666666666666666666",
  "77777777777777777777",                                
  "88888888888888888888",
  "99999999999999999999",
  "10 10 10 10 10 10 10",
  "11 11 11 11 11 11 11",
  "12 12 12 12 12 12 12",
  "13 13 13 13 13 13 13",
  "14 14 14 14 14 14 14",
  "15 15 15 15 15 15 15",
  "16 16 16 16 16 16 16",
  "17 17 17 17 17 17 17",
  "18 18 18 18 18 18 18",
  "19 19 19 19 19 19 19",
  "20 20 20 20 20 20 20",
  "21 21 21 21 21 21 21",							
  "22 22 22 22 22 22 22",
  "23 23 23 23 23 23 23",
  "24 24 24 24 24 24 24",
  "25 25 25 25 25 25 25",	
  "*** Group second ***",			
  "00000000000000000000",
  "11111111111111111111",
  "22222222222222222222",
  "33333333333333333333",
  "44444444444444444444",
  "55555555555555555555",
  "66666666666666666666",
  "77777777777777777777",                                
  "88888888888888888888",
  "99999999999999999999",
  "10 10 10 10 10 10 10",
  "11 11 11 11 11 11 11",
  "12 12 12 12 12 12 12",
  "13 13 13 13 13 13 13",
  "14 14 14 14 14 14 14",
  "15 15 15 15 15 15 15",
  "16 16 16 16 16 16 16",
  "17 17 17 17 17 17 17",
  "18 18 18 18 18 18 18",
  "19 19 19 19 19 19 19",
  "20 20 20 20 20 20 20",
  "21 21 21 21 21 21 21",							
  "22 22 22 22 22 22 22",
  "23 23 23 23 23 23 23",
  "24 24 24 24 24 24 24",
  "25 25 25 25 25 25 25",	
  "**** Group Tree ****",
  "00000000000000000000",
  "11111111111111111111",
  "22222222222222222222",
  "33333333333333333333",
  "44444444444444444444",
  "55555555555555555555",
  "66666666666666666666",
  "77777777777777777777",                                
  "88888888888888888888",
  "99999999999999999999",
  "10 10 10 10 10 10 10",
  "11 11 11 11 11 11 11",
  "12 12 12 12 12 12 12",
  "13 13 13 13 13 13 13",
  "14 14 14 14 14 14 14",
  "15 15 15 15 15 15 15",
  "16 16 16 16 16 16 16",
  "17 17 17 17 17 17 17",
  "18 18 18 18 18 18 18",
  "19 19 19 19 19 19 19",
  "20 20 20 20 20 20 20",
  "21 21 21 21 21 21 21",							
  "22 22 22 22 22 22 22",
  "23 23 23 23 23 23 23",
  "24 24 24 24 24 24 24",
  "25 25 25 25 25 25 25"};                               

const int MAXNUMROW =70; 
int i=0;
void setup(void)
{
  Serial.begin(9600);
  
}

void loop (void)
{
 delay(200);
 if(i <= MAXNUMROW){
   Serial.print(i,DEC);
   Serial.print(" - ");
   Serial.println(row[i]);
   i++;    
 }    
 delay(200); 
}

majenko

Sat, 29 Nov 2014 11:20:20 +0000

That works perfectly on UECIDE (I don't have MPIDE installed right now).

I notice you're using String. I don't like String. It wastes RAM. I rather suspect that you might be running into the maximum heap size problem (0x800 bytes) that I have worked around in UECIDE (by completely removing the heap limit in the compiler). You can try not using String, and using char * instead, which should not use any heap, or try your code in UECIDE.


Davileo60

Sat, 29 Nov 2014 13:55:02 +0000

I tried with UECIDE and it's OK. Thank you. also I thinking that is better const char * . Now that I tried it I think I will use UECIDE rather MPIDE.

Thanks a lot.