Serial Port Introduction
Serial Port is called serial interface, also known as serial communication interface, according to the electrical standards and protocols including RS-232, RS-422, RS485, USB and so on. RS-232-C, RS-422 and RS-485 standards only regulate the electrical characteristics of the interface, does not involve connectors, cables or protocols. USB is a new interface standard developed in recent years and is mainly used in the field of high-speed data transmission.
RS-232: Also known as standard serial port, is currently the most commonly used serial communication interface. In 1970, it was jointly developed by the American Association of Electronic Industry (EIA) and Bell systems, modem manufacturers and computer terminal manufacturers for serial communication. Its full name is "Technical Standard for Serial Binary data exchange interfaces between data terminal devices (DTE) and data communication devices (DCE ". The traditional RS-232 interface standard has 22 wires and adopts the Standard 25-core d plug-in seat. Later, a simplified 9-core d-socket was used on the PC. Currently, 25-core plug-in blocks are rarely used in applications. The current computer generally has two serial ports: COM1 and com2. You can see the 9-pin D interface at the end of the computer. Currently, many mobile phone data lines or logistics receivers are connected to computers using a comport.
RS-422: In order to improve the shortcomings of short distance and low speed of RS-232 communication, a balanced communication interface is defined in RS-422 to increase the transmission rate to 10 Mb/s, the transmission distance is extended to 4000 feet (when the speed is lower than kb/s), and a maximum of 10 receivers can be connected on a balanced bus. RS-422 is a kind of single-machine transmission, multi-machine receive one-way, balanced transmission specification, named as TIA/EIA-422-A standard.
RS-485: in order to expand the scope of application, EIA also established RS-422 standards on the basis of RS-485 in 1983, added multi-point, two-way communication capability, that is, allow multiple transmitters to connect to the same bus, at the same time, the driving capability and conflict protection characteristics of the transmitter are added, and the common mode range of the bus is extended, which is named Tia/EIA-485-A standard.
USB: Universal Serial Bus (USB) is a widely used interface specification on computers, new peripheral interface standards initiated by several major vendors, including Intel, Microsoft, Compaq, IBM, NEC, and northern Telcom. The USB interface is a four-pin interface on the computer motherboard. The two middle pins transmit data and the two sides supply power to the peripherals. Fast USB interface, simple connection, no need for external power supply, transmission speed of 12 Mbps, up to 480 Mbps of the latest; maximum cable length of 5 meters, four lines of USB cable, two signal lines, 2
The power cord can provide a 5 volt power supply. The USB cable can also be shielded or unshielded. The transmission speed of the shielded cable can reach 12 Mbps, which is expensive and the unshielded cable speed is 1.5 Mbps, however, the price is low. USB can be connected to a maximum of 127 devices in series. Hot swapping is supported.
RJ-45 interface is the most commonly used Ethernet interface, RJ45 is a common name, refers to the IEC (60) 603-7 standard, use a modular Jack or plug with 8 locations (8-pin) as defined by international connector standards. It can be made into a serial port according to the definition of the pin, and is mostly used to connect to the serial port server.
Code Implementation
Download the documentation and examples of cncomm serial communication library v1.5.
Http://blog.csdn.net/wujian53/article/details/4090685
Cserialport class (Appendix VC single-document Protocol Communication source program based on MFC and detailed programming steps)
Http://www.vchome.net/tech/multithread/thread33.htm
Cserialport class
Http://www.codeguru.com/Cpp/I-N/network/serialcommunications/article.php/c2483
Cserialport v1.03-serial port wrapper
Http://www.codeproject.com/KB/system/cserialport.aspx
Serial library for C ++
Http://www.codeproject.com/KB/system/serial.aspx
Serial Port to Network Interface
Http://www.codeproject.com/KB/IP/Serial_Port_Network_Acces.aspx
Above Serial Communication Class SerialPort code download: http://download.csdn.net/detail/luxiaoxun/3770333