You are here

AT commands set

This document provides an introduction to intelligent modems, the AT command set and the concepts behind many of the commands. The AT commands are used to configure the modem to your preferred operating mode and to instruct the modem to do what you want it to do.


A modem is a DCE (data communications equipment). A DCE plugs into a DTE (data terminal equipment). Examples of DTE are personal computers, computer terminals and terminal servers.

Intelligent vs Dumb Modems

A dumb modem is one where all the settings and operations have to be performed manually. This includes setting the connection speed, dialling telephone numbers, pushing switches to go on-line, and pushing switches to hang-up at the end of a call.

An intelligent modem has some built-in processing power (i.e., it has a small computer inside it). As a result no switches are needed: the modem can be put into a command mode in which it will respond to keyboard instructions as well as to commands issued by software. Intelligent modems can dial telephone numbers or answer incoming calls automatically. This provides greater flexibility and allows the modem to be used in unattended, software controlled, operation.

Dumb modems are quite rare now. Almost all modems sold are intelligent modems.

Most intelligent modems use the AT command set (sometimes called the Hayes AT command set, after Hayes Microcomputer Products of the USA, who originally designed this now industry standard command set).

The AT Command Set

The AT commands are used to configure the modem to your preferred operating mode and to instruct the modem to do what you want it to do, such as dial telephone numbers and connect to bulletin boards or the internet, or to answer incoming calls.

The AT command set is so named because to get the modems ATtention, so that you can issue a command, the first two characters that are sent are A and T. Following the AT is the command(s) for the modem. The command(s) is executed when a <CR> (carriage return or enter) is entered.

Note that while the AT command set is an industry standard, it has evolved over the years to accommodate the requirements of faster modem speeds. In addition, different manufacturers have added their own commands to perform various functions. In many cases the same function is performed by a different command on different modems. However, there is a core of AT commands that are common to all modems. AdvanCom modems comply with the Rockwell variant of the AT Command Set, which is one of the most common. This documents describe the AT commands of AdvanCom modems.

Result Codes

Once a command is executed the modem returns (i.e., sends to the DTE) a result code (also called a response code). The result code indicates the success or failure of the command. Success is indicated by a variety of responses, depending on the content of the command string. Examples of successful responses are the OK and CONNECT responses. Failure of a command is indicated by the ERROR response.

Result codes can be either text, also called verbose, as shown above, or numeric, i.e., a number that is equivalent to the text response. For clarity the verbose response codes are used in the examples in this document.

The AT commands which effect the result codes are:

Quiet command. This command controls whether result codes are sent, or not sent.
Result code form. This command controls whether the result codes issued are verbose or numeric.
This command controls which result codes are issued.

AT Command Strings

The simplest AT command is:


This results in the response of OK. Meaning that the modem received the AT command and executed it without errors. A typical command is:

AT I4 <CR>

This command requests the modems model and revision. A typical response is:

AdvanCom V.34 bis Modem V2.050_3W 970116

Multiple commands may be placed on a command line.
For example:

AT I4 I2 <CR>

Each command consists of one or more characters and one or more numbers. If the characters are entered without a number, the modem treats the command as if the number entered was a zero.

Spaces can be used to separate individual commands, to make it easier to read the command string. The spaces are ignored by the modem. Commands in the command string are executed in the order in which they appear, from left to right. If all commands in the command string are valid then the OK response is issued (or whatever response is appropriate for the commands in the command string).

If any command is not valid then an ERROR response is returned. All commands up to the one containing the error will be executed correctly. All commands in the command string after the one which caused the ERROR are ignored.

The backspace key can be used to delete any incorrect characters in a command string (before <CR> is entered).

The maximum number of characters in a command line is 256, including the AT characters.

The A/ (repeat) command is the only command which is not preceded by the AT characters and not terminated with a <CR>. This command is used to repeat the last command string entered.

The AT can be in upper or lower case characters. The case is ignored by the modem, i.e., AT is equivalent to at.

Each time the AT characters are sent to the modem, the modem detects the DTE's speed, the number of data bits, the parity and the number of stop bits. This means that the DTE's speed can be changed at any time, and to notify the modem simply enter AT<CR>.

Operating Modes

The modem has three operating modes:

