ARM Technical Support Knowledge Articles


Applies to: C166 C Compiler


Information in this article applies to:


I have used the sbit constructs in the C166 Compiler for several years and I am now converting my program to Embedded C++. It appears that the following construct does not work:

unsigned int bdata ival;
sbit b0 = ival^0;
sbit b1 = ival^1;
sbit b2 = ival^2;
sbit b3 = ival^3;

What can I do to achieve bit-level access in the Embedded C++ Compiler?


The Embedded C++ Compiler uses standard C syntax for this. Just rewrite your program so it uses a bit-field that is located to the bdata memory type.

struct bits {
  unsigned int b0: 1;
  unsigned int b1: 1;
  unsigned int b2: 1;
  unsigned int b3: 1;
  unsigned int b4: 1;
  unsigned int b5: 1;
  unsigned int b6: 1;
  unsigned int b7: 1;

union bacc  {
  unsigned int uc;
  struct bits   b;

union bacc bdata v1;    // bdata variables can be accessed using bit instructions

int main()  {
  if (v1.b.b0) {
    v1.b.b1 = 1;


Article last edited on: 2005-09-06 07:23:53

Rate this article

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