home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 3 Comm
/
03-Comm.zip
/
at3_15b.zip
/
AT3.DOC
next >
Wrap
Text File
|
1997-01-03
|
15KB
|
442 lines
AT3 --- by Rob Hamerling
AT3
This document describes the program AT3 for OS/2 2.0 and up (32-bit
version).
INTRODUCTION
AT3 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).
AT3 also shows the modem response(s), if any, which may be redirected,
for example to be stored in a file.
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.
R. Hamerling
Vianen, The Netherlands
Phone: BBS/FAX: 31-347-322423
FIDOnet: 2:281/732 or 2:280/804.1098
E-mail: rob.hamerling@f732.n281.z2.elcom.org
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_15B.ZIP) with the following
contents:
AT3.DOC This documentation file
AT3.EXE 32-bits executable, for OS/2 2.0 and newer
IBM7855A.CMD Sample commandfile to customise an IBM 7855-010 modem for
use in ASYNC mode with RTS/CTS handshaking.
AT3 PARAMETERS
AT3 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 AT3 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.
AT3 1
AT3 --- by Rob Hamerling
SPECIAL PARAMETERS
AT3 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, AT3 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, AT3 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)
AT3 does not perform any kind of syntax checking for modem commands.
EXAMPLES
Here some examples for AT3:
AT3 Z Reset modem: AT3 will send 'ATZ<CR>' to the modem.
AT3 E1 Set modem command-echoing ON: AT3 will send 'ATE1<CR>'
to the modem.
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 responses in file 'modem.cfg' (this command may
vary with the modem).
Note: A '^'-character is needed as escape-character in
front of every '&'-character on the commandline of AT3!
The '&'-character otherwise acts as command separator.
See your OS/2 command reference manual for details.
AT3 ^&Z0=322423 Store (replace) a telephone number in the modem
directory.
Of course these are just examples, use your imagination and your modem
manual!
AT3 2
AT3 --- by Rob Hamerling
COMMANDFILE FOR IBM7855
Of course 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 the 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 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, AT3 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 AT3 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 AT3 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.
AT3 3
AT3 --- by Rob Hamerling
IMPLEMENTATION
IMPLEMENTATION
AT3 is completely 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.
CONTROL OF THE DTR SIGNAL
AT3 does not set DTR true during execution by default. 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 AT3 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 AT3 generally useful for modems which require DTR being true
before accepting AT-commands, AT3 scans for the environmentstring "AT3"
during at 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
If 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 whithout DTR being true.
But also the standard timeout of AT3 is too short to wait for the
completion of a dial command. DTR will be turned off after that time,
which will prevent the modem from finishing the dial operation. The
sample value of '500' modifies the standard timeout from .5 seconds to
5 seconds (the value is expressed in hundredths of seconds), which will
generally be large enough for tone-dialing. But it may not be the
right value for your modem, modem command or network. Experiment with
this value!
Implementation 4
AT3 --- by Rob Hamerling
Note: Only values higher than the default of 50 (.5 seconds) are
accepted.
LIMITATIONS
The following minor restrictions may cause you some inconvenience:
■ Most Hayes-compatible modems have a commandbuffer of 40 characters.
Therefore AT3 limits the command-string to 40 characters.
'^'-characters on the commandline do not appear to AT3 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 AT3-parameters for COM-port and speed. If you need to sent
more data to your modem, use as many invocations of AT3 as you
desire.
■ For communication with the modem, AT3 may change certain COM-port
parameter settings. These parameters are not reset to their
previous values after AT3 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 AT3.
AT3 IS NOT A REPLACEMENT FOR MODE
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.
AT3 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 may stay 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
Implementation 5
AT3 --- by Rob Hamerling
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, AT3 opens the COM-port by default without
making DTR true
With AT3 you must be able to send any AT-string to the modem. To avoid
a possible interpretation error (whether AT3 should use a commandline
parameter as program-parameter or a modem-command), an environment
variable is used to control the DTR signal.
AT3 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 AT3 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. AT3 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.
Implementation 6
AT3 --- by Rob Hamerling
APPENDIX A. SAMPLE REXX COMMANDFILE FOR SETUP OF IBM 7855 MODEM
/* ╔═════════════════════════════════════════════════════╗ */
/* ║ IBM7855A.CMD by Rob Hamerling (see AT3.DOC file). ║ */
/* ╚═════════════════════════════════════════════════════╝ */
/* Change portnumber into the appropriate value (2 for COM2 etc). */
/* Change phone number as desired. */
modem = 'IBM 7855-010'
port = '2'
speed = '19200'
phone = '322423'
Say ''
Say 'Customise 'modem' modem for ASYNC (put it in SYNC mode with &M2).'
Say 'Modem must have been set in AT-commandset mode from the frontpanel!'
say ''
say 'Modem is supposed to be on COM'port':'
set AT3'='
/* First see if the modem responds: */
AT3 port speed 'I'
if rc > 0 then signal noreply
/* Reset the modem to the factory settings: */
AT3 port '^&F1'
if rc > 0 then signal problem
/* Transmit the customisation commands: */
/* (this may be a little bit more than absolutely needed after &F1) */
AT3 port 'B0 E0 L1 M0 Q0 V1 X4 S0=0'
AT3 port '^&AP7 ^&AL8 ^&B8N1 ^&C1 ^&D2 ^&I0 ^&L0 ^&M0 ^&R1 ^&S2 ^&X0 ^&Y0'
AT3 port '^\A3 ^\C3 ^\G0 ^\K2 ^\M14 ^\N3 ^\Q2 ^\R2 ^\T2 ^\V1 ^\X0'
AT3 port '%%B0 %%C0 %%D0 %%E1 %%F1 %%G1 %%H1 %%I1 %%O1 %%R1 %%V0'
/* Store current configuration to both(!) NVM profiles */
AT3 port '^&W0 ^&W1'
/* Finally set the phone number to be auto-dialed in SYNC-mode. */
AT3 port '^&Z'phone
exit 0
problem:
if rc>0 then Say 'See returncode of reported function for probable cause.'
noreply:
if rc=255 then say '[rc='rc'] Is 'modme' modem connected to COM'port'?'
exit rc
Appendix A. Sample REXX commandfile for setup of IBM 7855 modem 7