home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-07-31 | 85.5 KB | 2,041 lines |
-
-
- Personal Communications Library
-
- For Windows
-
-
- (PCL4W)
-
-
-
- USERS MANUAL
-
-
-
-
-
- Version 1.1
-
- August 1, 1994
-
-
-
-
- This software is provided as-is.
- There are no warranties, expressed or implied.
-
-
-
-
- Copyright (C) 1994
- 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
-
-
- _______
- ____|__ | (R)
- --+ | +-------------------
- | ____|__ | Association of
- | | |_| Shareware
- |__| o | Professionals
- --+--+ | +---------------------
- |___|___| MEMBER
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 1
- C O N T E N T S
-
-
-
-
-
- Chapter Page
-
- 1.0 Introduction................................................3
- 1.1 User Support............................................4
- 1.2 ASP Ombudsman...........................................4
- 1.3 A Typical Application...................................5
- 1.4 Installation............................................6
- 2.0 Library Organization........................................7
- 2.1 Configuration...........................................7
- 2.2 Initialization & Termination............................7
- 2.3 Modem Control & Status..................................8
- 2.4 Serial I/O..............................................8
- 2.5 Error Detection.........................................9
- 2.6 General Support.........................................9
- 3.0 Library Overview...........................................10
- 3.1 Dynamic Link Libraries.................................10
- 3.2 DOS Protected Mode Interface...........................10
- 3.3 Memory Models..........................................10
- 3.4 Using the Library......................................10
- 3.5 Example Programs.......................................11
- 3.6 Making the Library.....................................11
- 4.0 Talking to Your Modem......................................12
- 4.1 Modem Standards........................................12
- 4.2 Flow Control...........................................13
- 4.3 MODEM_IO Functions.....................................13
- 4.4 Modem Initialization...................................14
- 5.0 Problems...................................................15
- 6.0 Serial Communications......................................16
- 6.1 Communications Basics..................................16
- 6.2 Standard Port Addresses................................17
- 6.3 Running 3 or 4 Ports Concurrently......................18
- 6.4 Using Multiport Boards.................................19
- 6.4.1 Using the Digiboard..............................19
- 6.4.2 Using the BOCA board.............................19
- 6.5 Transmitter Interrupts.................................20
- 6.6 RS232 Signals..........................................21
- 6.7 National INS8250, INS16450, and INS16550 UARTs.........22
- 6.8 Register Summary.......................................23
- 7.0 Example Programs...........................................25
- 7.1 SIMPLE.C...............................................25
- 7.2 TERM.C.................................................26
- 8.0 Legal Issues...............................................27
- 8.1 Registration...........................................27
- 8.2 License................................................28
- 8.3 Warranty...............................................28
- 9.0 Summary....................................................29
- 9.1 Revision History.......................................29+
- 9.2 Function Summary.......................................29
- 9.3 Further Reading........................................29
- 10.0 Other MarshallSoft Computing products for C................30
- 10.1 The LZW Data Compression Library for Windows...........30
- 10.2 The Personal Communications Library for C..............30
- 10.3 The LZW Data Compression Library for C.................30
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 2
- 1.0 Introduction
-
-
- The Personal Communications Library for Windows (PCL4W) is an asynchronous
- communications dynamic link library (DLL) for software developers using the
- Microsoft Windows 7.0 (or higher) compiler and Windows 3.1 Software
- Development Kit (SDK) or the Borland 3.1 (or higher) windows development
- environment. A 80386 machine or higher is recommended.
-
-
- o 30+ communications functions.
- o Supports the high performance INS16550 UART.
- o Supports the PC/4 and PC/8 DigiBoard.
- o Supports the BOCA BB1004, BB1008, and BB2016 boards.
- o Supports hardware (RTS/CTS) flow control.
- o Interrupt driven receiver & (optionally) transmitter.
- o Supports 300 baud to 115,200 baud.
- o Supports COM1 through COM16.
- o Adjustable queues from 8 bytes to 32 KB.
- o Control-BREAK error exit.
- o 18 communications error conditions trapped.
- o Allows 4 ports to run concurrently (more with Digi/BOCA board).
- o Complete modem control & status.
- o Written in assembly language for small size & high speed.
- o Terminal program featuring ASCII (with XON/XOFF), XMODEM,
- YMODEM, & YMODEM-G.
-
-
- Why should you buy PCL4W? Consider the following:
-
- COMPLETE : PCL4W is complete since it provides absolute control of the
- serial ports (including the high performance INS16550).
-
- COMPACT : PCL4W is very compact at less than 6 KB. Your application
- doesn't carry a lot of excess code.
-
- FAST : PCL4W is fast. It will run at 115200 baud on all 80386 and
- up machines.
-
- SUPPORT : If you get stuck, you will talk to the programmer that
- wrote the code, not a person hired to answer the phone.
-
- BBS : A user support BBS is available (2400 to 9600 baud, N81) in
- order to provide immediate support as necessary.
-
- NEWSLETTER : One year subscription to the MSC newsletter discussing
- communications problems and solutions (published quarterly).
-
- PRICE : You get PCL4W for a very reasonable price !
-
- UPGRADES : Once you buy PCL4W, you can always update to the most recent
- version for a very reasonable cost.
-
- COMPATIBLE : PCL4W is call for call compatible with the MSDOS based
- version PCL4C except for two functions in which delay times
- are no longer necessary.
-
-
- Our goal is to provide a robust serial communications library that that you
- and your customers can depend upon.
-
-
-
-
-
-
-
- PCL4W Users Manual Page 3
- 1.1 User Support
-
-
- We want you to be successful in developing your applications using PCL4W! We
- depend on our customers to let us know what they need in a communications
- library. This means we are committed to providing the best communications
- library that we can. If you have any suggestions or comments, please let us
- know.
-
- If you are having a problem using PCL4W, call us at 205-881-4630 between
- 1:30PM and 9:30PM CST Monday through Friday. We are also usually in the
- office most mornings and Saturday afternoon.
-
- You can also FAX us at the same telephone number at any time (24
- hours). You can also call at other times and leave a message, and call back
- later for a reply. However, we can only answer questions with respect to
- using the PCL4W library. We cannot help you program your application.
-
- You may also call our User Support BBS (2400 to 9600 baud, no parity, 8 data
- bits, 1 stop bit) at 205-880-9748 and leave a message (address it to the
- SYSOP). We will usually have a reply ready for you within 24 hours.
-
- The BBS is available 24 hours per day except at 2 PM Sundays for
- maintenanace. All files are in standard ZIP format. The BBS will contain the
- latest shareware version of all MarshallSoft products as well as related
- files such as:
-
- BUGS.ZIP: Bug report.
- NEWS.ZIP: Latest news regarding our products.
-
- The MarshallSoft Computing, Inc. newsletter "Comm Talk" is published
- quarterly. It discusses various communications problems and solutions using
- PCL4W as well as related information. Registered users receive a one year
- complimentary subscription when first registering and for each update
- purchased.
-
- Of course, you can always write to us. You should receive a reply within a
- week or so. Please don't mail hardware without first talking to us.
-
-
- 1.2 ASP Ombudsman
-
-
- MarshallSoft Computing, Inc. is a member of the Association of Shareware
- Professionals (ASP). ASP wants to make sure that the shareware principle
- works for you. If you are unable to resolve a shareware-related problem
- with an ASP member by contacting the member directly, ASP may be able to
- help. The ASP Ombudsman can help you resolve a dispute or problem with an
- ASP member, but does not provide technical support for members' products.
- Please write to the ASP Ombudsman at 545 Grover Road, Muskegon, MI USA
- 49442-9427, Fax 616-788-2765, or send a CompuServe message via CompuServe
- Mail to ASP Ombudsman 70007,3536.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 4
- 1.3 A Typical Application
-
-
- In general, there are two classes of applications that use a communications
- library like PCL4W: those that use a modem to connect to the outside world
- and those that connect directly to a peripheral device. In either case, a
- typical application program using PCL4W might consist of 3 phases:
- initialization, execution, and termination. The following code segment
- assumes a knowledge of the windows API.
-
- In the following code sgment, SioRxBuf is called to set up the a 1024 byte
- receive buffer; SioParms is called to set up the parity, stop bit count, and
- word length; SioReset is called to set the baud rate to 9600 and reset the
- UART (Univeral Asynchronous Receiver / Transmitter).
-
-
- case WM_CREATE:
- /* initialization */
- SioRxBuf(Port,RxBuffer,Size1024);
- SioParms(Port,NoParity,OneStopBit,WordLength8);
- SioReset(Port,Baud9600);
-
-
- If you are using the version of the library with transmitter interrupts
- enabled (PCL4W2.LIB), then SioTxBuf() must be called to set up the
- transmitter buffer. The transmit buffer must be distinct from the receive
- buffer.
-
-
- case WM_CREATE:
- /* initialization */
- SioRxBuf(Port,TxBuffer,Size1024);
- SioTxBuf(Port,RxBuffer,Size1024);
- SioParms(Port,NoParity,OneStopBit,WordLength8);
- SioReset(Port,Baud9600);
-
-
- Characters can be transmitted and received once the required port is
- initialized. Before leaving your application, SioDone is called to restore
- the prior state of the serial communications system. Forgetting to call
- SioDone before exiting your application will leave the interrupt system in
- an unusable state and the machine will have to be re-booted.
-
-
- case WM_DESTROY:
- /* termination */
- SioDone(Port);
-
-
- If you are using a modem, you also need to be concerned about initializing
- your modem correctly and handling any required flow control. Refer to the
- "Talking to Your Modem" chapter for detailed information.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 5
- 1.4 Installation
-
-
- (1) Before installation of PCL4W , your Windows C compiler should already be
- installed on your system and tested. If you are not familiar with makefiles,
- refer to your compiler manual. Examine the file "FILES.LST" for a list of
- the distribution files.
-
- (2) Make a backup copy of your distribution disk. Put your original
- distribution disk in a safe place.
-
- (3) Create a work directory on your work disk (normally your harddisk). For
- example, to create a work directory named PCL4W, we first log onto the work
- disk and then type:
-
- MKDIR PCL4W
-
- (4) Copy all the files from your backup copy of the distribution disk to
- your work directory. For example, to copy from the A: drive to your work
- directory, we type:
-
- CD PCL4W
- COPY A:*.*
-
- (5) Compile SIMPLE.C and link with the PCL4W library (PCL4W.LIB).
-
- Makefiles are provided for each of the supported compilers. If you are
- unfamiliar with makefiles, please consult your compiler manual. After
- compiling with the provided makefiles, you can convert to a Microsoft
- Workbench or Borland Integrated Development Environment project file if you
- wish. Compile as follows (use NMAKE not MAKE in (a) below):
-
- (a) Microsoft C: Type NMAKE SIMPLE._M_
-
- (b) Borland C: Type MAKE -fSIMPLE._B_
-
- SIMPLE.C should compile and link without any problems.
-
- (6) The recommended way to test SIMPLE is to run it on two computers
- connected by a null modem cable. Whatever is typed on one computer should
- be displayed on the other. If you don't have two computers, you can use
- SIMPLE to talk to your modem. Sending an "AT" to the modem should result in
- an "OK" being sent back.
-
- (7) If you have downloaded the TERM test program (WTERM11.ZIP), be sure to
- create a separate directory and copy all TERM files into it. The TERM
- program uses some functions of enhanced capability with the same name as
- used by the SIMPLE program.
-
- Once you have become familiar with the PCL4W files and have compiled and
- tested SIMPLE, you may want to re-organize your files into sub-directories.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 6
- 2.0 Library Organization
-
-
- The PCL4W library is organized into six categories of functions. Refer to
- the PCL Reference Manual (PCL4W.REF) for details on individual functions.
-
-
- 2.1 Configuration
-
-
- There are three functions in the configuration category. SioPorts sets the
- number of PC and DigiBoard / BOCA ports. SioUART is used to change the
- UART base address for a communications port to a non-standard address, while
- SioIRQ is used to assign a nonstandard IRQ line to a port. (See the chapter
- IBM Communications Ports for more details on standard UART addresses and IRQ
- lines).
-
- The configuration functions SioPorts, SioUART and SioIRQ must be called
- before calling any other library functions. Be very careful when using
- these functions. Remember that your serial hardware must support the UART
- and IRQ that you specify. Always test any new configuration immediately.
-
- SioPorts : Sets number of PC and DigiBoard / BOCA ports.
- SioUART : Sets the UART base address.
- SioIRQ : Assigns an IRQ line to a port.
-
- THE IRQ GOLDEN RULE: You may open (via SioReset) only one port per IRQ
- (except for the DigiBoard / BOCA board).
-
-
- 2.2 Initialization & Termination
-
-
- There are nine functions in the initialization and termination category.
- Together, SioGetDiv, SioFIFO, SioRxBuf, SioTxBuf, and SioReset initialize
- your serial communications system. Your application must call SioParms and
- SioRxBuf before calling SioReset, and SioReset must be called before any
- serial I/O processing can be done.
-
- After initialization, SioParms and SioBaud can be called again to change the
- communications parameters without resetting the serial port. SioFlow can be
- called to enable hardware flow control.
-
- Before exiting from your application, SioDone must be called. Failure to
- call SioDone can crash your system later.
-
- SioRxBuf : Sets up receive buffer.
- SioTxBuf : Sets up transmitter buffer.
- SioFIFO : Sets the interrupt level for the INS16550.
- SioParms : Sets parity, stop bits, and word length.
- SioReset : Initialize a serial port for processing.
- SioDone : Terminates further serial processing.
- SioBaud : Sets the baud rate of the selected port.
- SioFlow : Enables / disables flow control.
- SioGetDiv : Gets the baud rate divisor.
-
-
-
-
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 7
- 2.3 Modem Control & Status
-
-
- There are eight functions in the modem control and status category which
- provide your application with complete control over the status and control
- bits of your modem.
-
- There are two modem control bits, "Data Terminal Ready" (DTR) and "Request
- To Send" (RTS). These bits can be read, set, or cleared by SioDTR and
- SioRTS.
-
- There are four modem status bits, "Data Set Ready" (DSR), "Clear To Send"
- (CTS), "Ring Indicator" (RI), and "Data Carrier Detect" (DCD). SioModem can
- read any of the modem status bits. SioDSR, SioCTS, SioRI, and SioDCD can
- only read their respective modem status bit.
-
- Refer to the chapter entitled "RS232 Signals" for a discussion of each of
- the control and status bits.
-
- SioDTR : Set, clear, or read the Data Terminal Ready (DTR) bit.
- SioRTS : Sets, clears, or reads the Request to Send (RTS) line.
- SioModem : Reads the modem status register.
- SioDSR : Reads the Data Set Ready (DSR) modem status bit.
- SioCTS : Reads the Clear to Send (CTS) modem status bit.
- SioDCD : Reads the Data Carrier Detect (DCD) modem status bit.
- SioRI : Reads the Ring Indicator (RI) modem status bit.
- SioRead : Reads the contents of the 7 UART registers.
-
-
- 2.4 Serial I/O
-
-
- There are eight library functions in the serial I/O category. Together,
- these functions give the programmer complete control over serial I/O. Higher
- level functions such as protocols and smart modem communications can be
- completely implemented in terms of these functions. Refer to the example
- code.
-
- SioGetc and SioPutc perform all the actual serial I/O. SioUnGetc "ungets"
- the last serial byte read. SioRxFlush clears the receive queue while
- SioTxFlush clears the transmit queue. SioLine can be used to test for UART
- errors. SioRxQue returns the number of bytes in the receive queue while
- SioTxQue returns the number of bytes in the transmit queue.
-
- SioGetc : Reads the next character from the serial line.
- SioPutc : Transmit a character over a serial line.
- SioUnGetc : "Un:gets" (puts back) a specified character.
- SioRxFlush : Flush (clears) the receive buffer.
- SioRxQue : Returns the number of characters in the RX queue.
- SioTxFlush : Flush (clears) the transmit buffer.
- SioTxQue : Returns the number of characters in the TX queue.
- SioLine : Reads the line status register.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 8
- 2.5 Error Detection
-
-
- There are two functions in the error detection category. They are concerned
- with detecting or reporting communications errors. Use of these functions
- can make your application significantly more robust.
-
- SioBrkSig can read or modify the UART break bit. This is useful for
- signalling the remote system that a fatal condition has occurred.
- SioLoopBack can be used to test the integrity of your UART.
-
- There is also a file SIOERROR.C which contains the function SioError which
- displays a error message corresponding to an error code returned from a
- PCL4W function (every PCL4W function returns a code).
-
- SioBrkSig : Asserts, cancels, or detects the RS232 BREAK signal.
- SioError : Displays error in text.
- SioLoopBack : Performs a UART loopback test.
-
-
- 2.6 General Support
-
-
- There is one function in the general support category. SioInfo returns the
- version number of the library and whether transmitter interrupts are
- enabled.
-
- SioInfo : Returns the library version & memory model.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 9
- 3.0 Library Overview
-
-
- 3.1 Dynamic Link Libraries
-
-
- PCL4W is provided as a dynamic link library (DLL). A DLL is characterized by
- the fact that it need not be loaded until required by an application program
- and that only one copy of the DLL is necessary regardless of the number of
- application programs that use it. Contrast this to the traditional static
- library which is bound to each and every application that uses it at link
- time.
-
- Since PCL4W is a DLL, only one copy of the PCL4W code & data is loaded into
- memory regardless of the number of applications programs that use it.
-
- For example, more than one instance of the test program simple can be
- started. All copies of SIMPLE can run concurrently as long as each uses a
- different COM port.
-
-
- 3.2 DOS Protected Mode Interface
-
-
- Windows itself uses what is known as the "DOS Protected Mode Interface"
- (DPMI) to control changing states (protected vs real), controlling the
- interrupt system, etc. This is necessary because Windows itself typically
- runs in a protected state and must change to real state in order to use
- MSDOS services.
-
- The PCL4W library uses this same DPMI mechanism. In particular, the file
- USE_DPMI.ASM contains the necessary functions for using DPMI. The developer
- should not modify USE_DPMI.ASM in any way.
-
-
- 3.3 Memory Models
-
-
- Most windows programs are small or medium memory model programs since these
- memory models are limited to one data segmnemt. However, all PCL4W
- functions are FAR functions, so they can be used with any memory model.
- Thus, there is just one PCL4W.DLL and PCL4W.LIB regardless of the memory
- model used.
-
-
- 3.4 Using the Library
-
-
- The PCL4W has been tested on a TANDY 3000 (80286 IBM AT clone), a Gateway
- 2000 25 MHZ 80386-DX, and a Gateway 2000 66MHZ 80486-DX2.
-
- Please examine the PCL4W.H file. Note that COM1 is defined as port zero, not
- port one. The user must assume the responsibilty for passing the correct
- information when calling PCL4W functions.
-
- If there are any conflicts between PCL4W definitions and those in other
- libraries, the PCL4W definitions can be changed in the PCL4W.H file and any
- file that uses the definition. There is no change necessary for the library
- code itself.
-
- If you write an application using the PCL4W library, don't run another
- application that uses the same communications port.
-
-
-
-
-
- PCL4W Users Manual Page 10
- 3.5 Example Programs
-
-
- Two communications programs are provided as a demonstration of the PCL4W
- library: SIMPLE and TERM.
-
- SIMPLE is provided as the easiest example of communications programming
- using PCL4W. The user should compile and link SIMPLE.C as a test of the
- library.
-
- If you have two computers, connect them together with a null modem cable and
- run SIMPLE on both machines. The baud rate in SIMPLE is hard coded to 2400
- baud. It is easily changed in the source code. Start SIMPLE by typing SIMPLE
- followed by the port.
-
- The TERM program is a more capable terminal emulator than SIMPLE. It
- features modem initialization, hardware flow control, and state driven file
- transfer using ASCII, XMODEM, and YMODEM, communications protocols. TERM
- can be used to call up any bulletin board system, including the MarshallSoft
- Computing BBS.
-
- Refer to the sections on SIMPLE and TERM in this manual for more detailed
- information.
-
-
- 3.6 Making the Library
-
-
- Registered users may wish to assemble PCL4W.ASM. Use the /MX switch in
- order to disable automatic conversion from lower case to upper case. If the
- /MX switch is not used, then all PCL4W function references in C code must be
- in upper case. To assemble using the Microsoft assembler, use the provided
- makefile "PCL4W.MAK". Type
-
- nmake pcl4w.mak
-
- Two libraries are made, one with transmitter interrupts disabled (PCL4W1)
- and one with transmitter interrupts enabled (PCL4W2). Most users should use
- the library without transmitter interrupts enabled since they require less
- overhead.
-
- To use the PCL4W library without transmitter interrupts enabled, type
-
- copy pcl4w1.lib pcl4w.lib
- copy pcl4w1.dll pcl4w.dll
-
- To use the PCL4W library with transmitter interrupts enabled, type
-
- copy pcl4w2.lib pcl4w.lib
- copy pcl4w2.dll pcl4w.dll
-
-
- After creating PCL4W.LIB and PCL4W.DLL, the example programs can be compiled
- and linked. Refer to the section "Example Programs".
-
-
-
-
-
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 11
- 4.0 Talking to Your Modem
-
-
- A modem is used to extend the distance over which you may communicate.
- Without a modem, your RS232 cable is limited to a maximum of approximately
- 50 feet. But with a modem, you can communicate literally around the world.
-
-
- 4.1 Modem Standards
-
-
- Two modems can communicate over a telephone line only if they are both using
- the same signaling frequencies and modulation, which are determined by the
- the modem standards used. Modem standards can be divided into three sets:
- (1) speed, (2) data compression used, and (3) error control.
-
- The Bell standards (103 & 212A) are those of AT&T. The CCITT (The
- International Consultative Committee for Telephone and Telegraph) standards
- are designated as "V. ".
-
-
- Speed
-
-
- Bell 103 : 300 baud
- Bell 212A : 1200 baud
- V.21 : 300 baud
- V.22bis : 1200 & 2400 baud
- V.32 : 4800 & 9600 baud
- V.32bis : 4800, 7200, 9600, 12000, and 14400 baud
-
-
- Data Compression
-
-
- MNP 5 : Microcom Networking Protocol (proprietary).
- V.42bis : International data compression standard.
-
-
- Error Control
-
-
- MNP 2,3,4 : Three level error correction (public domain).
- V.42 : International error correction standard.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 12
- 4.2 Flow Control
-
-
- With modems using data compression, the modem to modem connection will run
- at various speeds depending on the quality of the line. The computer to
- modem connection will be at a fixed baud rate. Therefore, a protocol (flow
- control) is necessary to synchronize the data flow between and modems and
- the computer to modem connection. Refer to your modem manual for
- information on flow control protocols supported.
-
- Two flow control protocols are used by most all modems which require flow
- control. Software flow control is called "XON/XOFF" (other software flow
- control character pairs are defined but operate the same as XON/XOFF) and
- hardware flow control is called "RTS/CTS". Most modems which require flow
- control enable hardware flow control by default.
-
- In XON/XOFF (software) flow control, the computer suspends transmitting data
- if it receives a XOFF character (13 hex) from the modem, and continues
- transmitting when it receives a XON character (11 hex). Similiarly, the
- computer can signal the modem not to send any more data by transmitting a
- XOFF to it, and can tell the modem to continue transmission be sending a
- XON.
-
- In RTS/CTS (hardware) flow control, the RTS line is used by the computer to
- signal the modem , while the CTS line is used by the modem to signal the
- computer. The RTS line is set OFF by the computer to tell the modem to
- suspend transmission, and set to ON to tell the modem to continue
- transmission. The CTS line is set to OFF by the modem to tell the computer
- to stop transmitting, and set to ON to tell the computer to continue
- transmitting.
-
- Given the choice, always choose hardware flow control over software flow
- control so that all data transmission is transparent. If hardware flow
- control is not the default (which it almost always is), you should modify
- your modem initialization string to turn hardware flow control on.
-
-
- 4.3 MODEM_IO Functions
-
- The file MODEM_IO.C contains several state driven functions that ease
- communicating with your modem. Look in the TERM.C code for examples of their
- use.
-
- ModemSendTo : Sends string to modem.
- ModemQuiet : Waits for continuous quiet.
- ModemWaitFor : Waits for particular string from modem.
- ModemHangup : Hangs up modem.
- ModemDriver : State Driver for the above functions.
-
- ModemResult : Gets result of last completed WaitFor.
- ModemFunction : Gets last MODEM_IO function.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 13
- 4.4 Modem Initialization
-
-
- If your application uses a modem (as opposed to using a null modem cable),
- then you should always send an initialization string to your modem if it is
- a programmable modem such as those made by Hayes. Communication programs
- such as PROCOMM and TELIX always send such a string automatically as soon as
- they start up.
-
- The particular initialization string depends on the make of your modem. For
- Hayes and Hayes AT command set compatible modems, the following string
- (followed by a carriage return) should work:
-
- AT E1 S7=60 S11=60 V1 X1 Q0 S0=0
-
- Refer to your Modem User's Guide for a full discussion of these commands. A
- brief description is as follows:
-
- AT Modem attention command.
- E1 Modem will echo what you send to it.
- S7=60 Wait 60 seconds for carrier and/or dial tone.
- S11=60 Use 60 milliseconds for tone dialing duration & spacing.
- V1 Display result code as words (not numbers).
- X1 Use the extended result message (CONNECT XXXX) set.
- Q0 Modem returns result codes.
- S0=0 Do not answer RING.
-
- If your application will answer incoming calls, then set the S0 register to
- the ring on which to automatically answer.
-
- If you send the above codes by using SioPutc (as opposed to typing them from
- the keyboard), then follow these guidelines:
-
- (1) Send an initial carriage return before the initialization string.
-
- (2) Pause at least 150 milliseconds after each character sent as your modem
- needs the time to perform its own internal processing. Pause a little longer
- if your modem is not accepting your initialization string.
-
- (3) Pause one and a half seconds after sending any initialization command
- such as ATZ or AT&F since your modem must do quite a bit of processing.
-
- If you experience any problems in initializing your Hayes modem, you should
- first reset it to factory settings by sending:
-
- AT&F
-
- Refer to the TERM program (function SendToModem in the file MODEM_IO.C) for
- an example of sending an initialization string to a Hayes compatible modem.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 14
- 5.0 Problems
-
-
- If you cannot get your application to run properly, first compile and run
- the terminal emulator program SIMPLE provided on your distribution disk.
- Test SIMPLE by connecting two computers with a null modem cable or by
- commanding a Hayes AT command set compatible modem.
-
- Once SIMPLE runs, compile and run the TERM program. If you are using a null
- modem cable or a non-programmable modem, be sure to set the HAYES constant
- to 0 in the source code (#define AT_COMMAND_SET 0). If you are using a Hayes
- compatible modem, set the AT_COMMAND_SET constant to 1. If you are using a
- programmable modem which is not Hayes compatible, then you must modify the
- initialization string for your particular modem.
-
- If your application does not run but TERM runs correctly, then you have most
- likely made a programming mistake in your application. MarshallSoft
- Computing cannot debug your application, especially over the telephone!
- However, consider each of the following when searching for an error in your
- application.
-
- 1. Have you included the file PCL4W.H in your application ?
-
- 2. Is your receive buffer large enough ? If you are using 1K data blocks in
- YMODEM, then your receive buffer should be at least 1K (2K if baud rates
- above 19200 are to be used).
-
- 3. Have you selected too high a baud rate? Windows can multitask many tasks
- at once. You may have to lower your baud rate (or get 16550 UARTS).
-
- 4. If you are running two COM ports simultaneously, are you using separate
- receive and transmits buffers ? (you should).
-
- 5. Did SioReset return a zero value ? If not, then you must call SioReset
- again. See TERM.C for an example.
-
- 6. Did you send the proper initialization string to your modem ? Did you
- set DTR and RTS ? (you should).
-
- 7. Do you have more than one COM1 port? For example, if you have a COM1
- port on your motherboard, you cannot add another COM1 port or modem board
- that uses COM1 without first disabling the COM1 on the motherboard.
-
- 8. Is your IRQ set correctly? If you can transmit data but can't receive
- using the PCL4W library with transmitter interrupts disabled (PCL4W2), then
- this usually means that interrupts are not working.
-
- We recommend the following steps if you believe that you have discovered a
- bug in the library:
-
- (1) Create the smallest, simpliest test program possible that demonstates
- the problem.
-
- (2) Document your exact machine configuration and what error the test
- program demonstates.
-
- (3) Upload the example source to our user support BBS or mail us a disk.
-
- If the problem can be solved with an easy work-around, we will publish the
- work-around. If the problem requires a modification to the library, we will
- make the change and make the modified library available to our customers
- without charge.
-
-
-
-
-
- PCL4W Users Manual Page 15
- 6.0 Serial Communications
-
- 6.1 Communications Basics
-
-
- The heart of serial communications is the UART (Universal Asynchronous
- Receiver Transmitter). The IBM PC/XT/AT and compatibles use the 8250,
- 16450, or the 16550 UART. The purpose of the UART is:
-
- (1) To convert bytes from the CPU (Central Processing Unit), into a serial
- format by adding the necessary start, stop, and parity bits to each byte
- before transmission, and to then transmit each bit at the correct baud rate.
-
- (2) To convert the incoming stream (at a specified baud rate) of serial bits
- into bytes by removing the start, stop, and parity bits before being made
- available to the CPU.
-
- The UART is part of the serial interface circuitry which allows the CPU to
- send and receive signals over the RS232 lines. This can be diagrammed as
- follows:
-
-
-
- Serial Interface
- +-------------------+
- | |
- +-----+ Data Bus | +------+ | RS232 Signals
- | CPU +------------+ | UART | +----------------*
- +-----+ | +------+ |
- | |
- +-------------------+
-
-
-
- The 8250/16450/16550 UART is capable of operating in one of two modes,
- "polled" and "interrupt driven". The serial communications functions in the
- BIOS uses the polled method. In this approach, the CPU is typically in a
- loop asking the UART over and over again if it has a byte ready. If its
- does, the polling code returns the byte. But, if the next byte comes in
- before the polling code is executing again, then that byte is lost.
-
- In the interrupt driven approach (used by PCL4W), when a byte is received by
- the UART, an "Interrupt Service Routine" (ISR) is executed immediately,
- suspending temporarily whatever else is executing. The ISR then moves the
- byte to a buffer so that your application program can later read it.
-
- If transmitter interrupts are enabled, then bytes are queued up waiting
- transmission. When a byte is moved from the UART transmitter holding
- register to the UART transmitter shift register, an interrupt is generated
- and the next byte is taken from the library transmitter buffer by the ISR
- and written to the UART holding register.
-
- Up to 16 bytes can be taken from the transmitter buffer while processing one
- transmitter interrupt if an 16550 UART is used. The 16550 UART is strongly
- recommended for computers doing serial communications under Windows.
-
- Refer to the sections entitled "RS232 Signals" and "National INS8250 UART"
- for further information on these topics.
-
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 16
- 6.2 Standard Port Addresses
-
-
- There are a few things to know about how serial communications ports are
- used by IBM PC/XT/AT and compatible computers. The standard IBM PC/XT/AT
- configuration values are as follows:
-
- Port Reg Base IRQ Line Vector
- COM1 3F8H 4 12
- COM2 2F8H 3 11
- COM3 3E8H 4 12
- COM4 2E8H 3 11
-
- (Refer to your DigiBoard manual for DigiBoard addresses, and your BOCA
- manual for BOCA board addresses).
-
- PCL4W assumes the above values. If necessary, the UART base address can be
- changed by SioUART, and IRQ lines can be re-assigned by SioIRQ. Remember
- that each port to be used concurrently must have a unique IRQ line. Refer
- to the PCL4W Reference Manual for specific details.
-
- When installing new communications cards, the following guidelines are
- recommended:
-
- (1) Be sure to read the documentation for the hardware you are installing.
- Pay special attention to UART base addresses and IRQ lines, particularly if
- trying to set up a non-standard configuration.
-
- (2) If you have a choice in base addresses and IRQ lines, always choose
- standard values as defined above.
-
- (3) The first port should be COM1, the second COM2, etc.
-
- (4) Use SioUART to zero all unused ports (for example, call SioUART(COM4,0)
- if there is no COM4 port installed).
-
- (5) Be carefull not to configure two ports for the same address. This is
- easier to do than you may believe.
-
- (6) Choose an external modem over an internal one. It is much easier to
- debug problems with an external modem than an internal one.
-
- (7) Select hardware flow control (RTS/CTS) if flow control is required and
- hardware flow control is not the default.
-
- (8) Always test your port as soon as it is installed. Try several programs
- that use the communications ports.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 17
- 6.3 Running 3 or 4 Ports Concurrently
-
-
- PCL4W supports up to 4 serial ports running concurrently (more if you have a
- DigiBoard or BOCA board). One free interrupt for each port is required.
- Refer to the next section if you have a DigiBoard or BOCA board.
-
- Interrupts IRQ4 and IRQ3 are dedicated to the communications ports in a
- standard IBM PC/XT/AT configuration. IRQ4 is shared between COM1 and COM3
- while IRQ3 is shared between COM2 and COM4. This means that you can run two
- ports simultaneously provided that they don't share an interrupt.
-
- Suppose that you wish to run 3 ports simultaneously. To begin, you must have
- 3 serial UARTs installed on your computer. Assume, for purposes of this
- discussion, that COM1 is installed on your motherboard, and that you have
- purchased a new 2 port serial communications board.
-
- You should be able to configure the first serial board port as COM2, which
- uses IRQ3. Refer to the manual that came with your serial board.
-
- In order to run the third serial port concurrently with the first two, an
- unused interrupt must be found. If your serial card can use only IRQ3 and
- IRQ4, then there is no way to run a third line since IRQ4 and IRQ3 are used
- for COM1 and COM2.
-
- However, many serial cards can use other IRQs, typically IRQ2 through IRQ7.
- Since IRQ5 is normally used for a second printer port, it is a good
- candidate for COM3. To use IRQ5 for the third serial port, first set your
- serial card to use IRQ5 for COM3 (refer to your serial card manual) and then
- add the following line to your applications code before calling SioReset:
-
- SioIRQ(COM3,IRQ5);
-
- Don't forget to disable any device that might use IRQ5, such as a second
- printer port or a music card. Unfortunately, there is no easy way to
- determine that you have no conflicts until you actually attempt to use the
- IRQ. If there are conflicts, your system will probably hang and you will
- have to reboot.
-
- To run a fourth serial port, another free IRQ must be found. On some
- systems, IRQ7 can be used. You must first disable IRQ7 on your parallel port
- card first (your printer doesn't need an IRQ). To use IRQ7 for the fourth
- serial port, first set your serial card to use IRQ7 for COM4 and then add:
-
- SioIRQ(COM4,IRQ7);
-
- To summarize, your serial card must be able to generate the correct IRQ,
- which is not already being used. Refer to the entry for the SioIRQ function
- in the PCL4W Reference Manual.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 18
- 6.4 Using Multiport Cards
-
-
- The PCL4W library supports the dumb Digiboard (PC/4 and PC/8) and the dumb
- BOCA board (BB1004, BB1008, and BB2016).
-
- 6.4.1 The DigiBoard
-
- PCL4W supports the DigiBoard PC/4 and PC/8. In order to use the DigiBoard,
- (not the Intelligent Digiboards such as the PC/Xe and PC/Xi) you must
- configure PCL4W using the SioPorts(), SioUART(), and SioIRQ() functions.
-
- Your PCs ports must be partitioned into "standard" PC ports and dumb card
- ports. Remember that standard PC ports cannot share IRQs like the DigiBoard
- (or BOCA board) can. If you are using IRQ4 and IRQ3 for standard PC ports
- COM1 and COM2, then you cannot use either for DigiBoard ports (try IRQ5 or
- IRQ7).
-
- Suppose that COM1 through COM2 are standard PC ports (using IRQ4 and IRQ3)
- and you have installed a PC/8 DigiBoard that you wish to use for COM3
- through COM10 using interrupt line IRQ5. You choose to use the recommended
- DigiBoard UART addresses starting at 0x100:
-
- SioPorts(10,COM3,0x140,DIGIBOARD);/* COM3 = 1st DigiBoard port */
- Address = 0x100; /* 1st DigiBoard UART address */
- for(Port=COM3;Port<=COM10;Port++) /* look at each port */
- {SioUART(Port,Address); /* set the UART address */
- Address += 8; /* compute next address */
- SioIRQ(Port,IRQ5); /* set the DigiBoard IRQ */
- }
-
- The DigiBoard uses 0x140 for the status address for odd interrupts and 0x141
- for even interrupts.
-
- Digiboard may be contacted at 6400 Flying Cloud Drive, Eden Prairie, MN
- 55344. Telephone 612-943-9020 or FAX 612-943-5398.
-
-
- 6.4.2 The BOCA Board
-
-
- PCL4W supports the dumb BOCA boards (BB1004, BB1008, and BB2016). As with
- the DigiBoard, you must configure PCL4W before using the BOCA board.
-
- For example, to configure the BOCA BB2016 to use COM1 to COM16, with base
- addresses starting at 0x100 and IRQ5:
-
- SioPorts(16,COM1,0x107,BOCABOARD);/* COM3 = 1st BOCA board port */
- Address = 0x100; /* 1st BOCA UART address */
- for(Port=COM1;Port<=COM16;Port++) /* look at each port */
- {SioUART(Port,Address); /* set the UART address */
- Address += 8; /* compute next address */
- SioIRQ(Port,IRQ5); /* set the BOCA IRQ */
- }
-
- BOCA may be contacted at BOCA Research, Inc., 6413 Congress Avenue, Suite
- 130, Boca Raton, FL 33487. Phone 407-241-8088, FAX 407-997-0918.
-
-
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 19
- 6.5 Transmitter Interrupts
-
-
- Transmitter interrupts are supported by the library. Separate libraries are
- provided, one with transmitter interrupts enabled and one without. When
- transmitter interrupts are NOT enabled, the following logic occurs every
- time you call SioPutc():
-
- 1. Wait for transmit buffer to become empty. The transmit buffer may not
- be empty if the previous transmit is not completed (the UART breaks down the
- byte & sends 1 bit at a time). 2. When the transmit buffer is empty, the
- byte from the SioPutc() call is loaded into the transmit buffer and control
- is returned to the caller.
-
- Note that you can not write to the UART any faster the the UART baud rate.
-
- When transmitter interrupts are enabled, the byte from SioPutc() is put into
- a previously prepared (by SioTxQue) transmitter queue. The interrupt service
- routine fetches bytes from this queue as soon as the previous byte has been
- sent.
-
- While you can now call SioPutc() faster than the baud rate, bytes are still
- transmitted at the given baud rate.
-
- The above sounds like transmitter interrupts are the way to go.
- Unfortunately, this is usually NOT the case. Most applications will perform
- better if transmitter interrupts are NOT enabled.
-
- The reason is that transmitter interrupts double the amount of code in the
- time critical interrupt service routine. While the library is processing a
- transmitter interrupt (which can take a while), incoming bytes can not be
- processed. What this means is that a given machine can run at a higher baud
- rate without transmitter interrupts. This problem is compounded when running
- multiple ports simultaniously.
-
- However, there are a few application areas where transmitter interrupts are
- preferable. If your application will be transmitting blocks of data at
- fairly slow baud rates you might profit from enabling transmitter interrupts
- provided that there is something else for the processor to do (which is NOT
- the case in most protocols).
-
- However, if you are using 16550 UARTS (which have 16 byte on-chip transmit
- and receive buffers rather that the 1 byte buffers on the 8250 and 16450
- UARTS), you may want to use the library version with interrupts enabled
- provided that you enable the 16550 UART with the SioFIFO() function.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 20
- 6.6 RS-232 Signals
-
-
- RS-232 is the name of the serial data interface standard used to connect
- computers to modems. Most IBM compatible computers are built with at least
- one serial port and use either DB9 (9 pin) or DB25 (25 pin) connectors.
-
- A summary of these pins and their function follows. For more detailed
- information, refer to one of the many books dealing with RS-232 interfacing.
-
- Signal Ground Pin 7 (DB25), Pin 5 (DB9)
-
- The SG line is used as the common signal ground, and must always be
- connected.
-
- Transmit Data Pin 2 (DB25), Pin 3 (DB9)
-
- The TX line is used to carry data from the computer to the modem.
-
- Receive Data Pin 3 (DB25), Pin 2 (DB9)
-
- The RX line is used to carry data from the modem to the computer.
-
- Data Terminal Ready Pin 20 (DB25), Pin 4 (DB9)
-
- The DTR line is used by the computer to signal the modem that it is ready.
- DTR should be set high when talking to a modem.
-
- Data Set Ready Pin 6 (DB25), Pin 6 (DB9)
-
- The DSR line is used by the modem to signal the computer that it is ready.
-
- Request to Send Pin 4 (DB25), Pin 7 (DB9)
-
- The RTS line is used to "turn the line around" in half duplex modems, and
- for hardware flow control in most modems that require flow control.
-
- Clear to Send Pin 5 (DB25), Pin 8 (DB9)
-
- The CTS line is used to "turn the line around" in half duplex modems, and
- for hardware flow control in most modems that require flow control.
-
- Data Carrier Detect Pin 8 (DB25), Pin 1 (DB9)
-
- The DCD line is used by the modem to signal the computer that a data carrier
- signal is present.
-
- Ring Indicator Pin 22 (DB25), Pin 9 (DB9)
-
- The RI line is asserted when a 'ring' occurs.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 21
- 6.7 National INS8250, INS16450, and INS16550 UARTs
-
-
- The Personal Communications Library is based on the standard National
- INS8250, INS16450, and INS16550 UARTs. The 8250 was the original UART used
- in the IBM PC, whereas the 16450 is a faster version found on most 286 & up
- machines. The 16550 contains a 16 byte FIFO to further reduce communications
- overhead. These UARTs consists of 8 register ports as follows:
-
- Offset R/W Register
- 0 R/W Receiver (read) / Transmitter (write)
- 1 R/W Interrupt Enable (read)
- 2 R Interrupt Identification
- 2 W FIFO control (INS16550 only)
- 3 R/W Data Format (Line Control)
- 4 R/W RS-232 (Modem) Control
- 5 R/W Line Status
- 6 R/W RS-232 (Modem) Status
- 7 R/W Not used.
-
- For the standard PC ports (not DigiBoard ports), the UART registers are
- based at 3F8h (COM1), 2F8h (COM2), 3E8h (COM3), and 2E8h (COM4). COM1 and
- COM3 share interrupt request line IRQ4 while COM2 and COM4 share request
- line IRQ3. This means that COM1 and COM3 can't be used concurrently.
- Similarly for COM2 and COM4.
-
- However, standard PC ports may be re-configured to use other UART addresses
- and IRQ assignments. Refer to the SioPorts(), SioUART(), and SioIRQ()
- functions.
-
- If you have a DigiBoard PC/4 (or PC/8) installed, you will have 4 (or 8)
- additional ports using INS16450 or INS16550 UARTS. The default DigiBoard
- ports are located at 100h, 108h, 110h & 118h for the PC/4 continuing with
- 120h 128h, 130h & 138h for the PC/8. IRQ3 is the default for all ports.
-
- Four sources of interrupts are possible with the 8250 and 16550: (1)
- receiver error or BREAK, (2) receiver data ready, (3) ready to transmit, and
- (4) RS232 input. These four sources of interrupts are summarized as
- follows:
-
- Source of Interrupt Action Required to Clear
- Receiver error or BREAK. Read Line Status register.
- Receiver data. Read data from data register.
- Transmitter Buffer Empty. Write to data register or read IID reg.
- RS232 Input. Read Modem Status register.
-
- If you are not familiar with UARTS, several good books are available. Refer
- to the Serial Communications chapter for recommendations. Although a
- knowledge of the 8250/16450/16550 is not necessary to use PCL4W, a general
- knowledge of the theory of asynchronous serial communications is helpfull.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 22
- 6.8 Register Summary
-
-
- REG 0 : Data Register
-
- Reading from the data register fetches the next input byte, once it is
- ready. Writing to the data register transmits the byte written to it over
- the serial line.
-
- REG 1 : Interrupt Enable
-
- The Interrupt Enable register enables each of four types of interrupts when
- the appropriate bit is set to a one.
-
- bit 3 : Enable interrupt on RS232 input.
- bit 2 : Enable interrupt on receiver error or break.
- bit 1 : Enable interrupt on transmitter buffer empty (TBE).
- bit 0 : Enable interrupt on received data (RxRDY).
-
- REG 2 : Interrupt Identification (IID)
-
- Reading the Interrupt Identification (read only) register once an interrupt
- has occurred identifies the interrupt as follows:
-
- Bit 2 Bit 1 Bit 0 Priority Interrupt
- 0 0 1 none none
- 1 1 0 0 (high) Serialization or break.
- 1 0 0 1 Received data.
- 0 1 0 2 Transmitter Buffer Empty.
- 0 0 0 3 (low) RS232 Input.
-
- In the INS16650, REG 2 (write only) is also the FIFO control register.
- Writing bits 6 & 7 will set the FIFO trigger level (number of bytes received
- before an interrupt is generated).
-
- Bit 7 Bit 6 Trigger Bit 7 Bit 6 Trigger
- 0 0 1 byte 1 0 8 bytes
- 0 1 4 bytes 1 1 14 bytes
-
- REG 3 : Line Control
-
- RS232 line parameters are selected by writing to this register.
-
- bit 7 : DLAB = 0
- bit 6 : BREAK on(1), off(0).
- bits 5-3: Parity None(000),ODD(001),EVEN(011),MARK(101),SPACE(111)
- bit 2 : One stop bit(0), two stop bits(1).
- bits 1-0: Data bits = 5 (00), 6(01), 7(10), 8(11).
-
- When the Divisor Latch Access Bit (DLAB) is 1, registers 0 and 1 become the
- LS and MS bytes of the Baud Rate Divisor registers.
-
- Baud Divisor Baud Divisor Baud Divisor
- 300 0180 4800 0018 38400 0003
- 1200 0060 9600 000C 57600 0002
- 2400 0030 19200 0006 115200 0001
-
-
-
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 23
- REG 4 : Modem Control
-
- RTS, DTR, loopback testing, and General Purpose Outputs #1 and #2 are
- controlled by the Modem Control register as follows:
-
- bit 4 : Enable local loopback.
- bit 3 : Enable GP02. Necessary for 8250 interrupts.
- bit 2 : Enable GP01.
- bit 1 : Set / clear RTS.
- bit 0 : Set / clear DTR.
-
- REG 5 : Line Status
-
- Reading the Line Status register provides status information as follows (1
- for TRUE, 0 for FALSE) :
-
- bit 6 : Transmitter Empty.
- bit 5 : Transmitter Buffer Empty (TBE).
- bit 4 : BREAK detect.
- bit 3 : Framing error.
- bit 2 : Parity error.
- bit 1 : Overrun error.
- bit 0 : Data Ready.
-
- REG 6 : Modem Status
-
- Reading the Modem Status register provides the following status information
- (1 for TRUE, 0 for FALSE) :
-
- bit 7 : DCD status.
- bit 6 : RI status.
- bit 5 : DSR status.
- bit 4 : CTS status.
- bit 3 : Delta DCD status.
- bit 2 : Delta RI status.
- bit 1 : Delta DSR status.
- bit 0 : Delta CTS status.
-
- The delta bits (bits 0 through 3) are set whenever one of the status bits
- (bits 4 through 7) changes (from 0 to 1 or from 1 to 0) since the last time
- the Modem Status register was read. Reading the Modem Status register clears
- the delta bits.
-
- REG 7 : Scratch Register
-
- There is no function associated with register 7. It does not exist in
- earlier versions of the 8250.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 24
- 7.0 Example Programs
-
-
- There are two example programs provided as described below. A separate
- directory should be created for each (and every) example program. In
- particular, the two example programs described below should be in separate
- directories.
-
- It is recommended that SIMPLE be compiled, linked, and run as a test of the
- software installation.
-
- In an attempt to minimize the size of the shareware version of the PCL4W
- library, the TERM program files are distributed as a separate file
- (WTERMxx.ZIP, where xx is the current version). WTERMxx.ZIP can always be
- downloaded from the MarshallSoft support BBS.
-
-
- 7.1 SIMPLE.C
-
-
- SIMPLE is meant as a very straight forward, easy to understand windows
- communications program. Unfortunately, windows programs are not all that
- straight forward or easy to understand.
-
- SIMPLE is a simple terminal emulator. It reads from the serial port and
- writes to the client area and reads from the keyboard and writes to the
- serial port. SIMPLE can also talk to a modem, although you will have to
- command the modem directly.
-
- The best way to test SIMPLE is to run it on two machines conmnected by a
- null modem cable. Whatever is typed on one is displayed on the other, and
- vice versa. If you have but one computer, you can use SIMPLE to talk to a
- modem.
-
- To make SIMPLE using the Microsoft SDK, type:
-
- NMAKE SIMPLE._M_
-
- To make simple using the Borland compiler, type:
-
- MAKE -fSIMPLE._B_
-
- If you use a graphical development environment, put the following files in
- your project file:
-
- SIMPLE SIOERROR SIMPL_IO EXPECT CONFIG PAINT LINE ABOUT PCL4W.LIB
-
- The SIMPLE makefiles use the small memory model. If a different memory model
- is required, the Microsoft (or Borland) runtime library must also be
- changed to match the memory model. No change is required for the PCL4W
- library.
-
- For example, to change the makefile from using the small memory model to
- using the medium memory model, the following changes are necessary: For
- Microsoft, change -AS to -AM and change SLIBCEW to MLIBCEW. For Borland,
- change -sm to -mm and change C0WS, CWS, and MATHWS to C0WM, CWM, and MATHWM.
-
-
-
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 25
- 7.2 TERM.C
-
-
- TERM is an communications program suitable for calling bulletin board
- systems (BBS) and performing as a PC to PC file copy program. TERM itself
- is not part of the communications library, but rather it is provided as an
- example of a communications application using PCL4W.
-
- TERM can send a standard Hayes standard AT command set string to your modem.
- An initialization string is sent by TERM provided that the constant
- AT_COMMAND_SET in the file TERM.CFG is defined to be TRUE:
-
- #define AT_COMMAND_SET 1
-
- Refer to the chapter "Modem Initialization" for a discussion of
- initialization strings.
-
- TERM also supports hardware flow control (RTS/CTS). Hardware flow control is
- observed provided that the constant RTS_CTS_CONTROL in the file TERM.CFG is
- defined to be TRUE:
-
- #define RTS_CTS_CONTROL 1
-
- Refer to the chapter "Flow Control" for a discussion of hardware flow
- control.
-
- TERM can also exchange files using ASCII (with XON/XOFF), XMODEM, YMODEM
- (batch capability), and YMODEM-G (streaming YMODEM used with error
- correcting modems) communications protocols. TERM can accept wildcards in
- the filename so that multiple files can be sent using YMODEM and YMODEM-G.
- The protocol timing can also be adjusted (this should not be necessary) by
- modifying the constants SHORT_WAIT and LONG_WAIT in the TERM.CFG file.
-
- TERM can be configured to run script files (the script compiler /
- interpreter is part of the registration package only) by setting
-
- #define SCRIPTS 1
-
- in TERM.H. Registered users can refer to SCRIPTS.DOC information on SCRIPTS.
-
- TERM can also be used as a PC to PC transfer program using a null modem
- cable. In this case, AT_COMMAND_SET and RTS_CTS_CONTROL should be defined to
- be FALSE in the file TERM.CFG:
-
- #define AT_COMMAND_SET 0
- #define RTS_CTS_CONTROL 0
-
- Be advised that many null modem cables do NOT swap RTS and CTS, which is
- necessary for hardware flow control. This means that RTS_CTS_CONTROL should
- never be set to 1 (TRUE) when using a null modem cable unless you are
- absolutely sure that RTS and CTS are swapped.
-
- The TERM program (but of course not the library itself) is placed in the
- public domain by MarshallSoft Computing, Inc., and can be used in any way
- desired by the user.
-
- To make TERM using the Microsoft SDK, type:
-
- NMAKE TERM._M_
-
- To make simple using the Borland compiler, type:
-
- MAKE -fTERM._B_
-
-
-
-
- PCL4W Users Manual Page 26
- 8.0 Legal Issues
-
- 8.1 Registration
-
-
- If you wish to register the PCL4W library, please send $65 plus $3 S&H ($6
- outside of North America) to:
-
- MarshallSoft Computing, Inc.
- Post Office Box 4543
- Huntsville AL 35815
-
- Multiple copies are available: $45 for 3 to 9, $35 for 10 to 19, and $25 for
- 20 or more. A site license is also available for $495 (includes 5 sets of
- printed documentation). We pay shipping.
-
- We accept American Express (account number, expiration date, exact name on
- your card, and complete AmEx billing address required), checks in US dollars
- drawn on a US bank, purchase orders (POs) from recognized US schools and
- companies listed in Dun & Bradstreet, and COD (street address and phone
- number required) within the USA (plus a $3 COD charge). Print the file
- PCL4W.INV if an invoice is needed.
-
- You can also order PCL4W from The Public Software Library (PSL) with your
- MC, Visa, AmEx, or Discover card by calling 800-242-4PSL (from overseas:
- 713-524-6394) or by FAX at 713-524-6398 or by CompuServe at [71355,470].
- THESE NUMBERS ARE FOR ORDERING ONLY. The product number for PCL4W is 11171.
-
- If you wish to update from an older version of PCL4W, send $15 plus $3 S&H
- ($6 outside of North America). Updates must be ordered directly from
- MarshallSoft Computing.
-
- The registered package includes:
-
- o PCL4W Library w/o shareware screens.
- o Assembler source code for the library.
- o SSCRIPT language (compiler and interpreter).
- o Laser printed Users and Reference Manuals.
- o Telephone, FAX, and BBS support for one year.
-
- Print the file INVOICE.DOC if an invoice is needed. The registered user will
- receive the latest version of PCL4W shipped by two day priority mail (packet
- airmail overseas). A 5.25" diskette is provided unless a 3.5" diskette is
- requested.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 27
- 8.2 License
-
-
- MarshallSoft Computing, Inc. grants the registered user of PCL4W the right
- to use one copy of the PCL4W library (in object form) on a single computer
- in the development of any software product (other than libraries such as
- PCL4W). The user may not use the library on more than one computer at the
- same time. The source code for the library (PCL4W.ASM) is copyrighted by
- MarshallSoft Computing and may not be released in whole or in part. Products
- developed using PCL4W may be distributed without any royalty.
-
-
- 8.3 Warranty
-
-
- MARSHALLSOFT COMPUTING, INC. DISCLAIMS ALL WARRANTIES RELATING TO THIS
- SOFTWARE, WHETHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE,
- AND ALL SUCH WARRANTIES ARE EXPRESSLY AND SPECIFICALLY DISCLAIMED. NEITHER
- MARSHALLSOFT COMPUTING, INC. NOR ANYONE ELSE WHO HAS BEEN INVOLVED IN THE
- CREATION, PRODUCTION, OR DELIVERY OF THIS SOFTWARE SHALL BE LIABLE FOR ANY
- INDIRECT, CONSEQUENTIAL, OR INCIDENTAL DAMAGES ARISING OUT OF THE USE OR
- INABILITY TO USE SUCH SOFTWARE EVEN IF MARSHALLSOFT COMPUTING, INC. HAS
- BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES OR CLAIMS. IN NO EVENT SHALL
- MARSHALLSOFT COMPUTING, INC.'S LIABILITY FOR ANY SUCH DAMAGES EVER EXCEED
- THE PRICE PAID FOR THE LICENSE TO USE THE SOFTWARE, REGARDLESS OF THE FORM
- OF THE CLAIM. THE PERSON USING THE SOFTWARE BEARS ALL RISK AS TO THE QUALITY
- AND PERFORMANCE OF THE SOFTWARE.
-
- Some states do not allow the exclusion of the limit of liability for
- consequential or incidental damages, so the above limitation may not apply
- to you.
-
- This agreement shall be governed by the laws of the State of Alabama and
- shall inure to the benefit of Marshallsoft Computing, Inc. and any
- successors, administrators, heirs and assigns. Any action or proceeding
- brought by either party against the other arising out of or related to this
- agreement shall be brought only in a STATE or FEDERAL COURT of competent
- jurisdiction located in Madison County, Alabama. The parties hereby consent
- to in personam jurisdiction of said courts.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 28
- 9.0 Summary
-
-
- 9.1 Revision History
-
- Version 1.0: 1 February, 1994.
-
- The initial release of PCL4W uses a considerable amount of the code from
- version 4.0 of PCL4C (the DOS version of the comm library).
-
- Version 1.1: August 1, 1994
-
- o A flow control bug was fixed.
- o COM11 through COM16 defined.
- o Supports the BB1004, BB1008, and BB2016 BOCA boards.
- o The new function SioGetDiv() was added.
- o A script compiler & interpreter was added to the registration package.
-
- 9.2 Function Summary
-
- Refer to the PCL4W Reference Manual (PCL4W.REF) for detailed information on
- the communications and support functions. A one line summary of each
- function follows:
-
- +--------------+-----------------------------------------------------------+
- | SioBaud | Sets the baud rate of the selected port. |
- | SioBrkSig | Asserts, cancels, or detects BREAK signal. |
- | SioCTS | Reads the Clear to Send (CTS) modem status bit. |
- | SioDCD | Reads the Data Carrier Detect (DCD) modem status bit. |
- | SioDone | Terminates further serial processing. |
- | SioDSR | Reads the Data Set Ready (DSR) modem status bit. |
- | SioDTR | Set, clear, or read the Data Terminal Ready (DTR) bit. |
- | SioError | Displays error in text. |
- | SioFIFO | Sets the interrupt level for the INS16550. |
- | SioFlow | Enables / disables hardware flow control. |
- | SioGetc | Reads the next character from the serial line. |
- | SioGetDiv | Gets the baud rate divisor. |
- | SioInfo | Returns library version number & memory model. |
- | SioIRQ | Assigns an IRQ line to a port. |
- | SioLine | Reads the line status register. |
- | SioLoopBack | Performs a UART loopback test. |
- | SioModem | Reads the modem status register. |
- | SioParms | Sets parity, stop bits, and word length. |
- | SioPorts | Sets # ports, 1st DigiBoard port & status register. |
- | SioPutc | Transmit a character over a serial line. |
- | SioRead | Reads any of 7 UART ports. |
- | SioReset | Initialize a serial port for processing. |
- | SioRI | Reads the Ring Indicator (RI) modem status bit. |
- | SioRTS | Sets, clears, or reads the Request to Send (RTS) line. |
- | SioRxBuf | Sets up receive buffer. |
- | SioRxFlush | Flushes (clears) the receive buffer. |
- | SioRxQue | Returns the number of characters in the receive queue. |
- | SioTxBuf | Sets up transmit buffer. |
- | SioTxFlush | Flushes (clears) the transmit buffer. |
- | SioTxQue | Returns the number of characters in the transmit queue. |
- | SioUART | Sets the UART base address. |
- | SioUnGetc | "Un-gets" (puts back) a specified character. |
- +--------------+-----+-----------------------------------------------------+
-
- 9.3 Further Reading
-
- The best way to learn about serial communications is to read a good book on
- the subject. Several good texts are available. Two that I like are:
-
- (1) C Programmers's Guide to Serial Communications by Joe Campbell (SAMS)
- (2) Mastering Serial Communications by Peter Gofton (SYBEX).
-
- PCL4W Users Manual Page 29
- 10.0 Other MarshallSoft Computing Products
-
- The following shareware libraries are also available from MarshallSoft
- Computing. They can be registered directly through use, or through the
- Public Software Library (PSL) if using VISA or MasterCard.
-
- 10.1 The LZW Data Compression Library for Windows
-
- LZW4W is a Windows implementation of the LZW (Lempel-Ziv-Welch) algorithm
- for compressing and decompressing data. LZW does particularly well on text
- files, achieving better than a 50 % compression ratio for many files.
-
- The LZW algorithm is considered to be one of the best general purpose
- algorithms available today. The new high speed modems that employ
- on-the-fly data compression (such as MNP 5.0 & the V.42 bis international
- standard) use the LZW algorithm, as well as such well known utility programs
- such as PKZIP.
-
- The LZW Data Compression Library for Windows is available for $45 plus
- $3 S&H ($6 S&H overseas). PSL order #11482.
-
-
- 10.2 The Personal Communications Library for C/C++
-
- The Personal Communications Library for the C Language (PCL4C) is a DOS
- based asynchronous communications library designed for experienced software
- developers programming in C. Four compilers are supported: Microsoft
- Optimizing C, Microsoft Quick C, Borland Turbo C, and MIX Power C. An IBM
- PC/XT/AT or compatible is required. PCL4C is the DOS equivalent of PCL4W.
-
- The Personal Communications Library for C (PCL4C) is available for $65 plus
- $3 S&H ($6 S&H overseas). PCL4C and PCL4W can be ordered together for $95
- plus $3 S&H ($6 overseas).
-
- 10.3 The LZW Data Compression Library for C
-
- LZW4C is a DOS implementation of the LZW (Lempel-Ziv-Welch) algorithm for
- compressing and decompressing data. LZW does particularly well on text
- files, achieving better than a 50 % compression ratio for many files.
-
- The LZW algorithm is considered to be one of the best general purpose
- algorithms available today. The new high speed modems that employ
- on-the-fly data compression (such as MNP 5.0 & the V.42 bis international
- standard) use the LZW algorithm, as well as such well known utility programs
- such as PKZIP.
-
- The LZW Data Compression Library for Windows is available for $45 plus $3
- S&H ($6 S&H overseas).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PCL4W Users Manual Page 30
-