STM32F10x_StdPeriph_Examples/TIM/TimeBase/stm32f10x_it.c

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    TIM/TimeBase/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_TimeBase
00031   * @{
00032   */ 
00033 
00034 /* Private typedef -----------------------------------------------------------*/
00035 /* Private define ------------------------------------------------------------*/
00036 /* Private macro -------------------------------------------------------------*/
00037 /* Private variables ---------------------------------------------------------*/
00038 uint16_t capture = 0;
00039 extern __IO uint16_t CCR1_Val;
00040 extern __IO uint16_t CCR2_Val;
00041 extern __IO uint16_t CCR3_Val;
00042 extern __IO uint16_t CCR4_Val;
00043 
00044 /* Private function prototypes -----------------------------------------------*/
00045 /* Private functions ---------------------------------------------------------*/
00046 
00047 /******************************************************************************/
00048 /*            Cortex-M3 Processor Exceptions Handlers                         */
00049 /******************************************************************************/
00050 
00051 /**
00052   * @brief  This function handles NMI exception.
00053   * @param  None
00054   * @retval None
00055   */
00056 void NMI_Handler(void)
00057 {
00058 }
00059 
00060 /**
00061   * @brief  This function handles Hard Fault exception.
00062   * @param  None
00063   * @retval None
00064   */
00065 void HardFault_Handler(void)
00066 {
00067   /* Go to infinite loop when Hard Fault exception occurs */
00068   while (1)
00069   {}
00070 }
00071 
00072 /**
00073   * @brief  This function handles Memory Manage exception.
00074   * @param  None
00075   * @retval None
00076   */
00077 void MemManage_Handler(void)
00078 {
00079   /* Go to infinite loop when Memory Manage exception occurs */
00080   while (1)
00081   {}
00082 }
00083 
00084 /**
00085   * @brief  This function handles Bus Fault exception.
00086   * @param  None
00087   * @retval None
00088   */
00089 void BusFault_Handler(void)
00090 {
00091   /* Go to infinite loop when Bus Fault exception occurs */
00092   while (1)
00093   {}
00094 }
00095 
00096 /**
00097   * @brief  This function handles Usage Fault exception.
00098   * @param  None
00099   * @retval None
00100   */
00101 void UsageFault_Handler(void)
00102 {
00103   /* Go to infinite loop when Usage Fault exception occurs */
00104   while (1)
00105   {}
00106 }
00107 
00108 /**
00109   * @brief  This function handles Debug Monitor exception.
00110   * @param  None
00111   * @retval None
00112   */
00113 void DebugMon_Handler(void)
00114 {}
00115 
00116 /**
00117   * @brief  This function handles SVCall exception.
00118   * @param  None
00119   * @retval None
00120   */
00121 void SVC_Handler(void)
00122 {}
00123 
00124 /**
00125   * @brief  This function handles PendSV_Handler exception.
00126   * @param  None
00127   * @retval None
00128   */
00129 void PendSV_Handler(void)
00130 {}
00131 
00132 /**
00133   * @brief  This function handles SysTick Handler.
00134   * @param  None
00135   * @retval None
00136   */
00137 void SysTick_Handler(void)
00138 {}
00139 
00140 /******************************************************************************/
00141 /*            STM32F10x Peripherals Interrupt Handlers                        */
00142 /******************************************************************************/
00143 
00144 /**
00145   * @brief  This function handles TIM2 global interrupt request.
00146   * @param  None
00147   * @retval None
00148   */
00149 void TIM2_IRQHandler(void)
00150 {
00151   if (TIM_GetITStatus(TIM2, TIM_IT_CC1) != RESET)
00152   {
00153     TIM_ClearITPendingBit(TIM2, TIM_IT_CC1);
00154 
00155     /* Pin PC.06 toggling with frequency = 73.24 Hz */
00156     GPIO_WriteBit(GPIOC, GPIO_Pin_6, (BitAction)(1 - GPIO_ReadOutputDataBit(GPIOC, GPIO_Pin_6)));
00157     capture = TIM_GetCapture1(TIM2);
00158     TIM_SetCompare1(TIM2, capture + CCR1_Val);
00159   }
00160   else if (TIM_GetITStatus(TIM2, TIM_IT_CC2) != RESET)
00161   {
00162     TIM_ClearITPendingBit(TIM2, TIM_IT_CC2);
00163 
00164     /* Pin PC.07 toggling with frequency = 109.8 Hz */
00165     GPIO_WriteBit(GPIOC, GPIO_Pin_7, (BitAction)(1 - GPIO_ReadOutputDataBit(GPIOC, GPIO_Pin_7)));
00166     capture = TIM_GetCapture2(TIM2);
00167     TIM_SetCompare2(TIM2, capture + CCR2_Val);
00168   }
00169   else if (TIM_GetITStatus(TIM2, TIM_IT_CC3) != RESET)
00170   {
00171     TIM_ClearITPendingBit(TIM2, TIM_IT_CC3);
00172 
00173     /* Pin PC.08 toggling with frequency = 219.7 Hz */
00174     GPIO_WriteBit(GPIOC, GPIO_Pin_8, (BitAction)(1 - GPIO_ReadOutputDataBit(GPIOC, GPIO_Pin_8)));
00175     capture = TIM_GetCapture3(TIM2);
00176     TIM_SetCompare3(TIM2, capture + CCR3_Val);
00177   }
00178   else
00179   {
00180     TIM_ClearITPendingBit(TIM2, TIM_IT_CC4);
00181 
00182     /* Pin PC.09 toggling with frequency = 439.4 Hz */
00183     GPIO_WriteBit(GPIOC, GPIO_Pin_9, (BitAction)(1 - GPIO_ReadOutputDataBit(GPIOC, GPIO_Pin_9)));
00184     capture = TIM_GetCapture4(TIM2);
00185     TIM_SetCompare4(TIM2, capture + CCR4_Val);
00186   }
00187 }
00188 
00189 /******************************************************************************/
00190 /*                 STM32F10x Peripherals Interrupt Handlers                   */
00191 /*  Add here the Interrupt Handler for the used peripheral(s) (PPP), for the  */
00192 /*  available peripheral interrupt handler's name please refer to the startup */
00193 /*  file (startup_stm32f10x_xx.s).                                            */
00194 /******************************************************************************/
00195 
00196 /**
00197   * @brief  This function handles PPP interrupt request.
00198   * @param  None
00199   * @retval None
00200   */
00201 /*void PPP_IRQHandler(void)
00202 {
00203 }*/
00204 
00205 /**
00206   * @}
00207   */ 
00208 
00209 /**
00210   * @}
00211   */ 
00212 
00213 /******************* (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