Electronic Design

Use Four External Interrupts Through One 8051 Input

The 8051-compatible microcontrollers are equipped with up to two inputs that may be used as general-purpose interrupts. A simple way to increase the number of interrupt inputs is shown in the figure. The 74LS08 chip provides up to four interrupt inputs through the standard INT0 input.

This circuit is built so that Interrupt 1 has the highest priority and Interrupt 4 has the lowest priority. Intel standard assembler is used for the demonstration program shown in the code listing. The program code allows masking of the unusable or undesirable interrupts. Here, the variable IE_MASK is used to hide the interrupts by setting the appropriate bits of the high-order nibble to "1." Each time the corresponding interrupt is implemented, the interrupt handler switches on the appropriate LED.

You see from the code that Interrupts 2 and 3 are disabled, so only 1 and 4 will be processed. Of course, the program code is only a skeleton for more complicated applications that readers can build.

To download a listing, click Download the Code below.

Download the code.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish