<< Previous | Next >>

SetVectIntern

unsigned SetVectIntern( int vectNum, void * isr );

Description

Sets an internal interrupt table entry. All Rabbit interrupts use jump vectors. This function writes a jp instruction (0xC3) followed by the 16 bit ISR address to the appropriate location in the vector table. The location in RAM of the vector table is determined and set by the BIOS automatically at startup. The start of the table is always on a 0x100 boundary.

It is perfectly permissible to have ISRs in xmem and do long jumps to them from the vector table. It is even possible to place the entire body of the ISR in the vector table if it is 16 bytes long or less, but this function only sets up jumps to 16 bit addresses.

The following table shows the vectNum value for each peripheral or RST. The offset into the vector table is also shown. The following vectors are valid for all Rabbit processors.

Peripheral or RST

vectNum

Vector Table Offset

Periodic interrupt

0x00

0x00

RST 10 instruction

0x02

0x20

RST 38 instruction

0x07

0x70

Slave Port

0x08

0x80

Timer A

0x0A

0xA0

Timer B

0x0B

0xB0

Serial Port A

0x0C

0xC0

Serial Port B

0x0D

0xD0

Serial Port C

0x0E

0xE0

Serial Port D

0x0F

0xF0

The following vectors are valid starting with the Rabbit 3000.

Peripheral or RST

vectNum

Vector Table Offset

Input Capture

0x1A

0x01A0

Quadrature Encoder

0x19

0x0190

Serial port E

0x1C

0x01C0

Serial port F

0x1D

0x01D0

The following vectors are valid starting with the Rabbit 3000 Revision 1.

Peripheral or RST

vectNum

Vector Table Offset

Pulse Width Modulator

0x17

0x0170

Secondary Watchdog

0x01

0x10

The following vectors are valid starting with the Rabbit 4000.

Peripheral or RST

vectNum

Vector Table Offset

Timer C

0x1F

0x01F0

Network Port A

0x1E

0x01E0

The following three RSTs are included for completeness, but should not be set by the user as they are used by Dynamic C.

Peripheral or RST

vectNum

Vector Table Offset

RST 18 instruction

0x03

0x30

RST 20 instruction

0x04

0x40

RST 28 instruction

0x05

0x50

Parameters

vectNum
Interrupt number. See the above table for valid values.

isr
ISR handler address. Must be a root address.

Return value

Address of vector table entry, or zero if vectNum is not valid.

Library

SYS.LIB

See also

GetVectExtern2000, SetVectExtern2000, GetVectIntern


Dynamic C Functions << Previous | Next >> rabbit.com