(The array is intialised with a bunch of characters)
I'm also getting an error saying "Data segment too large" when I make the array bigger. How do I copy the array from "CODE" to "XDATA"? or is this not the problem?
EDIT: Also when I call the function this way, the lcd skips element [i] [] in the array and prints the next element [i].
Any help I would very much appreciate.
unsigned char piece [4] [8];
lcd_msg_write(piece[0]); //rank
lcd_write(SecondLine);
lcd_msg_write(piece[1]);
lcd_write(SecondLine);
lcd_msg_write(piece[2]);
lcd_write(SecondLine);
lcd_msg_write(piece[3]);
lcd_write(SecondLine);
void lcd_msg_write(char * ptr2)
{
int x;
RS = 1;
for (x=0; x<8;x++)
lcd_write(*ptr2++); //write till end of string reached
RS = 0;
}
void lcd_write(unsigned char display_data)//LCD 1 {
EN = 1;
P0 = display_data;
EN = 0;
delay_5msec(); //delay to allow write operation to complete
}
You can put a variable to XDATA like this:
If I understand it correctly, I suppose you have some value like 0 inside your array, that's why it can skip it. If you show the real output(in text form), I could tell you more information. But as for code correctness, everything is ok. It can also be a character table of LCD, so you write some incorrect character that LCD does not support or know.