AT3 Version 1.6


Users Guide and Reference


Rob Hamerling
Vianen, The Netherlands

E-mail: r.hamerling@planet.nl
homepage: http://www.geocities.com/digithalys/

Copyright © R. Hamerling, 1990, 2000
All Rights Reserved.


Table of Contents


Introduction

AT3 is an OS/2 program with limited but useful functionality:

Who may use AT3?

AT3 may be used for private personal use only, not in a commercial or business environment. Please contact the author if you have a business need for AT3.

AT3 may be distributed freely, without charging a fee, as long as it remains a complete package as originally distributed and no other changes are applied without the explicit permission by the author.

Package contents:

AT3 is distributed as ZIP file (AT3_16C.ZIP) with the following contents

AT3.HTM
This documentation file (HTML format)
AT3.EXE
32-bits executable, for OS/2 Warp 3.0 and newer
IBM7855A.CMD
Sample REXX procedure to customise an IBM 7855-010 modem for use in ASYNC mode with RTS/CTS handshaking.
AT3R.CMD
Sample REXX procedure to collect the modem response in the procedure for further processing.

Users Guide

Modem command specification

AT3 builds the AT command to be sent to the modem from the commandline. The modem command may be specified as a single string or as separate words. AT3 will concatenate the whole commandline into a single string. The string will be preceeded with 'AT' and terminated with a Carriage Return character (ASCII 13).

The string will be sent to the modem in 8-bit, NO parity, 1 stop-bit mode.

Optional Commandline Parameters

AT3 accepts 2 optional commandline parameters to control its behaviour. These must be specified as first parameters on the OS/2 commandline and must be numeric to distinguish them from being part of the modem command. These parameters will not be sent to the modem. AT3 will send the first non-numeric and all subsequent parameters (even if numeric) to the modem.

When either the port is not available (not installed or in use), or the speed is not an acceptable value for OS/2, AT3 will terminate with an error message, and not issue any AT-command. The most common errors are:

AT3 does not perform any kind of syntax checking for modem commands.

Modem reply

AT3 sends the modem reply to the stdout stream, which will normally mean it will appear on the computer screen. The output may be redirected as with any other normal OS/2 command.

Some modems reply to some commands with a number of pages of output, and require user interaction (the Enter-key) for each subsequent page of output. AT3 takes care of this, such that the modem reply will appear as a single reply to the user. See Multiple modem replies for a special case.

Returncodes

When AT3 is invoked without any parameter, some help information is displayed, and a returncode of 1 is returned.

When the modem does not reply, the returncode of AT3 will have the value 255. This may however not be a real error, for example the modem may be in echo-off state or be programmed to never respond.

When encountering some kind of problem during execution, AT3 displays a message indicating the last executed function (DosOpen, DosRead, DosDevIOCtl, etc), and the returncode of that function. This returncode is also returned in 'errorlevel' for use in batch files.

Examples

Below some examples of the use of AT3:

AT3 Z
Reset modem
AT3 E1
Set modem command-echoing ON
AT3 19200 M1
Set the com-port to 19200 bps and set modem-speaker on.
AT3 2 \S
Report configuration of modem on COM2.
AT3 ^&V >modem.cfg
Report current and stored modem profiles, and store modem replies in file 'modem.cfg' (this command is modem dependend).
Note: A '^'-character (caret) is needed as escape-character in front of every '&'-character (ampersand) on the commandline of AT3! The '&'-character otherwise acts as command separator. See your OS/2 command reference manual for details.
AT3 ^&Z0=322822
Store (replace) a telephone number in the modem directory.

These are just examples, use your imagination and your modem manual!

AT3 and REXX

AT3 can also be used from a batch file or a REXX procedure. As an example this AT3 package contains a file IBM7855A.CMD to customise an IBM 7855-010 modem for use by an asynchronous communications package.
With a slight modification (&M2 in stead of &M0) the modem is started-up in sync-mode with power-on. So the modem can be used in SDLC-mode with an SDLC-card, and in Asynchronous mode after switching it to an Asynchronous communications port.

The modem reply may also be catched and processed in the same REXX procedure which issued the modem command with AT3. See the file AT3R.CMD for an example.


Usability Considerations

Control of the DTR signal

AT3 does not set DTR true during execution by default. The main reason for this is that modems which are programmed with a phone number to be dialed when DTR becomes true might inadvertently start to dial that number when AT3 only tries to deliver an AT command. On the other hand there are modems which do not accept AT commands when DTR is not true, and almost certainly will not deliver replies in that case!

To make AT3 useful for modems which require DTR being true before accepting AT-commands, AT3 scans for the environmentstring "AT3" during startup. When this string is set to "DTR", AT3 activates the DTR lead before delivering its AT-command, and drops it at termination. Otherwise AT3 keeps DTR false.

So enter (e.g. in your CONFIG.SYS):

     SET AT3=DTR
in case you have a modem that needs DTR to work with AT3. If you don't know, just try without this SET command to see if AT3 works as desired. If not then make it work with this enviroment setting.

