Sie sind auf Seite 1von 18

HOW MODEMS WORK

INTRODUCTION

he most explosive area of personal computer use is in the realm of data communications. Increasingly, personal computers are being connected, and data communications can be as simple as connecting two units so they can talk to each other. This can be accomplished by wiring their serial or parallel ports together when the computers are in physical proximity to each other (up to a few feet). Communicating over longer distances requires additional hardware in the form of a modem or a network card and software in the form of drivers and protocols. When more than two computers are linked so that they can share information, a network is formed. Networks in a relatively confined geographical area are called local area networks (LANs), and networks distributed over wider geographical areas are referred to as wide area networks (WANs).

MODEMS
Generally, the most difficult aspect of connecting peripheral equipment to a computer is obtaining the proper interfacing and cabling. If the peripheral is located at some distance from the computer (greater than 100 feet), it cannot be connected by simply using a longer cable. As the connecting cable gets longer, its resistance combines with distributive capacitance along the wires to form a natural electrical signal integrator, which tends to distort digital signals until they are no longer digital. To overcome this signal deterioration, a device called a modem (short for modulator/demodulator) is used to convert the parallel digital signals of the computer into serial, analog signals that are better suited for transmission over wire. A modem enables a computer to communicate with other computers through the telephone lines, as depicted in Figure 1.

Figure 1: Modem Communications

HOW MODEMS WORK 1

Some of the services available through the modem include bulletin board services (BBSs), user groups, and a variety of national and worldwide communication services, such as the Internet, Prodigy, and America Online. Many modems incorporate send/receive facsimile (fax) capabilities that enable the computer to correspond directly with fax machines around the world. Some newer modems incorporate digitized voice-transmission capabilities so that users can employ them as inexpensive telephones. In its simplest form, a modem consists of two major blocks: a modulator and a demodulator. The modulator is a transmitter that converts the parallel computer data into a serial format for transmission. The demodulator is the receiver that accepts the serial transmission format and converts it into a parallel format usable by the computer or peripheral. A modem, which sends signals in only one direction, is referred to as a simplex-mode modem. In the case of connecting two computers (or a computer and a remote terminal), its desirable to transmit data in both directions. This can be accomplished by placing a separate modulator and demodulator at each end of the transmission line. In this configuration, a complete modem unit is present at each end of the line. Modems capable of both transmitting and receiving data are divided into two groups, based on their mode of operation. Half-duplex mode modems can exchange data with another modem, but only in one direction at a time, as illustrated in Figure 2. Because both modems contain a modulator and a demodulator, adding an extra conductor enables both modems to send and receive data simultaneously. This mode of operation is known as Full-duplex mode.

Figure 2: Half- & Full-Duplex Communications


As the distance between terminals increases, it soon becomes impractical to use dedicated wiring to carry data. Fortunately, a very extensive communications network already exists: the public telephone network. Unfortunately, the phone lines were designed to carry analog voice signals instead of digital data. The design of the public phone system limits the frequency at which data can be transmitted over these lines. Again, the modem can be used to enable computers to use public telephone lines to exchange information.

HOW MODEMS WORK 2

A modem can be either an internal or an external device, as illustrated in Figure 3. An internal modem is installed in one of the computers expansion slots and has its own UART and interfacing circuitry. The external modem is usually a box installed outside the system unit and connected to one of the computers serial ports by an RS-232 cable. External units also require the use of an internal serial port for its UART. Most computers contain two serial port connections.

Figure 3: Internal and External Modems


In both cases, the modem typically connects to the telephone line using a standard four-pin RJ-11 telephone jack. A second RJ-11 jack in the modem enables an additional telephone to be connected to the line for voice usage. A still smaller four-pin RJ-12 connector is used to connect the telephone handset to the telephone base. Be aware that an RJ-14 jack looks exactly like the RJ-11, but it defines two lines to provide for advanced telephone features such as caller ID and call waiting.

Understanding How Modems Work


