📄 stm8s_it.c
字号:
/**
******************************************************************************
* @file TIM1_6Steps\stm8s_it.c
* @brief This file contains all the interrupt routines.
* @author STMicroelectronics - MCD Application Team
* @version V1.0.1
* @date 09/22/2008
******************************************************************************
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* <h2><center>© COPYRIGHT 2008 STMicroelectronics</center></h2>
* @image html logo.bmp
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "stm8s_it.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
u8 TimeCounter = 0;
u8 step = 1;
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/* Public functions ----------------------------------------------------------*/
/** @addtogroup TIM1_6Steps_IT_Functions
* @{
*/
/**
* @brief Dummy interrupt routine
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void NonHandledInterrupt(void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief TRAP interrupt routine
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void TRAP_IRQHandler(void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief Top Level Interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void TLI_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief Auto Wake Up interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void AWU_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief Clock Controller interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void CLK_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief External Interrupt PORTA routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void EXTI_PORTA_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief External Interrupt PORTB routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void EXTI_PORTB_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief External Interrupt PORTC routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void EXTI_PORTC_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief External Interrupt PORTD routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void EXTI_PORTD_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief External Interrupt PORTE routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void EXTI_PORTE_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief CAN RX interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void CAN_RX_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief CAN TX interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void CAN_TX_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief SPI interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void SPI_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief Timer1 Update/Overflow/Trigger/Break interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void TIM1_UPD_OVF_TRG_BRK_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
return;
}
/**
* @brief Timer1 Capture/Compare interrupt routine.
* @par Parameters:
* None
* @retval void None
* @par Required preconditions:
* None
* @par Called functions:
* None
*/
@near @interrupt void TIM1_CAP_COM_IRQHandler (void)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
/* Clear TIM1 COM pending bit */
TIM1_ClearITPendingBit(TIM1_IT_COM);
if(step == 1)
{
/* Next step: Step 2 Configuration ---------------------------- */
/* Channel3 configuration */
TIM1_CCxCmd(TIM1_CHANNEL_3, DISABLE);
TIM1_CCxNCmd(TIM1_CHANNEL_3, DISABLE);
/* Channel1 configuration */
TIM1_SelectOCxM(TIM1_CHANNEL_1, TIM1_FORCEDACTION_ACTIVE);
TIM1_CCxCmd(TIM1_CHANNEL_1, ENABLE);
TIM1_CCxNCmd(TIM1_CHANNEL_1, ENABLE);
/* Channel2 configuration */
TIM1_SelectOCxM(TIM1_CHANNEL_2, TIM1_FORCEDACTION_INACTIVE);
TIM1_CCxCmd(TIM1_CHANNEL_2, ENABLE);
TIM1_CCxNCmd(TIM1_CHANNEL_2, ENABLE);
step++;
}
else if(step == 2)
{
/* Next step: Step 3 Configuration ---------------------------- */
/* Channel2 configuration */
TIM1_SelectOCxM(TIM1_CHANNEL_2, TIM1_FORCEDACTION_INACTIVE);
TIM1_CCxCmd(TIM1_CHANNEL_2, ENABLE);
TIM1_CCxNCmd(TIM1_CHANNEL_2, ENABLE);
/* Channel3 configuration */
TIM1_SelectOCxM(TIM1_CHANNEL_3, TIM1_FORCEDACTION_ACTIVE);
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);
step++;
}
else if(step == 3)
{
/* Next step: Step 4 Configuration ---------------------------- */
/* Channel3 configuration */
TIM1_SelectOCxM(TIM1_CHANNEL_3, TIM1_FORCEDACTION_ACTIVE);
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);
/* Channel1 configuration */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -