Keil Logo

A51: ACCESSING PDATA VARIABLES IN ASSEMBLER


Information in this article applies to:

  • C51 Version 5.50

SYMPTOMS

In a C source file, I have declared a pdata variable called foo. I wish to access this variable in an assembly module, and I have written the following code to do this:

EXTRN XDATA (foo)
...
MOV R0, #foo
MOV @R0, A

However, when I build my project I get:

ERROR 121: IMPROPER FIXUP.

CAUSE

While using the EXTRN directive, you have specified the variable as xdata. This is correct since pdata variables are stored in xdata, however, the assembler assigns a 16-bit address to the variable, but only an 8-bit address exists for the pdata variable.

RESOLUTION

Move the lower byte of the 16-bit address of the variable into R0. The upper byte will be present on P2 during the memory access.

MOV R0, #LOW (foo)

Last Reviewed: Tuesday, June 8, 2004


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.