# 7. MODBUS Communication Protocol

**Read instantaneous flow rate, flow speed, RSSI, and signal quality:**

| 0       | 1            | 2         | 3         | 4      | 5      | 6                              | 7                              |
| ------- | ------------ | --------- | --------- | ------ | ------ | ------------------------------ | ------------------------------ |
| Node ID | Funtion Code | Address 1 | Address 0 | Data 1 | Data 0 | CRC                            | CRC                            |
| 01\~FF  | 04           | 00        | 00        | 00     | 07     | 16 Bit CRC Calculation results | 16 Bit CRC Calculation results |

**Response format:**

| 0       | 1            | 2           | 3                         | 4                         | 5                          | 6                          | 7                          | 8                          | 9                           | 10                          | 11            | 12              | 13       | 14             | 15   | 16              | 17                             | 18                             |
| ------- | ------------ | ----------- | ------------------------- | ------------------------- | -------------------------- | -------------------------- | -------------------------- | -------------------------- | --------------------------- | --------------------------- | ------------- | --------------- | -------- | -------------- | ---- | --------------- | ------------------------------ | ------------------------------ |
| Node ID | Funtion Code | Data length | Integer part of flow rate | Integer part of flow rate | Fraction part of flow rate | Fraction part of flow rate | Integer part of flow speed | Integer part of flow speed | Fraction part of flow speed | Fraction part of flow speed | Upstream RSSI | Downstream RSSI | Reserved | Signal quality | Unit | Metric/Imperial | CRC                            | CRC                            |
| 01\~FF  | 04           | 0D          |                           |                           |                            |                            |                            |                            |                             |                             |               |                 | 0        |                |      |                 | 16 Bit CRC Calculation results | 16 Bit CRC Calculation results |

Byte 00 : Node ID&#x20;

Byte 01 : Function code&#x20;

Byte 02 : Data length 10 bytes&#x20;

Byte 03 \~ 04 : Integer part of totalized positive flow rate, Format: 16-bit signed integer&#x20;

Byte 05 \~ 06 : Fraction part of totalized positive flow rate, Format: 16-bit signed integer, divide by 10000 before add to integer part&#x20;

Byte 07 \~ 08 : Integer part of totalized positive flow speed, Format: 16-bit signed integer&#x20;

Byte 09 \~ 10 : Fraction part of totalized positive flow speed, Format: 16-bit signed integer, divide by 10000 before add to integer part&#x20;

Byte 11, 12 : 8-bit unsigned integer, value is between 0 and 100&#x20;

Byte 14 : 8-bit unsigned integer, value is between 0 and 100&#x20;

Byte 15 : 8-bit unsigned integer, convert this number from hexadecimal to decimal, the digit in tens represents the unit of numerator and the digit in ones represents the unit of denominator. The table below shows the corresponding unit for each number.

Byte 16 : 8-bit unsigned integer,value is 1 or 2. 1 stands for Metric, 2 stands for Imperial.

**Numerator :**

| Number | Unit                     |
| ------ | ------------------------ |
| 1      | Cubic meter (m³)         |
| 2      | Liter (l)                |
| 3      | USA gallon (gal)         |
| 4      | Imperial Gallon (igl)    |
| 5      | Million USA gallon (Mgl) |
| 6      | Cubic feet (cf)          |
| 7      | USA liquid barrel (bal)  |
| 8      | Oil barrel (ob)          |

**Denominat :**

| Number | Unit   |
| ------ | ------ |
| 1      | Second |
| 2      | Minute |
| 3      | Hour   |
| 4      | Day    |

**Read totalized positive (forward-direction) flow rate :**

| 0       | 1            | 2         | 3         | 4      | 5      | 6                              | 7                              |
| ------- | ------------ | --------- | --------- | ------ | ------ | ------------------------------ | ------------------------------ |
| Node ID | Funtion Code | Address 1 | Address 0 | Data 1 | Data 0 | CRC                            | CRC                            |
| 01\~FF  | 04           | 00        | 07        | 00     | 05     | 16 Bit CRC Calculation results | 16 Bit CRC Calculation results |

**Response format:**

