6-4
Basic Programming For Interrupt Handling
What Is an Interrupt?
An interrupt is an event that causes the processor in your computer to temporarily halt its current process and
execute another routine. Upon completion of the new routine, control is returned to the original routine at the
point where its execution was interrupted.
Interrupts are very handy for dealing with asynchronous events (events that occur at less than regular inter-
vals). Keyboard activity is a good example; your computer cannot predict when you might press a key and it
would be a waste of processor time for it to do nothing while waiting for a keystroke to occur. Thus, the interrupt
scheme is used and the processor proceeds with other tasks. Then, when a keystroke does occur, the keyboard
interrupts the processor, and the processor gets the keyboard data, places it in memory, and then returns to what
it was doing before it was interrupted. Other common devices that use interrupts are modems, disk drives, and
mice.
Your DM6210 board can interrupt the processor when a variety of conditions are met, such as timer
countdown finished, end-of-convert, and external clock. By using these interrupts, you can write software that
effectively deals with real world events.
Interrupt Request Lines
To allow different peripheral devices to generate interrupts on the same computer, the AT bus has 16 differ-
ent interrupt request (IRQ) lines. A transition from low to high on one of these lines generates an interrupt request
which is handled by one of the ATs two interrupt control chips. One chip handles IRQ0 through IRQ7 and the
other chip handles IRQ8 through IRQ15. The controller which handles IRQ8-IRQ15 is chained to the first
controller through the IRQ2 line. When an IRQ line is brought high, the interrupt controllers check to see if
interrupts are to be acknowledged from that IRQ and, if another interrupt is already in progress, they decide if the
new request should supersede the one in progress or if it has to wait until the one in progress is done. This
prioritizing allows an interrupt to be interrupted if the second request has a higher priority. The priority level is
determined by the number of the IRQ. Because of the configuration of the two controllers, with one chained to the
other through IRQ2, the priority scheme is a little unusual. IRQ0 has the highest priority, IRQ1 is second-highest,
then priority jumps to IRQ8, IRQ9, IRQ10, IRQ11, IRQ12, IRQ13, IRQ14, and IRQ15, and then following
IRQ15, it jumps back to IRQ3, IRQ4, IRQ5, IRQ6, and finally, the lowest priority, IRQ7. This sequence makes
sense if you consider that the controller that handles IRQ8-IRQ15 is routed through IRQ2.
8259 Programmable Interrupt Controllers
The chips responsible for handling interrupt requests in the PC are the 8259 Programmable Interrupt Control-
lers. The 8259 that handles IRQ0-IRQ7 is referred to as 8259A, and the 8259 that handles IRQ8-IRQ15 is referred
to as 8259B. To use interrupts, you need to know how to read and set the 8259 interrupt mask registers (IMR) and
how to send the end-of-interrupt (EOI) command to the 8259s.
Interrupt Mask Registers (IMR)
Each bit in the interrupt mask register (IMR) contains the mask status of an IRQ line; in 8259A, bit 0 is for
IRQ0, bit 1 is for IRQ1, and so on, while in 8259B, bit 0 is for IRQ8, bit 1 is for IRQ9, and so on. If a bit is
set
(equal to 1), then the corresponding IRQ is masked and it will not generate an interrupt. If a bit is
clear
(equal to
0), then the corresponding IRQ is unmasked and can generate interrupts. The IMR for IRQ0-IRQ7 is programmed
through port 21H, and the IMR for IRQ8-IRQ15 is programmed through port A1H.
,54
,54
,54
,54
,54
,54
,54
,54
,54
,54
,54
,54
,54
,54
,54
,54
I/O Port 21H
I/O Port A1H
For all bits:
0 = IRQ unmasked (enabled)
1 = IRQ masked (disabled)
Содержание DM6210
Страница 2: ......
Страница 9: ...i 1 INTRODUCTION...
Страница 10: ...i 2...
Страница 14: ...1 2...
Страница 22: ...1 10...
Страница 24: ...2 2...
Страница 28: ...2 6...
Страница 30: ...3 2...
Страница 34: ...4 2...
Страница 44: ...5 2...
Страница 48: ...5 6...
Страница 50: ...6 2...
Страница 56: ...6 8...
Страница 57: ...7 1 CHAPTER 7 TIMER COUNTERS This chapter explains the 8254 timer counter circuits on the DM6210...
Страница 58: ...7 2...
Страница 61: ...8 1 CHAPTER 8 DIGITAL I O This chapter explains the digital I O circuitry on the DM6210...
Страница 62: ...8 2...
Страница 65: ...9 1 CHAPTER 9 EXAMPLE PROGRAMS This chapter discusses the example programs included with the DM6210...
Страница 66: ...9 2...
Страница 68: ...9 4...
Страница 70: ...10 2...
Страница 74: ...10 6...
Страница 75: ...A 1 APPENDIX A DM6210 SPECIFICATIONS...
Страница 76: ...A 2...
Страница 78: ...A 4...
Страница 79: ...B 1 APPENDIX B CN3 CONNECTOR PIN ASSIGNMENTS...
Страница 80: ...B 2...
Страница 82: ...B 4...
Страница 83: ...APPENDIX C COMPONENT DATA SHEETS C 1...
Страница 84: ......
Страница 85: ...Intel 82C54 Programmable Interval Timer Data Sheet Reprint...
Страница 86: ......
Страница 88: ...D 2...
Страница 90: ...D 4 RTD Embedded Technologies Inc 103InnovationBlvd StateCollegePA16803 0906 USA Ourwebsite www rtd com...
Страница 91: ...DM6210 User Settings Base I O Address hex decimal IRQ Channel...