The standard telephone system accommodates a range of frequencies between 300Hz and 3300Hz, or a bandwidth of 3000Hz. This is quite adequate for transmitting voice, but it severely distorts digital data. To use the audio characteristics of the phone lines to their best advantage, the modem encodes the digital 1s and 0s into analog signals within this bandwidth. Modems are generally classified by their baud rate. Baud rate is used to describe the number of signal changes that occur per second during the transfer of data. Because signal changes are actually being limited by the telephone lines, the baud rate is the determining factor. Most modems begin encoding data into different transmission formats so that a number of data bits can be represented by a single signal change. In this way, the bit rate can be high even though the baud rate is still low. Common bit rates for telecommunications include 2400, 9600, 14400, 28800, and 33600 bits per second (bps). To complete a successful connection at maximum speed, the other party involved must have a compatible modem capable of the same baud rate.

HOW MODEMS WORK 3

FSK Modulation
The most common method of encoding data is a specialized form of frequency modulation (FM) called frequency-shift keying (FSK). Using this method, a specific frequency (such as 1070Hz) is used to represent a 0 (or space), and a second frequency (such as 1270Hz) is used to represent a 1 (or mark). By using a second pair of frequency tones, the modem can both send and receive a message simultaneously. The sending (or originating) modem uses the frequencies shown in the first row in Figure Table 1, and the receiving (or answering) modem uses the frequency scheme shown in the second row.

Table 1: FSK Trasmission

1 MARK (Hz) ORIGINATE S16=0 ANSWER S16=0 ORIGINATE SELF-TEST S16=1 ANSWER SELF-TEST S16=1 TRANSMITTER RECEIVER TRANSMITTER RECEIVER TRANSMITTER RECEIVER TRANSMITTER RECEIVER 1270 2225 2225 1270 2225 2225 1270 1270

0 SPACE (Hz) 1070 2025 2025 1070 2025 2025 1070 1070

FSK is used in most low-speed inexpensive modems to transmit data at a rate of 300bps. The terms baud and bps are sometimes used interchangeably. However, this is true only if a signal change is used to represent each bit. Using FSK modulation, each bit is represented by a signal change, so its proper to refer to the transfer rate as either 300bps or 300 baud.

PSK Modulation
At the higher transmission rates used by medium- and high-speed modems, FSK becomes increasingly ineffective because of signal losses and noise produced by exceeding the bandwidth of the phone line. To enable higher transmission rates, higher-speed modems use a different form of modulation, referred to as phase modulation or phase-shift keying (PSK). PSK modulation encodes data on a sine wave by shifting the phase of the wave to represent the 1s and 0s. In this manner, a single carrier frequency can be used to carry data, with the relative phase of the waveform indicating the bit-value of data. As an example, a logic 0 can be represented as a 0-degrees phase shift, and a logic 1 by a 180-degrees phase shift.

HOW MODEMS WORK 4

Phase shift is an analog quantity, so more than two values of phase shift can be used to represent data, as indicated in Table 2. When using more than two phase relations to encode data, the method is referred to as differential phase-shift keying (DPSK). By grouping consecutive data bits in groups of two or three, more than one bit of data can be represented by a single quantity of phase shift. Therefore, the baud rate can be held within the bandwidth of the transmission line, and the number of bits transmitted can be increased. When two bits (dibits) are grouped together, four possible bit-pattern combinations result. These combinations can be represented by four increments of phase shift, as depicted in Figure 4. Three-bit groups (tribits) produce eight possible bit combinations and require eight distinct phase shifts to encode the data. The most common transmission rate for this type of modem is 1800bps, at 600 baud.
DIBIT PAIR 00 01 10 11 PHASE SHIFT 0o 90o 180o 270o TRIBITS 000 001 010 011 100 101 110 111 PHASE SHIFT 0o 45o 90o 135o 180o 225o 270o 315o

Table 2: DPSK Encoding

Figure 4: Phase Key Shifting

QAM Modulation
Even higher transmission rates are achieved by combining DPSK techniques with amplitude modulation (AM), in a method known as quadrature-amplitude modulation (QAM). The combination of the two methods produces two amplitude states and four distinct phase shifts to represent any of the eight possible combinations of a four-bit group with a single signal change. Therefore, twice as many data bits can be transmitted using quadrature modulation as with PSK alone. In other words, this type of modem commonly transmits data at 2400bps and 600 baud. Using tribits extends the transmission rate to 4800bps, at 600 baud.

HOW MODEMS WORK 5