| 0       | 1            | 2           | 3                                            | 4                                            | 5                                            | 6                                            | 7                                             | 8                                             | 9                                             | 10                                            | 11       | 12   | 13                             | 14                             |
| ------- | ------------ | ----------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | -------- | ---- | ------------------------------ | ------------------------------ |
| Node ID | Funtion Code | Data length | Integer part of totalized positive flow rate | Integer part of totalized positive flow rate | Integer part of totalized positive flow rate | Integer part of totalized positive flow rate | Fraction part of totalized positive flow rate | Fraction part of totalized positive flow rate | Fraction part of totalized positive flow rate | Fraction part of totalized positive flow rate | Reserved | Unit | CRC                            | CRC                            |
| 01\~FF  | 04           | 0A          |                                              |                                              |                                              |                                              |                                               |                                               |                                               |                                               | 0        |      | 16 Bit CRC Calculation results | 16 Bit CRC Calculation results |

Byte 00 : Node ID&#x20;

Byte 01 : Function code&#x20;

Byte 02 : Data length 10 bytes&#x20;

Byte 03 \~ 06 : 32-bits signed integer&#x20;

Byte 07 \~ 10 : 32-bits signed integer, divide by 1000000 before add to integer part&#x20;

Byte 12 : Value is between 1 and 8. The table below shows the corresponding unit for each number.

| Number | Unit                     |
| ------ | ------------------------ |
| 1      | Cubic meter (m³)         |
| 2      | Liter (l)                |
| 3      | USA gallon (gal)         |
| 4      | Imperial Gallon (igl)    |
| 5      | Million USA gallon (Mgl) |
| 6      | Cubic feet (cf)          |
| 7      | USA liquid barrel (bal)  |
| 8      | Oil barrel (ob)          |

**Read totalized negative (reverse-direciton) flow rate:**

| 0       | 1            | 2         | 3         | 4      | 5      | 6                              | 7                              |
| ------- | ------------ | --------- | --------- | ------ | ------ | ------------------------------ | ------------------------------ |
| Node ID | Funtion Code | Address 1 | Address 0 | Data 1 | Data 0 | CRC                            | CRC                            |
| 01\~FF  | 04           | 00        | 0C        | 00     | 05     | 16 Bit CRC Calculation results | 16 Bit CRC Calculation results |

**Response format:**

| 0       | 1            | 2           | 3                                            | 4                                            | 5                                            | 6                                            | 7                                             | 8                                             | 9                                             | 10                                            | 11       | 12   | 13                             | 14                             |
| ------- | ------------ | ----------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | -------- | ---- | ------------------------------ | ------------------------------ |
| Node ID | Funtion Code | Data length | Integer part of totalized negative flow rate | Integer part of totalized negative flow rate | Integer part of totalized negative flow rate | Integer part of totalized negative flow rate | Fraction part of totalized negative flow rate | Fraction part of totalized negative flow rate | Fraction part of totalized negative flow rate | Fraction part of totalized negative flow rate | Reserved | Unit | CRC                            | CRC                            |
| 01\~FF  | 04           | 0A          |                                              |                                              |                                              |                                              |                                               |                                               |                                               |                                               | 0        |      | 16 Bit CRC Calculation results | 16 Bit CRC Calculation results |

Byte 00 : Node ID&#x20;

Byte 01 : Function code&#x20;

Byte 02 : Data length 10 bytes&#x20;

Byte 03 \~ 06 : 32-bits signed integer&#x20;

Byte 07 \~ 10 : 32-bits signed integer, divide by 1000000 before add to integer part&#x20;

Byte 12 : Value is between 1 and 8. The table below shows the corresponding unit for each number.

| Number | Unit                     |
| ------ | ------------------------ |
| 1      | Cubic meter (m³)         |
| 2      | Liter (l)                |
| 3      | USA gallon (gal)         |
| 4      | Imperial Gallon (igl)    |
| 5      | Million USA gallon (Mgl) |
| 6      | Cubic feet (cf)          |
| 7      | USA liquid barrel (bal)  |
| 8      | Oil barrel (ob)          |

**Read totalized net flow rate:**

| **0**   | 1            | 2         | 3         | 4      | 5      | 6                              | 7                              |
| ------- | ------------ | --------- | --------- | ------ | ------ | ------------------------------ | ------------------------------ |
| Node ID | Funtion Code | Address 1 | Address 0 | Data 1 | Data 0 | CRC                            | CRC                            |
| 01\~FF  | 04           | 00        | 11        | 00     | 05     | 16 Bit CRC Calculation results | 16 Bit CRC Calculation results |

**Response format:**

| 0       | 1            | 2           | 3                                       | 4                                       | 5                                       | 6                                       | 7                                        | 8                                        | 9                                        | 10                                       | 11       | 12   | 13                             | 14                             |
| ------- | ------------ | ----------- | --------------------------------------- | --------------------------------------- | --------------------------------------- | --------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | -------- | ---- | ------------------------------ | ------------------------------ |
| Node ID | Funtion Code | Data length | Integer part of totalized net flow rate | Integer part of totalized net flow rate | Integer part of totalized net flow rate | Integer part of totalized net flow rate | Fraction part of totalized net flow rate | Fraction part of totalized net flow rate | Fraction part of totalized net flow rate | Fraction part of totalized net flow rate | Reserved | Unit | CRC                            | CRC                            |
| 01\~FF  | 04           | 0A          |                                         |                                         |                                         |                                         |                                          |                                          |                                          |                                          | 0        |      | 16 Bit CRC Calculation results | 16 Bit CRC Calculation results |

Byte 00 : Node ID&#x20;

Byte 01 : Function code&#x20;

Byte 02 : Data length 10 bytes&#x20;

Byte 03 \~ 06 : 32-bits signed integer&#x20;

Byte 07 \~ 10 : 32-bits signed integer, divide by 1000000 before add to integer part&#x20;

Byte 12 : Value is between 1 and 8. The table below shows the corresponding unit for each number.

| Number | Unit                     |
| ------ | ------------------------ |
| 1      | Cubic meter (m³)         |
| 2      | Liter (l)                |
| 3      | USA gallon (gal)         |
| 4      | Imperial Gallon (igl)    |
| 5      | Million USA gallon (Mgl) |
| 6      | Cubic feet (cf)          |
| 7      | USA liquid barrel (bal)  |
| 8      | Oil barrel (ob)          |

**Clear all totalized flow rate:**

| **0**   | 1            | 2         | 3         | 4      | 5      | 6                              | 7                              |
| ------- | ------------ | --------- | --------- | ------ | ------ | ------------------------------ | ------------------------------ |
| Node ID | Funtion Code | Address 1 | Address 0 | Data 1 | Data 0 | CRC                            | CRC                            |
| 01\~FF  | 14           | 00        | 00        | 00     | 00     | 16 Bit CRC Calculation results | 16 Bit CRC Calculation results |

**Clear totalized net flow rate:**

| **0**   | 1            | 2         | 3         | 4      | 5      | 6                              | 7                              |
| ------- | ------------ | --------- | --------- | ------ | ------ | ------------------------------ | ------------------------------ |
| Node ID | Funtion Code | Address 1 | Address 0 | Data 1 | Data 0 | CRC                            | CRC                            |
| 01\~FF  | 15           | 00        | 00        | 00     | 00     | 16 Bit CRC Calculation results | 16 Bit CRC Calculation results |

**Clear totalized positive (forward-direction) flow rate:**

| **0**   | 1            | 2         | 3         | 4      | 5      | 6                              | 7                              |
| ------- | ------------ | --------- | --------- | ------ | ------ | ------------------------------ | ------------------------------ |
| Node ID | Funtion Code | Address 1 | Address 0 | Data 1 | Data 0 | CRC                            | CRC                            |
| 01\~FF  | 16           | 00        | 00        | 00     | 00     | 16 Bit CRC Calculation results | 16 Bit CRC Calculation results |

**Clear totalized negative (reverse-direction) flow rate:**

| **0**   | 1            | 2         | 3         | 4      | 5      | 6                              | 7                              |
| ------- | ------------ | --------- | --------- | ------ | ------ | ------------------------------ | ------------------------------ |
| Node ID | Funtion Code | Address 1 | Address 0 | Data 1 | Data 0 | CRC                            | CRC                            |
| 01\~FF  | 17           | 00        | 00        | 00     | 00     | 16 Bit CRC Calculation results | 16 Bit CRC Calculation results |
