How to define a pointer to the SFR, e.g. I want to define a pointer to a Port0
unsigned char data *Sensor_Port = (unsigned char data * )0x80;
void main()
{
while(1)
*Sensor_Port = 0xFF;
*Sensor_Port = 0x00; }
}
"How to define a pointer to the SFR"
You can't.
The 8051 architecture does not have any instruction to indirectly address the SFRs - that's how it distinguishes between the upper IDATA addresses and the SFRs. (See the so-called "bible" for details)
The best you could do is have you own index, and use a switch statement...
In case you don't already have them, the links for the so-called "bible" for the 8051 are:
Chapter 1 - 80C51 Family Architecture: www.nxp.com/.../80C51_FAM_ARCH_1.pdf
Chapter 2 - 80C51 Family Programmer's Guide and Instruction Set: www.nxp.com/.../80C51_FAM_PROG_GUIDE_1.pdf
Chapter 3 - 80C51 Family Hardware Description: www.nxp.com/.../80C51_FAM_HARDWARE_1.pdf