Modbus protokoll rs485: Difference between revisions

From Chaosdorf Wiki
Jump to navigation Jump to search
No edit summary
(10 intermediate revisions by 2 users not shown)
Line 26: Line 26:
2. Set the address (communication using the device address, the default address is 01)<br>
2. Set the address (communication using the device address, the default address is 01)<br>
<br>
<br>
/***************************************************************************************/ <br>
Set the address from 01 to 09 or from Broadcast to 09
Set the address to: 09


{| class="wikitable"
{| class="wikitable"
Line 38: Line 37:
|}
|}
<br>
<br>
Read Address<br>
Read Address<br>
00 03 00 00 00 01 85 db <br>
<br>
Return:<br>
00 03 02 00 01 44 44                        // 01 for Address<br>


/***************************************************************************************/ <br>
{| class="wikitable"
|-
! Hex Byte  !! Funktion 
|-
| 00 03 00 00 00 01 85 db  || Send to Device
|-
| 00 03 02 00 01 44 44    || Receive from Device  '''01 for Address'''
|}
 
Meaning of each byte:<br>
Meaning of each byte:<br>
[address 1]<br>
<br>
No. 1 relay is on : 01 05 00 01 01 00 9d 9a<br>
<br>
<br>
Byte 1:        address <br>
Byte 1:        address <br>
Line 57: Line 59:
<br>
<br>


