Interrupts are an important part of embedded systems, but they are not included in standard C. Many compiler developers have added support for interrupts to standard C, providing new keywords for marking interrupt service routines (ISRs), such as __interrupt, #program interrupt, etc. When a function is defined as an ISR, the compiler will automatically add the interrupt scene stack push and pop codes required by the interrupt service routine to the function.
The interrupt service routine needs to meet the following requirements:
(1) Cannot return a value;
(2) Parameters cannot be passed to the ISR;
(3) ISR should be as short and powerful as possible;
(4) The printf(char * lpFormatString,…) function will cause reentrancy and performance issues and cannot be used in ISR.
My personal understanding
If the interrupt service routine has a return value, to whom does it return the value?
During the operation of the system, some interrupt source must have triggered a corresponding interrupt. The interrupt service program attached to the system performs on-site processing, such as alarms and other operations, and then clears the interrupt.
In other words, the interrupt service routine is linked to a certain type of interrupt source, and the generation of these interrupt sources is random. Therefore, the interrupt service routine does not have a fixed caller or a fixed return address, so the return value is useless.
Previous article:The concept, principle and application of microcontroller watchdog
Next article:Can interrupt service functions have parameters and return values?
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
- Question about a buzzer drive circuit
- What is the reason for the sudden reduction of tantalum capacitor at the power input end?
- What should I do if the RTC clock occasionally delays or times out?
- How to design millimeter wave filters
- The vivado simulation output waveform signal input is all Z and the output is all X
- Fix the problem that the MSP430 emulator cannot be used (caused by firmware upgrade)
- Design of screen self-checking program based on FPGA
- Live FAQ|Fujitsu FRAM non-encryption algorithm (spectrum) authenticity verification solution
- Based on STM32F303 dual motor FOC driver: sensorless schematic/BOM/code and other open source sharing
- (C- Wireless Charging Electric Car) 2018TI Cup Wireless Charging Car