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

Using _at_ keyword.

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 ?

Parents
  • 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;

Reply
  • 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;

Children