Data Compression
In addition to modulation techniques, advanced modems use data compression techniques to reduce the volume of data that must be transmitted. These data compression schemes are similar in operation to the techniques used with hard-disk drive recordings, tape back-up systems, and the audio/video digitizers described earlier in this text. Group coding techniques provide for redundant patterns of 1s and 0s to be represented by shorter encoded words. Several group coding techniques have been developed, but they all work on the same basic premise: remove redundant information from the data flow so that it takes less time to transmit. Each method involves a mathematical algorithm that reads the data and converts it into encoded words. The modem at the receiving end must use the same algorithm to decode the words and restore them to their original form. Some modem compression standards reach ratios as high as 4:1. The major standards for modem data compression have come from a company named Microcom and the Comite Consultatif International Telegraphique et Telephonique (CCITT) world-wide standards organization. The Microcom Networking Protocol level 7 (MNP 7) standard can produce 3:1 compression ratios, and the CCITT V.42bis standard reaches 4:1.

Transmission Synchronization
Data transmissions between computers, or between computers and peripherals, occur in data blocks consisting of strings of characters. Two techniques exist for synchronizing the timing of data transmission between devices. The first method, known as synchronous transmission, places timing synchronization signals at the beginning of each data block to synchronize the transmitter and the receiver. Because the entire block of data is synchronized at the beginning, blocks of data can be transmitted, one block after another, at a maximum rate set by the transmission line and the connecting modems. Because the entire block of data, the timing signals, and the error-checking information must be assembled before transmission, this technique requires the direction of a microcontroller and is usually reserved for high-speed, intelligent modem systems. The other technique, called asynchronous transmission, places a synchronizing bit at the beginning and end of each eight-bit character. The bits used in asynchronous transmission are referred to as start and stop bits. These bits enable characters to be transmitted at irregular intervals. This mode of transmission is usually associated with lower-speed modems (those in the range used with microcomputers and PCs).

HOW MODEMS WORK 6

Modem Sophistication
The simplest modem operation is provided by manually dialed modems. With this type of modem, an operator at one terminal dials a telephone number to contact an operator at another terminal. After the connection has been made, the operators initiate data transfers between their respective computers. At the end of the transmission, the operators must terminate the connection. Typically a number of sophisticated functions are available with more intelligent modems. Among these features is auto-dialing. Auto-dial modems store lists of telephone numbers, under the control of software. The system can dial these numbers at a particular time you specify (such as at night, when telephone rates are cheaper), and the feature may include automatic re-dialing of busy numbers. Besides auto-dial, modems may also provide autoanswer, auto log-on, and auto disconnect functions to accommodate completely unattended transfers of data. These are commonly referred to as originate/answer modems because of their capability of both initiating and answering calls under program control. Several features have been added to the basic modem that go far beyond simple autodial/auto-answer capabilities. The first major feature addition is the capability to communicate with facsimile machines (faxes). Many newer fax/modems come with the capability to send information to a remote fax machine, or to receive data from a fax machine, and store it on the hard drive until it can be printed. Another interesting feature added to modems is the capability to also carry digitized voice. A voice modem communicates with other modems, but it can also digitize voice and communicate this information to another voice modem. Such modems are becoming particularly interesting when used over the Internet. Because of the Internets organizational structure, voice modems can carry out telephone-like communications between any points in the world, often at the same cost as a local telephone call.

Computer-Modem Transfers
To facilitate the transfer of data from the parallel bus of the computer to the serial bit stream used by the modem (and vice versa), a UART or USART is used. Most modems use a UART. When the computer sends a character to the UART, it is loaded into a character buffer register. The UART shifts a start bit into the buffer, along with the proper error-checking bit and a specified number of stop bits. The character data block is now ready for transmission. At the receiver, the start bit of the incoming character block is detected. This causes the bits that follow to be shifted into the serial shift register. The error-checking bit is compared to an error bit generated by the receiver as the character block was shifted into the register. The start and stop bits are stripped from the character block, leaving only the data in the character buffer. The system processor can now access the incoming character in parallel form. The UART and a number of other asynchronous support chips make up the computer/modem interface. The physical location of the interface and its complexity depend on the particular computer system and the type of modem being used.

HOW MODEMS WORK 7

Stand-alone modems do not require an onboard UART because one is present in the computers asynchronous adapter card or serial interface. On the other hand, dedicated modems require an onboard UART to facilitate direct communications between the computer and the modem.

Protocols
To maintain an orderly flow of information between the computer and the modem (and between the modem and another modem) a protocol, or set of rules governing the transfer of information, must be in place. As far as stand-alone modems are concerned, the most basic hardware standard is the RS232C serial interface standard. But within the realm of the RS-232 standard, a proliferation of communication methods exist.

