Keil Logo

C51: Using PDATA Memory


Information in this article applies to:

  • C51 Version 5 and Later

QUESTION

I'm using a chip with on-chip XDATA memory. I want to use one 256-byte page as PDATA. How do I do that?

Does the upper address byte come from P2?

ANSWER

Accessing a 256-byte page (PDATA) of on-chip XDATA is possible and often desirable since PDATA is more efficient than XDATA.

When On-chip XDATA is Enabled...

  • Most devices allow PDATA access (MOVX @Rx) to only the first 256 bytes of XDATA (0x0000-0x00FF). On such devices, there is nothing to configure. You don't need to enable the PPAGEENABLE setting in the startup code since the PPAGE is fixed by the chip to 0.
  • Some devices have a special SFR that contains the upper address byte to use for PDATA accesses. Devices like the Infineon C517A have an SFR called XPAGE at address 0x91. In the startup code, you must set this SFR to the page number for PDATA. We recommend you use the first available memory page for the PDATA space (0xF8 in the case of the Infineon device).
To configure the tools for PDATA access, you must...
  • Copy the startup code to your project directory, modify it for PDATA access, and add it to the project.
  • In the startup code, you must set PPAGEENABLE EQU 1, PPAGE EQU 0F8h and PPAGE_SFR DATA 091h. This configuration reflects the Infineon C517A hardware. It will be different depending on the chip you use.
  • In the BL51 Linker options, you must specify the starting address for the PDATA memory. For the Infineon C517A device this value is 0xF800. Enter 0xF800 under Options for Target - BL51 Locate - Pdata:
  • In the Lx51 Linker options, you must specify the range of PDATA memory. Options for Target - LX51 Locate - User Class: PDATA(X:0xF800-X:0xF8FF)

When On-chip XDATA is Disabled...

Most 8051 devices use the value of Port 2 as the upper address byte for PDATA accesses. With such a configuration, the required startup code settings are nearly identical to the above except that the PPAGE SFR must be specified as PPAGE_SFR DATA 0A0H.

MORE INFORMATION

  • Refer to pdata in the Cx51 User's Guide.

SEE ALSO


Last Reviewed: Thursday, February 25, 2021


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.