hello everyone, i am quite new to programming 8051..hoping to receive some help.. i have a pointer variable.The address stored in this variable resides in the on-chip XRAM.
unsigned char xdata *xloc;
i need the control of my program to be transferred to this address..how can it be done in C??? Thank You in advance for the help..
i am quite new to programming 8051
Given that, you shouldn't even be thinking of doing anything like the following. You're diving well beyond your depth.
i need the control of my program to be transferred to this address..how can it be done in C???
Oh, and it's impossible, too. The 8051 will not execute xdata.
ok 8051 cannot execute anything that resides in xdata...i get the point...but is there any way i can make the program to simply jump to an address location stored in a pointer variable in C?
you can use a function pointer to make a function call.
You can use a GOTO to jump to a label. But that usually makes your code a mess and it is not recommended.
i tried using a function pointer...
static unsigned int s_addr; unsigned char xdata *xloc; void (far *MyFunc)(void)=(void far*)(xloc); void main (void) { s_addr=get_addr(); xloc=(unsigned char xdata *)s_addr; (*MyFunc)(); }
but the 3rd line shows error MAIN.C(30): error C141: syntax error near '*', expected ')' MAIN.C(30): error C129: missing ';' before ')' get_addr() is a function which returns the address to which i need to make the jump...
View all questions in Keil forum