home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / etc / misc / mod82c11.txt < prev    next >
Encoding:
Text File  |  2003-06-11  |  11.7 KB  |  245 lines

  1.             UM82C11-C Bidirectional Printer Port Modification
  2.             =================================================
  3.  
  4. This is a bidirectional modification for computers using the 82C11 for their
  5. parallel ports.  Please note that we give no guarantee that it will work or
  6. that everything is correct!  Proceed at your own risk!  (There is only one
  7. mistake as far as we know, but everybdy knows how easy it is to make a typo.)
  8.  
  9. NOTE: An asterix (*) in front of a control signal indicates a negative true
  10. signal (low = 1).  eg. CS=true when high, *CS=true when low.
  11.  
  12. The UM82C11-C is almost a one chip IBM pc printer interface.  It includes
  13. all the the registers and buffers for a printer port and needs only some
  14. address decoding and a LS245 buffer to hook a PC to a printer (plus some wire
  15. of course).  It comes in two packages - a 40 pin dual in line (DIP) package,
  16. and a 44 lead flat pak.  The pin numbers referred to below are for the DIP
  17. package.  There is a pinout for both packages at the end of this article.
  18.  
  19. Pin 19 on this chip is the Printer Data Output Enable (*POE).  The printer
  20. data buffers drive the printer data bus when this pin is grounded.  On my 
  21. machine, and probably many others, this pin is simply connected to pin 20 
  22. (Ground) next to it to permanently enable the printer data bus.  This pin
  23. needs to be controlled by the D5 output of the printer control word to make 
  24. the port bidirectional.  Unfortunately the printer control word is internal 
  25. to this chip and we can't simply add a couple of jumpers (as suggested in 
  26. Steve Ciarcia's article in Byte-Sept/88, pp 304-305,310)
  27.  
  28. On examining the truth table and some timing diagrams in the spec sheets we
  29. find that when *CS and DIR are low and A1 is high we can use the rising edge 
  30. of *IOW to latch the printer control word.  After detailed analysis and 
  31. consideration of our junkbox the following design presented itself.  We used
  32. a 74LS10 triple 3 input NAND gate as a decoder and a 74LS379 Quad D flip-flop
  33. with Clock enable to latch the data.
  34.  
  35.                             Schematic Diagram
  36.                             =================
  37.                         74LS10                       74LS379
  38.  
  39.                  ------\
  40.   (8)DIR --------|1     \                           D5(14)   /-------tie
  41.                /-|2    12>0---\                      |       |  |  |
  42. (40)+5v--\/\/\-+-|13    /     |                ------------------------
  43.           4k7  | ------/      |                |     4 (D0)  5  12 13 |
  44.                | ------\      |    (6) *IOW ---|9 (CP)      (D1,D2,D3)|
  45.        tie ----+-|3     \     |                |                      |
  46.                \-|4     6>0-\ |             /--|1(*CE)                |
  47.  (18)*CS --------|5     /   | | ------\     |  |     2 (Q0)           |
  48.                  ------/    | \-|11    \    |  ------------------------
  49.                             \---|9     8>0--/        |
  50.  (39) A1 -----------------------|10    /           *POE (19)
  51.                                 ------/
  52.  (40) +5 --(LS10-14, LS379-16)    A 0.01uf decoupling capacitor was added
  53.  (20)GND --(LS10--7, LS370--8)      between +5 and GND.
  54.      (The numbers in paranthesis are the pin numbers on the 82C11.)
  55.  
  56.                           Wiring Diagram
  57.                           ==============
  58.  
  59.        40              39              40                           6
  60.        +5              A1              +5                          *IOW
  61.         |       /---\   |   /-\ /---\   |                           |
  62.         |  tie  |   |   |   | | |   |   |          tie tie          |
  63.       ------------------------|---  | --------------------------------
  64.       |14  13  12  11  10   9 | 8|  | |16  15  14  13  12  11  10   9|
  65.       |+5                     |  |  | |                              |
  66.       |                       |  |  | |                              |
  67.       |1    2   3   4   5   6 | 7|  | | 1   2   3   4   5   6   7   8|
  68.       ------------------------|---  | --------------------------------
  69.        |   tie tie tie  |   | | |   |   |   |       |  tie          |
  70.        |                |   \-/ |   \---/   |       |               |
  71.       DIR              *CS     GND         *POE     D5             GND
  72.        18               18      20          19      14              20
  73.  
  74.  (40) +5 --/\/\/--tie  (All pins marked tie are pulled up to +5v through
  75.             4k7                    this resister. (4.7k ohms))
  76.  
  77.  (40) +5 ---||---GND(20) (This capacitor is connected across the supply
  78.             10n                  for decoupling. (.01 uf))
  79.  
  80.  
  81. I built this circuit on a small piece of perf board and hot melt glued it on
  82. top of the 82C11.  The wires were kept as short as possible and tack soldered
  83. to the pins of the 82C11.  The circuit board trace connecting pin 19 to GND
  84. (pin 20) was cut.  The printer seems to work fine and the CHECKDDT program
  85. reports that my printer port is now bidirectional.  I have yet to finish
  86. constructing the DDT51 to see if it really is working as it needs to, but I
  87. don't see any reason why it shouldn't be.
  88.  
  89. The next challenge is to see if this can be reduced to one IC.  A PAL or 
  90. something similar should be easy to program for this.
  91.  
  92.  
  93.           -------------------------------------------------------
  94.  
  95.                     Alternate Schematic Diagram (untried)
  96.                     =====================================
  97.  
  98.   This should do the same thing, and the parts might be more common.
  99.  
  100.                                             ----------
  101.  (14) D5 -----------------------------------|2      5|---------*POE (19)
  102.                                             |        |
  103.                  ------\   -------------    | 74LS74 |
  104.   (8)DIR -------O|4     \  |         15|O---|3       |
  105.  (18)*CS -------O|5      >O|           |    |  1  4  |
  106.  (39) A1 --------|6     /  | 74LS138   |    ----------
  107.                  ------/   |           |       |  |
  108.   (6)*IOW -----------------|1          |       \--+--/\/\/\---+5v
  109.                        /---|2          |              4k7
  110.                 GND ---+---|3          |
  111.                            -------------
  112.  
  113.  (40) +5 --(LS14-14, LS138-16)
  114.  (20)GND --(LS14--7, LS138--8)
  115.      (The numbers in paranthesis are the pin numbers on the 82C11.)
  116.  
  117.  
  118.  
  119.           -------------------------------------------------------
  120.  
  121.                             Data on the 82C11
  122.                             =================
  123.  
  124.                  UM82C11-C pinout
  125.                  ================
  126.  
  127.      This is the 40 pin Dual in Line package.
  128.  
  129.                     ___________
  130. Crystal in       x1 | 1     40|  Vdd   Power Supply +5v
  131. Crystal in       x2 | 2     39|  A1    System Address 1
  132. Clock out       CLK | 3     38|  A0    System Address 0
  133. Clock / 10     DCLK | 4  U  37|  P0    Printer Data Bus 0
  134. Reset           RST | 5  M  36|  P1    |
  135. I/O Write      *IOW | 6  8  35|  P2    |-Data to Printer
  136. I/O Read       *IOR | 7  2  34|  P3    |
  137. Direction       DIR | 8  C  33|  P4    |
  138. System Data Bus  D0 | 9  1  32|  P5    |
  139.               |  D1 |10  1  31|  P6    |
  140.               |  D2 |11  -  30|  P7    Printer Data Bus 7
  141.               |  D3 |12  C  29|  *ERROR  Error input from printer
  142.               |  D4 |13     28|  SLCT    Select input from printer
  143.               |  D5 |14     27|  PE      Paper end input from printer
  144.               |  D6 |15     26|  *ACK    Acknowledge input from printer
  145. System Data Bus  D7 |16     25|  BUSY    Busy input from Printer
  146. Interrupt       IRQ |17     24|  *STROB  Strobe output to Printer
  147. Chip Select     *CS |18     23|  *AUTOFD Printer feeds one line after printng
  148. Data output En *POE |19     22|  *INIT   Initialize printer
  149. Ground (0v)     Vss |20     21|  *SLCT   Select Printer
  150.                     -----------
  151.  
  152.    There is also a flat pack 48 pin version of this IC.  Pin 1 on the flat
  153.    pack is *IOW and the pins follow the same sequence around the package with
  154.    four not connected pins (pins 40-43) between VDD and X1.
  155.  
  156.                   P0           *SLCT
  157.                   36            25
  158.                  ------------------
  159.           A0   37|                |24 PE
  160.                  |                |
  161.    (4 NC lines   |                |
  162.     pins 40-43)  |                |
  163.                  |                |
  164.         RST    48|                |13 D7
  165.                  ----------------/
  166.                   1               12
  167.                   *IOW            D6
  168.  
  169.  
  170. The data sheets give the following truth table for the operation of this chip:
  171.  
  172.             Input            Output Operation:
  173.   *CS   A1  A0  *IOR   *IOW    DIR
  174.     1    x   x    x      x      0    Inactive    (x=don't care)
  175. 1)  0    0   0    1      0      0    Write Data to Printer
  176. 2)  0    0   0    0      1      1    Read data on printer Bus
  177. 3)  0    0   1    0      1      1    Read Status from Printer
  178. 4)  0    1   0    1      0      0    Write Control word to the printer
  179. 5)  0    1   0    0      1      1    Read control word on Printer control bus
  180.     0    1   1    0      x      x    *****Illegal operation*****
  181.     0    ---Others---------------    No Action
  182.  
  183. The 82C11 supports 5 commands: (Addresses are for LPT1).
  184.  
  185. 1)  Write data to printer (Out &H378,data)  The data written to the 82C11 is
  186. latched into the output register.  *POE enables or disables the data from
  187. being driven onto the printer data bus (GND=Enabled).
  188.  
  189. 2)  Read data from the printer bus (data = in &h378).  The data on the printer
  190. data bus is read back to the computer.  If *POE is enabled(GND) this will
  191. reflect the output data.  If *POE is disabled (+5) it will reflect whatever is
  192. on the other end of the printer data bus.
  193.  
  194. 3)  Read Status from the Printer (data = in &h379).  The data reflects the
  195. status of the printer status lines.
  196.  
  197.         D7 = Inverted version of BUSY signal - When this goes high the
  198.                         printer is ready to accept data.
  199.         D6 = *ACK  - The printer pulls ACKnowledge low to indicate it has
  200.                         received the data and is ready for more.
  201.         D5 = PE    - Paper End - A high indicate the printer is out of paper.
  202.         D4 = SLCT  - SeLeCT -This signal is high when the printer is on-line.
  203.         D3 = *ERROR  - This pin indicates the printer has a problem.
  204.         D2 = Not used
  205.         D1 = Not used
  206.         D0 = Not used
  207.  
  208. 4)  Write Control word to the printer (out &h37a,data).  Send control signals
  209. to the printer.
  210.  
  211.         D7 = Not used
  212.         D6 = Not used
  213.         D5 = Not used     ***(we use this to enable/disable bidirectional)***
  214.         D4 = IRQEN - When this pin is high the 82C11 sends an Interrupt
  215.                         request to PC when *ACK is asserted by the printer.
  216.         D3 = SLCT      - ??
  217.         D2 = INIT      - INITiate printer (reset printer)
  218.         D1 = *AUTOFD   - When low the printer automatically feeds one line
  219.                                 after printing.
  220.         D0 = STROB     - This pin is set to a 1 to tell the printer to read 
  221.                                 the data on the printer data bus.
  222.  
  223.         Pins D3, D2 and D0 are inverted between the control word and the 
  224.         output pins that connect to the printer. (eg. A 1 on D0 will be 
  225.         actually sent to the printer as a low on the *STROB pin)
  226.  
  227. 5)  Read Control word from the printer (data=in &h37a).  Read what control
  228. signals have been sent to the printer.  Data bits are the same as above.
  229. Note that this will not read what has been stored on D5.
  230.  
  231.        ----------------------------------------------------------
  232.  
  233. February 27, 1991
  234.  
  235. I welcome any constructive criticism.  I know that I do not know everything
  236. there is to know about the parallel port and I may have made some mistakes.
  237. Please let me know so I can fix them.
  238.  
  239. Thank you.
  240.  
  241. David Meed           (506) 375-4029
  242. c/o NBBI
  243. Victoria, NB
  244. E0J 2A0
  245.