Опубликован: 06.08.2012 | Доступ: свободный | Студентов: 1340 / 49 | Оценка: 5.00 / 5.00 | Длительность: 53:41:00
Лекция 19:

Serial communications

< Лекция 18 || Лекция 19: 1234 || Лекция 20 >

Connecting to the port

Theoretically, serial line can consist of only three wires: a Receive Data line, often abbreviated to RxD, a Transmit Data line (TxD), and a Signal Ground line (SG). In fact, it is possible to get a link to work like this, but there are a number of problems:

  • How do we know when the other end is able to accept data? It may be busy processing data it has already received.
  • How do we know when it's even switched on?
  • In the case of a modem, how do we know when it is connected to the modem at the other end?

We solve these questions, and more, by the use of additional lines. The most common standard is RS-232, so known as EIA-232, a standard for DCE to DTE connection. In Europe, it is sometimes confused with the CCITT V 24 standard, though V24 does not in fact correspond exactly to RS-232. Most external modems display some of these signals on LED, but modem manufacturers love to create alternative abbreviations for signal names. Here are the signals that RS-232 defines, with some of the more common abbreviations that you may see on external modems.

Таблица 19.1. RS-232 signals and modem LEDs
RS-232 name Pin Modem LED Purpose
PG 1 Protective ground. Used for electrical grounding only.
TxD 2 TD D1 Transmitted data: data coming from the DTE to the modem.
RxD 3 RD D2 Received data: data coming from the modem to the DTE.
RTS 4 Request to send. Indicates that the device has data to output.
CTS 5 Clear to send. Indicates that the device can receive input.
DSR 6 MR PW ON Data set ready. Indicates that the modem is powered on and has passed self-test. On some modems, PW indicates that power is on, and MR indicates that it is operative.
SG 7 Signal ground. Return for the other signals.
DCD 8 CD M5 Carrier detect. Indicates that the modem has connection with another modem.
DTR 20 DTR S1 Data terminal ready. Indicates that the terminal or computer is ready to talk to the modem.
RI 22 AA Ring indicator. Raised by a modem to indicate that an incoming call is ringing. The AA indicator on a modem will usually flash when the incoming call is ringing.
AA "Auto Answer. "Indicates that the modem will answer an incoming call.
HS "High Speed. " Indicates that the modem is running at a higher speed than its minimum. Individual modems interpret this differently, but you can assume that something is wrong if your modem has this indicator and it’s off during transmission.
MNP Indicates that error correction is active.
OH "Off hook". Indicates that the modem has some connection with the phone line.
PW Indicates that modem power is on. May or may not imply DSR.

The line DCD tells the DTE that the modem has established a connection. We’ll look at how to use this information on page 335.

In addition to these signals, synchronous modems supply clocks on pins 17 and 19. For more details about RS-232, see RS-232 Made easy by Martin Seyer.

When can I send data?

There are two ways to determine if the other end is prepared to accept data: hardware handshaking and software handshaking. Both are also referred to as flow control. In each case, the handshaking is symmetrical. We’ll look at it from the point of view of the DTE, because this is the more common viewpoint.

In hardware handshaking, the DCE raises CTS (Clear to Send) when it's ready to accept input. The DTE only transmits data when CTS is asserted from the other end. You'll often see that the DTE asserts RTS (Request to send) when it wants to send data. This is a throwback to the days of half-duplex modems, which could only transmit in one direction at a time: RTS was needed to switch the modem into send mode.

Software handshaking is also called X-on/X-off The DCE sends a character (X-off, which corresponds to Ctrl-S) when the buffer is full, and another (X-on, corresponding to Ctrl-Q) when there is space in the buffer again. You can also use this method on a terminal to temporarily stop the display of a lot of data, and then restart it. It's no longer a good choice for modems.

For hardware handshake to work, your modem must be configured correctly, and you must have the correct cables. If it isn't, the symptoms will be very slow response when transferring large quantities of data: at a higher level, TCP can recover from these overruns, but it takes at least a second to do so every time. We’ll see hatcheck that your modem has the correct kind of fow control on page 333.

Modems

A modem is a device that transfers digital data into a form suitable for transmission over a transmission line, which is usually a telephone line. Telephone lines are limited to a frequency of about 3.6 kHz, and this limited the speed of older modems to about 1200 bits per second. Modern modems use many sophisticated techniques to increase the speed way beyond this. Current modems transmit at 56 kilobits per second.

Let’s consider the modem connection in the reference network on page 294, which is repeated in figure 19-2 . As we can see, there are three connections:

  • The connection from the router gw to the local modem, connected at 57,600 bits per second.
  • The connection between the modems, at 56,000 bits per second.
  • The connection from the ISP's modem to his router, at 115,200 bits per second.

You'll also note another value specified here: the connection between the modems is 2,400 baud. Isn’t a baud the same thing as a bit per second? No, not always. The term baud is a representation of the frequency of data on a serial line. On the connections between the systems and the modem, which handle raw digital data, it corresponds to the bit rate. On the modem line, it doesn't. Here, it indicates that 2,400 units of data are sent per second.

Unfortunately, many people use the term baud where bit rate should be used. This didn't make any difference in the old days with simple modems where the bit rate and baud rate were the same, but nowadays it’s confusing

Network modem connection

Рис. 19.2. Network modem connection

Modem speeds

Two factors determine the data transmission speed of a modem: the protocol and the use of data compression. Table 19-2 on page 332 gives an overview of modem protocols and their speeds.

Currently, the most popular modem protocol is V90. V 90 pushes modem technology to the limit, and it only works when the other end of the link is a digital (ISDN) connection. You can't get a 56 kb/s connection with any kind of analogue modem at the other end. As a result, they're really only suitable for connection to a large ISP site. In addition, the actual speed of the connection depends greatly on the telephone line quality, so the difference between a V 90 and a V 34bis modem may not be as much as it appears.

< Лекция 18 || Лекция 19: 1234 || Лекция 20 >