# Serial Programming/Modems and AT Commands/& Commands

Serial Programming: Introduction and OSI Network Model -- RS-232 Wiring and Connections -- Typical RS232 Hardware Configuration -- 8250 UART -- DOS -- MAX232 Driver/Receiver Family -- TAPI Communications In Windows -- Linux and Unix -- Java -- Hayes-compatible Modems and AT Commands -- Universal Serial Bus (USB) -- Forming Data Packets -- Error Correction Methods -- Two Way Communication -- Packet Recovery Methods -- Serial Data Networks -- Practical Application Development -- IP Over Serial Connections
* Hayes-compatable Modems and AT Commands References:
* -- Special AT Commands and Character Sequences
* -- AT Commands A - M
* -- AT Commands N - Z
* -- AT& Commands

# Hayes-compatible AT& Commands

This module provides a reference to the Hayes-compatible AT commands which start with an &. The following list only contains the original Hayes commands. Different modems use slightly different commands. However, this list is supposed to be as "generic" as possible, and should not be extended with modem-specific commands. Instead it is recommended to provide such command lists in an Appendix.
AT& commands are in no way special, compared to other AT commands. It is just that Hayes at some point ran out of the 26 single-letter commands (ATA ... ATZ), so they introduced double-character commands. In order to avoid that these clash with single-letter commands, these double-character commands got a common prefix, the &.

### Command Description Template

To be removed when all commands are documented
Syntax:
Description:
<Description of the command, including information about the purpose and effects>
Result Codes:
Result Codes :
| Code | Description |
| OK | Parameter was valid <description of success> |
| ERROR | Otherwise <description of failure> |
Related Commands and Registers:
* <Link list of related commands and registers>

### &B: V.32 Auto Retrain Options

Command Description Template
Syntax:
Description:
<Description of the command, including information about the purpose and effects>
Result Codes:
Result Codes :
| Code | Description |
| OK | Parameter was valid <description of success> |
| ERROR | Otherwise <description of failure> |
Related Commands and Registers:
* <Link list of related commands and registers>

### &C: Data Carrier Detect Options

Syntax:
Description:
This option controls the behaviour of the DCD (Data Carrier Detect, alias RLSD) RS-232 output line of the modem. The modem can either be told to keep the line always on (parameter 0), or that the line should really follow the state of the carrier on the phone line (parameter 1, default). The carrier on the phone line is the basic signal on which then (later) the data is modulated on. It is like the carrier frequency of some radio station. Carrier detection indicates if the two paired modems have been "tuned in".
In case the RS-232 DCD line is configured to be driven by the modem following the state of the carrier (parameter 1), the DTE can use this information for flow control, display progress information to the user, etc.
On the other side, setting DCD to be on all the time (parameter 0) can be used if the DTE software, e.g. some terminal program, does not handle DCD correctly, or if the DTE ignores it. However, letting DCD follow the carrier state is usually the better configuration.

#### AT&C

or

#### AT&C0

    Always keep DCD on.

#### AT&C1

    DCD follows carrier state (default).
Result Codes:
Result Codes :
| Code | Description |
| OK | Parameter was valid (either 0 or 1) |
| ERROR | Otherwise (parameter was not 0 or 1) |
Related Commands and Registers:
* <Link list of related commands and registers>

### &D: Data Terminal Ready Options

Syntax:
Description:
The &D command specifies how the modem should react to an on-to-off transition on its DTR (data terminal ready) input line. The DTE can use this line as part of some hardware-handshake. The exact behavior of the &D command depends on other settings, as outlined below:
&D Behavior :
| &D | &Q | Description |
| 0 | 0, 5, or 6 | DTR is assumed to be always on. This allows communication with DTEs which do not provide DTR information, or wrong information. |
| 0 | 1, or 4 | When the DTE drops DTR (on-off transition) the modem hangs up. This does not affect auto-answer behavior. |
| 0 | 2, or 3 | When the DTE drops DTR (on-off transition) the modem hangs up. Auto-answer is blocked. |
| 1 | 0, 1, 4, 5, or 6 | A DTR on-off transition is interpreted as if the asynch. escape sequence has been entered. The modem goes in command mode but keeps the connection. |
| 1 | 2, or 3 | When the DTE drops DTR (on-off transition) the modem hangs up. Auto-answer is blocked. |
| 2 | 0, 1, 2, 3, 4, 5, or 6 | When the DTE drops DTR (on-off transition) the modem hangs up. Auto-answer is blocked. This is the default setting. |
| 3 | 0, 1, 4, 5, 6 | A DTR on-off transition causes the modem to perform a soft-reset as if the Z command was received. The &Y setting determines which configuration profile the modem will load during the reset. |
| 3 | 2, or 3 | When the DTE drops DTR (on-off transition) the modem hangs up. Auto-answer is blocked. |
Typically, more special rules apply if the modem supports additional features like Fax. This is out of the scope of this generic Hayes command description.
Result Codes:
Result Codes :
| Code | Description |
| OK | Parameter was valid (0 to 3) |
| ERROR | Otherwise |
Related Commands and Registers:
* #&Q: Communications Mode Options

