Modbus read-write analog register detailed

Source: Internet
Author: User

Read-Write Analog registers:

Send command (host to slave) format:

[Device Address] [Command Number[High Start register address8bit] [Low8bit] [high number of registers read8bit] [Low8bit] [CRCthe low checksum8bit] [CRCthe High calibration8bit] 

Example:[11][03][00][6B][00][03][CRC low ][CRC high ]

The meanings are as follows:

One: device Address, the address in the example is a, the default address of the dissolved oxygen sensor side is 1,.

A: the command number of the reading analog is fixed to the agreement, which is stipulated in the Modbus protocol.

00 6b : start address high 8 bit (00 , lo 8 bit ( 6b ) : Represents the starting address of the analog that you want to read, such as the starting address in the example is 107 this 006b represents a full address, note that the address here is high 8 bit in front, low 8 bit behind.

00 03 : high register Count 8 bit (00 , lo 8 bit ( 03 ) : Indicates how many simulations are being read from the start address (each of the returned simulations is represented in two bytes). In the example, 3 and the address here is also high 8 bit in front, low 8 bit in the rear .

[CRC low ][CRC high ]: CRC-16 Check at the end of the frame , one of the most important things to note is that the result of the calibration is 8 Lower Bit in front, high 8 bits behind, this order differs from the start address and the address order of the read depth.

Device response: [ device address ] [ command number 03] [ Number of bytes returned ][ data 1][ data 2] ... [ data N][CRC checksum low 8 bit ] [CRC high 8 bit ] 

Example:[11][03][06][02][2B][00][00][00][64][CRC low ][CRC high ]

The meanings are as follows:

One: device address (slave address).

: Command number.

: number of bytes returned (no high two-byte checksum): The number of bytes representing the data, that is, the value of n in data 1,2...n . The example returns 3 analog data because an analog requires 2 bytes, so a total of 6 bytes.

Data1...N: Where[Data1] [Data2]respectively is the first1a high number of analog8bit and low8bit,[Data3] [Data4]is the first2a high number of analog8bit and low8bits, and so on. The values returned in the example are555,0, -.

[CRC Low ][CRC high ]: CRC Check Ibid.

Write a single analog register:

Send command (host to slave) format:

[Device Address] [Command Number[High register address to be placed8bit] [Low8bit] [high data in the lower position8bit] [Low8bit] [CRCthe low checksum8bit] [CRCthe High calibration8bit] 

Example:[11][06][00][01][00][03][CRC low ][CRC high ]

The meanings are as follows:

One: The device address is the same as above.

: The command number to write analog is fixed to .

XX: The register address to be written is 8 bits High and 8 bits lower.

XX: The data to be written is 8 bits High, 8 bits lower. For example, the value of the 1 Register is set to 3.

Note that this command can only write a state of one analog amount.

[ Low 8 -bit CRC check ] [ high 8 -bit CRC check ] Ibid.

Device response: If the command sent by the computer is successfully returned, it will not respond.

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: 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.