User:Jeh/wip/RS232 signals

From Wikipedia, the free encyclopedia

Data Terminal Ready[edit]

Data Terminal Ready, or DTR, is originated by data terminal equipment (DTE) such as a computer and interpreted by data communications equipment (DCE), for example a modem. When asserted, it indicates that the terminal is ready for communications and that the modem may initiate a communications channel. Deasserting DTR indicates to the modem that the communications session should be terminated.

A computer will typically assert the DTR signal (if it isn't already asserted) before sending commands such as "dial" commands. When a modem is being used for automatic answering, the DTR signal confirms to the modem that the computer is available to accept a call.[1]

On many operating systems, including Windows, a serial port's DTR signal is deasserted while the serial port is not being controlled by an application.

off-spec usages

As with many aspects of RS-232, the usage and interpretation of DTR varies with the implementation in the operating system, the program or programs that use the modem, and the modem's firmware. For example, if the DTR signal is not asserted and the modem receives a "dial" command, some modems will refuse to place the call, while others will silently disable DTR support for the duration of that call. On most newer modems the modem's responses to changes in DTR can be manually overridden or configured.[2][3] and higher values are used by some vendors.[4]

Many external modems have LED indicators, one of which is labeled "TR" ("terminal ready") or similar. This follows the state of the DTR pin, illuminated when DTR is high, and off when it is low.

Null modem operation[edit]

When a serial connection is made between two computers using a null modem adapter, the DTR and the Data Set Ready (DSR) lines are typically paired. This allows each end of the connection to sense when the other end is powered up and ready to communicate.

Use for flow control[edit]

On some printers with serial interfaces, the DTR line is used for hardware flow control, similar to the use of RTS and CTS for modems. This practice is not consistent; other printers define RTS for this same purpose. The printer cable must connect the DTR or RTS pin to the computer's CTS pin in order to achieve the desired flow control.

Use as a power source[edit]

On some hardware the DTR line (along with RTS) may be used to provide power. The most notable example of this is a serial mouse. The DE-9 serial port on the PC does not provide any dedicated power source. The mouse driver holds the DTR and RTS lines high at all times so that the device has a source of power.

Another category of devices commonly powered by the DTR line includes converters between RS-232 and other serial standards such as RS-422 and RS-485.

Data Carrier Detect[edit]

Data Carrier Detect is sent "from DCE to DTE", or in a typical scenario, from the peripheral to the computer. Its purpose varies depending on the device connected, but the most typical meaning is to indicate when a modem is connected to another remote modem via telephone lines. (The word "carrier" is a reference to the analog carrier signal generated by a modem, which is modulated to carry the data. On a data modem, loss of the carrier usually equates to termination of the connection.)

Changes to the DCD signal state can generate a hardware interrupt that can notify the processor of the change, preventing the CPU from needing to constantly poll the pin.

As used on modems[edit]

DCD is very important on modems, as it is the computer's primary way to find out that the modem has established or lost its connection to the remote host. It is possible to use a modem without the DCD signal, however the only way for the computer to know that a connection is disconnected is by the modem transmitting the words "NO CARRIER" over the data lines. Because the words "NO CARRIER" are also a message that could appear in the context of a normal data session (for example, if typed by a person on the remote end, or when browsing a reference manual on a modem), there is no completely unambiguous way for a computer program to differentiate the words being sent over the connection versus from the modem.

External modems with LED status lights usually have a light labeled "CD" (carrier detect). This indicates the state of the modem's DCD signal: On if the modem is asserting DCD, off otherwise.

The signal is asserted at the same time the modem reports its CONNECT message, and stays asserted until the call is disconnected (either intentionally or because of a fault in the line). DCD is deasserted once the local modem is no longer receiving carrier from the remote modem, regardless of which side initiated the disconnect. So long as the DCD signal is high, the computer can assume that any data coming from the modem was sent from the remote side.

Virtually all newer modems allowing the behavior of the DCD signal to be configured. Typical options available include "always assert DCD", "assert DCD only when connected" (the usual default), and "always assert DCD except immediately after sensing a disconnect".

As used with null modems[edit]

A frequent use of a serial port is for a direct computer-to-computer connection. This requires an adapter called a null modem, which isn't actually a modem in the traditional sense, but rather a pair of connectors that simply crosses the complementary pins on two serial ports so the two sides can communicate. A null modem typically connects the DTR output of each computer to the DCD and DSR inputs of the other. When used in this scenario, DCD is used to simply detect the presence and/or readiness of the other side to start a session.

For example, on PCs running Windows, the DTR output is kept low until some program is run to access the serial port and raise the DTR signal high. The remote side will sense this as the DCD input going high. Some equipment will recognize the transition alone as the beginning of a session. Other equipment (such as the console port of a router) may expect characters to be transmitted,[clarification needed] but the DCD signal high is still a prerequisite for every communication.[clarification needed]

PPS (Pulse per second) timing use[edit]

The serial DCD pin can be used to accurately detect a PPS signal, as described in RFC 2783:[5]

References[edit]

  1. ^ "6.2.9 Circuit 108 (data terminal ready) behaviour", V.250: Serial asynchronous automatic dialling and control (05/99, 07/03) (PDF), ITU-T/Telecommunication Standardization Bureau
  2. ^ "8. Controlling EIA-232 Signaling", Courier V-Everything Command Reference, U.S. Robotics, retrieved 2009-11-23
  3. ^ "A.4 AT&D3 Implementation Issues", PnP for COM Devices, rev 0.92 (RTF), Microsoft and Hayes, February 28, 1995
  4. ^ Nick Robins (2003), Alpha Micro GPRS Modem Functional Overview 1.0 (PDF), Alpha Micro Components, retrieved 2009-11-23
  5. ^ Mogul, J.; Mills, D.; Brittenson, J.; Stone, J.; Windl, U. (2000). "Introduction". Pulse-Per-Second API for UNIX-like Operating Systems. IETF. p. 3. doi:10.17487/RFC2783. RFC 2783. One convenient means to provide a PPS signal to a computer system is to connect that signal to a modem-control pin on a serial-line interface to the computer. The Data Carrier Detect (DCD) pin is frequently used for this purpose. Typically, the time-code output of the time source is transmitted to the computer over the same serial line. The computer detects a signal transition on the DCD pin, usually by receiving an interrupt, and records a timestamp as soon as possible. {{citation}}: Unknown parameter |month= ignored (help)