We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi all,
Is "sfr" a typedef or a #define? How is it declared?
I would like to create a "pfr type" to access memory mapped peripherals in the xdata memory and also be able to use the same syntax for accessing them as with ordinary SFRs.
For example: pfr myReg = 0x3FF0; myReg = newVal;
Thanks you, Georgios
sfr is a keyword not typedef'd or #define'd.
http://www.keil.com/support/man/docs/c51/c51_le_keywords.htm http://www.keil.com/support/man/docs/c51/c51_le_sfr.htm
Some options:
#define myReg (*(unsigned char xdata *)0x3FF0) #define myReg XBYTE[0x3FF0] unsigned char xdata myReg _at_0x3FF0; myReg = newVal;