9-pin serial port

Source: Internet
Author: User
Currently, the commonly used serial ports include 9-pin serial ports (DB9) and 25-pin serial ports (db25). When the communication distance is close (<12 m ), you can use a cable to directly connect to the standard RS232 port (rs422, RS485 far). If the distance is far, a modem must be attached ). The simplest and most common method is the three-line method, that is, connecting the ground, receiving data, and sending data. The receiving pin and sending pin of the same serial port are directly connected by a line. The 9-pin serial port and the 25-pin serial port are both 2 and 3; two different serial ports (whether the two serial ports of the same computer or the serial ports of different computers) receive data pins (or wires) and send data pins (or wires) are connected and cross each other, the signal can be connected to each other in a hundred battles.

The connector can be divided into the public header and the mother header: The public header generic pointer connector; the mother header generic finger socket connector. There are unified rules on the pins of all connectors, and the serial numbers are printed on the connectors. Check the serial numbers when connecting the connectors. The pins that are not mentioned during wiring are left blank.
Serial Port pins

Overview of 25-pin serial port functions
Pin Function
2. Send data (txd)
3. receive data (rxd)
4. Send a request (RTS)
5 send clear (CTS)
6. Data preparation (DSR)
7 signal location (Gnd)
8. Carrier Detection (DCD)
20 data terminal preparation (DTR)
22. zhenling indication (RI)

Nine-pin serial port function list
Pin Function
1. Carrier Detection (DCD)
2 receive data (rxd)
3. Send data (txd)
4. Data Terminal preparation (DTR)
5. Signal Location (Gnd)
6. Data preparation (DSR)
7. Send a request (RTS)
8 send clear (CTS)
9. zhenling indication (RI)

I need to create a line with both ends with a public header to connect to GPRS and the Development Board. The connection method is:

1---3. That is, two or three calls, and other direct connections.

The relationship between colors and pins (do not know whether this relationship is universal ):

1 black, 2 Brown, 3 red, 4 orange, 5 yellow, 6 Green, 7 blue, 8 purple, 9 white.

Serial Communication Flow Control
In the process of serial communication, we often see the two options, namely, RTS/CTS and Xon/xoff, which are two traffic control options. Currently, flow control is mainly used in modem data communication, however, it is advantageous to know more about General RS232 programming. So what is the role of Stream Control in serial communication? Program How to apply it?
1. Role of Stream Control in Serial Communication
The "stream" mentioned here, of course, refers to data streams. When data is transmitted between two serial ports, data loss often occurs, or the processing speed of the two computers is different, such as the communication between the desktop and the single chip microcomputer, the data buffer at the receiving end is full, in this case, the sent data will be lost. Now we can transmit data through modem on the network, which is particularly prominent. Stream Control can solve this problem. When the receiving end cannot process data, it sends a "no longer received" signal, and the sending end stops sending until it receives the "can continue sending" signal and then sends data. Therefore, flow control can control the data transmission process to prevent data loss. Two common traffic control methods in PC are hardware traffic control (including RTS/CTS, DTR/CTS, etc.) and software traffic control Xon/xoff (continue/Stop.
2. Hardware Traffic Control
Hardware traffic control is commonly used, including RTS/CTS traffic control and DTR/DSR (Data Terminal ready/data set ready) Traffic Control. The hardware traffic control must be connected to the corresponding cable. When you use the RTS/CTS (request sending/clearing sending) traffic control, the RTS and CTS lines at both ends of the communication should be connected accordingly, data Terminal devices (such as computers) Use RTS to start data streams from a modem or other data communication devices, while data communication devices (such as a modem) use CTS to start and pause data streams from the computer. The hardware handshaking process is: we set a high flag (75% of the buffer size) and a low flag (25% of the buffer size) based on the buffer size at the receiver end during programming ), when the data volume in the buffer reaches a high level, we set the CTS line to a low level (send logic 0) at the receiving end. When the sending end detects that the CTS is low, it stops sending data, until the data volume in the acceptor buffer is lower than the low level, CTS is set to a high level. RTS indicates whether the receiving device is ready to receive data.
Common traffic control methods include DTR/DSR (Data Terminal ready/Data ready ). We will not detail it here. Due to the diversity of flow control, I personally think that when the software uses flow control, we should give a detailed description of how to connect and how to apply it.
3. Software Flow Control
Due to the limitations of cables, we generally use software flow control instead of hardware flow control in general control communication. Generally, Xon/xoff is used to implement software flow control. The common method is: when the data volume in the input buffer of the receiving end exceeds the set high, xoff (19 in decimal or control-s in decimal format) is sent to the data sending end, the device programming specification should be described in detail). After receiving the xoff character, the sender immediately stops sending data. When the data volume in the input buffer of the receiver is less than the set low level, send the Xon character (17 or control-Q in decimal format) to the data sender. The sender starts sending the data immediately after receiving the Xon character. Generally, you can find the characters sent from the source program of the device.
It should be noted that if binary data is transmitted, the flag characters may also occur in the data stream and cause misoperations. This is a defect in software flow control, and hardware flow control will not have this problem.

RJ45 to DB9

Just make three lines.

RJ45 side: DB9 side:

3 --- 2
4 --- 5
6 --- 3

RJ45 serial number:

____
| -------- |
| 1, 12345678 |
|
|
|
| -------- |
|
|
|

DB9 (female/master) sequence number:

\-------------/
\ 5 4 3 2 1/
\ 9 8 7 6/
---------

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.