help to sort the error out

For C and ASSEMBLY users to post questions and code snippets for programming in C and ASSEMBLY. And for any other C or ASM course related questions.

Moderators: Benj, Mods

Post Reply
ukweb
Posts: 16
Joined: Fri Jul 28, 2006 8:35 pm
Contact:

help to sort the error out

Post 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);
}

Ian
Posts: 110
Joined: Thu Sep 29, 2005 10:53 am
Location: Matrix Multimedia
Been thanked: 1 time
Contact:

Post by Ian »

0X00 or 0x00?
Remember C is case sensitive.

User avatar
Steve
Matrix Staff
Posts: 3427
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Post 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).

Post Reply