home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / DevCon / Washington_1988 / Devcon_Extras / Tech_Articles / Laser_Printers < prev   
Encoding:
Text File  |  1992-08-27  |  7.3 KB  |  230 lines

  1. "Fighting with Lasers"
  2. by Bryce Nesbitt
  3.  
  4. * Copyright 1988 Commodore-Amiga, Inc.
  5. *  
  6. * Executables based on this information may be used in software
  7. * for Commodore Amiga computers.  All other rights reserved.
  8. * This information is provided "as is"; no warranties are made.  All 
  9. * use is at your own risk. No liability or responsibility is assumed.
  10.  
  11.  
  12. This article goes over some of the common problems you may
  13. encounter when hooking an Amiga computer up to a PostScript(R)
  14. compatible laser printer.  As a bonus I'll show you how to
  15. significantly speed up printer communication.  The article is
  16. based on laser printers made by Apple, NEC and A.S.T., but the
  17. instructions apply to most PostScript printers.
  18.  
  19. We recommend the use of a serial (RS-232 compatible) interface
  20. for use with PostScript. PostScript is bi-directional; the
  21. printer can send error messages and other information back to the
  22. host.  While the Amiga's parallel port is also bi-directional,
  23. the parallel port on a typical laser printer will not be.  With
  24. the use of the techniques presented in this article, the serial
  25. interface can be set to speeds matching those of the parallel
  26. interface.
  27.  
  28. The required cable is quite simple.  Wire the two serial
  29. interface connectors as follows:
  30.  
  31.  
  32.     computer    printer
  33.        2          3
  34.        3          2
  35.        7          7
  36.  
  37. The preferences serial port parameters should be set to 8 data
  38. bits, 1 stop bit, Xon/Xoff handshake, no parity and either 1200
  39. or 9600 baud (depending on the setup of your printer).  On most
  40. printers the 1200 baud setting is non-adjustable, while the 9600
  41. baud setting is fully programmable.  Set the printer and Amiga to
  42. 1200 baud if you are having communication difficulties.
  43.  
  44. One very common problem is the inability to print complex
  45. documents to the printer.  When a simple document is printed, it
  46. works fine.  When a complex document is printed, the printer
  47. produces no output.  Chances are this is due to a handshaking
  48. problem and can be corrected by matching handshake between the
  49. Amiga and the printer.
  50.  
  51.  
  52. Talking to the printer
  53.  
  54. Once you have the cable ready, it is time to check the
  55. handshaking.  Using a text editor such as "ed" or "notepad",
  56. prepare the following PostScript program:
  57.  
  58.  
  59. /Helvetica findfont 20 scalefont setfont
  60.  
  61. 40 200 moveto
  62.  
  63. statusdict begin
  64. 25 sccbatch
  65. (The Options number is ) show
  66. 10 string cvs show
  67. (.  The baud rate is ) show
  68. 10 string cvs show
  69. (.) show
  70. end
  71. showpage
  72.  
  73.  
  74. From the CLI, copy the resulting text file to the serial port
  75. with a command such as "copy textfile ser:".  The printer should
  76. print a sheet of paper.  If nothing seems to happen after 30
  77. seconds, cycle the power to the printer, wait, and try again.
  78. The output should look like this:
  79.  
  80.  
  81. The Options number is 0.  The baud rate is 9600.
  82.  
  83.  
  84. If your Options number is in the range of 0-3, you probably are
  85. ok.  If it is in the range of 4-7, you definitely have a problem,
  86. and must make a change for reliable operation with the Amiga.
  87. The Options can be interpreted as follows:
  88.  
  89.             0 or 4    Ignore parity
  90.             1 or 5    Check for Odd parity
  91.             2 or 6    Check for Even parity
  92.             3 or 7    No parity
  93.  
  94. Codes 0-3 specify Xon/Xoff handshake.  Codes from 4-7 indicate
  95. "DTR" handshake (DTR goes low when the printer's buffer is full).
  96. For use with the Amiga, you should specify mode = 0.  Higher
  97. numbers may be used by some printers, but 0 should be the correct
  98. setting for the Amiga.
  99.  
  100.  
  101. Setting the numbers
  102.  
  103. Some printers have switches or front panel controls for the
  104. options and baud rate, in this case consult the manual for the
  105. printer.  Other printers require a PostScript program
  106. like the one given below.  Replace BAUD and OPTIONS with the
  107. numbers you wish to set.
  108.  
  109.  
  110. serverdict begin 0000 exitserver
  111. statusdict begin
  112. 25 BAUD OPTIONS setsccbatch
  113. end
  114.  
  115.  
  116. WARNING:  The EEPROM device that stores baud and options settings
  117. will wear out after about 10,000 settings.  Do NOT change the
  118. settings more often than necessary!  The settings made by this
  119. program are permanent, even if power to the printer is turned
  120. off.
  121.  
  122. After sending the program, either send a CTRL-D to the printer,
  123. or wait 30 seconds for the changes to take effect.
  124.  
  125.  
  126.  
  127. Approaching the speed of light
  128.  
  129. The 9600 baud default of most laser printers is not very fast.
  130. Printers with PostScript 38.0 and above can be set to higher baud
  131. rates.    See your printer manual for the exact list of baud rates
  132. supported.  Typical legal values are: 1200, 9600, 10473, 11520,
  133. 12800, 14400, 16457, 19200, 23040, 38400 and 56700.
  134.  
  135. 19,200 baud is the recommended speed for use with the Amiga.
  136. This speed can be set with the same PostScript program that sets
  137. the Options number.
  138.  
  139.  
  140. Going interactive
  141.  
  142. Copying files to SER: is a limited and primitive way of talking
  143. to the printer.  If you wish to experiment with PostScript, it is
  144. much better to use PostScript's interactive mode.  Any terminal
  145. emulator or modem program should work for this application.  Set
  146. the baud rate, parity and stop bit settings to match those of the
  147. printer, then follow the instructions:
  148.  
  149. Type one CTRL-D to the printer (hold "CTRL" and press "D").  This
  150. will end any current job the printer is working on.  If the
  151. printer is an Apple LaserWriter, the flashing activity light
  152. should stop.
  153.  
  154. Next type the word "executive" followed by a return.  If all
  155. works well you will be in PostScript's interactive mode, and
  156. should see an appropriate copyright message.  To read out the
  157. current settings, type the following (What you type is rendered
  158. in boldface, what postscript types back is in courier):
  159.  
  160. ^D
  161. executive
  162. PostScript(r) Version 47.0
  163. Copyright (c) 1984, '85, '86, '87 Adobe Systems Inc.
  164. Copyright (c) 1981 Linotype     All Rights Reserved.
  165. PS>
  166. PS>statusdict begin
  167. PS>
  168. PS>25 sccbatch
  169. PS>=
  170. 0                    ;<- mode byte
  171. PS>=
  172. 9600                    ;<- baud rate
  173. PS>
  174. PS>end
  175. PS>quit
  176. ^D
  177.  
  178. This sequence prints out the Options and baud rate just like the
  179. previous program.
  180.  
  181. Description of the code:  The "statusdict begin" informs
  182. Postscript you wish to access functions from the special status
  183. dictionary.  The "25 sccbatch" line first pushes the number 25 on
  184. the stack, then executes "sccbatch" (25 is a parameter to
  185. sccbatch, indicating you want information about the 25 pin RS-232
  186. port). sccbatch will leave two numbers on the stack.  The topmost
  187. will be the serial mode byte, the next will be the baud rate.
  188. The "=" command reads the top number from the stack and prints it
  189. to your terminal.  In this case, the printer was configured for
  190. mode 0 and a baud rate of 9600.
  191.  
  192.  
  193. You can multitask "your favorite editor" with the terminal
  194. program.  Prepare the PostScript file in the editor. To test,
  195. send the file to the printer with the "send ASCII" option of the
  196. terminal program.
  197.  
  198. Typing CTRL-T at any time will produce a status report from the
  199. printer.  CTRL-C will abort any currently executing job.
  200.  
  201.  
  202.  
  203. Fun With Postscript
  204.  
  205. No article about PostScript is complete without a gratuitous
  206. typesetting example. Here's mine:
  207.  
  208.  
  209. /showit %stack: (string)
  210. {0 0 moveto show} def
  211. /oshowit %stack: (string)
  212. {true charpath stroke} def
  213.  
  214. /Helvetica findfont 100 scalefont setfont
  215. 150 150 translate
  216.  
  217. .90 -.10 0 {setgray (Amiga) showit 10 rotate} for
  218.  
  219. 1 setgray (Amiga) showit
  220. 0 setgray 0 0 moveto (Amiga!) oshowit
  221.  
  222.  
  223. References
  224.  
  225. Adobe Systems, Inc.  PostScript Language Reference Manual.
  226. Addison-Wesley, Reading, Mass., 1985.
  227. Adobe Systems, Inc.  PostScript Language Tutorial and Cookbook.
  228. Addison-Wesley, Reading, Mass., 1985.
  229. PostScript is a registered trademark of Adobe Systems, Inc.
  230.