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"
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
- Popular Resources
- Popular amplifiers
- STM8 C language programming (1) - basic program and startup code analysis
- Description of the BLDC back-EMF sampling method based on the STM8 official library
- CVPR 2023 Paper Summary: Document Analysis and Understanding
- STM32 MCU project example: Smart watch design based on TouchGFX (8) Associating the underlying driver with the UI
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- They are all six non-gates. This power supply can be used even if it is connected reversely, but it cannot be replaced.
- About the test of power supply Wenbo
- EEWORLD University - Understand the basic technology of power density
- EEWORLD University Hall----Live Replay: Melexis explains the implementation and technical support of semiconductor R&D functional safety
- FPGA controls TMS320C6678 power-on reset program
- 【TGF4042 signal generator】+6th issue pwm modulation
- Can PCB boards be replaced? Everything you want to know is here!
- Transparent LED display classification
- 2019 TI E-Sports Evaluation Table
- STM32F4, how to deal with unused pins? Can they be left floating?