# 讀寫型記憶體-單Register寫入指令(06)

{% hint style="info" %}
當數值較大時，若分別以不同資料格式（例如 float32 或 int64）進行讀取與換算，因內部計算方式不同，可能會出現非常小的差異，通常小於 1/10,000，屬於正常現象。[請參考列表。](/qr/fu-lt-ultrasonic-flowmeter-manual-chinese-v1/communication/modbus-rtu-protocol/du-xie-xing-ji-yi-ti/du-xie-xing-ji-yi-ti-du-qu-lie-biao.md)
{% endhint %}

### Function Code 功能碼 06

讀寫型記憶體 單 Register 寫入指令，功能碼 06，1 個暫存器 (16 bit)，用於寫入一個簡易的單個 Int16 參數的值，適用設定選項、設定代碼、設定小範圍整數。例如：將 A08 管徑材質 ( Pipe Material) 設定為 PVC (代碼 2)。

### 讀寫型記憶體-單Register寫入指令(06)格式

<div align="left"><figure><img src="/files/v7WVtYyDpdlZ12V2x5TH" alt="" width="563"><figcaption></figcaption></figure></div>

<div align="left"><figure><img src="/files/IB9sTts6N8YLoEWEg5gV" alt="" width="563"><figcaption></figcaption></figure></div>

### Modbus RTU 讀寫型記憶體 - 單 Register 寫入指令 (功能碼 06)

以主站使用功能碼 06 寫入"A03 Pipe Geo Unit 管規尺寸單位" ，單位設定為 "inch"為例。根據 [讀寫型記憶體-讀取列表](/qr/fu-lt-ultrasonic-flowmeter-manual-chinese-v1/communication/modbus-rtu-protocol/du-xie-xing-ji-yi-ti/du-xie-xing-ji-yi-ti-du-qu-lie-biao.md)  ，該參數的起始位址為00 01，Reg 長度為 1  (一個暫存器)，資料型式為 int16。

#### **主站發送讀取指令 (TX 訊框)**

```
TX 請求指令： 01 06 00 01 00 01 19 CA
```

* Slave Address = 01
* Function Code = 06
* 起始暫存器位址 = 00 01 (A03 Pipe Geo Unit 的記憶體地址)
* 讀取數量 = 00 01 (設定為 inch )
* CRC 校驗碼 = 19 CA  (依 CRC 算法計算出的糾錯碼)

#### **從站回覆數據 (RX 訊框)**

寫入指令成功時，主站將會收到從站回傳數據，作為檢查（確認）功能。

```
RX 回覆數據：01 06 00 01 00 01 19 CA
```

* Slave Address = 01
* Function Code = 06
* 讀取數據的起始地址 = 00 01  (寫入 A03 Pipe Geo Unit 記憶體地址)
* 寫入資料 = 00 01 (確認設定 inch 格式)
* CRC 校驗碼 = 19 CA (確認 CRC (必須與 TX 一致))

如果 RX 和 TX 內容完全一致（包括 CRC 校驗碼），則表示：

1. 指令已成功送達。
2. 數據（ `00 01`表是A03 Pipe Geo Unit 單位是inch）成功寫入指定的暫存器位址（`00 01`）。
3. 從站已確認操作完成。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lorric.com/qr/fu-lt-ultrasonic-flowmeter-manual-chinese-v1/communication/modbus-rtu-protocol/du-xie-xing-ji-yi-ti/du-xie-xing-ji-yi-ti-dan-register-xie-ru-zhi-ling-06.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
