home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / program / pascal / pasdox / port.txt < prev    next >
Text File  |  1985-11-18  |  6KB  |  172 lines

  1. { -----------------------------------------------------------------------------
  2.  
  3.                                  NOTICE:
  4.  
  5.       THESE MATERIALS are UNSUPPORTED by OSS!  If you do not understand how to
  6.       use them do not contact OSS for help!  We will not teach you how to 
  7.       program in Pascal.  If you find an error in these materials, feel free
  8.       to SEND US A LETTER explaining the error, and how to fix it.
  9.  
  10.       THE BOTTOM LINE:
  11.  
  12.          Use it, enjoy it, but you are on your own when using these materials!
  13.  
  14.  
  15.                                DISCLAIMER:
  16.  
  17.       OSS makes no representations or warranties with respect to the contents
  18.       hereof and specifically disclaim all warranties of merchantability or
  19.       fitness for any particular purpose.   This document is subject to change
  20.       without notice.
  21.       
  22.       OSS provides these materials for use with Personal Pascal.  Use them in
  23.       any way you wish.
  24.  
  25.    -------------------------------------------------------------------------- }
  26.  
  27.  
  28.  
  29.  
  30.  
  31. Port Configuration                                                      Page 1
  32.  
  33.                           Configuring the I/O Ports
  34.  
  35. If  you  are  writing  a program which performs I/O to one of the devices that
  36. connect to the back of the ST (i.e., a printer or a modem), you will  probably
  37. want to set the configuration at some time or other.  If you are writing a GEM
  38. application  and you are content to use the desk accessories to allow the user
  39. to configure the  ports,  you  can  skip  this  section.   However,  the  desk
  40. accessories don't always set up the configuration properly, so be careful!  In
  41. any  case,  if  you  want  to  set  the configuration of the RS232 port or the
  42. parallel port, you need to know a few calls:
  43.  
  44. Set the printer configuration.
  45.  
  46. We'll investigate the printer  configuration  first,  since  there  are  fewer
  47. parameters  to  explain.  The following XBIOS call allows you to configure the
  48. printer:
  49.  
  50. FUNCTION setprt( config : integer ) : integer ;
  51.   XBIOS( 33 ) ;
  52.  
  53. In order to set or get the current printer configuration, you should use  this
  54. call.  If config is -1, the current configuration is passed back as the return
  55. value.   Otherwise, config specifies the desired configuration of the printer.
  56. The various bits within config specify the configuration as follows:
  57.  
  58. bit#  when 0            when 1
  59. ----  ----------------  -----------------
  60.   0   dot matrix        daisy wheel
  61.   1   color printer     monochrome
  62.   2   Atari printer     Epson compatible
  63.   3   draft mode        final mode
  64.   4   parallel port     RS232 port
  65.   5   continuous paper  single sheet
  66.   6               reserved
  67.   7               reserved
  68.   8               reserved
  69.   9               reserved
  70.  10               reserved
  71.  11               reserved
  72.  12               reserved
  73.  13               reserved
  74.  14               reserved
  75.  15   MUST BE ZERO!
  76.  
  77.  
  78. Configure the RS232 port.
  79.  
  80. OK, on to the RS232 configuration.  The following XBIOS call sets the  various
  81. parameters controlling the RS232 port:
  82.  
  83. PROCDURE rsconf( speed, flowctl, ucr, rsr, tsr, scr : integer ) ;
  84.   XBIOS( 15 ) ;
  85.  
  86. If  any  of  the  parameters  is -1, the corresponding RS232 parameter is left
  87. unchanged from its previous value.  You will mostly be  dealing  with  setting
  88. the baud rate, which is governed by the speed parameter:
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97. Port Configuration                                                      Page 2
  98.  
  99. speed   rate
  100. -----  -----
  101.   0    19200
  102.   1     9600
  103.   2     4800
  104.   3     3600
  105.   4     2400
  106.   5     2000
  107.   6     1800
  108.   7     1200
  109.   8      600
  110.   9      300
  111.  10      200
  112.  11      150
  113.  12      134
  114.  13      110
  115.  14       75
  116.  15       50-
  117.  
  118. The last value, 15, may not generate an accurate (as if you'll ever need it!).
  119. You  may also need to change the flow-control option of the RS232 port.  It is
  120. specified in the flow parameter as follows:
  121.  
  122. flow  flow-control
  123. ----  ------------
  124.  0    No flow control
  125.  1    XON/XOFF (control-S/control-Q)
  126.  2    RTS/CTS
  127.  3    XON/XOFF and RTS/CTS
  128.  
  129. The value 3 doesn't represent a very useful condition,  but  it  should  work.
  130. The  other  four  parameters  set  registers within the 68901 chip (for a more
  131. complete, but still sketchy, discussion, see the book  ST  Internals).   These
  132. registers perform the following functions:
  133.  
  134. register  function
  135. --------  --------
  136.   ucr     USART control register
  137.   rsr     Receiver status register
  138.   tsr     Transmitter status register
  139.   scr     Synchronous character register
  140.  
  141. If  you  are  transmitting in asynchronous mode (i.e, almost always), you will
  142. probably only use the ucr parameter, which has the following meanings:
  143.  
  144. ucr bits   function
  145. --------   --------
  146.    0       unused
  147.    1       parity type: 0=odd 1=even
  148.    2       parity enable: 0=no parity 1=parity
  149.   4,3      0,0 -> synchronous mode (all others asynch)
  150.            0,1 -> 1 start bit, 1 stop bit
  151.            1,1 -> 1 start bit, 2 stop bits
  152.   6,5      number of data bits
  153.            0,0 -> 8 bits
  154.            0,1 -> 7
  155.            1,0 -> 6
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163. Port Configuration                                                      Page 3
  164.  
  165.            1,1 -> 5
  166.    7       transmit and receive frequency
  167.             0 -> divide by 1 (synchronous only)
  168.             1 -> divide by 16
  169.  
  170. If you want to use the rsr, tsr, or scr registers, please refer elsewhere  for
  171. more documentation on the 68901 chip (ST Internals, for example).
  172. ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