Click below【Learn Embedded Together】 to follow, learn together, and grow together
Introduction to Communication Protocols
As we all know, a communication protocol is a specification for data transmission. It can be divided into hardware layer communication protocols and software layer communication protocols from both hardware and software perspectives.
To better understand the communication protocols at the hardware and software levels, we can compare communication to traffic. The hardware layer communication protocol is akin to the highway standards of various countries, while the traffic rules of different countries are similar to the various software layer protocol standards.
Figure 1 vividly explains the above description.

Hardware Layer Communication Protocol (Solving Logical Transmission Methods)
Using Device 1 to transmit data 0xA3 (1010 0011) to Device 2, we define the data 1010 0011 at the hardware level as 1 for high voltage and 0 for low voltage. We can achieve the smooth transmission of this data by changing the voltage levels on the transmission line.
To standardize this hardware-level data transmission form, hardware communication interface protocols such as RS-232, RS-485, and CAN bus have been established.

When the TTL level is 0, it makes VB > VA, and when the TTL level is 1, it makes VB < VA.

Software Layer Communication Protocol (Solving Logical Transmission Objectives)
Master-Slave Communication Mode
(1) To achieve half-duplex communication, the concept of master-slave communication mode must be introduced, designating one party as the master and the rest as slaves;
(2) It is stipulated that all slaves in the system cannot actively send data to the master;
(3) After powering on the master and all slaves in the system, they all remain in a receiving state;
For the master to send data to control the slave or for the master to query the slave for returned data, it must be initiated by the master.
When the master sends data to control the slave, the master should be in sending mode. When the master queries the slave for returned data, it should first send a set of addressing data frames in a pre-agreed format.
In summary, the primary purpose of the master finding the slave is to send data to the slave, and the second purpose is for the master to receive data from the slave.
This means ensuring that data can be transmitted and received at the hardware communication layer, while using the software layer to constrain the format and rules of data transmission.
The simplest form of master controlling the slave can be seen in Figure 4, but this arbitrary agreement format has poor general adaptability. Therefore, a universal software layer communication protocol is needed to specify the required functions.
Original Article:https://blog.csdn.net/Roger_717/article/details/105781467
Source from the Internet, copyright belongs to the original author. If there is any infringement, please contact for deletion.
Follow me 【Learn Embedded Together】, learn together, grow together.
If you find the article good, click “Share“, “Like“, or “View“!