EmbeddedRelated.com
Forums

lpc2138 Keil gives a simple error on the lcd6963.c library. I canīt solve it

Started by correoparalamierda August 7, 2009
Hi, Im an spanish student and I have a problem using the library of the T6963C LCD. Im new in the world of the lpc2138 but Im lost with the use of the LCD library, I think Its easy, however Im lost with the error Im going to tell you.
I need some help please.

Keil gives me that error message:
lcd6963.c(839): error: #513: a value of type "const unsigned char *" cannot be assigned to an entity of type "unsigned char *"

The error is because of this line:
glyph_ptr = fonts[font].glyph_table + ((unsigned int)glyph * (unsigned int)store_width * (unsigned int)height);

where we have: unsigned char glyph;
unsigned char height;
unsigned char store_width;
unsigned char *glyph_ptr;
and extern struct FONT_DEF fonts[FONT_COUNT]; (this last one, appears in other file named fonts.h, but its included: #include "fonts.h"

All the files of the library are in a file of the this group, link below:
http://tech.groups.yahoo.com/group/lpc2000/files/GLCD_T6963.zip

You can download it and try, because I think I havent explain myself very well.
Sorry for my english.
Thanks everybody, I wish anyone could help me!

An Engineer's Guide to the LPC2100 Series

correoparalamierda ha scritto:
>
>
> Hi, Im an spanish student and I have a problem using the library of the
> T6963C LCD. Im new in the world of the lpc2138 but Im lost with the
> use of the LCD library, I think Its easy, however Im lost with the
> error Im going to tell you.
> I need some help please.
>
> Keil gives me that error message:
> lcd6963.c(839): error: #513: a value of type "const unsigned char *"
> cannot be assigned to an entity of type "unsigned char *"
>

This is not much a problem with the LCD, I mean, rather than with
standard C and "const" objects.

I don't know much about that source, but you can try some cast to get
rid of the error

Dario
Yeah, IT must be a simple error, however I dont know how to solve it. Its rare than a library from a LCD gives that error, isnt it??? Dont you think it could be a problem from Keil??

correoparalamierda ha scritto:
>
>
> Yeah, IT must be a simple error, however I dont know how to solve it.
> Its rare than a library from a LCD gives that error, isnt it??? Dont
> you think it could be a problem from Keil??
Could it be that there is some compiler option which makes CONST and
"normal" compatible by default? in this case, the sources would be ok,
if compiled with that option.

But, to make a not-const into a const is easy :) just check a C manual
out there...
If you are sure about the code, try force casting the rhs to (unsigned char
*) as in
glyph_ptr = (unsigned char *) fonts[font].glyph_table + ((unsigned int)glyph
* (unsigned int)store_width * (unsigned int)height);
see if it works
Regards,
Prerak

On Fri, Aug 7, 2009 at 7:20 AM, correoparalamierda <
c...@yahoo.es> wrote:

> Hi, Im an spanish student and I have a problem using the library of the
> T6963C LCD. Im new in the world of the lpc2138 but Im lost with the use of
> the LCD library, I think Its easy, however Im lost with the error Im
> going to tell you.
> I need some help please.
>
> Keil gives me that error message:
> lcd6963.c(839): error: #513: a value of type "const unsigned char *" cannot
> be assigned to an entity of type "unsigned char *"
>
> The error is because of this line:
> glyph_ptr = fonts[font].glyph_table + ((unsigned int)glyph * (unsigned
> int)store_width * (unsigned int)height);
>
> where we have: unsigned char glyph;
> unsigned char height;
> unsigned char store_width;
> unsigned char *glyph_ptr;
> and extern struct FONT_DEF fonts[FONT_COUNT]; (this last one, appears in
> other file named fonts.h, but its included: #include "fonts.h"
>
> All the files of the library are in a file of the this group, link below:
> http://tech.groups.yahoo.com/group/lpc2000/files/GLCD_T6963.zip
>
> You can download it and try, because I think I havent explain myself very
> well.
> Sorry for my english.
> Thanks everybody, I wish anyone could help me!
>
>
>


----Original Message----
From: l...
[mailto:l...] On Behalf Of
correoparalamierda Sent: 07 August 2009 13:54 To:
l... Subject: [lpc2000] Re: lpc2138 Keil
gives a simple error on the lcd6963.c library. I cant
solve it

> Thanks for replying Tim, Ive change the problematic line
> in the code with the line you posted me and Keil gives
> me another error message: lcd6963.c(836): error: #513: a
> value of type "const char *" cannot be assigned to an
> entity of type "unsigned char *"
>
> Any idea??? Im starting to get desesperated :S Thanks
> everybody for you answers

Ummm... I don't use Keil, are you sure the compiler/project is definitely configured to create code for LPC2138?
On LPC2xxx a pointer to a char (in sram) should be no different to a pointer to a const char (in flash) as it is all in the same memory map.

--
Tim Mitchell

Yes, Ive revised the project once more and its made for lpc2138. I dont know much about the compiler because Ive been looking for change the compiler in Keil but I havent find out anything in google. Its a strange error, dont you think??

Ive made changes in the code and if I change the variables in fonts.h, fonts.c changing "constant unsigned char" to "unsigned char" the error goes away and Keil lets me compile, but Its a fudge :S
----Original Message----
From: l...
[mailto:l...] On Behalf Of
correoparalamierda Sent: 07 August 2009 15:35 To:
l... Subject: [lpc2000] Re: lpc2138 Keil
gives a simple error on the lcd6963.c library. I cant
solve it

> Yes, Ive revised the project once more and its made for
> lpc2138. I dont know much about the compiler because
> Ive been looking for change the compiler in Keil but I
> havent find out anything in google. Its a strange
> error, dont you think??
>
> Ive made changes in the code and if I change the
> variables in fonts.h, fonts.c changing "constant unsigned
> char" to "unsigned char" the error goes away and Keil
> lets me compile, but Its a fudge :S

The problem then is you're using up RAM to store the characters, rather than them being stored in Flash as intended.

--
Tim Mitchell

--- In l..., "correoparalamierda" wrote:
>
> Yes, Ive revised the project once more and its made for lpc2138. I dont know much about the compiler because Ive been looking for change the compiler in Keil but I havent find out anything in google. Its a strange error, dont you think??
>
> Ive made changes in the code and if I change the variables in fonts.h, fonts.c changing "constant unsigned char" to "unsigned char" the error goes away and Keil lets me compile, but Its a fudge :S
>

I hoope you just mistyped in your message. The proper form would be:

const unsigned char

not "constant unsigned char"

Richard