Dec 132017
 
AT2 is a simple OS/2 program with a limited but useful function: it sends characters from the OS/2 commandline as AT-command to a Hayes compatible modem (with blanks suppressed).
File AT2-14A.ZIP from The Programmer’s Corner in
Category OS/2 Files
AT2 is a simple OS/2 program with a limited but useful function: it sends characters from the OS/2 commandline as AT-command to a Hayes compatible modem (with blanks suppressed).
File Name File Size Zip Size Zip Type
AT2.DOC 12004 4602 deflated
AT2.EXE 9683 5931 deflated
AT3.EXE 26679 14014 deflated
IBM7855A.CMD 1518 758 deflated

Download File AT2-14A.ZIP Here

Contents of the AT2.DOC file




AT2 --- by Rob Hamerling

AT2

This document describes the programs AT2 and AT3:

AT2 OS/2 1.3 or 2.0 (16-bit version)
AT3 for OS/2 2.0 (32-bit version)

From version 1.4a on I use a single source file. This means that both
executables:

are functionally identical
have the same version number, currently 1.4a

For simplicity only AT2 is mentioned in the remainder of this text.
Essential differences between AT2 and AT3 are mentioned explicitly.


INTRODUCTION

AT2 is a simple OS/2 program with a limited but useful function: it sends
characters from the OS/2 commandline as AT-command to a Hayes compatible
modem (with blanks suppressed).

AT2 also shows the modem response(s), if any, which may be redirected, for
example to be stored in a file.


WHO MAY USE AT2?

AT2 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 AT2.

R. Hamerling
Vianen, The Netherlands
Phone: ++31.3473.72136 (voice, maybe my answering machine)
FIDOnet: 2:512/4.1098

AT2 may be distributed freely, without chargeing 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:

AT2 is distributed as ZIP file (AT2_1.4a.ZIP) with the following contents:

AT2.DOC This documentation file

AT2.EXE 16-bits executable, for OS/2 1.3 and 2.0

AT3.EXE 32-bits executable, for OS/2 2.0 only

IBM7855A.CMD Sample commandfile to customise an IBM 7855-010 modem for a
specific purpose: use it for SDLC with the Communications
Manager, and in Async mode for Bulletin Boards, etc.




AT2 --- by Rob Hamerling

AT2 PARAMETERS

AT2 builds the string to be sent to the modem with all commandline
parameters. These may be specified as a single string, or as separate
parameters, which will be concatenated by AT2 to form a single string. The
string will be preceeded with 'AT' and terminated with a Carrier Return
character (ASCII 13).

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


SPECIAL PARAMETERS

AT2 accepts 2 optional parameters to control its behaviour. These must be
specified as first parameters on the OS/2 commandline and can only be
numeric to distinguish them from modem-commands. Of course these
parameters will not be sent to the modem, AT2 will send the first
non-numeric and all subsequent parameters (even if numeric) to the modem.

1. A value from 1 to 8 will be considered as port number (COM1...COM8).
COM1 will be addressed by default.

2. A value higher than 8 will be considered as port-speed to be set and
subsequently used to transmit the AT-command and receive the modem
response. If not specified, the speed with which the COM-port has been
initialised before will be used and not changed.

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

Invalid port number will result in a DosOpen failure (rc=110)
Unacceptable speed will give a DosDevIOCtl error (rc=87) (e.g. when a
value higher than 19200 for OS/2 1.3 is specified).

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


EXAMPLES

Here some examples for AT2:

AT2 Z Reset modem: AT2 will send 'ATZ' to the modem.

AT2 E1 Set modem command-echoing ON: AT2 will send 'ATE1' to
the modem.

AT2 19200 M1 Set the com-port to 19200 bps and set modem-speaker on.

AT2 2 \S Report modem configuration of modem on COM2.

AT2 ^&V >modem.cfg Report current and stored modem profiles, and store
modem responses in file 'modem.cfg' (note: this command may
vary with the modem).

Note: A '^'-character is needed as escape-character in front
of every '&'-character on the commandline of AT2! The
'&'-character otherwise acts as command separator. See your


AT2 --- by Rob Hamerling

OS/2 command reference manual for details.

AT2 ^&Z0=0347372136 Store (replace) a telephone number in the modem
directory.

Of course these are just examples, use your imagination!


COMMANDFILE FOR IBM7855

Of course AT2 can also be used from a batch file. As an example this AT2
package contains a file IBM7855A.CMD to customise the IBM 7855-010 modem
for use by an asynchronous communications package, while the modem is
started-up in sync-mode with power-on. So the modem can be used with the
communications manager in SDLC-mode with a Multiprotocol Communications
Adapter or SDLC-card, and be used in Asynchronous mode after switching the
modem to an Asynchronous communications port.


