home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / dos / prg / bas / pcl4b42 / pcl4bref.doc < prev    next >
Text File  |  1994-10-19  |  67KB  |  1,633 lines

  1.  
  2.  
  3.                                Personal Communications Library
  4.  
  5.                                         For BASIC
  6.  
  7.  
  8.                                           (PCL4B)
  9.  
  10.  
  11.  
  12.                                      REFERENCE MANUAL
  13.  
  14.  
  15.  
  16.  
  17.  
  18.                                         Version 4.2
  19.  
  20.                                         Sept 1, 1994
  21.  
  22.  
  23.  
  24.  
  25.                              This software is provided as-is.
  26.                       There are no warranties, expressed or implied.
  27.  
  28.  
  29.  
  30.  
  31.                                    Copyright (C) 1994
  32.                                    All rights reserved
  33.  
  34.  
  35.  
  36.                                    MarshallSoft Computing, Inc.
  37.                                    Post Office Box 4543
  38.                                    Huntsville AL 35815
  39.  
  40.                                    Voice 205-881-4630
  41.                                    FAX   205|881|4630
  42.                                    BBS   205-880-9748
  43.  
  44.  
  45.                                           _______
  46.                                      ____|__     |                (R)
  47.                                   --+       |    +-------------------
  48.                                     |   ____|__  |  Association of
  49.                                     |  |       |_|  Shareware
  50.                                     |__|   o   |    Professionals
  51.                                   --+--+   |   +---------------------
  52.                                        |___|___|    MEMBER
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.                PCL4B   Reference   Manual                                      Page 1
  69.                                     C O N T E N T S
  70.  
  71.  
  72.  
  73.                 Chapter                                     Page
  74.  
  75.                 Table of Contents.............................2
  76.                 Introduction..................................3
  77.                    SioBaud....................................4
  78.                    SioBrkKey..................................4
  79.                    SioBrkSig..................................5
  80.                    SioCrtWrite................................5
  81.                    SioCTS.....................................6
  82.                    SioDCD.....................................6
  83.                    SioDelay...................................7
  84.                    SioDone....................................7
  85.                    SioDSR.....................................8
  86.                    SioDTR.....................................8
  87.                    SioError...................................9
  88.                    SioFIFO....................................9
  89.                    SioFlow...................................10
  90.                    SioGetc...................................10
  91.                    SioGetDiv.................................11
  92.                    SioKeyPress...............................11
  93.                    SioKeyRead................................12
  94.                    SioInfo...................................12
  95.                    SioIRQ....................................13
  96.                    SioLine...................................13
  97.                    SioLoopBack...............................14
  98.                    SioModem..................................14
  99.                    SioParms..................................15
  100.                    SioPorts..................................15
  101.                    SioPutc...................................16
  102.                    SioRead...................................16
  103.                    SioReset..................................17
  104.                    SioRI.....................................17
  105.                    SioRTS....................................18
  106.                    SioRxBuf..................................18
  107.                    SioRxFlush................................19
  108.                    SioRxQue..................................19
  109.                    SioTimer..................................20
  110.                    SioTxBuf..................................20
  111.                    SioTxFlush................................21
  112.                    SioTxQue..................................21
  113.                    SioUART...................................22
  114.                    SioUnGetc.................................22
  115.                 Function Summary.............................23
  116.                 Error Code Summary...........................24
  117.                 Code Examples................................24
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.                PCL4B   Reference   Manual                                      Page 2
  137.                                   Introduction
  138.  
  139.  
  140.  
  141.               This  manual  lists  all of the PCL4B functions in alphabetical order. Every
  142.               library function will return a value as follows:
  143.  
  144.               1.  Negative values for error conditions. See last page of this  manual  for
  145.               a list of error values and their meanings.
  146.  
  147.               2.  Non-negative values when returning data (eg: SioLine).
  148.  
  149.               3.  Zero otherwise.
  150.  
  151.               When  debugging  an  application,  be  sure  to  test all return values. Use
  152.               SioError to print the associated text for errors.
  153.  
  154.  
  155.               Example Code Segment
  156.  
  157.  
  158.               The  following code is the complete MINIMAL.BAS program. It talks on COM1 at
  159.               2400 baud. The code is as follows:
  160.  
  161.  
  162.               +--------------------------------------------------------+
  163.               |                                                        |
  164.               |  '                                                     |
  165.               |  '  MINIMAL.BAS:  Talk on COM1 @ 2400 baud             |
  166.               |  '                                                     |
  167.               |  '$INCLUDE: 'PCL4B.INC'                                |
  168.               |  'Reset port                                           |
  169.               |  S$ = STRING$(256,0)                                   |
  170.               |  BufSeg = SSEG(S$) + (SADD(S$)\16) + 1                 |
  171.               |  CODE = SioRxBuf(COM1, BufSeg, Size256)                |
  172.               |  CODE = SioReset(COM1, Baud2400)                       |
  173.               |  DO                                                    |
  174.               |    'Anything incoming ?                                |
  175.               |    CODE = SioGetc(COM1, 1)                             |
  176.               |    IF CODE > -1 THEN CODE = SioCrtWrite(CODE)          |
  177.               |    'Anything to send ?                                 |
  178.               |    IF SioKeyPress() <> 0 THEN                          |
  179.               |      ANYKEY = SioKeyRead()                             |
  180.               |      'Exit if user types Escape (ESC=27)               |
  181.               |      IF ANYKEY = 27 THEN EXIT DO                       |
  182.               |      CODE = SioPutc(COM1,ANYKEY)                       |
  183.               |    END IF                                              |
  184.               |  LOOP                                                  |
  185.               |  CODE = SioDone(COM1)                                  |
  186.               |  END                                                   |
  187.               |                                                        |
  188.               +--------------------------------------------------------+
  189.  
  190.  
  191.               For  more  examples, examine each of the example programs provided (SIMPLE.BAS
  192.               and TERM.BAS). Also look  at  the  examples  associated  with  each  library
  193.               function described in the following section.
  194.  
  195.               Also  note that there are two versions of the library for each memory model.
  196.               One version is with  transmitter  interrupts  disabled  and  one  with  them
  197.               enabled.
  198.  
  199.               Refer to the User's Manual (PCL4B.USR) for addition information.
  200.  
  201.  
  202.  
  203.  
  204.                PCL4B   Reference   Manual                                      Page 3
  205.               +-------------+------------------------------------------------------------+
  206.               |   SioBaud   |  Sets the baud rate of the selected port.                  |
  207.               +-------------+------------------------------------------------------------+
  208.  
  209.  
  210.                 Syntax    FUNCTION SioBaud(Port,BaudCode)
  211.                           REM Port:      Port selected (COM1 - COM16)
  212.                           REM BaudCode:  Baud code
  213.  
  214.                Remarks    The  SioBaud  function sets the baud rate without resetting  the
  215.                           port. It is used to change the baud rate after calling SioReset.
  216.  
  217.                            Code   Rate    Name             Code   Rate   Name
  218.                              0     300    Baud300            5    9600   Baud9600
  219.                              1     600    Baud600            6   19200   Baud19200
  220.                              2    1200    Baud1200           7   38400   Baud38400
  221.                              3    2400    Baud2400           8   57600   Baud57600
  222.                              4    4800    Baud4800           9  115200   Baud115200
  223.  
  224.  
  225.                Returns     -4 : No such port. Expect 0 to MaxPort.
  226.                           -11 : Bad baud rate code. See above code values.
  227.  
  228.               See Also    SioReset
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.               +-------------+------------+-------------------+---------------------------+
  238.               |  SioBrkKey  |  Return non|zero if the Control|Break key was pressed.     |
  239.               +-------------+------------+-------------------+---------------------------+
  240.  
  241.  
  242.                 Syntax    FUNCTION SioBrkKey()
  243.  
  244.                Remarks     The  SioBrkKey  function returns a TRUE value (non-zero) if the
  245.                           Control-BREAK key was pressed,  else  it  returns  a  zero.  Use
  246.                           SioBrkKey  as  a safety exit from a polling loop. Don't mix this
  247.                           function up with SioBrkSig.
  248.  
  249.                Returns    -1 : Control-BREAK was pressed.
  250.                            0 : Control-BREAK was NOT pressed.
  251.  
  252.               See Also    SioBrkSig
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.                PCL4B   Reference   Manual                                      Page 4
  273.               +-------------+------------------------------------------------------------+
  274.               |  SioBrkSig  |  Asserts, cancels, or detects BREAK signal.                |
  275.               +-------------+------------------------------------------------------------+
  276.  
  277.  
  278.                 Syntax    FUNCTION SioBrkSig(Port,Cmd)
  279.                           REM Port:      Port selected (COM1 thru COM16)
  280.                           REM char Cmd:  ASSERT, CANCEL, or DETECT
  281.  
  282.                Remarks    The SioBrkSig function controls the BREAK bit in the line status
  283.                           register. The legal commands are:
  284.  
  285.                           ASSERT_BREAK ('A') to assert BREAK
  286.                           CANCEL_BREAK ('C') to cancel BREAK
  287.                           DETECT_BREAK ('D') to detect BREAK
  288.  
  289.                           ASSERT_BREAK, CANCEL_BREAK,  and  DETECT_BREAK  are  defined  in
  290.                           PCL4B.BI. See TERM.BAS for an example of the use of SioBrkSig.
  291.  
  292.                Returns    -2 : Port not enabled. Call SioReset first.
  293.                           -4 : No such port. Expect 0 to MaxPort.
  294.                           -6 : Illegal command. Expected 'A', 'C', or 'D'.
  295.                           >0 : BREAK signal detected (DETECT command only)
  296.  
  297.               See Also    SioBrkKey
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.               +-------------+------------------------------------------------------------+
  306.               | SioCrtWrite |  Write character to the screen.                            |
  307.               +-------------+------------------------------------------------------------+
  308.  
  309.                 Syntax    FUNCTION SioCrtWrite(Ch)
  310.                           REM char Ch: Character to write
  311.  
  312.                Remarks    The SioCrtWrite  function  uses  the  BIOS  to  write  a  single
  313.                           character to the screen at the current cursor location.
  314.  
  315.                Returns    zero.
  316.  
  317.               See Also    SioKeyPress and SioKeyRead.
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.                PCL4B   Reference   Manual                                      Page 5
  341.               +-------------+------------------------------------------------------------+
  342.               |   SioCTS    |  Reads the Clear to Send (CTS) modem status bit.           |
  343.               +-------------+------------------------------------------------------------+
  344.  
  345.                 Syntax    FUNCTION SioCTS(Port)
  346.                           REM Port: Port selected (COM1 thru COM16)
  347.  
  348.                Remarks    The SioCTS function is used to read  the  Clear  to  Send  (CTS)
  349.                           modem status bit.
  350.  
  351.                           The  CTS  line  is  used  by  some  error  correcting  modems to
  352.                           implement hardware flow control.  CTS is dropped by the modem to
  353.                           signal the computer not to send data  and is  raised  to  signal
  354.                           the computer to continue.
  355.  
  356.                           Refer to the User's Manual for a discussion of flow control.
  357.  
  358.                Returns    -2 : Port not enabled. Call SioReset first.
  359.                           -4 : No such port.  Expect 0 to MaxPort.
  360.                            0 : CTS is clear.
  361.                           >0 : CTS is set.
  362.  
  363.               See Also    SioFlow, SioDSR, SioRI, SioDCD, and SioModem.
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.               +-------------+------------------------------------------------------------+
  374.               |   SioDCD    |  Reads the Data Carrier Detect (DCD) modem staus bit.      |
  375.               +-------------+------------------------------------------------------------+
  376.  
  377.  
  378.                 Syntax    FUNCTION SioDCD(Port)
  379.                           REM Port: Port selected (COM1 thru COM16)
  380.  
  381.                Remarks    The  SioDCD  function is  used to read the Data Carrier Detect
  382.                           (DCD) modem status bit. Also see SioModem.
  383.  
  384.                Returns    -2 : Port not enabled. Call SioReset first.
  385.                           -4 : No such port.  Expect 0 to MaxPort.
  386.                            0 : DCD is clear.
  387.                           >0 : DCD is set.
  388.  
  389.               See Also    SioDSR, SioCTS, SioRI, and SioModem.
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.                PCL4B   Reference   Manual                                      Page 6
  409.               +-------------+------------------------------------------------------------+
  410.               |   SioDelay  |  Delays one or more timer tics.                            |
  411.               +-------------+------------------------------------------------------------+
  412.  
  413.  
  414.                 Syntax    FUNCTION SioDelay(Tics)
  415.                           REM Tics: # timer tics to delay
  416.  
  417.                Remarks    The  SioDelay  function is used to delay one or more timer tics,
  418.                           where each timer tic is approximately 55 milliseconds (18.2 tics
  419.                           to the second).
  420.  
  421.                Returns    zero.
  422.  
  423.               See Also    SioTimer
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.               +-------------+------------------------------------------------------------+
  442.               |   SioDone   |  Terminates further serial processing.                     |
  443.               +-------------+------------------------------------------------------------+
  444.  
  445.  
  446.                 Syntax    FUNCTION SioDone(Port)
  447.                           REM Port: Port selected (COM1 thru COM16)
  448.  
  449.                Remarks    The  SioDone  function  terminates  further  serial  processing.
  450.                           SioDone  MUST  be called before exiting your application so that
  451.                           interrupts can be restored to their original state.  Failure  to
  452.                           do  this  can crash the operating system.  If you forget to call
  453.                           SioDone before exiting, be sure to re-boot your  computer.   You
  454.                           can  call SioDone even if SioReset has not been called, so it is
  455.                           good  practice  to  always  call  SioDone  before  exiting  your
  456.                           application.
  457.  
  458.                           Also  note  that  SioDone  dereferences the transmit and receive
  459.                           buffers set up by SioRxQue and SioTxQue.
  460.  
  461.                Returns    -2 : Port not enabled. Call SioReset first.
  462.                           -4 : No such port. Expect 0 to MaxPort.
  463.  
  464.               See Also    SioReset.
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.                PCL4B   Reference   Manual                                      Page 7
  477.               +-------------+------------------------------------------------------------+
  478.               |    SioDSR   |  Reads the Data Set Ready (DSR) modem status bit.          |
  479.               +-------------+------------------------------------------------------------+
  480.  
  481.  
  482.                 Syntax    FUNCTION SioDSR(Port)
  483.                           REM Port: Port selected (COM1 thru COM16)
  484.  
  485.                Remarks    The SioDSR function is used to read the  Data  Set  Ready  (DSR)
  486.                           modem status bit.
  487.  
  488.                Returns    -2 : Port not enabled. Call SioReset first.
  489.                           -4 : No such port.  Expect 0 to MaxPort.
  490.                            0 : DSR is clear.
  491.                           >0 : DSR is set
  492.  
  493.               See Also    SioCTS, SioRI, SioDCD, and SioModem
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.               +-------------+------------------------------------------------------------+
  510.               |    SioDTR   |  Set, clear, or read Data Terminal Ready (DTR) status bit. |
  511.               +-------------+------------------------------------------------------------+
  512.  
  513.  
  514.                 Syntax    FUNCTION SioDTR(Port,Cmd)
  515.                           REM Port: Port selected (COM1 thru COM16)
  516.                           REM Cmd:  DTR command (SET, CLEAR, or READ)
  517.  
  518.                Remarks    The SioDTR function controls the Data Terminal Ready (DTR) bit
  519.                           in the modem control register.  DTR should always  be  set  when
  520.                           communicating with a modem. Commands (defined in PCL4B.BI) are:
  521.  
  522.                           SET_LINE ('S')  to set DTR (ON)
  523.                           CLEAR_LINE ('C')  to clear DTR (OFF)
  524.                           READ_LINE ('R')  to read DTR
  525.  
  526.                Returns    -2 : Port not enabled. Call SioReset first.
  527.                           -4 : No such port. Expect 0 to MaxPort.
  528.                           -5 : Not one of 'S', 'C', or 'R'.
  529.                            0 : DTR is OFF (READ_LINE Command).
  530.                           >0 : DTR is ON (READ_LINE Command).
  531.  
  532.               See Also    SioRTS.
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.                PCL4B   Reference   Manual                                      Page 8
  545.               +-------------+------------------------------------------------------------+
  546.               |   SioError  |  Displays error in text.                                   |
  547.               +-------------+------------------------------------------------------------+
  548.  
  549.  
  550.                 Syntax    FUNCTION SioError(Code)
  551.                           REM Code: PCL4B error code
  552.  
  553.                Remarks    The SioError function displays the error in  text  corresponding
  554.                           to  the  error  code  returned  from  a  PCL4B  function. During
  555.                           development of a communications application, it is a  good  idea
  556.                           to  always  test  return codes, and print out their descriptions
  557.                           with SioError.
  558.  
  559.                Returns    zero.
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.               +-------------+------------------------------------------------------------+
  570.               |   SioFIFO   |  Sets the FIFO trigger level (16550 UART only).            |
  571.               +-------------+------------------------------------------------------------+
  572.  
  573.  
  574.                 Syntax    FUNCTION SioFIFO(Port,LevelCode)
  575.                           REM Port:      Port selected (COM1 thru COM16)
  576.                           REM LevelCode: FIFO level code (see below)
  577.  
  578.                Remarks    The SioFIFO function  is  used to enable both transmit & receive
  579.                           FIFOs for 16550 UARTS, and to set the  trigger  level  at  which
  580.                           receive interrupts are generated.
  581.  
  582.                           For  example, if the FIFO level is set to 8, then the 16550 UART
  583.                           will not generate an interrupt until 8 bytes have been received.
  584.                           This reduces the  number  of  interrupts  generated  and  allows
  585.                           faster   processing   with   slower  machines  or  when  running
  586.                           simultaneous ports.
  587.  
  588.                           In order to take advantage of the TX FIFO, use the PCL4B library
  589.                           with TX interrupts enabled.
  590.  
  591.                           In order to test if your port is a 16550 UART, call SioFIFO with
  592.                           a LevelCode of other than FIFO_OFF. SioFIFO can  be  called  for
  593.                           the 8250 and 16450 UART without ill effect.
  594.  
  595.                           Code  PCL4B.BI Name  Trigger Level
  596.                           -1      FIFO_OFF     Disable FIFO
  597.                            0      LEVEL_1      1 byte
  598.                            1      LEVEL_4      4 bytes
  599.                            2      LEVEL_8      8 bytes
  600.                            3      LEVEL_14     14 bytes
  601.  
  602.                Returns    -2 : Port not enabled. Call SioReset first.
  603.                           -4 : No such port.  Expect 0 to MaxPort.
  604.                           >0 : FIFO level set.
  605.                            0 : FIFO level not set (not 16550).
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.                PCL4B   Reference   Manual                                      Page 9
  613.               +------------+-------------------------------------------------------------+
  614.               |   SioFlow  |  Sets hardware (RTS/CTS) flow control.                      |
  615.               +------------+-------------------------------------------------------------+
  616.  
  617.  
  618.                 Syntax    FUNCTION SioFlow(Port,Tics)
  619.                           REM Port: Port selected (COM1 thru COM16)
  620.                           REM Tics: # tics before timeout
  621.  
  622.                Remarks    The SioFlow function is used to enable or disable hardware  flow
  623.                           control.  Hardware flow control uses RTS and CTS to control data
  624.                           flow  between  the  modem and the computer.  Refer to the User's
  625.                           Manual  for  a  discussion  of flow control.  To enable hardware
  626.                           flow control, call SioFlow with Flag > 0.
  627.  
  628.                           "Tics"  is  the  number of timer tics (18.2 per second) before a
  629.                           call to SioPutc will time out because CTS was not set.
  630.  
  631.                           In order for hardware flow control to work correctly, your modem
  632.                           must also be configured to work with hardware flow control,  and
  633.                           your  computer  to  modem  cable  must  have  RTS  and CTS wired
  634.                           straight through. If you enable hardware flow  control,  do  not
  635.                           modify  the  RTS  line  (by  calling  SioRTS).
  636.  
  637.                           Flow control is disabled after resetting a port.  To  explicitly
  638.                           disable hardware flow control, call SioFlow with Flag=FALSE.
  639.  
  640.                Returns    -2 : Port not enabled. Call SioReset first.
  641.                           -4 : No such port.  Expect 0 to MaxPort.
  642.                           =0 : Flow control disabled.
  643.                           >0 : Flow control enabled.
  644.  
  645.               See Also    SioPutc
  646.  
  647.  
  648.  
  649.               +------------+-------------------------------------------------------------+
  650.               |   SioGetc  |  Reads the next character from the serial line.             |
  651.               +------------+-------------------------------------------------------------+
  652.  
  653.  
  654.                 Syntax    FUNCTION SioGetc(Port,Tics)
  655.                           REM Port: Port selected (COM1 thru COM16)
  656.  
  657.                Remarks    The SioGetc function reads a byte from the selected serial port.
  658.                           The function will wait for the number of system  tics  given  by
  659.                           the  'Tics'  argument  before  returning 'timed out'.  There are
  660.                           18.2 tics to the second.
  661.  
  662.  
  663.                Returns    -2 : Port not enabled. Call SioReset first.
  664.                           -4 : No such port. Expect 0 to MaxPort.
  665.                           -1 : If timed out.
  666.                           >0 : Character read.
  667.  
  668.               See Also    SioUnGetc and SioPutc.
  669.  
  670.  
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.                PCL4B   Reference   Manual                                      Page 10
  681.               +---------------+----------------------------------------------------------+
  682.               |   SioGetDiv   |  Reads the baud rate divisor.                            |
  683.               +---------------+----------------------------------------------------------+
  684.  
  685.  
  686.                 Syntax    FUNCTION SioGetDiv(Port)
  687.                           REM Port: Port selected (COM1 thru COM16)
  688.  
  689.  
  690.                Remarks     The  SioGetDiv  function reads the baud rate divisor. The baud
  691.                           rate can then be determined by the divisor:
  692.  
  693.                           Baud   Divisor      Baud  Divisor      Baud  Divisor
  694.                            300    0180        4800   0018       38400   0003
  695.                           1200    0060        9600   000C       57600   0002
  696.                           2400    0030       19200   0006      115200   0001
  697.  
  698.                Returns    -2 : Port not enabled. Call SioReset first.
  699.                           -4 : No such port. Expect 0 to MaxPort.
  700.                           >0 : Baud rate divisor.
  701.  
  702.               See Also    SioParms.
  703.  
  704.  
  705.  
  706.  
  707.  
  708.               +-------------+------------------------------------------------------------+
  709.               | SioKeyPress |  Detects if keyboard key has been pressed.                 |
  710.               +-------------+------------------------------------------------------------+
  711.  
  712.  
  713.                 Syntax    FUNCTION SioKeyPress()
  714.  
  715.                Remarks     The SioKeyPress function uses the BIOS to test the keyboard for
  716.                           a key press (including control characters).
  717.  
  718.                           SioKeyPress  calls  the  BIOS  directly without any intermediate
  719.                           buffering or processing. It is usually faster than using  the  C
  720.                           library.
  721.  
  722.                Returns    zero.
  723.  
  724.               See Also    SioCrtWrite and SioKeyRead.
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.  
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.                PCL4B   Reference   Manual                                      Page 11
  749.               +--------------+-----------------------------------------------------------+
  750.               |  SioKeyRead  |  Reads the keyboard.                                      |
  751.               +--------------+-----------------------------------------------------------+
  752.  
  753.  
  754.                 Syntax    FUNCTION SioKeyRead()
  755.  
  756.                Remarks    The SioKeyRead function uses the BIOS to read the  keyboard.  It
  757.                           will wait until a character is typed.
  758.  
  759.                           SioKeyRead  calls  the  BIOS  directly without any intermediate
  760.                           buffering or processing. It is usually faster than using  the  C
  761.                           library.
  762.  
  763.                Returns    zero.
  764.  
  765.               See Also    SioCrtWrite and SioKeyRead.
  766.  
  767.  
  768.  
  769.  
  770.  
  771.               +-------------+------------------------------------------------------------+
  772.               |   SioInfo   |  Returns PCL4B library information.                        |
  773.               +-------------+------------------------------------------------------------+
  774.  
  775.  
  776.                 Syntax    FUNCTION SioInfo(Cmd)
  777.                           REM Cmd: Command ('V' or 'I')
  778.  
  779.                Remarks    The  SioInfo  function returns an integer code  corresponding to
  780.                           either the (1) library version number  or  (2)  whether  or  not
  781.                           transmitter interrupts are enabled.
  782.  
  783.  
  784.                Returns    Version ('V')
  785.  
  786.                           hex byte XY where version is denoted as X.Y
  787.  
  788.                           TX Interrupts ('I')
  789.  
  790.                           TRUE  if  transmitter  interrupts  are  enabled  in the library,
  791.                           otherwise FALSE.
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.                PCL4B   Reference   Manual                                      Page 12
  817.               +-------------+------------------------------------------------------------+
  818.               |    SioIRQ   |  Assigns an IRQ line to a port.                            |
  819.               +-------------+------------------------------------------------------------+
  820.  
  821.  
  822.                 Syntax    FUNCTION SioIRQ(Port,IRQcode)
  823.                           REM Port:    Port selected (COM1 thru COM16)
  824.                           REM IRQcode: IRQ number [IRQ2..IRQ7]
  825.  
  826.                Remarks    The SioIRQ function assigns an IRQ line to  a  port.   That  is,
  827.                           SioIRQ  maps  an  IRQ  to a port.  SioIRQ (like SioUART) must be
  828.                           called before calling SioReset. Unless you have  a  non-standard
  829.                           (COM1  &  COM3  use IRQ4 while COM2 & COM4 use IRQ3) serial port
  830.                           configuration  (or  don't  want  to  run  more  than   2   ports
  831.                           concurrently),  you  will not need to call SioIRQ.  Be EXTREMELY
  832.                           careful with SioIRQ as it can lock  your  machine  up  if  given
  833.                           incorrect information.
  834.  
  835.                           In  particular,  remember  that your port hardware must generate
  836.                           the interrupt that you have specified.  You should refer to your
  837.                           serial  board  hardware  manual  for  specfic  instructions   in
  838.                           configuring  your  hardware.  Be  sure to call SioPorts first to
  839.                           setup DigiBoard ports if you have  them.   Refer  to  the  PCL4B
  840.                           Users Manual for additional information.
  841.  
  842.  
  843.                Returns    -4 : No such port. Expect 0 to MaxPort.
  844.                          -15 : Port already enabled.  SioReset has already been called.
  845.                          |17 : No such IRQ.
  846.                          -18 : ISR limit (maximum of 4 PC IRQs) exceeded.
  847.                            0 : Otherwise
  848.  
  849.               See Also    SioUART and SioPorts.
  850.  
  851.  
  852.  
  853.  
  854.  
  855.               +-------------+------------------------------------------------------------+
  856.               |   SioLine   |  Reads the line status register.                           |
  857.               +-------------+------------------------------------------------------------+
  858.  
  859.  
  860.                 Syntax    FUNCTION SioLine(Port)
  861.                           REM Port: Port selected (COM1 thru COM16)
  862.  
  863.                Remarks    The  SioLine  function  reads  the  line  status  register.  The
  864.                           individual bit masks are as follows:
  865.  
  866.                           0x40  = Transmitter empty.
  867.                           0x20  = Transmitter buffer empty.
  868.                           0x10  = Break detected.
  869.                           0x08  = Framming error.
  870.                           0x04  = Parity error.
  871.                           0x02  = Overrun error.
  872.                           0x01  = Data ready.
  873.  
  874.                           The above are documented in the file PCL4B.BI.
  875.  
  876.                Returns    -2 : Port not enabled. Call SioReset first.
  877.                           -4 : No such port. Expect 0 to MaxPort.
  878.                           >0 : Line status (rightmost byte of word).
  879.  
  880.               See Also    SioModem.
  881.  
  882.  
  883.  
  884.                PCL4B   Reference   Manual                                      Page 13
  885.               +-------------+------------------------------------------------------------+
  886.               | SioLoopBack |  Does a UART loopback test.                                |
  887.               +-------------+------------------------------------------------------------+
  888.  
  889.  
  890.                 Syntax    FUNCTION SioLoopBack(Port)
  891.                           REM Port: Port selected (COM1 thru COM16)
  892.  
  893.                Remarks    SioLoopBack makes use of the built in loopback  test  capability
  894.                           of  the  INS8250  family  UART.  Normally SioLoopBack will never
  895.                           need to be called unless you suspect that your UART is bad. Many
  896.                           UARTs must be reset after running a loopback test.
  897.  
  898.                Returns      0 : Loopback test is successfull.
  899.                            -2 : Port not enabled. Call SioReset first.
  900.                            -4 : No such port.  Expect 0 to MaxPort.
  901.                           -12 : Loopback test fails.
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.               +-------------+------------------------------------------------------------+
  914.               |   SioModem  |  Reads the modem status register.                          |
  915.               +-------------+------------------------------------------------------------+
  916.  
  917.  
  918.                 Syntax    FUNCTION SioModem(Port, Mask)
  919.                           REM Port: Port selected (COM1 thru COM16)
  920.                           REM Mask: Modem function mask
  921.  
  922.                Remarks    The  SioModem  function  reads  the  modem  register.    The bit
  923.                           definitions for the function mask are as follows:
  924.  
  925.                           Bit Name  Function               Bit  Name      Function
  926.                            7  DCD   Data Carrier Detect     3   DeltaDCD  DCD has changed
  927.                            6  RI    Ring Indicator          2   DeltaRI   RI has changed
  928.                            5  DSR   Data Set Ready          1   DeltaDSR  DSR has changed
  929.                            4  CTS   Clear To Send           0   DeltaCTS  CTS has changed
  930.  
  931.                           Bits  4  through  7  represent  the  absolute  state  of   their
  932.                           respective  RS-232  inputs.  Bits 0 through 3 represent a change
  933.                           in the state of their respective RS-232 inputs since last  read.
  934.                           Once UART register 3 is read, the Delta bits are cleared.  Thus,
  935.                           it is best not to depend on the Delta bits.
  936.  
  937.  
  938.                Returns    -2 : Port not enabled. Call SioReset first.
  939.                           -4 : No such port. Expect 0 to MaxPort.
  940.                           >0 : Modem status (rightmost byte of word).
  941.  
  942.               See Also   SioCTS, SioDCD, SioDSR and SioRI.
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.                PCL4B   Reference   Manual                                      Page 14
  953.               +-------------+------------------------------------------------------------+
  954.               |  SioParms   |  Sets parity, stop bits, and word length.                  |
  955.               +-------------+------------------------------------------------------------+
  956.  
  957.  
  958.                Syntax     FUNCTION SioParms(Port,Parity,StopBits,DataBits)
  959.                           REM Port:     Port selected (COM1 - COM16)
  960.                           REM Parity:   Parity code [0,1,2]
  961.                           REM StopBits: Stop bits code [0,1]
  962.                           REM DataBits: Word length code [0,1,2,3]
  963.  
  964.                Remarks    The SioParms function sets  the  parity,  stop  bits,  and  word
  965.                           length.   If  the  default parity (none), stop bits (1), or word
  966.                           length (8) is not  acceptable,  then  they  can  be  changed  by
  967.                           calling SioParms.  SioParms can be called either before or after
  968.                           calling SioReset. See file PCL4B.BI. (8 = default)
  969.  
  970.                                         Value   Description    PCL4B.BI Name
  971.                           ParityCode:    *0      no parity      NoParity
  972.                                           1      odd parity     OddParity
  973.                                           3      even parity    EvenParity
  974.                           StopBitsCode:  *0      1 stop bit     OneStopBit
  975.                                           1      2 stop bits    TwoStopBits
  976.                           WordLengthCode: 0      5 data bits    WordLength5
  977.                                           1      6 data bits    WordLength6
  978.                                           2      7 data bits    WordLength7
  979.                                          *3      8 data bits    WordLength8
  980.  
  981.               Returns     -4 : No such port. Expect 0 to MaxPort.
  982.                           -7 : Bad parity code selected. Expecting  0 to 2.
  983.                           |8 : Bad stop bits code. Expecting  0 or 1.
  984.                           -9 : Bad word length code. Expecting  0 to 3.
  985.  
  986.              See Also    SioReset.
  987.  
  988.  
  989.               +-------------+------------------------------------------------------------+
  990.               |  SioPorts   |  Sets number of PC & Digiboard / BOCA Board ports.         |
  991.               +-------------+------------------------------------------------------------+
  992.  
  993.  
  994.                 Syntax     FUNCTION SioPorts(NbrPorts,FirstPort,StatusReg,Code)
  995.                           REM NbrPorts:  Total number of ports
  996.                           REM FirstPort: First DigiBoard port
  997.                           REM StatusReg: DigiBoard Status Register
  998.                           REM Code:      PC_PORTS, DIGIBOARD, or BOCABOARD
  999.  
  1000.                Remarks    The SioPorts function must be called  before  ANY  other  serial
  1001.                           functions.   The  purpose of the SioPorts function is to set the
  1002.                           total number of ports, the first DigiBoard (or BOCA board)  port
  1003.                           and the DigiBoard (or BOCA board) status register address.
  1004.  
  1005.                           Once SioPorts is called, all COM ports starting with "FirstPort"
  1006.                           will be treated as DigiBoard (or BOCA board) ports.  The default
  1007.                           setup is 4 standard PC ports and no DigiBoard or  BOCA  ports  [
  1008.                           SioPorts(4,4,0,PC_PORTS) ].
  1009.  
  1010.                           Refer  to  ther  PCL4B users maniual for more information on the
  1011.                           DigiBoard and BOCA board.
  1012.  
  1013.                Returns    -4 : No such port. Expect 0 to 9.
  1014.                           0 : No error (sets MaxPort to NumberPorts-1).
  1015.  
  1016.               See Also    SioUART, SioIRQ, and Code Examples.
  1017.  
  1018.  
  1019.  
  1020.                PCL4B   Reference   Manual                                      Page 15
  1021.               +-------------+------------------------------------------------------------+
  1022.               |   SioPutc   |  Transmit a character over a serial line.                  |
  1023.               +-------------+------------------------------------------------------------+
  1024.  
  1025.  
  1026.                 Syntax    FUNCTION SioPutc(Port,Ch)
  1027.                           REM Port: Port selected (COM1 thru COM16)
  1028.                           REM Ch:   Character to send
  1029.  
  1030.                Remarks    The SioPutc function transmits one character  over the  selected
  1031.                           serial line.
  1032.  
  1033.                           If  flow  control has been enabled, then SioPutc may return a -1
  1034.                           (time out) if the  number  of  tics  specified  in  the  SioFlow
  1035.                           function was exceeded waiting for the modem to raise CTS.
  1036.  
  1037.                           Refer to the User's Manual for a discussion of flow control.
  1038.  
  1039.                           If  transmitter  interrupts  are  enabled  (there  are  separate
  1040.                           versions of the library  for  transmitter  interrupts  enabled),
  1041.                           then  the  byte  is  placed  in  the  transmit  buffer, awaiting
  1042.                           transmission by the PCL4B interrupt service routine.
  1043.  
  1044.                Returns    -2 : Port not enabled. Call SioReset first.
  1045.                           -4 : No such port. Expect 0 to MaxPort.
  1046.                           -1 : Timed out waiting for CTS (flow control enabled)
  1047.  
  1048.               See Also    SioGetc and SioFlow.
  1049.  
  1050.  
  1051.  
  1052.  
  1053.               +-------------+------------------------------------------------------------+
  1054.               |   SioRead   |  Reads any UART register.                                  |
  1055.               +-------------+------------------------------------------------------------+
  1056.  
  1057.  
  1058.                 Syntax    FUNCTION SioRead(Port,Reg)
  1059.                           REM Port: Port selected (COM1 thru COM16)
  1060.                           REM Reg:  UART register (0 to 7)
  1061.  
  1062.                Remarks    The SioReset function directly reads the contents of any of  the
  1063.                           7  UART  registers.   This  function  is  useful  when debugging
  1064.                           application  programs  and  as  a  method  for  verifying   UART
  1065.                           contents.   Refer  to the PCL4B Users Manual for a discussion of
  1066.                           the 7 UART registers.
  1067.  
  1068.                           The line status register (register 5)  can  also  be  read  with
  1069.                           SioLine while the modem status register (register 6) can also be
  1070.                           read  with  SioModem.  Refer  to  the  PCL4B User's Manual for a
  1071.                           discussion of the UART registers.
  1072.  
  1073.                Returns     -3 : No buffer available. Call SioRxBuf first.
  1074.                            -4 : No such port. Expect 0 to MaxPort.
  1075.  
  1076.               See Also    SioLine and SioModem.
  1077.  
  1078.  
  1079.  
  1080.  
  1081.  
  1082.  
  1083.  
  1084.  
  1085.  
  1086.  
  1087.  
  1088.                PCL4B   Reference   Manual                                      Page 16
  1089.               +-------------+------------------------------------------------------------+
  1090.               |  SioReset   |  Initialize a serial port for processing.                  |
  1091.               +-------------+------------------------------------------------------------+
  1092.  
  1093.  
  1094.                 Syntax    FUNCTION SioReset(Port,BaudCode)
  1095.                           REM Port:     Port selected (COM1 thru COM16)
  1096.                           REM BaudCode: Baud code or -1
  1097.  
  1098.                Remarks    The SioReset function  initializes  the  selected  serial  port.
  1099.                           SioReset should be called after calling SioParm and SioRxBuf but
  1100.                           before  making  any  other  calls  to  PCL4B.  SioReset uses the
  1101.                           parity, stop bits, and  word  length  value  previously  set  if
  1102.                           SioParm  was  called, otherwise the default values (see SioParm)
  1103.                           are used.
  1104.  
  1105.                           Recall that COM1 and COM3 share the same  interrupt  vector  and
  1106.                           therefore  cannot  operate  simultaneously. Similiarly, COM2 and
  1107.                           COM4 cannot operate simultaneously. Any other combination of two
  1108.                           ports can be used.
  1109.  
  1110.                           By specifing NORESET (-1) for the baud rate code, the port  will
  1111.                           NOT  be  reset.   This is used to "take over" a port from a host
  1112.                           communications program that allows a  "DOS  gateway".   External
  1113.                           protocols  can  be implemented this way.  See SioBaud for a list
  1114.                           of the baud rate codes, or see "PCL4B.BI".
  1115.  
  1116.                Returns     -3 : No buffer available. Call SioRxBuf first.
  1117.                            -4 : No such port. Expect 0 to MaxPort.
  1118.                           -11 : Bad baud rate code selected. Expecting  0 to 9.
  1119.                           |13 : UART undefined.  SioUART(Port,0) was called previously.
  1120.                           |14 : Bad or missing UART.  You may not have hardware present.
  1121.                           |15 : Port already enabled.  SioReset has already been called.
  1122.                           -16 : Interrupt already in use.
  1123.  
  1124.               See Also    SioBaud, SioParms, SioRxBuf, SioDone, and SioUART.
  1125.  
  1126.  
  1127.  
  1128.  
  1129.               +-------------+------------------------------------------------------------+
  1130.               |    SioRI    |  Reads the Ring Indicator (RI) modem status bit.           |
  1131.               +-------------+------------------------------------------------------------+
  1132.  
  1133.  
  1134.                 Syntax    FUNCTION SioRI(Port)
  1135.                           REM Port: Port selected (COM1 thru COM16)
  1136.  
  1137.                Remarks    The SioRI function is used to read the Ring  Indicator
  1138.                           (RI) modem status bit. Also see SioModem.
  1139.  
  1140.                Returns    -2 : Port not enabled. Call SioReset first.
  1141.                           -4 : No such port.  Expect 0 to MaxPort.
  1142.                            0 : RI is clear.
  1143.                           >0 : RI is set (RING has occurred).
  1144.  
  1145.               See Also    SioDSR, SioCTS, SioDCD, and SioModem.
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.                PCL4B   Reference   Manual                                      Page 17
  1157.               +-------------+------------------------------------------------------------+
  1158.               |    SioRTS   |  Sets, clears, or reads the Request to Send (RTS) line.    |
  1159.               +-------------+------------------------------------------------------------+
  1160.  
  1161.  
  1162.                 Syntax    FUNCTION SioRTS(Port, Cmd)
  1163.                           REM Port: Port selected (COM1 thru COM16)
  1164.                           REM Cmd:  RTS command (SET, CLEAR, or READ)
  1165.  
  1166.                Remarks    The SioRTS function controls the Request to Send (RTS bit in the
  1167.                           modem control register.
  1168.  
  1169.                           The  RTS  line  is  used  by  some  error  correcting  modems to
  1170.                           implement hardware flow control.  RTS is dropped by the computer
  1171.                           to signal the modem not to send data, and is  raised  to  signal
  1172.                           the modem to continue. RTS should be set when communicating with
  1173.                           a modem unless Flow Control is being used.
  1174.  
  1175.                           Refer  to  the  User's  Manual for a discussion of flow control.
  1176.                           Commands (defined in PCL4B.BI) are:
  1177.  
  1178.                           SET_LINE ('S')   - set RTS (ON)
  1179.                           CLEAR_LINE ('C') | clear RTS (OFF)
  1180.                           READ_LINE ('R')  - read RTS
  1181.  
  1182.                Returns    -2 : Port not enabled. Call SioReset first.
  1183.                           -4 : No such port. Expect 0 to MaxPort.
  1184.                           -5 : Command is not one of 'S', 'C', or 'R'.
  1185.                            0 : RTS is OFF (READ_LINE Command).
  1186.                           >0 : RTS is ON  (READ_LINE Command).
  1187.  
  1188.               See Also    SioFlow and SioDTR.
  1189.  
  1190.  
  1191.               +------------+-------------------------------------------------------------+
  1192.               |  SioRxBuf  |  Sets up receive buffers.                                   |
  1193.               +------------+-------------------------------------------------------------+
  1194.  
  1195.  
  1196.                 Syntax    FUNCTION SioRxBuf(Port,Segment,SizeCode)
  1197.                           REM Port:     Port selected (COM1 thru COM16)
  1198.                           REM Segment:  Receive buffer segment
  1199.                           REM SizeCode: Buffer size code
  1200.  
  1201.                Remarks     The  SioRxBuf  function passes the address segment and size of
  1202.                           the  receive  buffer  to  PCL4B.   Recall  that PCL4B requires a
  1203.                           receive buffer for each port in simultaneous operation since the
  1204.                           receive function is interrupt driven.  It must be called  before
  1205.                           any incoming characters can be received. SioRxBuf must be called
  1206.                           before SioReset.  Buffer size codes are listed in "PCL4B.BI".
  1207.  
  1208.                           Size Code       Buffer Size    PCL4B.BI Name
  1209.                              4            128 bytes        Size128
  1210.                              5            256 bytes        Size256
  1211.                              6            512 bytes        Size512
  1212.                              7           1024 bytes        Size1024 or Size1K
  1213.                              8           2048 bytes        Size2048 or Size2K
  1214.                              9           4096 bytes        Size4096 or Size4K
  1215.                             10           8192 bytes        Size8192 or Size8K
  1216.                             11          16384 bytes        Size16384 or Size16K
  1217.                             12          32768 bytes        Size32768 or Size32K
  1218.  
  1219.                Returns    -4 : No such port. Expect 0 to MaxPort.
  1220.                          -10 : Bad buffer size code. Expecting 0 to 11.
  1221.  
  1222.               See Also    SioReset and Code Examples.
  1223.  
  1224.                PCL4B   Reference   Manual                                      Page 18
  1225.               +------------+-------------------------------------------------------------+
  1226.               | SioRxFlush |  Flushes (clears) the receive buffer.                       |
  1227.               +------------+-------------------------------------------------------------+
  1228.  
  1229.  
  1230.                 Syntax    FUNCTION SioRxFlush(Port)
  1231.                           REM Port: Port selected (COM1 thru COM16)
  1232.  
  1233.                Remarks    The SioRxFlush  function  will  delete  any  characters  in  the
  1234.                           receive  buffer  for  the  specified port.  After execution, the
  1235.                           receive buffer will be empty.  Call SioRxBuf after  resetting  a
  1236.                           port in order to delete any spurious characters.
  1237.  
  1238.                Returns    -2 : Port not enabled. Call SioReset first.
  1239.                           -4 : No such port. Expect 0 to MaxPort.
  1240.  
  1241.               See Also    SioRxQue.
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.               +-------------+------------------------------------------------------------+
  1255.               |  SioRxQue   |  Returns the number of bytes in the receive queue.         |
  1256.               +-------------+------------------------------------------------------------+
  1257.  
  1258.  
  1259.                 Syntax    FUNCTION SioRxQue(Port)
  1260.                           REM Port: Port selected (COM1 thru COM16)
  1261.  
  1262.                Remarks    The  SioRxQue  function  will return the number of characters in
  1263.                           the receive queue at the time of the call. It  can  be  used  to
  1264.                           implement XON/XOFF flow control.
  1265.  
  1266.                Returns    -2 : Port not enabled. Call SioReset first.
  1267.                           -4 : No such port. Expect 0 to MaxPort.
  1268.  
  1269.               See Also     SioRxFlush.
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.                PCL4B   Reference   Manual                                      Page 19
  1293.               +------------+-------------------------------------------------------------+
  1294.               |  SioTimer  |  Returns the number of system clock tics since midnight.    |
  1295.               +------------+-------------------------------------------------------------+
  1296.  
  1297.  
  1298.                 Syntax    FUNCTION SioTimer()
  1299.  
  1300.                Remarks     The  SioTimer  function will return the number of system clock
  1301.                           tics since midnight, at 18.2065 tics per second.  This  function
  1302.                           is usefull for timing various functions.
  1303.  
  1304.               See Also    SioDelay
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.               +------------+-------------------------------------------------------------+
  1312.               |  SioTxBuf  |  Sets up transmitter buffer.                                |
  1313.               +------------+-------------------------------------------------------------+
  1314.  
  1315.  
  1316.                 Syntax    FUNCTION SioTxBuf(Port,Segment,SizeCode)
  1317.                           REM Port:     Port selected (COM1 thru COM16)
  1318.                           REM Segment:  Receive buffer segment
  1319.                           REM SizeCode: Buffer size code
  1320.  
  1321.                Remarks     The  SioTxBuf  function passes the address segment and size of
  1322.                           the transmit buffer to PCL4B, provided that you will link with a
  1323.                           PCL4B  library  with  transmitter  interrupts  enabled.    PCL4B
  1324.                           requires  a  transmit  buffer  for  each  port  in  simultaneous
  1325.                           operation if you are using  the  version  of  the  library  with
  1326.                           transmitter interrupts enabled (PCL4B2.LIB).  SioTxBuf() must be
  1327.                           called before SioReset.
  1328.  
  1329.                           Size Code       Buffer Size    PCL4B.BI Name
  1330.                              4            128 bytes        Size128
  1331.                              5            256 bytes        Size256
  1332.                              6            512 bytes        Size512
  1333.                              7           1024 bytes        Size1024 or Size1K
  1334.                              8           2048 bytes        Size2048 or Size2K
  1335.                              9           4096 bytes        Size4096 or Size4K
  1336.                             10           8192 bytes        Size8192 or Size8K
  1337.                             11          16384 bytes        Size16384 or Size16K
  1338.                             12          32768 bytes        Size32768 or Size32K
  1339.  
  1340.                           This function is not used unless the transmitter interrupts  are
  1341.                           enabled  (PCL4B2.LIB).  Refer  to  the  PCL4B  Users  Manual for
  1342.                           information on transmitter (TX) interrupts.
  1343.  
  1344.                Returns     -4 : No such port. Expect 0 to MaxPort.
  1345.                           -10 : Bad buffer size code. Expecting 0 to 11.
  1346.  
  1347.               See Also    SioRxBuf, SioReset and Code Examples.
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.                PCL4B   Reference   Manual                                      Page 20
  1361.               +------------+-------------------------------------------------------------+
  1362.               | SioTxFlush |  Flushes (clears) the transmitter buffer.                   |
  1363.               +------------+-------------------------------------------------------------+
  1364.  
  1365.  
  1366.                 Syntax    FUNCTION SioTxFlush(Port)
  1367.                           REM Port: Port selected (COM1 thru COM16)
  1368.  
  1369.                Remarks    The SioTxFlush  function  will  delete  any  characters  in  the
  1370.                           transmit  buffer  for the specified port, provided that you will
  1371.                           link with a PCL4B library with transmitter  interrupts  enabled.
  1372.                           After execution, the transmit buffer will be empty.
  1373.  
  1374.                           Once  this  function is called, any character  in  the  transmit
  1375.                           buffer  (put  there  by  SioPutc) will be lost and therefore not
  1376.                           transmitted. This function is not used  unless  the  transmitter
  1377.                           interrupts  are  enabled  Refer  to  the  PCL4B Users Manual for
  1378.                           information on transmitter (TX) interrupts.
  1379.  
  1380.                Returns    -2 : Port not enabled. Call SioReset first.
  1381.                           -4 : No such port. Expect 0 to MaxPort.
  1382.  
  1383.               See Also    SioTxQue.
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.               +------------+-------------------------------------------------------------+
  1391.               |  SioTxQue  |  Returns the number of bytes in the transmit queue.         |
  1392.               +------------+-------------------------------------------------------------+
  1393.  
  1394.  
  1395.                 Syntax    FUNCTION SioTxQue(Port)
  1396.                           REM Port: Port selected (COM1 thru COM16)
  1397.  
  1398.                Remarks    The SioTxQue function will return the number  of  characters  in
  1399.                           the  transmit  queue  at the time of the call, provided that you
  1400.                           will link with  a  PCL4B  library  with  transmitter  interrupts
  1401.                           enabled.
  1402.  
  1403.                           This function is not used unless the transmitter interrupts  are
  1404.                           enabled.  Refer  to  the  PCL4B  Users Manual for information on
  1405.                           transmitter (TX) interrupts.
  1406.  
  1407.                Returns    -2 : Port not enabled. Call SioReset first.
  1408.                           -4 : No such port. Expect 0 to MaxPort.
  1409.  
  1410.               See Also     SioTxFlush.
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.                PCL4B   Reference   Manual                                      Page 21
  1429.               +------------+-------------------------------------------------------------+
  1430.               |  SioUART   |  Sets the UART base address.                                |
  1431.               +------------+-------------------------------------------------------------+
  1432.  
  1433.  
  1434.                 Syntax    FUNCTION SioUART(Port,Address)
  1435.                           REM Port:    Port selected (COM1 thru COM16)
  1436.                           REM Address: UART address
  1437.  
  1438.                Remarks    The  SioUART  function  sets  the  UART  base  address  for  the
  1439.                           specified port.  SioUART must be called before SioReset in order
  1440.                           to have effect.  Be extremely sure that you know  what  you  are
  1441.                           doing!   Note   that  PCL4B  uses  the  standard  PC/XT/AT  port
  1442.                           addresses,  interrupt  request  lines,  and  interrupt   service
  1443.                           vectors.   Therefore,   this   function   is   only  needed  for
  1444.                           non-standard ports.
  1445.  
  1446.                Returns    >0 : The previous base address for this port.
  1447.                           -4 : No such port.  Expect 0 to MaxPort.
  1448.                          -15 : Port already enabled.  SioReset has already been called.
  1449.  
  1450.               See Also    SioPorts, SioIRQ, and SioReset.
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.               +------------+-----+-------------------------------------------------------+
  1460.               | SioUnGetc  |  "Un|gets" the last character read with SioGetc().          |
  1461.               +------------+-----+-------------------------------------------------------+
  1462.  
  1463.  
  1464.                 Syntax    FUNCTION SioUnGetc(Port,Ch)
  1465.                           REM Port: Port selected (COM1 thru COM16)
  1466.                           REM Ch:   Character to unget
  1467.  
  1468.                Remarks    The SioUnGetc function returns  ("pushes")  the  character  back
  1469.                           into  the serial input buffer.  The character pushed will be the
  1470.                           next character returned by SioGetc.  Only one character  can  be
  1471.                           pushed back. This function works just like the "ungetc" function
  1472.                           in the C language.
  1473.  
  1474.                Returns    -2 : Port not enabled. Call SioReset first.
  1475.                           -4 : No such port. Expect 0 to MaxPort.
  1476.  
  1477.               See Also    SioReset.
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.                PCL4B   Reference   Manual                                      Page 22
  1497.                                        Function Sumary
  1498.  
  1499.  
  1500.  
  1501.                    +-------------+----------+----------+----------+----------+
  1502.                    | Function    |   Arg1   |   Arg2   |   Arg3   |   Arg4   |
  1503.                    +-------------+----------+----------+----------+----------+
  1504.                    | SioBaud     | Port     | BaudCode |          |          |
  1505.                    | SioBrkSig   | Port     | Cmd      |          |          |
  1506.                    | SioCTS      | Port     |          |          |          |
  1507.                    | SioDCD      | Port     |          |          |          |
  1508.                    | SioDone     | Port     |          |          |          |
  1509.                    | SioDSR      | Port     |          |          |          |
  1510.                    | SioDTR      | Port     | Cmd      |          |          |
  1511.                    | SioError    | Code     |          |          |          |
  1512.                    | SioFIFO     | Port     | FIFOcode |          |          |
  1513.                    | SioFlow     | Port     |          |          |          |
  1514.                    | SioGetc     | Port     | Tics     |          |          |
  1515.                    | SioGetDiv   | Port     |          |          |          |
  1516.                    | SioInfo     | Cmd      |          |          |          |
  1517.                    | SioIRQ      | Port     | IRQcode  | ISRcode  |          |
  1518.                    | SioLine     | Port     |          |          |          |
  1519.                    | SioLoopBack | Port     |          |          |          |
  1520.                    | SioModem    | Port     | Mask     |          |          |
  1521.                    | SioParms    | Port     | Parity   | StopBits |WordLength|
  1522.                    | SioPorts    | NbrPorts | FirstDBP |StatusReg | Code     |
  1523.                    | SioPutc     | Port     | Ch       |          |          |
  1524.                    | SioRead     | Port     | Register |          |          |
  1525.                    | SioReset    | Port     | BaudCode |          |          |
  1526.                    | SioRI       | Port     |          |          |          |
  1527.                    | SioRTS      | Port     | Cmd      |          |          |
  1528.                    | SioRxBuf    | Port     | Buffer   | SizeCode |          |
  1529.                    | SioRxFlush  | Port     |          |          |          |
  1530.                    | SioRxQue    | Port     |          |          |          |
  1531.                    | SioTxBuf    | Port     | Buffer   | SizeCode |          |
  1532.                    | SioTxFlush  | Port     |          |          |          |
  1533.                    | SioTxQue    | Port     |          |          |          |
  1534.                    | SioUART     | Port     | Address  |          |          |
  1535.                    | SioUnGetc   | Port     | Ch       |          |          |
  1536.                    +-------------+----------+----------+----------+----------+
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.                PCL4B   Reference   Manual                                      Page 23
  1565.                                        Error Code Summary
  1566.  
  1567.  
  1568.  
  1569.               +------+--------------------------------------------------------+
  1570.               | Code |  Description                                           |
  1571.               +------+--------------------------------------------------------+
  1572.               |   0  |  No error.                                             |
  1573.               |  -1  |  Timeout waiting for I/O.                              |
  1574.               |  -2  |  Port not enabled. Call SioReset first.                |
  1575.               |  -3  |  No buffer available. Call SioRxBuf first.             |
  1576.               |  -4  |  No such port. Expect 0 to MaxPort. (COM1 = 0)         |
  1577.               |  -5  |  Expected 'S', 'C', or 'R' as 2nd argument.            |
  1578.               |  -6  |  Expected 'A', 'C', or 'D' as 2nd argument.            |
  1579.               |  -7  |  Bad parity code specified. Expected 0 to 7.           |
  1580.               |  -8  |  Bad stop bits code specified. Expected 0 or 1.        |
  1581.               |  -9  |  Bad wordlength code specified. Expect 0 to MaxPort.   |
  1582.               | -10  |  Bad buffer size code specified. Expected 0 to 11.     |
  1583.               | -11  |  Bad baud rate code. Expected 0 to 9.                  |
  1584.               | -12  |  Loopback test fails.                                  |
  1585.               | -13  |  UART undefined.                                       |
  1586.               | -14  |  Missing or bad UART. (no UART hardware ?)             |
  1587.               | -15  |  Port already enabled.                                 |
  1588.               | -16  |  ISR (interrupt) already in use.                       |
  1589.               | -17  |  No such IRQ. (Should be 2 to 7)                       |
  1590.               | -18  |  ISR limit (maximum of 4 PC IRQs) exceeded.            |
  1591.               +------+--------------------------------------------------------+
  1592.  
  1593.  
  1594.                                        Code Examples
  1595.  
  1596.               SioRxBuf() Example
  1597.  
  1598.               S$ = STRING(1024,0)
  1599.               BufSeg = SSEG(S$) + (SADD(S$)\16) + 1
  1600.               'BufSeg:0 is SEG:OFS address of 1024 contiguous bytes
  1601.               RC = SioRxBuf(Port,BufSeg,SizeCode);
  1602.  
  1603.               DigiBoard Example
  1604.  
  1605.               'use 0x140 for odd IRQs & 0x141 for even IRQs
  1606.               RC = SioPorts(8,COM1,0x140,DIGIBOARD);
  1607.               FOR I = COM1 TO COM16
  1608.                 'set DigiBoard UART addresses
  1609.                 RC = SioUART(i,0x100+8*i);
  1610.                 'set DigiBoard for IRQ5
  1611.                 RC = SioIRQ(I,IRQ5);
  1612.               NEXT I
  1613.  
  1614.               BOCA Board Example
  1615.  
  1616.               'use base port + 7
  1617.               RC = SioPorts(16,COM1,0x100+7,BOCABOARD);
  1618.               FOR I = COM1 TO COM16
  1619.                 'set BOCA UART addresses
  1620.                 RC = SioUART(i,0x100+8*i);
  1621.                 'set BOCA for IRQ5
  1622.                 RC = SioIRQ(I,IRQ5);
  1623.               NEXT I
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.                PCL4B   Reference   Manual                                      Page 24
  1633.