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 Segment

I am not sure, if I have understood the usage of the PDATA segment properly.

When pdata is used (in the compact memory model), the variables in the external memory can be addressed with MOVX A,@Rx , which will save some processor cycles compared to the MOVX A,DPTR command. The high byte of the memory address will be in P2 (that are the A8..A15 signals).

When I want to use PDATA, I have to include a modified STARTUP.A51 and tell the linker the location of the PDATA-segment and that it has to link STARTUP.OBJ, too.

Is it possible to use PDATA and XDATA (different pages from PDATA) simultaneously?

Is it possible to use PDATA and external program memory?

I have seen, that P2 is loaded with the PDATA page in STARTUP. I think, every external access to a page that is not the PDATA page will "corrupt" P2 as the high byte of PDATA.

Why I ask? I have a project, that I didn't write the software for and the guy who did it is hopefully resting in peace. Now I have to modify the software a bit, but I cannot get a running code. Unfortunately all *.M51 and *.OBJ files were deleted, so I cannot retrieve the compiler and linker options that were originally used anymore.

My configuration is 64k of external code memory and 32k of external RAM. Originally, the code contains some xdata and some pdata variables. I guess, that mixing the kind of variables kinda screws up everything and that the external code access do also corrupt the pdata variables.