Table of Contents        Previous topic       Next topic       

C COMPILER LIBRARY FUNCTIONS->Detailed Descriptions->_setvect()


#include <os.h>
void _setvect(unsigned int n, void(interrupt* fnp)()));Set the interrupt handler


n    Address of interrupt vector
fpn    Pointer to the interrupt handler


This routine is used to setup the exception vector at run time. It sets the four bytes at address n to the address of the interrupt handler fpn. If n is the address of an exception vector, then the function pointed to by fpn will be executed when this exception occurs.

Use _getvect() if you want to to save the contents of the interrupt vector before you call _setvect().

Header file os.h contains prototypes for _getvect() and _setvect().  Header os.h also contains the vector numbers for the ColdFire core and these can be used in conjunction with the _X_VO predefined macro to calculate the value of n at compile time.

See Runtime Modification of Interrupt Vectors for an example of using _setvect() and _getvect().

Return Value