Modbus protokoll rs485: Difference between revisions

From Chaosdorf Wiki
Line 25: Line 25:
1. Software settings communication baud rate<br>
1. Software settings communication baud rate<br>
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 to: 09
Set the address to: 09


Line 37: 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 56: 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
|-
|}


=== Modbus Rtu 4 ===
=== Modbus Rtu 4 ===