This is an edited and condensed excerpt from The Modem Reference, written by Michael A. Banks and recommended by the Associated Press, The Smithsonian Magazine, Jerry Pournelle in Byte, et al. The right to reproduce this article is granted on the condition that all text, including this notice and the notice at the end of the article, remain unchanged, and that no text is added to the body of the article. Thanks! --MB Copyright (c), 1988, 1989, 1990 Michael A. Banks All Rights Reserved (From Chapter 3) HOW TELECOMPUTING WORKS You don't have to understand how something works to use it, but understanding sure makes things easier--especially when trouble pops up. This is true of using any complex device or system--be it an automobile, a VCR, or a library. And it's especially true of using a computer in any application. When you understand even a little of what's happening "behind the scenes," as it were, you'll find that you have a lot more control over what's going on with your equipment and software. Which brings us to my purpose in writing this excerpt: I want you to have a solid picture of what's happening when your computer communicates with another system. We'll first examine the basic elements of telecomputing, followed by data formats. Then, we'll segue into how data are transmitted (focusing on hardware and software elements), and wrap up with communications parameters and error control protocols. (And, yes--you can understand all this "technical" stuff; what one human creates, another human can understand, if he or she so desires.) You won't have to pull out engineering texts to keep up with me. I'll explain terms and concepts as necessary, and you can supplement those explanations with the Glossary of Terms in Section Four of THE MODEM REFERENCE. If you're relatively new to telecomputing, read this chapter from start to finish. Otherwise, you may skim the headings, if you wish, to find only the information you need to fill the gaps in your telecomputing knowledge. TELECOMPUTING BASICS As indicated in Chapter 2 of THE MODEM REFERENCE, telecomputing (also called data communications or microcomputer telecommunications) is the transfer of data of any type between two or more computers via a transmission link. Most telecomputing (especially telecomputing involving dial-up systems) goes like this: Computer A transmits binary data (also known as digital data) to a modem, in the form of a sequence of bits. The modem converts the bits to an analog signal which mimics the distinction between the binary 1s and 0s. The analog signal is then transmitted over voice-grade telephone lines. At the receiving end, a modem connected to computer B converts the analog signal back into a binary signal that is basically a copy of what computer A sent to its modem. The modem then sends the binary signal to computer B. At this point, Computer B has in its memory a duplicate of the data Computer A originally sent to its modem. (This process works in both directions, of course.) This is a greatly simplified description of data transfer from one computer to another via modem, but it should give you a picture of how the basic elements of telecomputing (as described below) interact. (If any of the terms used in the description caught you off guard, don't despair--they are fully explained in the following pages.) Basic Elements of Telecomputing Successful telecomputing involves four major elements: data, data terminal equipment, data communications equipment, and a communications link. Various sub-elements are also involved, as described in the text following. Data. Computer data is defined as machine-readable information of any kind. The information may consist of business or personal messages, other kinds of text files (articles, contracts, documentation, reports), spreadsheets, "lines" of a realtime conference, graphic images, data base files, executable programs in binary data format, data files for programs, etc. Data are handled within a computer as binary information, and may be entered in "real time" from a keyboard, retrieved from a mass storage device like a disk, generated by a program's operation, or received via an interface from an external source. By the way, this chapter focuses more on the format and mode of data transfer--before, during, and after transmission--than on its content. The successful delivery of data with its content intact is of course the primary goal of data communications but, as you'll learn, data format in large part determines the mode-- and success--of transmission. Data Terminal Equipment. As imposing as the phrase may sound, Data Terminal Equipment (DTE) is nothing more than the computers or terminals used in telecomputing--the source and destination of data. The use of the word "terminal" in the phrase alludes to the fact that the computers or terminals involved are the beginning and ending points of data transmission--which is just what a terminal is: a place where a journey begins and ends, ala a train or bus terminal. Communications Links. Computer-to-computer data transfer may take place in a variety of ways. In its most basic form, telecomputing involves linking two computers directly, using what is called a "null-modem cable" to connect their serial ports. In this kind of setup, the computers are only a few feet apart, and data are transferred in true binary format. (Appendix E contains instructions on making a null-modem cable.) The majority of telecomputing activities, however, take place via telephone lines--either the public voice telephone system or what are known as "dedicated" telephone lines as the communications link. Although it is the least expensive and most readily available channel of data transfer, the voice telephone system cannot handle computer data in its native binary format. Thus, a modem must be used to translate data from binary (or "digital") format into analog format--a format that can be successfully transmitted via ordinary phone lines. (There is another type of phone system that does accommodate direct binary data transmission. Called a digital network, it is used in a applications where extremely speed and accuracy are necessary--but setting up and using such a system is an extremely expensive proposition.) A telephone link does not, by the way, consist solely of telephone wires. Electro-mechanical, electronic, and computer switching equipment is involved, as well as microwave transmitters and satellite up- and down-links. For the purposes of this chapter, however, such elements will remain transparent. Data Communications Equipment. Simply put, Data Communications Equipment (DCE) consists of modems and their associated interfaces, connectors, and cables. Modems have a number of functions, including but not limited to: * establishing and maintaining a communications link * translating data from digital to analog format, and vice- versa * transmitting and receiving data The interface between a modem and its computer is typically a serial interface (specifically, an RS-232C interface), although some few modems use a parallel interface. For the dial-up applications discussed in this book, you'll probably use a serial interface. DATA FORMATS AND DATA TRANSFER IN COMPUTERS As noted above, computer data must be converted from digital to analog format before it can be transmitted via voice telephone lines. Before you can understand how data are physically converted and transmitted over communications links, however, you need to understand how computers handle data internally. This section presents important information about digital data organization and handling in both your computer and portions of a communications link. Basically, I'm going to show data to you as your computer sees it. Computer Data Format Continuing improvements in computer hardware and software over the years (as well as competition among various manufacturers) have made for a veritable Tower of Babel when it comes to mainipulating, storing, and transfering information. The differences in how data are stored on, say, an IBM AT quad-density disk versus a Commodore 128 disk are so great that there is no possible comparison of the two (and there's certainly no way to transfer data between machines using one machine's disk and the other machine's drive). Too, how various brands and models of computers handle data internally differs substantially. Fortunately, all modern computers have one thing in common: they handle data in digital format (which is why they're called digital computers). This means that they "see" data characters as strings of binary digits. Note: The terms "digital" and "binary" are sometimes used interchangeably. "Digital" refers to discrete, uniform signals of any type--binary or otherwise--that do not vary in a continuous manner. Rather, such signals are identified by specific levels or values such as "on" or "off." Digital signals change immediately from one state to another, and are the antithesis of analog signals. Because we are concentrating on binary data and binary signals in this book, "digital" refers to binary data and signals. Further, almost all computers (some mainframe computers excepted) use the same numeric code to represent each character--numbers from the American Standard Code for Information Interchange (ASCII). As you'll see in the following pages, computers that share these attributes can easily exchange data. Binary data. Even if you're not technically oriented, I'm sure you've at least heard rumors about data being stored and manipulated by digital computers in something called "digital" or "binary" data format. Binary data format means that each character (letter, number, symbol, or control character) a computer handles is operated on and stored as a specific binary number. (There are several excellent reasons for this, one of which you'll discover presently.) Binary numbers. A binary number is a string of binary digits, such as "1010" or "10011." Only 0s and 1s are used in binary notation (as opposed to the numerals 0 through 9, which are used by the decimal system). Unlike the decimal system, the values of the numerals themselves (0 and 1) are not used to determine the total value of a binary number; instead, the values of the places marked by a 1 are summed. Each place, of course, has a set value. The first place on the right in a binary number has a value of 1, the second place a value of 2, the third place a value of 4, and so on, with the value doubling with each place. Again, the value of a binary number is determined by adding up the values of the places that contain a 1. If there is a 0 in a place, that place's value is not counted. Consulting Table 3.1 in THE MODEM REFERENCE, it is easy to see that the binary number "11" is the same as the decimal number "3" (add the values of the places: 2 + 1 = 3). Similarly, the binary number 1010 is the same as the decimal number 10 (add the value of the places that contain a 1: 8 + 2 = 10). Nothing to it, right? Right! Keep this up and you'll be a math wizard in no time. Bits and bytes. A binary digit is called a "bit," by the way, and it happens to be the smallest unit of computer data. A binary number representing a computer character (sometimes called a data "word") is called a byte. The ASCII character set. I hope the explanation of binary data left you wondering what the key to the numeric "code" of binary numbers might be--which is to say, I hope it started you thinking. There is indeed a code to those numbers, a "Rosetta stone" you can use to translate the decimal equivalents of binary numbers into characters. It's called ASCII. Each and every character that a computer handles is assigned a number in the ASCII character set, which is shown in Table 3.2. (Note that only the first 128 ASCII characters are shown; certaincomputers--such as the IBM PC and Apple's MacIntosh--use an additional 128 ASCII characters, many of them dedicated to graphics. Not all computers recognize such extended ASCII character sets. Also note, for later reference, that the first 128 ASCII characters--0 through 127--can be represented by a string of seven binary digits, with leading 0's added as necessary.) As you may have inferred from the foregoing, a digital computer manipulates characters as the binary counterparts of these ASCII numbers. For instance, the letter "A" (ASCII 65) is represented within a computer as "1000001"--the binary counterpart of 65. Thus, any computer that uses binary data format and the ASCII character set recognizes the binary digit "100001" as the letter "A" when it is received as input--via its keyboard or from an external source such as a modem. Binary signals. Within a computer, each string of binary digits representing a character is manipulated as a discreet unit. This unit, as you may have noticed a few paragraphs back, is called a byte. A byte is normally composed of 8 bits. When a computer sends data to a peripheral--printer, modem, etc.--each byte is transmitted as a binary signal. The signal is literally a series of negative and positive voltages, as illustrated in Figure 3.2. The negative state represents a binary 1, while the positive state represents a binary 0. This particular signal contains the binary number "11000001." And yes, the order of the binary digits is reversed; that is, the figure does show "10000011," even though the number it represents is "11000001." The figure is reversed because the binary digits that make up a character are transmitted that way (i.e., the "low-order" bit [the bit with the lowest-value] is transmitted first). This is done so parity can be calculated as a character is sent (more on that later in the chapter). (NOTE: I wanted you to see this now, so you won't go slowly nuts trying to figure out why the digits are reversed in the figures in this book that illustrate binary signals. That's pretty much what happened to me the first few times I studied tutorials on data communication. None of the authors bothered to explain why the figures showed the data bit order as the reverse of what it was in the text. (Whether this was out of ignorance or due to a lack of consideration for the reader, I don't know. And I never did find a book that explains this situation; I eventually found out what was going on by asking several engineers who work in the field. (All of which is not to plug this book as the ultimate resource on data communications for the layman, but to make this point: Books and manuals are not infallible. Writers sometimes assume too much knowledge on the part of the reader, and are occasionally themselves confused. Too, the computer field is notorious for having several terms with the same meaning, or several meanings for one term. So, if something doesn't make sense when you read about it in your modem or software manual, check it out! See if this book provides the information you need. If not, ask someone who knows (or should know); contact the modem manufacturer or software publisher whose manual is the source of your confusion.) Why binary? The binary data system is used with modern computers primarily because it is faster and more reliable than analog systems. The two-state binary system is extremely simple; a signal is either there or not there, negative or positive, etc. Therefore, there is very little chance of information getting lost or "scrambled." Such information can be received and handled by a computer at extremely high rates, as cumbersome as this system is for humans to use. Using the analog technique for information transfer and manipulation, on the other hand, requires reading the relative strengths of any of a large number signals, as well as the calibration and checking of those signals. This slows down data manipulation tremendously. The electronic components used in digital computers (initially transistors and later integrated circuits of various types) exactly mimic the binary system, switching off and on (between two states) at extremely high speed. Data Transfer The astute reader will have realized by now that all that's necessary for the letter "A" to be transmitted from computer A to computer B is for computer A to send the binary digit "1000001" to computer B. If you've figured that out, pat yourself on the back--it represents the very essence of telecomputing. This all looks good on paper, but we still have to move that "1000001" from computer A to computer B. This requires a chain of devices and connections, the first link in which is a computer's port. SERIAL PORTS AND THE RS-232C STANDARD Computers aren't telepathic, and they seem immune to magic spells, so they must be physically connected before they can communicate. Moreover, they must be connected with one another or with their associated modems in a special way. The hardware medium for such a connection, whether the computers are linked via a null-modem cable or modems, is known as a port. Ports A computer's ports provide the physical (electrical) connections by which a computer's internal workings communicates with peripherals such as printers and modems. (A seaport might be used as a valid analogy for a communications port, as this is where data are sorted, organized, and shipped.) A port consists of a group of connectors in the form of pins (male) or sockets (female). Not all connectors are used by every computer, but each connector that is used is connected to a specific part of the computer's circuitry where signals are received and/or sent according to instructions from a program or the computer's operating system. (It gets more complicated, but I promised you wouldn't have to drag out the engineering texts, so we'll leave it at that.) There are two kinds of ports--parallel and serial. The name of each describes how it transfers data. Parallel ports. A parallel port sends and receives data over at least eight wires at once. This means it simultaneously transmits all the data bits that make up a character. Parallel ports are rarely used for data communication; they are most frequently used to connect computers with devices such as printers, where extremely high data transmission rates are necessary and the short distance involved won't cause problems. Serial ports. A serial port is a type of port which sends and receives data over one wire. Figure 3.3 shows typical serial port configuration. Note that Figure 3.3 shows two kinds of serial ports--one with 25 connectors and one with nine connectors. The difference in the number of connectors is a bit confusing, until you learn that not all 25 pins are used. The average microcomputer uses only eight of the pins in data communications applications (the IBM PC, among others, uses nine pins.) Serial ports and their associated cables function as an interface between computers and modems. Or, if you like technical jargon, as a "DTE/DCE interface." The RS-232C Standard This is where we un-buzz a buzz word (which should be done whenever possible). You've undoubtedly heard that this or that port or modem or cable conforms to something called the "RS-232C" standard. And you may well have wondered just what RS-232C means--and whether there's an RS-232A or B, for that matter. Well, I hope I don't shatter any cherished illusions, but RS-232C isn't as mystic as it may look in print. Let's look at it. What it is. RS-232C (often called simply RS-232) is a reference on how a serial port should physically communicate. Functionally, it is a standard for the design of the interface between a computer and its modem. This recommendation was established by the Electronics Industry Association (EIA) in 1969 to provide a standard for manufacturers of data communications equipment to follow in the design of such equipment. Semantically speaking, the designation breaks down thus: RS is an acronym for Recommended Standard; 232 is the ID number for this particular standard; and C is the latest revision of this standard. (The full name of RS-232C, by the way, is "Interface Between Data Terminal Equipment and Data Communication Equipment Employing Serial Binary Data Interchange.") What it does. The RS-232C recommendation covers the electrical and mechanical characteristics of the interface, the function of each signal (pin), and, for certain applications, secondary functions of signals. The reason for designing a serial interface that follows the RS-232C standard is to enable it to exchange data with other serial interfaces in proper form. To this end, the standard dictates how data are to be handled by the port, which indirectly dictates how the port's pins are connected to the computer's or modem's circuitry. Elements covered by the standard include voltage levels, which pins on the port are used to send and receive data, which pins detect various status signals, and more. In addition to the above, the RS-232C standard dictates that DCE (modems) use a female RS-232C connector, and DTE (computers) use a female connector. The actual configuration of a connector is not covered by the RS-232C standard, however. What a computer or modem does with a signal received at an RS-232C port is its own business; the important thing is to have the receiving device perceive data it receives in exactly the form it was sent, and at the appropriate location in its circuitry. How it works. Serial data ports that are designed in conformance with the RS-232C standard have standardized pin assignments. That is, each pin in the port's connector has a designated purpose, as shown in Figure 3.4 As you can see, the pin assignments cover just about every job that might come up in transmitting and receiving data. Again, each pin is connected to its device's circuitry as necessary to route signals to and from the appropriate elements. Thus, a computer with a properly-designed RS-232C port should, for example, send data at pin 2, and receive data at pin 3. In transfers via telephone line, each computer's serial port is connected to a modem via a cable that is wired in conformance with the RS-232C standard. (Presumably, the modem's serial port likewise conforms to the RS-232C standard.) In null-modem transfers, the computers' serial ports are connected via a cable that is wired to match the RS-232C standard for pin connections--but with two connections reversed. Figure 3.4 covers pin assignments for DTE only, by the way. A DCE serial port (as wired for a modem) has slightly different pin assignments (such as using pin 2 to receive data from a computer, and pin 3 to send data). Other RS-232C Functions. A serial port is much more than a simple data conduit. In most telecomputing applications, the serial port performs additional tasks, some of which may not be covered by the RS-232C standard. These include organizing the parallel data bits transmitted by a computer into serial form, parity checking, adding and stripping start and stop bits, and--on relatively rare occasions--flow control (more on those later in this chapter). Limitations. Because of the low voltages used to transmit a signal via an RS-232C port, the length, or "run," of a cable is limited to about 50 feet. If a longer cable is used, there is a good chance that data will be lost. However, the cable between a computer and modem is generally only two or three feet in length. Thus the RS-232C is ideal for this application. The maximum transmission speed of an RS-232C transmitter is 20,000 bps, but this is far faster than most telecomputing applications. Connectors and Cables The cables (and the connectors used with those cables) that connect a computer's serial port with a modem are obviously very important elements in the data communications chain. Like serial ports, connectors and cables used with serial ports must conform to the RS-232C standard. Connectors. There are two types of RS-232 connectors in common use--DB-9 and DB-25. Remember the diagram in Figure 3.3? It showed a port connector with nine pins and another with 25 pins. Nine- and 25-pin connectors are known as DB-9 and DB-25 connectors, respectively. Each type has numbered connectors (very important if you intend to make your own cables--saves a lot of messing around with a continuity tester). You'll sometimes see the letter "P" or "S" appended to DB-9 or DB-25. This letter indicates whether the connector is male ("P" for "plug") or female ("S" for socket). DB connectors are essentially "mirror images" of the serial ports on your computer and modem, and are used at each end of the computer-to-modem connecting cable. As noted earlier, the physical configuration, or shape, of an RS-232C connector is not defined by the RS-232C standard. DB-style connectors have become the de facto standard, however, simply because almost all manufacturers use them. Cables. A connecting cable is typically a "ribbon cable"--a flat cable with multiple conductors, as shown in Figure 3.5. Mixing connectors. DB-25 and DB-9 connectors can be used at opposite ends of a cable if necessary (as when a computer's serial port has a DB-9 connector and its modem has a DB-25 connector). Only eight of the pins are normally used, and all that's required for the connection to be successful is that the pins on each connector be properly wired (i.e., one connector should be wired as DCE [usually the DB-9], and the other as DTE [usually the DB-25]). Some modem manufacturers, such as U.S. Robotics and Migent, provide a DB-25 to DB-9 adaptor cable with certain models of their modems. (See Appendix E for more information on cable/connector hookups and making your own cables.) Connector and cable "gender". You may recall my saying a few paragraphs back that the RS-232 standard specifies a that female connector should be used on modems, and a male connector on computers. Thus, a "standard" RS-232C cable has a male connector on one end (to connect with the modem) and a female connector on the other end (to connect with the computer). Unfortunately, not all manufacturers follow this standard regarding the gender of their serial ports. So, with certain equipment you may find what is called a "gender problem." (No sex-change jokes please--this is serious stuff!) When this is the case, you'll have to buy or make an appropriate cable with both female or both male connectors. (See Appendix C for more information on this.) RS-232 Caveats Warning: Human nature being what it is, a few unscrupulous manufacturers and suppliers are rather more extravagant in their product claims than they should be. The result is that not every cable or device labeled "RS-232C compatible" is set up to operate exactly as a RS-232C device should. Generally, if a reputable manufacturer (or someone you trust) tells you that a cable, modem, or serial port conforms to the RS-232C standard, it's a fact . . . but watch out for Brand XYZ--especially if the company's home office is a post office box. You should of course refer to your computer's manual and your modem's manual before making connections of any type. Connecting your computer to a modem may require a cable of modified gender. You may find that, due to the peculiarities of your computer's design, you will need a special cable (as is the case with the IBM PCjr, which doesn't use a DB connector with its serial port). Or, it may happen that your computer's RS-232 port is wired slightly different from the standard. Now that you've seen how a computer handles data internally, and how it transmits that data to the outside world, let's take a look at the next link in the data communications chain: modems. MODEMS By now you probably have a mental picture of 0's and 1's hanging around inside a computer in groups that represent various characters, and, on demand, zipping through circuitry and pouring out a serial port and along a cable in tight formation. (If you don't have that picture, take a break, do whatever it is you do to clear your mind, and reread the preceding portion this chapter.) With that picture in mind, let's look at where data goes after it leaves a serial port, what happens to it, and why. What Does a Modem Do With Data? As you know, data intended for modem transmission normally leaves a computer via its serial port. A cable, connected to the port via a properly-wired connector, conducts the data to the modem's serial port. The modem, in the meantime, is busy maintaining the communications link that it originally established, watching for incoming data from the communications link, and watching for data and commands from the computer to which it is connected. When data arrives at a modem's serial port, the modem has two jobs to do: 1. Translate the data from digital to analog format. 2. Transmit the data via the communications link to a remote system. Similarly, when data arrives via the communications link, the modem must perform these tasks: 1. Translate the data from analog to digital format. 2. Send the data to its computer. Depending on its capabilities and the form of transmission, the modem handles flow control and performs certain kinds of error checking. These jobs are more often handled by software, however (and you'll learn more about them in a few pages.) The primary functions of a modem, then, are data translation and transmission. Data Translation: Digital vs. Analog Signals I've indicated more than once that data must be translated from digital (or binary) signals to analog signals before it can be transmitted over a voice-grade telephone line. You're already familiar with digital signals, so let's take a closer look at analog signals and why they must be used in data communications. What is an analog signal? Strictly defined, an analog signal is a signal that varies in a continuous manner, as opposed to a digital signal, which varies in a discontinuous manner. Figure 3.7 provides a visual comparison of analog and digital signals. As the diagram illustrates, analog signals vary continuously between their minimum and maximum values, while digital signals do not vary between values. A digital signal is always at either a minimum or a maximum level or value (or in one state or the other), with no in-between. Analog signals, on the other hand, cover the entire range between maximum and minimum values. Note that the analog signal in Figure 3.7 is in the form of a sine wave, while a digital, or binary, signal (as illustrated in Figure 3.2) is in the form of a square wave. Why analog? Modems were developed because the nature of the telephone system places several limitations on how data may be transferred: * Telephone lines and their associated switching equipment are designed for voice communications, which means they accommodate a limited range of frequencies. This frequency range, called the bandwidth, does not include all frequencies used by digital data. * Various amplifiers and filtering circuits involved in telephone line transmission sometimes "cut off" the upper end of a square-wave signal. * The sometimes-poor quality of telephone lines (which you've experienced aurally during long distance and even local calls) makes tolerance for variations in signal quality necessary. A computer's digital data signals must be changed to a format compatible with these limitations. To be compatible, the signal format must use the telephone bandwidth, and must be flexible enough so that minor variations in the signal do not result in lost data. Analog signals meet all the requirements dictated by the telephone system's limitations (the telephone system was, after all, designed to carry analog signals). And, as the diagram in Figure 3.8 shows, an analog signal can be made to approximate the variations of a digital signal. Data Transmission Once a signal has been converted from digital to analog format, it is a relatively simple matter to transmit the analog version by telephone lines. The signal is placed on the telephone line carrier wave via a process called modulation. This takes place in much the same way that radio transmission takes place. Carrier wave. A carrier wave is a tone transmitted on a telephone line. The carrier is a tone of constant frequency and strength--a sine wave, as shown in Figure 3.9. Carrier waves are so named because they are periodic electromagnetic impulses (waves) that literally carry information. Modulation. Modulation is a process whereby a signal is placed on a carrier wave by varying one or more of the wave's characteristics. These characteristics include amplitude, frequency, and phase. 1. Amplitude modulation. If the strength of a carrier wave is varied to carry a signal, it might appear much as in Figure 3.10 In this example, each period of maximum high and low variation might represent a binary 1, while each period of low variation might represent a binary 0. Because of the prevalence of varying amplitude on a telephone carrier (in the form of voltage spikes and other line "noise"), straight amplitude modulation is not commonly used. 2. Frequency modulation. If the frequency of a wave is varied, it might look like the wave in Figure 3.11. Each area of high frequency (i.e., when the waves are closest together) could represent a binary 1, while low- frequency waves could represent a binary 0. A simple variation of frequency modulation, called Frequency Shift Keying, is used by low-speed (300 bps) modems. Four frequencies are used in this technique, two of which represent the binary 1 and 0 of one modem, and two which represent the binary 1 and 0 of the other. The frequencies are turned on or off as necessary to transmit the 1s and 0s of each modem. (If you listen in on a telephone line while a modem using this kind of modulation is connected, you can hear the frequencies change.) 3. Phase modulation. Phase modulation is represented in Figure 3.12. Two waves of the same frequency are transmitted, and modulation is achieved by varying the time lag between the two waves. A variation on phase modulation is commonly used in higher speed modems, because it requires the smallest bandwidth of any modulation techniques. In the example in Figure 3.12, each change in phase represents a digital 1, while periods of no change represent a digital 0. (A change in phase occurs when the variable carrier wave is started at a new time in relation to the other carrier wave.) Several combinations of and variations on these modulation techniques are used in higher speed data transmission, but we won't concern ourselves with such here. The foregoing explanations and examples of modulation techniques are intended to help you visualize what happens when data are transmitted, rather than to serve as a tutorial. Data Reception You've seen how data are translated and transmitted by a modem, but what happens when a modem receives data? As you might expect, the reverse of the modulation process takes place. When a modem receives data, it senses the modulation of the carrier wave and demodulates the signal to recover the data from the carrier wave. This involves reconstructing a true digital signal from the analog signal's approximation of a digital signal. Once the translation is achieved, the modem transfers the data to the computer, sending it through its serial port to the computer's serial port. Not incidentally, the word "modem" is a contraction of the full name of the device: "modulating/demodulating device." This name, in turn, is derived from the modem's functions of modulating and demodulating signals. Modem Standards As with serial data ports, there are recommended standards for modem operation. Rules and conventions for the design of modems have been established by several trade organizations and corporations. The standards cover the modulation and transmission techniques used by modems, as well as other elements of their operation. Virtually all BBSs, online services, and packet switching networks in the U.S. and Canada use modems that are compatible with Bell 103 (300 bps) and Bell 212 (1200 bps) standards. So, it's a good idea to use a modem that conforms to these standards, which were developed by Bell Laboratories and adopted by the telecomputing industry in the U.S. 2400 bps modems generally conform to the international CCITT V.22bis standard, described below. If your modem does not meet the appropriate standard(s), you won't be able to communicate with the vast majority of dial-up systems in the U.S.; in fact, you'll probably be unable to communicate with any system unless it uses the exact brand and model of nonstandard modem! (NOTE: The Bell standards have nothing to do with the RS-232C standard. You must, of course, make sure your modem uses an RS-232C connector at its serial port.) If you're going to use a modem in another country--especially in a European nation--it will probably have to conform to a different standard, known as the CCITT standard. This standard was developed by the Consultive Committee on International Telegraphy and Telephony, an international telecommunications standards committee. It is the standard for 1200 baud communications in western Europe and most of the world outside North America. Thus it is necessary to have a modem that operates on the CCITT standard if you wish to access systems outside North America. (The current versions of the CCITT standard in use are CCITT V.22 and V.32 for dial-up modems up to 1200 bps, V.22bis for 2400 bps dial-up modems, and V.29 for leased line modems.) 1200 bps modems that meet the CCITT standard are manufactured by several U.S. modem manufacturers, by the way, and it is becoming more and more common to find modems manufactured in the U.S. that recognize both Bell and CCITT standards. You'll even find some modems, such as the Hayes Smartmodem 2400, that are compatible with CCITT V.22 bis at 2400 bps, CCITT V.22 and Bell 212A at 1200 bps, and Bell 103 at 0 to 300 bps. (With a modem like this, you'll have no problem communicating with any system in the U.S. or Europe!) FCC Registration. It is worth noting here that any device sold in the U.S. for connection to a telephone must be registered with the Federal Communications Commission. You'll find evidence of such registration on a plate attached to the modem, and probably in the modem's manual, as well. Don't not buy a modem that isn't FCC registered. (From Chapter 3) DATA TRANSMISSION MODES Now that you have a good understanding of the basics of data transmission (you did read the companion file to this one), we'll examine the major modes such transmission can take. The binary signals that must be transmitted for each data character can be sent simultaneously (parallel transmission) or one at a time (sequentially, in serial transmission). Parallel Transmission Parallel data transmission involves sending all of the bitsthat make up a character at the same time, using a separate wire for each bit. In parallel transmission, each bit in a character is sent as shown in Figure 3.13 in THE MODEM REFERENCE. This involves eight data bits, and thus eight wires. A ninth wire is used to send a special signal called a "strobe" or clock. This signal is sent after all 8 data bits are sent, to inform the receiving device that all bits have been sent. Data transmitted in this manner is not modified before or after transmission. Parallel transmission is commonly used to send data from a computer to a printer or another device located relatively nearby. Longer runs for parallel transmission are not very cost-effective, because of the number of wires involved as well as the more complex transmission equipment required. Serial Transmission When data is transmitted in serial format, each character's bits are sent individually, over a single wire. Some modification is required to prepare data for serial transmission, because the data a computer sends to its serial port is in parallel format. The serial port must convert this parallel data to serial format (using what are called shift registers). Among other things, this involves "lining up" the data bits in series, beginning with the lowest-value bit. At the receiving end, the serial port has to sort out the bits and return them to parallel format. Figure 3.14 illustrates how serial data transmission works. When compared with parallel transmission, serial data transmission would appear to be at a disadvantage. It requires special circuitry and other accommodations, and is somewhat slower than parallel transmission. Too, serial data must be synchronized, which sometimes means adding bits to each character. However, using one wire to send data is far less costly than using eight. Furthermore, the standard voice telephone system (noted earlier as the medium used for most telecomputing) can't accommodate parallel data transmission because it provides only two wires. So, serial transmission is the norm for telecomputing when two-wire (or four-wire), voice-grade telephone lines are involved. Synchronization. The sending and receiving systems must be synchronized during serial transmission, so that individual bits and full characters can be recognized and sorted out by the receiving system in the same pattern as they were sent. Without synchronization, the receiving system would perceive data as a seemingly-endless series of unrelated binary digits, with no indication of where one character ended and the next began. There are several modes of synchronization available. You'll probably encounter only two of them--synchronous and asynchronous. In data communication via microcomputer, these are virtually the only synchronizing modes in use. Synchronous transmission. Synchronous data transmission involves a continuous and consistent (in time) transfer of data. The duration of and time between each bit or character sent is preset by the sending and receiving systems. This provides a way for the receiving system to know when to look for each character as well as how long it will take to transmit a character. Modems that can be synchronized in this manner are called synchronous modems. Depending on the protocol used, time synchronization is usually effected by a special information signal that precedes a data transfer or by information contained in a group of bytes (called a block). This signal enables the systems to synchronize their internal clocks, and may come from the computer or the modem. For reasons discussed in the next section, synchronous transmission can be up to 20% faster than asynchronous transmission. But it requires more expensive equipment. (The expense is largely due to the additional circuits and programming required to synchronize timing.) Asynchronous transmission. Asynchronous transmission is a data transfer mode that notifies a receiving system when each character begins and ends by "framing" bytes with additional bits. These extra bits include a start bit and a stop bit, which are discussed in detail in the next section (DATA TRANSMISSION PARAMETERS). Modems that operate in asynchronous mode are called asynchronous modems, or asynchronous communications adaptors. As noted a few lines back, asynchronus transmission is a bit slower than synchronous transmission. (One reason for this is the presence of start- and stop-bits.) The advantages of asynchronous transmission far outweigh the loss in speed, however. Because no timing circuits are required, asynchronous modems are less expensive than their synchronous counterparts. Too, they are generally more "tolerant" of line noise, delays in sending, and so forth. So, you'll find the majority of modems used with microcomputers to be asynchronous; because of this the majority of dial-up systems (BBSs and online services) also operate in asynchronous mode. There are modems that operate in both synchronous and asynchronous mode. However, unless you are communicating with mainframe computers, Local Area Networks (LANs), or other systems that use synchronous data transfer, your telecomputing needs will probably dictate an asynchronous modem. Digital Data Transmission When a data communications system is not restricted by the frequency bandwidths and other limitations of a voice-grade telephone system, digital transmission can be used. In digital data transmission, data does not have to be translated to analog format. Instead, it is sent as binary signals, just as it would be during a direct data transfer between two computers using a null-modem cable. This kind of transmission accommodates extremely high baud and bps rates, but there are tradeoffs. Digital transmission requires special interfaces or modems, and is generally used only with digital dial-up networks. Such networks use special conditioned lines and switching equipment to maintain the integrity of the digital signals they carry, and are extremely expensive to build and maintain. DATA TRANSMISSION PARAMETERS In a very general sense, this book is not unlike a data communications link. I am communicating certain information and ideas to you; this book is the vehicle for that communication, just as the a data link is the vehicle computer-to-computer communication. You can understand the information and ideas herein because I write in a language you understand, and conform to certain rules of grammar and syntax. (Whether that information is useful to you or not is irrelevant to the topic; as I said early in the chapter, we are more concerned here with the form of information than with its content.) In short, we agree as to the parameters of our communication; thus we communicate. Computers must likewise agree on communications parameters. There are several important data communications parameters that define the operation and characteristics of a data communications system. They include the following: * the number of bits transmitted for each character * how (or if) data is checked for errors * when each character transmission begins and ends * whether your system or the remote system displays what you type on your screen * the speed at which transmission takes place The parameters are data bits, parity, start- and stop-bits, duplex, and speed. As you probably know, computers are quite literal devices, and, unlike humans, do not tolerate deviations from rules. So, each of the parameter settings must be set to the same value on both systems. Parameter settings are altered via commands to your modem or communications software, and it is normally up to you to match a host system's communications parameters. Now, let's take a look at each of the parameters. Data Bits The phrase "data bits" refers to the number of bits (binary digits) sent for each data character transmitted, not counting parity, start, or stop bits--which are explained in a few paragraphs. This parameter is sometimes called "data word length" or "character length." Depending upon what's being transmitted, either seven or eight bits are used. The number of data bits used is set by a software command; the computer's serial port does the actual configuring of data before it is transmitted. Each of the first 128 characters in the ASCII character set can be represented by seven-digits binary numbers (that is, the binary counterparts of the numbers 0 through 127 are each composed of seven or fewer digits). The majority of data communication uses only the first 128 ASCII characters, because all systems have these characters in common. So, much data transmission takes place using the 7-bit ASCII characters 0 through 127. Seven bits are used whether or not the character actually uses seven places/digits (i.e., leads off with a "1" in the seventh place, as is the case with 1100010--a decimal 98, which is the ASCII number for a lower case "b"). When necessary, 0's are added to fill out the binary number to a full seven digits--as with 111111 (a decimal 63, the question mark character on the ASCII table.) This binary number is sent with a leading zero, thus: 0111111. If special characters from an extended ASCII character set are used (ASCII numbers 128 through 255), eight data bits must be used. This is because each of the binary numbers 128 through 255 are composed of eight binary digits, each leading off with a 1. 8-bit transmission must be used with special binary file transfer protocol transfers, too, as you'll learn when we discuss these protocols. Parity Parity is an extremely simple (and not quite perfect) way for a receiving computer to determine whether a data character has been properly received. (This error checking, by the way, is quite apart from special error-checking file transfer protocols, which we'll get to later in the book.) There are two types of parity checking: Even/Odd and Mark/Space. Almost all communications software packages allow you to change the parity setting (the choices available depend upon the type of parity checking in use). More systems use Even/Odd parity than Mark/Space parity. Even/Odd parity. Even/Odd parity works by checking whether the sum of the 1s in a string of bits is even or odd. The settings available with most communications programs are "Even," "Odd," or "None." (When "none" is selected, parity checking is effectively "turned off.") When Even/Odd parity checking is used, the sending computer adds up the 1's in each binary number it sends, and determines whether their sum is odd or even. It then adds an extra bit, known as the parity bit, to the character at its serial port. (As with other data bits, the parity bit can be either 0 or 1.) The purpose of the parity bit is to make the sum of the 1s in the character even or odd, as called for by the current parity setting. For example, if the letter "A" (1000001) is sent under even parity, a 0 is added as the parity bit--making it 10000010. This is because the sum of the 1s in the binary number is already even. If the same data character is sent under odd parity, a 1 is added as the parity bit, so that the sum of the 1s in the character would be odd. (Thus, the character would be transmitted as 10000011.) The receiving computer checks the sum of the 1s--counting the parity bit as well as the bits making up the character. If the total doesn't agree with the parity setting (even or odd), it signals the transmitting computer to resend the character (provided its software supports this). The extra parity bit is "stripped" and ignored when it is sent to the software from the serial port for "end use." Most systems that use 7-bit communication use even parity, while systems that use 8-bit communication use no parity. (Parity-bit checking is theoretically possible with 8-bit communication, but not practical.) Although it is generally effective, parity checking has its shortcomings. It can detect a "dropped" or garbled bit only if the bit is a 1. And if more than one 1 is dropped, the parity check may sometimes pass the defective character anyway, because the sum of the 1s still agrees with the parity setting (as when two 1s are dropped when the parity is set to "even"). A parity bit is transmitted at the end of a seven-bit character as shown in Figure 3.15. (NOTE: As I noted during the discussion of binary signals earlier in this chapter, a character's data bits are transmitted in reverse order. This is so both the sending and receiving serial ports can calculate the number of 1s in each character as the character is sent.) Mark/Space parity. Mark/Space is even simpler than Even/Odd parity checking. When Mark/Space parity is used, the sending system puts either 1 or 0 in the parity bit's "slot." The receiving system looks for the parity bit to be a 1 or a 0, as appropriate with active setting. When set to "Mark," the parity bit must be 1; when set to "Space," the parity bit must be 0. As with Even/Odd parity, parity is checked, and parity bits added and stripped, at the systems' serial ports. Start- and Stop-Bits When data are transmitted in asynchronous mode (as will be the case in any telecomputing applications you are likely to encounter), there may be varying time lapses between the transmission of characters. Thus, the receiving modem cannot rely on a set time frame between the end of one character and the beginning of another to know when to look for the new character. This problem is solved by the use of special bits--called start bits and stop bits--added to the beginning and end of a data character. Start bits. A start bit marks the beginning of a new string of bits (i.e., a new character). A start bit is always a 0. This is because the normal "state" of a modem when it is not sending data is the equivalent of a digital 1, or negative voltage. When a 0, or positive voltage comes through after a period of no transmission, the receiving system knows that a new character transmission has started. Stop bits. To let the receiving modem know when the transmission of a string of bits is complete, the sending computer adds a stop bit to the end of a character (following the parity bit, if any). The stop bit provides a timing "bench mark" whereby the receiving modem knows when a complete character has been sent. This bench mark involves the baud rate, which is tied to the time it takes for the sending system to send each bit (i.e., make a change in state from high to low, or 0 to 1). The timing of a stop bit is entirely dependent upon the baud rate. Most systems use either one or two stop bits; one stop bit is by far the most common. Figure 3.16 shows the placement of the start and stop bits in a transmitted data character. Duplex Duplex is one of those unfortunate terms that has two meanings. It has one meaning as a parameter setting, and another as a transmission mode. Worse, there are several other terms used in place of duplex when it is used as a parameter. (Don't worry--I'll untangle this mess for you. Of course, if you've been computing for a while, this sort of dichotomy is not new to you, I'm sure.) As a parameter or a mode, duplex has two settings: full-duplex and half-duplex. Duplex parameter. As a parameter setting, duplex is used to determine whether the computer you've dialed up echoes the characters you type at your computer's keyboard back to your computer for display. When you set your software to full-duplex, it expects the remote system to echo characters back to you. When you set your software to half-duplex, it echoes the characters you type. Naturally, the remote system's duplex setting should agree with your system's. Looking at it another way, a system set to full-duplex is responsible for echoing characters back to its counterpart, but not to its own screen. A system set to half-duplex echoes no characters back to the remote system, but echoes characters to its own screen. Obviously, when the remote system is set to full-duplex, your system should be set to full-duplex. Otherwise, both your computer and the remote system will be echoing characters to you, and you'll see double characters, lliikkee tthhiiss.. Conversely, if the remote system is set to half-duplex, and your system is set to full-duplex, no characters are echoed to your screen and you will not see what you type. So, duplex modes must match. In this context, duplex is more properly referred to as echo, or echoplex, with local echo/remote echo or echo/noecho as the available settings. (A very few software packages call duplex mode, with the half and full as the available settings.) Most BBSs and dial-up systems operate in full-duplex, which means that you should set your system to full duplex (or to remote echo or noecho) as well. Many systems that operate in half-duplex (such as GEnie) can be changed to communicate with your computer in full-duplex by a simple online command. Duplex mode. As a transmission mode, duplex determines whether or not data is transmitted in two directions at once. In full duplex mode, data flows in both directions at once (two different carrier signals are used). In half duplex mode, data flows in only one direction at a time. When half duplex mode is in effect, each system must signal the other when it has finished transmitting data and is ready for a reply. All of this back-and-forth happens at the speed of light, so of course you'll notice no perceptible delay at turnaround. Duplex mode is dependent upon modem capability. Some modems operate at either half or full duplex, while others operate at only half duplex or only full duplex. The majority of modem data communication--especially communication involving BBSs and online services--takes place in half duplex transmission mode (data is transmitted in one direction at a time), due to the limitations imposed by telephone line bandwidth. Leased line modems, on the other hand, typically communicate at full duplex (data transmitted in both directions at once). (A reminder: When you set duplex with the majority of software packages, you aren't changing the transmission mode, but the echo mode. For the dialup applications discussed in this book, you will be dealing exclusively with the echo mode.) Speed There is a lot of confusion about modem transmission speed. I strongly suspect this is a result of the fact that it's easier to say "baud" than "bits per second," though misinformation has a hand in it, too. If you've ever found yourself confused by the relationship of bits and bauds, or if you think that a modem's baud rate is the same as bits or characters per second, please read this section carefully; I guarantee to clear up the confusion and disabuse you of any false concepts ... Bits per second (bps). Bits per second is a measure of the number of bits transmitted each second in a communications channel. This is sometimes referred to as "bit rate." While a modem's bit rate is tied to its baud rate, the two are not the same, as explained below. Baud rate. Baud rate is a measure of the number of times per second a signal in a communications channel varies, or makes a transition between states (states being frequencies, voltage levels, or phase angles). One baud is one such change; thus, a 300 baud modem's signal changes state 300 times each second. Determining bits per second. Depending on the number of states used in a communications system, one change of state can transmit one bit--or more or less than one bit. The number of bits a modem transmits per second is directly related to the number of bauds that occur each second, but the numbers are not necessarily the same. To illustrate this, first consider a modem with a baud rate of 300, using a transmission technique in which one change in state (baud) transmits one bit. The bps rate is also 300: 300 bauds per second X 1 bit per baud = 300 bps This describes exactly the process used by FSK--the modulation technique used with 300 baud modems that conform to the Bell 103 standard. Only one change in state--from ON to OFF--is required to send a bit when FSK is used. Similarly, if a modem operating at 1200 baud were to use one change in state to send each bit, that modem's bps rate would be 1200. (There are no 1200 baud modems, by the way; remember that. This is only a demonstrative and hypothetical example.) Now, consider a 1200 baud modem using a modulation technique that requires two changes in state to send one bit, which can also be viewed as 1/2 bit per baud. This modem's bps rate is only 600: 1200 bauds per second X 1/2 baud per bit = 600 bps To look at it another way, bits per second can also be obtained by dividing the modem's baud rate by the number of changes in state, or bauds, required to send one bit: 1200 baud --------------- = 600 bps 2 bauds per bit Lest I mislead you into thinking that "any 1200 baud modem" should be able to operate at 2400 bps with a two-bits-per-baud modulation technique, remember that I said there are no 1200 baud modems. Medium- and high-speed modems use baud rates that are lower than their bps rates. Along with this, however, they use multiple-state modulation to send more than one bit per baud. For example, 1200 bps modems that conform to the Bell 212A standard (which includes most 1200 bps modems used in the U.S.) use a phase modulation technique that transmits four bits per baud. Such modems are capable of 1200 bps operation, but not 2400 bps because they are not 1200 baud modems; they use a baud rate of 300. So: 300 baud X 4 bits per baud = 1200 bps or 300 baud ------------------ = 1200 bps 1/4 baud per bit Similarly, 2400 bps modems that conform to the CCITT V.22 recommendation (virtually all of them) actually use a baud rate of 600 when they operate at 2400 bps. However, they also use a modulation technique that transmits four bits per baud: 600 baud X 4 bits per baud = 2400 bps or 600 baud ------------------ = 2400 bps 1/4 baud per bit Thus, a 1200 bps modem is not a 1200 baud modem, nor is a 2400 bps modem a 2400 baud modem. To continue this demonstration, 9600 bps modems operate at 2400 baud, but use a modulation technique that yields four bits per baud: 2400 baud X 4 bits per baud = 9600 bps or 2400 baud ------------------ = 9600 bps 1/4 baud per bit If nothing else, I hope the examples here have shown you just why baud rate is not always equivalent to bps rate. (And if anyone who tries to sell a modem to you tells you otherwise, you'll do well to take your business elsewhere.) When you're considering a particular modem for purchase, look for its bps rate, rather than its baud rate. Characters per second (cps). Characters per second is the number of characters (letters, numbers, spaces, and symbols) transmitted over a communications channel in one second. Cps is the bottom line in rating data transmission speed, and a more convenient way of thinking about data transfer than bauds or bits. Determining the number of characters transmitted per second is easy: simply divide the bps rate by the number of bits per character. You must of course take into account the fact that more than just the bits that make up the binary digit representing a character are transmitted when a character is sent from one system to another. As illustrated a few pages back in Figure 3.16, up to 10 bits may be transmitted for each character, whether 7 or 8 data bits are used. In asynchronous data communication, the number of bits per character is usually 10 (either 7 data bits, plus a parity bit, plus a start bit and a stop bit, or 8 data bits plus a start bit and a stop bit). Thus: 300 bps ----------------------- = 30 characters per second 10 bits per character 1200 bps ----------------------- = 120 characters per second 10 bits per character 2400 bps ----------------------- = 240 characters per second 10 bits per character Common speeds. The most commonly-used communications rates for dial-up systems (and hence the most commonly available modem speeds) are 300, 1200, and 2400 bps. A few older systems--especially Telex systems--communicate at 110 bps, but these are gradually going the way of the dinosaur. 4800 and 9600 bps modems are generally available, but few online services or BBSs accommodate them. This will change in the near future, however, with the cost of high-speed modem technology decreasing as the demand for it increases. Modems with even higher bps rates are manufactured (19,200 and up) but it is doubtful that you will be accessing dial-up systems capable of more than 9600 bps (if that). The upper limit on asynchronous data transmission via voice-grade telephone lines appears to be 9600 bps. The use of higher transmission rates requires special dedicated lines that are "conditioned" (i.e., shielded from outside interference) as well as expensive modulation and transmission equipment. Those are the basics of what goes on behind the scenes in data communications. If you've read all of this chapter (and I hope you have), my congratulations; you're now more knowledgeable in the ins and outs of data communications than the average modem user (and most computer salespeople, for that matter). The knowledge you've gained here will enable you to make optimum use of your modem and communications software. Combined with the information in the next chapter, it will also help you make an informed decision when you buy a modem. If you found this excerpt useful, you may want to pick up a copy of the book from which it was excerpted: THE MODEM REFERENCE by Michael A. Banks Published by Brady Books/Simon & Schuster ISBN 0-13-586646-4 $19.95 In addition to explaining the technical aspects of modem operation, communications software, data links, and other elements of computer communications, the book provides detailed, illustrated "tours" of major online services such as UNISON, CompuServe, DELPHI, BIX, Dow Jones News/Retrieval, MCI Mail, and others. It contains information on using packet switching networks and BBSs, as well as dial-up numbers for various networks and BBSs, and the illustrations alluded to in this excerpt. You'll also find hands-on guides to buying, setting up, using, and troubleshooting computer communications hardware and software. (And the book "supports" all major microcomputer brands.) For more information, contact: Michael A. Banks P.O. Box 312 Milford, OH 45150