Keil Logo

bit Types

The C166 Compiler provides a bit data type that may be used for variable declarations, argument lists, and function return values. A bit variable is declared just as other C data types are declared. For example:

static bit done_flag = 0;    /* bit variable */

bit testfunc (               /* bit function */
  bit flag1,                 /* bit arguments */
  bit flag2)
  return (0);                /* bit return value */

All bit variables are stored in a bit segment located in the bit memory area of the C16x/ST10. This area is only 256 bytes long, so, a maximum of 2048 bit variables may be declared within any one scope.

Automatic bit variables are stored in register R14 and R15 and limited to a maximum of 32 automatic bits inside a function.


  • Functions that disable interrupts (using #pragma disable) and functions that that use explicit register banks (with the using function attribute) may not return a bit value. The C166 Compiler generates an error if functions of this type attempt to return a bit.
  • A bit may not be declared as a pointer. For example:
    bit *ptr;          /* invalid */
  • An array of type bit is invalid. For example:
    bit ware [5];      /* invalid */
  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.