beautypg.com

Zilog EZ80F916 User Manual

Page 158

background image

UM014423-0607

Using the ANSI C-Compiler

ZiLOG Developer Studio II

eZ80Acclaim!

®

User Manual

138

For clarity, it is recommended to place all the

_set_vector

calls in main. For example:

extern void my_zero_timer(); /* declared as interrupt */
extern void my_one_timer(); /* declared as interrupt */
int main() {
_di(); /* disable interrupts */
_set_vector(TMR0, my_zero_timer);
_set_vector(TMR1, my_one_timer);
_ei(); /* enable interrupts */

/* Body of application */
}

If you are in the early stages of developing your application, you might need to capture all
of the interrupt vectors so that any unexpected interrupts are vectored to a known section
of code. The

_init_default_vectors

function can be used for this purpose. It takes

no arguments and should be called at the beginning of main. This function sets up all of
the entries in the vector table to point to a single interrupt handler. Interrupts must be dis-
abled at the point where this function is called.

Using Interrupts in Your Application
The eZ80Acclaim! family has a number of options for handling interrupts.

If you are using the default boot module, use the following procedure to enable the first
interrupt:

1. Call

init_default_vectors()

once

2. Call

set_vector()

with the appropriate parameters.

3. Configure and enable the peripherals interrupt.

For each additional interrupt, use steps 2 and 3 only.

The eZ80F92 and eZ80F93 operate like the eZ80190 in terms of having on-chip SRAM
available. If, however, you are only targeting to have your code run within the on-chip
Flash memory, you might want to just keep your ISR routines within the first 64 Kbytes
and point the default vector addresses right to the ISR routines.

The eZ80Acclaim! eZ80F91 devices, however, have a new feature that has been added to
the interrupt controller to help out with interrupts. The default interrupt vectors have been
changed from two byte addresses to four bytes. This allows you to point the default ISR
vector right to your ISR routine. The following is some simple ISR setup code for the
eZ80F91 device:

;**********************************
; Program entry point
;**********************************

.org

%00

di
jp.lil_c_int0

; Jump around the ISR vectors.

This manual is related to the following products: