LPC938 ADC code problems - porting from Keil

Started by evsource_com November 3, 2008
Hi,

I'm sort of new at the LPC micros, but have some code apparently
compiled with the Keil compiler for a lPC938. I've got everything
compiling fine, except for the ADC code. The relevant portions of the
code are this:

(line 80): res = (XBYTE[AD0DAT0L_ADDR]<<2) | XBYTE[AD0DAT0R_ADDR]; //
res is declared as "uint16 res = 0;", this line is for channel 0

I get the following error when compiling:

AD.c: 180: error 88: illegal cast of LITERAL value to 'generic'
pointer from type 'literal-long-int' to type 'volatile-unsigned-char
generic* '

Can anyone shed some light on the problem? The XBYTE is defined in
ABSACC.H, which I had to find online, and defined like this:

#define XBYTE ((unsigned char volatile *) 0x20000L)

Thanks in advance,

Ryan

Dear Ryan,
Are you able to write the code in a simple way ????
like
unsigned char buf;
buf = AD0DAT0;
and see what you get in the buf
On 11/3/08, evsource_com wrote:
>
> Hi,
>
> I'm sort of new at the LPC micros, but have some code apparently
> compiled with the Keil compiler for a lPC938. I've got everything
> compiling fine, except for the ADC code. The relevant portions of the
> code are this:
>
> (line 80): res = (XBYTE[AD0DAT0L_ADDR]<<2) | XBYTE[AD0DAT0R_ADDR]; //
> res is declared as "uint16 res = 0;", this line is for channel 0
> I get the following error when compiling:
>
> AD.c: 180: error 88: illegal cast of LITERAL value to 'generic'
> pointer from type 'literal-long-int' to type 'volatile-unsigned-char
> generic* '
>
> Can anyone shed some light on the problem? The XBYTE is defined in
> ABSACC.H, which I had to find online, and defined like this:
>
> #define XBYTE ((unsigned char volatile *) 0x20000L)
>
> Thanks in advance,
>
> Ryan
>

--
Doshi Harshal
POTENT
F-27, VRAJWADI COMPLEX,
Nr. UTKARSH SCHOOL,
Gadapura,
VADODARA
GUJARAT 390015, INDIA
PH: 09429071421
www.potent.co.in