RS232, RS485 study notes

Industrial Internet of Things Wired Transmission Electrical Protocol Study Notes

Common electrical protocols are RS232, RS422 and RS485, among which RS232 and RS485 are widely used.

RS: Abbreviation for Recommended Standard

1, Kushiyuki communication Japanese parallel communication

Note: 8- Xintong (Xintong can be simply understood as a transmission line) Parallel transmission due to capacitive induction between channels, the reliability of long-distance transmission is low. 

summary

Considering the cost and reliability of the application, the long-distance communication between the computer and the computing, the computer and the peripherals is suitable for serial communication, and the short-distance communication within the computer is suitable for parallel communication (not to say that it is the same internally).

Therefore, the communication of industrial IoT equipment basically adopts serial communication mode. Typical serial communication standards are RS232, RS422 and RS485 , among which half-duplex RS485 is the most widely used.

2、RS232,Recommended standard-232

The RS-232 standard interface (also known as EIA RS-232 ) is one of the commonly used serial communication interface standards. It was jointly established by the Electronic Industries Association (EIA) in 1970 in conjunction with Bell Systems, modem manufacturers and computer terminal manufacturers. Developed, its full name is " Technical Standard for Serial Binary Data Exchange Interface Between Data Terminal Equipment (DTE) and Data Communication Equipment (DCE) " - Baidu Encyclopedia

But I understand that " RS232 is a commonly used serial communication, which is a level signal transmission protocol ; not an interface standard, which is easy to understand as a hardware standard and is not rigorous". The reasons are as follows:

(1) In the computer world, all data is actually electrical signals. The so-called data transmission is the transmission of electrical signals. For example, 0 means no electrical signal, 1 means electrical signal, and the combination of 0 and 1 constitutes various Data, characters, etc.; the transmission of data is the transmission of electrical signals, and the high and low electrical signals are transmitted in an orderly manner (the physical layer in communication is the transmission of electrical signals), as shown in the figure below.

Note: The electrical signal here can be voltage or current.

Using serial communication, the level signal represented by each bit is successively transmitted to the target end, connected by two signal lines, one is the signal transmission line, the other is the signal return line, and both lines are unidirectional Transmission; Two unidirectional transmission signal lines enable the device to receive data while sending data, which is called duplex working mode, as shown in the figure below.

Note: Tx stands for data sending end, Rx stands for data receiving end; DTE stands for data terminal equipment, and DCE stands for data communication equipment.

(2)UART:Universal Asynchronous Receiver/Transmitter

It is a universal asynchronous receiver/transmitter and a key module for asynchronous communication between devices.

UART is responsible for processing the serial / parallel and parallel / serial conversion between the data bus and the serial port , and specifies the frame format; as long as the communication parties adopt the same frame format and baud rate, they can only share the clock signal without sharing the clock signal. The communication process can be completed with two wires ( Rx , Tx ), so it is also called asynchronous serial communication.

As shown in the figure above, it is a schematic diagram of the full-duplex RS232 serial communication process. Inside the DTE device: UART reads data from the CPU in parallel, and then outputs the data bit by bit (parallel to serial), and transmits it to the DCE serial port through the DTE serial port , Serial data is written into memory/CPU/MCU in parallel (serial to parallel) through UART . The reverse DCE transmits data to the DTE , the same is true .

(3) RS232 summary

  • RS232 is a point-to-point communication method, and the serial bus is not considered, so the network function cannot be realized.
  • A signal line and a signal return line are used to form a common ground transmission form. This common ground transmission is prone to common mode interference, so the anti-noise interference is weak
  • The transmission rate is low. In asynchronous transmission, the baud rate is 20Kbps . Now thanks to the new UART chip, the baud rate reaches 115.2Kbps
  • The transmission distance is limited, the maximum transmission distance standard value is 50 meters, in fact it can only be used at about 15 meters
  • Interface signal level value higher ( 15V ), fragile interface circuit chip, and because the 232 level and TTL is not compatible with the level it is required to use in order to level conversion circuit TTL circuit connected

In summary, RS232 is understood to be a more reasonable and rigorous electrical transmission protocol for serial communication between two devices, rather than an interface standard.

Because RS232 has the above-mentioned various deficiencies, EIA has introduced RS422 and RS485 specifically.

3、RS485,Recommended standard-485

RS485 uses a balanced driver to transmit the level signal in a differential manner, and then uses a differential receiver at the terminal to convert the differential signal to a logic level signal; RS485 has two formats, one is a half-duplex composed of two transmission lines, and the other One is full duplex composed of 4 transmission lines.

(1) Half-duplex RS485

Two transmission lines, the level signal A is converted into ( a+ ) - ( a- ) two level signals for transmission through a balanced driver , so both lines are used for one-way electrical signal transmission (sending/ receiving), also That is to say, you cannot receive electrical signals at the same time when sending electrical signals, and cannot send electrical signals when receiving electrical signals (ie half-duplex), as shown in the figure below.

(2) RS485 networking based on half-duplex

RS-485 adopts half-duplex working mode and supports multi-point data communication . RS-485 bus network topology is generally used is a match, the overall linear structure . That is, a bus is used to connect each node in series, and ring or star networks are not supported. If you need to use a star structure, you must use a 485 repeater or a 485 hub. The RS-485/422 bus generally supports a maximum of 32 nodes. If a special 485 chip is used, it can reach 128 or 256 nodes, and the maximum can support up to 400 nodes.

Note: The device in the above figure is UART, and the corresponding interfaces are "A+" and "B-".

(3) Full duplex RS485

For full-duplex RS485, four transmission lines are responsible for full-duplex electrical signal transmission, two wires are responsible for sending, and at the same time, two wires are responsible for receiving.

(4) RS485 summary

  • RS485 has two working modes, one is half-duplex formed by two transmission lines, and the other is full-duplex formed by four transmission lines. At present, the half-duplex formed by two lines is widely used.
  • The RS485 interface is a combination of a balanced driver and a differential receiver, which has good anti-noise interference
  • The standard value of the maximum transmission distance of the RS485 interface is 1200 meters (at 9600bps ), which can actually reach 3000 meters
  • The RS-485 interface allows the connection of up to 128 transceivers on the bus , and users can easily establish a device network with a single RS-485 interface
  • The maximum data transmission rate of RS-485 is 10Mbps
  • RS-485 is a logic "1" voltage difference between the two lines + represents ; logic "0" voltage difference between the two lines - represents

4. The difference between RS232 and RS485

5. Other

  • RS422 is less used. It is similar to full-duplex RS485. It consists of four transmission lines for signal transmission, two for sending signals in a differential manner, and two for receiving signals in a differential manner.
  • RS232, RS422 and RS485 can be interconnected by converting interface devices.

Guess you like

Origin blog.csdn.net/xs_2018/article/details/110749682