intel 8259A PROGRAMMABLE INTERRUPT CONTROLLER (8259A/8259A-2) 8086, 8088 Compatible m Single + 5V Supply (No Clocks) a mw MCS-80, MCS-85 Compatible wg Available in 28-Pin DIP and 28-Lead gm Ejight-Level Priority Controller PLCC Package Order #231369) w Expandable to 64 Levels w Available in EXPRESS @ Programmable Interrupt Modes Standard Temperature Range @ Individual Request Mask Capability Extended Temperature Range The Intel 8259A Programmable Interrupt Controtler handles up to eight vectored priority interrupts for the CPU. it is cascadable for up to 64 vectored priority interrupts without additional circuitry. It is packaged in a 28-pin DIP, uses NMOS technology and requires a single + 5V supply. Circuitry is static, requiring no clock input. The 8259A is designed to minimize the software and real time overhead in handling multi-level priority inter- rupts. It has several modes, permitting optimization for a variety of system requirements. The 8259A is fully upward compatible with the Intel 8259. Software originally written for the 8259 will operate the 8259A in all 8259 equivalent modes (MCS-80/85, Non-Buffered, Edge Triggered). DIP INTA INT pep ali ai DATA BUS BUFFER CONTROL LOGIC % eoearw nn ewn = D, any [Ro caso J INT casi 1) EN GNO f)cas2 RD 231468-2 wr IN e SERVICE PRIORITY REQUEST In3 PLCC Ay REG SOLVE REG Ra oO SR) WAR) siete 8 elf = 4.3 2 1 28 27 2% oes 2570 R7 os C6 24D irs o7 23 Rs ods 8259A 220 ire caso INTERRUPT MASK REG ocd 21 rs cast alariaiely or Cy10 2069 tr2 pod 13 P a 12 13 14 15 16 17 18 CAS 2 DUuUUuUUUT Ba2Glb ze NN. $5 Se a Sen 4 INTERNAL BUS 291468-31 231468-1 Figure 2. Pin Configurations Figure 1. Block Diagram December 1988 3-171 Order Number: 231468-0038259A Table 1. Pin Description Pin No. Type Name and Function 28 SUPPLY: +5V Supply. 14 GROUND CHIP SELECT: A low on this pin enables RD and WR communication between the CPU and the 82594. INTA functions are independent of cs. WRITE: A low on this pin when CS is low enables the 8259A to accept command words from the CPU. AD READ: A low on this pin when CS is low enables the 8259A to release status onto the data bus for the CPU. D7-Do 1/0 BIDIRECTIONAL DATA BUS: Control, status and interrupt-vector information is transferred via this bus. CASp-CAS2 12, 13, 15 1/0 CASCADE LINES: The CAS lines form a private 8259A bus to control a multiple 8259A structure. These pins are outputs for a master 8259A and inputs for a slave 8259A. SP/EN 16 /O SLAVE PROGRAM/ENABLE BUFFER: This is a dual function pin. When in the Buffered Mode it can be used as an output to control buffer transceivers (EN). When not in the buffered mode it is used as an input to designate a master (SP = 1) or slave (SP = 0). 17 INTERRUPT: This pin goes high whenever a valid interrupt request is asserted. It is used to interrupt the CPU, thus it is connected to the CPUs interrupt pin. 18-25 INTERRUPT REQUESTS: Asynchronous inputs. An interrupt request is executed by raising an IR input (low to high), and holding it high until itis acknowledged (Edge Triggered Mode), or just by a high level on an IR input (Level Triggered Mode). 26 INTERRUPT ACKNOWLEDGE: This pin is used to enable 8259A interrupt-vector data onto the data bus by a sequence of interrupt acknowledge pulses issued by the CPU. 27 AO ADDRESS LINE: This pin acts in conjunction with the CS, WR, and RD pins. It is used by the 8259A to decipher various Command Words the CPU writes and status the CPU wishes to read. It is typically connected to the CPU AO address line (A1 for 8086, 8088). 3-172intel. 8259A FUNCTIONAL DESCRIPTION CPU-DRIVEN cru MULTIPLEXOR Interrupts in Microcomputer Systems po TT Microcomputer system design requires that 1.0 de- 1] ' vices such as keyboards, displays, sensors and oth- \ er components receive servicing in a an efficient J manner so that large amounts of the total system me KO Ky tasks can be assumed by the microcomputer with little or no effect on throughput. 0 {2} The most common method of servicing such devic- es is the Polled approach. This is where the proces- row TK sor must test each device in sequence and in effect ask each one if it needs servicing. It is easy to see that a large portion of the main program is looping cvTTy through this continuous polling cycle and that such a i | method would have a serious detrimental effect on voi) system throughput, thus limiting the tasks that could Low be assumed by the microcomputer and reducing the Vv cost effectiveness of using such devices. 231468-3 A more desirable method would be one that would Figure 3a. Polied Method . allow the microprocessor to be executing its main program and only stop to service peripheral devices when it is told to do so by the device itself. In effect, the method would provide an external asynchronous input that would inform the processor that it should complete whatever instruction that is currently being executed and fetch a new routine that will service the requesting device. Once this servicing is com- plete, however, the processor would resume exactly S where it left off. ram OK This method is called /nterrupt. It is easy to see that system throughput would drastically increase, and thus more tasks could be assumed by the micro- computer to further enhance its cost effectiveness. Pic Rom vO 11) The Programmable Interrupt Controller (PIC) func- tions as an overall manager in an Interrupt-Driven system environment. it accepts requests from the peripheral equipment, determines which of the in- coming requests is of the highest importance (priori- ty), ascertains whether the incoming request has a higher priority value than the level currently being serviced, and issues an interrupt to the CPU based on this determination. wenn I vow) - i i tt 4/0 (2) Each peripheral device or structure usually has a ' special program or routine that is associated with t-----4 its specific functional or operational requirements; V this is referred to as a service routine. The PIC, 231468-4 after issuing an Interrupt to the CPU, must somehow input information into the CPU that can point the Figure 3b. Interrupt Method Program Counter to the service routine associated with the requesting device. This pointer is an ad- dress in a vectoring table and will often be referred to, in this document, as vectoring data. y 3-173intel. 8259A The 8259A is a device specifically designed for use in real time, interrupt driven microcomputer systems. It manages eight levels or requests and has built-in features for expandability to other 8259As (up to 64 levels). It is programmed by the systems software as an I/O peripheral. A selection of priority modes is available to the programmer so that the manner in which the requests are processed by the 8259A can be configured to match his system requirements. The priority modes can be changed or reconfigured dynamically at any time during the main program. This means that the complete interrupt structure can be defined as required, based on the total system environment. : INTERRUPT REQUEST REGISTER (IRR) AND IN-SERVICE REGISTER (ISR) The interrupts at the IR input lines are handled by two registers in cascade, the Interrupt Request Reg- ister (IRR) and the In-Service (ISR). The IRR is used to store all the interrupt levels which are requesting service; and the ISR is used to store all the interrupt levels which are being serviced. PRIORITY RESOLVER This logic block determines the priorites of the bits set in the IRR. The highest priority is selected and strobed into the corresponding bit of the {SR during INTA pulse. INTERRUPT MASK REGISTER (IMR) The IMR stores the bits which mask the interrupt lines to be masked. The IMR operates on the IRR. Masking of a higher priority input will not affect the interrupt request lines of Jower quality. INT (INTERRUPT) This output goes directly to the CPU interrupt input. The Von level on this line is designed to be fully compatible with the 8080A, 8085A and 8086 input levets. INTA (INTERRUPT ACKNOWLEDGE) INTA pulses will cause the 8259A to release vector- ing information onto the data bus. The format of this data depends on the system mode (1PM) of the B259A. DATA BUS BUFFER This 3-state, bidirectional 8-bit buffer is used to inter- face the 8259A to the system Data Bus. Control words and status information are transferred through the Data Bus Buffer. READ/WRITE CONTROL LOGIC The function of this block is to accept OUTput com- mands from the CPU. It contains the Initialization Command Word (ICW) registers and Operation Command Word (OCW) registers which store the various control formats for device operation. This function block also allows the status of the 8259A to be transferred onto the Data Bus. | CS (CHIP SELECT) A LOW on this input enables the 8259A. No reading or writing of the chip will occur unless the device is selected. WR (WRITE) A LOW on this input enables the CPU to write con- trol words (ICWs and OCWs) to the 8259A. RD (READ) A LOW on this input enables the 8259A to send the status of the Interrupt Request Register (IRR), In Service Register (ISR), the Interrupt Mask Register (IMR), or the Interrupt level onto the Data Bus. Ao This input signal is used in conjunction with WR and RD signals to write commands into the various com- mand registers, as well as reading the various status registers of the chip. This line can be tied directly to one of the address lines. 3-1748259A 2 q > INT a NK DATA SS CONTROL LOGIC D;-Dy J BUS BUFFER ~~ _ +o 1RO RD +a Le IR1 wa ed READ! apf * IR2 WRITE -_*?* in BNTEARUPT) LOGIC SERVICE emonity | | neouest [= '93 Ay ~ REG ESOLVERT. 4) REG pe if SR} ARR . IRS j~- |IR6 cs IR? Caso KC INTERRUPT MASK REG CASCADE A {IMR} CAS 1 ~#} BUFFER: [* COMPARATOR CAS2 4+ SPIEN __} ~ INTERNAL BUS ba 231468-5 Figure 4a. 8259A Block Diagram 3-1758259A caso CAS 1 CAS2 INTA INT CONTROL LOGIC IN SERVICE REG HSR) TEAR REQUEST REG (iRAR) PRIORITY ESOLVE INTERRUPT MASK REG (IMR } CASCADE BUFFER/ COMPARATOR NN INTERNAL BUS 1RO (Rl IR2 IR3 Ra IRS IR6 1a? 231468-6 Figure 4b. 8259A Block Diagram 3-176intel. 8259A THE CASCADE BUFFER/COMPARATOR This function block stores and compares the Ds of all 8259As used in the system. The associated three I/O pins (CASO-2) are outputs when the 8259A is used as a master and are inputs when the 8259A is used as a slave. As a master, the 8259A sends the ID of the interrupting slave device onto the CASO~2 lines. The slave thus selected will send its preprogrammed subroutine address onto the Data Bus during the next one or two consecutive INTA pulses. (See section Cascading the 8259A.) INTERRUPT SEQUENCE The powerful features of the 8259A in a microcom- puter system are its programmability and the inter- rupt routine addressing capability. The latter allows direct or indirect jumping to the specific interrupt rou- tine requested without any polling of the interrupting devices. The normal sequence of events during an interrupt depends on the type of CPU being used. The events occur as follows in an MCS-80/85 sys- tem: 1. One or more of the INTERRUPT REQUEST lines (IR7-0) are raised high, setting the correspond- ing IRR bit(s). 2. The 8259A evaluates these requests, and sends an INT to the CPU, if appropriate. 3. The CPU acknowledges the INT and responds with an INTA pulse. 4. Upon receiving an INTA from the CPU group, the highest priority ISR bit is set, and the correspond- ing IRR bit is reset. The 8259A will also release a CALL instruction code (11001101) onto the 8-bit Data Bus through its D7-0 pins. 5. This CALL instruction will initiate two more INTA pulses to be sent to the 8259A from the CPU group. 6. These two INTA pulses allow the 8259A to re- lease its preprogrammed subroutine address onto the Data Bus. The lower 8-bit address is re- leased at the first INTA pulse and the higher 8-bit address is released at the second INTA pulse. 7. This completes the 3-byte CALL instruction re- leased by the 8259A. In the AEO! mode the ISR bit is reset at the end of the third INTA pulse. Otherwise, the ISR bit remains set until an appro- priate EOI command is issued at the end of the interrupt sequence. The events occuring in an 8086 system are the same until step 4. 4. Upon receiving an INTA from the CPU group, the highest priority ISR bit is set and the correspond- ing IRR bit is reset. The 8259A does not drive the Data Bus during this cycle. 5. The 8086 will initiate a second INTA pulse. Dur- ing this pulse, the 8259A releases an 8-bit pointer onto the Data Bus where it is read by the CPU. 6. This completes the interrupt cycle. In the AEOI mode the ISR bit is reset at the end of the sec- ond INTA pulse. Otherwise, the ISR bit remains set until an appropriate EO! command is issued at the end of the interrupt subroutine. If no interrupt request is present at step 4 of either sequence (i.e., the request was too short in duration) the 8259A will issue an interrupt level 7. Both the vectoring bytes and the CAS lines will look like an interrupt level 7 was requested. When the 8259A PIC receives an interrupt, INT be- comes active and an interrupt acknowledge cycle is started. If a higher priority interrupt occurs between the two INTA pulses, the INT line goes inactive im- mediately after the second INTA pulse. After an un- specified amount of time the INT line is activated again to signify the higher priority interrupt waiting for service. This inactive time is not specified and can vary between parts. The designer should be aware of this consideration when designing a sys- tem which uses the 8259A. It is recommended that proper asynchronous design techniques be fol- lowed. 3-1778259A 3] 3 3 INTA DATA BUS BUFFER IN SERVICE REG {tSRI ESOLV CONTROL LOGIC PRIORITY INT TERR REQUEST REG {IRA} caso CAS! CaAS2 Z| INTERNAL BUS INTERRUPT MASK REG (IMR) ADORESS BUS (16) CONTROL BUS _) |_| DATA BUS (8) els i 0,0, AE WR INT INTA CASCADE 82594 LINES 288. (AQ 1AO IAD IRO IRG IRQ IRQ IRA 7 & 5 a 2 1 0 | 231468-8 CaS2 Shi SLAVE PROGRESS ENABLE BUFFER INTERRUPT REQUESTS Figure 5. 8259A Interface to Standard System Bus Figure 4c. 8259A Block Diagram INTERRUPT SEQUENCE OUTPUTS MCS-80, MCS-85 This sequence is timed by three INTA pulses. During the first INTA pulse the CALL opcode is enabled onto the data bus. Content of First Interrupt Vector Byte D7 D6 D5 D4 D3 D2 D1 DO [1 1001104 CALL CODE During the second INTA pulse the lower address of the appropriate service routine is enabled onto the data bus. When Interval = 4 bits AsA7 are pro- grammed, while AjA4 are automatically inserted by the 8259A. When Interval = 8 only Ag and A7 are programmed, while Ag-As are automatically insert- ed. 3-178intel. 8259A Content of Second interrupt Vector Byte IR Interval = 4 D7 D6 D5 D4 D3 D2 Di ODO 7 | A7 AB AS 1 1 1 0 0 6 | AZ AB AS 1 1 0 0 0 5 | A7 AB AS 1 0 1 0 0 4} A7 AB AS 1 0 0 0 0 3; A7 AB AS O 1 1 0 0 21A7 A6 AS O 1 0 0 0 1] A7 A6B AS O 0 1 0 0 0 | A7 A6 AS O 0 0 0 0 IR Interval = 8 D7 D6 D5 04 D3 D2 Di pO 7 | A7 AGB 1 1 1 0 0 0 6 | A7 AG 1 1 0 0 0 0 5 | A7 AG 1 0 1 0 0 0 4 | A7 A6 1 0 0 0 0 0 3 | A7 AB O 1 1 0 0 0 21A7 AB O 1 0 0 0 0 1 |;A7 AB O 0 1 0 0 0 0 | A7 AB O 0 0 0 0 0 composed as follows (note the state of the ADI mode control is ignored and AsA4; are unused in 8086 mode): Content of interrupt Vector Byte for 8086 System Mode D7 | D6 | D5 | D4 | D3 | D2 | D1 | DO IR7 | T7 | T6 | T5 | T4 | T3] 1 1 1 IR6 | 17 | T6| T5 | 74) TH} 1 1 0 IRS | 77 | T6| T5174) T3] 1 0 1 IR4 | 77 | T6 | 75} 74] 73) 1 0 0 IR3 | 77} T6| T5 | T4] T3 |] O 1 1 IR2 | 77 | T6| 75 | T4] 73] O 1 0 IR1 | 77 | T6 | T5 | 74] 73] 0 0 1 IRO | 77 | T6 |] T5 | T4] T3] O 0 0 During the third INTA pulse the higher address of the appropriate service routine, which was programmed as byte 2 of the initialization sequence (AgAj5), is enabled onto the bus. Content of Third interrupt Vector Byte D7? D6 D5 D4 D3 D2 OD1 OobDO [a15 | 14] ai3 | at2 | att | ato | ag | as | 8086, 8088 8086 mode is similar to MCS-80 mode except that only two Interrupt Acknowledge cycles are issued by the processor and no CALL opcode is sent to the processor. The first interrupt acknowledge cycle is similar to that of MCS-80, 85 systems in that the 8259A uses it to internally freeze the state of the interrupts for priority resolution and as a master it issues the interrupt code on the cascade lines at the end of the INTA pulse. On this first cycle it does not issue any data to the processor and leaves its data bus buffers disabled. On the second interrupt ac- knowledge cycle in 8086 mode the master (or slave if so programmed) will send a byte of data to the processor with the acknowledged interrupt code PROGRAMMING THE 8259A The 8259A accepts two types of command words generated by the CPU: 1. Initialization Command Words (iCWs): Before normal operation can begin, each 8259A in the system must be brought to a starting pointby a sequence of 2 to 4 bytes timed by WR pulses. 2. Operation Command Words (OCWs): These are the command words which command the 8259A to operate in various interrupt modes. These modes are: a. Fully nested mode b. Rotating priority mode c. Special mask mode d. Polled mode The OCWs can be written into the 8259A anytime after initialization. INITIALIZATION COMMAND WORDS (ICWS) General Whenever a command is issued with AO = 0 and D4 = 1, this is interpreted as initialization Command Word 1 (ICW1). ICW1 starts the intiitalization se- quence during which the following automatically oc- cur. a. The edge sense circuit is reset, which means that fotlowing initialization, an interrupt request (IR) in- put must make a low-to-high transistion to gener- ate an interrupt. 3-179intel. 8259A b. The Interrupt Mask Register is cleared. c. IR7 input is assigned priority 7. d. The slave mode address is set to 7. e . Special Mask Mode is cleared and Status Read is set to IRR. f. If 1C4 = 0, then all functions selected in ICW4 are set to zero. (Non-Buffered mode, no Auto- EO!, MCS-80, 85 system). *NOTE: Master/Slave in ICW4 is only used in the buffered mode. Initialization Command Words 1 and 2 (ICw1, iCW2) AsAj15: Page starting address of service routines. In an MCS 80/85 system, the 8 request levels will generate CALLs to 8 locations equally spaced in memory. These can be programmed to be spaced at intervals of 4 or 8 memory locations, thus the 8 rou- tines will occupy a page of 32 or 64 bytes, respec- tively. The address format is 2 bytes long (AgAji5). When the routine interval is 4, AgpA4 are automatically in- serted by the 8259A, while A5A;5 are programmed externally. When the routine interval is 8, AgAs are automatically inserted by the 8259A, while AgA15 are programmed externally. The 8-byte interval will maintain compatibility with current software, while the 4-byte interval is best for a compact jump table. in an 8086 system A,5~Aj,, are inserted in the five most significant bits of the vectoring byte and the 8259A sets the three least significant bits according to the interrupt level. Ayg-As are ignored and ADI (Address interval) has no effect. LTIM: If LTIM = 1, then the 8259A will operate in the level interrupt mode. Edge detect logic on the interrupt inputs will be disabled. ADI: CALL address interval. ADI = 1 then inter- val = 4; ADI = 0 then interval = 8. SNGL: Single. Means that this is the only 8259A in the system. If SNGL = 1 no ICW3 will be issued. IC4: \f this bit is set-ICW4 has to be read. If ICW4 is not needed, set IC4 = 0. Initialization Command Word 3 (ICW3) This word is read only when there is more than one 8259A in the system and cascading is used, in which case SNGL = 0. it will load the 8-bit slave register. The functions of this register are: a. In the master mode (either when SP = 1, or in buffered mode when M/S = 1 in [CW4) a 1 is set for each slave in the system. The master then will release byte 1 of the call sequence (for MCS- 80/85 system) and will enable the corresponding slave to release bytes 2 and 3 (for 8086 only byte 2) through the cascade lines. b. In the slave mode (either when SP = 0, or if BUF = 1 and M/S = 0 in ICW4) bits 2-0 identify the slave. The slave compares its cascade input with these bits and; if they are equal, bytes 2 and 3 of the call sequence (or just byte 2 for 8086) are released by it on the Data Bus. NO (SINGL = 1} YES (SNGL = 0) NO (iC4 = 0) Is 1cw4 YES (IC4 = 1) READY TO ACCEPT INTERRUPT REQUESTS 231468-9 Figure 6. Initialization Sequence 3-1808259A intel. Initialization Command Word 4 (ICW4) SFNM: {If SFNM = 1 the special fully nested mode is programmed. master, M/S = 0 means the 8259A is pro- grammed to be a slave. If BUF = 0, M/S has no function. BUF: If BUF = 1 the buffered mode is pro. AEO! WARGO! = 1 the automatic end of interrupt grammed. In buffered mode SP/EN be- : prog . comes an enable output and the master/ #PM: Microprocessor mode: 4PM = 0 sets the slave determination is by M/S. 8259A for MCS-80, 85 system operation, M/S: If buffered mode is selected: M/S = 1 1M io _| Sets the 8259 for 8086 system means the 8259A is programmed to be a P , 1Cwr 4, 9, 5. OQ oO, 0D, OO, 0, Dy 0 A, Ae A LTiM | ADI {SNGL] IC4 T 1 ICW4 NEEDED 0 = NO ICW4 NEEDED 1 = SINGLE 0 = CASCADE MODE CALL ACORESS INTERVAL +> INTERVAL OF 4 O= INTERVAL OF 8 = LEVEL TRIGGERED MODE 0 = EDGE TRIGGERED MODE A;-Ag of INTERRUPT VECTOR ADDRESS (MCS-80/85 MODE ONLY) 231468-10 1cw2 Ao o, o, o, 0, 0; 0; o, % A, 4 Ai3/7 Piz h 1 A A %, in Ts , T3 0 *s 5 A,5-Ag OF INTERRUPT VECTOR ADDRESS (MCS80/85 MODE) T,-T, OF INTERRUPT VECTOR ADDRESS (8086 / 8088 MODE) 231468-11 Figure 7. initialization Command Word Format 3-181intel. 8259A ICW3 (MASTER DEVICE) o 2 OF RH BR DB DB 0B fs > sly ils f5 15 |S | % 1= IR INPUT HAS A SLAVE O= 1R INPUT DOES NOT HAVE ASLAVE ICW3 (SLAVE DEVICE) % oO, OQ & OO OO, 1B, OD, B 0 0 0 SLAVE 101"l ICW4 Ao D7 O06 Os Og 03 02 O71 00 1 Q 0 O [SFNM] BUF I M/S | AEOIT WPM 231468-12 231468-13 = 8086/8088 MODE 0 = MCS-80/85 MODE 1= AUTO EOt 0- NORMA: EO! x ~ NON BUFFERED MODE G9 _ J- BUFFERED MODE/SLAVE BUFFERED MODE /MASTER 1 = SPECIAL FULLY NESTEO MODE O = NOT SPECIAL FULLY NESTED MODE NOTE: Slave ID is equal to the corresponding master IR input. 231468-14 Figure 7. initialization Command Word Format (Continued) 3-182intel. 8259A OPERATION COMMAND WORDS (OCWS) After the Initialization Command Words (ICWs) are AO D7? ocw1 D6 D5 D4 D3 Operation Control Words (OC Ws) D2 D1 DO programmed into the 8259A, the chip is ready to ac- [1] | M7 M6 M5 M4 M3 cept interrupt requests at its input lines. However, during the 8259A operation, a selection of algo- rithms can command the 8259A to operate in vari- [| ous modes through the Operation Command Words (OCWs). 0 M2 M1 Mo| ocw2 [R SL EO! 0 0 12 Lt 1Lo| ocws3 [0 ESMM SMM 0 1 P AR AIS| ocwi Ao , OF OP, M% 3 % OM OD 1 m7 M6 MS Ma M3 m2 M1 MO INTERRUPT MASK t= MASK SET 0 = MASK RESET 231468-15 ocw2 A 0, OB O% OO 0, DOD, DB, DB of} | sw] eo] a 0 1, ] t, Pty IR LEVEL YO BE ACTED UPON of,isztayep steely? ofi1fozifofrjfo}r ofo}ifrfofofrii o;ofofofrfyrfids 0] 0] 1] NON-SPECIFIC EOICOMMAND ENO OF INTERRUPT O] 141] SPECIFIC EO) COMMAND 1 [0] 1] ROTATE ON NON-SPECIFIC EO! COMMAND 1 | 0 | 0] ROTATE IN AUTOMATIC EO! MODE (SET) AUTOMATIC ROTATION 0 | 0 | 0] ROTATE IN AUTOMATIC EO! MODE (CLEAR) tfafa ROTATE ON SPECIFIC EO! COMMAND SPECIFIC ROTATION 1] 1] 0] SET PRIORITY COMMAND 0 ].1 [0] NOOPERATION *LO-L2 ARE USED 231468-16 Figure 8. Operation Command Word Format 3-183intel. 8259A Operation Control Word 1 (OCW1) Operation Control Word 2 (OCW2) OCW1 sets and clears the mask bits in the interrupt Mask Register (IMR). M7-Mo represent the eight mask bits. M = 1 indicates the channel is masked (inhibited), M = 0 indicates the channel is enabled. Operation Command Word Format. Lo, Ly, LgThese bits determine the interrupt level acted upon when the SL bit is active. READ REGISTER COMMAND 1 oO 1 0 1 1 READ 1A REG ON NEXT RO PULSE READ 1S REG ON NEXT AD PULSE NO ACTION 1=POLL COMMAND 0=NO POLL COMMAND SPECIAL MASK MODE 1 Qo 0 1 NO ACTION 231468-17 Figure 8. Operation Command Word Format (Continued) 3-184 R, SL, EOlThese three bits control the Rotate and End of Interrupt modes and combinations of the two. A chart of these combinations can be found on theintel. 8259A Operation Control Word 3 (OCW3) ESMMEnable Special Mask Mode. When this bit is set to 1 it enabies the SMM bit to set or reset the Special Mask Mode. When ESMM = 0 the SMM bit becomes a dont care. SMMSpecial Mask Mode. if ESMM = 1 and SMM = 1 the 8259A will enter Special Mask Mode. If ESMM = 1 and SMM = 0 the 82594 will revert to normal mask mode. When ESMM = 0, SMM has no effect. Fully Nested Mode This mode is entered after initialization unless anoth- er mode is programmed. The interrupt requests are ordered in priority from 0 through 7 (0 highest). When an interrupt is acknowledged the highest pri- ority request is determined and its vector placed on the bus. Additionally, a bit of the Interrupt Service register (ISO-7) is set. This bit remains set until the microprocessor issues an End of Interrupt (EOl) command immediately before returning from the service routine, or if AEOI (Automatic End of Inter- rupt) bit is set, until the trailing edge of the last INTA. While the {S bit is set, all further interrupts of the same or lower priority are inhibited, while higher lev- els will generate an interrupt (which will be acknowl- edged only if the microprocessor internal Interupt enable flip-flop has been re-enabled through soft- ware). After the initialization sequence, IRO has the highest prioirity and IR7 the lowest. Priorities can be changed, as will be explained, in the rotating priority mode. End of Interrupt (EOI) The In Service (IS) bit can be reset either automati- cally following the trailing edge of the last in se- quence INTA pulse (when AEOI bit in ICW1 is set) or by a command word that must be issued to the 8259A before returning from a service routine (EO! command). An EO] command must be issued twice if in the Cascade mode, once for the master and once for the corresponding slave. There are two forms of EOI command: Specific and Non-Specific. When the 8259A is operated in modes which perserve the fully nested structure, it can de- termine which IS bit to reset on EOI. When a Non- Specific EOI command is issued the 8259A will auto- matically reset the highest IS bit of those that are set, since in the fully nested mode the highest IS level was necessarily the last level acknowledged and serviced. A non-specific EO! can be issued with OCW2 (EOI = 1, SL = 0, R = 0). When a mode is used which may disturb the fully nested structure, the 8259A may no longer be abie to determine the last level acknowledged. In this case a Specific End of Interrupt must be issued which includes as part of the command the IS level to be reset. A specific EOI can be issued with OCW2 (EOI = 1, SL = 1, R = 0, and LO-L2 is the binary level of the {S bit to be reset). It should be noted that an IS bit that is masked by an IMR bit will not be cleared by a non-specific EOI if the 8259A is in the Special Mask Mode. Automatic End of Interrupt (AEOI) Mode If AEO! = 1 in ICW4, then the 8259A will operate in AEOI mode continuously until reprogrammed by ICW4. in this mode the 8259A will automatically per- form a non-specific EOI operation at the trailing edge of the last interrupt acknowledge pulse (third pulse in MCS-80/85, second in 8086). Note that from a system standpoint, this mode should be used only when a nested multilevel interrupt structure is not required within a single 8259A. The AEOI mode can only be used in a master 8259A and not a slave. 8259As with a copyright date of 1985 or later will operate in the AEOI mode as a master or a slave. Automatic Rotation (Equal Priority Devices) In some applications there are a number of interrupt- ing devices of equal priority. In this mode a device, after being serviced, receives the lowest priority, so a device requesting an interrupt will have to wait, in the worst case until each of 7 other devices are serviced at most once. For example, if the priority and in service status is: Before Rotate (IR4 the highest prioirity requiring service) 1S7 186 {$5 184 ($3 1S2 181 186 IS Status 231468~-18 Lowest Priority Highest Priority Priority Status 231468-19 3-185intel. 8259A After Rotate (IR4 was serviced, ail other priorities rotated correspondingly) (S7 1S6 ISS I$4 IS3 182 1St [SO IS Status 231468-20 Highest Priority 2]: fol r#e}s[]a| Priority Status 231468-21 Lowest Priority There are two ways to accomplish Automatic Rota- tion using OCW2, the Rotation on Non-Specific EO! Command (R = 1, SL = 0, EOI = 1) and the Ro- tate in Automatic EOI Mode which is set by (R = 1, SL = 0, EO! = 0) and cleared by (R = 0, SL = 0, EO! = 0). Specific Rotation (Specific Priority) The programmer can change priorities by program- ming the bottom priority and thus fixing all other pri- Orities; i.e., if IR5 is programmed as the bottom prior- ity device, then IR6 wiil have the highest one. The Set Priority command is issued in OCW2 where: R = t, SL = 1, LO-L2 is the binary priority level code of the bottom priority device. Observe that in this mode internal status is updated by software control during OCW2. However, it is in- dependent of the End of Interrupt (EOI) command (also executed by OCW2). Priority changes can be executed during an EOI command by using the Ro- tate on Specific EO! command in OCW2 (R = 1, SL = 1, EOI = 1 and LO-L2 = IR level to receive bottom priority). interrupt Masks Each interrupt Request input can bem masked indi- vidually by the Interrupt Mask Register (IMR) pro- grammed through OCW1. Each bit in the IMR masks one interrupt channel if it is set (1). Bit 0 masks IRO, Bit 1 masks IR1 and so forth. Masking an IR channel does not affect the other channels operation. Special Mask Mode Some applications may require an interrupt service routine to dynamically alter the system priority struc- ture during its execution under software control. For example, the routine may wish to inhibit lower priori- ty requests for a portion of its execution but enable some of them for another portion. The difficulty here is that if an Interrupt Request is acknowledged and an End of Interrupt command did not reset its iS bit (i.e., while executing a service routine), the 8259A would have inhibited all lower priority requests with no easy way for the routine to enable them. That is where the Special Mask Mode comes in. In the special Mask Mode, when a mask bit is set in OCW, it inhibits further interrupts at that level and enabies interrupts from aff other levels (lower as weil as higher) that are not masked. Thus, any interrupts may be selectively enabled by loading the mask register. The special Mask Mode is set by OWC3 where: SSMM = 1, SMM = 1, and cleared where SSMM = 1, SMM = 0. Poll Command In Poll mode the INT output functions as it normally does. The microprocessor should ignore this output. This can be accomplished either by not connecting the INT output or by masking interrupts within the microprocessor, thereby disabling its interrupt input. Service to devices is achieved by software using a Poll command. The Poil command is issued by setting P = 1 in OCW3. The 8259A treats the next RD pulse to the 8259A (i.e, RD = 0, CS = 0) as an interrupt ac- knowledge, sets the appropriate IS bit if there is a request, and reads the priority level. Interrupt is fro- zen from WR to RD. The word enabled onto the data bus during RD is: D7 D6 D5 D4 DS D2 ODiI DO fio o we wi wo WO0-W2: Binary code of the highest priority level requesting service. I: Equal to 1 if there is an interrupt. This mode is useful if there is a routine command common to several levels so that the INTA se- quence is not needed (saves ROM space). Another application is to use the poll mode to expand the . number of priority levels to more than 64. Reading the 8259A Status The input status of several internal registers can be read to update the user information on the system. 3-186e intel. 8259A LT BIT TO OTHER PRIORTY CELLS ine i CRG or sense ey PRIORITY ~_ 4 SERVICE Seren J nesorven CUR LATCH -) conraot \ if J Set REQUEST SL LATCH i" an) J, won LATCH endl AEO ; pC 6. 1o a (NYA MCS-00, 65 H MODE on H FREEZE L4 INTERNAL DATA BUS ita 5 g : ga 2086 e Q 22 MODE w z 3 ee __ z FREEZE NOTES: 1. Master clear active only during ICW1. 231468-22 2. FREEZE is active during INTA and poll sequences only. 3. Truth Table for a D-Latch. clo Q_ | Operation 1} Di] Di Follow 0| X | Qn-1 Hold Figure 9. Priority CellSimplified Logic Diagram The following registers can be read via OCW3 (IRR and ISR or OCW1 [IMR]). Interrupt Request Register (IRR): 8-bit register which contains the levels requesting an interrupt to be ac- knowledged. The highest request level is reset from the IRR when an interrupt is acknowledged. (Not af- fected by IMR.) In-Service Register (/SA): 8-bit register which con- tains the priority levels that are being serviced. The ISR is updated when an End of Interrupt Command is issued. Interrupt Mask Register: 8-bit register which con- tains the interrupt request lines which are masked. The IRR can be read when, prior to the RD pulse, a Read Register Command is issued with OCW3 (RR = 1, RIS = 0) The ISR can be read, when, prior to the RD puise, a Read Register Command is issued with OCW3 (RR = 1, RIS = 1): There is no need to write an OCW3 before every status read operation, as long as the status read corresponds with the previous one; i.e., the 8259A remembers whether the IRR or ISR has been pre- viously selected by the OCW3. This is not true when poll is used. After initialization the 8259A is set to IRR. For reading the IMR, no OCW3 is needed. The out- put data bus will contain the IMR whenever RD is active and AO = 1 (OCW1). Polling overrides status read when P = 1, RR = 1 in OCWS. Edge and Level Triggered Modes This mode is programmed using bit 3 in ICW1. lf LTIM = 0, an interrupt request will be recognized by a low to high transition on an IR input. The IR input can remain high without generating another in- terrupt. 3-1878259A . | > tT 9086/6088 8080/6065 . 8086/8088 ze \/ \/ \ Asse LATCH EARLIEST IR LATCH ARMED CAN BE REMOVED EDGE TRIGGERED MODE ONLY ARMEO 231468-23 Figure 10. IR Triggering Timing Requirements lf LTIM = 1, an interrupt request will be recognized by a high level on IR input, and there is no need for an edge detection. The interrupt request must be removed before the EOI command is issued or the CPU interrupts is enabled to prevent a second inter- rupt from occurring. The priority cell diagram shows a conceptual circuit of the level sensitive and edge sensitive input circuit- ry of the 8259A. Be sure to note that the request latch is a transparent D type latch. In both the edge and level triggered modes the IR inputs must remain high until after the falling edge of the first INTA. If the IR input goes low before this time a DEFAULT IR7 will occur when the CPU ac- knowledges the interrupt. This can be a useful safe- guard for detecting interrupts caused by spurious noise glitches on the IR inputs. To implement this feature the IR7 routine is used for clean up simply executing a return instruction, thus ignoring the inter- rupt. If IR7 is needed for other purposes a default IR7 can still be detected by reading the ISR. A nor- mal IR7 interrupt will set the corresponding ISR bit, a default IR7 won't. if a default IR7 routine occurs dur- ing a normal IR7 routine, however, the ISR will re- main set. In this case it is necessary to keep track of whether or not the IR7 routine was previously en- tered. If another IR7 occurs it is a default. The Special Fully Nest Mode _ This mode will be used in the case of a big system where cascading is used, and the priority has to be conserved within each slave. in this case the fully nested mode will be programmed to the master (us- ing ICW4). This mode is similar to the normal nested mode with the following exceptions: a. When an interrupt request from a certain slave is in service this slave is not locked out from the masters priority logic and further interrupt re- quests from higher priority IRs within the slave will be recognized by the master and will initiate interrupts to the processor. (In the normal nested mode a slave is masked out when its request is in service and no higher requests from the same slave can be serviced.) b. When exiting the Interrupt Service routine the software has to check whether the interrupt serv- iced was the only one from that slave. This is done by sending a non-specific End of Interrupt (EO!) command to the slave and then reading its In-Service register and checking for zero. If it is empty, a non-specific EOI can be sent to the master too. If not, no EO! should be sent. Buffered Mode When the 8259A is used in a large system where bus driving buffers are required on the data bus and the cascading mode is used, there exists the prob- lem of enabling buffers. The buffered mode will structure the 8259A to send an enable signal on SP/EN to enable the buffers. In this mode, whenever the 8259As data bus outputs are enabled, the SP/EN output becomes active. This modification forces the use of software pro- gramming to determine whether the 8259A is a mas- ter or a slave. Bit 3 in ICW4 programs the buffered mode, and bit 2 in |CW4 determines whether it is a master or a slave. 3-188intel. 8259A CASCADE MODE The 8259A can be easily interconnected in a system of one master with up to eight slaves to handle up to 64 priority levels. The master controls the slaves through the 3 line cascade bus. The cascade bus acts like chip selects to the slaves during the INTA sequence. In a cascade configuration, the slave interrupt out- puts are connected to the master interrupt request inputs. When a slave request line is activated and afterwards acknowledged, the master will enable the corresponding slave to release the device routine address during bytes 2 and 3 of INTA. (Byte 2 only for 8086/8088). The cascade bus lines are normally low and will con- tain the slave address code from the trailing edge of the first INTA pulse to the trailing edge of the third pulse. Each 82594 in the system must follow a sep- arate initialization sequence and can be pro- grammed to work in a different mode. An EOI com- mand must be issued twice: once for the master and once for the corresponding slave. An address de- coder is required to activate the Chip Select (CS) input of each 8259A. The cascade lines of the Master 8259A are activat- ed only for slave inputs, non-slave inputs leave the cascade line inactive (low). B259A SLAVE A 7 6 5 4 AODRAESS BUS (16) CONTROL BUS DATA BUS (6) ay 00.7 INTA Ay 00-7 SLAVE B T INTERRUPT REQUESTS Int REO 82598 MASTER 231468-24 Figure 11. Cascading the 8259A 3-189intel. 8259A ABSOLUTE MAXIMUM RATINGS* Ambient Temperature Under Bias ...... 0C to 70C Storage Temperature .......... 65C to + 150C Voltage on Any Pin with Respect to Ground.......... 0.5V to +7V Power Dissipation ...................00c cece iW NOTICE: This is a production data sheet. The specifi- cations are subject to change without notice. *WARNING: Stressing the device beyond the Absolute Maximum Ratings may cause permanent damage. These are stress ratings only. Operation beyond the Operating Conditions is not recommended and ex- tended exposure beyond the Operating Conditions may affect device reliability. D.C. CHARACTERISTICS T, = 0C to 70C, Voc = 5V + 10% Symbol Parameter Min Max Units Test Conditions Vit Input Low Voltage 0.5 0.8 Vv Vin Input High Voltage 2.0* Voc + 0.5V Vv Vor Output Low Voltage 0.45 Vv lo. = 2.2mA VoH Output High Voltage 2.4 v lou = 400 pA VOH(INT) Interrupt Output High 3.5 Vv lon = 100 pA Voltage 2.4 V lon = 400 pA lu Input Load Current 10 +10 pA OV < Vin < Voc ILoL Output Leakage Current 10 +10 pA 0.45V < Vout < Vcc loc Voc Supply Current 85 mA lurk IR Input Load Current 300 pA Vin = 0 10 BA Vin = Voc *NOTE: For Extended Temperature EXPRESS Vy = 2.3V. CAPACITANCE Ta = 25C; Voc = GND = OV Symbol Parameter Min Typ Max Unit Test Conditions Cin Input Capacitance 10 pF fe = 1 MHz C0 1/0 Capacitance . 20 pF Unmeasured Pins Returned to Vsg 3-190intel. 259A A.C. CHARACTERISTICS Ta = 0C to 70C, Voc = 5V + 10% TIMING REQUIREMENTS 8259A 8259A-2 Symbol Parameter Units | Test Conditions Min | Max | Min | Max TAHRL | AQ/CS Setup to RD/INTA |. ) 0 ns TRHAX | AO/CS Hold after RD/INTA T 0 0 ns TRLRH RD Pulse Width 235 160 ns TAHWL | AO/CS Setup to WR J 0 0 ns TWHAX | AO/GS Hold after WR T 0 0 ns TWLWH | WR Pulse Width 290 190 ns TDVWH | Data Setup to WR T 240 160 ns TWHDX | Data Hold after WR T 0 0 ns TJLJH Interrupt Request Width (Low) 100 100 ns See Note 1 TCVIAL | Cascade Setup to Second or Third INTA | (Slave Only) 55 40 ns TRHRL | End of RD to Next RD End of INTA to Next INTA within 160 100 ns an INTA Sequence Only TWHWL | End of WR to Next WR 190 100 ns *TCHCL | End of Command to Next Command 500 150 ns (Not Same Command Type) End of INTA Sequence to Next INTA Sequence. 500 300 *Worst case timing for TCHCL in an actual microprocessor system is typically much greater than 500 ns (i.e. 8085A = 1.6 ps, 8085A-2 = 1 ps, 8086 = 1 ps, 8086-2 = 625 ns) NOTE: This is the low time required to clear the input latch in the edge triggered mode. TIMING RESPONSES Symbol Parameter 8259A 8259A-2 Units Test Conditions Min | Max | Min | Max TRLDV | Data Valid from RD/INTA J 200 120 ns C of Data Bus = 100 pF TRHDZ | Data Float after RD/INTA T 10 | 100 | 10 | 85 ns | Cof Data Bus Max Test C = 100 pF TJHIH { t | 350 300 J nterrupt Output Delay i ns Min Test C = 15 pF TIALCV | Cascade Valid from First INTA (Master Only) 565 360 | ns | Cyr = 100 pF TRLEL | Enable Active from RD J or INTA | 125 100 | ns CcoascaDE = 100 pF TRHEH | Enable Inactive from RD T or INTA T 150 150 ns TAHDV | Data Valid from Stable Address 200 200 ns TCVDV | Cascade Valid to Valid Data 300 200 ns 3-191intel. 8259A A.C. TESTING INPUT/OUTPUT WAVEFORM A.C. TESTING LOAD CIRCUIT v0 20 a TEST x > TEST POINTS < x , = 100 pF 0.8 0.8 0.45 231468-25 = AC. Testing: Inputs are driven at 2.4V for a logic 1 and 0.45V 231468 -26 for a logic 0. Timing measurements are made at 2.0V for a logic CL = 100 pF 4+ and 0.8V for a logic 0. C, Includes Jig Capacitance WAVEFORMS WRITE wa TWwLWH TAMWL |~ Jo] TWHAX cs ADDRESS BUS we TOVWH o} TWHOX DATA BUS 231468-27 3-192intel. 8259A WAVEFORMS (Continued) READ/INTA ADnNTA TRLAN | e TALEL TRHEM Po TAMA _,, TRHAX a@ ADOAESS BUS de TRLOV TAHOV--+} DATA BUS = me me ee ee er ne ae 4 231468-28 OTHER TIMING RD NTA . TRHAL WA : TWHWL RO INTA TCHCL ial a 231468-29 3-193intel. 8259A WAVEFORMS (Continued) INTA SEQUENCE , . 4 E \ |racev_~. 231468-30 NOTES: Interrupt output must remain HIGH at least until leading edge of first INTA. 1. Cycle 1 in 8086, 8088 systems, the Data Bus is not active. Data Sheet Revision Review The following changes have been made since revision 2 of the 8259A data sheet. 1. The first paragraph of the Poll Command section was rewritten to clarify the status of the INT pin. 2. A paragraph was added to the Interrupt Sequence section to indicate the status of the INT pin during multiple interrupts. 3. A reference to PLCC packaging was added. 4. All references to the 8259A-8 have been deleted. 3-194