Industrial communication bus RS485 and RS232

Industrial communication bus RS485 and RS232

1.RS232

  RS-232 standard interface (also known as EIA RS-232) is one of the commonly used serial communication interface standards. Jointly formulated in 1970, its full name is "Technical Standard for Serial Binary Data Exchange Interface between Data Terminal Equipment (DTE) and Data Communication Equipment (DCE)".
  The RS-232 bus specifies 25 lines, including two signal channels, namely the first channel (called the main channel) and the second channel (called the secondary channel). Full-duplex communication can be realized by using the RS-232 bus, and the main channel is usually used, while the secondary channel is rarely used. In general applications, full-duplex communication can be realized by using 3 to 9 signal lines, and a simple full-duplex communication process can be realized by using three signal lines (receiving line, sending line and signal line). The RS232 protocol transmits data over the wire using a different signal level than the standard 5V to minimize signal interference. It performs asynchronous transfers at a constant rate that is synchronized with the level of the start pulse signal.
  The RS232 protocol transmits data over the wire using a different signal level than the standard 5V to minimize signal interference. It performs asynchronous transfers at a constant rate that is synchronized with the level of the start pulse signal.

1.1 Interface definition

  RS-232 is the most widely used serial interface in PC and communication. RS-232 is defined as a single-ended standard for low-speed serial communication with increased communication distance. RS-232 adopts unbalanced transmission mode. The interface adopted by the RS232 standard is a 9-pin or 25-pin D-type plug. The commonly used one is a 9-pin plug, which is a D-shaped 9-pin head. The signal definition of the interface of all connected devices is the same, and the signal definition is as follows:
insert image description here
insert image description here

1.2 RS232 level signal

  RS232 uses negative logic level, and RS232 uses non- differential (similar signal) for transmission; logic 1 corresponds to +5 ~ +15V ; logic 0 corresponds to -15 ~ -5V .

1.3 Communication distance and speed

  The agreement originally stipulated that the maximum speed of the equipment was 20kbps. The standard transmission rates stipulated by RS-232 are 50b/s, 75b/s, 110b/s, 150b/s, 300b/s, 600b/s, 1200b/s, 2400b/s, 4800b/s, 9600b/s, 19200b /s, can flexibly adapt to devices with different rates. For slow peripherals, a lower transfer rate can be selected; conversely, a higher transfer rate can be selected. The longest communication distance of Rs232 serial port connection is 15 meters. The maximum transmission rate of RS232 is 20Kbps.

1.4 Disadvantages of RS232

  1. The signal level of the interface is relatively high, which is easy to damage the chip of the interface circuit, and because it is incompatible with the TTL level, it needs to use a level conversion circuit to connect with the TTL circuit.
  2. The transmission rate is low. During asynchronous transmission, the maximum transmission rate of RS232 is 20Kbps.
  3. The interface uses a signal line and a signal return line to form a common-ground transmission form. This common-ground transmission is prone to common-mode interference, so the anti-noise interference is weak.
  4. The transmission distance is limited. The maximum transmission distance standard value is 50 feet, but in fact it can only be used at about 15 meters.

2.RS485

insert image description here
![Insert picture description here](https://img-blog.csdnimg.cn/eb1e17742248488ca798664972375c96.png insert image description here
  485 (commonly referred to as RS485/EIA-485) is the electrical characteristic of the physical layer of the OSI model specified as 2-wire, half Duplex, the standard of multi-point communication . Its electrical characteristics are quite different from RS-232. The transmission signal is represented by the voltage difference at both ends of the cable. RS485 only specifies the electrical characteristics of the receiving end and the sending end . It does not specify or Any data protocol is recommended.
  Typical serial communication standards are RS232 and RS485, which define voltage, impedance, etc., but do not define software protocols. The RS-485 bus standard specifies the electrical characteristics of the bus interface, that is, for 2 logic states Definition: logic 1 is between +2V+6V, logic 0 is between -2V~-6V, using differential transmission mode , which can effectively reduce the interference of noise signals.

  The RS-485 bus technology only stipulates the electrical standard of the interface, and does not specify the cable, plug-in and communication protocol of the RS-485 interface. The cables used are recommended to use shielded twisted pairs, so that 485+ and 485- are paired in pairs, and the shielding layer is used to shield the external electromagnetic interference. However, in the construction on site, some people use parallel lines, which can also be applied to the RS-485 bus. Cable, but the anti-interference ability is poor, the transmission distance is not far and the communication quality is unstable, it is generally recommended to use shielded twisted pair. As for the interface definition form, since the RS-485 bus generally uses three wires 485+, 485- and GND, there is no mandatory definition of the interface definition form. Generally, the common interface forms on the market include RJ45 interface, industrial terminal interface, DB9 Serial terminal and RJ11 telephone line interface, etc. Generally speaking, it is more appropriate to use industrial terminals, because if you need to access terminal resistance, it is very easy to use industrial terminals, and it is more convenient to access shielded twisted-pair wires.

  • Features of RS485
      1. The interface level is low and the chip is not easily damaged. Electrical characteristics of RS485: Logic "1" is expressed when the voltage difference between two lines is +(2~6)V; logic "0" is expressed when the voltage difference between two lines is -(2~6)V. The signal level of the interface is lower than that of RS232, and it is not easy to damage the chip of the interface circuit, and the level is compatible with the TTL level, which can be easily connected with the TTL circuit.
      2. High transmission rate. The maximum data transmission rate of RS485 can reach 35Mbps at 10 meters, and the transmission speed can reach 100Kbps at 1200m.
      3. Strong anti-interference ability. The RS485 interface is a combination of a balanced driver and a differential receiver, which enhances the ability to resist common-mode interference, that is, it has good anti-noise interference.
      4. The transmission distance is long, and there are many supporting nodes. The longest RS485 bus can transmit over 1200m (rate ≤100Kbps) and 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 400 nodes.
      The 485 bus is widely used in various fields such as video surveillance, access control intercom, and building alarm because of its simple wiring, stability and reliability.

2.1 485 bus wiring method

  In the simple application of the 485 bus, the bus topology wiring method is generally adopted. But in a more complex system, the wiring construction of the bus topology is not only very cumbersome, but also wastes a lot of connections. By flexible use of 485 hubs or 485 repeaters, the bus topology can be connected into a star or tree topology. It greatly facilitates the pre-construction and post-maintenance work.
insert image description here

2.2 HT485 chip

  The HT485 is a low power transceiver for RS-485 and RS-422 communications. The IC contains a driver and a receiver. The HT485's drivers have an unlimited slew rate, allowing them to transmit up to 2.5Mbps. These transceivers are either empty or fully loaded with the driver disabled. All parts are powered by a 5V supply. The driver is short-circuit current limited and is protected against excessive power dissipation by a thermal shutdown circuit that places the driver output in a high-impedance state. The receiver inputs are fail-safe, guaranteeing a logic high output if the input is left open. The HT485 is designed for half-duplex applications.
insert image description here
  The RE pin is a transceiver control bit, low level means receiving, high level means sending.

  • characteristic

  1. Extended ESD protection for RS-485/RS-422 I/OPins ± 15kV using human body model
  2. Low quiescent current: 300µA; -7V to +12V common-mode input voltage range; 3-state output
  3. Provide full-duplex and half-duplex version
  4. Operates from a single 5V supply, allowing up to 32 transceivers on the bus Data rate: 2.5 Mbps
  5. Current limiting and thermal shutdown for driver overload protection
  If 485 communication needs to realize one-master and multiple-slave communication, it is also necessary to design a communication protocol by itself, and use addresses to distinguish slaves. Generally, it can be designed with reference to the modbus protocol protocol.

3. TTL level and COMS level

  TTL is the abbreviation of Time To Live, which means the time-to-live value. The TTL level signal stipulates that +5V is equivalent to logic "1", and 0V is equivalent to logic "0" (when using binary to represent data). Input high level>=2.0V, input low level<=0.8V. Such a data communication and level regulation method is called a TTL (transistor-transistor logic level) signal system. This is a standard technique for communicating between parts inside a device controlled by a computer processor.
  In the same way, the level suitable for cmos circuit work is the cmos level. COMS integrated circuit is the English abbreviation of Compiementary symmetry metal oxide semiconductor (Compiementary symmetry metal oxide semiconductor) integrated circuit. Many basic logic units of the circuit are connected in a complementary symmetrical form with enhanced PMOS transistors and enhanced NMOS transistors. Static power Consumption is very small. The power supply voltage VDD of the COMS circuit is relatively wide and can work normally at +5–+15V, and the voltage fluctuation is allowed to be ± 10. When the output voltage is higher than VDD-0.5V, it is logic 1, and the output voltage is lower than VSS+0.5V (VSS is digital ground) is logic 0, and the fanout is 10–20 CMOS gates.

4. USB to serial port CH340

  CH340 is a USB bus adapter chip, which realizes USB to serial port or USB to printer port. In the serial port mode, CH340 provides common MODEM communication signals, which are used to expand the asynchronous serial port for the computer, or directly upgrade the common serial device to the USB bus.
insert image description here
insert image description here

4.1 Features

  ● Full-speed USB device interface, compatible with USB V2.0.
  ● Simulate a standard serial port, used to upgrade the original serial port peripherals, or add additional serial ports through USB.
  ● The serial port application program under the Windows operating system on the computer side is fully compatible and does not need to be modified.
  ● Hardware full-duplex serial port, built-in transceiver buffer, supports communication baud rate 50bps~2Mbps.
  ● Support common MODEM communication signals RTS, DTR, DCD, RI, DSR, CTS.
  ● Provide RS232, RS485, RS422 and other interfaces by adding level conversion devices.
  ● CH340R chip supports IrDA standard SIR infrared communication, and supports baud rate from 2400bps to 115200bps.
  ● Built-in firmware, the software is compatible with CH341, and can directly use the VCP driver of CH341.
  ● Support 5V power supply voltage and 3.3V power supply voltage and even 3V power supply voltage.
  ● CH340C/N/K/E and CH340B have a built-in clock, no external crystal oscillator is required, and CH340B also has a built-in EEPROM for configuring serial numbers.
  ● Available in SOP-16, SOP-8, and SSOP-20 and ESSOP-10, MSOP-10 lead-free packages, RoHS compliant.

4.2 Features of CH340 USB to serial port

insert image description here
  CH340 has a built-in independent transceiver buffer and supports simplex, half-duplex or full-duplex asynchronous serial communication. Serial data includes 1 low-level start bit, 5, 6, 7 or 8 data bits, 1 or 2 high-level stop bits, and supports odd parity/even parity/mark parity/blank parity test. CH340 supports common communication baud rates: 50, 75, 100, 110, 134.5, 150, 300, 600, 900, 1200, 1800, 2400, 3600, 4800, 9600, 14400, 19200, 28800, 33600, 38 400, 56000, 57600, 76800, 115200, 128000, 153600, 230400, 460800, 921600, 1500000, 2000000 etc. For applications with one-way 1Mbps and above, or two-way 500Kbps and above, it is recommended to use CH343 to enable hardware automatic flow control. The allowable baud rate error of CH340 serial port receiving signal is about 2%, and the baud rate error of CH340G/CH340T/CH340R serial port sending signal is less than 0.3% CH340C/340N/340K/340E/340B serial port sending signal baud rate error is less than 1.2% .
  Under the Windows operating system, the driver program of CH340 can emulate the standard serial port, so most of the original serial port application programs are fully compatible, and usually do not need any modification. CH340 can be used to upgrade the original serial port peripherals, or add additional serial ports to the computer through the USB bus. Interfaces such as RS232, RS485, and RS422 can be further provided by adding a level conversion device. CH340R only needs to add an infrared transceiver, and can add a SIR infrared adapter to the computer through the USB bus, so as to realize the infrared communication between the computer and the external devices conforming to the IrDA specification.

Guess you like

Origin blog.csdn.net/weixin_44453694/article/details/127811783