NOTE AT3 makes RTS true during execution, otherwise hardly any modem would listen to commands from the computer.

Dialing

When you want to use AT3 for dial commands, then you need to set the environment variable slightly different, for example:

     SET AT3=DTR,500

Hardly any modem will execute a dial-command without DTR being true. But also the default timeout value of AT3 (0.5 seconds), is too short to wait for the completion of a dial command. DTR will be turned off after that time, which will cause the modem to abort the dial operation. The value of '500' in the example above modifies the standard timeout to 5 seconds (the value is expressed in hundredths of seconds), which will generally be large enough for tone-dialing. You may have to experiment with your modem to find the right value for your modem, your dial-command or your telephone network.

Warning: Any value greater than 0 is accepted, but a very low may cause AT3 to terminate before the modem had a chance to reply, especially with ERROR replies! You should experiment.

Restrictions and Limitations

The following minor restrictions may cause you some inconvenience

Relation with the MODE command

AT3 is not a stand-in for the MODE command

  • It would make AT3 considerably more complicated and error-prone.
  • Every OS/2 installation has the MODE-command available, so why duplicate good work?

    The exception is the setting of port-speed. Using the MODE-command just for setting the speed of the COM-port has the potential problem that it may set DTR true.

    Use AT3 to address your modem, use MODE to control your COM-port.


    Design Issues

    This chapter is meant to give some background information about the design of AT3.

    Control of the DTR signal

    It was originally designed for just switching a modem from SYNC to ASYNC mode (and vice versa) in a situation where communications services are used of which some use Synchronous (SDLC) protocol and others use Asynchronous protocol. This could be done with redirecting an ECHO command (ECHO ATE1 >COM1), which works perfectly for DOS in combination with some modems. However, OS/2 and some other modems behave differently.

    MODE and ECHO may result in DTR becoming true (and may stay true!). And the modem might have been prpgrammed to dial a phone number from its profile to a SYNC connection point when DTR becomes true. This may have some undesirable effects:

    Therefore AT3 opens the COM-port by default without making DTR true, but it can set DTR true when required. To avoid possible interpretation errors of the commandline this is controlled by an environment variable.

    Multiple modem replies

    Some modems reply with multiple output pages to show the configuration after being requested so (for example with the command AT\S or AT&V). The operator is requested to hit the ENTER key before the modem shows the next page of information. AT3 tries to anticipate on this situation by sending a CR (Carriage Return) character when the modem stops sending data. If this works for your modem you'll get the modem-configuration in 1 single outputstream. Otherwise the modem will probably stack the remaining pages and send them at the next occasion, for example when your 'real' communications program opens the COM-port!

    To play it safe AT3 assumes that every modem reply is in multi-page mode. To determine the real end of the modem reply AT3 sends a CR character after it did not receive any data for a period of the timeout value, and waits again for this time. So the minimum elapsed time before AT3 terminates is at least 2 times the timeout value. Please read the following section for a possibility to speedup AT3!

    Timeout

    AT3 waits by default about 0.5 seconds for the modem to start transferring a reply as reaction on the AT command. Most modems react much faster! On the other hand it is short enough to let AT3 terminate quickly when there is no reply, or even when there is no modem connected to the port at all.

    You might experiment with shorter timeout values. This can be accomplished with the environment variable as described with Dialing, for example you might specify:

      set AT3=DTR,10
    
    to obtain a 0.10 second timeout value.
    Note: You may specify something else for 'DTR' if you don't want DTR to become true.

    Miscellaneous Information

    Implementation

    AT3 is written in C-language, and uses the standard OS/2 Application Programmers Interface and functions provided by the COM-port driver COM.SYS for OS/2 2.0 and newer. The program has been compiled with IBM C/C++ 2.0 and IBM Program Development Toolkit for OS/2 Warp.

    Comments

    Comments, suggestions or problem reports can be sent to the E-mail address listed in the header of this document. Please provide all relevant information.
    I cannot guarantee that any additional functionality will be implemented, but I'll certainly do my best when your requirements would mean a useful improvement or extension of AT3!


    Appendix

    A. Summary of changes

    Below a summary of changes with each version.

    version 1.0
    1990 (first version)
    version 1.4
    August 1992
    • (history of changes since previous versions lost)
    version 1.5
    January 1997
    • introduction of user specified timeout for dial commands (with a minimum of 0.5 seconds).
    version 1.6
    March 1999
    • accepts user specified timeout values of lower than .5 seconds
    • port parameters restored after normal termination, except speed and character format; mode-command not needed anymore afterwards
    • bug fix: corrected improper handling of read timeouts
    • documentation converted to HTML format
    • does not accept more than 2 commandline parms, even when numeric

    B. Customise IBM 7855 modem

    For an example of the use of AT3 to custimise a modem, you may have a look at the provided sample REXX procedure IBM7855A.CMD.

    C. Obtain modem reply in REXX

    When you need to analyse the modem reply in a REXX procedure AT3R.CMD shows you a possibility.