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

PDATA question

I have not used PDATA before, so this may be a silly question. Can I set up PDATA dynamically (within the code) to any 256-byte chunk of xdata? So I can change where the PDATA is "looking" in xdata on the fly, and subsequently have byte addressing (and hopefully faster writes within a loop) for any 256-byte section of xdata at a time?

Parents
  • The upper half of the address for pdata is taken from port 2 (usually; your particular variant may have a different SFR for this purpose).

    You'll want to be sure to restore P2 if you have declared pdata variables. The linker will expect them to live in a particular page (see the PPAGE directive, and PPAGEENABLE / PPAGE_SFR defines in STARTUP.A51).

    I don't think the C compiler and linker support a "banked pdata" mode, where you can declare more than 256 bytes of pdata that live in different pages, and have the compiler automatically generate the correct values to write to P2.

Reply
  • The upper half of the address for pdata is taken from port 2 (usually; your particular variant may have a different SFR for this purpose).

    You'll want to be sure to restore P2 if you have declared pdata variables. The linker will expect them to live in a particular page (see the PPAGE directive, and PPAGEENABLE / PPAGE_SFR defines in STARTUP.A51).

    I don't think the C compiler and linker support a "banked pdata" mode, where you can declare more than 256 bytes of pdata that live in different pages, and have the compiler automatically generate the correct values to write to P2.

Children