# 唯讀型記憶體讀取指令(04)及記憶體列表

{% hint style="info" %}
讀取指令中register長度必需小於等於 20個 register。超過該長度的指令會被忽略。
{% endhint %}

## 指令範例

### 控制端發指令(04)格式

| Byte#      | 1             | 2             | 3         | 4         | 5              | 6              | 7   | 8   |
| ---------- | ------------- | ------------- | --------- | --------- | -------------- | -------------- | --- | --- |
| Node ID    | Slave Address | Function Code | 讀取數據的啟始地址 | 讀取數據的啟始地址 | 讀取registers 總數 | 讀取registers 總數 | CRC | CRC |
| 範例內容01\~FF | 01            | 04            | 00        | 00        | 00             | 02             | 71  | CB  |

#### 控制端發訊範例說明

這個範例會讀取即時流量

slave address: 01(本流量計地址)

function code: 04(讀取指令)

讀取數據的啟始地址: 0000(要讀取的數據的啟始地址)

讀取registers 總數: 0002 (需要從 0000 開始讀兩個 register 的記憶體)

CRC: 71 CB(依 CRC 算法計算出的糾錯碼)

### 流量計回覆(04)格式

| Byte#      | 1             | 2             | 3        | 4            | 5                         | 6                         | 7                         | 8   | 9   |
| ---------- | ------------- | ------------- | -------- | ------------ | ------------------------- | ------------------------- | ------------------------- | --- | --- |
| Node ID    | Slave Address | Function Code | 回覆的Byte數 | Data Byte #1 | <p>Data Byte</p><p>#2</p> | <p>Data Byte</p><p>#3</p> | <p>Data Byte</p><p>#4</p> | CRC | CRC |
| 範例內容01\~FF | 01            | 04            | 04       | 00           | 00                        | 00                        | 00                        | FB  | 84  |

#### 流量計回覆範例說明

slave address: 01(本流量計地址)

function code: 04(讀取指令)

回覆的Byte數: 04(2個register=4byte)

Data Byte: 00 00 00 00(假設目前即時流量為 0)

CRC: FB 84(依 CRC 算法計算出的糾錯碼)

## 記憶體位置及定義

### 本頁面的表格使用方法：

| 欄位名稱                     | 功能                             |
| ------------------------ | ------------------------------ |
| Register位置               | 讀寫記憶體位置與唯讀記憶體不共用。              |
| <p>Register</p><p>長度</p> | 這個變數的數據長度。以 Register(2Byte)為單位 |
| 記憶體內容                    | 用來說明功能。                        |
| 資料型式                     | 標明收發數據的格式。                     |

### 唯讀區記憶體列表

| Register 位置 | Register 長度 | 記憶體內容                                                                                                                                                                                 | 資料型式            | 註                            |
| ----------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- | ---------------------------- |
| 0000        | 2           | instantaneous flow rate                                                                                                                                                               | float 32        |                              |
| 0002        | 2           | instantaneous flow velocity                                                                                                                                                           | float 32        |                              |
| 0004        | 2           | totalized flow volume                                                                                                                                                                 | float 32        |                              |
| 0006        | 2           | analog output in micro-amp                                                                                                                                                            | unsigned int 32 |                              |
| 0008        | 1           | [error code a](https://docs.lorric.com/qr/fp-as510-paddle-wheel-flowmeter-manual-chinese-v2/alarm-priority-and-display-method#alarm-a-zhong-da-yi-chang-failed)                       | unsigned int 16 | 第一個 byte 未定義補0               |
| 0009        | 1           | [error code b](https://docs.lorric.com/qr/fp-as510-paddle-wheel-flowmeter-manual-chinese-v2/alarm-priority-and-display-method#alarm-b-chao-chu-gong-zuo-fan-wei-out-of-specification) | unsigned int 16 | 第一個 byte 未定義補0               |
| 000A        | 1           | [error code c](https://docs.lorric.com/qr/fp-as510-paddle-wheel-flowmeter-manual-chinese-v2/alarm-priority-and-display-method#alarm-c-xu-yao-wei-hu-maintenance-required)             | unsigned int 16 | 第一個 byte 未定義補0               |
| 000B        | 1           | [error code d](https://docs.lorric.com/qr/fp-as510-paddle-wheel-flowmeter-manual-chinese-v2/alarm-priority-and-display-method#alarm-d-she-bei-que-ren-zhong-function-check)           | unsigned int 16 | 第一個 byte 未定義補0               |
| 000C        | 1           | [System Status](https://docs.lorric.com/qr/fp-as510-paddle-wheel-flowmeter-manual-chinese-v2/alarm-priority-and-display-method#system-status-xi-tong-zhuang-tai)                      | unsigned int 16 | 第一個 byte 未定義補0               |
| 000D        | 1           | history\[1] year & month                                                                                                                                                              | unsigned int 16 |                              |
| 000E        | 1           | history\[1] day                                                                                                                                                                       | unsigned int 16 |                              |
| 000F        | 1           | history\[1] total method                                                                                                                                                              | unsigned int 16 |                              |
| 0010        | 2           | history\[1] totalized flow rate                                                                                                                                                       | float32         |                              |
| 0012        | 1           | history\[2] year & month                                                                                                                                                              | unsigned int 16 |                              |
| 0013        | 1           | history\[2] day                                                                                                                                                                       | unsigned int 16 |                              |
| 0014        | 1           | history\[2] total method                                                                                                                                                              | unsigned int 16 |                              |
| 0015        | 2           | history\[2] totalized flow rate                                                                                                                                                       | float32         |                              |
| 0017        | 1           | history\[3] year & month                                                                                                                                                              | unsigned int 16 |                              |
| 0018        | 1           | history\[3] day                                                                                                                                                                       | unsigned int 16 |                              |
| 0019        | 1           | history\[3] total method                                                                                                                                                              | unsigned int 16 |                              |
| 001A        | 2           | history\[3] totalized flow rate                                                                                                                                                       | float32         |                              |
| 001C        | 1           | history\[4] year & month                                                                                                                                                              | unsigned int 16 |                              |
| 001D        | 1           | history\[4] day                                                                                                                                                                       | unsigned int 16 |                              |
| 001E        | 1           | history\[4] total method                                                                                                                                                              | unsigned int 16 |                              |
| 001F        | 2           | history\[4] totalized flow rate                                                                                                                                                       | float32         |                              |
| 0021        | 1           | history\[5] year & month                                                                                                                                                              | unsigned int 16 |                              |
| 0022        | 1           | history\[5] day                                                                                                                                                                       | unsigned int 16 |                              |
| 0023        | 1           | history\[5]total method                                                                                                                                                               | unsigned int 16 |                              |
| 0024        | 2           | history\[5] totalized flow rate                                                                                                                                                       | float32         |                              |
| 0026        | 1           | history\[6] year & month                                                                                                                                                              | unsigned int 16 |                              |
| 0027        | 1           | history\[6] day                                                                                                                                                                       | unsigned int 16 |                              |
| 0028        | 1           | history\[6] total method                                                                                                                                                              | unsigned int 16 |                              |
| 0029        | 2           | history\[6] totalized flow rate                                                                                                                                                       | float32         |                              |
| 002B        | 1           | history\[7] year & month                                                                                                                                                              | unsigned int 16 |                              |
| 002C        | 1           | history\[7] day                                                                                                                                                                       | unsigned int 16 |                              |
| 002D        | 1           | history\[7] total method                                                                                                                                                              | unsigned int 16 |                              |
| 002E        | 2           | history\[7] totalized flow rate                                                                                                                                                       | float32         |                              |
| 0030        | 1           | history\[8] year & month                                                                                                                                                              | unsigned int 16 |                              |
| 0031        | 1           | history\[8] day                                                                                                                                                                       | unsigned int 16 |                              |
| 0032        | 1           | history\[8] total method                                                                                                                                                              | unsigned int 16 |                              |
| 0033        | 2           | history\[8] totalized flow rate                                                                                                                                                       | float32         |                              |
| 0035        | 1           | history\[9] year & month                                                                                                                                                              | unsigned int 16 |                              |
| 0036        | 1           | history\[9] day                                                                                                                                                                       | unsigned int 16 |                              |
| 0037        | 1           | history\[9] total method                                                                                                                                                              | unsigned int 16 |                              |
| 0038        | 2           | history\[9] totalized flow rate                                                                                                                                                       | float32         |                              |
| 003A        | 1           | history\[10] year & month                                                                                                                                                             | unsigned int 16 |                              |
| 003B        | 1           | history\[10] day                                                                                                                                                                      | unsigned int 16 |                              |
| 003C        | 1           | history\[10] total method                                                                                                                                                             | unsigned int 16 |                              |
| 003D        | 2           | history\[10] totalized flow rate                                                                                                                                                      | float32         |                              |
| 003F        | 1           | history\[11] year & month                                                                                                                                                             | unsigned int 16 |                              |
| 0040        | 1           | history\[11] day                                                                                                                                                                      | unsigned int 16 |                              |
| 0041        | 1           | history\[11] total method                                                                                                                                                             | unsigned int 16 |                              |
| 0042        | 2           | history\[11] totalized flow rate                                                                                                                                                      | float32         |                              |
| 0044        | 1           | history\[12] year & month                                                                                                                                                             | unsigned int 16 |                              |
| 0045        | 1           | history\[12] day                                                                                                                                                                      | unsigned int 16 |                              |
| 0046        | 1           | history\[12] total method                                                                                                                                                             | unsigned int 16 |                              |
| 0047        | 2           | history\[12] totalized flow rate                                                                                                                                                      | float32         |                              |
| 0049        | 1           | history\[13] year & month                                                                                                                                                             | unsigned int 16 |                              |
| 004A        | 1           | history\[13] day                                                                                                                                                                      | unsigned int 16 |                              |
| 004B        | 1           | history\[13] total method                                                                                                                                                             | unsigned int 16 |                              |
| 004C        | 2           | history\[13] totalized flow rate                                                                                                                                                      | float32         |                              |
| 004E        | 1           | history\[14] year & month                                                                                                                                                             | unsigned int 16 |                              |
| 004F        | 1           | history\[14] day                                                                                                                                                                      | unsigned int 16 |                              |
| 0050        | 1           | history\[14] total method                                                                                                                                                             | unsigned int 16 |                              |
| 0051        | 2           | history\[14] totalized flow rate                                                                                                                                                      | float32         |                              |
| 0053        | 1           | Maximum r value                                                                                                                                                                       | unsigned int 16 |                              |
| 0054        | 1           | Minimum r value                                                                                                                                                                       | unsigned int 16 |                              |
| 0055        | 2           | instantaneous flow rate(X100取整數)                                                                                                                                                      | signed int 32   | 例如原始數值 5.1234，會變成 512，整數以下捨去 |
| 0057        | 2           | instantaneous flow speed(X100取整數)                                                                                                                                                     | signed int 32   | 例如原始數值 5.1234，會變成 512，整數以下捨去 |
| 0059        | 2           | totalized flow rate                                                                                                                                                                   | signed int 32   | 例如原始數值 5.1234，會變成 512，整數以下捨去 |
| 005B        | 2           | history\[1] totalized flow rate(X100取整數)                                                                                                                                              | signed int 32   | 例如原始數值 5.1234，會變成 512，整數以下捨去 |
| 005D        | 2           | history\[2] totalized flow rate(X100取整數)                                                                                                                                              | signed int 32   | 例如原始數值 5.1234，會變成 512，整數以下捨去 |
| 005F        | 2           | history\[3] totalized flow rate(X100取整數)                                                                                                                                              | signed int 32   | 例如原始數值 5.1234，會變成 512，整數以下捨去 |
| 0061        | 2           | history\[4] totalized flow rate(X100取整數)                                                                                                                                              | signed int 32   | 例如原始數值 5.1234，會變成 512，整數以下捨去 |
| 0063        | 2           | history\[5] totalized flow rate(X100取整數)                                                                                                                                              | signed int 32   | 例如原始數值 5.1234，會變成 512，整數以下捨去 |
| 0065        | 2           | history\[6] totalized flow rate(X100取整數)                                                                                                                                              | signed int 32   | 例如原始數值 5.1234，會變成 512，整數以下捨去 |
| 0067        | 2           | history\[7] totalized flow rate(X100取整數)                                                                                                                                              | signed int 32   | 例如原始數值 5.1234，會變成 512，整數以下捨去 |
| 0069        | 2           | history\[8] totalized flow rate(X100取整數)                                                                                                                                              | signed int 32   | 例如原始數值 5.1234，會變成 512，整數以下捨去 |
| 006B        | 2           | history\[9] totalized flow rate(X100取整數)                                                                                                                                              | signed int 32   | 例如原始數值 5.1234，會變成 512，整數以下捨去 |
| 006D        | 2           | history\[10] totalized flow rate(X100取整數)                                                                                                                                             | signed int 32   | 例如原始數值 5.1234，會變成 512，整數以下捨去 |
| 006F        | 2           | history\[11] totalized flow rate(X100取整數)                                                                                                                                             | signed int 32   | 例如原始數值 5.1234，會變成 512，整數以下捨去 |
| 0071        | 2           | history\[12] totalized flow rate(X100取整數)                                                                                                                                             | signed int 32   | 例如原始數值 5.1234，會變成 512，整數以下捨去 |
| 0073        | 2           | history\[13] totalized flow rate(X100取整數)                                                                                                                                             | signed int 32   | 例如原始數值 5.1234，會變成 512，整數以下捨去 |
| 0075        | 2           | history\[14] totalized flow rate(X100取整數)                                                                                                                                             | signed int 32   | 例如原始數值 5.1234，會變成 512，整數以下捨去 |
