Connection Methods for serial communication: 9-pin/25-pin
Basic connection method for Serial Communication
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. This article only involves the most basic method and is directly connected with RS232, to answer questions from some netizens.
2. RS232C Serial Communication Connection method (three-line)
First, as long as there are receive data pins and send pins for data transmission through the serial port, the receiving pin and sending pin of the same serial port can be directly connected by a line, connect two or more serial ports
The receiving pin and sending pin of the same serial port are directly connected to the 9-pin serial port and the 25-pin serial port, both of which are 2 and 3;
Two different serial ports (either the two serial ports of the same computer or the serial ports of different computers)
The above table is for the standard serial port of the microcomputer, and there are many non-standard devices, such as receiving GPS data or electronic compass data, as long as you remember one principle: receiving data pins (or wires) it is connected to the data transmission pin (or wire). If the signal is connected to each other, the system will be able to win a hundred battles.
3. Notes for serial port debugging:
Different encoding mechanisms cannot be mixed. For example, RS232C cannot be directly connected to the RS422 interface. Specialized converters on the market can only be connected through the converter;
Line welding should be solid, or the program will be okay, but it will be wrong due to wiring problems;
Prepare an easy-to-use debugging tool for serial port debugging, such as serial port debugging assistant and serial port genie;
We strongly recommend that you do not use the live plug-in serial port. At least one end of the plug-in is powered off. Otherwise, the serial port is vulnerable to damage.