Information and Tips Regarding the C51 compiler for the 8xc51
Since the c51 compiler has been specially written for the 8051
there have been several additions to the standard C language to make
it easier to write programs for the 8051.
- You can include the file reg51.h. All the 8051 registers
and register bits(that are bit addressable) have been already
defined so you do not have to define them in your program.
- A memory specifier e.g. code, data, idata, bdata, xdata and pdata
can be added to your variable declarations to specify where the
variable should reside in memory.
- New data types such as the sfr, bit, sbit etc. have been added
where sfr helps to address the special function registers
of the 8051, sbit their individual bits and so on.
Variables declared with the bdata type are also bit addressable
(placed in the bit addressable memory of the 8051).
- Different memory models i.e. small, compact or large can be
specified using the pragma directive in your file.
e.g #pragma small
The C51 compiler can automatically generate the interrupt vectpr
and entry and exit code for interrupt routines where only the
interrupt number and the register bank needs to be specified. This is
done using the interrupt attribute (see page 80-82) of the C51
Several other convenient features exist for the C51 compiler. For more
information please look at the C51 Compiler User's Guide from Keil
software. It can save you valuable time while programming.