RS-232C
The RS-232C standard identifies communication equipment using two categories:

Data terminal equipment (DTE), usually a computer Data communication equipment (DCE), usually a modem
Data terminal equipment is any equipment whose main purpose is to process data. On the other hand, any communication equipment that changes data during transmission is referred to as DCE. Figure 5 illustrates a typical DTE/DCE relationship.

Figure 5: DTE/DCE Relationship

HOW MODEMS WORK 8

The RS-232C serial interface connection is usually made with a 25-pin, D-type connector. You should be aware that not all RS-232C connections use the 25-pin DB connector, and not all 25-pin DB connectors are RS-232C connections. Table 3 describes the pin designations and functions associated with the RS-232C interface, as they apply to modem/computer connections.

PIN NUMBER 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

COMMON NAME

RS-232C NAME AA BA BB CA CB CC AB CF

DESCRIPTION

Table 3: RS-232C Signal/Pin Definitions

TxD RxD RTS CTS DSR GND CD

Protective ground Transmitted data Received data Request to send Clear to send Data set ready Signal ground (common return) Received line signal detector (RLSD) Reserved for data set testing) Reserved for data set testing) Unassigned Secondary recd line sig. detector Secondary clear to send Secondary transmitted data Transmission signal element timing (DCE source) Secondary received data Receiver signal element timing (DCE source) Unassigned Secondary request to send Data terminal ready Signal quality detector Ring indicator Data signal rate selector (DTE/DCE source) Transmit signal element timing (DTE source) Unassigned

SI

SCF SCB SBA DB SBB DD

DTR RI

SCA CD CG CE CH/CI DA

In its most basic form, the RS-232C interface makes provision for full-duplex operating mode through pin 2 (TXD), and pin 3 (RXD). Normally, data passes from the DTE to the DCE on the TXD (Transmitted Data) line, and from the DCE to the DTE on the RXD (Received Data) line, although these two pins may sometimes be reversed. Of the variations of protocol schemes in use with the asynchronous RS-232C standard, five types are in widespread use today. These five types of protocols can be broken down into two distinct classes:

Hardware-oriented protocols Control code-oriented protocols

HOW MODEMS WORK 9

Hardware-Oriented Protocols
The hardware oriented protocols are tied to the use of a particular pin of the RS-232C connector to control data flow. The two most common forms of hardware protocols are DTR and RTS, named after the data terminal ready and request to send pins. These lines are toggled between high and low logic levels to control when to sendand not senddata. The DTE uses the RTS (pin 4) to inform the DCE that it is ready to send data. The DTE may also use the DTR (pin 20) to inform the DCE that it is online and functioning. The DCE uses a trio of reciprocal linesCTS (Clear to Send), DSR (Data Set Ready), and CD (Data Carrier Detect)to signal the data terminal equipment. The DCE uses the CTS to inform the DTE that it is ready to accept data. The data set (or modem) uses the DSR to notify the DTE that it is connected to the phone line. The RS-232C standard also designates a number of other lines that can be used for specialized functions. The Speed Indicator (SI) line, connected to pin 12, is used by the DCE to indicate whether the modem is in low- or high-speed mode. The DCE may also use the Ring Indicator (RI) line to indicate that ring-in voltage is being received. Pin 1 of the DB-25 connector is reserved for the protective frame ground, and pin 7 is used for the signal ground, to which all other voltages in the interface are referenced.

Table 4: Control Codes


HEX
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20

Control Code-Oriented Protocols


ASCII
NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT FF CR SO SI DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US SP

EBCDIC
NUL SOH STX ETX PF HT LC DEL GE RLF SMM VT FF CR SO SI DLE DC1 DC2 TM RES NL BS IL CAN EM CC CU1 IFS IGS IRS IUS DS

BINARY
0000 0000 0000 0001 0000 0010 0000 0011 0000 0100 0000 0101 0000 0110 0000 0111 0000 1000 0000 1001 0000 1010 0000 1011 0000 1100 0000 1101 0000 1110 0000 1111 0001 0000 0001 0001 0001 0010 0001 0011 0001 0100 0001 0101 0001 0110 0001 0111 0001 1000 0001 1001 0001 1010 0001 1011 0001 1100 0001 1101 0001 1110 0001 1111 0010 0000

DESCRIPTION
Null character (used for padding) Start of header (begin session) Start of text (begin data block) End of text (end data block) End of transmission Inquire (bid for acknowledgment) Acknowledge (positive response) Bell (ring the bell) Backspace Horizontal tab Line feed Vertical tab Form feed Carriage return Shift out (subscripting) Shift in (superscripting) Data link escape (binary xmission) Device control #1 (X-ON) Device control #2 Device control #3 (X-OFF) Device control #4 Negative acknowledge Synchronous idle (sync character) End of transmission block Cancel End of medium Substitute character Escape Field separator Group separator Record separator Unit separator Space (blank character)

Most data flow control is performed using the control code, or software, class of protocols. Of this class of protocols, three types are in widespread use:

X-OFF/X-ON ACK/NAK ETX/ACK


In these protocols, control codes are sent across the data lines to control data flow instead of using separate control lines. A listing of accepted ASCII control codes is presented in Table 4.

HOW MODEMS WORK 10

The X-ON/X-OFF protocol, where X represents two special control characters, is a relatively simple concept used to regulate data flow. This control is necessary to prevent buffer memories from overfilling. When data overflows the buffer, the result is usually an error code. The X-ON/X-OFF protocol uses special control characters to start and stop data flow. The ACK/NAK and ETX/ACK protocols are considered to be high-level protocols because they require special interface programs called drivers, or driver emulators. In both cases, these protocols use special control characters and escape code sequences to provide functions such as data transmission integrity, flow control, requests for re-transmission, and so forth. The ACK/NAK protocol derives its title from the ASCII control characters for ACKnowledge and Not ACKnowledge. This protocol uses these characters to provide a means of error correction for transmitted data. Basically, the ACK/NAK protocol expects a block of data to be preceded by a start-of-text (STX) character, and to be followed by both an end-of-text (ETX) character and an error-checking code, as depicted in Figure 6. At the receiving end, the block check character (BCC) is checked for errors. Depending on the outcome of the check, either an ACK signal is returned to indicate a successful transmission, or a NAK signal is returned to indicate that an error has occurred. If a NAK signal is returned, the transmitting device responds by re-transmitting the entire block. The ETX/ACK protocol is somewhat simpler than ACK/NAK, in that no character check is performed. If the receiving device does not return an ACK signal within a predetermined length of time, the sending device assumes that an error or malfunction has occurred and re-transmits the character block. Many protocol standards are in use with data communications equipment. The CCITT standards are identified by a v.xx nomenclature. The original CCITT standard was the v.22 protocol that established transfers at 1200bps using 600 baud. The v.22bis standard followed, providing 2400bps transfers at 600 baud using QAM methods. The v.32 protocol increased the rate to 4800bps and 9600bps. The 4800bps rate uses QAM modulation at 2400 baud, and the 9600bps rate operates at 2400 baud with additional QAM bit values. A v.32bis modification improves the transmission rate to 14,400bps by providing 128 possible QAM values.

Figure 6: ACK/NAK Transmission

The CCITT standards also include an error-correction and a data-compression protocol. The v.42 standard is the error-correction protocol, and v.42bis protocol is the CCITT equivalent of the MNP5 and MNP7 protocols. Both protocols run as modules along with the v.32 and v.32bis protocols to provide additional transmission speed. The MNP Microcom standards began with protocols MNP2MNP4. These standards dealt with error-correction protocols. The MNP5 and MNP 7 standards followed as the first datacompression protocols. The MNP10 standard introduced the first Adverse Channel Enhancement protocol. This type of protocol is designed to provide maximum performance for modems used in typically poor connection applications, such as cellular phones. This protocol features multiple connection attempts and automatically adjusted transmission rates. As with the advanced CCITT protocols, the MNP10 protocol module runs along with a V.42 protocol to maximize the data transmission rate.

HOW MODEMS WORK 11

Newer CCITT and MNP protocols are under development to provide modems with 56kbps transmission capabilities. These protocols use a two-step mapping algorithm to map 256 binary values into a data encoder. The encoder produces digital symbols that are applied to a D/A circuit which converts the data into 256 possible analog signals. The symbol rate for 56kB modems is 8Khz. The two-step mapping algorithm provides the best possible trade-off between data table size, error rates, and elevated complexity. During a special training period conducted at lower speeds, the modem tests the integrity of the transmission medium. The modem uses the training information to determine the ultimate group of points in the map to be used for the existing line conditions. The modem then negotiates with the remote modem to determine the maximum transfer rate. Several error-correcting file transfer protocols have been developed for modem communications packages. Some of the more common protocols include the following:

Xmodem Ymodem Zmodem Kermit


These protocols use extensive error-detection schemes to maintain the validity of the data as it is being transmitted. The concept of parity checking has already been discussed as a method of detecting data errors. However, parity checking alone is somewhat ineffective when used to check large blocks of data and it offers no convenient means of error correction. Error-detecting and correcting protocols generate more exotic error-detection algorithms such as checksum and cyclic redundancy checks (CRCs)to identify, locate, and possibly correct data errors. In Xmodem transfers, the transmitter sends a data block similar to the ones depicted in Figure 7. The data section of the block is 128 bytes long. A checksum character is used to detect transmission errors, and the ACK/NAK method of flow control is employed. An improved version of the protocol, called Xmodem CRC, replaces the checksum character with a CRC block check character. The Ymodem protocol improves on the Xmodem CRC version by increasing the size of the data block to 1024 bytes, although Ymodem can still support the 128 byte xmodem format, if necessary. The 1024 byte version begins with an STX ASCII character, and the 128 byte transmission starts with an SOH character. An improved version, called Ymodem batch, includes filenames and sizes in the transfer so that multiple files can be sent in a single transmission. A further improvement is used in Ymodem G. In this format, the sending unit uses the Ymodem batch method but does not wait for an ACK signal back from the receiver before sending the next data block. This latter format is used only with the MNP protocol functions that supply their own error checking and correcting. The Zmodem protocol provides a wealth of high-level management features. In addition to using CRC16 and CRC32 error-detection schemes to verify data integrity, the Zmodem protocol offers Autofile Restart crash-recovery techniques and selective file transfers. The files are selected by including their filenames in a batch transfer operation. Zmodem can be used for transferring both text and binary files (such as .exe files). All the protocols mentioned in this category are used to transmit files over dial-up telephone lines. However, they are not capable of being used with Internet communications.

HOW MODEMS WORK 12

These are only classes of protocols, and within these classes are many methods of actually implementing a particular protocol. Within a particular protocol, a number of parameters must be agreed upon before an efficient exchange of information can occur. Chief among these parameters are character type and character framing. Basically, character type refers to the character set (or alphabet) understood by the devices. Depending on the systems, the character set may be an 8-bit ASCII line code, a 7-bit ASCII code (with a parity bit), or an EBCDIC code. Character-framing, on the other hand, refers to the total number of the bits used to transmit a character. This includes the length of the coded character and the number and type of overhead bits required to send the character. A common character-framing scheme calls for a start bit, seven data bits, an odd-parity bit, and a stop bit, as depicted in Figure 7. Although this is a typical characterframing technique, it is not universal throughout the industry. The problem here is one of device comprehension. The local unit may be using a 10-bit character frame consisting of a start bit, seven data bits, an odd-parity bit, and a stop bit. However, if the remote system is using something besides 7-bit, odd-parity ASCII with one stop bit, the response from it would be as unintelligible as anything written in English.

Figure 7: Asynchronous Character Format

The Call
To understand the operation of the modem, it is important to understand that it must function in two different modes. The first mode is the local command state. In this condition, the modem is offline and communicates with the host system to receive and process commands. The second mode is the online state. In this condition, the modem facilitates the transfer of data between the host computer and a remote computer or device. Two events can cause the modem to shift from the offline state to the online condition. The system can prompt the modem to go online and dial out to another unit. To accomplish this, the host computer directs places the modem in Originate mode. The second event involves the modem receiving a ring signal from a remote device. In this situation, the host system shifts the modem into Answer mode. The modem automatically shifts from the online state to the local command state whenever the carrier signal from the incoming line is not detected in a given amount of time, or whenever the carrier signal is lost after the connection has been made. An embedded code in the transmitted data can also be used to shift the modem into the local command state. There are three basic conditions during the operation of the modem:

Dialing Data exchange (the call) Answering

HOW MODEMS WORK 13

Dialing
To place a call using the modem, the same series of events must occur as when you are placing a voice telephone call. When the handset is removed from its cradle, a switch inside the telephone closes, connecting the phone to the line. At this point, the phone is in a state known as off-hook, but it is not yet online. When the modems relay closes and the dial tone is detected, the modem notifies the host computer that it is connected to the line. To originate a call using an auto-dial modem, you must first place your modem in Originate mode. This requires that the modem be operating in the local command state. Basically, the modem is always in either the local command state or the online state. In the local command state, you can issue commands from the computer to the modem. In the online state, communications between modems occur. Using an auto-dial modem, the modem automatically places the call by issuing the digital tones equivalent of the desired phone number. The number may come from the keyboard, or it may be one that has previously been entered into memory. Some auto-dial modems are capable of producing both pulse- and touch-tone dialing equivalents. A number of things can occur to prevent the modem from going into the online state. An intelligent modem waits a specified length of time after pick-up before it starts dialing so that the phone system has time to apply a dial tone to the line. After the number has been dialed, the modem waits for the ring back from the telephone company (this is what you hear when you are making a call). When the ringing stops, indicating that the call has gone through, the modem waits a specified length of time for an answer tone (carrier) from the receiving modem. If the carrier is not detected within the allotted time, the originating modem begins automatic disconnect procedures (hangs up), as depicted in Figure 8. If a busy signal is detected, the originating modem hangs up or refers to a second number.

Figure 8: AutoDial/AutoAnswer Modem Cycle

HOW MODEMS WORK 14

The Conversation
After the phone line connection has been established, a handshaking sequence occurs. The originating modems Carrier Received pin (CD) signals its computer that the receiving modem is online. This is followed by a signal on the Clear To Send (CTS) pin, indicating that its computer is ready to transmit and receive data. The originating modem responds by issuing its own carrier tone frequency, which the answering modem must detect to notify its computer (through its CD and CTS pins) that it is online and ready for data. If both tones have been received successfully, the greetings and handshakes are completed, and the transfer of information begins. During the data transfer, both modems monitor the signal level of the carrier to prevent the transfer of false data due to signal deterioration. If the carrier signal strength drops below some predetermined threshold level or is lost for a given length of time, one or both modems will initiate automatic disconnect procedures. While the modem is in the online state, no commands can be given to it from the keyboard. However, the local command state can be re-entered while still maintaining the connection, by using of an escape-code sequence.

Answering
For an auto-answer modem to receive calls, it must be configured to answer the incoming call. When a call comes in, the ring voltage is detected by the modem, which activates its Ring Indicator (RI) pin to notify the computer that a call is coming in. Depending on the configuration of the modem, it may answer the incoming call on the first ring or after some preset number of rings. If the called computer is ready, meaning the data terminal ready (DTR) signal is active, the modem goes off-hook and begins the handshaking routine.

The Serial Interface


In the case of external modems, the serial interface, including the UART, is normally provided by the host system. In pre-Pentium units, the systems multi I/O card provided a pair of fully programmable, asynchronous communication channels through two serial port connections. On earlier I/O cards, a pair of 8250 UARTs were used as the basic port circuitry. In newer MI/O cards, a single VLSI device, called an integrated I/O controller, provided the interfacing and UART functions. In most Pentium systems, the serial port adapter function is incorporated into the system boards integrated I/O controller IC. The original serial adapters featured programmable baud rates from 50 to 9600 baud, a fully programmable interrupt system, and variable character lengths (5-, 6-, 7-, or 8-bit characters). In addition, the adapter added and removed start, stop, and parity bits; had false start-bit detection, line-break detection, and generation; and possessed built-in diagnostics capabilities. As modems became faster and faster, upgraded UARTs were included or integrated to keep up.

HOW MODEMS WORK 15

Notable advanced UART versions include the 16450 and 16550. The 16450 was the 16-bit improvement of the 8250, and the 16550 was a high-performance UART with an onboard 16-byte buffer. The buffer enables the UART to store or transmit a string of data without interrupting the systems microprocessor to handle them. This provides the 16550 with an impressive speed advantage over previous UARTs. These advanced UARTs enable serial ports to reach data transmission rates of up to 115 Kbps. Although some features have changed between these UARTs, and although they are sometimes integrated directly into an integrated I/O chip, they must still adhere to the basic 8250 structure to remain PC-compatible. In most PC-compatible serial ports, very little circuitry besides the UART is needed to implement the interface. Normally, only an oscillator/clock circuit and some RS-232 line driver/receiver chips are required. Figure 9 shows these required sections in block form. Although the basic lines of the serial ports originate on a multi I/O card or system board, they must be connected to RS-232-compatible D-shell connectors to complete the interface. This usually involves connecting a ribbon cable between the board that contains the interface circuitry and the connectors, located on a special expansion slot cover. The connectors on the slot cover are usually a 9-pin DB-9M, and a 25-pin DB-25M. The ribbon cables pass the TXD, RXD, DSR, DTR, RTS, CTS, CD, RI, and ground signals to the connectors.

