ARM Technical Support Knowledge Articles

DECLARING BDATA AND SBIT VARIABLES

Applies to: C51 C Compiler

Answer


Information in this article applies to:


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:c51examplesmy>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

Article last edited on: 2006-03-12 09:28:59

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential