home *** CD-ROM | disk | FTP | other *** search
/ Compu-Fix / Compu-Fix.iso / misc / program2 / irq.doc < prev    next >
Encoding:
Text File  |  1993-03-01  |  11.6 KB  |  222 lines

  1. The Zenith Data Systems Forum on CompuServe
  2. File: IRQ.ZIP
  3.  
  4.                                  IRQS
  5.  
  6.                    by Ralph E. Griffin [70323,1440]
  7.  
  8.  
  9. What is an IRQ line:
  10.  
  11. Some adapter cards which are designed to be installed in an IBM PC,
  12. PC/XT, PC/AT, or compatible computer require an Interrupt Request (IRQ)
  13. line. These cards usually give the user a narrow selection of IRQ lines
  14. and the accompanying documentation gives little advice on which IRQ line
  15. to use. If you choose the wrong line, it will interfere with the
  16. operation of some other hardware on your system such as the COM ports or
  17. printer ports. This document explains how to use IRQ lines.
  18.  
  19. It will be helpful to review the function of the IRQ lines. The IBM PC,
  20. and PC/XT have 8 IRQ lines (numbered IRQ0 through IRQ7). The IBM PC/AT
  21. and the non-IBM 386/ATs have 16 IRQ lines (numbered IRQ0 through IRQ15).
  22. The IRQ lines are physical connections in the computer. When a hardware
  23. device such as an adapter card activates the IRQ line it is detected by
  24. the programmable interrupt controller (PIC). The PIC then activates the
  25. interrupt pin on the processor. The processor responds by stopping
  26. whatever it is doing and then asks the PIC which interrupt should by
  27. executed. The PIC responds by telling the processor which interrupt to
  28. execute depending on which IRQ line was activated. The processor then
  29. gets the vector for that interrupt by looking in the interrupt vector
  30. table in memory. The processor then starts executing the procedure at the
  31. address that is pointed to by the vector. When the procedure is finished,
  32. the processor resumes doing whatever it was doing before it was
  33. interrupted.
  34.  
  35. Every IRQ line has a designated interrupt, and many IRQ lines have
  36. designated functions. Some of these functional designations are a little
  37. flexible. The following list shows the interrupt number and function of
  38. all the IRQ lines:
  39.  
  40. line     interrupt  function
  41.  
  42. IRQ0      08        system timer
  43. IRQ1      09        keyboard
  44. IRQ2      0A        PC/XT: EGA vertical retrace or maybe available
  45.                     PC/AT: see explanation below
  46. IRQ3      0B        COM2 or maybe available
  47. IRQ4      0C        COM1
  48. IRQ5      0D        PC/XT: hard disk drive
  49.                     PC/AT: LPT2 or maybe available
  50. IRQ6      0E        floppy disk drive
  51. IRQ7      0F        LPT1
  52. IRQ8      70        PC/AT: CMOS Real Time Clock
  53. IRQ9      71        PC/AT: see explanation below
  54. IRQ10     72        PC/AT: probably available
  55. IRQ11     73        PC/AT: probably available
  56. IRQ12     74        PC/AT: probably available
  57.                     PS/2: mouse
  58. IRQ13     75        PC/AT: numeric coprocessor
  59. IRQ14     76        PC/AT: hard disk drive
  60. IRQ15     77        PC/AT: probably available
  61.  
  62.  
  63. As you can see from the above table, it appears that all of the lower 8
  64. IRQ lines are all reserved for something, and that makes it hard to add
  65. anything. But you may not actually have all the equipment that uses all
  66. those lines which means that the lines are free to be used for something
  67. else.
  68.  
  69.  
  70. IRQ5:
  71.  
  72. On PC/XT's, the IRQ5 line is reserved for the hard disk drive. On
  73. PC/AT's, it is reserved for the second parallel printer port (LPT2), but
  74. most PC/AT's have only one parallel printer port (LPT1), so the IRQ5 line
  75. is in fact available for other uses. If you do have a second parallel
  76. port, you may be able to disable it and the IRQ5 line, which would make
  77. the IRQ5 line available for other uses.
  78.  
  79.  
  80. IRQ3:
  81.  
  82. If a computer has only one serial port, or uses only one serial port,
  83. then IRQ3 may be available. If the computer has two serial ports but only
  84. one of them is being used, it may be possible to disable the IRQ3 line of
  85. the second serial port (COM2). If the IRQ3 line is unused or can be made
  86. available, then it is available for other uses.
  87.  
  88.  
  89. IRQ2:
  90.  
  91. The IRQ2 line has no predetermined function, but it is commonly used by
  92. EGA and VGA adaptors, network adaptors, and bus mouse adaptors. The IRQ2
  93. line can be used for any one of these purposes or for any other purpose,
  94. as long as there is no conflict with other adaptors. If the IRQ2 line is
  95. already being used by an EGA or VGA adaptor, you may be able to disable
  96. it for reasons explained below, and that would free it up for some other
  97. use. On a PC/AT the IRQ9 line may be considered the same as the IRQ2 line
  98. (more on that later). So if one adaptor uses the IRQ2 line and another
  99. uses the IRQ9 line, then there is a conflict.
  100.  
  101. Many of the old style of EGA adaptor cards have the problem that snow may
  102. appear on the display if you right directly to the display memory in
  103. graphics mode. To get around the snow problem, the EGA card generates an
  104. interrupt every time the display goes into a vertical retrace. Any
  105. software that uses the EGA display in graphics mode can set up an
  106. interrupt handler to write to the display only while the display is in
  107. vertical retrace, and that eliminates the snow problem. The EGA adaptor
  108. uses IRQ2 for this purposes. If your EGA adaptor does not have a jumper
  109. that enables or disables the IRQ2 line, then chances are that the IRQ2
  110. line is enabled (and there is nothing you can do about it). If your EGA
  111. adaptor has a jumper that enables or disables the IRQ2 line, then you
  112. could disable it, and you may not notice any change in performance,
  113. especially if you do not have any software that utilizes it. There is
  114. also a chance that your EGA adaptor does not have the snow problem
  115. anyway, and the IRQ2 jumper is there only for the remote possibility that
  116. you may be running some software that won't work properly without the
  117. IRQ2.
  118.  
  119. Some VGA adaptor cards also have a jumper that allows you to enable or
  120. disable the IRQ2 line. VGA adaptors are not supposed to have the snow
  121. problem even when the IRQ2 line is disabled, so it is very unlikely that
  122. you need to enable it. The IRQ2 jumper is there only for the remote
  123. possibility that you may be running some software that won't work
  124. properly without the IRQ2. Most software that uses the IRQ2 can
  125. automatically detect it and adjust its operations to work with or without
  126. it. Some software that uses the IRQ2 selects the mode of operation during
  127. installation, so you may have to reinstall or resetup after disabling the
  128. IRQ2 line of the EGA or VGA adaptor. If the VGA adaptor has a 16 bit
  129. interface instead of an 8 bit interface, then the jumper will be referred
  130. to as IRQ9 enable instead of IRQ2 enable. It is really the same line as
  131. explained below.
  132.  
  133.  
  134. IRQ2 and IRQ9 Working Together:
  135.  
  136. On PC/AT's and 386/AT's the IRQ2 and IRQ9 lines are used in mysterious
  137. ways which require lengthy explanation. Most technical references provide
  138. confusing, scant and contradictory information about this line and its
  139. interrupt. The following is an attempt to clear up the confusion.
  140.  
  141. A comparison of the pinout diagrams for the adapter interface of the
  142. PC/XT and PC/AT shows that the IRQ9 terminal on the PC/AT is in the same
  143. location as the IRQ2 terminal on the PC/XT. Furthermore, the PC/AT does
  144. not even have an IRQ2 terminal. If a card is designed to work in the
  145. PC/XT, it has an 8 bit interface and it may use the IRQ2 line. If the
  146. card is plugged into a PC/XT system and if it activates its IRQ2 line,
  147. then it will activate the IRQ2 line on the computer mother board and that
  148. will cause the computer to execute interrupt 0A. If the same card is
  149. plugged into a PC/AT and if it activates (what it thinks is) the IRQ2
  150. line, then it will actually be activating the IRQ9 line on the computer
  151. motherboard (the IRQ2 terminal of the card contacts the IRQ9 terminal of
  152. the interface connector) and that will cause the computer to execute
  153. interrupt 71. The procedure for interrupt 71 is set up by the BOIS and it
  154. includes a software call to interrupt 0A (the interrupt for IRQ2).
  155.  
  156. In other words, the PC/AT computer uses hardware to redirect the IRQ2
  157. line of an adaptor card onto the IRQ9 line of the motherboard, and it
  158. uses software to redirect interrupt 71 (the procedure for IRQ9) back to
  159. interrupt 0A (the procedure for IRQ2). Thus the real IRQ2 line on the
  160. motherboard is uninvolved, except for an indirect way (cascading) which
  161. is discussed below. You can install an 8 bit card in a PC/AT computer and
  162. enable IRQ2. It is possible to run software which is specifically
  163. designed to work with that card (it expects to see interrupt 0A executed
  164. every time the card activates the IRQ2 line) and it should work (provided
  165. that there are no conflicts with other adaptor cards).
  166.  
  167. Many technical references state that the PC/AT computer uses the IRQ2
  168. line as a cascade for IRQ8 through IRQ15. That is true. It means that
  169. whenever any one of the IRQ8 through IRQ15 lines is activated, it
  170. triggers a slave PIC which then activates the IRQ2 line going into the
  171. master PIC. The master PIC then activates the interrupt pin of the
  172. processor. However, that IRQ2 line is not accessible by the adaptor
  173. interface, so it is not interfered with by using the IRQ2 line of an 8
  174. bit adaptor card. Furthermore, the cascading process is based on hardware
  175. protocol and it does not involve the use of interrupt 0A.
  176.  
  177. Many technical references state that the IRQ2 line or int 0A is reserved.
  178. That is not true. It may be that IBM wanted to reserve IRQ2 for its own
  179. use, but the only things that IBM ever commonly used it for are listed
  180. above. Currently, IBM has abandoned the AT architecture in favor of the
  181. PS/2. It may be that the technical references are referring to the IRQ2
  182. line which is used for cascade and which is not even accessible to the
  183. adapter cards of the PC/AT. But that is misleading because it leaves the
  184. reader with the untrue impression that it would be hazardous to enable
  185. the IRQ2 line on an 8 bit adaptor card which is plugged into a PC/AT.
  186.  
  187.  
  188. Printing without an IRQ line:
  189.  
  190. It is possible to operate a printer port without an IRQ line. By
  191. disabling the IRQ7 line of LPT1, or the IRQ5 line of LPT2, you can make
  192. that IRQ line available for other uses. The parallel printer port needs
  193. an IRQ line only if it is performing true bidirectional data transfer. If
  194. you disable the IRQ line of the parallel printer port, your programs can
  195. still send data to the printer and it will be printed. The parallel
  196. interface still has status lines which enables your programs to avoid
  197. overflowing the printers input buffer and detect basic errors such as
  198. "Out of Paper" and "Device not Ready".
  199.  
  200.  
  201. Sharing an IRQ line:
  202.  
  203. It is also possible for more than one device to share an IRQ line. For
  204. example, you could have a scanner and a modem both using the IRQ3 line.
  205. As long as you don't try to run the scanner program and the modem program
  206. at the same time, you may be able to make it work. The most likely
  207. problem that may arise here is a software incompatibility. For example,
  208. you may need to load a driver for the scanner in the CONFIG.SYS file, and
  209. that may conflict with the modem program even when you are not running
  210. the scanner program. It may be that you will have to change the
  211. configuration and reboot in order to switch between the scanner and the
  212. modem. You may find that you can run the scanner just fine, and then run
  213. the modem just fine, but you can't run the scanner after running the
  214. modem because the modem program does not restore the state of the
  215. interrupt vectors and the state of the PIC enable/disable masking bit for
  216. that IRQ line. Such an incompatibility can be overcome without rebooting,
  217. but it requires that the modem program be run from a batch file. The
  218. batch file would contain commands to run the modem program and then a
  219. custom program that restores the interrupt vectors and PIC mask to the
  220. proper values for compatibility with the scanner (this solution is most
  221. elegant once you get it working but it is not for novices).
  222.