Expansion of External Interrupt Sources of MCU

Publisher:才富五车330Latest update time:2015-03-23 Source: diangonKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Design a system with five external interrupt sources. The highest level external interrupt source is connected to the INT0 pin, and the rest of the interrupt sources are connected to the INT1 pin. Draw the system circuit schematic and write the interrupt service routine for external interrupt 1.

Case analysis:
The method of combining interrupt and query is to sort multiple external interrupt sources in the system according to their importance, connect the highest-level interrupt source to an external interrupt source input terminal of MCS-51 (for example, to a pin), and connect the remaining interrupt sources to another external interrupt input terminal ( ) by wire "OR" method, and connect to an I/O port at the same time, such as P1 port as shown in Figure 3. The interrupt request is generated by the hardware circuit, and the identification of the interrupt source is processed by program query. The query order is determined by the priority of the interrupt source. Figure 3 shows the connection circuit of five external interrupt sources, in which devices 1~4 are connected through OC gates and connected to P1.0~P1.3, all using level triggering. Device 0 is the highest-level interrupt source and is used as the input signal of external interrupt 0 alone. This method is relatively simple to expand, but when the number of external interrupt expansions is large, the query time is relatively long, resulting in low program execution efficiency.
Program code:
ORG 1000H
LJMP INTR
INTR: PUSH PSW ; protect context
PUSH A 
JNB P1.0, IR1 ; P1.0 pin is 0, jump to device 1 interrupt service routine
JNB P1.1, IR2 ; P1.1 pin is 0, jump to device 2 interrupt service routine
JNB P1.2, IR3 ; P1.2 pin is 0, jump to device 3 interrupt service routine
JNB P1.3, IR4 ; P1.3 pin is 0, jump to device 4 interrupt service routine
INTR1: POP A ; restore context
POP PSW 
RETI ; interrupt return
IR1: …… ; device 1 interrupt service routine entry
AJMP INTR1 ; jump to the instruction indicated by INTR1
IR2: …… ; device 2 interrupt service routine entry
AJMP INTR1 ; jump to INTR1
IR3: …… ; device 3 interrupt service routine entry
AJMP INTR1 ; Jump to INTR1
IR4: ... ; Device 4 interrupt service routine entry
AJMP INTR1 ; Jump to INTR1


Keywords:MCU Reference address:Expansion of External Interrupt Sources of MCU

Previous article:Summary of small problems in microcontroller programming
Next article:Extension of Parallel I/O Interface of Single Chip Microcomputer

Recommended ReadingLatest update time:2024-11-16 01:25

MSP430 MCU GPIO Programming Tutorial
In this tutorial, we will learn how to program the GPIO of the MSP430 microcontroller. This article is also applicable to MSP430x2xx devices used on Launchpad development boards, such as MSP430G2553, MSP430G2231, etc. Most pins on the MSP430 microcontroller are grouped into up to 8 ports, P1 to P8. Each port is 8 bits
[Microcontroller]
Serial communication program for two 51 single-chip microcomputers to communicate with each other
;The system crystal is 11.0592 MHz ;51 MCU sends MCU program ; this program is simulated by Proteus ;This program has been tested on hardware ; 2007-05-27 ; A simplified circuit diagram is attached ; In order to make it easier for beginners to understand, the program and diagram are as simple and concise as poss
[Microcontroller]
Serial communication program for two 51 single-chip microcomputers to communicate with each other
Realizing the Spectrum Display of Audio Signals Using 51 Single-Chip Microcomputer
Idea: The external audio signal passes through the 51 single-chip microcomputer, performs spectrum analysis in the single-chip microcomputer, and displays the results on the LCD (12864 or 1602) Requirement: The spectrum display is the same as the spectrum display when Qianqian Jingting plays music I hope you experts
[Microcontroller]
How much do you know about AVR microcontrollers?
What is an AVR microcontroller? What are the advantages of an AVR microcontroller? Why should you choose an AVR microcontroller? AVR microcontroller is a new type of microcontroller developed by ATMEL. Compared with 51 microcontroller and PIC microcontroller, it has a series of advantages: 1: AVR runs fastest u
[Microcontroller]
Temperature acquisition system based on 51 single chip microcomputer (Labview as host computer)
The original intention of doing this design is to lay the foundation for my graduation project, because my graduation project is to make a detection robot, which needs to detect various environmental parameters in a certain area and then return to the host computer through WIFI. So in order to understand the temperatu
[Microcontroller]
Temperature acquisition system based on 51 single chip microcomputer (Labview as host computer)
Playing with MCU 1
A single-chip microcomputer is also called a single-chip microcontroller. It is not a chip that completes a certain logical function, but a computer system integrated into one chip. In general, a chip becomes a computer. It is small in size, light in weight, and cheap in price, providing convenient conditions for learn
[Microcontroller]
Playing with MCU 1
MCU instruction cycle, machine cycle, state cycle, clock cycle
The system instruction cycle of the microcontroller varies according to different core architectures. The 8051 series microcontroller uses a synchronous sequential logic system. The operation of the entire system is completely dependent on the clock signal inside the system. Its instruction cycle, machine cycle
[Microcontroller]
MCU instruction cycle, machine cycle, state cycle, clock cycle
The History and Current Development of Single Chip Microcomputers
The History and Current Status of Single Chip Microcomputer The first stage (1976-1978): The exploration stage of low-performance single-chip microcomputers. Intel's MCS-48 is a representative example. It adopts a single-chip structure, that is, an 8-bit CPU, timer/counter, parallel I/O port, RAM and ROM are contain
[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号