STM32F10x_StdPeriph_Examples/TIM/6Steps/stm32f10x_it.c

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    TIM/6Steps/stm32f10x_it.c 
00004   * @author  MCD Application Team
00005   * @version V3.4.0
00006   * @date    10/15/2010
00007   * @brief   Main Interrupt Service Routines.
00008   *          This file provides template for all exceptions handler and peripherals
00009   *          interrupt service routine.
00010   ******************************************************************************
00011   * @copy
00012   *
00013   * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
00014   * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
00015   * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
00016   * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
00017   * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
00018   * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
00019   *
00020   * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
00021   */ 
00022 
00023 /* Includes ------------------------------------------------------------------*/
00024 #include "stm32f10x_it.h"
00025 
00026 /** @addtogroup STM32F10x_StdPeriph_Examples
00027   * @{
00028   */
00029 
00030 /** @addtogroup TIM_6Steps
00031   * @{
00032   */ 
00033 
00034 /* Private typedef -----------------------------------------------------------*/
00035 /* Private define ------------------------------------------------------------*/
00036 /* Private macro -------------------------------------------------------------*/
00037 /* Private variables ---------------------------------------------------------*/
00038 __IO uint32_t step = 1;
00039 
00040 /* Private function prototypes -----------------------------------------------*/
00041 /* Private functions ---------------------------------------------------------*/
00042 
00043 /******************************************************************************/
00044 /*            Cortex-M3 Processor Exceptions Handlers                         */
00045 /******************************************************************************/
00046 
00047 /**
00048   * @brief  This function handles NMI exception.
00049   * @param  None
00050   * @retval None
00051   */
00052 void NMI_Handler(void)
00053 {
00054 }
00055 
00056 /**
00057   * @brief  This function handles Hard Fault exception.
00058   * @param  None
00059   * @retval None
00060   */
00061 void HardFault_Handler(void)
00062 {
00063   /* Go to infinite loop when Hard Fault exception occurs */
00064   while (1)
00065   {}
00066 }
00067 
00068 /**
00069   * @brief  This function handles Memory Manage exception.
00070   * @param  None
00071   * @retval None
00072   */
00073 void MemManage_Handler(void)
00074 {
00075   /* Go to infinite loop when Memory Manage exception occurs */
00076   while (1)
00077   {}
00078 }
00079 
00080 /**
00081   * @brief  This function handles Bus Fault exception.
00082   * @param  None
00083   * @retval None
00084   */
00085 void BusFault_Handler(void)
00086 {
00087   /* Go to infinite loop when Bus Fault exception occurs */
00088   while (1)
00089   {}
00090 }
00091 
00092 /**
00093   * @brief  This function handles Usage Fault exception.
00094   * @param  None
00095   * @retval None
00096   */
00097 void UsageFault_Handler(void)
00098 {
00099   /* Go to infinite loop when Usage Fault exception occurs */
00100   while (1)
00101   {}
00102 }
00103 
00104 /**
00105   * @brief  This function handles Debug Monitor exception.
00106   * @param  None
00107   * @retval None
00108   */
00109 void DebugMon_Handler(void)
00110 {}
00111 
00112 /**
00113   * @brief  This function handles SVCall exception.
00114   * @param  None
00115   * @retval None
00116   */
00117 void SVC_Handler(void)
00118 {}
00119 
00120 /**
00121   * @brief  This function handles PendSV_Handler exception.
00122   * @param  None
00123   * @retval None
00124   */
00125 void PendSV_Handler(void)
00126 {}
00127 
00128 /**
00129   * @brief  This function handles SysTick Handler.
00130   * @param  None
00131   * @retval None
00132   */
00133 void SysTick_Handler(void)
00134 {
00135   /* Generate TIM1 COM event by software */
00136   TIM_GenerateEvent(TIM1, TIM_EventSource_COM);
00137 }
00138 
00139 /******************************************************************************/
00140 /*            STM32F10x Peripherals Interrupt Handlers                        */
00141 /******************************************************************************/
00142 
00143 /**
00144   * @brief  This function handles TIM1 Trigger and commutation interrupts
00145   *   requests.
00146   * @param  None
00147   * @retval None
00148   */
00149 #if defined (STM32F10X_LD_VL) || defined (STM32F10X_MD_VL) || defined (STM32F10X_HD_VL)
00150 void TIM1_TRG_COM_TIM17_IRQHandler(void)
00151 #else
00152 void TIM1_TRG_COM_IRQHandler(void)
00153 #endif  
00154 {
00155    /* Clear TIM1 COM pending bit */
00156    TIM_ClearITPendingBit(TIM1, TIM_IT_COM);
00157 
00158   if (step == 1)
00159   {
00160     /* Next step: Step 2 Configuration ---------------------------- */
00161     /*  Channel3 configuration */
00162     TIM_CCxCmd(TIM1, TIM_Channel_3, TIM_CCx_Disable);
00163     TIM_CCxNCmd(TIM1, TIM_Channel_3, TIM_CCxN_Disable);
00164 
00165     /*  Channel1 configuration */
00166     TIM_SelectOCxM(TIM1, TIM_Channel_1, TIM_OCMode_PWM1);
00167     TIM_CCxCmd(TIM1, TIM_Channel_1, TIM_CCx_Enable);
00168     TIM_CCxNCmd(TIM1, TIM_Channel_1, TIM_CCxN_Disable);
00169 
00170     /*  Channel2 configuration */
00171     TIM_SelectOCxM(TIM1, TIM_Channel_2, TIM_OCMode_PWM1 );
00172     TIM_CCxCmd(TIM1, TIM_Channel_2, TIM_CCx_Disable);
00173     TIM_CCxNCmd(TIM1, TIM_Channel_2, TIM_CCxN_Enable);
00174     step++;
00175   }
00176   else if (step == 2)
00177   {
00178     /* Next step: Step 3 Configuration ---------------------------- */
00179     /*  Channel2 configuration */
00180     TIM_SelectOCxM(TIM1, TIM_Channel_2, TIM_OCMode_PWM1);
00181     TIM_CCxCmd(TIM1, TIM_Channel_2, TIM_CCx_Disable);
00182     TIM_CCxNCmd(TIM1, TIM_Channel_2, TIM_CCxN_Enable);
00183     
00184     /*  Channel3 configuration */
00185     TIM_SelectOCxM(TIM1, TIM_Channel_3, TIM_OCMode_PWM1);
00186     TIM_CCxCmd(TIM1, TIM_Channel_3, TIM_CCx_Enable);
00187      TIM_CCxNCmd(TIM1, TIM_Channel_3, TIM_CCxN_Disable);
00188 
00189     /*  Channel1 configuration */
00190     TIM_CCxCmd(TIM1, TIM_Channel_1, TIM_CCx_Disable);
00191     TIM_CCxNCmd(TIM1, TIM_Channel_1, TIM_CCxN_Disable);
00192     step++;
00193   }
00194   else if (step == 3)
00195   {
00196     /* Next step: Step 4 Configuration ---------------------------- */
00197     /*  Channel3 configuration */
00198     TIM_SelectOCxM(TIM1, TIM_Channel_3, TIM_OCMode_PWM1);
00199     TIM_CCxCmd(TIM1, TIM_Channel_3, TIM_CCx_Enable);
00200     TIM_CCxNCmd(TIM1, TIM_Channel_3, TIM_CCxN_Disable);
00201 
00202     /*  Channel2 configuration */
00203     TIM_CCxCmd(TIM1, TIM_Channel_2, TIM_CCx_Disable);
00204     TIM_CCxNCmd(TIM1, TIM_Channel_2, TIM_CCxN_Disable);
00205 
00206     /*  Channel1 configuration */
00207     TIM_SelectOCxM(TIM1, TIM_Channel_1, TIM_OCMode_PWM1);
00208     TIM_CCxCmd(TIM1, TIM_Channel_1, TIM_CCx_Disable);
00209     TIM_CCxNCmd(TIM1, TIM_Channel_1, TIM_CCxN_Enable);
00210     step++;
00211   }
00212   else if (step == 4)
00213   {
00214     /* Next step: Step 5 Configuration ---------------------------- */
00215     /*  Channel3 configuration */
00216     TIM_CCxCmd(TIM1, TIM_Channel_3, TIM_CCx_Disable);
00217     TIM_CCxNCmd(TIM1, TIM_Channel_3, TIM_CCxN_Disable);
00218 
00219     /*  Channel1 configuration */
00220     TIM_SelectOCxM(TIM1, TIM_Channel_1, TIM_OCMode_PWM1);
00221     TIM_CCxCmd(TIM1, TIM_Channel_1, TIM_CCx_Disable);
00222     TIM_CCxNCmd(TIM1, TIM_Channel_1, TIM_CCxN_Enable);
00223 
00224     /*  Channel2 configuration */
00225     TIM_SelectOCxM(TIM1, TIM_Channel_2, TIM_OCMode_PWM1);
00226     TIM_CCxCmd(TIM1, TIM_Channel_2, TIM_CCx_Enable);
00227     TIM_CCxNCmd(TIM1, TIM_Channel_2, TIM_CCxN_Disable);
00228     step++;
00229   }
00230   else if (step == 5)
00231   {
00232     /* Next step: Step 6 Configuration ---------------------------- */
00233     /*  Channel3 configuration */
00234     TIM_SelectOCxM(TIM1, TIM_Channel_3, TIM_OCMode_PWM1);
00235     TIM_CCxCmd(TIM1, TIM_Channel_3, TIM_CCx_Disable);
00236     TIM_CCxNCmd(TIM1, TIM_Channel_3, TIM_CCxN_Enable);
00237 
00238     /*  Channel1 configuration */
00239     TIM_CCxCmd(TIM1, TIM_Channel_1, TIM_CCx_Disable);
00240     TIM_CCxNCmd(TIM1, TIM_Channel_1, TIM_CCxN_Disable);
00241 
00242     /*  Channel2 configuration */
00243     TIM_SelectOCxM(TIM1, TIM_Channel_2, TIM_OCMode_PWM1);
00244     TIM_CCxCmd(TIM1, TIM_Channel_2, TIM_CCx_Enable);
00245     TIM_CCxNCmd(TIM1, TIM_Channel_2, TIM_CCxN_Disable);
00246     step++;
00247   }
00248   else
00249   {
00250     /* Next step: Step 1 Configuration ---------------------------- */
00251     /*  Channel1 configuration */
00252     TIM_SelectOCxM(TIM1, TIM_Channel_1, TIM_OCMode_PWM1);
00253     TIM_CCxCmd(TIM1, TIM_Channel_1, TIM_CCx_Enable);
00254     TIM_CCxNCmd(TIM1, TIM_Channel_2, TIM_CCxN_Disable);
00255 
00256     /*  Channel3 configuration */
00257     TIM_SelectOCxM(TIM1, TIM_Channel_3, TIM_OCMode_PWM1);
00258     TIM_CCxCmd(TIM1, TIM_Channel_3, TIM_CCx_Disable);
00259     TIM_CCxNCmd(TIM1, TIM_Channel_3, TIM_CCxN_Enable);
00260 
00261     /*  Channel2 configuration */
00262     TIM_CCxCmd(TIM1, TIM_Channel_2, TIM_CCx_Disable);
00263     TIM_CCxNCmd(TIM1, TIM_Channel_2, TIM_CCxN_Disable);
00264     step = 1;
00265   }
00266 }
00267 
00268 /******************************************************************************/
00269 /*                 STM32F10x Peripherals Interrupt Handlers                   */
00270 /*  Add here the Interrupt Handler for the used peripheral(s) (PPP), for the  */
00271 /*  available peripheral interrupt handler's name please refer to the startup */
00272 /*  file (startup_stm32f10x_xx.s).                                            */
00273 /******************************************************************************/
00274 
00275 /**
00276   * @brief  This function handles PPP interrupt request.
00277   * @param  None
00278   * @retval None
00279   */
00280 /*void PPP_IRQHandler(void)
00281 {
00282 }*/
00283 
00284 /**
00285   * @}
00286   */ 
00287 
00288 /**
00289   * @}
00290   */ 
00291 
00292 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
STM32F10x Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM32(CORTEX M3) 32-bit Microcontrollers platform visit  www.st.com/STM32