4Bit Lcd _ Array Size?

Hi,

I’m using 4*20 LCDs for my current project, and hope to upload an many strings as arduino can without a computer (I need to upload at least 40lines( around 80char/each). Strangely, my code is working up to binary sketch size: 3522 bytes (of a 14336 byte maximum) but not working from 3594 bytes. (Win XP, Diecimila)

For example, this array is working (3522 bytes)

char strs[12][72] = {
“Arduino is an open-source electronics prototyping platform”,
“based on flexible, easy-to-use hardware and software.”,
“It’s intended for artists, designers, hobbyists,”,
"and anyone interested in creating interactive objects or environments. ",


"Arduino projects can be stand-alone or they can communicate "
};

However, if I add more (ex> char strs[13][72]), than my lcd doesn’t show anything although my arduino uploaded the code without problems.

Please help! Thanks,
K.

You are running out of RAM. Have a look at progmem to see how you can put the strings in program memory instead of RAM: http://www.arduino.cc/en/Reference/PROGMEM

Thanks! I am applying progmem now, but my lcd is showing some strange characters. The strings working ok inside serial moniter, but my lcd is still showing wrong thing. Could you tell me why?


#include <avr/pgmspace.h>
#include <LCD4Bit.h>

LCD4Bit lcd = LCD4Bit(4);

prog_char string_0 PROGMEM = “String 0”;
prog_char string_1 PROGMEM = “String 1”;

PGM_P PROGMEM string_table =
{
string_0,
string_1
};

char buffer[30]; // make sure this is large enough for the largest string it must hold

void setup()
{
Serial.begin(9600);
lcd.init();
}

void loop()
{

for (int i = 0; i < 2; i++)
{
strcpy_P(buffer, (char*)pgm_read_word(&(string_table*))); *

  • lcd.printIn( buffer);*
  • Serial.println( buffer );*
  • delay( 500 );*
  • }*
    }

That sketch really should set the cursor position in loop, but it does work on my 4x20 display.

If you need more help tracking down the problem, post a description of what you see on the LCD.