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
"What does 'sfr' stand for?"
I checked in chapter 1 of the so-called "bible" for the 8051, and it uses the abbreviation "SFR" twice before saying what it stands for!
Chapter 1 - 80C51 Family Architecture: www.nxp.com/.../80C51_FAM_ARCH_1.pdf
In fact, "SFR" stands for Special-Function Register; these are the means of accessing the 8051's various peripherals - timers, UART, etc, etc...
"Is 'sfr' a typedef or a #define?" Neither - it is a new keyword, provided specifically by Keil as an extension to the standard 'C' programming language: http://www.keil.com/support/man/docs/c51/c51_extensions.htm
"How is it declared?"
Please read the manual: http://www.keil.com/support/man/docs/c51/c51_le_sfrs.htm
"I would like to create a 'pfr type' to access memory mapped peripherals in the xdata memory"
Take a look at the _at_ keyword extension, and the xdata memory-space qualifier: http://www.keil.com/support/man/docs/c51/c51_le_absvarloc.htm http://www.keil.com/support/man/docs/c51/c51_le_xdata.htm
For reference, here are the links to the other chapters of the so-called "bible":
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