⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pcl4c.ref

📁 C语言通讯程序库DOS版,支持10个115200波特率的通讯口
💻 REF
📖 第 1 页 / 共 5 页
字号:


                          Personal Communications Library

                                For the C Language


                                    (PCL4C)



                               REFERENCE MANUAL





                                  Version  4.0

                                  Oct 18, 1993




                        This software is provided as-is.
                 There are no warranties, expressed or implied.




                              Copyright (C) 1993
                              All rights reserved



                              MarshallSoft Computing, Inc.
                              Post Office Box 4543
                              Huntsville AL 35815

                              Voice 205-881-4630
                              FAX   205-881-4630
                              BBS   205-880-9748

















        PCL4C Reference Manual                                 Page 1
                               C O N T E N T S



              Chapter                                     Page

              Table of Contents.............................2
              Introduction..................................3
                 SioBaud....................................4
                 SioBrkKey..................................5
                 SioBrkSig..................................6
                 SioCrtWrite................................7
                 SioCTS.....................................8
                 SioDCD.....................................9
                 SioDelay..................................10
                 SioDone...................................11
                 SioDSR....................................12
                 SioDTR....................................13
                 SioError..................................14
                 SioFIFO...................................15
                 SioFlow...................................16
                 SioGetc...................................17
                 SioKeyPress...............................18
                 SioKeyRead................................19
                 SioInfo...................................20
                 SioIRQ....................................21
                 SioLine...................................22
                 SioLoopBack...............................23
                 SioModem..................................24
                 SioParms..................................25
                 SioPorts..................................26
                 SioPutc...................................27
                 SioRead...................................28
                 SioReset..................................29
                 SioRI.....................................30
                 SioRTS....................................31
                 SioRxBuf..................................32
                 SioRxFlush................................33
                 SioRxQue..................................34
                 SioTimer..................................35
                 SioTxBuf..................................36
                 SioTxFlush................................37
                 SioTxQue..................................38
                 SioUART...................................39
                 SioUnGetc.................................40
              Function Summary.............................41
              Error Code Summary...........................42












        PCL4C Reference Manual                                 Page 2
                                  Introduction



         This manual lists all of the PCL4C functions in alphabetical
         order. Every library function will return a value as follows:

         1.  Negative values for error conditions. See last page of this
         manual for a list of error values and their meanings.

         2.  Non-negative values when returning data (eg: SioLine).

         3.  Zero otherwise.

         When debugging an application, be sure to test all return values.
         Use SioError to print the associated text for errors.

         Example Code Segment


         *****************************************************************
         * int Code;                 /* MUST be 'int', not 'char' */     *
         *                                                               *
         * Code = SioFunction( );    /* any PCL4C function */            *
         * if(Code<0)                                                    *
         *   {/* error returned */                                       *
         *    SioError(Code);        /* SioError prints error text */    *
         *    SioDone(Port);         /* always call SioDone last */      *
         *    exit(1);                                                   *
         *   }                                                           *
         * /* no errors */                                               *
         * ...your application code...                                   *
         *                                                               *
         *****************************************************************


         For  more  examples, examine each of the example programs provided
         (SIMPLE.C and TERM.C). Also look at the examples  associated  with
         each library function described in the following section.

         Also  note  that  there  are  two versions of the library for each
         memory model. One version is with transmitter interrupts  disabled
         and one with them enabled.

         Refer to the User's Manual (PCL4C.USR) for addition information.














        PCL4C Reference Manual                                 Page 3
                                  SioBaud



         Function    Sets the baud rate of the selected port.

           Syntax    int SioBaud(Port,BaudCode)
                     int Port;     /* Port selected (COM1 - COM4) */
                     int BaudCode; /* Baud code */


          Remarks    The  SioBaud  function  sets  the  baud  rate  without
                     resetting the port. It is used to change the baud rate
                     after calling SioReset.

                     Baud Code           Baud Rate       PCL4C.H Name
                          0                 300            Baud300
                          1                 600            Baud600
                          2                1200            Baud1200
                          3                2400            Baud2400
                          4                4800            Baud4800
                          5                9600            Baud9600
                          6               19200            Baud19200
                          7               38400            Baud38400
                          8               57600            Baud57600
                          9              115200            Baud115200


          Returns     -4 : No such port. Expect 0 to MaxPort.
                     -11 : Bad baud rate code. See above code values.

          Example    /* verify 2400 baud connection */
                     if(WaitFor(Port,"CONNECT") )
                       {/* expect "2400" */
                        if(WaitFor(Port,"2400")
                          {/* 2400 baud connection made */
                           ...
                          }
                       }

         See Also    SioReset


















        PCL4C Reference Manual                                 Page 4
                                  SioBrkKey



         Function    Return non-zero if the Control-BREAK key was pressed.

           Syntax    int SioBrkKey()

          Remarks    The SioBrkKey function  returns  a  TRUE  value  (non-
                     zero)  if  the  Control-BREAK key was pressed, else it
                     returns a zero. Use SioBrkKey as a safety exit from  a
                     polling   loop.   Don't  mix  this  function  up  with
                     SioBrkSig.

          Returns    -1 : Control-BREAK was pressed.
                      0 : Control-BREAK was NOT pressed.

          Example    int c;
                     ...
                     while(1)
                       {/* exit if user pressed Control-BREAK */
                        if(SioBrkKey())
                          {puts("User typed Contrl-BREAK");
                           SioDone(Port);
                           exit(1);
                          }
                        /* transmit any typed character */
                        if(SioKeyPress())
                          {c = SioKeyRead();
                           SioPutc(Port,c);
                          }
                        /* display any incoming character */
                        c = SioGetc(Port,0);
                        if(c!=-1)  SioCrtWrite(c);
                       }

         See Also    SioBrkSig






















        PCL4C Reference Manual                                 Page 5
                                  SioBrkSig



         Function    Asserts, cancels, or detects BREAK signal.

           Syntax    int SioBrkSig(Port,Cmd)
                     int Port;      /* Port selected (COM1 thru COM4) */
                     char Cmd;      /* ASSERT, CANCEL, or DETECT */

          Remarks    The SioBrkSig function controls the BREAK bit  in  the
                     line status register. The legal commands are:

                     ASSERT_BREAK ('A') to assert BREAK
                     CANCEL_BREAK ('C') to cancel BREAK
                     DETECT_BREAK ('D') to detect BREAK

                     ASSERT_BREAK,   CANCEL_BREAK,   and  DETECT_BREAK  are
                     defined in PCL4C.H. See TERM.C for an example  of  the
                     use of SioBrkSig.

          Returns    -2 : Port not enabled. Call SioReset first.
                     -4 : No such port. Expect 0 to MaxPort.
                     -6 : Illegal command. Expected 'A', 'C', or 'D'.
                     >0 : BREAK signal detected (DETECT command only)

          Example    /* Assert BREAK for 1 second */
                     SioBrkSig(Port,ASSERT_BREAK);
                     SioDelay(18);
                     SioBrkSig(Port,CANCEL_BREAK);
                     /* Detect BREAK */
                     if(SioBrkSig(Port,DETECT_BREAK))
                       {puts("BREAK signal detected");
                        /* ...do some more stuff... */
                       }

         See Also    SioBrkKey






















        PCL4C Reference Manual                                 Page 6
                                  SioCrtWrite



         Function    Write character to the screen.

           Syntax    int SioCrtWrite(ch)
                     char ch;        /* character to write */

          Remarks    The  SioCrtWrite  function  uses  the  BIOS to write a
                     single character to the screen at the  current  cursor
                     location.

                     SioCrtWrite   calls  the  BIOS  directly  without  any
                     intermediate buffering or processing.  It  is  usually
                     faster than a call to the C library.

          Returns    zero

          Example    /* wait up to 1 second (18 tics) for character */
                     if( (c = SioGetc(COM1,18)) != -1)
                       {/* echo to screen */
                        SioCrtWrite(c);
                       }

         See Also    SioKeyPress and SioKeyRead

































        PCL4C Reference Manual                                 Page 7
                                  SioCTS



         Function    Reads the Clear to Send (CTS) modem status bit.

           Syntax    int SioCTS(Port)
                     int Port;   /* Port selected (COM1 thru COM4) */

          Remarks    The  SioCTS function is used to read the Clear to Send
                     (CTS) modem status bit.

                     The  CTS  line is used by some error correcting modems
                     to implement hardware flow control.  CTS is dropped by
                     the modem to signal the computer not to send data, and
                     is raised to signal the computer to continue.

                     Refer to the User's Manual for a  discussion  of  flow
                     control.

          Returns    -2 : Port not enabled. Call SioReset first.
                     -4 : No such port.  Expect 0 to MaxPort.
                      0 : CTS is clear.
                     >0 : CTS is set.

          Example   /* wait for CTS to go active */
                     while(1)
                       {if(SioCTS(Port)) break;
                        if(SioBrkKey())
                           {puts("Aborted by user");
                            SioDone(Port);
                            exit(1);
                           }
                       }
                     /* now we can send the character */
                     SioPutc(Port,ch);

         See Also    SioFlow, SioDSR, SioRI, SioDCD, and SioModem.














⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -