I want to display certain messages on an LCD using a PIC MCU (16F887) and mikroC PRO for programming.
I have stored the words in a 2D string array like in the following program:
char text[21][11]={"GAS","DETECTED","MODE","SENSOR","TEST","SPRAY","GAS","ON",
"THE","PERFECT!!!","OVER","DOES","NOT","RESPONDE","PLEASE",
"REDO","FAILURE","SUSPECTED","CAUTION","NO"};
Now, for example, if I want to display "GAS DETECTED" I proceed as follows:
lcd_out(1,1,text[1][11]);
lcd_out(1,13,text[2][11]);
Here, I have noticed that:
- When I simulate the program as above I get a message error that says "Not enough RAM 'text'", So I understood that RAM is saturated, and I have declared my array with the
const
modifier as follows:
const char text[21][11]={"GAS","DETECTED","MODE","SENSOR","TEST","SPRAY","GAS","ON",
"THE","PERFECT!!!","OVER","DOES","NOT","RESPONDE","PLEASE",
"REDO","FAILURE","SUSPECTED","CAUTION","NO"};
Here again, I did not get the message error, but when I load the program to the PIC, nothing is displayed on the LCD.
NB: The LCD connections are correct, and it works perfectly with simple programs like:
Lcd_out(1,1,"Hello");
Could anyone explain to me where the problem is, and what the best solution is to display a sentence on a 2x16 LCD?