关于UART接口,高手请进
TX(M)——〉RX(D)
RX(M)〈—— TX(D)
RTS(M)——〉CTS(D)?
CTS(M)〈——RTS(D)?
主RTS是接到从的CTS吗?它们的方向应该如上所示么?
http://www.e-midas.cn/Article_Show.asp?ArticleID=213
RS-232 Cable Information
An RS-232 cable consists of wires, or lines, that join two connectors. The connectors plug into the serial ports of each device to form a communications link over which data and control signals flow. Each serial port consists of numbered pins that have the meanings shown in the following table:
Table 1. PC Cable Configuration
PinMeaning
2TxD—Transmit Data *
3RxD—Receive Data
4RTS—Request to Send *
5CTS—Clear to Send
6DSR—Data Set Ready
20DTR—Data Terminal Ready *
7Common
The items with an asterisk (*) indicate the lines that the PC drives. All other items indicate the lines that the PC monitors.
All serial devices are either Data Communication Equipment (DCE) type devices or Data Transmission Equipment (DTE) type devices. IBM-compatible PCs are DTE type devices. The difference between the two types is in the meaning assigned to the pins. A DCE device reverses the meaning of pins 2 and 3, 4 and 5, and 6 and 20. In the simplest scenario, a DTE device attaches to a DCE device, such as a modem. The following table shows the cable required to connect a PC (or DTE) to a DCE device.
Table 2. DTE to DCE Cable Configuration
(PC)Connect pins
as indicated:(Device)
TxD*2____________2RxD
RxD3____________3TxD*
RTS*4____________4CTS
CTS5____________5RTS*
DSR6____________6DTR
DTR*20___________20DSR*
common7____________7common
You need a different cable for the PC to talk to a DTE device because both devices transmit data over pin 2. A null modem cable connects a PC to a DTE. The following table shows the configuration of a null modem cable.
Table 3. PC to DTE Cable Configuration
(PC)Connect pins
as indicated:(Device)
TxD*2_____________3RxD
RxD3_____________2TxD*
RTS*4_____________5CTS
CTS5_____________4RTS*
DSR6____________20DTR
DTR*20____________6DSR*
common7_____________7common
For more information about the meaning of DTE and DCE, refer to a reference book on RS-232 communication.
In the simplest case, a serial cable needs lines 2, 3, and 7 for basic communication to take place. Hardware handshaking and modem control can require other lines, depending on the application. Refer to the Hardware Handshaking section for more information about using lines 4, 5, 6, and 20.
You also must consider the gender of the connectors of your serial cable. The serial cable plugs into sockets in the PC and the serial device, just as a lamp cord plugs into a wall socket. Both the connector and the socket can be male, with pins (like a lamp plug), or female, with holes (like an outlet). If your serial cable connector and PC socket are the same gender, you cannot plug the cable into the socket. You can resolve this issue by attaching a small device called a gender changer to your cable. One type of gender changer converts a female connector to a male connector, and the other type converts a male connector to a female connector.
The size of the connector on your serial cable also can differ from the size of the socket. Most serial ports require a 25-pin connector. However, some serial ports require a 9-pin connector. To resolve this incompatibility, you must either change the connector on your serial cable or attach a small device that converts a 25-pin connector to a 9-pin connector.