STM8 interrupt vector

Publisher:快乐球球Latest update time:2021-10-19 Source: eefocusKeywords:STM8 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

In the stm8_interrupt_vector.c file, we can see that except for the Reset vector, the entries of other interrupt vectors all use the void NonHandledInterrupt (void) function. For normal use, we still need to re-change the interrupt function library function name.


      For the entry modification of the interrupt function:

      1. The interrupt vector table indicated by struct interrupt_vector const _vectab[], each similar to {0x82, NonHandledInterrupt}, the offset declaration represents the interrupt function name corresponding to an interrupt vector.


      2. Interrupt function declaration @far @interrupt void NonHandledInterrupt (void)

      For example, when you need to use I2C interrupt, you can do this:

      1. Declare the name of the I2C interrupt function:

      Find the I2C interrupt function entry in struct interrupt_vector const _vectab[] and add the I2C interrupt function name

      {0x82, I2C_Server_Interrupt },  

      2. Add service function in stm8_interrupt_vector.c file:

      @far @interrupt void I2C_Server_Interrupt (void)

 

      {

         ~~~~~Add interrupt service code~~~~~~

         return;

      }

 

      3. It is best to declare external callable above the file header: extern void I2C_Server_Interrupt (void)  

 

      4. Or just declare the function, then define the STM8_IT.c and STM8_IT.h files, and place all the interrupt service routines in them. 


      After the project is established, you can modify the project configuration through the menu bar "Project" -> "Settings"


Keywords:STM8 Reference address:STM8 interrupt vector

Previous article:Use of STVD in STM8
Next article:STM8S clock calibration notes 2 - calibrating HSI through AWU

Recommended ReadingLatest update time:2024-11-16 14:26

Low-power programming ideas for front-end and back-end systems - STM8 platform
1 Introduction     After I started working, I came across the term "low power consumption" and started searching for various low power MCUs. The Internet is a very free place, and you can always see various debates about which MCU has lower power consumption. In these debates, I looked up the characteristics of almost
[Microcontroller]
stm8s jumps out of the interrupt program c language, STVD automatically generates stm8
I'll sort it out, I don't know if I understand it correctly; /* BASIC INTERRUPT VECTOR TABLE FOR STM8 devices * Copyright (c) 2007 STMicroelectronics */ //typedef void (*)void,; define a type (pointer to function) to get the function entry address pointer of void type function typedef void @far (*interrupt_handler_t)(
[Microcontroller]
Summary of STM8 library development resources and basic steps
1. Download multiple versions of EWstm8 IAR EWSTM8 series tutorial 01_IAR introduction, download, installation and registration - Zhihu https://zhuanlan.zhihu.com/p/42499895 Download address: https://pan.baidu.com/s/1slF5kYx#list/path=%2F https://pan.baidu.com/s/1slF5kYx#list/path=%2F 2. Download the standard libr
[Microcontroller]
Summary of STM8 library development resources and basic steps
Learning STM8 SPI
#define SPI_CS_PORT GPIOC #define SPI_CS_PIN GPIO_PIN_4 #define SPI_CLK_PORT GPIOC #define SPI_CLK_PIN GPIO_PIN_5 #define SPI_MOSI_PORT GPIOC #define SPI_MOSI_PIN GPIO_PIN_6 #define SPI_MISO_PORT GPIOC #define SPI_MISO_PIN GPIO_PIN_7 SPI is the abbreviation of Serial Peripheral Interface, which is a single-master-mu
[Microcontroller]
STM8 study notes - PWM module
    First, configure the pin as a push-pull output. The following takes the up-counting mode as an example to explain the principle of PWM generation: TIMx starts counting up, TIMx_CNT is the count value, and the count is increased by 1. TIMx_ARR determines the upper limit of the count. After reaching the upper limit,
[Microcontroller]
The reason why the STM8 microcontroller inexplicably enters external interrupt
Just as the title!       I have been working on a project these days, using the STM8L152 microcontroller. There has been a problem during debugging, that is, it always stops at the same place. When using the emulator to simulate and debug, it always hangs at the same place. Later, I found that an inexplicable interrup
[Microcontroller]
The reason why the STM8 microcontroller inexplicably enters external interrupt
STM8 16-bit general-purpose timer (TIM2, TIM3, TIM5)
introduce This chapter introduces the STM8 general-purpose timers TIM2, TIM3 and TIM5, where TIM2 has 3 channels, TIM3 has 2 channels, and TIM5 is similar to TIM2 but with two additional registers for timer synchronization and cascading. The general-purpose timer consists of a 16-bit auto-load counter with a programma
[Microcontroller]
STM8 16-bit general-purpose timer (TIM2, TIM3, TIM5)
STM8 study notes---serial port uart1
To use the uart1 serial port, you need to use two files: stm8s_uart1.c and stm8s_uart1.h 1. Create a project directory structure as follows: 2. Write the uart.h file as follows: #ifndef __UART_H #define __UART_H #include "stm8s.h" #include "stm8s_clk.h" void USART_Configuration(void); //Serial port configuration f
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号