Keil™, An ARM® Company

C166 User's Guide

ebdata

The ebdata memory type may be used to declare variables only. You may not declare ebdata functions. This memory is accessed using 16-bit addresses and is the on-chip extended bit-addressable memory of the C16x/ST10/XC16x. This memory (which is limited to 512 bytes) may be accessed as bytes or as bits.

Variables declared ebdata are located in the SDATA group.

Declare ebdata variables as follows:

unsigned int ebdata eb_var;

Declare bits within an ebdata variable as follows:

struct s  {
  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;
};

struct s ebdata  v;

void main (void)  {
  if (v.b1)  {
    v.b0 = 1;
  }
}

You may use ebdata variables to access extended SFRs by:

  1. Defining the SFRs in a C source file,
  2. Compiling the file using the ORDER directive,
  3. and Using the SECTIONS linker directive to locate the SFR definitions to the appropriate address. For example:
    L166 ... SECTIONS(?EB?SFRBIT%EBDATA(0F100H), ?BD?SFRBIT%BDATA(0FF00H))
  4. Note

    • All SFRs (including extended SFRs) are defined in the SFR Definitions Files for each supported microcontroller. While it is possible to do, there is no need to use the ebdata type to define SFRs.