On Thu, 26 May 2005, J S wrote:
> I've been reading over a book on programming in C for
> the 8051 and it has quite a few lines like this
> sbit TEST = P1_6;
> in some of its examples. I tried adding that line to
> a sample program and it fails to compile with this
> error 2: Initializer element is not constant.
> Has the syntax/assumed semantics changed from when the
> book was written (which was in 2000)? If so, how
> should I write that statement?
The above syntax is for the Keil C51 compiler. With SDCC it would be
sbit at 0x96 TEST;
or if you have already included the header file with your processor's sfr
declarations, you could make the compiler do the math with:
sbit at ((int)&P1)+6 TEST;