This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to use global pointer of C in assembly program

/*******************************************/
/*compiler Keil C51 v6.23*/
/*name:main*/
unsigned char xdata temp;
unsigned char xdata *p;
void func(void);
void main(void)
{	
	unsigned char xdata i;
 	while(1)
	{
		p = &temp;	
		*p = 98;	
		func();
		i = *p;
	}
}
/******************************************/
/*--------------------------------------
compile following program to assembly program, then link with the main function.ERROR!!! Why and how to chang the assembly program.please help me,thank you.!
------------------------------------------*/
#pragma src(MYPTR.A51) small

extern unsigned char xdata *p;

void func(void)
{	
	*p = 0xdd;
}
my E-mail:inspra@xjgroup.com
name:huangjian

Parents
  • It appears that your C program which you use SRC with is ALWAYS compiled in SMALL memory model. The following line:

    #pragma src(MYPTR.A51) small
    

    tells the compiler to compile in the small memory model.

    If you compile other parts of your program in LARGE or COMPACT memory model, the memory areas used for variables won't match.

    Jon

Reply
  • It appears that your C program which you use SRC with is ALWAYS compiled in SMALL memory model. The following line:

    #pragma src(MYPTR.A51) small
    

    tells the compiler to compile in the small memory model.

    If you compile other parts of your program in LARGE or COMPACT memory model, the memory areas used for variables won't match.

    Jon

Children
No data