Figure 9: RS-232 Serial Interface

As mentioned earlier, two serial ports are normally provided in a PC-compatible system:

RS-232-1 RS-232-2
These are hardware settings for the physical ports. The system recognizes the serial ports by their COM port settings. COM port settings are simply port addresses (COM1, COM2, COM3, and COM4) assigned to the serial interfaces by the operating system. These settings enable the hardware and software to work together. The communication protocol is a function of the system software and must be loaded before the interface can be operational. Software uses the COM setting to address instructions and data to the correct UART. Therefore, both the hardware and software COM settings must agree for the interface to function properly. Either RS-232 port may be designated as COM1, COM2, COM3, or COM4, as long as both ports are not assigned to the same COM port number. In most PCs, COM1 is assigned as port address hex 3F8h, and COM2 is assigned port address hex 2F8h. Normally, IRQ4 is selected for COM1 and COM3, and IRQ3 is selected for COM2 and COM4. Because these COM ports share IRQ settings, it should be apparent that all four ports cannot be in use at the same time. For example, if an external modem is connected to COM2, then no other device should be set up on COM4.

HOW MODEMS WORK 16

The UART
Whether the UART is located on a multi I/O board, in an integrated I/O controller chip, or is part of an internal modem, it must supply most of the logic and control circuitry for the RS232C interface. In addition to the classic functions described earlier for a UART, the I/O controller provides all the control and handshake lines required for asynchronous communications to take place (such as RI, DSR, DTR, RTS, CTS, and RLSD). Note that the Receive Line Signal Detect (RLSD) line can is described as the Carrier Detect (CD) line in the RS232C standard. Of course, these lines are used by the interface adapter to control the flow of information between the PC and the serial communications equipment. Figure 10 shows a block function diagram of an 8250-compatible UART.

Figure 10: Inside the UART

HOW MODEMS WORK 17

The UART in a PC-compatible system has a number of addressable registers, which help the system units software to control its operation. Different modes of operation are selected by programming its registers at port addresses 3F8h3FFh for the primary RS-232-1 interface, and 2F8h2FFh for the secondary RS-232-2 interface. The operation of these registers can be summarized as follows:

TX-RD buffer (3F8/2F8h): This address selects the received data register, which holds the received character if the UART is in read configuration. Conversely, the transmitter holding register is accessed by the same address when the UART is in write configuration and bit-7 is low. If bit-7 is high, this address accesses the least significant byte (LSB) of the programmable baud-rate generator for initialization. Interrupt enable register (3F9/2F9h): The bits of this register enable four different UART interrupts, which, in turn, activate the chips INTRPT output. This address also depends on bit 7 of the line-control register. The interrupt enable register is selected by bit 7 being low. If bit 7 is high, this address selects the most significant byte (MSB) of the programmable baud-rate generator for initialization. Interrupt identification register (3FA/2FAh): The contents of this register are used to prioritize four interrupt levels in the UART. The bits of the register are used by software to identify the highest priority interrupt that may be pending and lock out all other interrupts until that particular interrupt has been serviced. Line-control register (3FB/2FBh): The contents of this register are used to define the format of the ports data exchange. The logic level of the various bits of this register define parameters such as word length, number of stop bits, and the type of parity used. Modem-control register (3FC/2FCh): The bits of this register control the DTE/DCE interface (in particular, the DTR and RTS lines). One bit of this register is used by software to provide loopback diagnostic testing. Line status register (3FD/2FDh): This register provides the system unit with status information concerning data transfers. This information includes data ready in the receiver register, receiver register overrun errors, parity errors, framing errors, transmitter holding register empty, and transmitter shift register empty. Modem status register (3FE/2FEh): The contents of this register indicate the status of the DTE/DCE control lines. These lines include the CTS, DSR, RI, and RLSD lines.

HOW MODEMS WORK 18