Intel386™ EX EMBEDDED MICROPROCESSOR USER’S MANUAL
9-32
9.5 PROGRAMMING CONSIDERATIONS
Consider the following when programming the ICU.
• When an 82C59A receives an interrupt request, it sets the request’s pending bit (regardless
of whether the IR signal is masked or not). The pending bit remains set until the interrupt is
serviced.
• When the LS bit in ICW1 is set to edge-triggered during initialization, all the interrupt
pending bits will be cleared.
• In special-fully nested mode, care must be taken when processing interrupt requests from
the master’s internal cascade signal (IR2). At the end of the slave’s interrupt service routine,
first issue a nonspecific EOI to the slave. Before issuing a nonspecific EOI command to the
master, make sure that the slave has no other in-service bits set.
• Systems that use polling as the only method of device servicing must still fully initialize the
82C59A modules. Also, the interrupt requests to the core must be disabled using the mask
bits or the CLI instruction.
• The 8259A must be initialized before it can be used. After reset, the 82C59A register states
are undefined. The 82C59A modules must be initialized before the IF flag in the core FLAG
register is set. All peripherals that use interrupts connected to the ICU must be initialized
before initializing the ICU.
9.5.1 Interrupt Control Unit Code Examples
The example code contains these software routines:
InitICU Initializes the Master and Slave 82C59A Interrupt Controllers
InitICUSlave Initializes the Slave 82C59A Interrupt Controllers
Disable8259Interrupt Disables interrupts on the Master and internal Slave
Enable8259Interrupt Enables interrupts on the Master and internal Slave
SetIRQVector Loads the interrupt vector table with the address of the Interrupt
Service Routine
SetInterruptVector Called by SetIRQVector to load vector table
Poll_Command Issues a poll command to read the poll status byte of the ICU
See Appendix C for included header files.
#include <conio.h>
#include “80386ex.h”
#include “EV386EX.h”
/* Globals For information about the ICU */
BYTE _IRQ_SlaveBase_= 0x30;
BYTE _IRQ_MstrBase_ = 0x20;