|
|||||||||||
|
Technical Support Support Resources
Product Information |
C51: Porting Code from PL/M-51Information in this article applies to:
QUESTIONI am porting code from Intel PLM51 to Keil C51 and have a problem with the following construct:
I have translated this PL/M-51 statement into the following C construct:
However, the Keil C51 does not allow an _at_ statement to be a variable. How can I solve this problem? ANSWERThe Intel PL/M-51 statement:
can be represented by the following C variable definition:
To access the elements you need to write:
Instead of having two variables that represent the memory address and its contents, the C language needs just one. With ptr the memory address is accessed. With *ptr the memory content is accessed. In PL/M you might use a 'BASE' variable to address more than just one variable. This can be represented by a union in C. Example:
In the beginning, the C constructs look a bit odd to a PL/M programmer, but after a while, you will see the benefits of the pointer constructs. The pointer has an associated type, and therefore it is a lot easier to maintain programs and view memory contents in a debugger. MORE INFORMATION
SEE ALSOLast Reviewed: Thursday, February 25, 2021 | ||||||||||
|
|||||||||||
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.