15 Sept 1992 Version P2.0 Hayes Microcomputer Products, Inc. P.O. Box 105203 Atlanta, Georgia 30348 U.S.A. (c) 1990, 1992 Hayes Microcomputer Products, Inc. All rights reserved. 44-00012 AA H32 (BBS Version)Note: This version of the "Technical Reference for Hayes Modem Users" is a special version edited for bulletin-board downloading. As a plain ASCII character file, it therefore cannot contain any of the illustrations and graphic elements provided in the printed version.
Result Codes Description ------------------------------------------------------------------------ 300 Smartmodem 300. 120 Smartmodem 1200, Smartmodem 1200B, Smartmodem 1200C, Smartmodem 1200A. 240 Smartmodem 2400, Smartmodem 2400B, Smartmodem 2400P, Smartmodem 2400Q, Smartmodem 2400M, V-series Smartmodem 2400, V-series Smartmodem 2400B, V-series Smartmodem 2400 Quad, V-series Smartmodem 2400M, Smartmodem OPTIMA (TM) 24, Smartmodem OPTIMA 24 + FAX96, ACCURA (TM) 2400 EC/FAX96. 960 Smartmodem 9600, V-series Smartmodem 9600, V-series Smartmodem 9600B, V-series ULTRA (TM) Smartmodem 2400, V-series ULTRA Smartmodem 9600, V-series ULTRA 24 with Express 96, Smartmodem OPTIMA 9600, Smartmodem OPTIMA 96 + FAX96, ACCURA 9600 EC/FAX96. 14400 V-series ULTRA Smartmodem 14400, Smartmodem OPTIMA 144, Smartmodem OPTIMA 144 + FAX144, ACCURA 14400 EC/FAX144. ------------------------------------------------------------------------
Since the following tables identify features for Hayes modem products, the values included here and the number of strings are subject to change and expansion. The maximum length per string is 40 characters.
The I4 text is displayed in the following form:
a097800C204C264 bF60410000 r1031111111010000 r3000111010000000surrounded by additional <CR> and <LF> characters as are required by the V command option in effect. According to convention, all <CR> and <LF> characters are defined by S3 and S4, respectively. The meanings of the a, b, r1, and r3 strings currently defined are described below.
a D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13 D14 D15 D16 D17 D18.... ------------------------------------------------------------------------ D1, D2 Reserved D3 Bit 3: Indicates modem based on SM1200FE commands Bit 2: Indicates modem based on SM2400 commands Bit 1: Indicates that modem supports &J commands Bit 0: Indicates that modem supports &L commands D4 Bit 3: Indicates that modem supports AutoSync (&Q4) D5 Bit 3: Plug-in board modem product Bit 2: Standalone modem product Bit 1: Supports &H0 through &H4 Bit 0: Supports &I0 through &I4 D6 Bit 3: Reserved Bit 2: Supports M4 command Bit 1: Supports 32-bit FCS (frame check sequence for AutoSync) Bit 0: Supports AutoSync II D7 Bit 3: Supports V.22 at 1200 bps (B0) Bit 2: Supports 212A (B1) Bit 1: Supports ASB in V.23 75 bps xmt/1200 bps rcv (B2) Bit 0: Supports ASB in V.23 1200 bps xmt/75rcv (B3) D8 Bit 3: Supports V.23 1200 bps xmt/75 bps rcv (B4) Bit 2: Supports V.23 1200 half duplex (B5) Bit 1: Supports V.23 75 bps xmt/1200 bps rcv (B10) Bit 0: Supports V.23 75 bps xmt/600 bps rcv (B11) D9 Bit 3: Supports V.21 100/300 bps (B15) Bit 2: Supports ASB in V.23 75 bps xmt/600 bps rcv (B20) Bit 1: Supports ASB in V.23 600 bps xmt/75 bps rcv (B21) Bit 0: Supports V.23 600 bps xmt/75 bps rcv (B22) D10 Bit 3: Supports V.23 600 bps half-duplex (B23) Bit 2: Supports V.22bis at 2400 bps (B30) Bit 1: Supports V.27ter at 2400 bps (B31) Bit 0: Supports V.27ter at 4800 bps (B40) D11 Bit 3: Supports V.32 full duplex at 4800 bps (B41) Bit 2: Supports Express 96 at 4800 bps (B42) Bit 1: Reserved Bit 0: Supports V.29 half duplex at 4800 bps (B44) D12 Bit 3: Supports V.29 half duplex at 7200 bps (B50) Bit 2: Supports V.32 full duplex at 9600 bps (B60) Bit 1: Supports Express 96 at 9600 bps (B61) Bit 0: Reserved D13 Bit 3: Supports V.29 half duplex at 9600 bps (B63) Bit 2: Supports 103 110/300 bps (B16) Bit 1: Supports V.32bis (7200/12000/14400 bps) Bit 0: Reserved ------------------------------------------------------------------------
------------------------------------------------------------------------ D1, D2 Reserved D14 0: Reserved 1: Personal Modem 1200 2: Personal Modem 2400 3: Personal Modem 1200 Plus 4: Personal Modem 2400 Plus 5: Pocket Edition D15 Bit 3: Reserved Bit 2: Supports $ dial modifier and NO DIALTONE result code. Bit 1: Supports S95 Bit 5 for COMPRESSION: result code Bit 0: Supports S95 Bit 4 for AUTOSTREAM: result code D16 Bit 3: Supports S95 Bit 3 PROTOCOL: result code Bit 2: Supports S95 Bit 2 CARRIER result code Bit 1: Supports S95 Bit 1 CONNECT/ARQ result code Bit 0: Supports S95 Bit 0 CONNECT XXXX (for DCE rate) ------------------------------------------------------------------------
b D1 D2 D3 D4 D5 D6 D7 D8 D9.... ------------------------------------------------------------------------ D1 Bit 3: V.42 Alternate Protocol Supported Bit 2: V.42 LAPM Protocol Supported Bit 1: X.25 Protocol Supported Bit 0: LAPB (Point-to-point error control) protocol supported D2 Bit 3: Reserved (should be set to zero) Bit 2 MNP (TM) Class 5 supported Bit 1: V.42bis supported Bit 0: Compression through the X.25 network supported D3/D4 These combine to indicate the number of AutoStream Type A channels which are supported. The formula (D3*16 + D4) is used. Zero means AutoStream is not supported D5 Bit 3: Reserved Bit 2: Reserved Bit 1: Adjustable startup (ASU) is supported Bit 0: Negotiates adjustable startup D6 Bit 3: &K5 not supported Bit 2: &K5 supported Bit 1: Unidirectional flow control Bit 0: S105 N104 parameter supported ------------------------------------------------------------------------
The presence of the r2-string in the I4 result infers that S87 is supported and is required for autobauding at the higher speeds. To autobaud at one of the speeds indicated in the r2-string requires that S87 be set to match that speed.
The r3-string is issued if synchronous DTE speeds are supported. The map indicates which DTE rates are supported in synchronous modes. Each r- string begins with the lower case letter "r" and may be followed by as many as 39 additional characters, not counting <CR><LF>'s that will be used to separate them from other strings. Those 39 additional characters are limited to the ASCII-HEX alphabet 0-9 and A-F.
After the two lead-in characters (i.e., r
In r1, if the bit is filled with a 1, the corresponding DTE rate is supported for sending AT commands to the device. A zero indicates that DTE rate is not supported for AT commands.
In the r3 map, the bits simply indicate which DTE rates are supported for synchronous operation on-line. This does not indicate, however, the supported rates for synchronous V.25bis commands.
Split speeds if available are marked in the r1 string only when the appropriate B command option has been selected. Future expansion of these strings may include new speeds that are not in strict ascending order.
Character Bit # DTE Rate ------------------------------------------------------------------------ 3: 1 bit 0 45.45 bps 2 bit 1 50 4 bit 2 75 8 bit 3 75/600 (xmt is 75, rcv is 600) 4: 1 bit 4 75/1200 2 bit 5 110 4 bit 6 134.5 8 bit 7 50 5: 1 bit 8 300 2 bit 9 450 4 bit 10 600 8 bit 11 600/75 6: 1 bit 12 1200 2 bit 13 1200/75 4 bit 14 1800 8 bit 15 2000 7: 1 bit 16 2400 2 bit 17 3000 4 bit 18 3600 8 bit 19 4200 8: 1 bit 20 4800 2 bit 21 5400 4 bit 22 6000 8 bit 23 6600 9: 1 bit 24 7200 2 bit 25 7800 4 bit 26 8400 8 bit 27 9000 10: 1 bit 28 9600 2 bit 29 12000 4 bit 30 14400 8 bit 31 16800 11: 1 bit 32 19200 2 bit 33 21600 4 bit 34 24000 8 bit 35 26400 12: 1 bit 36 28800 2 bit 37 31200 4 bit 38 33600 8 bit 39 36000 13: 1 bit 40 38400 2 bit 41 43200 4 bit 42 48000 8 bit 43 52800 14: 1 bit 44 56000 2 bit 45 57600 4 bit 46 62400 8 bit 47 64000 15: 1 bit 48 67200 2 bit 49 72000 4 bit 50 76800 8 bit 51 81600 16: 1 bit 52 86400 2 bit 53 91200 4 bit 54 96000 8 bit 55 100800 17: 1 bit 56 105600 2 bit 57 110400 4 bit 58 115200 8 bit 59 reserved ("0") ------------------------------------------------------------------------
The W command supports extended result codes in addition to the CONNECT result code. When the modem is operated in error-control mode (&Q5 is in effect), the W command and S95 together allow the user to select these additional result codes:
CARRIER PROTOCOL AUTOSTREAM COMPRESSION CONNECTAny result codes enabled by the W command and S95 will be generated in the order indicated above. If AutoStream is not being used, no AUTOSTREAM result code is returned. Result codes not enabled when the W command option is in effect may be turned on by setting certain bits in S95. The W command options below are available when S95 is configured for any setting other than the factory-setting of 0.
------------------------------------------------------------------------ W0 CONNECT result code reports DTE speed, and if S95=0, then disable all extended result codes. W1 CONNECT result code reports DTE speed, and if S95=0, then enable the CARRIER and PROTOCOL extended result codes. W2 CONNECT result code reports DCE speed, and if S95=0, then disable all extended result codes. ------------------------------------------------------------------------Refer to the S95 bit map description in the next section. Note that selecting W0 and setting S95=12 is the same as selecting W1; and that selecting W0 and setting S95=1 is the same as selecting W2. S95 cannot be configured to force W2 to report DTE speed in the CONNECT result code; there is no setting of S95 that will force W1 not to produce the CARRIER and PROTOCOL result codes. S95 extends the functionality of the W command. The W command with S95=0 (factory setting) maintains backwards compatibility with previous Hayes Products. However, selecting W0 and setting S95 as required allows you to tailor result code characteristics to your own requirements.
------------------------------------------------------------------------ Z0 Recall stored profile 0 Z1 Recall stored profile 1 ------------------------------------------------------------------------
&T19 in the modem works interactively with the DTE to confirm the RTS and CTS signal. Only the DTE can detect CTS, and only the modem can detect RTS. The modem cannot verify both signals without the active involvement of the DTE software.
The modem performs the following algorithm in response to the AT&T19<CR> command:
The following algorithm is used by Hayes Smartcom software in its use of the &T19 test:
Note: For more predictable timing, do not combine other commands on the same command line with &T19. Also, higher DTE port speeds improve the timing resolution.
A modification to the software algorithm could be made to permit software to detect which signal is missing from the cable. After issuing the AT&T19 <CR> command, give the modem about 100ms to drop CTS. Then, even if the CTS drop is not detected, proceed to toggle RTS anyway, keeping in mind that the CTS part of the test has failed.
RTS/CTS flow control is preferred because it is "out of band", that is, it does not consume any of the 256 serial codes from the user data. XON/XOFF flow control uses DC1 (ASCII 17) and DC3 (ASCII 19). If RTS/CTS is not supported, then Transparent Flow Control (&K5) is the next best option (IF the software supports it) because it accomplishes Xon/Xoff flow control without interfering with the user data (e.g. during binary file transfers).
The table below shows the various formats in which modem responses can be presented. Note that the "text" of the info-text may consist of multiple lines of text. The formats depicted here only refer to the <CR><LF> characters between info-texts and not within them.
------------------------------------------------------------------------ V0 V1 Information Text text <CR><LF> <CR><LF> text <CR><LF> Result Codes numeric code <CR><LF> <CR> verbose code <CR><LF> ------------------------------------------------------------------------
The command response and call progress monitoring result codes are defined below:
0 - OK
This result code indicates that a command or command string was
executed. Note that if more than one command were included on a line and
an ERROR result code received, this means that one or more of the
commands was not processed. If one or more were executed properly, but
even one was invalid, no OK will be issued, only the ERROR.
1 - CONNECT
This result code indicates a connection was made between the DTE and the
modem. If X4 (extended set of call progress monitoring) were selected,
the code indicates that a connection from at 0 to 300 bps was made.
However, if X0 (basic set of call progress monitoring) were selected,
the connection could be 0-300, 1200, 1200/75, 75/1200, 2400, 4800, 7200,
9600, 14400, 19200, or 38400 bps. If the modem is not operating in
error-control or ASB mode, this is the same as the line speed. See other
CONNECT messages and CARRIER messages.
2 - RING
This result code indicates the modem has detected a ring signal. No
distinction can be made as to whether this is a voice call, a modem
call, a fax call, or other type.
3 - NO CARRIER
This result code indicates that no carrier signal was detected, or that
the signal was lost. This is the response the modem will give when no
connection is made; see CONNECT result code. The modem will also return
this message when the connection is broken, either intentionally as when
the hangup process completes, or if line difficulties break the
connection.
4 - ERROR
This result code indicates that an invalid command was issued, or that
there was an error in the command line. For example, if the command line
exceeds the character limit for your modem, this result code will be
returned. See your user documentation to determine the character limit for
your modem. This result code is also returned in response to the I1 command
requesting a ROM checksum, if the modem detects an error in the computation.
5 - CONNECT 1200
This result code indicates a connection has been established at 1200,
1200/75 or 75/1200 bps between the modem and the DTE. If the modem is
not operating in error-control mode, this is the same as the line speed.
This result code is disabled by X0. Only CONNECT is reported.
6 - NO DIALTONE
This result code indicates that no dial tone was detected when the modem
went off hook. Dial tone detection and this result code are enabled by
X2 or X4, or the W dial modifier.
7 - BUSY
This result code indicates that the modem detected a busy signal when it
attempted to connect with the modem at the number dialed. Busy signal
detection and this result code are enabled by X3 or X4.
8 - NO ANSWER
This result code indicates no silence was detected when dialing a system
not providing a dial tone. Enabled by the @ dial modifier.
10 - CONNECT 2400
This result code indicates a connection has been established at 2400 bps
between the modem and the DTE. If the modem is not operating in error-
control mode, this is the same as the line speed. This result code is
disabled by X0. Only CONNECT is reported.
11 - CONNECT 4800
This result code indicates a connection has been established at 4800 bps
between the modem and the DTE. This result code is disabled by X0.
12 - CONNECT 9600
This result code indicates a connection has been established at 9600 bps
between the modem and the DTE. This result code is disabled by X0.
13 - CONNECT 14400
This result code indicates a connection has been established at 14400
bps between the modem and the DTE. This result code is disabled by X0.
14 - CONNECT 19200
This result code indicates a connection has been established at 19200
bps between the modem and the DTE. This result code is disabled by X0.
22 - CONNECT 1200/75
This result code indicates a connection has been established at 1200 bps
when transmitting data and 75 bps when receiving data between the modem
and the DTE.
23 - CONNECT 75/1200
This result code indicates a connection has been established at 75 bps
when transmitting data and 1200 bps when receiving data between the
modem and the DTE.
24 - CONNECT 7200
This result code indicates a connection has been established at 7200 bps
between the modem and the DTE. This result code is disabled by X0.
25 - CONNECT 12000
This result code indicates a connection has been established at 12000
bps between the modem and the DTE. This result code is disabled by X0.
28 - CONNECT 38400
This result code indicates a connection has been established at 38400
bps between the modem and the DTE. This result code is disabled by X0.
Negotiation progress messages are reported in the following order:
CARRIER PROTOCOL AUTOSTREAM COMPRESSION CONNECTIf AutoStream is not used, no message is reported.
40 - CARRIER 300
This message indicates that a carrier signal has been detected at 300
bps (modem-to-modem line speed).
44 - CARRIER 1200/75
This message indicates that a carrier signal has been detected at 1200
bps when transmitting and at 75 when receiving (modem-to-modem line
speed).
45 - CARRIER 75/1200
This message indicates that a carrier signal has been detected at 75 bps
when transmitting and at 1200 bps when receiving (modem-to-modem line
speed).
46 - CARRIER 1200
This message indicates that a carrier signal has been detected at 1200
bps (modem-to-modem line speed).
47 - CARRIER 2400
This message indicates that a carrier signal has been detected at 2400
bps (modem-to-modem line speed).
48 - CARRIER 4800
This message indicates that a carrier signal has been detected at 4800
bps (modem-to-modem line speed).
49 - CARRIER 7200
This message indicates that a carrier signal has been detected at 7200
bps (modem-to-modem line speed).
50 - CARRIER 9600
This message indicates that a carrier signal has been detected at 9600
bps (modem-to-modem line speed).
51 - CARRIER 12000
This message indicates that a carrier signal has been detected at 12000
bps (modem-to-modem line speed).
52 - CARRIER 14400
This message indicates that a carrier signal has been detected at 14400
bps (modem-to-modem line speed).
66 - COMPRESSION: CLASS 5
This message indicates that data compression using MNP Class 5 has been
negotiated for the connection.
67 - COMPRESSION: V.42BIS
This message indicates that data compression using CCITT V.42bis has
been negotiated for the connection.
68 - COMPRESSION: ADC
This message indicates that data compression using Hayes Adaptive Data
Compression has been negotiated for the connection.
69 - COMPRESSION: NONE
This message indicates that data compression was not negotiated for the
connection.
70 - PROTOCOL: NONE
This message indicates that no protocol was negotiated for the
connection. A standard asynchronous connection was made.
71 - PROTOCOL: ERROR-CONTROL/ LAPB
This message indicates that an error-control connection was negotiated
with LAPB protocol.
72 - PROTOCOL: ERROR-CONTROL/ LAPB/HDX
This message indicates that a half-duplex error-control connection was
negotiated with LAPB protocol.
73 - PROTOCOL: ERROR-CONTROL/LAPB/AFT
This message indicates that an error-control connection was negotiated
using the Hayes Asynchronous Framing Technique. This protocol is used
for connections between modems such as Smartmodem 1200 that do not
communicate synchronously across the telephone line. AFT enables an
error-control protocol to be used.
74 - PROTOCOL: X.25/LAPB
This message indicates that an error-control connection using the X.25
protocol was established with a carrier speed of 1200, 2400, 4800, or
9600 bps.
75 - PROTOCOL: X.25/LAPB/HDX
This message indicates that a half-duplex error-control connection using
the X.25 protocol was established with a carrier speed of 4800 or 9600
bps.
76 - PROTOCOL: X.25/LAPB/AFT
This message indicates that an asynchronous error-control connection
using the X.25 protocol was established with a carrier speed of 1200
bps. The Hayes Asynchronous Framing Technique was used.
77 - PROTOCOL: LAP-M
This message indicates that an error-control connection using the V.42
LAPM protocol was established.
78 - PROTOCOL: LAP-M/HDX
This message indicates that a half-duplex error-control connection using
the V.42 LAPM protocol was established.
79 - PROTOCOL: LAP-M/AFT
This message indicates that an asynchronous error-control connection
using the V.42 LAPM protocol was established with a carrier speed of
1200 bps. The Hayes Asynchronous Framing Technique was used.
80 - PROTOCOL: ALT
This message indicates that an errorge indicates that an error-control
connection using the V.42 LAPM alternative protocol was established.
This protocol is MNP Classes 2, 3, and 4 compatible.
91 - AUTOSTREAM: LEVEL 1
This message indicates that Hayes AutoStream Level 1 has been negotiated
for the connection. This technique provides for multiplexing of multiple
virtual channels.
92 - AUTOSTREAM: LEVEL 2
This message indicates that Hayes AutoStream Level 2 has been negotiated
for the connectionsage indicates that Hayes AutoStream Level 2 has been
negotiated for the connection. This technique provides for multiplexing
of multiple virtual channels, with transparent control of one PAD (non-
simultaneous). Level 3 has been negotiated for the connection. This
technique provides for multiplexing of multiple virtual channels, with
transparent control of all PADs (simultaneous).
93 - AUTOSREAM LEVEL 3
This message indicates that Hayes Autostream Level 3 has been negoitiated
for the connection. This technique provides for multiplexing of multiple
virtual channels, with transparent control of all PADs (simultaneous).
Note: The bit values of S95 may be set to override some of the characteristics of the Wn command. Setting any of the S95 bits to "1" enables the corresponding result codes regardless of the Wn command in effect. Changing the Wn command setting does not affect the value set for this register.
Bit Value Explanation ------------------------------------------------------------------------ 0 1 Verbose CONNECT result code indicates the DCE speed (rather than DTE speed). Numeric result codes are also different when CONNECT reports DCE speed. 1 2 Append "/ARQ" to CONNECT result code when an error-control connection is made. 2 4 Add CARRIER messages 3 8 Add PROTOCOL messages 4 16 Add AUTOSTREAM messages 5 32 Add COMPRESSION messages ------------------------------------------------------------------------For example, if you want to add the compression result code (with W1 selected), you would select bit 5 (value of 32). The command line ATS95=32J<CR> will then enable the COMPRESSION negotiation messages.
Refer to the Wn and Xn commands for additional and related information.
Because the type of modem that will be present, certain assumptions can be made regarding modem characteristics, such as maximum transmission rate, support of AT commands or specific commands such as L or X. If a more general application is being designed for an environment about which assumptions cannot be made regarding type or brand of modem that might be used, the software's first task should be to identify the modem.
The I0 and I4 command options make this process simple. In the initial versions of Smartmodem 1200, I0 returned the three digit response: 120. Since then, responses have been extended for several groups identifying modem supporting 2400 bps, 9600 bps, and other products. The I0 response simply indicates the speed category of the modem.
The result of the I0 command is a number which identifies the category of modem product. Some unique I0 values can be used to identify a unique product which has specific behaviors. 960, for example, identifies a Hayes product capable of 9600 bps, which has additional commands and behaviors.
The I4 command provides a reliable means of communicating specific features and modulation protocols to software. The responses to the I4 command are strings delimited by <CR> and beginning with a lowercase letter and typically followed by a hex-character bit-map. The I0 and I4 responses currently defined are detailed in the description of the I4 command in Chapter 1. The tables show the decoding of the hex- map returned in the "a", and "b" bit-mapped strings. If I4 is used to identify features of the modem, consider that new result strings are periodically defined that may be returned in addition to those expected. Fields once designated as "reserved" that held a zero may now have values assigned. The strings themselves may also be of different lengths than previously implemented.
In spite of the modifications to this command necessary to be current with new modems, the I4 command is the best way for software to determine the modem type and capability, if the guidelines below are considered:
An example I4 command and response is shown below:
AT E0 V1 Q0 S0=0 I4 <CR>response:
<CR><LF>a087840C004424<CR><LF> <CR><LF>bF60410000<CR><LF> <CR><LF>cUS<CR><LF> J <CR><LF>m0000000001001FFFF<CR><LF> <CR><LF>OK<CR><LF>Note: Each I4 result is surrounded by <CR><LF>; not all responses are hex-strings; and some responses may not be expected at all.
Software can be confused by a command echo. For example, if the following command were sent with echo on (E1) and numeric results (V0) on:
AT ... S9=20 <CR>The resulting data, echoed by the modem, would be followed by the numeric result code zero, meaning OK:
AT ... S9=20<CR>0 <CR>Software may become confused by seeing a 0<CR> result which is actually part of the command echo, then another 0<CR> which is the numeric result. A program can become unsynchronized with the command processor in the modem.
Turning off echo mode (E0) in the initial setup string would solve this problem; however, do not end that command with any digits (simply E).
Another shortcoming of numeric results is that the software must anticipate all possible responses. This requires updating controller software whenever new result codes are added. For example, suppose a CONNECT 115200 result were added with a numeric value of 31. If verbose results were used instead, and the controller directed to interpret the number after the CONNECT result as simply the connection speed in bits per second, no changes to the driver are necessitated by the new result code. If, however, numeric result codes were used, the result code 31 must be added to the table, and the controller modified to interpret it appropriately.
As characters are received, they should be processed through a state machine providing the functionality of the following one. This state machine recognizes strings surrounded by <CR><LF> characters and stores the string in a character array. <CR><LF> are defined by S3 and S4.
Once a result code string is returned, it can be compared against the known result code strings. Some strings may incorporate wild-card suffixes. For example CONNECT followed by any numeric value indicates a successful connection at the indicated transmission rate. Even if a result such as CONNECT 38400 is not anticipated, if the controller has been coded for wild-card recognition, the controller will be capable of interpreting such responses correctly. This practice also facilitates interpretation of connection failed messages that are preceded by NO followed by any other character string such as DIALTONE, CARRIER, or ANSWER.
Setup commands can be issued at the highest transmission rate the modem supports as determined from the identification process or it may be fixed at a certain value if the modem is not identified.
Some commands will always be overridden by the controller in order to ensure its proper functioning. Other command options should either default to the factory setting, or simply act as the "transfer agent" for the commands specified by the user. Menus and dialogs can be provided to prompt the user for specific activities; the program can then interpret these requests and configure the modem accordingly, as Hayes Smartcom products do, or provide the user opportunity to enter AT command strings.
Commands frequently set by a modem controller:
E0 Turn off echo mode to avoid having command echoes pass through the result code scanner. &F Recall the factory profile. Q1 Enable result codes to ensure that commands are being processed, and to synchronize with the modem command processor (except for synchronous communications where result codes may cause the DTE confusion). V0 or V1 Use either numeric result codes or verbose (recommended) result codes. S0=0 Disable auto-answer during the setup process to avoid inadvertent disruption by an incoming call. H0 Ensure modem is on hook before continuing to the answer or originate process. S12=10 Set the escape sequence guard time to 200ms to hasten the escape for hang-up process. Also reduces the probability of inadvertent user escapes. S2=* Change the escape sequence character for two reasons: To avoid inadvertent user escapes, and to provide different escape sequence characters for answer and originate ends. This prevents inadvertent escaping when data is echoed. S4=* Modify the linefeed character to make the <CR><LF>NO CARRIER<CR><LF> result code more unique if you scan for it to detect carrier loss. S95=60 Enables the result codes which will provide the maximum amount of information about the connection when it is established.Two typical setup sequences using these recommendations are shown below:
Recommendation for software design based on using pre-existing user settings:
AT E Q V S0=0 H S12=10 S2=28 S4=31 S95=60 <CR>Recommendation for software design based on starting from a known factory setting:
AT &F S2=28 S4=31 S12=10 S95=60Note: Where the zero suffix is used, it may be omitted from a command. Spaces are shown above for readability, but the use of spaces between commands is not recommended.
Once this setup command has been sent, and the OK response returned, the controller can continue to the originate or answer processing.
If user-programmed settings are included in additional setup strings, or the user is permitted to enter AT setup strings, the software should anticipate ERROR result codes. If an ERROR is returned in response to such a command, the result does not have to be reported to the user, but the controller should not be prevented from continuing in either case. Many times a connection can be made even though some setting is in error or is inappropriate for the class of modem being addressed.
The optimum fallback control strategy depends on which Hayes error- control modem you have. The fallback behavior is determined by S36, S46, S48, and &Q5.
There have been two improvements in the V-series, OPTIMA and ACCURA EC modems that affect S36: The first added &Q6 Asynchronous Speed Buffering (ASB); ASB provides the same fixed speed DTE interface and local flow control as in the error control mode but without the error control or remote flow control. The second improvement added V.42 with its Alternate Protocol (MNP).
Previously, S36 only consisted of one bit, Bit 0, which permitted the user to decide whether the modem would hang up or not if it did not succeed in negotiating an error-controlled connection. The factory default for S36 was 1, which meant fall back to direct async rather than hang up if an error control protocol is not established in &Q5 mode.
When &Q6 (ASB) was added, a fall back option for &Q5 mode, which can be controlled with S36, was also added. If S36 Bit 1 is set, and bit 0 is also set, the modem will fall back to ASB instead of direct async if no error control protocol is established in &Q5 mode. The factory default for S36 remained 1.
When V.42 was added, it added another fall back option, MNP, to S36. If S36 Bit 2 is set, then MNP will be attempted if the primary protocol selected in S48 is not established. Bit 2 is evaluated before Bits 0, then Bit 1. If MNP is established as the protocol, then Bits 0 and 1 are ignored. The factory default became 5 and later was changed to 7 to take more advantage of ASB.
Now that we know that there are three versions of S36, we may need a way to tell which version our software is controlling. First, verify that it is a Hayes error-control modem. This is done by issuing an I4 command and looking for the existence of a "b-string". A b-string begins with a lower case letter "b" and is followed by several upper case letters or numbers forming a hex value.
The easiest way for software to identify whether a Hayes modem supports Asynchronous Speed Buffering (also known as ASB, Buffered Async, or Normal) is to issue the following AT command, AT &Q6 &Q5 <CR>. If the result code is OK then &Q6 is supported, and ASB is also supported as a fall back. If the result code is ERROR, then &Q6 is not supported. If this is the case, then software should be prepared to fall back to a direct async connection.
The easiest way for software to identify whether a Hayes modem supports V.42 (and MNP) is to decode the first character after the leading "b" in the b-string of the I4 ID command response. The characters following the "b" in that line are "ASCII-hex" (0-9, A-F), which decode into 4 bits of ID code (3-0). If Bit 3 is set, then MNP is supported; Bit 2 is V.42.
Armed with the knowledge of which S36 bits are supported, the software may now safely configure the modem and properly anticipate the fall-back action.
It should be safe to set S36 bit 2 to enable V.42 (and MNP) even if those protocols are not supported in the modem.
If the modem does not support ASB, then software should be prepared to follow the CONNECT XXXXX speed result code and change the DTE port speed to match the indicated line speed of the direct connection when no error controlled connection was negotiated.
If software will not change port speeds in response to the CONNECT message, then when software has identified a 'pre-ASB' modem, it should set S36 to 0 or 4 so that if no protocol is negotiated, the modem will hang up.
The following table shows the order in which the bits of S36 are evaluated: (Remember, these steps only occur after the S46/S48 selections have failed to make a LAPBased error controlled connection in &Q5 mode.)
------------------------------------------------------------------------ S36 Bit 7-3=0 reserved First Bit 2 (4) If set, means try MNP protocol; reset means don't use MNP. Third Bit 1 (2) If set, means fall back to ASB; reset means direct async. Second Bit 0 (1) If set, means fall back based on Bit 1; reset means hang up. ------------------------------------------------------------------------The following table shows the meaning of each setting:
------------------------------------------------------------------------ S36=7 Try MNP, then fall back to ASB. S36=6 Try MNP, then hang up. S36=5 Try MNP, then fall back to direct async. S36=4 Try MNP, then hang up. S36=3 Don't try MNP; fall back to ASB. S36=2 Don't try MNP; hang up. S36=1 Don't try MNP; fall back to direct async. S36=0 Don't try MNP; hang up. ------------------------------------------------------------------------There are three types of fallback stratagies which Hayes products use.
Type 1: Hayes Modem Operation in &Q5 Communications Mode Applies to V-series Smartmodem 2400 up to and including Version 1.3 and V-series Smartmodem 9600 up to and including Version 1.4.
Type 2: Hayes Modem Operation in &Q5 Communications Mode Applies to V-series Smartmodem 2400 Version 1.4 and V-series Smartmodem 9600 Versions 1.5 and 1.6.
Type 3: Hayes Modem Operation in &Q5 Communications Mode Applies to all V-series products newer than Types 1 and 2 and all OPTIMA and ACCURA EC products.
------------------------------------------------------------------------ ATI3 Response contains... V-SERIES SMARTMODEM 2400 V-SERIES SMARTMODEM 9600 Type 1 04-00005-10 04-00015-10 04-00005-11 04-00015-11 04-00005-12 04-00015-12 04-00005-13 04-00015-13 04-00015-14 Type 2 04-00005-14 04-00015-15 04-00015-16 Type 3 Does not contain any Does not contain any of the above numbers any of the above numbers ------------------------------------------------------------------------
Result Code Meaning ------------------------------------------------------------------------ NO CARRIER Connection failed NO ANSWER No response to '@' dial modifier NO DIALTONE No dial tone in X4 mode NO ____ Connection failed for some other reason BUSY Busy signal detected CONNECT ____ Connection successful; you may need to change DTE speed to the indicated baud rate. (See Wn and S95) CARRIER ____ * DCE carrier speed. (See Wn and S95) PROTOCOL: ____ * Error-correction protocol being used by the modems. (See Wn and S95) COMPRESSION:____ Compression technique in use by modems. (See Wn and S95) AUTOSTREAM Autostream technique in use by modems if selected by user. (See Wn and S95) ------------------------------------------------------------------------Ignore other responses, but continue to wait for CONNECT ___, BUSY, or NO ___ responses. The CARRIER and PROTOCOL results are intermediate results and precede either a CONNECT ____ or NO ____ result. These results are only returned by Hayes modems when configured to use an error-correcting protocol.
If you recognize any numeric value for the baud rate after the CONNECT result, you will have a much more robust controller able to handle many situations. You can use the PROTOCOL result to determine if the flow control requested by the &K command is in effect.
Note: If you want to manually dial a call and then have the modem connect, enter the command string ATX1D (X1 disables dial tone detection) when you hear the dial tone.
If you set S0, you may want to set it back to zero after your controller finishes the call to prevent inadvertent answering when your software is not running. By setting S0 to the number of rings you desire before the modem answers, you utilize the ring detection technology already built into the modem.
You should not use the A command to answer after counting RING results because the command may collide with another RING result from the modem and be missed. The RING results may be generated in pairs depending on the ringing cadence of the phone system.
If you use CD, you do not know when the modem has given up waiting for the carrier, or why. If the line is busy, you may want to re-try the dial operation. If there is no dial tone, the user needs to know this.
Smartcom products send AT<CR> to abort an in-progress connect command. This elicits a result code regardless of whether the modem were off-hook or not. If the modem was off-hook attempting to connect, this will abort the connect operation and return NO CARRIER. If the modem was on-hook in command mode, this simply returns <CR><LF>OK<CR><LF>.
However, this is the most restrictive and risky choice. It requires a properly wired cable and support of &C1 by the modem's command set or proper DIP-switch settings.
Typically, at the low-level of the program all received data is retrieved through one subroutine. This subroutine can be augmented or layered to provide the service needed. As data passes through, the last fourteen characters are buffered, typically in a circular buffer. If more data passes in each call, only the last fourteen need to be copied. At a time when the processor is free, such as after 100 ms of idle time or the receive routine has returned no data for 30 to 100 calls, then the buffer is compared against the <CR><LF>NO CARRIER<CR><LF> result code. If a match is found, the carrier lost event is triggered.
By only checking when there is idle time, or after no data has been received for a while, you reduce the CPU overhead and ensure that the modem is not falsely triggered when the string is imbedded in an actual data stream.
You can also modify the linefeed character by using S4 to a different value such as S4=31 to make the result code sequence more unique. This action, however, affects other result codes generated by the modem.
The controller software must be sure to wait the required guard time before sending the escape sequence characters. Your controller may have been called just after data was transmitted and, without the delay, your characters will just be sent without triggering the escape sequence recognition process. It is important that the serial transmitter be permitted to be idle for the escape sequence guard time, plus a few extra milliseconds to allow for error, before sending characters.
For example, if S12=10, a delay of at least 200 milliseconds is required before sending the escape sequence characters. After sending the escape sequence characters, the OK result will be received after another 200 millisecond wait. This completes the escape sequence process in slightly over 400 milliseconds. If S12=50 (factory setting) is used, one full second must pass before the characters can be sent, then another second delay must transpire prior to the OK result. This completes the process in slightly over two seconds. For this reason, it is recommended that S12=10 be issued to speed up this process.
A delay slightly longer than that stored in S12 should be used to allow for errors in the system clock as well as in the modem clock. 100ms is an adequate safety margin.
The minimum the controller should do when through with the modem is issue a Z command option to ensure the modem is restored to its power-up state.
Under DOS, the INT 1C timer tick produces an interrupt every 55 milliseconds. An ISR can be installed on this interrupt to add 55 to a long integer every time it is called. This will provide a millisecond counter.
On the Macintosh, the "Tick Count" function will return the number of vertical-retrace ticks since computer power-up. Each tick represents 1/60 of a second.
This technique is independent of processor speed. A faster processor may make thousands of trips through the loop, where a slower one would only make a few hundred. Any anticipated result code would arrive within that two-second real-time window.
Care should be given to considering when to start the timing loop. If an AT command string is sent, then a loop executed, the time interval may also include the time required to send the AT command (if data is buffered and sent by an interrupt service routine).
At 300 bps, where each character takes 33ms just to transmit (10/300), a 40 character AT command would take over a second to transmit. This means a two second loop spends more than half of its time waiting for the AT command process to complete, leaving only a fraction of a second for the modem to respond with the result (again at 33ms per character).
One way to avoid this is to wait until all data has been transmitted by an ISR before entering the result code scan loop. Alternatively, more time can be provided for loops to process results. Another option is to measure idle time rather then elapsed time.
A timeout may also occur when the software receives a result code it does not recognize. The software may continue to wait until it receives a code it does recognize. If this is the case, the controller should proceed as if an ERROR response were received. The only instance in which it is not prudent to continue is when a connect (D, A, or S0) command was issued.
Before implementing a timeout, the advantages, if any, to this level of program interruption should be considered. For example, if the program times out from a dial command in one minute when it may take two minutes to complete the call, the timeout defeats the purpose of the command. The modem always responds with a result code, whether BUSY, NO CARRIER, or CONNECT, after some length of time.
Idle time is the time since data was received. Elapsed time is the time since the software started looking for the result. Idle time can be measured by resetting the timeout clock each time the software receives a character. Rather than exiting the loop after two seconds of elapsed time, the logic changes to exit after no further data has been received for two seconds.
Hayes modems support the industry standard "RTS/CTS" hardware flow control (invoked by the &K3 command) and "XON/XOFF" character-based flow control (&K4) schemes. However, in some situations, it is not possible to use either of these. For example, hardware flow control cannot be used if the DTE serial port does not support the RTS and/or CTS hardware signals, if corresponding conductors are not present in the interface cable, or if intermediate equipment does not properly transfer the RTS and CTS signals. XON/XOFF flow control cannot be used if the XON and XOFF characters appear in the user data or in the control information associated with the file transfer protocol in use, since this would interfere with the use of these characters for flow control, resulting in failure of data transfer and possibly locking up the interface.
Hayes addressed these problems in the design of V-series, OPTIMA and ACCURA EC modems. Desiring to provide a complete solution for all users, Hayes provided a third flow control scheme, which accommodates systems which cannot use RTS/CTS but which must transfer data containing the XON and XOFF characters. This scheme, known as Transparent XON/XOFF Local Flow Control (invoked by the &K5 command), uses only the Transmit Data and Receive Data circuits, yet provides for the transfer of all 256 possible 8-bit characters over the interface without interfering with the flow control scheme.
Transparent flow control can be viewed as a layered process, organized as follows. Note that this process is duplicated in the reverse direction (operates in both directions simultaneously).
Char Replaced By ------------------------------------------------------------------------ $10 $10 $31 $11 $10 $30 $13 $10 $32 $90 $10 $B1 $91 $10 $B0 $93 $10 $B2 ------------------------------------------------------------------------The characters are transmitted using the parity setting then in force on the DTE-DCE interface; the XOR with $21 preserves the correct value of the parity bit.
If the software wants the modem to suspend delivering data, it inserts an XOFF ($13 at current parity setting) in the transmitted data stream at any arbitrary point, which may be between a DLE ($10) and the following transparentized character. The XOFF should be issued BEFORE the buffer is completely full, since there may be a lag of several characters before the modem is able to react to the XOFF and suspend delivery. To resume delivery of data, the software inserts an XON ($11 at current parity setting) at any arbitrary point. Characters inserted for flow control purposes are NOT passed through the transparency algorithm defined above.
If the character received is $13 or $93 (XOFF with either parity), it is interpreted (regardless of the setting of the TSIP-FLAG) as a request from the modem for the DTE to suspend transmission of data to the modem. The receiver portion of the software must communicate this request to the transmitter portion of the software in a timely manner, since the modem has a limited amount of buffer space to allow for additional characters to be received after it sends XOFF (about 64 characters maximum). The XOFF character is discarded from the received data stream. The TSIP-FLAG is not changed.
If the character received is $11 or $91 (XON with either parity), it is interpreted (regardless of the setting of the TSIP-FLAG) as a request from the modem for the DTE to resume transmission of data to the modem, if any is available. The XON character is discarded from the received data stream. The TSIP-FLAG is not changed.
If the character is neither an XON or and XOFF, the following steps are performed:
Clock Controller Speed Modem (1200) bps) ------------------------------------------------------------------------ 00000 ATZ<CR> 00034 ATZ<CR> 00068 (one second to do reset) 01068 0<CR> (V0 stored as default) 01084 (delay additional 600ms) 01684 ATEQV1S0=0S12=10S4=3HI<CR> 01884 ATEQV1S0=0S12=10S4=3HI <CR> (echo) 02084 <CR><LF>960<CR><LF> 02142 <CR><LF>OK<CR><LF> (19200 bps) 02192 ATM0X4L1S12=10S2=1&Q5W1S36 =7S37=9&K5<CR> 02206 <CR><LF>OK<CR><LF> 02209 ATDT9W14045551212<CR> 38000 <CR><LF>CARRIER 2400<CR><LF> 45000 <CR><LF>PROTOCOL: NONE<CR><LF> 45010 <CR><LF>CONNECT 2400<CR><LF> (2400 bps) (Connection Established) ----------------------------------------------------------------------- (2400 bps) 00000 (delay 300ms, need 200, add 100 for safety) 00300 (escape char is ^A, S2=1) 00313 (waits 200ms) 00513 <CR><LF>OK<CR><LF> 00538 ATHE1S2=43S12=50W0&Q0<CR> 00630 <CR><LF>OK<CR><LF> ------------------------------------------------------------------------