### &F: Recall Factory Profile

Command Description Template
Syntax:
Description:
The modem loads the factory profile 0 (default) or the factory profile 1. The factory profiles are fixed modem condigurations as provided by the modem manufacturer
Result Codes:
Result Codes :
| Code | Description |
| OK | Profile loaded (modem was previously off-line) |
| ERROR | Modem is on-line. |
Related Commands and Registers:
* <Link list of related commands and registers>

### &G: Guard Tone Selection

Syntax:
Description:
In some telephone systems it is necessary to transmit an additional guard tone in order to disable echo supressors in the phone system. Echo supressors do interfere with data communication, because they alter (in good faith) the transmited signal, e.g. by changing the signal's delay, phase and amplitude. This disturbes the modem's signal modulation and introduces communication errors.
A guard tone tells an echo supressor (and possibly other equipment) to not alter the transmitted signal. Guard tones are standardised in telecom standards.

#### 0

    Do not use a guard tone (default)

#### 1

    Set guard tone on answering modem to 550Hz. Note, this feature is rarely implemented in todays consumer modems.

#### 2

    Use 1800Hz guard tone.
Result Codes:
Result Codes :
| Code | Description |
| OK | Parameter was valid (0, 1, or 2) |
| ERROR | Otherwise. |

### &J: Jack Type Selection (Auxiliary Relay Options)

Syntax:
Description:
Hayes modems supported different jacks to connect the modem to a telephone or leased line. The '&J' command allows to select the type of jack which should be used. Typically, this command is not fully implemented in today's modems. Usually, the command just sets some registers and does nothing otherwise.

#### 0

    Jack type RJ-11, RJ41S, or RJ-45S type phone jack (default)

#### 1

    Jack type RJ-12 or RJ-13 type phone jack
Result Codes:
Result Codes :
| Code | Description |
| OK | Parameter was valid (0, 1) |
| ERROR | Otherwise. |

### &K: Local Flow Control Options

Command Description Template
Syntax:
Description:
<Description of the command, including information about the purpose and effects>
Result Codes:
Result Codes :
| Code | Description |
| OK | Parameter was valid <description of success> |
| ERROR | Otherwise <description of failure> |
Related Commands and Registers:
* <Link list of related commands and registers>

### &L: Line Type Selection (Dialup/Leased)

Command Description Template
Syntax:
Description:
<Description of the command, including information about the purpose and effects>
Result Codes:
Result Codes :
| Code | Description |
| OK | Parameter was valid <description of success> |
| ERROR | Otherwise <description of failure> |
Related Commands and Registers:
* <Link list of related commands and registers>

### &O: PAD Channel Selection

Command Description Template
Syntax:
Description:
<Description of the command, including information about the purpose and effects>
Result Codes:
Result Codes :
| Code | Description |
| OK | Parameter was valid <description of success> |
| ERROR | Otherwise <description of failure> |
Related Commands and Registers:
* <Link list of related commands and registers>

### &Q: Communications Mode Options

Command Description Template
Syntax:
Description:
<Description of the command, including information about the purpose and effects>
Result Codes:
Result Codes :
| Code | Description |
| OK | Parameter was valid <description of success> |
| ERROR | Otherwise <description of failure> |
Related Commands and Registers:
* <Link list of related commands and registers>

### &R: RTS/CTS Options

Syntax:
AT&R[0|1]
Description:
This option controlls the behavior of the CTS (clear to send) RS-232 input line of the modem. The modem can either be told to use it for hardware handshaking (parameter 0), or ignore it (parameter 1).

#### AT&R0

    Use CTS signal from DTE for hardware flow control

#### AT&R1

    Ignore CTS from DTE (always send)
Result Codes:
Result Codes :
| Code | Description |
| OK | Parameter was valid <description of success> |
| ERROR | Otherwise <description of failure> |
Related Commands and Registers:
* <Link list of related commands and registers>

