Modems

Modems

Up to this point, I’ve talked about things that almost every computer user has and almost always come with the system. We are now moving into a new area, where we get one computer to talk to another. In my opinion, this is where computers begin to show their true power.

Although once almost a standard, modems are no longer common computer accessories. Other technologies such as ISDN, DSL and VPNs have supplanted the functionality of modems, as of this writing, knowing how to cofigure modems is still part of some Linux certificatations.

Perhaps the earliest means of getting computers to talk to one another (at least over long distances) was the modem. Modem stands for Modulator/Demodulator, which is its basis of operation. It takes the digital signals that come across the bus from the CPU and converts them into a signal that can be understood by the telephone wires. This process is called modulation. On the other end, the signals are converted back from telephone signals into computer signals by a process called demodulation. Graphically this looks like Figure 0-15.

Image – Transfer of Data Across Modems (interactive)

The underlying concept of the transmission of data across the telephone line is that of a carrier. A carrier is a signal that runs along the phone line that is at a constant strength (amplitude), frequency, and phase. Because all of these are known values, changes in them can be detected. It is the changes that are used to encode the data.

When data are sent at relatively low speeds, the exact timing of that data being sent is not important. (relative to modem speeds) Markers, the start and stop bits, used within the transmitted data indicate the beginning and the end of each piece of data. (Note: You could have two stop bits.) If each modem is set to the same values, it knows when one piece of data stops and the next one begins. This is called asynchronous transfer.

How big is that piece of data? Usually just a single character. All the modems that I have ever seen have either 7 or 8 bits for data. That means that there are 7 or 8 bits between the start-stop bit pairs .This, too, is something that both modems need to agree on.

Parity works like this. Lets assume that a specific byte has 3 bits that are set. If you are using even parity, then the parity bit would be set to make the total number set four, which is an even number. If you are using odd parity, the number of the bit is already an odd number (three), and the parity bit would not be set.

When the settings at which your modem must be are determined, the order is usually the number of data bits, followed by the number of stop bits, then the parity. By default, Linux uses eight data bits, one stop bit, and no parity. It is common to refer to this as “eight, one, and none,” or “8-1-N.” Other settings might be 7-2-E for seven data bits, two stop bits, and even parity.

Another important characteristic is the speed at which the modem transmits the data. Although the exact timing is not critical, signals must be received within a certain time or problems happen. (For example, you could be waiting for months if the connection suddenly dropped.)

Now, lets go back to the modulated carrier wave. The term for the number of changes in the carrier wave per second is baud, named after the French telegraph expert, J. M. E. Baudot. One way of encoding data, based on the changes to the carrier wave, is called frequency shift keying, or FSK. The number of changes that can take place per second is the number of bits of information that can be sent per second (one change = one bit).

Lets consider a modem connection that operates at 2400 baud, eight data bits, one stop bit, and no parity. This gives us a total of 10 bits used for each character sent. (Did you forget the start bit?) Because baud is a measurement of the number of bits sent per second, 2400 baud means that 240 characters can be sent per second.

Other encoding methods result in getting more bits per baud. For example, the Bell 212A standard operates at 300 baud. However, because it gets four bits of data per baud, it gets 1,200 bits per second for those 300 baud. This rate is accomplished by changing more than just the frequency. If you changed both frequency and amplitude, you have four distinct values that you could use.

Have you ever had someone tell you that you have a 9600 baud modem? Don’t believe them! There is no such thing. In fact, the fastest baud rate is only 2400. So what are people taking about when they say their modem goes 9,600 or 14,400? They are talking about the bits-per-second (bps). If you get one bit-per-baud, then these terms are synonymous. However, all 9600 modems get more than that. They operate at 2400 baud but use a modulation technique that yields 4 bits per baud. Thus, a 2400 baud modem gives 9,600 bits per second.

As with all the other kinds of hardware I’ve talked about, modems must have standards to be useful. Granted, you could have a modem that can only communicate with another from the same manufacturer, but even that is a kind of standard.

Modem standards are like opinions: everyone has one. There are the AT&T standards, the Bell standards, the International Telecommunications Union (ITU) standards (which was formally the Comite Consultatif International Telegraphique et Telephoneique, or CCITT), and the Microcom Networking Protocol (MNP) standards.

