0% found this document useful (0 votes)
27 views4 pages

Ultrasonic Open Channel Flowmeter: The Manual

open chanel communication manual

Uploaded by

kepyar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views4 pages

Ultrasonic Open Channel Flowmeter: The Manual

open chanel communication manual

Uploaded by

kepyar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Ultrasonic Open Channel Flowmeter

The manual

YANTAI WINMORE TRADE CO., LTD.


Modbus-RTU Communication protocol

7.1 Modbus_RTU Protocol Description

(1) The instrument supports two standard serial communication protocols and a customized
serial communication command.

⑵ RS485 compatible serial interface, half duplex asynchronous mode:


① Support baud rate: 600-19200bps
② Data bit: 8
③ Check bit: N/O/E Default: N

7.2 Modbus_RTU agreement

7.2.1 Modbus_RTU is query-reply communication, and the data frame format is as


follows:

Address Function Data Check

single-byte single-byte multibyte Double byte

①Address: At the beginning of each frame, indicate the device address 1-255 of the terminal
② Function: It indicates the function to be performed by the current command. The common
function codes are as follows
③ Data: the host reads the variable address and length from the machine or returns the variable
data and other information from the machine.
④ Check: Cyclic redundancy (CRC16) check code.

Function codes and their meanings:

Function code (HEX) Function Function code (HEX) Function

03 Read menu parameters 10 Write menu parameters

04 Read running data 12 Save the parameters

7.2.2 Examples

⑴ The host reads the data command of the liquid level display value from the machine in the
format of example 01 04 00 00 00 02 71 CB

A serial port address Function code Register address Read data length CRC Check code

01 04 00 00 00 02 71CB
The read data is two words in length, and each word returns two bytes.
⑵ Return the command from the machine in the format
Example 01 04 04 40 A0 00 00 EE 66

A serial port address Function code Register address Read data length CRC Check code

01 04 04 40 A0 00 00 EE 66
⑶ The master machine writes the data command format to the slave machine

Example 01 10 00 00 00 02 04 40 A0 00 00 E6 4D

(4) The host requires the slave machine to save data to EEPROM

01 12 00 A0 00 02 04 00 00 00 A1 99 A5
This is a special command that returns 01 13 00 00 00 00 09 63

7.3.2 Data Format

⑴ Meter data storage format: IEEE754 standard single precision floating point number
IEEE754 standard single-precision floating point number consists of 1 sign bit, 8 step code,
and 23 mantras, and is represented by a four-digit hexadecimal number. For example, 124.75 is
42 F9 80 00 in hexadecimal format. The calculation method is: 24.75 converted to binary:
1111100.11

A serial port Function code Register Register length Write data Written CRC Check code
address address length data

01 10 00 00 00 02 04 40 A0 00 00 E6 4D

In scientific notation: 1.11110011*2^6

The rank code 6+127 = 133 is 0 for positive and 1 for negative.
Therefore, the binary number of 124.75 is 0 10000101 11110011000000000000000B =
42F98000H

⑵ c-based four bytes are converted to floating point numbers


Union // Common
Float testData_float; // Float 4 bytes
Unsigned char testArray[4]; / / values
TData;

Note: In the Commons, floating point numbers and four-byte character groups share a
piece of storage.

Best solution: Take the ultrasonic level gauge level value as an example, read back the data
bit 42 F9 80 00, convert the floating point number to 124.75. The internal register storage form is
as follows:

initial address+3 initial address+2 initial address+1 Register start address

03 02 01 00

42 F9 80 00

Folat Tempfloat;

TData.testArray[3] = 0x42; // Enter high bytes


TData.testarray [2] = 0xF9;
TData.testArray[1] = 0x80;

TData.testArray[0] = 0x00; // Enter low bytes

Tempfloat = testData_float; // Get a float

You might also like