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

📄 cport.doc

📁 C语言开发串行通讯程序库
💻 DOC
字号:






            Cport

            Serial Communications Library for C/C++
            Version 2.0







   Copyright (c) 1993  Bri Productions - all rights reserved

   Cport is a registered trademark of Bri Productions. All other product and
   brand names are trademarks or registered trademarks of their respective
   holders.

                                 i


Contents
========

   Introduction
   ------------
      General Description ............................. 1-1
      Disclaimer ...................................... 1-2
      Evaluation Copy ................................. 1-2
      Purchase Version ................................ 1-2
      Contacting  Bri Productions ..................... 1-2
      Terminology ..................................... 1-3

   Using Cport
   -----------
      Basics .......................................... 2-1
      Buffered Input .................................. 2-3
      Buffered Output ................................. 2-5
      Handshaking ..................................... 2-7
      Direct Transmit Mode ............................ 2-10

   Theory of Operation
   -------------------
      The UART ........................................ 3-1
      The Transmitter and Receiver .................... 3-1
      The Transmit and Receive Queues ................. 3-2
      Input and Output Functions ...................... 3-2
      Control and Status Functions .................... 3-2
      Direct Transmit mode ............................ 3-2

   C Reference
   -----------
      Typedefs and Structures ......................... 4-1
         COM .......................................... 4-2
         CPARAM ....................................... 4-2
         byte ......................................... 4-3

      Global Variables ................................ 4-4
         comopen_errno ................................ 4-4

      Control Functions ............................... 4-5
         ComOpen ...................................... 4-6
         ComOpenS ..................................... 4-8
         ComClose ..................................... 4-8
         ComCloseAll .................................. 4-9
         ComHandshake ................................. 4-9
         ComParam ..................................... 4-10
         ComBaud ...................................... 4-11
         ComMode ...................................... 4-12
         ComRxQ ....................................... 4-13
         ComTxQ ....................................... 4-14
         ComTx ........................................ 4-15
         ComNS550 ..................................... 4-15
         ComTurbo ..................................... 4-16

                                 ii


      Input Functions ................................. 4-18
         ComGetc ...................................... 4-19
         ComGets ...................................... 4-19
         ComIn ........................................ 4-20
         ComFlushRx ................................... 4-21
         ComLenRx ..................................... 4-22
         ComPeek ...................................... 4-22
         ComRxScan .................................... 4-23

      Output Functions ................................ 4-25
         ComPutc ...................................... 4-26
         ComPuts ...................................... 4-26
         ComOut ....................................... 4-27
         ComFlushTx ................................... 4-28
         ComLenTx ..................................... 4-29
         ComTxWait .................................... 4-29

      Status Functions ................................ 4-31
         ComError ..................................... 4-32
         ComStatus .................................... 4-33
         ComRts ....................................... 4-33
         ComDtr ....................................... 4-34
         ComOut1 ...................................... 4-35
         ComUart ...................................... 4-35

      Data Integrity .................................. 4-37
         ComChecksum .................................. 4-38
         ComCrc16 ..................................... 4-38
         ComCrc32 ..................................... 4-39

      Misc Functions .................................. 4-41
         ComSetBreak .................................. 4-42
         ComClrBreak .................................. 4-42
         ComPutScrtch ................................. 4-43
         ComGetScrtch ................................. 4-43

   C++ Reference
   -------------
      Control Functions ............................... 5-1
         Cport::Cport ................................. 5-2
         Cport::operator int .......................... 5-4
         Cport::Handshake ............................. 5-5
         Cport::Param ................................. 5-6
         Cport::Baud .................................. 5-6
         Cport::Mode .................................. 5-7
         Cport::RxQ ................................... 5-8
         Cport::TxQ ................................... 5-9
         Cport::Tx .................................... 5-10
         Cport::NS550 ................................. 5-10
         Cport::Turbo ................................. 5-11

                                 iii


      Input Functions ................................. 5-13
         Cport::Get ................................... 5-14
         Cport::In .................................... 5-15
         Cport::FlushRx ............................... 5-16
         Cport::LenRx ................................. 5-17
         Cport::Peek .................................. 5-17
         Cport::RxScan ................................ 5-18

      Output Functions ................................ 5-19
         Cport::Put ................................... 5-20
         Cport::Out ................................... 5-21
         Cport::FlushTx ............................... 5-22
         Cport::LenTx ................................. 5-22
         Cport::TxWait ................................ 5-23

      Status Functions ................................ 5-24
         Cport::Error ................................. 5-25
         Cport::Status ................................ 5-25
         Cport::Rts ................................... 5-26
         Cport::Dtr ................................... 5-27
         Cport::Out1 .................................. 5-28
         Cport::Uart .................................. 5-28

      Data Integrity .................................. 5-29
         Cport::Checksum .............................. 5-30
         Cport::Crc16 ................................. 5-30
         Cport::Crc32 ................................. 5-31

      Misc Functions .................................. 5-33
         Cport::SetBreak .............................. 5-34
         Cport::ClrBreak .............................. 5-34
         Cport::Scratch ............................... 5-35

   File Transfer
   -------------
      Xmodem .......................................... 6-1
      XmodemTx ........................................ 6-2
      XmodemRx ........................................ 6-3
      Xcallback ....................................... 6-4
      Callback Function ............................... 6-5
      Xmodem Tables of Values ......................... 6-7

   Appendix
   --------
      Appendix A - Tables of Values ................... A-1
      Appendix B - Compiling and Linking .............. B-1
      Appendix C - Order form ......................... C-1

                                 1-1


Introduction
============

   General Description
   -------------------
      Cport is a general purpose C/C++ serial communications library for
      80x86 Intel processor-based systems and the National Semiconductor
      family of UARTs. This includes IBM and compatible computers and
      potentially 80x86 processor-based embedded applications. The latter
      is usually possible with few no modifications.

      Cport features:
         

⌨️ 快捷键说明

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