Knowledge

How Do Distinguish Between RS232, RS485, RJ45, and Modbus?(3)

MODBUS-RTU communication protocol

Look at the MODBUS-RTU communication protocol:

With the physical layer communication interface, is it possible to communicate? The answer is no. The physical layer communication interface is only to enable both parties to have communication conditions. However, if neither of the two parties understands what they are saying, or if the way of speaking and the grammatical structure of the two communicating parties do not match, it is obviously impossible to communicate.

In the OSI model, above the physical layer is the data link layer. The MODBUS-RTU protocol is the data link layer protocol. As long as both parties in the communication adopt the MODBUS-RTU protocol, it can ensure that the communication language is a statement format that both parties can understand.

MODBUS is also a master-slave. It is the same as the bus control of the physical layer. The master-slave relationship here is to stipulate the control of the communication bus. The master first issues a command to occupy the bus; then the bus is vacant and handed over to the slave to write the response code. After the slave station is completed, the bus is returned to the master station.

Under the MODBUS communication protocol, different command function codes have different frame structures. For the read register command, the MODBUS master frame structure is: 2-byte address code, 1-byte function code, 2-byte data address code, 2-byte CRC check code; MODBUS The response frame structure of the slave station is: 2-byte function code, 1-byte total number of bytes in the response area, N-byte response data, and 2-byte CRC check code.

Although the physical layer protocol is different from the data link layer protocol, the implementation of the data link layer protocol must be based on the fact that the physical layer connection of both parties has met the requirements, and the information exchange can be realized without obstacles.

From the data link layer up, it is the network layer. Its task is to form the information exchange network of the field bus.

The functions of the network layer include packaging communication frames into data packets, and then sending the data packets to the other party.

Since the network structures of the two communicating parties may be different, bridges are required to connect the same kind of networks, and gateways are required to connect different kinds of networks.

There may be multiple channels between networks. Data packets have multiple paths to choose from when they are sent. The element responsible for choosing a path is called a router. The router not only determines the real data exchange network path, but also can construct a virtual network path, and also determines the sending order of data packets. Therefore, the router is the most complex and critical equipment in the network layer.

In the OSI model, the combination of the physical layer + data link layer + network layer is called a field bus, and its communication interface is an 8-pin RJ45 crystal head. Obviously, RJ45 is completely different from RS232/RS485/RA422.

A data packet at the network layer is a combination of data frames. In layman's terms, a data packet is a short article, or a page of data combination units to be delivered.

It is worth noting that the RS232/RS485/RS422 communication interfaces and their definitions are very clear. Including the level of the pin, the function definition of the pin, and the data flow timing relationship of the interface when the information is sent and received, these must be accurate and strict, otherwise the information exchange cannot be performed.


You Might Also Like

Send Inquiry