RTOS Interrupts - Introduction to Interrupts

First acquaintance interrupted

overview

Want quick response and easy programming of your device? Using interrupts is a good idea.

The preceding chapters mainly describe the use and design of tasks, including task management, inter-task communication, and protection of shared resources between tasks. The operating system provides an easy-to-use task management mechanism, as well as rich communication components and protection methods for shared resources. So, can we design an embedded system that meets our expectations using these functions provided by the operating system?

The answer is no, because only relying on the task, the device can only perform a designed function according to the agreement, does not have the ability to deal with any emergencies, and cannot perceive what is happening in the outside world. Such devices are actually very few of.

Why Disruption Is Necessary

In most cases, we need to rely on the interrupt function of the device to realize the ability to handle emergencies and perceive external events.

Interruption is a function of the device itself, just as a person is used for the five senses. Humans use their five senses to understand what is happening in the outside world, and devices judge what is happening in the outside world through interruptions. Some devices can see external things with a camera, and some devices cannot see external things without a camera.

Through the interrupt mechanism, when the peripheral does not require CPU intervention, the CPU can perform other tasks, and when the peripheral needs the CPU, the CPU can immediately stop the current task and respond to the interrupt request by generating an interrupt signal. In this way, the CPU can avoid spending a lot of time waiting and inquiring about the status of peripheral devices, so the real-time performance and execution efficiency of the overall system will be greatly improved.

insert image description here
In addition, interrupts are faster to react and less complex to program than tasks.

What is interrupt response?

When an interruption occurs,

Guess you like

Origin blog.csdn.net/wangyx1234/article/details/128175086