Interrupt support – Zilog Z8F0130 User Manual

Page 226

Advertising
background image

Using the ANSI C-Compiler

UM013037-1212

202

Zilog Developer Studio II – Z8 Encore!
User Manual

return 1;

return ( k * recursive_fn (k-1));

}

When the static call frame option is selected, all call frames are assumed static by the com-
piler unless the

reentrant

storage class is used in the function declaration. Obviously, if

large numbers of functions in an application must be declared reentrant, the benefit of
using static frames diminishes proportionately.

When the dynamic call frame option is selected, all call frames are assumed reentrant by
the compiler.

Interrupt Support

To support interrupts, the Z8 Encore! C-Compiler provides the following features:

interrupt Keyword

– see page 202

Interrupt Vector Setup

– see page 202

interrupt Keyword

Functions that are preceded by

#pragma interrupt

or are associated with the interrupt

storage class are designated as interrupt handlers. These functions should neither take
parameters nor return a value. The compiler stores the machine state at the beginning of
these functions and restores the machine state at the end of these functions. Also, the com-
piler uses the

iret

instruction to return from these functions.

For example:

void interrupt isr_timer0(void)

{

}

or

#pragma interrupt

void isr_timer0(void)

{

}

Interrupt Vector Setup

The compiler provides two mechanisms for interrupt vector setup:

SET_VECTOR Intrinsic Function

– see page 203

_At Keyword

– see page 203

Advertising