As of this writing, the two most common standards are the CCITT and MNP. The MNP standards actually work in conjunction with modems that adhere to the other standards and for the most part define technologies rather than speeds or other characteristics.

The CCITT/ITU standards define (among other things) modulation methods that allow speeds up to 9,600bps for the V.32 standard and 14,00bps for the V.32 bis standard. The new V.34 standard supports 2,800bps. One newer standard, V.42, is accepted worldwide and provides error-correction enhancements to V.32 and V.32 bis. The V.42 standard also incorporates the MNP 4 standard, enabling one modem that supports V.42 to communicate with another that supports MNP 4. (For much more detail on the different modem standards, see The Winn L. Rosch Hardware Bible, Third Edition, and the Modem Reference, Second Edition, by Michael Banks. Both are published by Brady Books.)

One standard we need to go into is the Hayes command set. This set was developed by and named for the modem manufacturer Hayes and is used by almost every modem manufacturer. It consists of dozens of commands that are used to modify the functionality as well as read the characteristics of your modem. Most of the commands in this set begin with AT (which is short for “attention”), so this is often referred to as the AT command set. Note that the AT and almost every other letter is capitalized.

Several AT commands can be combined in a single string, and this is often used to initialize the modem before first use. These commands can set the default speed, whether the modem should automatically answer when someone calls in, and even how many rings it should wait for. I’ll talk about these in more detail later when I talk about configuring modems.

Modems come in two forms: internal and external. Because a modem is a serial device (it communicates serially as opposed to parallel), it will always take up a serial port. With an external modem, you must physically make the connection to the serial port, so you are more conscious of the fact that the modem is taking up a port. Internal modems also take up a serial port, but it is less obvious. Because you don’t actually see the modem, some users don’t realize that they no longer have a COM1 (or COM2).

In addition to the traditional serial modems, you can also find external USB modems. Some motherboards are produced with the modem built into the motherboard.

External modems are usually connected to the computer via a 25-pin RS-232 connector. Some serial ports have only a 9-pin serial port, so you need an adapter to convert the 25-pin to 9-pin, because every modem I have every seen has a 25-pin connector.

So, what happens when I want to dial into another site or send an e-mail message to my sister in Washington? Well, the communications software (maybe cu or uucp) sends a signal (an increase in voltage) along pin 20 (data terminal ready, or DTR) to tell the modem that it is ready to transmit data. On the modem, the equivalent pin is pin 6, data set ready, or DSR.

The modem is told to go “off hook” via the transmit data line (TX, line 2). Shortly thereafter, the system sends the AT-commands to start the modem dialing either with pulses (ATDP) or with tones (ATDT). The modem acknowledges the commands via line 3 (receive data, or RX).

The modem dials just like a phone and tries to connect to some device on the other end, probably a modem. If auto answer is enabled, the modem being called should answer, or pick up, the modem. When the connection is made, the calling modem sends a high-pitched signal to tell the receiving modem that a modem is calling. The receiving modem sends a higher-pitched acknowledgment. (You can hear this if your modem has a speaker.)

The carrier signal is then established between the two modems, which is kept at a steady, predetermined frequency. This is the signal that is then modulated actually to transmit the data. When the modem has begun to receive this carrier signal, it sends another signal back to the system via line 8 (carried detect, or CD). This signal is held active for the duration of the call.

The two modems must first decide how they will transmit data. This negotiation is called a handshake. The information exchanged includes many of the things that are defined in the different standards I talked about earlier.

When the system is ready to send data, it first raises line 4 (request to send, or RTS). If it is ready, the modem says okay by raising line 5 (clear to send, or CTS). Data then is sent out on line 2 and received on line 3. If the modem cannot keep up, it can drop the CTS line to tell the system to stop for a moment.

Moderm modems, are almost always plug-n-play, but you still need a means of communicating with it. For this, one tool you can use is setserial. It can be used to not only specify various modem settings, but can also provide information about how your modem is currently set. This includes basic information like what interrupt or base address the modem uses, but also how to behave with hangup signals. System Tools –> Internet Configuration Wizard http://www.yolinux.com/TUTORIALS/LinuxTutorialPPP.html –>