Technical Support

C51: DECLARING BDATA AND SBIT VARIABLES


Information in this article applies to:

  • C51 All Versions

QUESTION

I'm trying to use the SBIT keyword to create a bit in a BDATA variable. However, I can't seem to get the example program to work:

void main (void)
  {
  bdata int ibase;
  sbit mybit0 = ibase ^ 0;
  .
  .
  .
  mybit0 = 1;
}

The C51 command line I use is:

c:\c51\examples\my>C51 TEST.c

and the error message I receive is:

syntax error near "sbit"

What's wrong with my program?

ANSWER

You must declare the bdata and sbit variables OUTSIDE of a function. For example:

bdata int ibase;
sbit mybit0 = ibase ^ 0;

void main (void)
{
mybit0 = 1;
}

MORE INFORMATION

Last Reviewed: Sunday, March 12, 2006


Did this article provide the answer you needed?
 
Yes
No
Not Sure