home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Today - The Disc! 2 / CD-ROM_Today_-_The_Disc_2_June-July_1994.iso / mmtools / inthlp.doc < prev   
Text File  |  1993-04-14  |  7KB  |  171 lines

  1.  
  2.  
  3.               WHY DID ADDING MY MODEM
  4.               AT COM3 OR COM4
  5.                  HANG THE
  6.                   MODEM?
  7.  
  8.                 OR
  9.  
  10.                    WHY
  11.          EVEN IF YOU DON'T "SHARE INTERRUPTS"
  12.                    YOU
  13.               GET CONFLICTS
  14.                ON THE COM1-4 PORTS
  15.  
  16.              by Dr. W. Curtiss Priest
  17.       Center for Information, Technology and Society
  18.               Lexington, MA  02173
  19.         Internet: bmslib@mitvma.mit.edu
  20.               Voice: 617-862-7763
  21. _______________________________________________________________________
  22. ***********************************************************************
  23.  
  24. Most of us quickly have learned that while there are four COM
  25. ports, there are only (usually) 2 IRQ's.  [In AT's you can also
  26. use IRQ's 5,7, and 9, if your serial board supports those.]
  27.  
  28. First -- many uses of serial ports do not use interrupts and so you
  29. can in those cases just forget about them.  Example:  you print
  30. out a serial port using XON/XOFF hand-shaking using a redirection
  31. program like LPTCOM1.
  32.  
  33. Second -- if you use only one IRQ, there is still no potential conflict
  34. in terms of IRQ assignments.
  35.  
  36. Third -- if you want to use 2 IRQ's [3 and 4], you want one port to use
  37. one of those and the other to use the other one.  Typically IRQ 4
  38. is hardwired for use with COM1 and COM3, and IRQ 3 is hardwired for
  39. use with COM2 and COM4.
  40.  
  41. So -- a typical configuration is:  your serial card is set for COM1
  42. and COM2.  You use COM2 for your mouse (usually a DB 9 connector).
  43. The mouse always uses interrupt servicing, and so your mouse driver
  44. "hooks interrupt vector 3" and when an interrupt occurs the driver
  45. services the request.
  46.  
  47. But now you add an internal modem.  Most telecommunications programs
  48. like Procomm Plus use interrupt servicing of the modem.  So --
  49. you must use the other IRQ, IRQ 4.  So, you set the modem to COM3, since
  50. this usually sets the IRQ to 4 [newer boards allow mixing and matching
  51. of IRQ's but the problem is always the same -- don't let two ports use
  52. the same IRQ ! !
  53.  
  54. ______________________________________________________________________
  55.                ********************
  56.                   BUT
  57.  
  58. You find things still don't work.  Why?
  59.  
  60. The answer is in hardware, not in software.
  61.  
  62. When IBM designed the PC, they used an 8259 chip to service the
  63. interrupt request.  On the bus there are separate lines for each IRQ.
  64.  
  65. On the XT there are 8 interrupts.  On the AT there are 16 (actually
  66. 15, since IRQ 9 is redirected to IRQ2)
  67.  
  68. An informative shareware program called IRQR produces the following
  69. on my machine:
  70.  
  71. IRQR -- Report Status of 8259 Hardware Interrupt Channels
  72.     Copyright 1988 by Lawrence R. Steeger
  73.  
  74.     8259  IRQ  Status   IBM Assignments  OEM Assignments
  75.     ----  ---  ------   ---------------  ---------------
  76.     0x21    0    used   Timer
  77.         1    used   Keyboard
  78.         2    used   2nd 8259         Autofax Imager
  79.         3   >FREE   COM2
  80.         4   >FREE   COM1
  81.         5   >FREE   LPT2             MS Bus Mouse
  82.         6    used   Floppy Disk
  83.         7   >FREE   LPT1
  84.  
  85.     0xA1    8    used   Clock
  86.         9    used   Redirected IRQ2
  87.            10   >FREE   (reserved)
  88.            11   >FREE   (reserved)
  89.            12   >FREE   (reserved)
  90.            13    used   Coprocessor
  91.            14    used   Hard Disk
  92.            15   >FREE   (reserved)
  93.  
  94. If you go into Procomm and shell to DOS and do this again, and if your
  95. modem is on IRQ 4, you'll find the report changed to show IRQ 4
  96. now used.  When you leave Procomm, Procomm releases the interrupt and
  97. the report reverts back to showing FREE.
  98.  
  99. If you take a circuit diagram of a PC, you'll find each of the IRQ's
  100. to correspond to actual bus pins [yes, the ones you plug cards into].
  101.  
  102. For example, you'll find IRQ 4 on Pins B24 and A24 [the only slot in
  103. an XT and the slot nearest the back on an AT].  On an AT you'll find
  104. for example, IRQ 14 (Hard Disk) on Pin D7.  This is in the second
  105. slot from the back in the AT, and not present on the XT.
  106.  
  107.  
  108.                ********************
  109.                 THE ANSWER
  110.  
  111. The 8279 watches all the IRQ lines (8 in an XT and 16 in an AT).
  112. It recognizes an IRQ when the line goes from 0 volts to 5 volts.
  113. It is also "edge triggered" -- the line only needs to go high long
  114. enough for the 8279 to register the event on the rise of the square
  115. wave.
  116.  
  117. In hardware things often are held high and pulled low.  This is commonly
  118. done with a resistor to an output going to +5 volts and a transistor from
  119. the output connecting the anode to the output and the emitter to ground.
  120. A signal on the base causes the transistor to conduct, the output is
  121. then pulled low.  This is very common in TTL (Transistor-Transistor Logic).
  122. Boards sharing the same line will typically not "electrically" interfere
  123. since they the line is high across all of them using the pull-up resistor
  124. and so any one board can pull the line low, regardless of the presence of
  125. extra pull-up resistors (these resistors are typically ten thousand ohms
  126. and a transistor can pull dozens of these in parallel low).
  127.  
  128. But remember, IBM uses a chip that wants an output that goes low to high.
  129.  
  130. To achieve this the serial board designer uses a "totem pole driver."
  131. Here there are two transistors. One to pull the line up, the other to pull
  132. the line down.
  133.  
  134. Returning to software, you might think that if you don't ask the UART (the
  135. Universal Asynchronous Receiver/Transmitter) chip to enable the interrupt
  136. that the output on the IRQ line will be not present.  This would be
  137. achieved with a "tri-state" output.  Tri-state is either low, high, or not
  138. there.
  139.  
  140. But this just isn't so.  Even if you haven't enabled the interrupt in
  141. software, it still exists in the hardware.  So on that
  142. serial port, a transistor is still trying to pull that IRQ line low.
  143.  
  144. So, if another board tries to pull it high using its transistor to +5,
  145. there is a battle between the transistor on one board pulling the line
  146. low and the other trying to pull it high.
  147.  
  148. The result is confusion.  Sometimes it works because the IRQ you want is
  149. able to beat out the other port's transistor, and sometimes it doesn't
  150. because it just can't compete.
  151.  
  152.                ********************
  153.                THE SOLUTION
  154.  
  155. The solution is easy.  On boards that you are not going to use the
  156. offending IRQ line, you disconnect that line from the bus.
  157.  
  158. There are two ways:
  159.  
  160.      1.)  For boards that are hardwired, you take a narrow strip of
  161.      scotch tape and place it over the gold contact that slide into
  162.      the board.  To disable IRQ4 you wrap B24/A24 and to disable
  163.      IRQ3 you wrap B25/A25.
  164.  
  165.      2.)  For boards that have jumpers for IRQ assignments, just
  166.      take the jumper for the offending IRQ and remove it, or let
  167.      it dangle from one pin into mid air.
  168.  
  169. Is this unbelievable?  Absolutely ! !
  170.  
  171.