MODBUS communication protocol learning (1): Introduction to the protocol

tags: MODBUS learning  modbus  MCU

Preface

In the near future, we need to make a MODBUS/RTU to MODBUS/TCP gateway. First, you need to understand the MODBUS communication protocol.
This article is used as a summary in the learning process, if there are errors, please advise.

Introduction to MODBUS protocol

The MODBUS protocol is the RS485 bus-based communication protocol first introduced by the American Modicon company (now acquired), with RS232/RS422/RS485 interface standards. Modbus has become an industry standard for communication protocols in the industrial field, and is now a common connection method between industrial electronic devices.
MODBUS protocol is aMaster-slave Serial asynchronous Half duplex letter of agreement.
Master-slave Means that there is a master and multiple slaves (maximum 240) in the communication equipment. The master can communicate with the slaves in both directions, and can communicate with a single slave, or all slaves can communicate (broadcast) at the same time. No response is required at this time . The slave station can only communicate with the master station, and the slave stations cannot communicate with each other.
If the slave station wants to communicate with the slave station, it needs to be sent to the master station first, and then the master station sends it to the slave station.
Serial asynchronous
Asynchronous serial communication refers to serial data transmission in which both parties use a character (including specific additional bits) as the data transmission unit and the interval between the sender's transmission of characters is not necessarily, and has the characteristics of irregular data segment transmission.
Half duplex
Half-duplex means that both parties in communication can only send or receive at a certain time, just like making a call, when one party is talking, the other party does not talk.

MODBUS communication format

MODBUS uses asynchronous serial communication, which is an agreement for single character transmission. The baud rate, check method, number of stop bits and other data contained in it can be set by yourself, as long as the communication parties are consistent.
The serial port in the single-chip microcomputer also uses this method, but it is TTL level, while MODBUS uses the RS232/RS422/RS485 interface standard, and the communication with the single-chip microcomputer requires level conversion.

Information frame format

The information frame format is a message, which includes the definition of the frame structure, frame sequence, and function codes and data. These contents are user-defined, and other sequences and formats have strict requirements. All adopting MODBUS communication protocol must comply with these conventions.
The basic format of one frame of MODBUS information is:Meter header + function code + data area + check code + stop code
The header is different according to different communication methods, but the header form of each communication method is the same, and the number of bytes is also fixed.
The function code is also prescribed, and the symbol and the function it represents are obeyed by everyone.
The length of the data area is different due to the different function codes, but the length of the data areaformatIt is fixed.
The format of check code and stop code also has corresponding fixed format.
The format of the function code and the data area is fixed in all communication modes, and the different communication formats of other parts have their own standards and need to follow the requirements of the communication format.

Intelligent Recommendation

C# MODBUS communication protocol

ModbusIs a serialletter of agreementIt is Modicon (now fromSchneider ElectricSchneider Electric) was used in 1979 for usePLC(PLC) Published. MODBUS has become the industry standard (DE FACTO) of the c...

Modbus protocol communication exception

Article Directory 1. Modbus protocol communication abnormality 1. Modbus protocol communication abnormality Address range Slave address: 1-247: Valid address range 0: Broadcast Data exception (data ca...

Modbus protocol Introduction

MODBUS is a request / response protocol,includeASCII, RTU, TCP, etc.,Yes1979In developed an industrial communication protocol,It does not require the physical layer. This protocol defines a controller...

Introduction to Modbus Protocol

ModBus communication protocol Modbus is a serial communication protocol. Through this protocol, controllers can communicate with each other and between controllers and other devices via a network (suc...

MODBUS protocol introduction and analysis

MODBUS protocol introduction and analysis 1.Modbus Introduction Modbus is a wide application of serial communication protocols in the industrial control field, which has become the industry standard f...

More Recommendation

Modbus protocol learning -Modbus RTU

Articles directory Foreword 1. What is Modbus? 2. What is Modbus used to do What is the content of Modbus? 3.1 Modbus-RTU+Modbus-ASCII Summarize Foreword Tip: You can add the approximate content of th...

(1) MODBUS protocol

table of Contents Foreword What is the Modbus protocol? MODBUS function code Modbus TCP Example Foreword Recently, due to task needs, it is required to ask this kind of knowledge foundation, so I plan...

Modbus protocol learning

The Modbus protocol is the seventh layer of the application layer communication protocol of the OSI model, which defines the way in which information is exchanged between different types of devices, a...

Modbus protocol learning (3)

Implementation of MODBUS protocol on serial link include: -Modbus serial link protocol is a master/slave protocol, which is located on the second layer of the OSI model -Modbus application layer messa...

Modbus protocol learning (4)

Implementation of Modbus on TCP/IP 1. The client/server model The client/server model is based on 4 types of messages: 1. MODBUS request-the client sends a message on the network to initiate transacti...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top