Cx51 User's Guide

Function Declarations

The C51 Compiler provides a number of extensions for standard C function declarations. These extensions allow you to:

  • Declare a function as an interrupt procedure
  • Choose the register bank used
  • Select the memory model
  • Declare a reentrant function
  • Declare alien functions

You may include these extensions or attributes (many of which may be combined) in the function declaration. Use the following standard format for your C51 Compiler function declarations.

<[>return_type<]> funcname (<[>args<]>) <[>{small | compact | large}<]>
                                    <[>reentrant<]>
                                    <[>interrupt x<]>
                                    <[>using y<]>

where:

return_typeis the type of the value returned from the function. If no type is specified, int is assumed.
funcnameis the name of the function.
argsis the argument list for the function.
smallexplicitly defines the function uses the small memory model.
compactexplicitly defines the function uses the compact memory model.
largeexplicitly defines the function uses the large memory model.
reentrantindicates that the function is recursive or reentrant.
interruptindicates that the function is an interrupt function.
xis the interrupt number.
usingspecifies which register bank the function uses.
yis the register bank number.

Descriptions of these attributes and other features are described in detail in the following sections.