Technical Support
Support Resources
Product Information
&&/&&Technical Support
C51: ERRORS USING SBITS AND SFRS
Information in this article applies to:
C51 All Versions
I've created the following program.
void main (void)
sfr P1 = 0x90;
P1 ^= 0xFF;
When I compile it, I receive the following error messages:
*** ERROR C141 IN LINE 3 OF .\MAIN.C: syntax error near 'sfr'
*** ERROR C202 IN LINE 3 OF .\MAIN.C: 'P1': undefined identifier
What's wrong?
SBIT and SFR objects may not be declared inside a function
definition. They must be declared outside of a function. The
following code compiles with no errors or warnings.
sfr P1 = 0x90;
void main (void)
P1 ^= 0xFF;
MORE INFORMATION
in the Cx51 User's Guide.
in the Cx51 User's Guide.
Last Reviewed: Tuesday, March 27, 2007
Did this article provide the answer you needed?
Development Tools
Hardware & Collateral
Important information
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our .
Don't show this message again
Privacy Policy Update
ARM’s Privacy Policy has been updated. By continuing to use our site, you consent to ARM’s Privacy Policy. Please review our
to learn more about our collection, use and transfers
of your data.
Accept and hide this message
/support/docs/1951.asp}