Main Page | See live article | Alphabetical index

Hayes command set

Most dialup modems follow the Hayes Command Set to a large extent, originally developed for the Hayes Smartmodem 2400. The modem initialization string consists of a series of commands. It prepares the modem for communications, setting such features as dialing mode (tone or pulse), 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 selected or which features are enabled.

Table of contents
1 History
2 Description
3 The Basic Hayes Command Set
4 External Link


Prior to the introduction of the Bulletin board system, modems were typically used on dedicated point-to-point telephone lines that were always connected to a modem at the far end. In the situations where this was not the case, the user would dial the phone manually before connecting, or pick it up if it rang. In a few cases the computers themselves were required to call a selection of numbers, and for this task a separate "dialer" was used, plugged into a different input/output port on the computer (typically an RS-232).

When Dennis Hayes was creating his first "smart modem" in 1977, he faced a problem that no previous modem manufacturer had: how to tell the modem what phone number to dial, using only one port. One solution would be to use a separate set of "command pins" that would be dedicated to sending and receiving commands. Another would be to use a signal pin that indicated that data on the main data lines should be interpreted as a command.

Instead, in order to save money, Hayes chose to re-use the existing data pins with no modification. The modem could be placed in one of two modes, data mode in which the modem sent the data to the remote modem ( when the modem is in the data mode, it assumes that everything it recieves from the computer is data and sends it across the phone line), and command mode in which the data was interpreted as commands to the local modem (a command to execute by the local modem). To switch from data to command mode an escape sequence string of three plus signs was sent ( to go the command modem without losing the connection), and to switch back you sent the online command, O. In actual use many of the commands automatically switched to the online mode after completion, and it is rare for a user to use the online command explicitly.

This use of in-band signalling leads to a potential serious problem: what if the data being sent in data mode contains three plus signs? This could happen randomly quite easily, and it would happen any time someone attempted to send data describing the system – this document for instance. In order to avoid this problem a delay was added to the end of the escape sequence, if any other data was received within one second of the three plus signs, it was not the escape sequence and would be sent as-is.

The command set includes commands for various phone-line manipulations, dialing and hanging up for instance. It also includes various controls to setup the modem, including a set of register commands which allowed the user to directly set the various memory locations in the original Hayes modem. The command set was copied largely verbatim, including the meaning of the registers, by almost all early 300 baud modem manufacturers, of which there were quite a few.

The expansion to 1200 and 2400 baud required the addition of a small set of new commands, some of them prefixed with a & to denote those dedicated to new functionality. However Hayes was slow to move to higher speeds or the use of compression, and three other companies led the way here – Microcomm, U.S. Robotics and Telebit. All three used their own additional command sets instead of waiting for Hayes to lead the way.

Soon there was an explosion of new models, including new ones from Hayes, following one sort of standard or another. Things became simpler again during the widespread introduction of 14.4 and 28.8 kbaud modems in the early 1990s. Slowly a set of command based heavily on the original Hayes extended set using & commands became popular, and then universal. The only other command set still popular is the US Robotics set, due to their widespread popularity.

The command set was unprotected, but the concept of a "guard time" after the escape sequence was patented. In the late 1980s Hayes started enforcing the patent, charging $1 per modem that used it.


The following is a partial list of the Hayes command set. (also called the AT commands, AT is short for attention).

The Hayes Command Set can be divided into four groups:

A register is 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.

When in data mode the
escape sequence "+++" is used to return the modem to command mode.

The Basic Hayes Command Set

Command Description Comments
A0 or A Answer incoming call
A/Repeat last command Don't preface with AT. Enter usually
B0 or B Call negotiationV32 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

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
E1Echo Will echo commands to the computer (so one can see what one
H0 Hook Status On hook - Hang up
H1 Hook statusOff 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 M3 is also common, but different on many
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 OnlineSee 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
Sn? Query the contents of S-register
Sn=rStore Store the value of r in S-register
V0 or V

Verbose Numeric result codes
V1 English result codes (e.g. CONNECT,
      BUSY, NO
      CARRIER etc.)
X0 or X Smartmodem Hayes Smartmodem 300 compatible result codes

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)

External Link