"Modbus RTU Protocol Usage Summary" for Modbus communication protocol

Source: Internet
Author: User

1. RTU mode

When the controller is set to communicate in RTU (remote terminal Unit) mode on the Modbus network, each 8Bit byte in the message contains two
A hexadecimal character of 4Bit. The main advantage of this approach is that, at the same baud rate, more than the ASCII method can transmit more
Data.
Code system
· 8-bit binary, hexadecimal number 0 ... 9,a ... F
· Each 8-bit field in the message is made up of two hexadecimal characters
Bits per byte
· 1 Starting Bits
· 8 data bits, the smallest significant bit is sent first
· 1 parity bits, no checksum
· 1 stop bit (with checksum), 2 bit (no calibration)
Error detection Domain
· CRC (cyclic verbose detection)

2. RTU Frame

With RTU mode, the message is sent at least at a 3.5-character-time pause interval. In the network baud rate under a variety of character time, which is easiest to implement (as shown in T1-T2-T3-T4). The first domain that is transferred is the device address. The transmission characters that can be used are hex 0 ... 9,a ... F. Network devices constantly detect the network bus, including the time between pauses. When the first domain (address field) is received, each device is decoded to determine if it is destined for itself. After the last transmission character, a pause of at least 3.5 character time is calibrated to the end of the message. A new message can begin after this pause. The entire message frame must be lost as a continuous flow. If there is a pause time of more than 1.5 characters before the frame completes, the receiving device refreshes the incomplete message and assumes that the next byte is the Address field of a new message. Similarly, if a new message starts in less than 3.5 character time and then the previous message begins, the receiving device considers it to be a continuation of the previous message. This will result in an error because the value in the last CRC field cannot be correct. A typical message frame is as follows:

3. Modbus RTU Protocol format

The request and response is prefixed with a six-byte prefix, as follows: Byte 0: Device address byte 1: function code BYTE 2: Register address byte 3: Register address byte 4: Data length byte 5: Data length byte 6:CRC check byte 7:CRC checksum

      

      

4, the function code commonly used

0x01 reads the status of the output relay

       

      

0x02 read the status of the input relay

      

0X03 Read multiple registers

      

0x05 write the status of a single output relay

      

0x0F write the status of multiple output relays

      

0X10 Write multiple registers

      

5, Example: Modbus-rtu reading temperature and humidity meter

      

"Modbus RTU Protocol Usage Summary" for Modbus communication protocol

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.