Hi, I put a variable in a fixed adress using the _at_ expression, as follow: xdata PSD_REGS PSD8xx_reg _at_ 0x9000; It works fine, now I would like to acess this variable in other souce code. I try to make a lot of things like declare it on my header file, put extern before the expression, but anything works. Somebody can help me ?
Thanks, now it's working fine !
You should have an extern reference to the actual variable, as well as the type, in the header file for this module: xx1.h: typedef xdata struct REG_PSD_struct { }PSD_REGS; extern xdata PSD_REGS PSD8xx_reg; This allows other modules to see the variable that's actually allocated in xx1.c, which is the only place that needs the _at_ keyword. xx1.c: xdata PSD_REGS PSD8xx_reg _at_ 0x9000;
Sorry, I can't get it. In my header "xx1.h" file a have a struct: typedef xdata struct REG_PSD_struct { unsigned char DATAIN_A; unsigned char DATAIN_B; unsigned char CONNTROL_A; }PSD_REGS; In my "xx1.c" file a use the _at_ keyword: xdata PSD_REGS PSD8xx_reg _at_ 0x9000; It's work fine, but I wanto to use the "PSD8xx_reg" in others sorce file "**2.c". I try to do what do you say, but it's not work, too.
Use the _at_ in the definition only - not in the 'extern' declaration
View all questions in Keil forum