Command Mode
The modem is normally in command mode. In this mode the modem waits for commands to be issued to it. It also monitors the telephone line, and if it detects an incoming ring signal it returns the RING response to inform the DTE of an incoming call. (The incoming call is answered by the modem only if S-register S0 is not zero.)

On-line mode
In on-line mode the modem is connected to another modem. In this case all information received from the remote modem is transmitted to the DTE, and all information received from the DTE is transmitted to the remote modem.

On-line command mode
In on-line command mode, the modem is connected to another modem, but the escape sequence (see below) has been issued to enter command mode, so that commands can be issued to the modem. If the hang-up command (H0) is not issued, then on-line mode can be re-entered by issuing the O command.

Going On-line

Three different commands can be used to get the modem on-line:

Dial command
The most common way of going on-line. The dial (Dn) command is used to dial the telephone number of another modem (such as that of an internet service provider). Dialling a telephone number is also called originating a call. If the originating modem does not detect an answering modem within 30 seconds (the content of register S7) it hangs up the phone line and returns the NO CARRIER response.

If the modems connect then the CONNECT response is returned.

The format of the dial command is:


where nnnn is the telephone number of a remote modem. For more information on the D command refer to Chapter 3 of the AdvanCom AT Command Set Reference Manual.

Originate command
When the dial command is issued with no arguments, (i.e., ATD<CR>) the modem goes off-hook (seizes the phone line) and looks for an auto-answer sequence from a remote modem. If the auto-answer sequence is not detected within 30 seconds (the content of register S7) the modem hangs up the phone line and returns the NO CARRIER response.

If the modems connect then the CONNECT response is returned.

This command is normally used to go on-line, to transfer data, after having a voice conversation with someone, without having to re-dial the telephone number. One modem must be in originate mode and the other modem must be in answer mode.

Answer command
This is the A command. Typing ATA<CR> will cause the modem to seize the telephone line and perform an auto-answer sequence. This is equivalent to auto-answer mode (see below).
If there is a modem (in originate mode) on the other end of the phone line then both modems will connect and go on-line. Otherwise the local modem will hang-up (release the telephone line) after 30 seconds (the content of register S7) and return the NO CARRIER response.

If the modems connect then the CONNECT response is returned.

To ensure a successful connection, the originating modem (ATD) should commence its sequence before the answer command (ATA) is issued.

The other most common way of going on-line is connecting to a modem that is set to auto-answer incoming calls. Auto-answer is controlled by register S0. When S0 is not zero then the modem is set to answer any incoming calls. The number in S0 defines on which ring the modem answers the call.

If there is a modem (in originate mode) on the other end of the phone line then both modems will connect, go on-line, and return the CONNECT response. Otherwise the local modem will hang-up (release the telephone line) after 30 seconds (the content of register S7) and return the NO CARRIER response. In all cases, once the modem seizes the telephone line and starts looking for a valid carrier from the remote modem, any characters sent from the DTE to the modem, before the modem returns the CONNECT message, will cause the modem to abort the originate or answer sequence and return to command mode.

Escape Sequence

The escape sequence is used to get the modem from on-line mode to on-line command mode. Typically it is used to change a modem parameter and then return on-line, or to hang up the modem.

The format of the escape sequence is:

type nothing for at least one second

type +++

type nothing for at least one second

The delay (called the guard time) is determined by the content of register S12. The escape character is determined by the content of register S2.

Another way of going into command mode is to issue the &D1 setting, and then drop the DTR signal. Refer to the &D command for more information.

To return to on-line mode from command mode the O command is issued (i.e., ATO<CR> or ATO0<CR>).


There are two ways to cease a connection:

  • Enter on-line command mode using the escape sequence and then issue the hang-up command, i.e. ATH0<CR> (or ATH<CR>, because if the number is not entered then 0 is assumed). The modem returns the OK response.

  • If the &D2 setting is enabled, then momentarily dropping DTR will cause the modem to hang-up. This is achieved with most communications software using a hang-up command, such as Alt-H or Cmd-H.

    For this to work the DTR pin must be wired in the RS232 cable between the DTE and modem.

Often you don't need to worry about the hang-up command, because when you exit from the internet or bulletin board service the remote modem hangs up the call, which causes your modem to hang-up.