### &S: Data Set Ready Options

Command Description Template
Syntax:
Description:
<Description of the command, including information about the purpose and effects>
Result Codes:
Result Codes :
| Code | Description |
| OK | Parameter was valid <description of success> |
| ERROR | Otherwise <description of failure> |
Related Commands and Registers:
* <Link list of related commands and registers>

### &T: Test Options

Command Description Template
Syntax:
Description:
<Description of the command, including information about the purpose and effects>
Result Codes:
Result Codes :
| Code | Description |
| OK | Parameter was valid <description of success> |
| ERROR | Otherwise <description of failure> |
Related Commands and Registers:
* <Link list of related commands and registers>

### &U: Trellis Coding Options

Command Description Template
Syntax:
Description:
<Description of the command, including information about the purpose and effects>
Result Codes:
Result Codes :
| Code | Description |
| OK | Parameter was valid <description of success> |
| ERROR | Otherwise <description of failure> |
Related Commands and Registers:
* <Link list of related commands and registers>

### &V: View Configuration Profiles

Command Description Template
Syntax:
Description:
<Description of the command, including information about the purpose and effects>
Result Codes:
Result Codes :
| Code | Description |
| OK | Parameter was valid <description of success> |
| ERROR | Otherwise <description of failure> |
Related Commands and Registers:
* <Link list of related commands and registers>

### &W: Write Active Profile to Memory

Command Description Template
Syntax:
Description:
<Description of the command, including information about the purpose and effects>
Result Codes:
Result Codes :
| Code | Description |
| OK | Parameter was valid <description of success> |
| ERROR | Otherwise <description of failure> |
Related Commands and Registers:
* <Link list of related commands and registers>

### &X: Synchronous Transmit Clock Source

Command Description Template
Syntax:
Description:
<Description of the command, including information about the purpose and effects>
Result Codes:
Result Codes :
| Code | Description |
| OK | Parameter was valid <description of success> |
| ERROR | Otherwise <description of failure> |
Related Commands and Registers:
* <Link list of related commands and registers>

### &Y: Select Stored Profile For Hard Reset

Command Description Template
Syntax:
Description:
<Description of the command, including information about the purpose and effects>
Result Codes:
Result Codes :
| Code | Description |
| OK | Parameter was valid <description of success> |
| ERROR | Otherwise <description of failure> |
Related Commands and Registers:
* <Link list of related commands and registers>

### &Zn=x: Store Telephone Number

Syntax:
Description:
The &Z command allows to store up to four telephone number dial strings into the modem's NVRAM.
This feature is rarely used by modem communication software these days. DTE software preferes to keep an own list of possible phone numbers (e.g. a list of bulletin board system numbers), which can be much more than just four different numbers.
The feature is still useful in automated systems, and e.g. in cases where the DTE software is not (end user) configurable. For example, some embedded controller might be capable of running a modem communication with generic Hayes-compatible commands to alert a remote site in case of problems (burgler alarm, machine maintenance request, etc.). But for cost or other reasons the embedded system might provide no way for the end user to configure the embedded system. Instead the embedded system will use ATDS=0 (or another index) to dial and relie on the modem's setup to have a phone number stored at index 0 (or another index).

#### n = 0 ... 3

    Index of the dial string

#### <x>

    A dial string. This can be a simple number, but it can also contain dial modifiers as listed for the ATD (dial) command. Typically, the size of a single dial string can not extend 34 characters.
Example :
To store the number 00155512345 into register 0 for tone dialing (T) use:
AT&Z0=T00155512345<CR>
Result Codes:
Result Codes :
| Code | Description |
| OK | Index was valid (0 ... 3), and dial string less than 35 characters. |
| ERROR | Otherwise. |
Related Commands and Registers:
* D: Dial Command
Serial Programming: Introduction and OSI Network Model -- RS-232 Wiring and Connections -- Typical RS232 Hardware Configuration -- 8250 UART -- DOS -- MAX232 Driver/Receiver Family -- TAPI Communications In Windows -- Linux and Unix -- Java -- Hayes-compatible Modems and AT Commands -- Universal Serial Bus (USB) -- Forming Data Packets -- Error Correction Methods -- Two Way Communication -- Packet Recovery Methods -- Serial Data Networks -- Practical Application Development -- IP Over Serial Connections
* Hayes-compatable Modems and AT Commands References:
* -- Special AT Commands and Character Sequences
* -- AT Commands A - M
* -- AT Commands N - Z
* -- AT& Commands