I get this Warning 154: Converting integral to pointer without a cast from type 'const-unsigned-char literal' to type 'unsigned-int near* xdata'.
This warning is with the SDCC compiler using the 8051 processor when attempting to use pointers to change internal data memory. These warnings flood my screen so I'm trying to solve the issue.
My simple code is like this:
# include <8052.h>
# include <stdio.h>
# include <stdlib.h>
data at (0x50) unsigned char temp;
data unsigned int * xdata p;
//getting pointers to work
printf("this is temp: %i ",(int)temp);
I know I can change temp variable, but i'm trying to use pointers to do this so p can point to variable addresses through function calls. Thanks
The statement p=0x50; should say p = (unsigned char *)0x50;
Would p=&temp be feasible? If not, there's also #pragma disable_warning 154
Also, temp should also be unsigned int instead of unsigned char if you are using a pointer to unsigned int to modify it. Otherwise, whatever is at location 0x51 will be overwritten as well.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.