This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Sbit doest work

Hello ALL

I need to access some of the bit positions of the SFR. But each time i tried to declare a variable of the type sbit , i get error C141: syntax error near sbit. I have read the manual and i even tried the statement :

 sbit EA = 0xAF 
but I still get the same error . Can someone help me out!!!

Thanks.

Parents
  • Take a look at the example CPU header files for your variant. This likely has already been done for you, and certainly has for standard 8051 SFRs.

    sfr IE   = 0xA8;
    
    /*  IE   */
    sbit EA   = 0xAF;
    sbit ES   = 0xAC;
    sbit ET1  = 0xAB;
    sbit EX1  = 0xAA;
    sbit ET0  = 0xA9;
    sbit EX0  = 0xA8;
    

    Going just from the posted code, I'd say you forgot the semicolon at the end of the statement.

Reply
  • Take a look at the example CPU header files for your variant. This likely has already been done for you, and certainly has for standard 8051 SFRs.

    sfr IE   = 0xA8;
    
    /*  IE   */
    sbit EA   = 0xAF;
    sbit ES   = 0xAC;
    sbit ET1  = 0xAB;
    sbit EX1  = 0xAA;
    sbit ET0  = 0xA9;
    sbit EX0  = 0xA8;
    

    Going just from the posted code, I'd say you forgot the semicolon at the end of the statement.

Children