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 idata

i tried to make a space but it's still said "missing ';' before '_at_'"
i wrote :
char idata nim[14] _at_ 0x00;

and is idata starting address at 0x80?
and data starting address at 0x00?

so, if i want to set an array starting at the first address of idata, is it right if i define the array as idata and starting address at 0x00?

or i should starting at 0x80?

thanks very much

sincerly,
hardian

Parents

  • The problem with the line below:

    char idata nim[14] _at_ 0x00;

    is the absolte setting to 0x00. Address 0 is the location of bank 0 registers in the 8051. You cannot use this as an absolute location.

    If you want the array to be in idata, all you need is:
    char idata nim[14];

    The linker will place this in the idata space. If you must have this array at absolute address 0x80, then:

    char idata nim[14] _at_ 0x80;

    will place the array at absolute address 80h. You should only use absolute addressing when you need to access external memory or memory mapped peripherals.

Reply

  • The problem with the line below:

    char idata nim[14] _at_ 0x00;

    is the absolte setting to 0x00. Address 0 is the location of bank 0 registers in the 8051. You cannot use this as an absolute location.

    If you want the array to be in idata, all you need is:
    char idata nim[14];

    The linker will place this in the idata space. If you must have this array at absolute address 0x80, then:

    char idata nim[14] _at_ 0x80;

    will place the array at absolute address 80h. You should only use absolute addressing when you need to access external memory or memory mapped peripherals.

Children
  • You should only use absolute addressing when you need to access external memory

    In general, you wouldn't need it for external memory (XDATA).

    Only use it if there's a specific reason why something has to be at a specific, fixed address location.

    otherwise, let the compiler sort out the allocation of variables in the available memory space.