ARM Technical Support Knowledge Articles

INDIRECTLY ACCESSING 8051 SFRS

Applies to: C51 C Compiler

Answer

QUESTION

Why can't I create a C pointer to the SFRs on the 8051?

ANSWER

C pointers cannot be used to access the 8051's SFRs (special function registers).

The reason is because the 8051's SFRs are mapped into the upper 128 bytes of the Directly Addressable On-chip Memory. This area cannot be accessed indirectly, so you cannot use pointers to indirectly access the SFRs. If you attempt to indirectly access address 0x90 (normally port 1), you will access idata byte 0x90 instead of P1.

Refer to the Intel 8-bit Microcontrollers User's Manual or the manual specific to your 8051 derivative for more information on how the internal data area and the special function register memory is used.

SEE ALSO

Article last edited on: 2004-05-08 16:46:57

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential