Difference between RS232 interface and RS485 interface
First, the physical structure of the interface
1, RS232 interface:
One of the computer communication interface, usually RS-232 interface to 9 pins (DB-9) or 25 pins (DB-25) type of appearance, general personal computer will have two sets of RS-232 interface, respectively known as COM1 and COM2.
2, RS485:
RS485 no specific physical shape, according to the actual situation of the project and the interface.
Second, the electronic characteristics of the interface
1, RS232: Transmission level signal interface signal level value is higher (signal "1" for the "-3V to -15V", signal "0" for the "3 to 15V", "0" for the "3 to 15V", "0" for the "-15V", "0" for the "3 to 15V", "0" for the "-15V", "0" for the "3 to 15V". "3 to 15V"), easy to damage the interface circuit chip, but also because of the TTL level (0 ~ '<0.8v', 1 ~ '>2.0V') is not compatible with the need to use the level conversion circuit to be able to communicate with the TTL level (0 ~ '<0.8v', 1 ~ '>2.0V'). Level conversion circuit can be connected to the TTL circuit. In addition, poor anti-jamming ability.
2, RS485: Transmission of differential signals logic "1" to the voltage difference between the two lines for + (2-6) V said; logic "0" to the voltage difference between the two lines for - (2-6) The logic "0" is indicated by a voltage difference of -(2-6) V between the two lines. Interface signal level is lower than RS-232, it is not easy to damage the interface circuit chip, and the level is compatible with the TTL level, it is convenient to connect with the TTL circuit.
Third, the length of the communication distance
1, RS232: RS232 transmission distance is limited, the maximum transmission distance standard value of 15 meters, and can only be point-to-point communication, the maximum transmission rate of up to 20kB/s.
2, RS485: RS485 maximum wireless transmission distance of 1200 meters. The maximum transmission rate is 10Mbps, and the maximum communication distance can be reached only under the transmission rate of 100Kb/S. The maximum wireless transmission distance of RS485 is 1200 meters.
Using impedance matching, low attenuation of the special cable can reach 1800 meters! More than 1200 meters, you can add repeaters (up to 8), so that the transmission distance is close to 10Km.
Fourth, can support multi-point communication
RS232: RS232 interface in the bus only allows the connection of a transceiver, can not support the ability to send and receive multiple stations, so only point-to-point communication, does not support multi-point communication.
RS485: RS485 interface on the bus is allowed to connect up to 128 transceivers. That is, with multi-station communication capabilities, so that users can use a single RS485 interface to easily establish a network of devices.
Five, the difference between the communication line
RS232: you can use three-core twisted pair, three-core shielded wire, etc..
RS485: two-core twisted pair, two-core shielded wire, etc. can be used. In low-speed, short-distance, non-interference occasions can be used ordinary twisted-pair cable, on the contrary, in high-speed, long-wire transmission, it must be used to impedance matching (generally 120Ω) of the RS485 special cable (STP-120Ω (for RS485 & CAN) a pair of 18AWG), and in the interference of harsh environments should be used to armored twisted shielded cable (ASTP-120Ω) (for RS485 & CAN) a pair of 18AWG) should also be used in interference-hostile environments.
Supplementary: that is, the RS232 transmission distance is only 15 meters so short, then what is the role of it?
In fact, it has a very wide range of applications, can be connected to a variety of devices, such as monitoring, other equipment upgrades or debugging, etc. may need to use it. Function and USB is relatively close, with the USB port is more and more common, there will be more USB into RS-232 or other interfaces of the conversion device.
Through the USB interface can be connected to more RS-232 devices, not only to obtain higher transmission speeds, realizing the real plug and play, while solving the USB interface can not be a long-distance transmission shortcomings (USB communication distance within 5 meters).
Several common communication protocols
Before we start this issue, we should understand a problem that I have been confused before.
RS485 and MODBUS difference: RS485 is a physical interface, simply put, hardware; MODBUS is an international standard communication protocol for the exchange of data between different manufacturers of equipment (generally industrial use); the so-called protocol, which can also be interpreted as the above, someone said "language," it, simply put, software. The so-called protocol can also be understood as the "language" mentioned above, which is simply the software.
In general, two devices through the MODBUS protocol to transmit data: the earliest is to use RS232 as the hardware interface, (that is, ordinary computer serial communications port (serial port)); also useful RS422, there are also commonly used RS485, this interface transmission distance, in general, the industrial field with more.
MODBUS protocol is divided into MODBUS RTU, MODBUS ASCII and the later development of MODBUS TCP three modes.
The first two (MODBUS RTU, MODBUS ASCII) used in the physical hardware interface are serial (Serial) communication (RS232, RS422, RS485). MODBUS TCP is to comply with the trend of today's world development, what can be used Ethernet network or the Internet to connect and transmit data. So the MODBUS TCP mode, the mode of the hardware interface is Ethernet (Ethernet) port, that is, our computers are generally used on the network port.
Then we can use a picture to understand the S7-200 PLC supports several communication protocols.
PPI communication
It is a communication protocol developed by Siemens specifically for s7-200 series plc. It is built into s7-200 CPU. ppi protocol is physically based on RS-485 port, and PPI communication can be realized through shielded twisted pair cable. ppi protocol is a master-slave protocol. The master device sends a request to the slave device, the slave device responds, and the slave cannot initiate information. The master relies on the shared connection managed by the PPI protocol to communicate with the slaves. the PPI protocol does not limit the number of masters that can communicate with any one of the slaves, but there can be no more than 32 masters in a network. the most basic use of the PPI protocol is to allow the Siemens Step7-Micro/Win programming software to upload and download programs and the Siemens HMI to communicate with the PC.
MPI Communication
MPI (multipoint interface) is the interface for SIMATIC s7 multipoint communication, which is a kind of network suitable for communication between a few sites, mostly used for connecting the upper computer and a small number of plc to communicate with each other in close distance. This can be realized by connecting the MPI programming port of the CPU of the controller s7-300 or s7-400 and the PPI communication port of the s7-200 CPU to each other via Profibus cables and connectors, as well as connecting the programming port of the network card of the host computer (MPI/DP port) via Profibus or MPI cables. It is of course possible to exclude the PC from the network and only include the plc.
The communication rate of MPI is 19.2k to 12mbit/s, but the maximum rate of an MPI network directly connected to the communication port of the s7-200 CPU is usually 187.5kbit/s (limited by the maximum communication rate of the s7-200 CPU). There can be up to 32 stations on the MPI network, and the maximum communication distance of a network segment is 50 meters (when the communication baud rate is 187.5 kbit/s), and the longer communication distance can be extended by rs-485 repeater. The number of connections per s7-200 CPU communication port is 4.
MPI protocol can not communicate with an s7-200 CPU as a PPI master, i.e., s7-300 or s7-400 must ensure that this s7-200 CPU can no longer be used as a PPI master when communicating with the s7-200, and Micro/Win can not access the s7-200 CPU as a PPI master through the MPI protocol. s7-200 CPU can only be used as an MPI slave, i.e., the s7-200 CPU can only be used as a PPI master. The s7-200 CPUs can only be MPI slaves, i.e., the s7-200 CPUs cannot communicate with each other through MPI network, but can only communicate with each other through PPI.
Modbus Communication
Modbus was invented by Modicon (now a brand of Schneider Electric ) in 1979, which is the first real bus protocol used in industrial field in the world. In order to better popularize and promote the distributed application of Modbus based on Ethernet, at present, Schneider has transferred the ownership of Modbus protocol to IDA (Interface for Distributed Automation ) organization and set up Modbus-IDA organization, which lays the foundation for the future development of Modbus. This has laid the foundation for the future development of Modbus. In China, Modbus has become the national standard GB/T19582-2008, according to incomplete statistics: by 2007, the number of Modbus nodes installed has exceeded 10 million.
Modbus protocol is a universal language applied to electronic controllers. With this protocol, controllers can communicate with each other and with other devices via a network (e.g. Ethernet). It has become a common industrial standard. With it, control devices from different manufacturers can be connected into an industrial network for centralized monitoring and control. This protocol defines a structure of messages that a controller can recognize and use, regardless of the network over which they communicate. It describes the process by which a controller requests access to other devices, how it responds to requests from other devices, and how it detects and logs errors. It establishes a common format for the pattern and content of message fields.Modbus is a single-master master/slave communication model. There can only be one master on a Modbus network at a time, and there can be several slaves.
Modbus has the following characteristics.
1, standard, open, users can use the Modbus protocol for free, at ease, without paying license fees, and will not violate intellectual property rights. At present, more than 400 manufacturers support Modbus, and more than 600 kinds of products support Modbus.
2, Modbus can support a variety of electrical interfaces, such as RS-232, RS-485, etc., but also can be transmitted on a variety of media, such as twisted-pair, optical fiber, wireless, etc..
3,The frame format of Modbus is simple, compact and easy to understand. It is easy for users to use and simple for manufacturers to develop.
Note: S7-200 only supports Modbus RTU protocol, not Modbus ASCII protocol;
ProfiBus Communication
As one of the many members of the fieldbus family, ProfiBus is one of the most widely used fieldbus standards in the European industrial world, and is also one of the internationally recognized fieldbus standards. ProfiBus is a unit-level, field-level SIMITAC network suitable for transmitting medium and small amounts of data. Its openness allows many manufacturers to develop their own ProfiBus-compliant products, which can be connected to the same ProfiBus network.
ProfiBus is an electrical network where the physical transmission medium can be shielded twisted pair, fiber optic, or wireless. PROFIBUS is an international, open, manufacturer-independent fieldbus standard with selectable transmission speeds ranging from 9.6 kbaud to 12 Mbaud and all devices connected to the bus should be set to the same speed when the bus system is activated. PROFIBUS is widely used in manufacturing automation, process industry automation and other fields such as building, transportation and power automation, etc. PROFIBUS is also a kind of fieldbus technology used for factory automation shop floor level monitoring and control and data communication and control at field device level. It can realize decentralized digital control and field communication network from field equipment layer to workshop level monitoring, thus providing a feasible solution for realizing integrated factory automation and field equipment intelligence.
USS Communication
USS (Universal Serial Interface) is a communication protocol developed by Siemens specifically for drives, and has undergone a process of continuous development and improvement over the years. Initially, USS was used to parameterize the drive, i.e. to set more ground-oriented parameters. It was widely used in the connection of drives with operating panels and commissioning software (e.g. DriveES/STARTER).
Recently USS has also been increasingly used for communication with controllers (e.g. PLCs) for general level communication control due to its simple protocol and low hardware requirements. (Note: USS provides a low-cost, relatively simple means of communication control. Due to its design, USS cannot be used in applications with high requirements for communication rate and data transfer volume. In these cases, a better real-time communication method, such as PROFIBUS-DP, should be selected. This limitation of USS must be taken into account when designing the system.
For example, if in some speed synchronization requirements of higher applications (such as paper production line), a dozen or even dozens of inverters using USS communication control, the effect can be imagined.
All Siemens inverter with a RS485 communication port, PLC as the master, allowing up to 31 inverters as a communication link in the slave station, according to the address of the inverter or using the broadcast method, you can access the inverter need to communicate, only the master station can send out a communication request message, the address characters in the message to specify the slave station to transmit data, the slave station can only be received in the master request message to the slave station. Only the master can send a communication request message, and the address character in the message specifies the slave station to which the data is to be transmitted. Before using the USS protocol, you need to install the Siemens instruction library. the USS protocol instructions are in the library folder of the STEP7-MICRO/WIN32 instruction tree. the STEP7-MICRO/WIN32 instruction library provides 14 subroutines, 3 interrupts, and 8 instructions to support the USS protocol. One or more subroutines will be added automatically when an instruction is called.
The basic features of the USS protocol are as follows:
■ Supports multi-point communication (and thus can be applied to networks such as RS 485)
■ A "master-slave" access mechanism with a single master.
■ Up to 32 nodes on a network (up to 31 slaves)
Simple and reliable message format for flexible and efficient data transmission
Easy to implement and low cost
The USS works in such a way that communication is always initiated by the master, the USS master polls the individual slaves in a continuous cycle, and the slaves decide whether, and how, to respond based on the commands they receive. Slaves never send data on their own initiative.
The slave responds when the following conditions are met:
1. The received message from the master is free of errors;
2. and this slave is addressed in the received master message.




