4 methods of single-chip microcomputer extended interrupt

Source: Internet
Author: User

MCS-51 Series MCU internal only two external interrupt source input, when the external interrupt source more than two

, you have to expand, and here are two simple extension methods:

First, the use of hardware requests and software Query method:

This method is to introduce each interrupt source into the MCU external interrupt source input via hardware "or non (highly effective, such as CD4002)" (and, low-effective) gate

(INT0 or INT1), while the external interrupt source is sent to an input-output port of the microcontroller, which

When the external interrupt, through the "or non" (and) gate caused by the single-chip interrupt, in the interrupt service program to re-pass

The software query, and then go to the corresponding interrupt service program. Obviously, the interrupt priority of this method depends on

The order of the software queries. Its hardware connection and software programming are as follows:

void Zhongduan (void) interrupt 0 using 3//Interrupt function

{

ex0=0;//off Interrupt

If (p0_0=1) {*****}//interrupt query

If (p0_1=1) {*****}//interrupt query

If (p0_2=1) {*****}//interrupt query

ex0=1; open Interrupt

}

Second, the use of ordinary diodes to form an interrupt selection

The extended 8 external interrupt sources are interrupted by a diode to I N T (x=0 or i). When an external interrupt source requests interrupt service output low level, microcontroller I NT through the diode ground level, the microcontroller satisfies the response external interrupt (I N T) request condition, the response is interrupted, the program immediately turns to I NT corresponding interrupt entry address at the beginning of the execution interrupt service program, through the software query pi.0~ The P1.7 mouth interrupts the state of the source to identify the requested extended interrupt source, and turns to the interrupt Service program for its service, whose query order is the interrupt priority order of the external extension interrupt source. In the diagram, the PI.0~PI.7 is selected as the status information input port for the extended interrupt source request.

A bit like the first method.

Third, use timer/counter for external interrupt

MCU Timer/counter is a plus a counter, whenever the count input has a "1-0" negative

Jump, the counter plus one, when the addition of a counter overflow, the CPU is interrupted, take advantage of this feature

To extend the interrupt is: first set the timer/counter to count mode, and preset full value, the

The external interrupt source is input to the 4th PIN or 5th pin (counter input) of the P3 port, which allows

The timer/counter is interrupted as a microcontroller outside. Note that the entry address of the interrupt service for this method should be

In 000BH or 001BH.

Iv. expansion of Chip 8259A with dedicated interrupt

8259A is a programmable interrupt control interface, single-chip microcomputer control eight interrupt. In the system can also be cascaded, a main chip can cascade 8 from the chip, forming a 64-level interrupt processing system.

In this case, the program is less than 8K, you can use a single chip microcomputer implementation, and do not need to use two single-chip microcomputer control, but also to the single-chip computer point-to-point communication.

Transfer from http://www.21ic.com/jichuzhishi/mcu/interrupt/2014-03-20/216130.html

4 methods of single-chip microcomputer extended interrupt

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.