/***************************************************************************************/ <br>
[Mod Bus Address 1]<br>
<br>
0 relay ON:      01 05 00 00 FF 00 8C 3A <br>
0 relay off:      01 05 00 00 00 00 CD CA <br>
<br>
No. 1 relay ON:  01 05 00 01 FF 00 DD FA <br>
No. 1 relay off:  01 05 00 01 00 00 9C 0A <br>
<br>
No. 2 relay ON:  01 05 00 02 FF 00 2D FA <br>
No. 2 relay off:  01 05 00 02 00 00 6C 0A <br>
<br>
/********************************************
01 10 00 00 00 01 02 00 09 66 56            // Current address 01 is changed to 09<br>
00 10 00 00 00 01 02 00 09 6B C6            // Broadcast Address Modified to 09<br>******************************************* / <br>
off:              01 0F 00 00 00 08 01 00 FE 95 <br>
all bright:      01 0F 00 00 00 08 01 FF BE D5 <br>
/*************************************************************************************** / <br>


Read all relay states:<br>
 
<br>
[address 1]<br>
Send: 01 01 00 00 00 08 3D CC <br>
 
<br>
{| class="wikitable"
Return: 01 01 01 00 51 88       Relay fully closed <br>
|-
<br>
! Hex Byte  !! Funktion 
Return: 01 01 01 03 11 89       All relays are on<br>
|-
<br>
| 01 05 00 00 FF 00 8C 3A  || 0 relay ON
/*************************************************************************************** / <br>
|-
Read all input switch status <br>
| 01 05 00 00 00 00 CD CA  || 0 relay off
Send: 01 02 00 00 00 08 79 CC     Read 8 input states <br>
|-
Return: 01 02 01 00 A1 88 <br>
|    ||
<br>
|-
<br>
| 01 05 00 01 FF 00 DD FA || No. 1 relay ON
|-
| 01 05 00 01 00 00 9C 0A || No. 1 relay off
|-
|    ||
|-
| 01 05 00 02 FF 00 2D FA || No. 2 relay ON
|-
| 01 05 00 02 00 00 6C 0A || No. 2 relay off
|-
|    ||
|-
| 01 0F 00 00 00 08 01 00 FE 95 || Full off
|-
| 01 0F 00 00 00 08 01 FF BE D5 || all bright
|-
|    ||
|-
| 01 01 00 00 00 08 3D CC || Send : Read all relay states
|-
| 01 01 01 00 51 88 || Return : Relay fully closed
|-
| 01 01 01 03 11 89 || Return : All relays are on
|-
|    ||
|-
| 01 02 00 00 00 08 79 CC || Send : Read all input switch status
|-
| 01 02 01 00 A1 88 || Return : 8 input states
|-
|}
https://hacktronics.co.in/2-channel-relay-module/modbus-rtu-2-way-relay-output-2-way-input-switch-ttl-rs485-interface-communication


=== Modbus Rtu 4 ===
=== Modbus Rtu 4 ===
Line 111: Line 126:
Baud Rate: 9600 8 NONE 1
Baud Rate: 9600 8 NONE 1


{| class="wikitable"
|-
! Hex Byte  !! Funktion 
|-
| 00 06 40 00 00 01 5c 1b  || Setting address is: 01
|-
| 00 06 40 00 00 02 1c 1a  || Setting address is: 02
|-
| 00 03 40 00 00 01 90 1b  || Read address
|-
|                          || Read the software version
|-
| 00 03 00 04 00 01 c4 1a ||  [month] broadcast read (only by one device to address all practical, easy to test)
|-
|  ||Read the hardware version (PCB version)
|-
| 00 03 00 04 00 01 c4 1a ||  broadcast read (only by one device to address all practical, easy to test)
|-
|}


/ *************************************************************************************** / <br>
Setting address is: 01<br>
00 06 40 00 00 01 5c 1b<br>
Setting address is: 02<br>
00 06 40 00 00 02 1c 1a<br>
Read address<br>
00 03 40 00 00 01 90 1b<br>
/ *************************************************************************************** / <br>
Read the software version<br>
00 03 00 04 00 01 c4 1a // [month] broadcast read (only by one device to address all practical, easy to test)<br>
0,003,000,800,010,419 [years] // broadcast read (only by one device to address all practical, easy to test)<br>
00 03 00 10 00 01 84 1e [when] // sub broadcast read (only by one device to address all practical, easy to test)<br>


Read the hardware version (PCB version)<br>
[address 1]<br>
0,003,002,000,018,411 // broadcast read (only by one device to address all practical, easy to test)<br>
 
/ *************************************************************************************** / <br>
{| class="wikitable"
[1 Address]<br>
|-
! Hex Byte  !! Funktion 
|-
| 01 05 00 01 01 00 9d 9a || No. 1 relay ON
|-
| 01 05 00 01 00 00 9c 0a || No. 1 relay off
|-
|    ||
|-
| 01 05 00 02 01 00 6d 9a || No. 2 relay ON
|-
| 01 05 00 02 00 00 6c 0a || No. 2 relay off
|-
|    ||
|-
| 01 05 00 03 01 00 3c 5a || No. 3 relay ON
|-
| 01 05 00 03 00 00 3d ca || No. 3 relay off
|-
|    ||
|-
| 01 05 00 04 01 00 8d 9b || No. 4 relay ON
|-
| 01 05 00 04 00 00 8c 0b || No. 4 relay off
|-
|    ||
|-
| 01 05 00 ff 00 00 fd fa || Quanmie
|-
| 01 05 00 ff ff ff fc 4a || All light
|}
 
[address 2]<br>
 
{| class="wikitable"
|-
! Hex Byte  !! Funktion 
|-
| 02 05 00 01 01 00 9d a9 || No. 1 relay ON
|-No. 1 relay 1 channel status
| 02 05 00 01 00 00 9c 39 || No. 1 relay off
|-
|    ||
|-
| 02 05 00 02 01 00 6d a9 || No. 2 relay ON
|-
| 02 05 00 02 00 00 6c 39 || No. 2 relay off
|-
|    ||
|-
| 02 05 00 03 01 00 3c 69 || No. 3 relay ON
|-
| 02 05 00 03 00 00 3d f9 || No. 3 relay off
|-
|    ||
|-
| 02 05 00 04 01 00 8d a8 || No. 4 relay ON
|-
| 02 05 00 04 00 00 8c 38 || No. 4 relay off
|-
|    ||
|-
| 02 05 00 ff 00 00 fd c9 || Quanmie
|-
| 02 05 00 ff ff ff fc 79 || All light
|}
<br>
<br>
Open relay 1<br>
[address 1]<br>
01 05 00 01 01 00 9d 9a<br>
{| class="wikitable"
Relay 1 closed<br>
|-
01 05 00 01 00 00 9c 0a<br>
! Hex Byte  !! Funktion 
|-
| 01 01 00 01 00 04 6c 09 || Send : No. 1 relay 1 channel status
|-
| || Return ......
|-
| 01 01 00 02 00 04 9c 09 || Send : No. 1 Relay 2 channel status
|-
| || Return ......
|-
| 01 01 00 03 00 04 CD C9 || Send : No. 1 Relay 3 channel status
|-
| || Return ......
|-
| 01 01 00 04 00 04 7C 08 || Send : No. 1 Relay 4 channel status
|}
 
<br>
<br>
No. 2 relay open<br>
https://hacktronics.co.in/4-channel-relay-module/4-channel-relay-module-programmable-w-opto-isolated-rs485-stm8s103f3
01 05 00 02 01 00 6d 9a<br>
 
No. 2 relay closed<br>
 
01 05 00 02 00 00 6c 0a<br>
===  DDS578R Energy Meter ===
<br>
 
3 relay open<br>
01 05 00 03 01 00 3c 5a<br>
3 Relay Off<br>
01 05 00 03 00 00 3d ca<br>
<br>
No. 4 relay open<br>
01 05 00 04 01 00 8d 9b<br>
4 Relay Off<br>
01 05 00 04 00 00 8c 0b<br>
Quanmie<br>
01 05 00 ff 00 00 fd fa<br>
All light<br>
01 05 00 ff ff ff fc 4a<br>
<br>
[2 Address]<br>
Open relay 1<br>
02 05 00 01 01 00 9d a9<br>
Relay 1 closed<br>
02 05 00 01 00 00 9c 39<br>
<br>
No. 2 relay open<br>
02 05 00 02 01 00 6d a9<br>
No. 2 relay closed<br>
02 05 00 02 00 00 6c 39<br>
<br>
3 relay open<br>
02 05 00 03 01 00 3c 69<br>
3 Relay Off<br>
02 05 00 03 00 00 3d f9<br>
<br>
No. 4 relay open<br>
02 05 00 04 01 00 8d a8<br>
4 Relay Off<br>
02 05 00 04 00 00 8c 38<br>
Quanmie<br>
02 05 00 ff 00 00 fd c9<br>
All light<br>
02 05 00 ff ff ff fc 79<br>
/ *************************************************************************************** / <br>
No. 1 relay 1 channel status<br>
01 01 00 01 00 04 6c 09<br>
<br>
No. 1 Relay 2 channel status<br>
01 01 00 02 00 04 9c 09<br>
<br>
Relay 1 3 Channel status<br>
01 01 00 03 00 04 CD C9<br>
<br>
<br>
4 channel relay 1 status<br>
<br>noch kein Text
01 01 00 04 00 04 7C 08<br>
/ *************************************************************************************** / <br>
Read the status of all input interfaces<br>
01 02 00 00 00 00 78 0a<br>

Revision as of 23:08, 4 December 2019

Modbus Rtu 2

Hardware Resources:

 *   RS485 communication interface
 *   TTL communication interface
 *   2 optocoupler isolation input
 *   2 way optocoupler isolation output
 *   A user button
 *   A user LED
 *   A power indicator
 *   A STM32F030F4 microcontroller
 *   2 relay status indicators LED lights
 *   Power supply terminal interface (12V power supply)


Modbus RTU Instructions:

Baud rate: 9600 8 NONE 1

Hexadecimal send
hexadecimal receive

Operation steps:
1. Software settings communication baud rate
2. Set the address (communication using the device address, the default address is 01)

Set the address from 01 to 09 or from Broadcast to 09

Hex Byte Funktion
01 10 00 00 00 01 02 00 09 66 56 Current address 01 is changed to 09
00 10 00 00 00 01 02 00 09 6B C6 Broadcast Address Modified to 09



Read Address

Hex Byte Funktion
00 03 00 00 00 01 85 db Send to Device
00 03 02 00 01 44 44 Receive from Device 01 for Address

Meaning of each byte:

Byte 1: address
byte 2: function
byte 3 4: register address
byte 5 6: register data
byte 7 8: CRC check


[address 1]

Hex Byte Funktion
01 05 00 00 FF 00 8C 3A 0 relay ON
01 05 00 00 00 00 CD CA 0 relay off
01 05 00 01 FF 00 DD FA No. 1 relay ON
01 05 00 01 00 00 9C 0A No. 1 relay off
01 05 00 02 FF 00 2D FA No. 2 relay ON
01 05 00 02 00 00 6C 0A No. 2 relay off
01 0F 00 00 00 08 01 00 FE 95 Full off
01 0F 00 00 00 08 01 FF BE D5 all bright
01 01 00 00 00 08 3D CC Send : Read all relay states
01 01 01 00 51 88 Return : Relay fully closed
01 01 01 03 11 89 Return : All relays are on
01 02 00 00 00 08 79 CC Send : Read all input switch status
01 02 01 00 A1 88 Return : 8 input states

https://hacktronics.co.in/2-channel-relay-module/modbus-rtu-2-way-relay-output-2-way-input-switch-ttl-rs485-interface-communication

Modbus Rtu 4

Specifications:

 *   RS485 communication interface
 *   TTL communication interface
 *   4 optocoupler isolation input
 *   4 way optocoupler isolation output
 *   A user button
 *   A user LED
 *   A power indicator
 *   A STM32F030F4 microcontroller
 *   4 relay status indicators LED lights
 *   Power supply terminal interface (12V power supply)


Modbus RTU command

Baud Rate: 9600 8 NONE 1

Hex Byte Funktion
00 06 40 00 00 01 5c 1b Setting address is: 01
00 06 40 00 00 02 1c 1a Setting address is: 02
00 03 40 00 00 01 90 1b Read address
Read the software version
00 03 00 04 00 01 c4 1a [month] broadcast read (only by one device to address all practical, easy to test)
Read the hardware version (PCB version)
00 03 00 04 00 01 c4 1a broadcast read (only by one device to address all practical, easy to test)


[address 1]

Hex Byte Funktion
01 05 00 01 01 00 9d 9a No. 1 relay ON
01 05 00 01 00 00 9c 0a No. 1 relay off
01 05 00 02 01 00 6d 9a No. 2 relay ON
01 05 00 02 00 00 6c 0a No. 2 relay off
01 05 00 03 01 00 3c 5a No. 3 relay ON
01 05 00 03 00 00 3d ca No. 3 relay off
01 05 00 04 01 00 8d 9b No. 4 relay ON
01 05 00 04 00 00 8c 0b No. 4 relay off
01 05 00 ff 00 00 fd fa Quanmie
01 05 00 ff ff ff fc 4a All light

[address 2]

Hex Byte Funktion
02 05 00 01 01 00 9d a9 No. 1 relay ON
02 05 00 01 00 00 9c 39 No. 1 relay off
02 05 00 02 01 00 6d a9 No. 2 relay ON
02 05 00 02 00 00 6c 39 No. 2 relay off
02 05 00 03 01 00 3c 69 No. 3 relay ON
02 05 00 03 00 00 3d f9 No. 3 relay off
02 05 00 04 01 00 8d a8 No. 4 relay ON
02 05 00 04 00 00 8c 38 No. 4 relay off
02 05 00 ff 00 00 fd c9 Quanmie
02 05 00 ff ff ff fc 79 All light


[address 1]

Hex Byte Funktion
01 01 00 01 00 04 6c 09 Send : No. 1 relay 1 channel status
Return ......
01 01 00 02 00 04 9c 09 Send : No. 1 Relay 2 channel status
Return ......
01 01 00 03 00 04 CD C9 Send : No. 1 Relay 3 channel status
Return ......
01 01 00 04 00 04 7C 08 Send : No. 1 Relay 4 channel status


https://hacktronics.co.in/4-channel-relay-module/4-channel-relay-module-programmable-w-opto-isolated-rs485-stm8s103f3


DDS578R Energy Meter



noch kein Text