RETURNCODES

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

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

When the modem does not respond, the returncode of AT2 will be the value
255. This may however not be a real error. Examples are: the modem is in
echo-off state, programmed to not responding.




























AT2 --- by Rob Hamerling

IMPLEMENTATION



IMPLEMENTATION

AT2 is completely written in C-language, and uses the standard OS/2
Application Programmers Interface and functions provided by the COM-port
drivers COM0x.SYS of OS/2 1.3 and COM.SYS for OS/2 2.0.

It is distributed in 2 versions:

a 16-bit version for OS/2 1.3 and 2.0, compiled with MS-C 6.00a and IBM
Program Development Toolkit 1.2/1.3.

a 32-bit program useable with OS/2 2.0 only, compiled with IBM C Set/2
and IBM Program Development Toolkit 2.0. This version has a pretty
large EXE-file, since it has been linked 'statically' with some runtime
library routines for those of you who do not have that library (others
may want to recompile with the /GD+ option).



CONTROL OF THE DTR SIGNAL

AT2 does (by default) not set DTR true during execution. The 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
AT2 only tries to deliver an AT command. On the other hand there are
modems which do not accept an AT command when DTR is not true, and almost
certainly will not deliver responses in that case.

To make AT2 generally useful for modems which require DTR being true before
accepting AT-commands, AT2 scans for an environmentstring "AT2" during its
startup phase. When this string is set to "DTR", AT2 does set DTR true
before delivering its AT-command (and drops it before termination).
Otherwise AT2 keeps DTR false.

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

SET AT2=DTR

in case you have a modem that needs DTR to work with AT2. Just try without
this SET command to see if AT2 works as desired. If not, try with this
enviroment setting, then it should work.

Note:

1. For AT3 the environment string should be named AT3 (SET AT3=DTR).

2. RTS is made true during execution of AT2, otherwise many modems would
not listen at all.








AT2 --- by Rob Hamerling

LIMITATIONS

The following minor restrictions may cause you some inconvenience:

Most Hayes-compatible modems have a commandbuffer of 40 characters.
Therefore AT2 limits the command-string to 40 characters.
'^'-characters on the commandline do not appear to AT2 and will
therefore not be included. The first parameter that would make the
length of the AT-command string exceed 40 characters and all subsequent
parameters will be ignored. Of course this does NOT include
AT2-parameters for COM-port and speed. If you need to sent more data to
your modem, use as many invocations of AT2 as you desire.

For communication with the modem, AT2 may change certain COM-port
parameter settings. These parameters are not reset to their previous
values after AT2 has finished. This may leave the port in a setting
that you may want differently.

Always issue a MODE command with the proper parameters after using AT2.


AT2 IS NOT A REPLACEMENT FOR MODE

AT2 is not a stand-in for the MODE command:

It would make AT2 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
make DTR come true. So the use of AT2 may be more convenient.

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


AT2 DESIGN ISSUES

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 the modem might be
programmed to dial a built-in phone number to a SYNC connection point when
DTR becomes true. This may have some undesirable effects:

It is in most cases not useful to start dialing the programmed number
when you are in the process of configuring your COM-port or modem.
It is certainly not useful to dial a service with Synchronous protocol
when the modem is connected to an ASYNC port (which is the only
possibility to deliver AT-commands)!

To avoid these problems, AT2 opens the COM-port by default without making
DTR true



AT2 --- by Rob Hamerling

With AT2 you must be able to send any AT-string to the modem. To avoid a
possible interpretation error (whether AT2 should use a commandline
parameter as program-parameter or a modem-command), an environment variable
is used to control the DTR signal.

AT2 waits about 0.5 seconds for the modem to transfer a response after
receiving an AT command. This timeout is long enough for most modems. On
the other hand it ensures that AT2 terminates quickly when there is no
response, or even when there is no modem connected to the port at all.

Some modems have multiple output screens to show its configuration after
being requested so (for example with the command AT\S). The operator is
requested to hit the ENTER key before the modem shows the next screen of
information. AT2 tries to anticipate this situation by issuing a CR
(Carriage Return) when the modem stops sending data. If this works for
your modem you'll get the modem-configuration in 1 single outputstream.
Otherwise you may get the remaining screens at the next occasion, for
example when your 'real' communications program opens the COM-port.



 December 13, 2017  Add comments

Leave a Reply