UPS25 32
RTD Embedded Technologies, Inc
What exactly happens when an interrupt occurs?
Understanding the sequence of events when an interrupt is triggered is necessary
to correctly write interrupt handlers. When an interrupt request line is driven high
by a peripheral device (such as the UPS25), the interrupt controller checks to see
if interrupts are enabled for that IRQ. It then checks to see if other interrupts are
active or requested and determines which interrupt has priority. The interrupt
controller then interrupts the processor. The current code segment (CS),
instruction pointer (IP), and flags are pushed onto the system stack., and a new
set if CS and IP are loaded from the lowest 1024 bytes of memory.
These memory locations are referred to as the interrupt vector table and each
entry to this table is called an interrupt vector. Once the new CS and IP are loaded
from the interrupt vector table, the processor starts to execute code from the new
Code Segment (CS) and from the new Instruction Pointer (IP). When the interrupt
routine is completed the old CS and IP is popped from the system stack and the
program execution continues from the point where interruption occurred.
Using Interrupts in your Program
Adding interrupt support to your program is not as difficult as it may seem
especially when programming under DOS. The following discussion will cover
programming under DOS. Note that even the smallest mistake in your interrupt
program may cause the computer to hang up and will only restart after a reboot.
This can be frustrating and time-consuming.
Содержание UPS25
Страница 39: ...UPS25 39 RTD Embedded Technologies Inc...