Keil™, An ARM® Company

MCBSTR9 User's Guide

IRQ Handler Example

STMicroelectronics functions in the STR91xD.LIB and STR91xR.LIB STR91x Software Library files use a common IRQ handler for interrupt functions.

All interrupt functions are implemented in the 91X_IT.C module as shown below:

/******************************************************************
* Function Name  : TIM0_IRQHandler
* Description    : This function handles the TIM0 interrupt request
* Input          : None
* Output         : None
* Return         : None
*******************************************************************/
void TIM0_IRQHandler(void)
{
  /* Set the TIM0 OC1 value */
  TIM_SetPulse(TIM0, TIM_PWM_OC1_Channel, Pulse);
  /* Clear the TIM OC1 flag */
  TIM_ClearFlag(TIM0, TIM_FLAG_OC1);
}

To enable the interrupt, execute the following STR9 Library functions:

// Configure and enable IRQ for Timer 0
  VIC_Config(TIM0_ITLine, VIC_IRQ, 1);
  VIC_ITCmd(TIM0_ITLine, ENABLE);