The Hayes Modem Command Set

Here is a description of the Hayes Command Set. Most modems follow this command set to large extent. If you lost your modem manual or never had one in the first place, this reference might come in handy.

The modem initialization string consists of a series of commands. It prepares the modem for communications, setting such features as dialing mode, waits, detection of the busy signal and many other settings. Newer modem communications programs reset the initializations string for you according to which menu options you select, which features you enable, etc..

For many years Hayes modems have been the standard. As the field of modem manufactures has grown, most have adhered at least loosely to the Hayes standard. The following is a partial list of the Hayes command set. (called the "AT" commands). The Hayes Command Set can be divided into four groups:

Basic Command Set

A capital character followed by a digit. For example, M1.

Extended Command Set

An "&" (ampersand) and a capital character followed by a digit. This is an extension of the basic command set. For example, &M1. Note that M1 is different from &M1.

Proprietary Command Set

Usually started by either a backslash ("\"), or a percent sign ("%"), these commands vary widely among modem manufacturers. For that reason, only a few of these commands are listed below.

Register Commands

Sr=n where r is the number of the register to be changed, and n is the new value that is assigned.

A "register" is computerese for a specific physical location in memory. Modems have small amounts of memory onboard. This fourth set of commands is used to enter values in a particular register (memory location). The register will be storing a particular "variable" (alpha-numeric information) which is utilized by the modem and communication software. For example, S7=60 instructs your computer to "Set register #7 to the value 60".


Although most commands are defined by a letter-number combination (L0, L1 etc.), the user of a zero is optional. In this example, L0 is the same as a plain L. Keep this in mind when reading the table below!

Here are some of the most important characters that may appear in the modem initialization string. These characers normally should not be changed.


Tells the modem that modem commands follow. This must begin each line of commands.


Resets the modem to it's default state

, (a comma)

makes your software pause for a second. You can use more than one , in a row. For example, ,,,, tells the software to pause four seconds. (The duration of the pause is governed by the setting of register S8.


Sends the terminating Carriage Return character to the modem. This is a control code that most communication software translates as "Carriage Return"

The Basic Hayes Command Set

In alphabetical order:

Table B.1. Basic Hayes Command Set

Command Description Comments

A0 or A Answer incoming call

A/ Repeat last command Don't preface with AT. Enter usually aborts.

B0 or B Call negotiation V32 Mode/CCITT Answer Seq.

B1 Call negotiation Bell 212A Answer Seq.

B2 Call negotiation Verbose/Quiet On Answer

D Dial Dial the following number and then handshake in orginate mode.

P Pulse Dial

T Touch Tone Dial

W Wait for the second dial tone

, Pause for the time specified in register S8 (usually 2 seconds

; Remain in command mode after dialing.

! Flash switch-hook (Hang up for a half second, as in transferring a call.

L Dial last number

E0 or E No Echo Will not echo commands to the computer

E1 Echo Will echo commands to the computer (so one can see what one types)

H0 Hook Status On hook - Hang up

H1 Hook status Off hook - phone picked up

I0 or I Inquiry, Information, or Interrogation
This command is very model specific. I0 usually returns a number or code, while higher numbers often provide much more useful information.

L0 or L Speaker Loudness. Modems with volume control knobs will not have these options.
Off or low volume

L1 Low Volume

L2 Medium Volume

L3 Loud or High Volume

M0 or M Speaker off M3is also common, but different on many brands

M1 Speaker on until remote carrier detected (i.e. until the other modem is heard)

M2 Speaker is always on (data sounds are heard after CONNECT)

N0 or N Handshake Speed Handshake only at speed in S37

N1 Handshake at highest speed larger than S37

O0 or O Return Online See also X1 as dial tone detection may be active.

O1 Return Online after an equalizer retrain sequence

Q0 or Q1 Quiet Mode Off - Displays result codes, user sees command responses (e.g.OK)

Q1 Quiet Mode On - Result codes are suppressed, user does not see responses.

Sn? Query the contents of S-register n

Sn=r Store Store the value of r in S-register n

V0 or V Verbose Numeric result codes

V1 English result codes (e.g.CONNECT, BUSY, NO CARRIERetc.)

X0 or X Smartmodem Hayes Smartmodem 300 compatible result codes

X1 Usually adds connection speed to basic result codes (e.g.CONNECT 1200

X2 Usually adds dial tone detection (preventing blind dial, and sometimes preventing AT0)

X3 Usually adds busy signal detection

X4 Usually adds both busy signal and dial tone detection

Z0 or Z Reset Reset modem to stored configuration. Use Z0, Z1etc. for multiple profiles. This is the same as &F for factory default on modems without NVRAM (non voltaile memory)

The Extended Hayes Command Set

Ampersand Commands

Table B.2. The Extended Hayes Command Set

Command Description Comments

&B0 or &B Retrain Parameters Disable auto retrain function

&B1 Retrain Parameters Enable auto retrain function

&B2 Retrain Parameters Enable auto retrain, but disconnect if no line improvement over the period dictated by S7

&C0 or &C1 Carrier detect Signal always on

&C1 Carrier detect Indicates remote carrier (usual preferred default)

&D0 or &D Data Terminal Ready(DTR Signal ignored (This is modem specific, you must see your manual for information on this one!)

&D1 Data Terminal Ready(DTR If DTR goes from On to Off the modem goes into command mode (Some modems only)
&D2 Data Terminal Ready(DTR Some modems hang up on DTR On to Off transition (This is the usual preferred default)
&D3 Data Terminal Ready(DTR Hang up, reset the modem, and return to command mode upon DTR

&F0 or &F Factory defaults Generic Hayes-compatible defaults.
This is usually a good thing to use in your init string, since the &F1-&F3 settings can vary among modems, and they may actually be the cause of connection problems. (Since you never know exactly what Brand X's &F2 really changes.

On the other hand, it pays to try out the other options below; many people's problems can be solved by replacing a complicted init string with a simple &F2 or the like. However, if building an init string, it's best to start with a simple &F, and not use the "customized" form of defaults.

&F1 Factory Defaults Factory Defaults tailored to an IBM PC compatible user

&F2 Factory Defaults Factory defaults for a Mac w/software handshaking

&F3 Factory Defaults Factory defaults for a Mac w/hardware handshaking

&G0 or &G Guard tones Disable guard tones

&K0 or &K Local flow control Disable local flow control

&K1 Local flow control Enable RTS/CTS hardware local flow control

&K2 Local flow control Enable XON/XOFF software local flow control

&K3 Local flow control Enable RTS/CTS hardware local flow control

&K4 Local flow control Enable XON/XOFF software local flow control

&L0 or &L Dial mode Select dial-up mode

&M0 or &M Error control mode Select asynchronous non-EC mode (the same as &Q0)

&P0 or &P Pulse dialing ratio U.S./Canada pulse dialing 39% make / 61% break ratio

&P1 Pulse dialing ratio U.K./Hong Kong pulse dialing 33% make / 67% break ratio

&Q0 or &Q Error control mode Asynchronous non-EC more. No data buffering. ASB disabled.

&Q5 Error control mode Select V.42 EC operation (requires flow control)

&Q6 Error control mode Asynchronous mode with ASB (requires flow control)

&Q8 Error control mode Select alternate EC protocol (MNP)

&Q9 Error control mode Conditional data compression: V.42bis = yes, MNP5 = no.

&S0 or &S DSR action select Always on (default)

&S1 DSR action select Follows EIA specification (Active following carrier tone, and until carrier is lost.)

&T0 or &T Self test Model specific self test on some modems

&U0 or &U Trellis code modulation Enable V.32 TCM

&U1 Trellis code modulation Disable V.32 TCM

&V0 or &V1 View active (and often stored) configuration profile settings (or ATI4

&W0 or &W Store profile In NVRAM (&W0, &W1 etc. for multiple profiles) Some settings cannot be stored. These often don't show on &V or ATI4

&Y0 or &Y Select configuration loaded at power-up Load profile 0 (default)

&Y1 Select configuration loaded at power-up Load profile 1

&Zn=x Soft reset and load stored profile number n Note that all items after the &Z on the command line are ignored

Backslash and Percent Commands

Table B.3. Backslash and Percent Commands

Command Description Comments

\A0 or \A Character maximum MNP block size 64 character maximum

\A1 Character maximum MNP block size 128 character maximum

\A2 Character maximum MNP block size 192 character maximum

\A3 Character maximum MNP block size 256 character maximum

%C0 or %C Data Compression Enable/Disable Disabled

%C1 Data Compression Enable/Disable MNP5 enabled

%C2 Data Compression Enable/Disable V.42bis (BTLZ) Enabled

%C3 Data Compression Enable/Disable MNP5 & V.42bis (BTLZ) Enabled

%D0 or %D Data compression 512 BLTZ dictionary size

%D1 Data compression 1024 BLTZ dictionary size

%D2 Data compression 2048 BLTZ dictionary size

%D3 Data compression 4096 BLTZ dictionary size

%E0 or %E1 Escape method ESCAPE DISABLED

%E1 Escape method +++AT method (default)

%E2 Escape method BreakAT method

%E3 Escape method BOTH methods enabled

%E4 Escape method Disable OK to +++

%E5 Escape method Enable OK to +++

\J0 or \J DTE Auto Rate Adjustment Disabled

\J1 DTE Auto Rate Adjustment DTE rate is adjusted to match carrier rate.

\N0 or \N Connection type Normal connection (see below for definitions)

\N1 Connection type Direction connection

\N2 Connection type MNP Auto-reliable connection

\N3 Connection type Auto-reliable connection

\N4 Connection type V.42bis reliable link with phase detection

\N5 Connection type V.42bis auto-reliable link with phase detection

\N6 Connection type V.42 reliable link with phase detection

\N7 Connection type V.42 auto-reliable link with phase detection

A direct connection is a simple straight-through connection without any error connection or data compression. In this case, the computer-to-modem and modem-to-modem speeds must be identical.

A normal connection uses flow control (either software or hardware) to buffer the data being sent or received, so that the modem can transmit data at a different rate than the computer is actually sending or receiving it. For example, a computer may send actual data at 57kbps, but using compression, the modem only actually sends 28.8kbps. This is the mode use by most modems.

A reliable connection is a type of normal connection; if, for some reason, data compression or error correction cannot be established or maintained, the connection will hang up. (In essence, such a modem ensures that all connections are reliable, for it will hang up if the connection isn't.)

Likewise, an auto-reliable connection is virtually the same, except that the modem will try to renegotiate the connection in order to establish a reliable connection. Again, this is the mode that most modems use.


Table B.4. S Registers

Register Range Default Function

S0 0-255 rings 1-2 Answer on ring number. Don't answer if 0

S1 0-255 rings 0 if S0 is greater than 0 this register counts the incoming rings.

S2 0-127 ASCII 43 + Escape to command mode character

S2 >127 no ESC

S3 0-127 ASCII 13 CR Carriage return character

S4 0-127 ASCII 10 LF Line feed character

S5 0-32, 127 ASCII 8 BS Backspace character

S6 2-255 seconds 2 Dial tone wait time (blind dialling, see Xn

S7 1-255 seconds 30-60 Wait time for remote carrier

S8 0-255 seconds 2 Comma pause time used in dialing

S9 1-255 1/10ths second 6 Carrier detect time required for recognition

S10 1-255 1/10ths second 7-14 Time between loss of carrier and hangup

S11 50-255 milliseconds 70-95 Duration and spacing of tones when tone dialing

S12 0-255 1/50th seconds 50 Guard time for pause around +++ command sequence

S36 Fallback options when error correction link fails:

7 Negotiation Failure Treatment

0 - Disconnect

1 - Establish Direct Connection

3 - Establish Normal Connection

4 - Establish an MNP connection if possible, else disconnect

5 - Establish an MNP connection if possible, else Direct Connection.

7 - Establish an MNP connection if possible, else Normal connection

S37 1 = 300 bps 0 Negotiation Speed (Intial handshake)

5 = 1200 bps

6 = 2400 bps

7 = 1200/75 bps (v.23 mode)

8 = 4800 bps

9 = 9600 bps

10 = 12000 bps

11 = 14400 bps

12 = 7200 bps

Many modems have dozens, even hundreds, of S registers, but only the first dozen or so are fairly standard. They are changed with a command like ATSn=N, and examined with ATSn? (e.g. AT S10=70 S1? would tell the modem not to hang up for seven seconds should it not hear the answering modem, and return the number of times the phone last rang.)

Belive it or not, I did attempt to format some of the tables, but alas, with html posting, you never know quite for sure whats going to happen. In this case, the white space was trunicated. Sorry Folks. I Did Try.