The Technofile Web site has moved.

Technofile is now located at
Please update your links, bookmarks and Favorites.  

Modems have a language all their own

technofile  by al fasoldt

Columns and commentaries in a life-long dance with technology

Simple gray rule

Modems have a language all their own

By Al Fasoldt

Copyright © 1994, The Syracuse Newspapers


If you use a modem, your software sends out this message all the time. If I write it this way—"ATtention!"—you may have an easier time recognizing it. It's the Hayes command that has become the standard way for software to begin sending instructions to a modem.

The Hayes command set is named after the Hayes Microcomputer Products company, which developed a series of short commands that tell a modem what to do and how to do it. Hayes is the IBM of the modem world, setting standards that others have gladly followed.

For the next few weeks, we'll take a look at the Hayes command set. We'll start with a few of the basic commands.

Commands are issued to the modem either directly by the user or by software running on the computer. To give a command directly, you generally have to run a telecommunications program and put it into terminal mode. (You can send a command right from the MS-DOS command line if you know the trick. We'll cover that another time.)

Terminal mode varies from program to program. Usually in terminal mode, you'll have a window or a screen that is blank except for text that you send to the modem and that the modem sends to you. Some telecomm programs are always in terminal mode; some, such as Procomm Plus for DOS, leave terminal mode only when you choose the help screens or scroll back to look at captured text, and others seem to be designed to hide the terminal activity unless you really insist on seeing it.

So use whatever method you need and make sure your software is in terminal mode. Turn the modem on if it's an external model. (Internal modems are always on when your computer's on.)

Wake up the modem with the "ATtention!" command. I'm not just making a pun here, by the way. Hayes calls this command—which is "AT"—the "ATtention!" command, too. Just type "AT" and hit the Return or Enter key.

You should see a response from your modem. (If you see no response at all, and you know your modem is working, you may need to tell the modem to echo its responses to the screen. Do this by typing "AT" and then "E1"—like this: "ATE1." Then hit the Return or Enter key. The "E" stands for echo, and the "1" stands for "on.")

From here on, I won't tell you to hit Return or Enter to send the command. Just remember that you have to do it.

