Embedded Learning Notes 9——51 MCU Interrupt External Interrupt

Publisher:平和的心情Latest update time:2016-05-16 Source: eefocusKeywords:Embedded Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1. The principle of interruption:

   The CPU temporarily interrupts its current work (this is called interrupt response) and switches to processing event B (this is called interrupt service).

2. The interrupt system of 89C51 has 5 interrupt sources (in order of priority: external interrupt 0, timer interrupt 0, external interrupt 1, timer interrupt 1, serial port interrupt), 2 priorities, and can realize secondary interrupt nesting (an interrupt with a higher priority occurs during the interrupt processing process). Advanced microcontrollers may have more interrupt sources and more priorities.

Embedded Learning Notes 9——51 MCU Interrupt External Interrupt
 

Embedded Learning Notes 9——51 MCU Interrupt External Interrupt
 

3. The interrupt priority of 89C51 microcontroller has three principles:

  (1) When the CPU receives several interrupts at the same time, it responds to the interrupt request with the highest priority first. (2) The ongoing interrupt process cannot be interrupted by a new interrupt request of the same or lower priority. (3) The ongoing low-priority interrupt service can be interrupted by a high-priority interrupt request. (To implement the latter two principles, the system has two non-addressable priority triggers. One of them is set to 1, indicating that it is responding to a high-priority interrupt and will block all subsequent interrupt requests; the other is set to 1, indicating that it is responding to a low-priority interrupt and will block all subsequent low-priority interrupt requests.)

 

4. The CPU's development and shielding of all interrupts of the interrupt system and a certain interrupt source are controlled by the interrupt enable register IE.

Embedded Learning Notes 9——51 MCU Interrupt External Interrupt
 

 

5. Interrupt response conditions:

   (1) The interrupt source has an interrupt request; (2) The interrupt enable bit of this interrupt source is 1; (3) The CPU turns on the interrupt (i.e. EA = 1).

6. What does a programmer need to do to use interrupts?

    (1) Which interrupt to use (external interrupt, timer interrupt, serial port interrupt, etc.) determines the interrupt number to respond to; (2) What conditions are expected to trigger the interrupt, such as falling edge trigger or low level trigger; (3) What to do after the interrupt (the interrupt service program should be as short as possible).

      For example: a. Set the response value in IE - EA is set to 1 (allow CPU interrupts) and turn on the interrupt to be used; b. Set the trigger mode of the corresponding interrupt in TCON (as shown in the TCON register below); c. Write the interrupt service program (void function name () interrupt interrupt number using any value from 0 to 3 { function body }, where the value from 0 to 3 indicates selecting one of the four groups of registers on the chip to save the scene before the interrupt. It is usually recommended that beginners do not write "using any value from 0 to 3" because you are not clear about the usage of the internal registers. If you do not write it, Keil will automatically specify it for you.)

Embedded Learning Notes 9——51 MCU Interrupt External Interrupt
 

7. External interrupt:

IT0 (TCON.0) determines whether external interrupt 0 is low level active or falling edge active (from high level to low level). Similarly, IT1 (TCON.2) corresponds to external interrupt 1.

Keywords:Embedded Reference address:Embedded Learning Notes 9——51 MCU Interrupt External Interrupt

Previous article:51 MCU external interrupt example
Next article:Embedded Learning Notes 10——51 MCU Interrupt Timer Interrupt

Recommended ReadingLatest update time:2024-11-17 02:29

Development of 51 MCU (STC89C52) under Ubuntu
Introduction They are all 8-bit MCUs derived from 8051. STC MCUs have several major series: 89/90/10/11/12/15. The characteristics of each series are as follows The 89 series is a traditional 8051 microcontroller. The burning method is different, but the function is compatible with the AT89 series. It belongs to the
[Microcontroller]
Design of electronic password lock based on 51 single chip microcomputer -- 1602 display
1. Hardware Solution This system consists of STC89C52 single-chip microcomputer, 44 matrix keyboard, buzzer, reset circuit and crystal oscillator circuit, relay, etc. The 44 keyboard is mainly used for password input and modification, the buzzer alarm, reset circuit and crystal oscillator circuit and STC89C52 single-c
[Microcontroller]
Design of electronic password lock based on 51 single chip microcomputer -- 1602 display
Application of 8051 microcontroller in robotics and medical fields
  It has been more than 40 years since the birth of the 8051 microcontroller. Due to the expiration of the patent, domestic 8051 microcontrollers are generally much cheaper in price. With the development of science and technology, the use of microcontrollers has reduced the size, cost and complexity of electronic prod
[Microcontroller]
Application of 8051 microcontroller in robotics and medical fields
51 MCU interrupt function
Interrupts are implemented using the interrupt keyword and terminal numbers 0-4: Return value Function name  interrupt n n corresponds to the number of the interrupt source. The interrupt number tells the interrupter the entry address of the interrupt program, which corresponds to the enable bit in the IE register, t
[Microcontroller]
Design of train voice broadcasting system based on ISD4004 and AT89C51 microcontroller
In the modern industrial control process, working status and fault status alarm devices are widely used. They usually use sound and light to remind the operator to deal with the problems in time. With the development of new technologies, people have begun to apply voice technology to this field. It provides relevant i
[Microcontroller]
Design of train voice broadcasting system based on ISD4004 and AT89C51 microcontroller
C51 MCU LCD1602 Driver
LCD1602 Introduction LCD1602 character liquid crystal (16 characters per line, two lines in total) - a dot matrix liquid crystal module specially used to display letters, numbers and symbols. It is composed of several 5x7 or 5x10 dot matrix characters. Each dot matrix character position can be used to display a chara
[Microcontroller]
C51 MCU LCD1602 Driver
【51 MCU Experiment】INT0 interrupt count
Preface —Interrupt Sources— 52 MCU: 6 interrupt sources: INT0: External interrupt 0, P3.2, caused by: low level, falling edge INT1: External interrupt 1, P3.3, caused by: low level, falling edge T0: Timer/Counter 0 interrupt, caused by T0 counter full count back to zero T1: Timer/Counter 1 interrupt, caused by
[Microcontroller]
【51 MCU Experiment】INT0 interrupt count
Self-debugging and online programming of 51 single-chip microcomputer
Traditional single-chip microcomputer system development is always inseparable from simulators and programmers. With the rapid development of electronic and computer technology, single-chip microcomputer technology has also achieved unprecedented development. Some 16-bit single-chip microcomputers and 32-bit ARM mic
[Microcontroller]
Self-debugging and online programming of 51 single-chip microcomputer
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号