beautypg.com

Interrupt vector setup – Zilog ZUSBOPTS User Manual

Page 191

background image

UM017105-0511

Language Extensions

Zilog Developer Studio II – ZNEO™

User Manual

163

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 an intrinsic function

SET_VECTOR

for interrupt vector setup.

SET_VECTOR

can be used to specify the address of an interrupt handler for an interrupt

vector. Because the interrupt vectors of the ZNEO microcontroller are usually in ROM,
they cannot be modified at run time. The

SET_VECTOR

function works by switching to a

special segment and placing the address of the interrupt handler in the vector table. No
executable code is generated for this statement.

The following example represents the

SET_VECTOR

intrinsic function prototype:

intrinsic void SET_VECTOR(int vectnum,void (*hndlr)(void));

An example of the use of

SET_VECTOR

is:

#include

extern void interrupt isr_timer0(void);

void main(void)

{

SET_VECTOR(TIMER0, isr_timer0);

}

This manual is related to the following products: