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 Reply Children
  • Only SFRs with addresses that end in 0 or 8 are bit-addressable.

    Note that there are eight bits in a byte, and the bit addresses for SFR X0 range from X + 0 to X + 7, whereupon you reach SFR X8 with bits X8 + 0 to X8 + 7.

    There's method in the madness.

    For registers that are not bit addressable, you can set bits the good old fashioned way, with AND and OR operations. AND / OR also works on the SFRs with addressable bits.