STM8S/A Standard Peripherals Firmware Library: stm8s_it.c Source File

STM8S/A

STM8S_StdPeriph_Examples/ADC2/ADC2_ContinuousConversion/stm8s_it.c
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file     stm8s_it.c
00004   * @author   MCD Application Team
00005   * @version  V2.2.0
00006   * @date     30-September-2014
00007   * @brief    Main Interrupt Service Routines.
00008   ******************************************************************************
00009   * @attention
00010   *
00011   * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
00012   *
00013   * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
00014   * You may not use this file except in compliance with the License.
00015   * You may obtain a copy of the License at:
00016   *
00017   *        http://www.st.com/software_license_agreement_liberty_v2
00018   *
00019   * Unless required by applicable law or agreed to in writing, software 
00020   * distributed under the License is distributed on an "AS IS" BASIS, 
00021   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00022   * See the License for the specific language governing permissions and
00023   * limitations under the License.
00024   *
00025   ******************************************************************************
00026   */ 
00027 
00028 /* Includes ------------------------------------------------------------------*/
00029 #include "stm8s_it.h"
00030 #include "stm8s_eval.h"
00031 
00032 /* Private typedef -----------------------------------------------------------*/
00033 /* Private define ------------------------------------------------------------*/
00034 /* Private macro -------------------------------------------------------------*/
00035 /* Private variables ---------------------------------------------------------*/
00036 extern uint16_t Conversion_Value;
00037 /* Private function prototypes -----------------------------------------------*/
00038 /* Private functions ---------------------------------------------------------*/
00039 /* Public functions ----------------------------------------------------------*/
00040 
00041 /** @addtogroup IT_Functions
00042   * @{
00043   */
00044 #ifdef _COSMIC_
00045 /**
00046   * @brief  Dummy interrupt routine
00047   * @param  None
00048   * @retval None
00049   */
00050 INTERRUPT_HANDLER(NonHandledInterrupt, 25)
00051 {
00052   /* In order to detect unexpected events during development,
00053      it is recommended to set a breakpoint on the following instruction.
00054   */
00055 }
00056 #endif /*_COSMIC_*/
00057 
00058 /**
00059   * @brief  TRAP interrupt routine
00060   * @param  None
00061   * @retval None
00062   */
00063 INTERRUPT_HANDLER_TRAP(TRAP_IRQHandler)
00064 {
00065   /* In order to detect unexpected events during development,
00066      it is recommended to set a breakpoint on the following instruction.
00067   */
00068 }
00069 /**
00070   * @brief  Top Level Interrupt routine
00071   * @param  None
00072   * @retval None
00073   */
00074 INTERRUPT_HANDLER(TLI_IRQHandler, 0)
00075 {
00076   /* In order to detect unexpected events during development,
00077      it is recommended to set a breakpoint on the following instruction.
00078   */
00079 }
00080 
00081 /**
00082   * @brief  Auto Wake Up Interrupt routine
00083   * @param  None
00084   * @retval None
00085   */
00086 INTERRUPT_HANDLER(AWU_IRQHandler, 1)
00087 {
00088   /* In order to detect unexpected events during development,
00089      it is recommended to set a breakpoint on the following instruction.
00090   */
00091 }
00092 
00093 /**
00094   * @brief  Clock Controller Interrupt routine
00095   * @param  None
00096   * @retval None
00097   */
00098 INTERRUPT_HANDLER(CLK_IRQHandler, 2)
00099 {
00100   /* In order to detect unexpected events during development,
00101      it is recommended to set a breakpoint on the following instruction.
00102   */
00103 }
00104 
00105 /**
00106   * @brief  External Interrupt PORTA Interrupt routine
00107   * @param  None
00108   * @retval None
00109   */
00110 INTERRUPT_HANDLER(EXTI_PORTA_IRQHandler, 3)
00111 {
00112   /* In order to detect unexpected events during development,
00113      it is recommended to set a breakpoint on the following instruction.
00114   */
00115 }
00116 
00117 /**
00118   * @brief  External Interrupt PORTB Interrupt routine
00119   * @param  None
00120   * @retval None
00121   */
00122 INTERRUPT_HANDLER(EXTI_PORTB_IRQHandler, 4)
00123 {
00124   /* In order to detect unexpected events during development,
00125      it is recommended to set a breakpoint on the following instruction.
00126   */
00127 }
00128 
00129 /**
00130   * @brief  External Interrupt PORTC Interrupt routine
00131   * @param  None
00132   * @retval None
00133   */
00134 INTERRUPT_HANDLER(EXTI_PORTC_IRQHandler, 5)
00135 {
00136   /* In order to detect unexpected events during development,
00137      it is recommended to set a breakpoint on the following instruction.
00138   */
00139 }
00140 
00141 /**
00142   * @brief  External Interrupt PORTD Interrupt routine
00143   * @param  None
00144   * @retval None
00145   */
00146 INTERRUPT_HANDLER(EXTI_PORTD_IRQHandler, 6)
00147 {
00148   /* In order to detect unexpected events during development,
00149      it is recommended to set a breakpoint on the following instruction.
00150   */
00151 }
00152 
00153 /**
00154   * @brief  External Interrupt PORTE Interrupt routine
00155   * @param  None
00156   * @retval None
00157   */
00158 INTERRUPT_HANDLER(EXTI_PORTE_IRQHandler, 7)
00159 {
00160   /* In order to detect unexpected events during development,
00161      it is recommended to set a breakpoint on the following instruction.
00162   */
00163 }
00164 
00165 #ifdef STM8S903
00166 /**
00167   * @brief  External Interrupt PORTF Interrupt routine
00168   * @param  None
00169   * @retval None
00170   */
00171  INTERRUPT_HANDLER(EXTI_PORTF_IRQHandler, 8)
00172  {
00173   /* In order to detect unexpected events during development,
00174      it is recommended to set a breakpoint on the following instruction.
00175   */
00176  }
00177 #endif /*STM8S903*/
00178 
00179 #if defined (STM8S208) || defined (STM8AF52Ax)
00180 /**
00181   * @brief CAN RX Interrupt routine.
00182   * @param  None
00183   * @retval None
00184   */
00185  INTERRUPT_HANDLER(CAN_RX_IRQHandler, 8)
00186  {
00187   /* In order to detect unexpected events during development,
00188      it is recommended to set a breakpoint on the following instruction.
00189   */
00190  }
00191 
00192 /**
00193   * @brief  CAN TX Interrupt routine
00194   * @param  None
00195   * @retval None
00196   */
00197  INTERRUPT_HANDLER(CAN_TX_IRQHandler, 9)
00198  {
00199   /* In order to detect unexpected events during development,
00200      it is recommended to set a breakpoint on the following instruction.
00201   */
00202  }
00203 #endif /*STM8S208 || STM8AF52Ax */
00204 
00205 /**
00206   * @brief  SPI Interrupt routine
00207   * @param  None
00208   * @retval None
00209   */
00210 INTERRUPT_HANDLER(SPI_IRQHandler, 10)
00211 {
00212   /* In order to detect unexpected events during development,
00213      it is recommended to set a breakpoint on the following instruction.
00214   */
00215 }
00216 
00217 /**
00218   * @brief  Timer1 Update/Overflow/Trigger/Break Interrupt routine
00219   * @param  None
00220   * @retval None
00221   */
00222 INTERRUPT_HANDLER(TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11)
00223 {
00224   /* In order to detect unexpected events during development,
00225      it is recommended to set a breakpoint on the following instruction.
00226   */
00227 }
00228 
00229 /**
00230   * @brief  Timer1 Capture/Compare Interrupt routine
00231   * @param  None
00232   * @retval None
00233   */
00234 INTERRUPT_HANDLER(TIM1_CAP_COM_IRQHandler, 12)
00235 {
00236   /* In order to detect unexpected events during development,
00237      it is recommended to set a breakpoint on the following instruction.
00238   */
00239 }
00240 
00241 #ifdef STM8S903
00242 /**
00243   * @brief  Timer5 Update/Overflow/Break/Trigger Interrupt routine
00244   * @param  None
00245   * @retval None
00246   */
00247  INTERRUPT_HANDLER(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13)
00248  {
00249   /* In order to detect unexpected events during development,
00250      it is recommended to set a breakpoint on the following instruction.
00251   */
00252  }
00253 /**
00254   * @brief  Timer5 Capture/Compare Interrupt routine
00255   * @param  None
00256   * @retval None
00257   */
00258  INTERRUPT_HANDLER(TIM5_CAP_COM_IRQHandler, 14)
00259  {
00260   /* In order to detect unexpected events during development,
00261      it is recommended to set a breakpoint on the following instruction.
00262   */
00263  }
00264 
00265 #else /*STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x */
00266 /**
00267   * @brief  Timer2 Update/Overflow/Break Interrupt routine
00268   * @param  None
00269   * @retval None
00270   */
00271  INTERRUPT_HANDLER(TIM2_UPD_OVF_BRK_IRQHandler, 13)
00272  {
00273   /* In order to detect unexpected events during development,
00274      it is recommended to set a breakpoint on the following instruction.
00275   */
00276  }
00277 
00278 /**
00279   * @brief  Timer2 Capture/Compare Interrupt routine
00280   * @param  None
00281   * @retval None
00282   */
00283  INTERRUPT_HANDLER(TIM2_CAP_COM_IRQHandler, 14)
00284  {
00285   /* In order to detect unexpected events during development,
00286      it is recommended to set a breakpoint on the following instruction.
00287   */
00288  }
00289 #endif /*STM8S903*/
00290 
00291 #if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) || \
00292     defined(STM8S005) ||  defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8AF626x)
00293 /**
00294   * @brief Timer3 Update/Overflow/Break Interrupt routine.
00295   * @param  None
00296   * @retval None
00297   */
00298  INTERRUPT_HANDLER(TIM3_UPD_OVF_BRK_IRQHandler, 15)
00299  {
00300   /* In order to detect unexpected events during development,
00301      it is recommended to set a breakpoint on the following instruction.
00302   */
00303  }
00304 
00305 /**
00306   * @brief  Timer3 Capture/Compare Interrupt routine
00307   * @param  None
00308   * @retval None
00309   */
00310  INTERRUPT_HANDLER(TIM3_CAP_COM_IRQHandler, 16)
00311  {
00312   /* In order to detect unexpected events during development,
00313      it is recommended to set a breakpoint on the following instruction.
00314   */
00315  }
00316 #endif /*STM8S208, STM8S207 or STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x */
00317 
00318 #if defined (STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S103) || \
00319     defined(STM8S003) ||  defined (STM8AF62Ax) || defined (STM8AF52Ax) || defined (STM8S903)
00320 /**
00321   * @brief  UART1 TX Interrupt routine
00322   * @param  None
00323   * @retval None
00324   */
00325  INTERRUPT_HANDLER(UART1_TX_IRQHandler, 17)
00326  {
00327     /* In order to detect unexpected events during development,
00328        it is recommended to set a breakpoint on the following instruction.
00329     */
00330  }
00331 
00332 /**
00333   * @brief  UART1 RX Interrupt routine
00334   * @param  None
00335   * @retval None
00336   */
00337  INTERRUPT_HANDLER(UART1_RX_IRQHandler, 18)
00338  {
00339     /* In order to detect unexpected events during development,
00340        it is recommended to set a breakpoint on the following instruction.
00341     */
00342  }
00343 #endif /*STM8S208 or STM8S207 or STM8S103 or STM8S903 or STM8AF62Ax or STM8AF52Ax */
00344 
00345 /**
00346   * @brief  I2C Interrupt routine
00347   * @param  None
00348   * @retval None
00349   */
00350 INTERRUPT_HANDLER(I2C_IRQHandler, 19)
00351 {
00352   /* In order to detect unexpected events during development,
00353      it is recommended to set a breakpoint on the following instruction.
00354   */
00355 }
00356 
00357 #if defined(STM8S105) || defined(STM8S005) ||  defined (STM8AF626x)
00358 /**
00359   * @brief  UART2 TX interrupt routine.
00360   * @param  None
00361   * @retval None
00362   */
00363  INTERRUPT_HANDLER(UART2_TX_IRQHandler, 20)
00364  {
00365     /* In order to detect unexpected events during development,
00366        it is recommended to set a breakpoint on the following instruction.
00367     */
00368  }
00369 
00370 /**
00371   * @brief  UART2 RX interrupt routine.
00372   * @param  None
00373   * @retval None
00374   */
00375  INTERRUPT_HANDLER(UART2_RX_IRQHandler, 21)
00376  {
00377     /* In order to detect unexpected events during development,
00378        it is recommended to set a breakpoint on the following instruction.
00379     */
00380  }
00381 #endif /* STM8S105 or STM8AF626x */
00382 
00383 #if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
00384 /**
00385   * @brief  UART3 TX interrupt routine.
00386   * @param  None
00387   * @retval None
00388   */
00389  INTERRUPT_HANDLER(UART3_TX_IRQHandler, 20)
00390  {
00391     /* In order to detect unexpected events during development,
00392        it is recommended to set a breakpoint on the following instruction.
00393     */
00394  }
00395 
00396 /**
00397   * @brief  UART3 RX interrupt routine.
00398   * @param  None
00399   * @retval None
00400   */
00401  INTERRUPT_HANDLER(UART3_RX_IRQHandler, 21)
00402  {
00403     /* In order to detect unexpected events during development,
00404        it is recommended to set a breakpoint on the following instruction.
00405     */
00406  }
00407 #endif /*STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax */
00408 
00409 #if defined(STM8S207) || defined(STM8S007) || defined(STM8S208) || defined (STM8AF52Ax) || defined (STM8AF62Ax)
00410 /**
00411   * @brief  ADC2 interrupt routine.
00412   * @param  None
00413   * @retval None
00414   */
00415  INTERRUPT_HANDLER(ADC2_IRQHandler, 22)
00416  {
00417     /* In order to detect unexpected events during development,
00418        it is recommended to set a breakpoint on the following instruction.
00419     */
00420     
00421     /* Get converted value */
00422     Conversion_Value = ADC2_GetConversionValue();
00423 
00424     if (Conversion_Value == 0x0)
00425     {
00426         /* Turn off LED1..4*/
00427         STM_EVAL_LEDOff(LED1);
00428         STM_EVAL_LEDOff(LED2);
00429         STM_EVAL_LEDOff(LED3);
00430         STM_EVAL_LEDOff(LED4);
00431      }
00432     else if ((Conversion_Value <= 0xFF) && (Conversion_Value > 0x0))
00433     {
00434         /* Turn on LED1 */
00435         STM_EVAL_LEDOn(LED1);
00436         
00437         /* Turn off LED2..4 */
00438         STM_EVAL_LEDOff(LED2);
00439         STM_EVAL_LEDOff(LED3);
00440         STM_EVAL_LEDOff(LED4);
00441     }
00442     else if ((Conversion_Value >= 0x100) && (Conversion_Value <= 0x1FF))
00443     {
00444         /* Turn on LED1 and LED2 */
00445         STM_EVAL_LEDOn(LED1);
00446         STM_EVAL_LEDOn(LED2);
00447         
00448         /* Turn off LED3 and LED4 */
00449         STM_EVAL_LEDOff(LED3);
00450         STM_EVAL_LEDOff(LED4);
00451     }
00452     else if ((Conversion_Value >= 0x200) && (Conversion_Value <= 0x2FF))
00453     {
00454         /* Turn on LED1..3 */
00455         STM_EVAL_LEDOn(LED1);
00456         STM_EVAL_LEDOn(LED2);
00457         STM_EVAL_LEDOn(LED3);
00458         
00459         /* Turn off LED4 */
00460         STM_EVAL_LEDOff(LED4);
00461     }
00462     else
00463     {
00464         /* Turn on LED1..4*/
00465         STM_EVAL_LEDOn(LED1);
00466         STM_EVAL_LEDOn(LED2);
00467         STM_EVAL_LEDOn(LED3);
00468         STM_EVAL_LEDOn(LED4);
00469     }
00470     ADC2_ClearITPendingBit();
00471  }
00472 #else /*STM8S105, STM8S103 or STM8S903 or STM8AF626x */
00473 /**
00474   * @brief  ADC1 interrupt routine.
00475   * @param  None
00476   * @retval None
00477   */
00478  INTERRUPT_HANDLER(ADC1_IRQHandler, 22)
00479  {
00480     /* In order to detect unexpected events during development,
00481        it is recommended to set a breakpoint on the following instruction.
00482     */
00483  }
00484 #endif /*STM8S208 or STM8S207 or STM8AF52Ax or STM8AF62Ax */
00485 
00486 #ifdef STM8S903
00487 /**
00488   * @brief  Timer6 Update/Overflow/Trigger Interrupt routine
00489   * @param  None
00490   * @retval None
00491   */
00492 INTERRUPT_HANDLER(TIM6_UPD_OVF_TRG_IRQHandler, 23)
00493  {
00494   /* In order to detect unexpected events during development,
00495      it is recommended to set a breakpoint on the following instruction.
00496   */
00497  }
00498 #else /*STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x */
00499 /**
00500   * @brief  Timer4 Update/Overflow Interrupt routine
00501   * @param  None
00502   * @retval None
00503   */
00504  INTERRUPT_HANDLER(TIM4_UPD_OVF_IRQHandler, 23)
00505  {
00506   /* In order to detect unexpected events during development,
00507      it is recommended to set a breakpoint on the following instruction.
00508   */
00509  }
00510 #endif /*STM8S903*/
00511 
00512 /**
00513   * @brief  Eeprom EEC Interrupt routine
00514   * @param  None
00515   * @retval None
00516   */
00517 INTERRUPT_HANDLER(EEPROM_EEC_IRQHandler, 24)
00518 {
00519   /* In order to detect unexpected events during development,
00520      it is recommended to set a breakpoint on the following instruction.
00521   */
00522 }
00523 
00524 /**
00525   * @}
00526   */
00527 
00528 
00529 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
STM8 Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM8 8-bit Microcontrollers platform visit www.st.com