Windows Standard
Serial Communications
for C/C++
Programmer's Manual
(WSC_4C)
Version 3.2
July 17, 2002
This software is provided as-is.
There are no warranties, expressed or implied.
Copyright (C) 2002
All rights reserved
MarshallSoft Computing, Inc.
Post Office Box 4543
Huntsville AL 35815
Voice : 1-256-881-4630
FAX : 1-256-880-0925
email : info@marshallsoft.com
web : www.marshallsoft.com
MarshallSoft is a member of the Association of Shareware Professionals
MARSHALLSOFT is a registered trademark of MarshallSoft Computing.
1 Introduction
1.1 Features2 Library Overview
1.2 Documentation Set
1.3 Example Program
1.4 Installation
1.5 Uninstalling
1.6 Limitations on COM Ports
1.7 Ordering
1.8 Updates
2.1 Dynamic Link Libraries3 Compiler Issues
2.2 Console Mode
2.3 Using the Library
2.4 Static Linking
2.5 Large Memory Model in Win16
2.6 Win32 STDCALL and DECLSPEC
2.7 Using Threads
2.8 Compiling for WinCE
2.9 Calling from C++
3.1 Command Line Tool Setup4 Supported Compilers
3.1.1 Microsoft3.2 Command Line Batch Files
3.1.2 Borland
3.1.3 Watcom
3.1.4 Lcc-Win32
3.3 Command Line Makefiles
3.4 Compiling Using an IDE
4.1 Microsoft C/C++5 Compiling Programs
4.2 Microsoft Visual C/C++
4.3 Borland C/C++
4.4 Turbo C/C++ for Windows
4.5 Borland C++ Builder
4.6 Watcom C/C++
4.7 Lcc-Win32 C/C++
5.1 Compiling WSC6 Example Programs
5.2 Compiling Example Programs
5.3 Static Libraries
7 More Examples
8 Revision History
The Windows Standard Serial Communications Library (WSC) is an asynchronous communications dynamic link library (DLL) which uses the standard Windows API (Application Programmer's Interface) to communicate with any device connected to a serial port.
Our goal is to provide a robust serial communications library that you and your customers can depend upon. Contact us if you have any questions.
The shareware and registered versions are identical except that the shareware version displays the "Shareware Info" screen. The registered version also includes source code.
WSC features include:
A good selection of C/C++ example programs with full source code are included. Refer to Section 6 for more details on each of the example programs. [PROGRAM] [DESCRIPTION] WSCVER : Program that displays the WSC version number. SIMPLE : A simple terminal emulator. SELFTEST : Performs COM port functionality testing. MODEM : Same as SIMPLE but controls flow control, modem lines, etc. TERM : Terminal emulator with XMODEM, YMODEM, and ANSI support. BCB : Borland C++ Builder (32-bit C++) example. MFC_PGM : Microsoft Foundation Class (MFC) C++ example program. CONSOLE : A WIN32 console mode program similar to SIMPLE. FINDER : Finds a modem connected to one of your serial ports. ECHOPORT : Multi-threaded console mode program echoes all input. EVENT : Blocking version of SIMPLE. Uses SioEvent. XMS , XMR : Console mode XMODEM programs. YMS , YMR : Console mode YMODEM programs. RS485 : RS485 version of CONSOLE. DEVICE : Program to communicate with serial device. HOST : Simple one-line host program. DIAL : Dials up host (or BBS). HELLO : Example program which uses the C++ fSio class.
The complete set of documentation consists of four manuals in three formats. This is the first manual (WSC_4C) in the set.
The WSC_4C Programmer's Manual is the language specific (C/C++) manual.
The WSC User's Manual (WSC_USR) discusses language independent serial communications programming issues.
The WSC Reference Manual (WSC_REF) contains details on each individual WSC function.
The Asynchronous Serial Communications Manual (ASYNC) contains background information on serial port hardware.
Each manual comes in three formats:
Use Microsoft Word or Microsoft WordPad to print the document files.
#include <windows.h> #include <stdio.h> #include "wsc.h" void main(void) {int Code; // reset (open) COM1 Code = SioReset(COM1,1024,1024); if(Code<0) {char Temp[80]; // display error message SioWinError((LPSTR)Temp,80); printf("ERROR %d : %s\n",Code,(LPSTR)Temp); SioDone(COM1); exit(1); } // set DTR printf("Setting DTR\n"); SioDTR(COM1,'S'); // wait for user to quit printf("Type any character to exit.\n"); getch(); // close port SioDone(COM1); } /* end main */
In the console mode program above, the SioDTR function is called set the DTR line.
All recent WIN32 C/C++ compilers support the "declspec" keyword. Microsoft VC (version 4.0 and up), Borland (version 5.0 and up), Watcom (version 11.0 and up), and Lcc-Win32 compilers support the "declspec" keyword. If you have an older Win32 compiler, you can get the legacy DLL's from our web site at
www.marshallsoft.com/wsc4c.htm
Uninstalling WSC4C is very easy. WSC does not modify the registry. First, delete the WSC project directory created when installing WSC4C. Second, delete WSC16.DLL and WSC32.DLL from your Windows directory, typically C:\WINDOWS for Windows 3.1/95/98/Me/XP and C:\WINNT for Windows NT/2000. That's it!
The 32-bit version of WSC4C (WSC32.DLL) can use any port from COM1 to COM32, provided that the port is known to Windows 95/98/NT/2000/Me/XP and there is physical hardware present. More ports (256) can easily be added by recompiling the registered version of WSC32.C.
WSC4C can be registered for $105. See Section 1.5 "Ordering" in the WSC User's Manual (WSC_USR) for details on ordering. WSC4C comes complete with source code.
An update for WSC4C may be purchased for $30 (for email delivery) if ordered within one year of the original purchase (or previous update). After one year, WSC can be updated for $55. See Section_1.5 "Ordering" in the WSC User's Manual (WSC_USR) for details on ordering.
Note that the registered DLL's do not expire.
WSC4C includes both Win16 and a Win32 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.
An important advantage that DLL's have over other "popular" library formats such as VBX or OCX is that DLL's are callable by all Windows applications. Since DLL's are the building blocks of the Windows Operations System, they will not be replaced by a "newer technology".
WSC4C functions can be called from WIN32 console mode programs. A "console mode" program is a Windows 95/98/NT/2000/Me/XP WIN32 command line program running in a command window. Although console mode programs look like DOS programs, they are WIN32 programs which have access to the Win32 API and the entire Windows address space.
The WSC4C has been tested on multiple computers running Windows 3.1, Windows 95/98/Me/XP, and Windows NT/2000.
The WSC4C library has also been tested with several C/C++ compilers, including Microsoft C/C++ v7.0 (from the Windows SDK), Microsoft Visual C/C++, Borland C/C++, Borland C++ Builder, Turbo C/C++ for Windows, and Watcom C/C++.
The SETUP installation program will copy the Lib's and DLL's to your Windows directory. Refer to Section 1.3 "Installation".
"Legacy DLL's" required by Borland C/C++ 4.0/4.5 and Watcom 10.5/10.6 can be downloaded from our web site at www.marshallsoft.com/wsc4c.htm.
The registered user can easily compile WSC16.C (or WSC32.C) into their application, so that the WSC DLL's are not needed. The makefiles STATIC16._M_ and STATIC32._M_ compile WSC to create versions of SIMPLE which don't require the use of WSC16.DLL or WSC32.DLL.
Static libraries require the source code for WSC, which is included in the registered package. Refer to section 5.3 "Static Libraries".
WSC16.DLL can be used from Win16 programs written in any memory model. Two examples are included in this archive for compiling SIMPLE.C for the large memory model.
[FILE] [DESCRIPTION] SIMPLE16._ML : Large memory model makefile for Microsoft SIMPLE16._BL : Large memory model makefile for Borland.
WSC32 is compiled using the _stdcall and _declspec keywords. This means that WSC4C uses the same calling conventions and file naming conventions as the Win32 API. In particular, function names are NOT decorated. There are no leading underscores nor trailing "@size" strings added to function names.
Microsoft Visual C/C++ users can look at the WSC32 function names using the dumpbin.exe executable:
dumpbin /exports wsc32.dll
Some older compilers such as Borland C/C++ 4.0/4.5 and Watcom 10.5/10.6 do not support the "declspec" keyword. DLL's for these compilers can be downloaded from
http://www.marshallsoft.com/wsc4c.htm
WSC4C is thread safe. Refer to the ECHOPORT.C example program, which demonstrates the use of multiple threads. ECHOPORT also demonstrates the use of the WIN32 Sleep() function.
Also examine the EVENT.C example program, which uses both threads and the SioEvent function. Note that in Windows NT/2000/XP (but not in Windows 95/98/Me), calling
SioEvent(Port, EV_RXCHAR)
blocks the outgoing serial stream as well as the incoming serial stream.
Windows CE versions of WSC32.DLL can be downloaded from our web site at www.marshallsoft.com/wsc4c.htm. Let us know if you have any problems.
Registered users can recompile WSC32.C for Win/CE using the Microsoft Embedded Tools C/C++ cross compiler. Follow the directions in the text file EMBEDDED.TXT.
Like Windows itself, WSC functions are coded in ANSI C, but they can be called directly from both ANSI C programs and from C++ programs.
WSC functions can also be called using the C++ class wrapper fSio. Refer to HELLO.CPP for an example.
Your command line compiler tools must be set up properly. Note that you have an option of installing the command line tools (or not) when your compiler is first installed. Refer to your compiler manufacturer's manual for details.
If necessary, you can increase the size of your environment table space (to 1024 for example) by adding
SHELL=C:\COMMAND.COM /e:1024 /p
to CONFIG.SYS in C:\ and then rebooting. Yes, this works for all versions of Windows, including Windows NT, 2000, and XP
For all compilers, your path should point to the compiler's BIN directory. For example, to add "C:\BC50\BIN" to your existing path, use
PATH C:\BC50\BIN;%PATH%
Set LIB and INCLUDE environment variables. For example,
SET INCLUDE=C:\MSVC\INCLUDE SET LIB=C:\MSVC\LIB
Check that TURBOC.CFG, BCC32.CFG, TLINK.CFG, and TLINK32.CFG all have the correct information in them, as they should have when your compiler was installed. For example, assuming your BC compiler is installed at C:\BC5, the INCLUDE (-I) and LIB (-L) paths are specified by:
-IC:\BC5\INCLUDE -LC:\BC5\LIB
BRCC (the Borland Resource Compiler) doesn't use the *.CFG files. Set the INCLUDE environment variable or BRCC will not be able to find the INCLUDE files (such as WINDOWS.H). For example,
SET INCLUDE=C:\BC5\INCLUDE
Clear the LIB environment variable (so it is not present when SET is typed at the command line) with
SET LIB=
Set the WATCOM environment variables to point to your compilers include (H) and BIN directories. For example,
SET INCLUDE=C:\WC11\H;C:\WC11\H\NT SET WATCOM=C:\WC11 SET EDPATH=C:\WC11\EDDAT SET WWINHELP=E:\BINW
The LCC environment variables are set like the others. For example,
SET INCLUDE=C:\LCC\INCLUDE SET LIB=C:\LCC\LIB
After making the above changes for your compiler, type PATH at the command line prompt to verify the search path, and type SET at the command line prompt to verify the INCLUDE and LIB environment variables.
If your compiler installation includes command line tools, then all of the example programs can be compiled directly from the command line. These same compiler commands can also be placed in a batch file.
See CONSOLE.BAT for an example of a console mode command line batch file and SIMPLE$.BAT for an example of a GUI mode command line batch file. Similarly, command line batch files can be created for all of the example programs.
Command line makefiles originated on UNIX systems. They are the standard way that C/C++ programs are constructed in command line environments. The advantage of makefiles (as compared to an integrated development environment) is that all compiler switches are coded within the makefile and the makefile can be run with a single keystroke.
Makefiles are provided for Microsoft, Borland, and WATCOM command line compilers.
All current windows compilers have an "Integrated Development Environment" (IDE) for building application programs in the Windows environment. Since there is no standard format for IDE project files, file names must be entered into the IDE from the keyboard.
Note that not only do IDE's vary between the different compiler manufacturers, but they also vary from version to version for the same compiler.
Creating a project makefile for the examples that have only command line makefiles is fairly straight forward. All of the IDE's use the concept of a file hierarchy. For example, the WSCVER example program file hierarchy in the IDE (for 32-bit) should look like:
WSCVER.EXE +++ WSCVER.C +++ WSC32.LIB
Replace WSC32.LIB above with WSC16.LIB for 16-bit applications, with WSC32BCB.LIB if using
Borland C++ Builder, and with WSC32LCC.LIB if using Lcc-Win32.
The order of the files is not significant. Also refer to the sections on individual IDE's that follow this section.
WSC4C has been tested with Microsoft C/C++, Microsoft Visual C/C++, Borland C/C++ , Borland C++ Builder, Borland Turbo C/C++, Watcom C/C++, and Lcc-Win32. Other Windows C/C++ compilers may work as well.
Note: See Section 4.2 for Microsoft Visual C/C++.
Microsoft C/C++ programs can be compiled from either the command line or from within the Microsoft development environment.
The last Win16 Microsoft compiler is version 1.52. All Microsoft Visual C/C++ compilers (beginning with version 4.0) compile Win32 programs ONLY.
All Microsoft Win16 makefiles end with "16._m_". Note that many of the example programs are console mode programs, and cannot be compiled as Win16 programs since Win16 does not support console mode. To compile, use the Microsoft NMAKE utility:
NMAKE -f SIMPLE16._M_
WSC can be used with Microsoft Foundation Class (MFC) programs. Use the MFCPGM16.MAK makefile to compile the MFC_PGM example program.
NMAKE -f MFCPGM16.MAK
Microsoft Visual C/C++ programs can be compiled from either the command line or from within the Microsoft development environment. All MSVC programs are Win32 only.
Programs can be compiled using command line makefiles. All Microsoft Win16 command line makefiles end with "16._m_" while Win32 command line makefiles end with '32._m_". To compile using a makefile, use the Microsoft NMAKE utility. For example,
NMAKE -f SIMPLE16._M_ NMAKE -f SIMPLE32._M_
WSC can be used with Microsoft Foundation Class (MFC) programs. Use the MFCPGM32.MAK makefile to compile the MFC_PGM example program.
NMAKE -f MFCPGM32.MAK
To open an existing project, choose "File", then "Open Workspace", and then select "Makefiles" from the list of file types. Several of the example programs have Microsoft Visual Studio C/C++ makefiles, ending with ".MAK" , such as
WSCVER32.MAK SIMPLE32.MAK
To create a new project in MSVC 4.0, choose "File", then "New", then "Project Workspace". Select "Application" or "Console Application" for "Type:" and your project name for "Name:". Choose Win32 for platform. Then select "Create". Select "Insert", then "Files into Project". Add all filenames including any resource file (.RC) and WSC32.LIB. Lastly, select "Build", then "Rebuild All".
To create a new project in MSVC 5.0, choose "File", then "New", then "Win32 Application" or "Win32 Console Application " and your project name. Check "Create new workspace". Select "Project", then "Add to Project". Add all filenames including any resource file (.RC) and WSC32.LIB. Lastly, select "Rebuild All".
If the compiler complains that it cannot find "_main", "Console Application" was chosen but the program being compiled is a GUI application. If the compiler complains that it cannot find "WinMain", "Application" was chosen but the program being compiled is a Console Mode application.
Creating a new project in MSVC 6.0 follows the same logic as for MSVC 5.0.
Borland C/C++ version 5.0 programs can be compiled from either the command line (using makefiles ending with "._b_") or from within the Borland development environment using Borland v5.0 or above.
In order to use WSC with Borland C/C++ version 4.0 or version 4.5, you will have to download the legacy DLLs for Borland from our web site at www.marshallsoft.com/wsc4c.htm.
Borland C/C++ version 5.5 (which can be downloaded from www.borland.com) is a free Win32 console mode compiler (no IDE). Makefiles for BC v5.5 end with "._i_", and (like Borland C++ Builder) use ILINK32 rather than TLINK32. Be careful with linker response files (*.RSP) -- they must NOT end with a carriage return / line feed!
Borland programs always link with WSC32BCB.LIB.
Programs can be compiled using command line makefiles. All Borland Win16 command line makefiles end with "16._b_" while Borland Win32 command line makefiles end with "32._b_" (or "32._i_" for Borland 5.5). To compile using a makefile, use the Borland MAKE utility. For example,
MAKE -f SIMPLE16._B_ MAKE -f SIMPLE32._B_
To create a new project, first turn off LINKER case sensitivities: Choose "Options", "Projects", "Linker", "General". Turn off the "case sensitive link" and "case sensitive exports and imports" boxes.
Next, choose "Files", then "New Project". Use the INS (Insert) key to pop up a dialog box into which the project file names are entered. Lastly, add WSC32BCB.LIB to your project. WSC32BCB.LIB can also be created from WSC32.DLL using the Borland IMPLIB utility:
IMPLIB WSC32BCB.LIB WSC32.DLL
Select "GUI" or "Console" for the "Target Model:". Only "Static" or "Dynamic" should be checked for "Standard Libraries:"
NOTE1: If, after linking in the IDE, you get unresolved external references to the library functions in which each function name is all upper case, then you have NOT turned off case sensitivity as described above.
NOTE2: If you get errors compiling the windows header file "WINDOWS.H", turn on "Borland Extensions" in "Options", "Project", "Compiler", "Source".
Borland Turbo C/C++ for Windows does not have command line tools, so all programs must be compiled from the Turbo C/C++ integrated environment.
Follow the same directions as above (Borland IDE), except that the "Target Model:" can be any listed.
Borland C++ Builder does not have command line tools, so all programs must be compiled from the Borland C++ Builder integrated environment. Compile the BCB example program BCB_PRJ with BCB_PRJ.MAK if running BCB version 1 through 3, and compile with BCB_PRJ.BPR if running BCB version 4 or above.
To load the BCB_PRJ example project, Choose "File" / "Open Project" on the menu bar. Load BCB_PRJ.MAK (or BCB_PRJ.BPR). Then, choose "Build All" from "Project" to create the executable.
Note that WSC32BCB.LIB is the LIB file used with Borland C++ Builder. WSC32BCB .LIB can be created from WSC32.DLL by using the Borland IMPLIB program:
IMPLIB WSC32BCB.LIB WSC32.DLL
Watcom C/C++ programs can be compiled from either the command line or from within the Watcom development environment.
Watcom v10.5and v10.6 do not recognize the "declspec" keyword, and there require "legacy DLL's", which can be downloaded from www.marshallsoft.com/wsc4c.htm.
Win32 programs can be compiled using command line makefiles. All Watcom command line makefiles end with "32._w_" for Win32 makefiles. To compile using a makefile, use the Watcom WMAKE utility. For example,
WMAKE -f SIMPLE32._W_
Win32 programs can also be compiled using command line batch files. See SIMPLE$.BAT for an example of a console mode command line batch file and SIMPLE$.BAT for an example of a GUI mode command line batch file. To run these command line batch files from the command line, type
SIMPLE32
To create a new project, choose "File", then "New Project". Enter the project name and then choose Win32 as the target. Use the INS (Insert) key to pop up a dialog box into which the project file names are entered.
Select "Options" from the main window, then "C Compiler Switches", then "10". Memory Models and Processor Switches". Check "80386 Stack based calling [-3s]", then check "32-bit Flat model [-mf]".
Lcc-Win32 C/C++ programs can be compiled from either the command line or from within the development environment.
Lcc-Win32 is a freeware C compiler developed and distributed by Jacob Navia at
http://www.cs.virginia.edu/~lcc-win32/
To use our DLL's with Lcc-Win32, you must link with WSC32LCC.LIB. This file can also be re-created using the Lcc-Win32 utility BUILDLIB.
buildlib wsc32.lcc wsc32lcc.lib
Then, compile and link as normal. For example, to compile the CONSOLE example program,
lcc -DWIN32 console.c lcclnk console.obj wsc32.lib -subsystem:console
To compile the GUI mode example SIMPLE,
lcc -DWIN32 simple.c lcc -DWIN32 about.c lcc -DWIN32 line.c lcc -DWIN32 paint.c lcc -DWIN32 sioerror.c lrc simple.rc lcclnk simple.obj about.obj line.obj paint.obj sioerror.lib wsc32lcc.lib simple.res -subsystem:windows
See CONSOLE.BAT for an example of a console mode command line batch file and SIMPLE$.BAT for an example of a GUI mode command line batch file.
Command files are used for Lcc-Win32 rather than makefiles since the makefile that comes with LCC-Win32 does not work well (unlike the actual compiler).
WSC16.DLL and WSC32.DLL have been compiled using Microsoft Visual C/C++, and are callable from applications written using Microsoft, Borland, or Watcom compilers. If you recompile WSC32.C using Borland or Watcom compilers, then the resulting WSC32.DLL can only be used by applications compiled with the same compiler, unless the "_stdcall" and "_declspec" keywords are specified.
For Microsoft C, type:
NMAKE -f WSC16._M_ NMAKE -f WSC32._M_ For Borland C, type: MAKE -f WSC16._B_ MAKE -f WSC32._B_ For Watcom C, type: WMAKE -f WSC16._W_ WMAKE -f WSC32._W_
There are makefiles provided for each of the example programs. For example, to compile SIMPLE:
For Microsoft C, type:
NMAKE -f SIMPLE16._M_ NMAKE -f SIMPLE32._M_ For Borland C, type: MAKE -f SIMPLE16._B_ MAKE -f SIMPLE32._B_ For Watcom C, type: WMAKE -f SIMPLE16._W_ WMAKE -f SIMPLE32._W_
There is also a Microsoft Developer Studio generated makefile for SIMPLE. See SIMPLE.MAK.
The registered user can also statically link WSC16.OBJ or WSC32.OBJ, rather than making calls to the DLL's. To create an application which links WSC16.OBJ or WSC32.OBJ statically:
If using Microsoft Developer Studio, make these changes:
Alternatively, WSC16.C and WSC32.C can be edited so that they can be compiled and linked like any other program file. In order to do this, remove all code from WSC16.C and WSC32.C from
#ifndef STATIC_LIBRARY
to the following
#endif
Many of the example programs are written in Win32 console mode. This was done in order to provide the clearest possible code, without the complication and complexity of GUI code. All console mode programs can be converted to GUI mode by adding the necessary Windows interface code. Example programs are located in the APPS directory.
Makefiles are classified as follows:
Files ending with .MAK (and .BPR) include:
The first example program is the GUI program WSCVER (WSC Version) which displays the WSC library version number.
There are command line makefiles for Microsoft (WSCVER32._M_), Borland (WSCVER32._B_), and Watcom (WSCVER32._W_), as well as a Microsoft Developer Studio makefile (WSCVER32.MAK), and a Lcc-Win32 command file (SIMPLE$.BAT).
After compiling, from the command line, type:
WSCVER
SIMPLE is a very simple communications program using WSC4C. Everything typed on the keyboard is sent to the serial port, and everything incoming from the serial port is displayed on the screen.
The easiest way to test SIMPLE is to connect to a modem. Typing "AT" should result in an "OK" being displayed.
SELFTEST performs a serial port I/O functionality test using a loopback adapter. Refer to LOOPBACK.TXT for an explanation of how to make a loopback adapter (without tools!).
MODEM is similar to SELFTEST, but with enhanced capability. It can set flow control (hardware, software, or none), DTR line (set or clear), RTS line (set or clear), display the transmit & receive queue sizes, detect a break signal, detect changes in DSR and CTS. It can also check for various line errors such as parity error, framing error, data overrun, receive queue overflow, and transmit buffer full.
TERM is a simple ANSI terminal emulator suitable for calling up a BBS and downloading or uploading files using XMODEM or YMODEM. The TERM program uses MIO16.DLL (or MIO32.DLL) for modem control commands, and XYDRV16.DLL (or XYDRV32.DLL) for XMODEM & YMODEM file transfer.
Selecting "Dial" from the menu bar will result in a pop-up dialog requesting the phone number to dial. Once entered, the number is dialed, and the program will wait for up to 60 seconds for the "CONNECT" string from the modem. This wait can be terminated at any time by choosing "BREAK" on the menu bar.
Once logged on, files can be uploaded or downloaded by selecting "Send" or "Receive" from the menu bar. To abort a file transfer, choose "BREAK" from the menu bar then type a series of Ctrl-X (^X) characters from the keyboard.
TERM uses ANSI.C, which provides ANSI terminal emulator support.
BCB_PGM is a Borland C++ Builder example program similar to SIMPLE. BCB_PRJ.MAK is the BCB makefile necessary for building BCB_PGM.EXE.
MFC_PGM is a Microsoft Foundation Class C++ program similar to SIMPLE. MFCPGM16.MAK is the Win16 makefile and MFCPGM32.MAK is the Win32 makefile. File NAFXCW.LIB may have to be copied from MFC\LIB on your Microsoft Visual C/C++ CD disk.
The CONSOLE program is a WIN32 console mode program similar to SIMPLE. It also demonstrates how to acquire and manipulate the standard input handle so that a "KeyPress" function can be implemented.
CONSOLE takes the port and baud rate as arguments. For example, to start CONSOLE on COM1 at 38,400 baud:
CONSOLE 1 38400
The FINDER program is a WIN32 console mode program that searches for a connected modem. Your modem must be connected to one of COM1 through COM4, and the modem must be turned on. FINDER takes no arguments.
The ECHOPORT console mode program demonstrates the use of threads. Connect COM1 and/or COM2 to another computer or serial device using a NULL modem cable. ECHOPORT will echo back to the remote anything that it receives on the serial port. ECHOPORT takes no arguments.
The EVENT console mode program demonstrates the use of SioEvent in efficiently waiting for serial input. No polling or timer is required. EVENT operates like SIMPLE. Recall that SioEvent blocks until the requested event occurs, which is why SioEvent is called from a thread rather than the main application code.
XMS (XMODEM Send) and XMR (XMODEM Receive) are console mode programs that send and receive files using the XMODEM protocol. YMS (YMODEM Send) and YMR (YMODEM Receive) are console mode programs that send and receive files using the YMODEM protocol.
The RS485 example console mode program operates like SIMPLE, except that it assumes an RS485 port. RTS is set before transmitting data, and cleared after the last bit of the last byte has been sent.
The DEVICE console mode program is designed for talking to an arbitrary serial device. Use this program as a guide when communicating with all serial devices other than modems and other computers.
The HOST console mode program is a simple example of a one-line BBS, which is capable of answering an incoming call. HOST uses both WSC32.DLL and MIO32.DLL. Start HOST from the command line passing the port and baud rate. For example,
HOST 1 19200
The DIAL console mode example program uses the MIO module to dial up using the port, baud rate, and phone number specified by the user on the command line. For example
DIAL 1 38400 "1,256,880,9748"
We have other examples programs including programs for controlling voice modems (which use the Rockwell voice/data chip set), an example of handling continuously incoming data, and others.
Version 1.0: September 6, 1996.
Version 2.0: January 25, 1997.
Version 2.1: June 2, 1997.
Version 2.2: October 1, 1997.
Version 2.3: July 15, 1998.
Version 2.4: May 17, 1999.
Version 3.0: July 12, 2000.
Version 3.1: April 19, 2001.
Version 3.2: July 17, 2002.