关于STM8S中断服务向量号的疑问

2019-07-15 09:12发布

  1. #pragma vector=0xD
  2. __interrupt void tiM1_UPD_OVF_TRG_BRK_IRQHandler(void)
  3. {
  4.   TIMER1_Decrement();
  5.   TIM1_ClearITPendingBit(TIM1_IT_UPDATE);
  6. }
复制代码上边是网友的代码
  1. /* BASIC INTERRUPT VECTORS TABLE FOR STM8 devices
  2. * Copyright (c) 2014 STMicroelectronics
  3. */

  4. #include "stm8s_it.h"

  5. typedef void [url=home.php?mod=space&uid=625061]@far[/url] (*interrupt_handler_t)(void);

  6. struct interrupt_vector {
  7.         u8 interrupt_instruction;
  8.         interrupt_handler_t interrupt_handler;
  9. };

  10. struct interrupt_vector const _vectab[] = {
  11.   {0x82, (interrupt_handler_t)_stext}, /* RESET */
  12.   {0x82, (interrupt_handler_t)TRAP_IRQHandler}, /* TRAP - Software interrupt */
  13.         {0x82, (interrupt_handler_t)TLI_IRQHandler}, /* irq0 - External Top Level interrupt (TLI) */
  14.         {0x82, (interrupt_handler_t)AWU_IRQHandler}, /* irq1 - Auto Wake Up from Halt interrupt */
  15.         {0x82, (interrupt_handler_t)CLK_IRQHandler}, /* irq2 - Clock Controller interrupt */
  16.   {0x82, (interrupt_handler_t)EXTI_PORTA_IRQHandler}, /* irq3 - External interrupt 0 (GPIOA) */
  17.         {0x82, (interrupt_handler_t)EXTI_PORTB_IRQHandler}, /* irq4 - External interrupt 1 (GPIOB) */
  18.         {0x82, (interrupt_handler_t)EXTI_PORTC_IRQHandler}, /* irq5 - External interrupt 2 (GPIOC) */
  19.         {0x82, (interrupt_handler_t)EXTI_PORTD_IRQHandler}, /* irq6 - External interrupt 3 (GPIOD) */
  20.         {0x82, (interrupt_handler_t)EXTI_PORTE_IRQHandler}, /* irq7 - External interrupt 4 (GPIOE) */
  21.        
  22. #if defined(STM8S208) || defined(STM8AF52Ax)
  23.         {0x82, (interrupt_handler_t)CAN_RX_IRQHandler}, /* irq8 - CAN Rx interrupt */
  24.         {0x82, (interrupt_handler_t)CAN_TX_IRQHandler}, /* irq9 - CAN Tx/ER/SC interrupt */
  25. #elif defined(STM8S903) || defined(STM8AF622x)
  26.         {0x82, (interrupt_handler_t)EXTI_PORTF_IRQHandler}, /* irq8 - External interrupt 5 (GPIOF) */
  27.         {0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq9 - Reserved */
  28. #else /*STM8S207, STM8S105 or STM8AF62Ax or STM8AF626x*/
  29.         {0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq8 - Reserved */
  30.         {0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq9 - Reserved */
  31. #endif /* STM8S208 or STM8AF52Ax */
  32.         {0x82, (interrupt_handler_t)SPI_IRQHandler}, /* irq10 - SPI End of transfer interrupt */
  33.         {0x82, (interrupt_handler_t)TIM1_UPD_OVF_TRG_BRK_IRQHandler}, /* irq11 - TIM1 Update/Overflow/Trigger/Break interrupt */
  34.         {0x82, (interrupt_handler_t)TIM1_CAP_COM_IRQHandler}, /* irq12 - TIM1 Capture/Compare interrupt */
  35.   
  36. #if defined(STM8S903) || defined(STM8AF622x)
  37.   {0x82, (interrupt_handler_t)TIM5_UPD_OVF_BRK_TRG_IRQHandler}, /* irq13 - TIM5 Update/Overflow/Break/Trigger interrupt  */
  38.   {0x82, (interrupt_handler_t)TIM5_CAP_COM_IRQHandler}, /* irq14 - TIM5 Capture/Compare interrupt */
  39.        
  40. #else /*STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x*/
  41.   {0x82, (interrupt_handler_t)TIM2_UPD_OVF_BRK_IRQHandler}, /* irq13 - TIM2 Update/Overflow/Break interrupt  */
  42.   {0x82, (interrupt_handler_t)TIM2_CAP_COM_IRQHandler}, /* irq14 - TIM2 Capture/Compare interrupt */
  43. #endif /*STM8S903*/
  44.        
  45. #if defined(STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8S105) ||
  46.     defined(STM8S005) ||  defined(STM8AF52Ax) || defined(STM8AF62Ax) || defined(STM8AF626x)
  47.   {0x82, (interrupt_handler_t)TIM3_UPD_OVF_BRK_IRQHandler}, /* irq15 - TIM3 Update/Overflow/Break interrupt */
  48.   {0x82, (interrupt_handler_t)TIM3_CAP_COM_IRQHandler}, /* irq16 - TIM3 Capture/Compare interrupt */
  49. #else
  50.         {0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq15 - Reserved */
  51.         {0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq16 - Reserved */
  52. #endif /*STM8S208, STM8S207, STM8S105 or STM8AF62Ax or STM8AF52Ax or STM8AF626x*/
  53.        
  54. #if defined(STM8S105) || defined(STM8S005) || defined(STM8AF626x)
  55.         {0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq17 - Reserved */
  56.         {0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq18 - Reserved */
  57. #elif defined (STM8AF622x)
  58.         {0x82, (interrupt_handler_t)UART4_TX_IRQHandler}, /* irq17 - UART4 Tx complete interrupt */
  59.         {0x82, (interrupt_handler_t)UART4_RX_IRQHandler}, /* irq18 - UART4 Rx interrupt */
  60. #else       
  61.         {0x82, (interrupt_handler_t)UART1_TX_IRQHandler}, /* irq17 - UART1 Tx complete interrupt */
  62.         {0x82, (interrupt_handler_t)UART1_RX_IRQHandler}, /* irq18 - UART1 Rx interrupt */
  63. #endif /*STM8S105 or STM8AF626x */
  64.         {0x82, (interrupt_handler_t)I2C_IRQHandler}, /* irq19 - I2C interrupt */

  65. #if defined(STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8AF52Ax) || defined(STM8AF62Ax)

  66.         {0x82, (interrupt_handler_t)UART3_TX_IRQHandler}, /* irq20 - UART3 Tx interrupt */
  67.         {0x82, (interrupt_handler_t)UART3_RX_IRQHandler}, /* irq21 - UART3 Rx interrupt */
  68. #elif defined(STM8S105) || defined(STM8S005) || defined(STM8AF626x)
  69.         {0x82, (interrupt_handler_t)UART2_TX_IRQHandler}, /* irq20 - UART2 Tx interrupt */
  70.         {0x82, (interrupt_handler_t)UART2_RX_IRQHandler}, /* irq21 - UART2 Rx interrupt */

  71. #else /* STM8S103, STM8S903, STM8AF622x */
  72.         {0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq20 - Reserved */
  73.         {0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq21 - Reserved */
  74. #endif /* STM8S208, STM8S207, STM8AF52Ax or STM8AF62Ax */

  75. #if defined(STM8S208) || defined(STM8S207) || defined(STM8S007) || defined(STM8AF52Ax) || defined(STM8AF62Ax)
  76.         {0x82, (interrupt_handler_t)ADC2_IRQHandler}, /* irq22 - ADC2 end of conversion interrupt */
  77. #else /* STM8S105, STM8S103, STM8S903, STM8AF622x   */
  78.         {0x82, (interrupt_handler_t)ADC1_IRQHandler}, /* irq22 - ADC1 end of conversion/Analog watchdog interrupts */

  79. #endif /* STM8S208, STM8S207, STM8AF52Ax or STM8AF62Ax */

  80. #if defined(STM8S903) || defined(STM8AF622x)
  81.         {0x82, (interrupt_handler_t)TIM6_UPD_OVF_TRG_IRQHandler}, /* irq23 - TIM6 Update/Overflow/Trigger interrupt */
  82. #else
  83.         {0x82, (interrupt_handler_t)TIM4_UPD_OVF_IRQHandler}, /* irq23 - TIM4 Update/Overflow interrupt */
  84. #endif /* (STM8S903) || (STM8AF622x) */
  85.         {0x82, (interrupt_handler_t)EEPROM_EEC_IRQHandler},  /* irq24 - FLASH interrupt */
  86.         {0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq25 - Reserved */
  87.         {0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq26 - Reserved */
  88.         {0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq27 - Reserved */
  89.         {0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq28 - Reserved */
  90.         {0x82, (interrupt_handler_t)NonHandledInterrupt}, /* irq29 - Reserved */

  91. };

  92. /******************* (C) COPYRIGHT 2014 STMicroelectronics *****END OF FILE****/
复制代码上边是从STM8固件库中的模板工程拷贝出为的
想问下 #pragma vector=0xD 为什么是0XD   而模板中的全是0X82
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
1条回答
beiC
1楼-- · 2019-07-15 11:21
N76E003 在20 pin封装下提供高达18根I/O脚位;周边包含双串口、SPI、I²C、6通道PWM输出;内建优于同类产品之 < 2% 误差之高精确度16 MHz RC晶振与高分辨率8通道12位ADC;并具备自我唤醒、欠压检测等功能;提供TSSOP20 (4mm*6.5mm) 与QFN20 (3mm*3mm) 小封装,兼具高性能与设计弹性。


应用领域 :

门禁系统/警报器、温度传感设备、蓝牙音箱、电动车表头、数字电压表头、气体检测器、采集器、充电器、美容仪器、小家电等。



关键特性 :

内核(core)
- 1T 8051微处理器
- 工作频率可达 16 MHz
- 工作电压: 2.4V 至 5.5V
- 工作温度: -40℃ 至 105℃

内存(memory)
- 18 KB应用程序 Flash
- 内嵌1 KB SRAM
- 可配置的 Data Flash
- 支持在线系统更新:

ISP(In-System Programming)
ICP(In-Circuit Programming)
IAP(In-Application Programming)
脉波宽度调变(PWM)
- 6通道PWM输出
- 带死区产生器

模拟转数字转换器(ADC)
- 12位8通道ADC
- 每秒转换速率可达500 kSPS

通信接口(connectivity)
- 二组UART,可达115200 bps
- 一组SPI,可达8 MHz
- 一组 I²C,可达 400 kHz

时钟控制(clock control)
-内置< 2% 误差16 MHz 高精度RC晶振
-内置低速省电10 kHz RC晶振

DS_N76E003中文规格书_SC_Rev1.00.pdf 下载积分: 积分 -1 分

4.38 MB, 下载次数: 4, 下载积分: 积分 -1 分

一周热门 更多>