Next Previous Contents

5. Language Extensions

5.1 Storage Classes.

In addition to the ANSI storage classes SDCC allows the following 8051 specific storage classes.

xdata.

Variables declared with this storage class will be placed in the extern RAM. This is the default storage class for Large Memory model .

eg. xdata unsigned char xduc;

data

This is the default storage class for Small Memory model. Variables declared with this storage class will be allocated in the internal RAM.

eg. data int iramdata;

idata

Variables declared with this storage class will be allocated into the indirectly addressable portion of the internal ram of a 8051 .

eg.idata int idi;

bit

This is a data-type and a storage class specifier. When a variable is declared as a bit , it is allocated into the bit addressable memory of 8051.

eg.bit iFlag;

sfr / sbit

Like the bit keyword, sfr / sbit signifies both a data-type and storage class, they are used to describe the special function registers and special bit variables of a 8051.

eg.

sfr at 0x80 P0; /* special function register P0 at location 0x80 */

sbit at 0xd7 CY; /* CY (Carry Flag) */


Next Previous Contents