Once you see a response, check to see if it's in words or numbers. If you see "OK," your modem is set up to give "Verbose" responses (not verbs, of course—just words), but if you see "0" (a zero, not an "Oh"), you're getting the number treatment. To switch from number responses to words, type "AT V1." To switch to numbers, type "AT V0" (that's AT V zero).

By now, you should be seeing an "OK" on the screen when you type "AT." This means we can back up a little and explain how the AT command set works.

Modems have a neat way of ignoring spaces in commands. They aren't seen at all, nor are they counted. (Older modems can't take more than 40 characters at a time in a complicated set of commands, but even the older ones don't count spaces as part of the total.)

So this makes it easy for you to dress up your commands so they make sense. Instead of typing "ATE1V1," which looks like something a hungry computer might say, type "AT E1 V1" and so on.

When the Hayes company began to add to the Hayes command set for modems, it ran out of simple commands such as "L" for loudness and "E" for echo, so it had to create newfangled command names. The result was a group of "&" commands (and some others that use still more odd characters).

The most common might be "AT &W," which tells the modem to store all the current commands in its temporary memory into a permanent storage area. That can be very handy, especially if you find that the modem arrived from the factory with the wrong settings for your situation. Just type in all the settings you want, then use "&W" to store them.

Doing a reset command—"AT Z"—will bring back the settings you stored. Some modems also have secondary storage areas that you can access with the "&W1" or "&W2" commands. To bring those settings back, you'd use "AT Z1" or "AT Z2."

Another handy ampersand command is "&V," which tells the modem to display all its settings on your screen. Unless your software is some dimbulb freeware offering, you should be able to turn on the software's capture mode and save the commands the modem shows you on the screen. It's a great way of keeping a record of your modem's configuration.

"&C" and "&D" are two important commands you must know about to get the most out of your modem.

"&C1" is the standard setting; it tells the modem to keep track of the telephone line to detect a carrier signal from another modem. "&D2" is the preferred setting for the other command. (It handles another detection method, but we'll keep the techie stuff out of this for now.)

"&F" can be helpful if you mess up your modem's configuration so badly that it won't work any more. It calls up the settings made by the factory. If those settings are what you want, issue the "&W" command to store them in the other part of the modem's memory.

Modems sometimes have dozens of other commands. We'll look at some of them another time, but we should finish this miniseries with a quick look at S-Registers. They're places in the modem's memory where its brains are located. You can change many of them.

One S-Register many folks know about is S0. (That's a zero, not an Oh.) It controls the modem's response to a telephone ring. If you enter this command—"AT S0 0"—the modem will never answer the phone itself. (It will do it if commanded to, of course.) But if you type "AT S0 1," the modem will pick up the line after one ring.

If the phone line you're using is substandard and has a hard time clearing a dial tone, use the S6 register to tell the modem to wait longer than the standard two seconds for a dial tone. Use "AT S6 4" to have it wait for four seconds, or "S6 10" for 10 seconds, and so on.

These days, modems are so complicated that there are S-Registers well into the hundreds. If you have a good, name-brand modem, many of them are explained in your manual. If you bought a no-name brand, you may not have been so lucky.

Normal Hayes commands don't need to be hard to learn.

These commands can be typed directly to the modem from the terminal screen of your telecomm program, or they can be inserted into the so-called dialing string of your software. (They can also be put into the initialization string.)

IF this jargon seems a little nerdish, check your software's manual or help menu; you should see references to the dialing string and the initialization string. (If you don't, maybe it's time for new software.)

At the paragraph factory, we have modems on every personal computer, and one of the biggest complaints we hear is that they make an annoying noise. Squealing and rushing sounds come out of the tiny speakers that are built into them. Usually, you want to be able to hear those sounds, because they tell you the modem is connecting with another modem, but it's easy to turn the sound down or off.

Here's how. To turn the sound down, send the modem an "AT L0" command. To turn the sound off, send an "AT M0" command. (Those are zeroes, not "ohs.") To turn the sound back on, use "AT M1."

(As with all modem commands, you do not need to put the "ATtention!" command—"AT"—in front of everything. Just put it at the start and string all the commands together.)

As you can see, most commands are easy to remember—"L" for loudness, "M" for mode and so on. Another to keep in mind is "X" for eXtended result codes, which can get your modem working properly even when you have that ever-popular $#!*&! voice mail on your line. (I'm not a fan of voice mail, in case you wondered.)

Normally, your command set should include "AT X4," which tells the modem to send your software the proper responses when it dials out and tries to connect with another system. But "X4" will not work when you use a modem on a voice-mail system that signals the presence of voice mail by making short beeps when you pick up the phone.

This can be very annoying, and no doubt there are hundreds of you who have had to get a second phone line in your office because the expert on your staff assured you that your modem will not work when you have voice mail.

Wrong. All you need to do is change "X4" to "X3." The "X3" command tells the modem to do a so-called blind dial—in other words, to dial without checking for a dial tone.

Look at the modem initialization string your software sends out and you will almost surely see "X4." Change it to "X3" if you have voice mail. (And don't pick on that "expert" too much; modems are mysteries to them, too.)

As we just saw, your modem snaps to attention when it gets commands from your software—or directly from you, if you type them at the keyboard. These are known as the Hayes commands.

They're also known as the "ATtention" commands, or the plain old "AT" command set. Many of them are easy to remember because they start with the first letter of the description of the command.

For example, the command for "dial" is "D." The command for "pulse" is "P" and the command for "tone" is "T." Add these together and you get the Hayes dialing command, either "DP" for "dial by pulses" or "DT" for "dial by tones."

Simple, right? All you need to add is the actual phone number, so the command to dial a number using a Touch-Tone phone line would be "AT DT 123-4567." (You have to press the Return or Enter key to actually send the command to the modem, of course.)

Let's look at some of the others.

To tell the modem to answer the phone, use "AT A" ("A" for "answer"—I told you this would be easy.) To get it to zero out all the temporary commands it has received and use the permanent ones stored in its memory, use "AT Z."

Most of the AT commands are a little fancier than this. They let you or your software add a number to the command letter. The choice is often "0" (that's a zero) or "1." If the command is able to use a number and you don't use one, the modem usually puts a "0" onto the command itself.

Take that "AT Z" command, for example. Most modern modems provide "Z0" and "Z1," corresponding to memory setting "0" and memory setting "1." If you type "AT Z," memory setting "0" is used. (Computers count by starting at "0," not at "1.")

But my advice, as modems get more complicated, is to put the numbers into all the commands that use them. That way, you'll never be surprised by a command that starts acting up when it defaults to the wrong numerical setting.

Better yet, you'll get into the habit of associating these numbers with "off" and "on," which is what "0" and "1" often mean in the computer world.

Take the echo command. It's "AT E0" for "echo off" and "AT E1" for "echo on." (It tells the modem to echo, or display, its responses to your commands on the screen.) And look at the full-duplex command. It's "AT F0" for "full duplex off" and "AT F1" for "full duplex on."

(Now you know a way to switch your modem to full or half duplex if your software doesn't allow this. Just use "AT F0" for half duplex.)

Then there's the hang-up command. It's "AT H0" for an "off" connection (a line that is hung up) and "AT H1" for an "on" connection (a line that is live—in other words, one that the modem has picked up the connection on).

It's important to note that you can string these commands together, using just one "AT" command at the beginning, like this:

AT Z1 E1 F1 H0 DT 123-4567

And you can leave out all the spaces. I like to leave them in so I can make sense out of the commands.

We've seen how high-speed modems achieve a very fast transfer rate, as much as four times faster than their actual baud rate (or bit-per-second rate, which is more accurate technically). Let's see how your computer is fooled into working with the modem at only one basic rate.

That's right. I said "fooled." Computers are pretty smart in some ways, but they're babes in the digital woods when it comes to figuring out what's going on at the other end of a cable.

The secret is called "RTS/CTS." (Watch out! Here comes that jargon again.) That means "request to send/clear to send." It's also known as "hardware handshaking," and that's a bit clearer.

Hardware handshaking is just what it sounds like. Each computer is always reaching out to shake hands with its modem, so to speak, to signal their agreement on everything they do. "Want to get a byte of my data?" "Yeah, man. Shake!" And so they shake hands, in computer terms.

They do that by sending out signals that tell each modem when to start sending something and when to stop. You might imagine that this happens every now and then, maybe once a minute, but in fact it can happen many times a second—even hundreds of times a second, if necessary.

AND IT JUST might be necessary for them to shake hands that way hundreds of times a second if their modems are speeding along while the computers are bumbling about at a much slower speed.

That's because the RTS/CTS handshaking is a cushion that absorbs the speed differences between one kind of hardware—the computer—and another kind—the modem. In effect, RTS/CTS puts the modem on a rubber band that lets the modem go faster or slower than the computer without getting out of the computer's grasp.

If you've played with your software's menus or settings, you may have seen "RTS/CTS" listed. You also may have noticed something else—"X-on/X-off." This is merely a simpler type of handshaking.

THE "X" STANDS for "Xmit," which, in turn, stands for "transmit. So it means "transmit on/transmit off."When X-on/X-off is used, the two computers send simple signals across the phone lines to call for a pause or a resumption in the data flow. You may have used X-on/X-off yourself without even realizing it; pressing Control-S sends the pause signal, and pressing Control-Q sends the resume signal. (They mean "stop" and "query.")

X-on/X-off works fine at slow speeds, but it can't handle high-speed transmissions. That's why we need RTS/CTS. It makes sure that no matter how fast or slow the modem is going, the computer will be able to work with it.

Aren't you glad you asked?

We now know how a 14.4Kbps (kilobit per second) modem can act like a 57.6 Kbps modem. In the best of times, the modem compresses the stuff it is sending by a factor of 4, so that 400K of data can be sent as 100K.

Einstein would appreciate the next part. Since the modem is sending something across both space and time, compressing the data by 4:1 also compresses the time required to send it. If you turn that mathematical logic upside down, it raises the bits-per-second rate by a factor of 4, too.

Are you still with me?

So far as the computers on each end of the connection are concerned, the two modems aren't talking back and forth at 14.4Kbps; they're blitzing back and forth at 57.6Kbps.

That's what matters. Keep in mind that your computer has no idea that the modem is doing any compression. All it knows, literally, is "data in, data out." And that data, under the best conditions, is zooming along much faster than 14.4Kbps.

This is not necessarily good news. (Don't you love this part of the explanation?) Some computers just plain can't handle "data in, data out" rates that fast. If you have an old, old IBM-compatible PC, or something like an Apple II, you probably can't get that kind of speed out of the computer.

And if you are running Windows software on your PC, Windows itself can't handle that speed in many cases.

THERE'S MORE. If you set up your software for a baud rate (bit-per-second rate) of 14.4Kbps, your computer will never be able to take advantage of the compression trick. No matter how amazingly your modem performs, if your software is set to 14.4, you'll never get more than 14.4, compression or no compression.

Complicated, isn't it?

I'm going to skip some of the dense technical stuff (and risk the danger of oversimplifying this and saying something the tech-heads will complain about), but here is the problem in brief:

Your computer has to be set up, through your software, to expect the highest possible transfer rate that your system can handle. The highest rate is always the one that is lower when you compare the computer's maximum rate and the modem's maximum rate.

In other words, if your modem can achieve an effective rate of 57.6Kbps and your computer has a maximum of 19.2Kbps, then 19.2 is the rate you set in your telecommunications software. If your modem's maximum effective rate is 14.4Kbps (as it would be if it didn't have the compression feature built in) and your computer's maximum rate is 9 zillion Kbps, 14.4 is the rate you set in your software.

Does this make sense so far? The most astute readers may already have a problem with this scenario. It goes like this: If I have my software baud rate set at 57.6Kbps and the modem connects to an online service at 2400bps or 9600bps, won't they be totally out of whack?

No, not at all.

It has to do with the price of progress. When something gets better, it often gets harder to use.

Take modems, for instance. Back in the days when 2400 baud was the highest speed any sane computer user dared to go with a modem, you plugged the modem in and set your software to 2400 baud. That's all.

But high-speed modems have turned this simple task topsy-turvy.

Firrst, there is the problem of baud. No doubt J.M.E. Baudot (1845-1903), the Frenchman who developed a code for the deaf long ago, would have felt honored by seeing his name used to represent the speed at which modems operate. But it turns out that baud is the wrong term these days.

Ah, progress! The right term is "bits per second." In slower modems, baud and BPS (often written "bps") are the same, but when things start happening faster, the rules change.

So, if you've recently switched from a slower modem to one of those zippy "14.4" models, get "baud" out of your vocabulary. It's BPS, pal. (No, you don't get any points for saying "bips," either; you have to pronounce it "bee pee ess.")

Then there is the problem of BPS. (I was hoping you wouldn't notice that we went right from one speed problem to another.) It has to do with the trick a high-speed modem uses to get an even higher speed than the high speed you thought you were getting when you bought it.

Still with me?

Let's say you have a modem that runs at 14.4Kbps (kilo, or thousand, bits per second). Your friend Mary has the same modem, but she says hers runs at 57.6Kbps. Who's right?

Both of you. The nominal rate is 14.4, but the effective rate under the best conditions is 57.6. The "effective" rate is so much higher because most 14.4 modems are able to compress whatever they are sending. The amount of compression varies according to the density and nature of the data being sent, but it can reach a 4:1 ratio.

This means, for example, that 400K can be sent in the space of 100K. At the receiving end, the modem expands that 100K back into 400K.

Pretty neat, eh? Not really. It can cause all sorts of problems, as we'll see another time.

 Image courtesy of Adobe Systems Inc.technofile: [Articles] [Home page] [Comments:]