8259 A P R O G R A M M A B L E I N T E R R U P T C O N T R O L L E R2


Published on

Published in: Technology
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

8259 A P R O G R A M M A B L E I N T E R R U P T C O N T R O L L E R2

  2. 2. NEED FOR 8259A <ul><li>8085 Processor has only 5 hardware interrupts. </li></ul><ul><li>Consider an application where a number of I/O devices connected with CPU desire to transfer data using interrupt driven data transfer mode. In this process more number of interrupt pins are required. </li></ul><ul><li>In these multiple interrupt systems the processor will have to take care of priorities. </li></ul>
  3. 3. 8259A PIC <ul><li>Able to handle a number of interrupts at a time. </li></ul><ul><li>Takes care of a number of simultaneously appearing interrupt requests along with their types and priorities. </li></ul><ul><li>Compatible with 8-bit as well as 16-bit processors. </li></ul>
  4. 4. 8259A PIC- FEATURES <ul><li>Manage 8 interrupts according to the instructions written into the control registers. </li></ul><ul><li>Vector an interrupt request anywhere in the memory map. However all the 8 interrupts are spaced at an interval of four to eight locations. </li></ul><ul><li>Resolve 8 levels of interrupt priorities in variety of modes. </li></ul><ul><li>Mask each interrupt request individually. </li></ul><ul><li>Read the status of pending interrupts, in-service interrupts and masked interrupts. </li></ul>
  5. 5. 8259A PIC- FEATURES <ul><li>Be set up to accept either the level triggered or the edge triggered interrupt request. </li></ul><ul><li>Be expanded to 64 priority levels by cascading additional 8259As. </li></ul><ul><li>Compatible with 8-bit as well as 16-bit processors. </li></ul>
  6. 6. 8259A PIC- BLOCK DIAGRAM <ul><li>It includes 8 blocks. </li></ul><ul><li>Control logic </li></ul><ul><li>Read/Write logic </li></ul><ul><li>Data bus buffer </li></ul><ul><li>Three registers (IRR,ISR and IMR) </li></ul><ul><li>Priority resolver </li></ul><ul><li>Cascade Buffer </li></ul>
  7. 7. 8259A PIC- PIN DIGRAM
  8. 8. 8259A PIC- BLOCK DIAGRAM
  9. 9. 8259A PIC- INTERRUPTS AND CONTROL LOGIC SECTION <ul><li>This section consists of </li></ul><ul><li>IRR (Interrupt Request Register) </li></ul><ul><li>ISR (In-Service Register) </li></ul><ul><li>Priority Resolver </li></ul><ul><li>IMR (Interrupt Mask Register) </li></ul><ul><li>Control logic block </li></ul><ul><li>IRR </li></ul><ul><li>8 interrupt inputs set corresponding bits of IRR </li></ul><ul><li>Used to store the information about the interrupt inputs requesting service. </li></ul>
  10. 10. 8259A PIC- INTERRUPTS AND CONTROL LOGIC SECTION <ul><li>ISR </li></ul><ul><li>Used to store information about the interrupts currently being serviced. </li></ul><ul><li>* OCWs  Operation Control Word. </li></ul><ul><li>PRIORITY RESOLVER </li></ul><ul><li>Determines the priorities of interrupts requesting services (which set corresponding bits of IRR) </li></ul><ul><li>It determines the priorities as dictated by priority mode set by OCWs. </li></ul><ul><li>The bit corresponding to highest priority input is set in ISR during input. </li></ul><ul><li>Examines three registers and determines whether INT should be sent to MPU. </li></ul>
  11. 11. 8259A PIC- INTERRUPTS AND CONTROL LOGIC SECTION <ul><li>IMR </li></ul><ul><li>This register can be programmed by an OCW to store the bits which mask specific interrupts. </li></ul><ul><li>IMR operates on the IRR. </li></ul><ul><li>An interrupt which is masked by software (By programming the IMR) will not be recognized and serviced even if it sets corresponding bits in the IRR. </li></ul>
  12. 12. 8259A PIC- INTERRUPTS AND CONTROL LOGIC SECTION <ul><li>CONTROL LOGIC </li></ul><ul><li>Has two pins: </li></ul><ul><li>INT (Interrupt)  Output </li></ul><ul><li>( Interrupt Acknowledge)  Input </li></ul><ul><li>INT  Connected to Interrupt pin of MPU. </li></ul><ul><li> When interrupt occurs this pin goes high. </li></ul>
  13. 13. 8259A PIC- BLOCK DIAGRAM <ul><li>DATA BUS BUFFER </li></ul><ul><li>8 bit </li></ul><ul><li>Bidirectional </li></ul><ul><li>Tri-state Buffer used to Interface the 8259 to the system data bus. </li></ul><ul><li>Control words, Status words and vectoring data are all passed through the data bus buffer. </li></ul>
  14. 14. 8259A PIC- READ/WRITE CONTROL LOGIC SECTION <ul><li>Contains ICW and OCW registers which are programmed by the CPU to set up the 8259 and to operate it in various modes. </li></ul><ul><li>Also accepts read command from CPU to permit the CPU to read status words. </li></ul><ul><li> Chip Select  Active Low input </li></ul><ul><li> Used to select the Device. </li></ul><ul><li> Read  Active Low input </li></ul><ul><li> Used by CPU to read the status of </li></ul><ul><li>ISR,IRR,IMR or the Interrupt level. </li></ul><ul><li> Write  Active Low input </li></ul><ul><li> Used to write OCW and ICW onto the 8259. </li></ul><ul><li>*ICW  Initialization Control Word </li></ul>
  15. 15. 8259A PIC- CASCADE BUFFER/ COMPARATOR <ul><li>Generates control signals for cascade operation . </li></ul><ul><li>Also generates buffer enable signals. </li></ul><ul><li>8259 cascaded with other 8259s </li></ul><ul><li> Interrupt handling capacity to 64 levels </li></ul><ul><li> Former is called master and latter is slave. </li></ul><ul><li>8259 can be set up as master or slave by </li></ul><ul><li>pin in non-buffered mode or by software if it is to be operated in the buffered mode of operation. </li></ul>
  16. 16. 8259A PIC- CASCADE BUFFER/ COMPARATOR <ul><li>CAS 0-2 </li></ul><ul><li>For master 8259 these pins are outputs and for slaves these are inputs. </li></ul><ul><li>When 8259 is a master the CALL op-code is generated by master in response to the first Interrupt acknowledge. </li></ul><ul><li>The vectoring address must be released by slave 8259. </li></ul><ul><li>The master puts out the identification code to select one of the slave from 8 slaves through these pins. </li></ul><ul><li>The slave accepts these three signals as inputs and compare the code put out by the master with the codes assigned to them during initialization. </li></ul><ul><li>The slave thus selected puts out the address of ISR during second and third interrupt acknowledge pulses from the CPU. </li></ul>
  17. 17. 8259A PIC- CASCADE BUFFER/ COMPARATOR <ul><li>Slave Program/ Enable Buffer: </li></ul><ul><li>Used to specify whether 8259 is to act as a master or a slave </li></ul><ul><li>High  Master </li></ul><ul><li>Low  Slave </li></ul><ul><li>In Non-Buffered Mode , this pin is used to specify whether 8259 is to act as a master or a slave. </li></ul><ul><li>In Buffered mode this pin is used as an output to enable the data bus buffer of the system. </li></ul>
  18. 18. 8259A PIC- INTERRUPT OPERATION <ul><li>To implement interrupt, the interrupt Enable FF must be enabled by writing EI instruction . </li></ul><ul><li>8259A  should be initialized by writing control words in the control register. </li></ul><ul><li>8259 requires two types of control words: </li></ul><ul><li>ICW  Used to set up proper conditions </li></ul><ul><li>and specify RST vector address. </li></ul><ul><li>OCW  Used to perform functions such as </li></ul><ul><li>masking interrupts, setting up status </li></ul><ul><li>read operations etc. </li></ul><ul><li>After 8259A is initialized, the following sequence of events occurs when one or more interrupt request lines go high. </li></ul>
  19. 19. 8259A PIC- INTERRUPT OPERATION <ul><li>IRR stores the Interrupt requests. </li></ul><ul><li>Priority Resolver Checks three registers: IRR  for interrupt requests. IMR  for Masking bits. ISR  for the interrupt request being serviced. It resolves the priority and sets the INT high when appropriate. </li></ul><ul><li>MPU acknowledges the interrupt by sending interrupt acknowledge. </li></ul>
  20. 20. 8259A PIC- INTERRUPT OPERATION <ul><li>4. After is received, the appropriate priority bit in the ISR is set to indicate which level is being served and the corresponding bit in the IRR is reset to that request is accepted. Then op-code for CALL instruction is placed on the Data Bus. </li></ul><ul><li>5. When MPU decodes the CALL instruction, it places two more signals on the data bus. </li></ul>
  21. 21. 8259A PIC- INTERRUPT OPERATION <ul><li>6. When 8259 receives second , it places lower order byte of CALL address on the data bus. </li></ul><ul><li>Third  High order byte. </li></ul><ul><li>The CALL address is the vector memory location for the interrupt. This address is placed in control register during initialization. </li></ul>
  22. 22. 8259A PIC- INTERRUPT OPERATION <ul><li>7. During third pulse, the ISR bit is reset either automatically (AEOI) or by a command word that must be issued at the end of the service routine (EOI). This option is determined by the ICW. </li></ul><ul><li>8. The program sequence is transferred to the memory location specified by the CALL instruction. </li></ul><ul><li>AEOI  Automatic End of Interrupt Mode </li></ul><ul><li>EOI  End of Interrupt Mode </li></ul>
  23. 24. 8259A PIC- COMMAND WORDS <ul><li>Two types: ICW, OCW </li></ul><ul><li>ICW: </li></ul><ul><li>Before start functioning, 8259 must be initialized by writing two to four command words into their respective command word registers. </li></ul><ul><li>A 0 =0,D 4 =1 : The control word is ICW 1 . ICW 1  contains the control bits for edge/level triggered mode, single/cascade mode, call address interval and whether ICW 4 is required or not etc. </li></ul><ul><li>A 0 =1 : ICW 2  Store details interrupt vector addresses. </li></ul>
  24. 25. 8259A PIC- ICW 1 <ul><li>The following initialization procedure Carried out internally when ICW 1 is loaded. </li></ul><ul><li>The edge sense circuit is reset i.e. by default 8259A interrupts are edge sensitive. </li></ul><ul><li>IMR is cleared. </li></ul><ul><li>IR7 input is assigned lowest priority. </li></ul><ul><li>Slave mode address is set to 7. </li></ul><ul><li>Special mask mode is cleared and status read is set to IRR. </li></ul><ul><li>If IC 4 =0, all functions of ICW 4 are set to Zero. Master/slave bit in ICW4 bit is used in buffered mode only. </li></ul>
  25. 26. INITIALIZATION SEQUENCE OF 8259A ICW1 & ICW2 are Compulsory command Words in the initialization sequence. ICW3 & ICW4 are Optional. ICW3 is read only when More than one 8259 used in the system ( SNGL bit in ICW1 is 0).
  26. 27. For 8086  Don’t Care ADI=1 for 8086 based system p
  27. 28. For 8085 system they are filled by A 15 -A 11 of the interrupt vector address and Least significant 3 bits are same as the respective bits of the vector address. For 8086 system they are filled by most significant 5 bits of interrupt type and the least significant 3 bits are 0, pointing to IR 0 .
  28. 32. If BUF=0,M/S is to be neglected .
  29. 36. 8259A- OPERATING MODES <ul><li>FULLY NESTED MODE: </li></ul><ul><li>General purpose mode. </li></ul><ul><li>All IRs are arranged from highest to lowest. </li></ul><ul><li>IR0  Highest IR7  Lowest </li></ul><ul><li>AUTOMATIC ROTATION MODE: </li></ul><ul><li>In this mode, a device after being serviced, receives the lowest priority. </li></ul><ul><li>SPECIFIC ROTATION MODE: </li></ul><ul><li>Similar to automatic rotation mode, except that the user can select any IR for the lowest priority, thus fixing all other priorities. </li></ul>
  31. 39. 8259A- OPERATING MODES <ul><li>END OF INTERRUPT (EOI): </li></ul><ul><li>After the completion of an interrupt service, the corresponding ISR bits needs to be reset to update the information in the ISR. This is called EOI command. </li></ul><ul><li>It can be issued in three formats: </li></ul><ul><li>NON SPECIFIC EOI COMMAND: </li></ul><ul><li>When this command is sent to 8259A, it resets the highest priority ISR bit. </li></ul><ul><li>SPECIFIC EOI COMMAND: </li></ul><ul><li>This command specifies which ISR bit is to reset. </li></ul>
  32. 40. 8259A- OPERATING MODES <ul><li>AUTOMATIC EOI: </li></ul><ul><li>In this mode, no command is necessary. </li></ul><ul><li>During the third interrupt acknowledge cycle, the ISR bit is reset. </li></ul><ul><li>DRAWBACK: The ISR does not have information about which ISR is being serviced. Thus, any IR can interrupt the service routine, irrespective of its priority, if the interrupt enable FF is set. </li></ul>
  33. 41. 8259A- OPERATING MODES <ul><li>SPECIAL FULLY NESTED MODE: </li></ul><ul><li>Used in case of larger system where cascading is used, and the has to be programmed in the master using ICW4 </li></ul><ul><li>In this mode, when an interrupt request from a certain slave is in service, this slave can further send requests to the master, if the requesting device connected to the slave has higher priority than the one being currently served. </li></ul><ul><li>In this mode, the master interrupts the CPU only when the interrupting device has the highest priority or the same priority than the one currently being served. </li></ul><ul><li>In normal mode, other requests than the one being served are masked. </li></ul><ul><li>BUFFERED MODE </li></ul><ul><li>CASCADE MODE </li></ul>
  34. 42. ADDITIONAL FEATURES OF THE 8259A <ul><li>INTERRUPT TRIGGERING: </li></ul><ul><li>8259A can accept an interrupt request with either the edge triggered or level triggered mode. </li></ul><ul><li>Mode is determined by initialization instructions. </li></ul><ul><li>INTERRUPT STATUS: </li></ul><ul><li>The status of the three interrupt registers (IRR, ISR and IMR) can be read, and this status information can be used to make the interrupt process versatile. </li></ul><ul><li>POLL METHOD: </li></ul><ul><li>8259A can be set up to function in polled environment. </li></ul><ul><li>MPU polls the 8259A rather than each peripheral . </li></ul>