Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Comparison between MQTT Protocol and Modbus Protocol

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "the comparison of MQTT protocol and Modbus protocol". In the daily operation, I believe that many people have doubts about the comparison of MQTT protocol and Modbus protocol. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "the comparison of MQTT protocol and Modbus protocol". Next, please follow the editor to study!

The protocol is an agreement between the two sides of the communication, that is, what is transmitted by the first bit and what is transmitted by the second bit.

Modbus protocol is mainly composed of address code / identification code, function code, register address, data message and so on. Because modbus protocol is a request / response communication protocol, the function code is mainly used to describe the function performed by the data message. When the server responds to the client, it uses the function code field to indicate normal response (no error) or abnormal response (that is, some error). The function codes of modbus protocol are numerous, which can not be listed here.

We take the Modbus RTU protocol as an example, the address code is 0x01, the write operation is 0x10, and the register address is 0x018Edata CRC check. If the register can be read or written, it returns normal, if the register is read-only, an exception is returned.

Issue instruction: 01 10 018E 00 01 02 00 00 69 BE (write a data with a value of 0 to register 0x018E)

Correct response instruction: 01 10 018E 00 01 60 1E (write a register to the register address 0x018E)

Error response instruction: 01 9001 8D C0 (illegal function of write operation, possibly writing data to the input register)

In MQTT protocol, a MQTT packet consists of three parts: fixed header (Fixed header), variable header (Variable header) and message body (payload).

MQTT fixed head

1.1 MQTT packet Typ

1.2 identification bit

1.3 remaining length (Remaining Length)

MQTT variable head

Payload message body

MQTT packet structure

Fixed header (Fixed header), which exists in all MQTT packets and indicates the packet type and packet class identification of the packet

Variable header (Variable header), which exists in some MQTT packets. The packet type determines whether the variable header exists and its specific content.

The message body (Payload), which exists in some MQTT packets, indicates the specific content received by the client

At this point, the study of "the comparison of MQTT protocol and Modbus protocol" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report