Keil Logo

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_type is the type of the value returned from the function. If no type is specified, int is assumed.
funcname is the name of the function.
args is the argument list for the function.
small explicitly defines the function uses the small memory model.
compact explicitly defines the function uses the compact memory model.
large explicitly defines the function uses the large memory model.
reentrant indicates that the function is recursive or reentrant.
interrupt indicates that the function is an interrupt function.
x is the interrupt number.
using specifies which register bank the function uses.
y is the register bank number.

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

  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.