It is a good idea to have the &D2 setting as a power-up default, so that if the remote modem does not hang-up and you turn off the DTE, the DTE automatically hangs up the modem (assuming the DTE turns DTR off). In this way the modems don't stay on-line without your knowledge.

Another option is to enable the modem's inactivity timer (controlled by register S30). If no data is transmitted or received by the modem in the time set in register S30, the modem automatically disconnects the call.

Call Statistics

The &V1 command provides various statistics about the previous call, (i.e., the modem connection just completed) including speeds at which the connection was made and the line quality.

The &V1 command and the S86 register provide information on the reason why the call was terminated.

Speed Buffering

The modem and DTE can communicate at various speeds: from 300 bps to 115,200 bps. The modem can also be on-line at various speeds: from 300 bps up to 14,400 bps for V.32 bis modems, up to 33,600 bps for V.34 bis modems, and up to 56,000 bps for V.90 modems.

In order to cope with the various speeds there are two options: the DTE-modem link must be at the same speed as the modem-modem link (called variable speed mode) or the modem must provide some form of speed buffering so that the DTE-modem link remains at a constant speed (called constant speed mode).

Constant speed mode forces the modem to maintain the DTE-modem speed, even if the connection speed made with the remote modem does not match the DTE-modem speed. For example, if the modem connects to another modem at 14,400 bps and the initial DTE-modem speed was 38,400 bps then the modem maintains this speed. If the DTE transmits a lot of data (such as a large file), then a bottleneck will eventually develop because the modem can only transmit the data at 14,400 bps (while the DTE transmits it at 38,400 bps). To cope with this the modem stores the data in an internal buffer. However, if the modem's buffer starts getting full then the modem must tell the DTE to stop sending data. This is called hand-shaking or flow-control (i.e., the DTE and modem control the flow of data between them) and is described below.

Speed buffering is controlled by the \N command. \N0 selects constant speed mode. \N1 selects variable speed mode (also called direct mode).

Note that if variable speed mode is used when auto-answering, the modem will change its DTE-modem speed to reflect the speed of the modem-modem link. In this case the DTE must change its speed.

Handshaking/flow control

As explained in the previous section the modem contains an internal data buffer to allow the use of constant speed mode between the DTE and modem. This internal buffer is of a fixed size (approximately 32 KBytes). If the DTE-modem speed is higher than the modem-modem speed and the DTE is transmitting a large volume of data (such as a large file transfer) then at some point the modem's data buffer will start getting full. At this point the modem must inform the DTE to stop transmitting data. (Conversely if the modem is transmitting too much data to the DTE then at some point the DTE must inform the modem to stop transmitting data.)

This is called handshaking or flow-control, i.e., the DTE and modem control the flow of data between them.

There are two methods of flow control: hardware or software.

The hardware method uses the RTS/CTS signals on the RS232 serial port. This is the most reliable method because it does not insert anything into the data stream between the DTE and modem. When the modem's buffer starts getting full the modem turns off the CTS (Clear To Send) signal. The CTS signal is turned on once the modem is ready to receive more data. If the DTE cannot cope with the amount of data the modem is sending then the DTE turns off the RTS (Request To Send) signal. Once it is ready to receive more data the DTE turns the RTS signal on again.

The software method is to use the XON and XOFF characters. When the modem's buffer starts getting full the modem transmits an XOFF to the DTE. When the modem is ready for more data it sends the XON character. The DTE can also use this, so if the modem is sending too much data the DTE can send the XOFF character and when it is ready for more data it sends the XON character. This method sometimes interferes with some file transfer protocols. Also you must guarantee that the XON and XOFF characters will not be transmitted as part of the data. XON/XOFF flow control is only used when the DTE or communications software do not support RTS/CTS flow control.

The flow control option to be used is selected with the &K command.

Setting the DTE-modem Speed

The modem determines the DTE-modem speed each time the AT characters are entered, at the start of a command string. The number of data bits, parity setting and number of stop bits are also determined at this point, by the modem.

The modem maintains this data rate, number of data bits and parity setting until the next time the AT characters are entered. If the DTE speed has changed then the modem changes its speed in response.

Setting the Modem-modem Speed

In the default configuration the modem is in autospeed mode, so that it can connect to any modem at any compatible line speed. If both modems are V.34 bis modems then they will both connect at 33,600 bps. However, if one modem is a V.32 bis modem and the other is a V.34 bis modem then they can only connect at the highest speed supported by both modem, in this case 14,400 bps.

