Keil Logo

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
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

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 Privacy Policy to learn more about our collection, use and transfers
of your data.