From 20b9db877e9eee87486df13bccd6809366b5baf6 Mon Sep 17 00:00:00 2001
From: shaoxiang <1026025056@qq.com>
Date: Fri, 9 Aug 2019 20:51:19 +0800
Subject: [PATCH] add AC socket Modbus Protocol en
---
docs/en/app/ac_socket.md | 246 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 245 insertions(+), 1 deletion(-)
diff --git a/docs/en/app/ac_socket.md b/docs/en/app/ac_socket.md
index 9186a9a1..2f3d052c 100644
--- a/docs/en/app/ac_socket.md
+++ b/docs/en/app/ac_socket.md
@@ -31,6 +31,7 @@ Let's break it down a little bit, start with the bottom part.
## Product Features
+
- RS485 OUTLET
- Serial communication protocol: ModBUS-RTU
- support Mutiple device Series connection
@@ -55,4 +56,247 @@ Let's break it down a little bit, start with the bottom part.
## Application
-- Smart AC Socket Outlet With wire control of RS485
\ No newline at end of file
+- Smart AC Socket Outlet With wire control of RS485
+
+
+## ACSocket Modbus RTU Protocol
+
+### Description:
+
+- 1. Communication uses RS485, 1 bit start bit + 8 bit data bit + 1 bit end bit
+- 2. Baud rate 9600
+- 3.Device ID defaults to AAH
+- 4. Address 00H is the broadcast address, the slave does not reply
+
+### Instruction: (hexadecimal) (Modbus RTU format)
+
+
+### 1. Write coil
+
+The host sends:
+
+`AA 05 00 00 FF 00 95 E1` (closed coil)
+
+`AA 05 00 00 00 00 D4 11` (disconnect coil)
+
+
+
+
+ | Send content |
+ bytes |
+ Send a message |
+ Remarks |
+
+
+ | module address |
+ 1 |
+ AAH |
+ 00H is the broadcast address |
+
+
+ | Function code |
+ 1 |
+ 05H |
+ Write a single coil |
+
+
+ | start register address |
+ 2 |
+ 0000H |
+ Coil 0 Address |
+
+
+ | Write data |
+ 2 |
+ FF00H |
+ FF00H: indicates coil closure | 0000H: indicates coil disconnection |
+
+
+ | CRC check |
+ 2 |
+ XXXXH |
+ CRC code of all previous data (CRC16) |
+
+
+
+Slave response:
+
+The operation successfully returns the original data:
+
+`AA 05 00 00 FF 00 95 E1`
+
+Operation failed to return:
+
+`AA 85 error code CRC_L CRC_H`
+
+
+### 2. Reading the coil
+
+The host sends:
+
+`AA 01 00 00 00 01 E4 11`
+
+
+
+ | Send content |
+ bytes |
+ Send a message |
+ Remarks |
+
+
+ | module address |
+ 1 |
+ AAH |
+ 00H is the broadcast address |
+
+
+ | Function code |
+ 1 |
+ 01H |
+ read coil |
+
+
+ | start register address |
+ 2 |
+ 0000H |
+ Coil 0 Address |
+
+
+ | Read quantity |
+ 2 |
+ 0001H |
+ can only be 0001H |
+
+
+ | CRC check |
+ 2 |
+ XXXXH |
+ CRC code of all previous data (CRC16) |
+
+
+
+Slave response:
+
+The operation returns successfully:
+
+
+
+ | Address |
+ Function code |
+ Return data length |
+ Coil Status |
+ CRC_L |
+ CRC_H |
+
+
+ | AA |
+ 01 |
+ 01 |
+ 01 |
+ B0 |
+ 6C |
+
+
+
+Coil status: `01H -> coil closed ` \ `00H -> coil disconnected`
+
+Operation failed to return: `AA 81 error code CRC_L CRC_H`
+
+
+### 3. Write device address
+
+The host sends:
+
+`AA 41 00 00 00 12 A4 13`
+
+
+
+ | Send content |
+ bytes |
+ Send a message |
+ Remarks |
+
+
+ | module address |
+ 1 |
+ AAH |
+ 00H is the broadcast address |
+
+
+ | Function code |
+ 1 |
+ 41H |
+ Set module address |
+
+
+ | start register address |
+ 2 |
+ 0000H |
+ Address |
+
+
+ | module new address |
+ 1 |
+ 12H |
+ 1 byte |
+
+
+ | CRC check |
+ 2 |
+ XXXXH |
+ CRC code of all previous data (CRC16) |
+
+
+
+Slave response:
+
+The operation successfully returns the original data:
+
+`AA 41 00 00 00 12 A4 13`
+
+Operation failed to return:
+
+`AA C1 error code CRC_L CRC_H`
+
+
+
+### 4. Broadcast recovery device address
+
+The host sends:
+
+`00 42 00 00 A0 30 `
+
+
+
+ | Send content |
+ bytes |
+ Send a message |
+ Remarks |
+
+
+ | broadcast address |
+ 1 |
+ 00H |
+ 00H is the broadcast address |
+
+
+ | Function code |
+ 1 |
+ 42H |
+ Recovery address is AAH |
+
+
+ | start register address |
+ 2 |
+ 0000H |
+ Address |
+
+
+ | CRC check |
+ 2 |
+ XXXXH |
+ CRC code of all previous data (CRC16) |
+
+
+
+Slave response: `none`
\ No newline at end of file