A system has three external interrupt sources 1, 2, and 3. When an interrupt source becomes low level, the CPU is required to process it. Their priority processing order from high to low is 3, 2, and 1. The entry addresses of the interrupt processing program are 1000H, 1100H, and 1200H respectively. Try to write the main program and interrupt service program (just go to the entry of the corresponding interrupt processing program).
Answer: If only 3 external interrupt sources are connected to the /INT0 pin
ORG 0000H
LJMP MAIN
ORG 0003H
LJMP INT_EX0
ORG 0030H
MAIN: CLR IT0; Use low level active interrupt
SETB EX0 ; Enable external interrupt 0
SETB OF
; Insert user program
WAIT: MOV PCON,#01H; MCU enters sleep mode and waits for interrupt
NOP
LJMP WAIT
; The following is the external interrupt 0 service subroutine
INT_EX0: JNB P1.0, NEXT1; Determine if it is interrupt 1
LJMP INT_IR1 ; Jump to interrupt handler No. 1
NEXT1: JNB P1.1, NEXT2; Determine if it is interrupt 2
LJMP INT_IR2 ; Jump to interrupt handler No. 2
NEXT2: LJMP INT_IR3 ; Jump to interrupt handler No. 3
ORG 1000H
INT_IR1:
;Insert the corresponding interrupt handler
RETI ;Interrupt return
ORG 1100H
INT_IR2:
;Insert the corresponding interrupt handler
RETI ;Interrupt return
ORG 1200H
INT_IR3:
;Insert the corresponding interrupt handler
RETI ;Interrupt return
Previous article:The format and functions of each bit of the timer/counter control register TCON
Next article:The function and use of single chip microcomputer timer counter
- Popular Resources
- Popular amplifiers
- Detailed I2C interface SI114 datasheet for proximity/ambient light sensor chip
- Introducing the application of multiplication and division instructions with interrupt functions of C16x series microcontrollers
- Infrared remote control receiving and sending source program Interrupt for IR subroutine external interrupt source INT0
- Multi-channel pressure measuring instrument based on C8051F020 single chip microcomputer
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
- Data acquisition technology based on SDI-12 bus (communication protocol)
- 04. WS2812B driver implementation of SPI
- 315Mhz wireless module microcontroller soft decoding receiving program
- Learning experience of MSP430F5529 clock module
- Noise suppression solution example in automotive power circuits
- How can wireless monitoring systems minimize latency?
- Power amplifier circuit composed of operational amplifier and NMOS
- Why are the lines drawn on the schematic connected randomly when imported into the PCB?
- [N32L43X Review] 9. Review Summary
- What are the criteria for selecting voice chips on the market?