⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stm8s_it.c

📁 STM8示例程序
💻 C
📖 第 1 页 / 共 2 页
字号:
	TIM1_SelectOCxM(TIM1_CHANNEL_1, TIM1_FORCEDACTION_INACTIVE);
	TIM1_CCxCmd(TIM1_CHANNEL_1, ENABLE);
	TIM1_CCxNCmd(TIM1_CHANNEL_1, ENABLE);
    step++;
  }
  else if(step == 4)
  {
    /* Next step: Step 5 Configuration ---------------------------- */
	/*  Channel3 configuration */
	TIM1_CCxCmd(TIM1_CHANNEL_3, DISABLE);
	TIM1_CCxNCmd(TIM1_CHANNEL_3, DISABLE);
	
	/*  Channel1 configuration */
	TIM1_SelectOCxM(TIM1_CHANNEL_1, TIM1_FORCEDACTION_INACTIVE);
	TIM1_CCxCmd(TIM1_CHANNEL_1, ENABLE);
	TIM1_CCxNCmd(TIM1_CHANNEL_1, ENABLE);

	/*  Channel2 configuration */
	TIM1_SelectOCxM(TIM1_CHANNEL_2, TIM1_FORCEDACTION_ACTIVE);
	TIM1_CCxCmd(TIM1_CHANNEL_2, ENABLE);
	TIM1_CCxNCmd(TIM1_CHANNEL_2, ENABLE);    
    step++;
  }
  else if (step == 5)
  {
    /* Next step: Step 6 Configuration ---------------------------- */
	/*  Channel3 configuration */
	TIM1_SelectOCxM(TIM1_CHANNEL_3, TIM1_FORCEDACTION_INACTIVE);
	TIM1_CCxCmd(TIM1_CHANNEL_3, ENABLE);
	TIM1_CCxNCmd(TIM1_CHANNEL_3, ENABLE);

	/*  Channel1 configuration */
	TIM1_CCxCmd(TIM1_CHANNEL_1, DISABLE);
	TIM1_CCxNCmd(TIM1_CHANNEL_1, DISABLE);
    
	/*  Channel2 configuration */
	TIM1_SelectOCxM(TIM1_CHANNEL_2, TIM1_FORCEDACTION_ACTIVE);
  	TIM1_CCxCmd(TIM1_CHANNEL_2, ENABLE);
	TIM1_CCxNCmd(TIM1_CHANNEL_2, ENABLE);
    step++;
  }
  else
  {
    /* Next step: Step 1 Configuration ---------------------------- */
    /*  Channel1 configuration */
	TIM1_SelectOCxM(TIM1_CHANNEL_1, TIM1_FORCEDACTION_ACTIVE);
	TIM1_CCxCmd(TIM1_CHANNEL_1, ENABLE);
	TIM1_CCxNCmd(TIM1_CHANNEL_1, ENABLE);
    
	/*  Channel3 configuration */
	TIM1_SelectOCxM(TIM1_CHANNEL_3, TIM1_FORCEDACTION_INACTIVE);
	TIM1_CCxCmd(TIM1_CHANNEL_3, ENABLE);
	TIM1_CCxNCmd(TIM1_CHANNEL_3, ENABLE);

	/*  Channel2 configuration */
	TIM1_CCxCmd(TIM1_CHANNEL_2, DISABLE);
	TIM1_CCxNCmd(TIM1_CHANNEL_2, DISABLE);
    step = 1;
  }	
  
  return;
}

/**
  * @brief Timer2 Update/Overflow/Break interrupt routine.
  * @par Parameters:
  * None
  * @retval void None
  * @par Required preconditions:
  * None
  * @par Called functions:
  * None
  */
@near @interrupt void TIM2_UPD_OVF_BRK_IRQHandler (void)
{
  /* In order to detect unexpected events during development,
     it is recommended to set a breakpoint on the following instruction.
  */
  return;
}

/**
  * @brief Timer2 Capture/Compare interrupt routine.
  * @par Parameters:
  * None
  * @retval void None
  * @par Required preconditions:
  * None
  * @par Called functions:
  * None
  */
@near @interrupt void TIM2_CAP_COM_IRQHandler (void)
{
  /* In order to detect unexpected events during development,
     it is recommended to set a breakpoint on the following instruction.
  */
  return;
}

/**
  * @brief Timer3 Update/Overflow/Break interrupt routine.
  * @par Parameters:
  * None
  * @retval void None
  * @par Required preconditions:
  * None
  * @par Called functions:
  * None
  */
@near @interrupt void TIM3_UPD_OVF_BRK_IRQHandler (void)
{
  /* In order to detect unexpected events during development,
     it is recommended to set a breakpoint on the following instruction.
  */
  return;
}

/**
  * @brief Timer3 Capture/Compare interrupt routine.
  * @par Parameters:
  * None
  * @retval void None
  * @par Required preconditions:
  * None
  * @par Called functions:
  * None
  */
@near @interrupt void TIM3_CAP_COM_IRQHandler (void)
{
  /* In order to detect unexpected events during development,
     it is recommended to set a breakpoint on the following instruction.
  */
  return;
}

/**
  * @brief UART1 TX interrupt routine.
  * @par Parameters:
  * None
  * @retval void None
  * @par Required preconditions:
  * None
  * @par Called functions:
  * None
  */
@near @interrupt void UART1_TX_IRQHandler (void)
{
  /* In order to detect unexpected events during development,
     it is recommended to set a breakpoint on the following instruction.
  */
  return;
}

/**
  * @brief UART1 RX interrupt routine.
  * @par Parameters:
  * None
  * @retval void None
  * @par Required preconditions:
  * None
  * @par Called functions:
  * None
  */
@near @interrupt void UART1_RX_IRQHandler (void)
{
  /* In order to detect unexpected events during development,
     it is recommended to set a breakpoint on the following instruction.
  */
  return;
}

/**
  * @brief I2C interrupt routine.
  * @par Parameters:
  * None
  * @retval void None
  * @par Required preconditions:
  * None
  * @par Called functions:
  * None
  */
@near @interrupt void I2C_IRQHandler (void)
{
  /* In order to detect unexpected events during development,
     it is recommended to set a breakpoint on the following instruction.
  */
  return;
}

/**
  * @brief UART2 TX interrupt routine.
  * @par Parameters:
  * None
  * @retval void None
  * @par Required preconditions:
  * None
  * @par Called functions:
  * None
  */
@near @interrupt void UART2_TX_IRQHandler (void)
{
    /* In order to detect unexpected events during development,
       it is recommended to set a breakpoint on the following instruction.
    */
    return;
}

/**
  * @brief UART2 RX interrupt routine.
  * @par Parameters:
  * None
  * @retval void None
  * @par Required preconditions:
  * None
  * @par Called functions:
  * None
  */
@near @interrupt void UART2_RX_IRQHandler (void)
{
    /* In order to detect unexpected events during development,
       it is recommended to set a breakpoint on the following instruction.
    */
    return;
}

/**
  * @brief UART3 TX interrupt routine.
  * @par Parameters:
  * None
  * @retval void None
  * @par Required preconditions:
  * None
  * @par Called functions:
  * None
  */
@near @interrupt void UART3_TX_IRQHandler (void)
{
    /* In order to detect unexpected events during development,
       it is recommended to set a breakpoint on the following instruction.
    */
    return;
}

/**
  * @brief UART3 RX interrupt routine.
  * @par Parameters:
  * None
  * @retval void None
  * @par Required preconditions:
  * None
  * @par Called functions:
  * None
  */
@near @interrupt void UART3_RX_IRQHandler (void)
{
    /* In order to detect unexpected events during development,
       it is recommended to set a breakpoint on the following instruction.
    */
    return;
}

/**
  * @brief ADC1 interrupt routine.
  * @par Parameters:
  * None
  * @retval void None
  * @par Required preconditions:
  * None
  * @par Called functions:
  * None
  */
@near @interrupt void ADC1_IRQHandler (void)
{

    /* In order to detect unexpected events during development,
       it is recommended to set a breakpoint on the following instruction.
    */
    return;

}

/**
  * @brief ADC2 interrupt routine.
  * @par Parameters:
  * None
  * @retval void None
  * @par Required preconditions:
  * None
  * @par Called functions:
  * None
  */
@near @interrupt void ADC2_IRQHandler (void)
{

    /* In order to detect unexpected events during development,
       it is recommended to set a breakpoint on the following instruction.
    */
    return;

}

/**
  * @brief Timer4 Update/Overflow interrupt routine.
  * @par Parameters:
  * None
  * @retval void None
  * @par Required preconditions:
  * None
  * @par Called functions:
  * TIM1_GenerateEvent
  */
@near @interrupt void TIM4_UPD_OVF_IRQHandler (void)
{

	TIM4_ClearITPendingBit(TIM4_IT_UPDATE);
  
  if (TimeCounter == 11)
  {
		/* Generate TIM1 COM event by software */
		TIM1_GenerateEvent(TIM1_EVENTSOURCE_COM);
		TimeCounter=1;
	/*
		the TIM4 Update Interrupt occurs each 0.064ms ( Tui=(Period * Prescaler)/Fmaster  = (256*128)/2Mhz = 16,384 ms )
		so after 11 TIM4 Update Interrupts,  180ms have been spent  (T= 11 * 16,384  = 180.2 ms)
	*/

  }
  else
  {
		TimeCounter++;
  }
  return;
}

/**
  * @brief Eeprom EEC interrupt routine.
  * @par Parameters:
  * None
  * @retval void None
  * @par Required preconditions:
  * None
  * @par Called functions:
  * None
  */
@near @interrupt void EEPROM_EEC_IRQHandler (void)
{
  /* In order to detect unexpected events during development,
     it is recommended to set a breakpoint on the following instruction.
  */
  return;
}

/**
  * @}
  */

/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -