|ARM Technical Support Knowledge Articles|
Applies to: C51 C Compiler
Why can't I create a C pointer to the SFRs on the 8051?
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.
Article last edited on: 2004-05-08 16:46:57
Did you find this article helpful? Yes No
How can we improve this article?