The other alternative is to force your modem to connect at a particular speed. This can be done using the F command (for V.32 bis modems) or the +MS command (for V.34 bis and V.90 modems). 

Error Correction

All forms of data communication equipment have a probability of an error occurring in the data being transferred, i.e., what was sent is not what was received. With modems the number of errors received is directly proportional to the quality of the telephone line on which the connection is made. To overcome this problem of errors, an error correction protocol must be implemented between the modems.

Error correction is a technique used to guarantee that the data sent from the remote modem is the data received by the local modem.

Two different international standards exist for error correction between modems: MNP and V.42 (also called LAP-M). Most modems support either one or both of these standards.

MNP (Microcom Networking Protocol) was originally developed by Microcom Inc of the USA and has become an industry standard. There are three common classes of MNP error correction: classes 2, 3 and 4. V.42 was developed by the International Telecommunications Union (formerly the CCITT), a European based standards organisation.

A variation of the MNP error correction protocol is MNP-10. This was developed for noisy telephone lines and for modem connections over the cellular telephone network.

The \N command controls the error correction protocol used.

Data Compression

In addition to error correction, most modems now support data compression. Often the data transmitted between two modems contains similar data (i.e., per 1,000 characters sent many sequences are repeated). If the repeated sequences are encoded and sent as one character, rather than say 5, the amount of data transmitted between modems is reduced, thus giving an apparently higher data transfer rate. (Of course for this to work effectively the DTE-modem data rate must be much higher than the modem-modem data rate.)

Two different standards exist for data compression between modems: MNP-5 and V.42 bis. MNP-5 was developed by Microcom Inc, while V.42 bis was developed by the International Telecommunications Union (ITU, formerly the CCITT).

MNP-5 uses run-length-limited encoding and a variation of the Huffman compression algorithm. It can double the data transfer rate on some types of data. It works best when there are a lot of characters repeated in sequence, or a particular character is repeated.

V.42 bis is based on the Lempel-Ziv compression algorithm. It is good at compressing data where sequences of characters are repeated.

The %C command controls the data compression technique used.


MNP-10 works in conjunction with error correction and data compression to improve the modem's performance when working over poor quality telephone lines or over the analog cellular telephone network.

MNP-10 operates at a high level and controls the size of the error correction data packets and the modem-modem line speed. Therefore, as the quality of the data link changes the modem responds by either reducing or increase the size of data packet transmitted or the speed of the link.

Smaller packets mean that the effective data rate is slightly reduced (due to the packet protocol overhead), however, on a poor line this means that more data can be transferred because the chance of getting a data error in a packet is reduced.

The faster line modulation methods provide a higher data transfer rate, however, to operate effectively they need a better quality line than a lower speed modulation method. Therefore, reducing the speed of the link may indeed increase the effective data transfer rate (because less data errors will occur). Whenever MNP-10 changes the line speed (either up or down) there is a delay while both modems agree on the line speed at which to connect.

MNP is the only error correction protocol allowed with MNP-10.

Flow control should always be used with MNP-10, to ensure that no data is lost.

Because of the nature of the way MNP-10 works, and the way it is implemented on some modems, on good quality telephone lines MNP-10 sometimes causes more problems than it solves, i.e., some modems try and renegotiate the link speed on good quality links (this can be seen because there a breaks of up to 30 seconds between data transmissions).

Common Configuration Setup Strings

This section provides some typical modem setup strings. Force V.42 bis data compression with LAP-M error correction:

AT \N4 %C2 -K0 <CR>

Force V.42 bis data compression with MNP error correction:

AT \N5 %C2 <CR>

Force MNP-5 data compression with MNP error correction:

AT \N5 %C1 <CR>

Note that with the above three setup strings, if the modem is unable to negotiate with the remote modem, the modem will disconnect and return the NO CARRIER response.

Auto-negotiate data compression and error correction:

AT \N3 %C3 <CR>

In this mode, the AdvanCom modem prefers LAP-M over MNP-10, MNP-10 over MNP-4 and V.42 bis over MNP-5. If error correction is not negotiated, the modem will connect in normal mode.

This article was took over from the AdvanCom web pages.

Links & Download

Related articles

Hodnocení článku: