Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper Tools . Books 1-3 - <b>com_init()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 COM_INIT()
 Initializes the port parameters
------------------------------------------------------------------------------
 Syntax

     COM_INIT(<nComPort>,[<nBaudRate>],[<cParity>],
        [<nDataLength>],[<nStopBits>]) --> lInitialized

 Arguments

     <nComPort>  Designates the port (1 to 4) that is initialized.

     <nBaudRate>  Designates the selected baud rate for the port.
     Settings of 300, 600, 1200, 2400, 4800, 9600 and 19200 baud are
     possible.  The default value is 300 baud.

     <cParity>  Designates parity in the following form: (E)ven, (O)dd,
     (M)ark, (S)pace, or (N)one.  The default value is (N)one.

     <nDataLength>  Designates the data length; seven or eight bits are
     possible.  The default value is eight bits.

     <nStopBits>  Designates the number of stop bits, one or two.  The
     default value is one stop bit.

 Returns

     If the com port is initialized successfully, the function returns .T..

 Description

     In order to use the serial port after you open it, four operating
     parameters must have been passed to this function.  These operating
     parameters are the transmission speed (baud rate), the data length, the
     parity, and the number of stop bits.  Today most bulletin boards use the
     configuration "300 - 9600 baud, 8N1".  This configuration means eight
     data bits, no parity, and one stop bit.  What is important is that all
     these parameters can be changed while the port is closed.  Neither the
     data buffer or the modem status register (DTR, etc.) are affected.

 Notes

     .  The port must have been opened previously.  It is impossible
        to initialize a port prior to opening it.

     .  If any or all of the four operating parameters are not
        designated, or are designated incorrectly, the standard arguments of
        300 baud, no parity, eight data bits, and one stop bit is used.

 Examples

     .  Open and initialize a port:

        nBuff_size := 4000                     // 4000 character buffer
        lComOk  :=  COM_OPEN(1, nBuff_size)    // Open port

        IF lComOk
              * The port is open, now it is to be initialized with 1200
              * baud, no parity, eight data bits, and one stop bit.

              lInitOk  :=  COM_INIT(1, 1200, "N", 8, 1)

              IF .NOT. lInitOk
                 ? "Port cannot be initialized !"
              ENDIF
        ENDIF

     .  You can also omit the last three parameters in the above
        example because they correspond to the default settings:

        lInitOk  :=  COM_INIT(1, 1200)      // Init. with 1200, N, 8, 1


See Also: COM_OPEN() COM_CLOSE()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson