We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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 ?
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;
Thanks, now it's working fine !