# OS_SetIrqFunction

## C Specification

  `#include <nitro/os.h>`
  `void OS_SetIrqFunction( OSIrqMask intrBit, OSIrqFunction function );`

## Arguments

intrBit | The IRQ interrupt cause to be enabled (expressed as a bitmask)
function | The interrupt handler

## Return Values

None.

## Description

This function sets the interrupt handler.

The function sets the functions (interrupt handler) that jump when the designated IRQ interrupt occurs. In intrBit, the IRQ interrupt cause that sets the handler gets designated. In function, the handler gets designated.

Refer to `OS_SetIrqMask` for details about setting the IRQ interrupt cause.

The interrupt handler is of the `OSIrqFunction` type . It is a void function without arguments.

> Example:
> `main()
> {
> :
> OS_InitIrqTable();
> OS_SetIrqFunction( OS_IE_V_BLANK, vhandler );
> :
> }
> void vhandler( void )
> {
> // V-Blank interrupt process
> }`

Note: You need to be cautious about timer interrupts. With the hardware timer specifications, the set timer interrupts are generated repeatedly. With the OS, the settings for the registered handler are released when the first interrupt is generated, so only that first timer interrupt is generated. In order to generate repeated timer interrupts, processing to carry out settings needs to be done again in the interrupt handler.

## See Also

`OS_SetIrqMask`, `OS_InitIrqTable`, `OS_GetIrqFunction`

## Revision History

03/08/2005 Standardized the Japanese term for "interrupt"
06/03/2004 Added note about timer interrupts.
12/01/2003 Initial version

CONFIDENTIAL