Programmable Interrupt Controller (PIC) 8259 – Microprocessor YASH PAL, April 5, 2026April 5, 2026 Programmable Interrupt Controller (PIC) 8259 – The 8259 programmable interrupt controller is used to provide additional interrupts other than software and hardware interrupts of the 8085 microprocessor. The 8259 interrupt controller can do the following things :Manage eight interrupts according to the instructions written into its control registers. This is equivalent to providing eight interrupt pins on the processor by connecting to its INTR pin of the 8085 microprocessor. Thus, we have a total of 12 interrupt lines by using one 8259 (8 new and 4 earlier interrupt lines) (TRAP, RST 7.5, RST 6.5, RST 5.5), with the loss of the INTR line.Vector an interrupt request anywhere in the memory map. However, all eight interrupts are spaced at an interval of either four or eight locations. This eliminates the major drawback of the 8085 interrupts, in which all interrupts are vectored to memory locations on page 00H.Provides eight levels of interrupt priorities in a variety of modes, such as fully nested mode, automatic rotation mode, and specific rotation mode.Mask each interrupt request individually.Read the status of pending interrupts, in-service interrupts, and masked interrupts.Be set up to accept either the level-triggered or the edge-triggered interrupt request.Be expanded to 64 priority levels by cascading an additional 8259s.Be set up to work with either the 8085 microprocessor mode or the 8086/8088 microprocessor mode.Block Diagram of 8259The figure below shows the internal block diagram of the 8259. It includes eight blocks: control logic, read/write logic, data bus buffer, three registers (IRR, ISR, and IMR), priority resolver, and cascade buffer. The diagram shows all the elements of a programmable device, plus additional blocks.Block diagram of 8259The functions of these blocks are as follows:Control LogicThis block has two pins: INT (interrupt) and INTA (interrupt acknowledge). The functions of these are:INT (Interrupt): It is an active high output signal. Whenever a valid interrupt is asserted, this signal goes high. This is connected to the INTR pin of the microprocessor.INTA (Interrupt Acknowledge): It is an active low input signal. The INTA is the interrupt acknowledge signal from the microprocessor. This is connected to the INTA pin of the microprocessor.Read/Write LogicRead/Write logic has the following signals:A0: When the address line A0 is set to logic 0, the controller is selected to write a command or read a status. This is connected to the A0 address line of the microprocessor.RD (Read), WR (Write), and CS (Chip select): These pins have their usual functions.Data Bus BufferIt has bidirectional data pins (D0 – D7). These pins are connected to the data bus of the microprocessor. The data buffer allows the 8085 to send control words to the 8259 and read a status word from the 8259.Cascade Buffer/ComparatorThis block is used to expand the number of interrupt levels by cascading two or more 8259s. The pins associated with this block are:CAS 0 – CAS 2(Cascade lines): These lines are used to connect more than one 8259 in cascade mode.SP/EN (Slave Program/Enable Buffer): It is used to define the 8259 as master/slave. When a single 8259 is used, it operates as a master. Then the SP/EN pin is connected to +5V (logic 1). When more than one 8259 is used, then only one 8259 can be a master. The remaining 8259s must operate as slaves, with SP/EN connected to ground (logic 0).Registers8259 has three registers: IRR, ISR, and IMR.IRR (Interrupt Request Register): The Interrupt Request Register (IRR) has eight input lines (IR0 – IR7) for interrupts. When these lines go high, the requests are stored in the register.ISR (In-Service Register): The In-Service Register (ISR) stores all the interrupts that are currently being serviced.IMR (Interrupt Mask Register): The Interrupt Mask Register (IMR) stores the masking bits of the interrupt lines to be masked.Priority ResolverThe priority resolver (PR) examines three registers (IRR, ISR, and IMR). It resolves the priority and generates an INT (high) signal when it finds the interrupt request appropriate.Operation of InterruptIf lines (IR0 – IR7) are high, it means that the request is stored and the corresponding IRR bit is set.All three registers are checked by the priority resolver, and the INT pin is set high.The microprocessor acknowledges the interrupt by sending an INTA pulse.When an INTA pulse is received from the microprocessor, the ISR bit with the highest priority is set, and the corresponding IRR bit is reset. Thereafter, the call instruction code CDH is set on pins (D0 – D7). Since all the RST instructions are 1-byte call instruction having some vectored location.Two more INTA signals on the data bus are placed while decoding the CALL instruction.The two INTA pulses are defined as that lower 8-bit address is released at the second INTA pulse, and the higher 8-bit address at the third INTA pulse. It completes the 3-byte CALL instruction.At the third INTA pulse, the ISR bit is reset either automatically with the help of AEOI (Automatic End of Interrupt) or by a command word that should be given at the end of the subroutine, which is determined by the initialization command word.Priority Modes of PICMany types of priority modes are available with 8259. They can be changed dynamically during the program by writing appropriate command words. Priority modes, which are commonly used, are as follows:Fully Nested ModeIn this mode, the interrupt requests from IR0 to IR7 are arranged, from highest to lowest priority. IR0 has the highest priority, and IR7 has the lowest priority. When an interrupt is acknowledged, the highest priority request is determined, and its vector location is placed on the bus. Also, any IR can be set to the highest priority.IR0IR1IR2IR3IR4IR5IR6IR7456701237 = Lowest priority and 0 = Highest PriorityAutomatic Rotation ModeIn some applications, there can be equal priority assigned to no of interrupting devices. With the help of this mode, the interrupt request, after being served, receives the lowest priority.IR0IR1IR2IR3IR4IR5IR6IR7567012347 = Lowest PriorityAssuming that IR2 has just been serviced, it will receive the seventh (lowest) priority.Specific Rotation ModeIn this mode, the user can select any interrupt request for the lowest priority. The programmer, by programming the bottom priority and fixing other priorities, can change any priority.Programming the 8259The first INTA pulse is dedicated to CALL, having opcode CDH.D7D6D5D4D3D2D1D011001101C = D7 – D4 and D = D3 to D0The second INTA pulse enables the lower address of the service routine on the data bus when interval = 4 bits, A5 – A7 are programmed, while A0 – A4 are automatically inserted by the 8259. When interval = 8, only A0 and A7 are programmed, while A0 – A5 are automatically inserted.During the third INTA pulse, the higher address of the service routine as byte 2 of the initialization sequence (A8 – A15) is enabled onto the bus.Command Words of PITThere are two types of command words:Initialization Command Word (ICW)Operational Command Word (OCW)Initialization Command Word (ICW)8259 has 4 ICWs, ICW1 and ICW2 are essential whereas ICW3 and ICW4 depends upon the types of modes being used.ICW1 and ICW2: The request levels can be programmed to be spaced either at an interval of 4 or at an interval of 8. ICW1 and ICW2 are shown in the table below.D7D6D5D4D3D2D1D0A7A6A51LTIMADISNGLIC4CallAddressCallAddressCallAddress1 = LevelTriggered Mode0 = EdgeTriggeredModeCall Address Interval1= Inerval of 40 = Interval of 81 = Single0 = Cascade Mode1 = ICW4 is required0 = ICW4 is not requiredICW1 (with A0 = 0)D7D6D5D4D3D2D1D0A15A14A13A12A11A10A9A8ICW2 (with A0 = 1)A15 – A8 = Interrupt Vector AddressICW1 provides the following information:Single or multiple 8259s in the system.4-bit or 8-bit interval between the interrupt vector locations.The address bits A5 – A7 of the CALL instruction; the rest are supplied by the 8259, as shown in the two tables below.CALL ADDRESS = D0 to D7IRD7D6D5D4D3D2D1D0IR7A7A6A511100IR6A7A6A511000IR5A7A6A510100IR4A7A6A510000IR3A7A6A501100IR2A7A6A501000IR1A7A6A500100IR0A7A6A500000Call Address with an interval of 4CALL ADDRESS = D0 to D7IRD7D6D5D4D3D2D1D0IR7A7A6111000IR6A7A6110000IR5A7A6101000IR4A7A6100000IR3A7A6011000IR2A7A6010000IR1A7A6001000IR0A7A6000000Call Address with an interval of 8ICW2 defines the remaining high-order byte of the call address (A8 – A15).ICW2 and ICW4: ICW3 is required only when more than one 8259 is used in the system by the cascading process. It is optional and needed when bit D1 of ICW1 is 0. Both master and slave will be identified. ICW4 is also needed only when bit D0 of ICW1 is 1.D7D6D5D4D3D2D1D0S7S6S5S4S3S2S1S0ICW3 – Master mode (with A0 = 1)1 = Slave for IR Input0 = No slave for interrupt requestD7D6D5D4D3D2D1D000000ID2ID1ID0ICW3 – Slave Mode (with A0 = 1)Slave Cascade Number = ID2, ID1, ID0D7D6D5D4D3D2D1D0000SFNMBUFM/SAEOI11 = SpecialFullyNestedMode1 = Buffered Mode1 = Master Mode0 = Slave Mode1 = Automatic end of interrupt modeICW4 – (with A0 = 1)Operational Command Word (OCW)It has three OCWS. The OCWS are written in the control register after ICWS.(a) OCW1: The OCW1 is used to set and reset the mask bits in the interrupt mask register.D7D6D5D4D3D2D1D0M7M6M5M4M3M2M1M0OCW1Interrupt Mask1 = Mask Set0 = Mask Reset(b) OCW2: The OCW2 is used to control the rotation (R) and EOI (End of Interrupt) modes and their combination of two. It is used to set various priority levels.D7D6D5D4D3D2D1D0RSLEOI00L2L1L0OCW2 (Use L2 – L0 for specific IR level)RSLEOI001Non-specific EOI Command011Specific EOI Command101Rotate on non-specific EOI Command100Rotate in AEOI mode (Set)000Rotate in AEOI mode (Reset)111Rotate on Specific EOI Command110Set priority command010No operationEnd of Interrupt Modes of OCW20L2L1L00000IR00001IR10010IR20011IR30100IR40101IR50110IR61111IR7rotation modes of OCW2((c) OCW3: The OCW3 is used to set and reset the special mask and poll command.D7D6D5D4D3D2D1D00SM1SM001PR1R0OCW3SM1SM011Set Special Mask10Reset Special Mask0XNo functionP1Poll Command0No poll Command10Read IR11Read ISEnd of Interrupt in PICWhen any interrupt service is completed, it is necessary to reset the corresponding ISR bit to update the information in the ISR. This is called the End-of-Interrupt (EOI) command. It can be issued in three ways:Non-specific EOI CommandWhen this command is sent to the 8259, it resets the highest priority ISR bit. The format for non-specific EOI instruction is as follows:D7D6D5D4D3D2D1D000100000= 20HA0 should be 0 while issuing the EOI instruction.Specific EOI CommandThis command is used to specify which ISR bit is to be reset. The format for specific EOI instruction is as follows:A0D7D6D5D4D3D2D1D0001100I2I1I0ISR bit to be resetI2I1I000000011010201131004101511061117Automatic EOINo command is required to specify End-of-Interrupt. During the third INTA, the ISR bit is reset. The limitation of this mode is that the ISR does not have information on which IR is being serviced. Thus, any IR can interrupt the service routine, irrespective of its priority, if the interrupt enable flip-flop is set. engineering subjects Microprocessor microprocessor