Page 1 of 1

help to sort the error out

Posted: Mon Jul 31, 2006 3:02 pm
by ukweb
Hello
I just want to print welcome on the lcd, (PIC Matirx multimedai board) the code is below which i have tried, but it gives me a error saying that Error in const array definition.
#include <system.h>
#include "lcdlib.h"
const unsigned char welcome[8]={'W', 'E', 'L', 'C', 'O', 'M', 'E', 0X00};

void main(void)
{
lcd_start();
lcd_print(welcome);
while(1);
}

Posted: Tue Aug 01, 2006 10:10 am
by Ian
0X00 or 0x00?
Remember C is case sensitive.

Posted: Tue Aug 01, 2006 2:02 pm
by Steve
If it's not a problem with the capital "X" in "0X00", then you may want to try either of these:

const char welcome[] = {'W', 'E', 'L', 'C', 'O', 'M', 'E', 0X00};

const char *welcome = "WELCOME";

This should work for C2C. If you are using a different C compiler, you may need to do something different (for example, BoostC uses the "rom" qualifier in place of "const").

Another thing to be aware of is what the function <lcd_print> expects. Does it take a single "char" parameter or does it take a "char*" parameter (i.e. a pointer to a string).