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);
}
help to sort the error out
- Steve
- Matrix Staff
- Posts: 3433
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
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).
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).