Modbus–RTU Funktionscode
测试Werkzeuge:信捷 T-com Die SerieDebugging-Tools代替触摸屏;
测试Ausrüstung:信捷 PLC ;
PLC 的内部软元件编Nr.与 Modbus-RTU Adresse编Nr.请参考信捷 PLC Modbus 通讯FunktionKapitel节。
Modbus Funktion代码:
| Funktionscode(16 进制) | Funktion |
| 01 | 读多个位 |
| 03 | 读多ein Register. |
| 05 | 写单个位 |
| 06 | Schreiben eines einzelnen Registers |
| 0F | 写多个位 |
| 10 | Schreiben mehrerer Register |
通讯Das Format:Porter Rate 19200,Zufällige Prüfungen(EVEN), Datenplatz 8 位, Stoppen Sie Platz 1 位。
注意: 以下测试Adresse都是16. SystemAdresse, 实际Operationen需将16. SystemAdresse转换成十 进制Adresse输入zu触摸屏中。
1. 01 Funktionscode: Lesen多个线圈位Operationen
例如:Lesen线圈 0X4800~0X4815 的位Status。
0X4800~0X4807:PLC Y0~Y7 0X4808~0X4815:PLC Y10~Y17
Befehle senden: 01 01 48 00 00 10 2A 66
| 动作 | AusrüstungNr. (1 Byte) | Funktionscode (1 Byte) | Ausgang Adresse 高位(1 Byte) | Ausgang Adresse 低位(1 Byte) | 总位数高位(1 Byte) | 总位数低位(1 Byte) | CRC(1 Byte) | (1 Byte) |
| Senden Sie | 01 | 01 | 48 | 00 | 00 | 10 | 2A | 66 |
返回Befehl: 01 01 02 00 00 B9 FC
| 动作 | AusrüstungNr. (1 Byte) | Funktionscode (1 Byte) | Anzahl der Bytes (2 Byte) | 位Status (On/Off) | 位Status (On/Off) | CRC(1 Byte) | (1 Byte) |
| 返回 ON | 01 | 01 | 02 | FF | 03 | B8 | 0D |
| 返回 Off | 01 | 01 | 02 | 00 | 00 | B9 | FC |
2. 03 Funktionscode: Lesen多个字Operationen(Daten显示)
例如:Lesen 4X00~4X02 的Daten。
4X000~4X003 :PLC D0~D2
4X00 = 4, 4X01= 5, 4X001= 1, 4X02= 2
Befehle senden: 01 03 00 00 00 04 44 09
| 动作 | AusrüstungNr. (1 Byte) | Funktionscode (1 Byte) | Ausgang Adresse 高位(1 Byte) | Ausgang Adresse 低位(1 Byte) | 总位数高位(1 Byte) | 总位数低位 (1 Byte) | CRC(1 Byte) | (1 Byte) |
| Senden Sie | 01 | 03 | 00 | 00 | 00 | 04 | 44 | 09 |
Befehle senden: 01 03 08 00 04 00 05 00 01 00 02 CC 16
| 动 作 | AusrüstungNr.(1 Byte) | Funktionscode(1 Byte) | Anzahl der Bytes (1Byte) | 寄 存 器 值高位 4X00 | 寄 存 器 值低位 4X00 | Registerwert 高位 4X01 | Registerwert 低位 4X01 | 寄 存 器 值高位 4X02 | 寄 存 器 值低位 4X02 |
| 返 回 | 01 | 03 | 08 | 00 | 04 | 00 | 05 | 00 | 01 |
| Registerwert 高位 4X023 | Registerwert 低位 4X023 | CRC | |||||||
| 00 | 02 | CC | 16 |
3. 05 Funktionscode: 写单个位Operationen(Knopf)
例如: 置 ON 0X4800
0X4800 :PLC Y0
Befehle senden: 01 05 48 00 FF 00 9B 9A
| 动 作 | AusrüstungNr.(1 Byte) | Funktionscode(1 Byte) | Ausgang Adresse高 位(1 Byte) | Ausgang Adresse低 位(1 Byte) | 总位数 高 位 (1 Byte) | 总位数 低 位 (1 Byte) | CRC(1Byte) | (1Byte) |
| 发 送 | 01 | 05 | 48 | 00 | FF | 00 | 9B | 9A |
返回Befehl: 01 05 48 00 FF 00 9B 9A
| 动作 | AusrüstungNr.(1 Byte) | Funktionscode(1 Byte) | Ausgang Adresse高位(1 Byte) | Ausgang Adresse低位(1 Byte) | 总位数高位(1 Byte) | 总位数低位(1 Byte) | CRC(1 Byte) | (1 Byte) |
| 返回 | 01 | 05 | 48 | 00 | FF | 00 | 9B | 9A |
例如:置 OFF 0X4800
0X4800 :PLC Y0
Befehle senden: 01 05 48 00 00 00 DA 6A
| 动作 | AusrüstungNr. (1 Byte) | Funktionscode (1 Byte) | Ausgang Adresse 高位(1 Byte) | Ausgang Adresse 低位(1 Byte) | 总位数高位 (1 Byte) | 总位数低位 (1 Byte) | CRC(1 Byte) | (1 Byte) |
| Senden Sie | 01 | 05 | 48 | 00 | 00 | 00 | DA | 6A |
返回Befehl: 01 05 48 00 00 00 DA 6A
| 动作 | AusrüstungNr. (1 Byte) | Funktionscode (1 Byte) | Ausgang Adresse 高位(1 Byte) | Ausgang Adresse 低位(1 Byte) | 总位数高位 (1 Byte) | 总位数低位 (1 Byte) | CRC(1 Byte) | (1 Byte) |
| 返回 | 01 | 05 | 48 | 00 | 00 | 00 | DA | 6A |
4. 06 Funktionscode: 写单个字Operationen
例如: Adresse 4X00 Schreiben von Daten 8
4X00 :PLC D0
Befehle senden: 01 06 00 00 00 08 88 0C
| 动作 | AusrüstungNr. (1 Byte) | Funktionscode(1 Byte) | Ausgang Adresse 高位(1 Byte) | Ausgang Adresse 低位(1 Byte) | Registerwert 高位(1 Byte) | Registerwert 低位(1 Byte) | CRC (1 Byte) | (1 Byte) |
| Senden Sie | 01 | 06 | 00 | 00 | 00 | 08 | 88 | 0C |
返回Befehl: 01 06 00 00 00 08 88 0C
| 动作 | AusrüstungNr. (1 Byte) | Funktionscode(1 Byte) | Ausgang Adresse 高位(1 Byte) | Ausgang Adresse 低位(1 Byte) | Registerwert 高位(1 Byte) | Registerwert 低位(1 Byte) | CRC (1 Byte) | (1 Byte) |
| 返回 | 01 | 06 | 00 | 00 | 00 | 08 | 88 | 0C |
5. 10 Funktionscode: 写多个字Operationen(Daten输入写双字 Dword)
例如: Unterteilung别给Adresse 4X00 Schreiben von Daten 10, 4X01 Schreiben von Daten 11, 4X02 Schreiben von Daten 12
4X00~4X02 :PLC D0~D2
Befehle senden: 01 10 00 00 00 03 06 00 0A 00 0B 00 0C 0F 46
| 动 作 | 设 备 Nr.(1 | 功 能 码(1 | Ausgang Adresse 高位(1 Byte) | Ausgang Adresse 低位(1 Byte) | Register. 总数高位 (1 Byte) | Register. 总数低位 (1 Byte) | Register. 总Anzahl der Bytes (1 Byte) | Register. 值高位 | Registerwert 低位(1 Byte) |
| Byte) | Byte) | (1Byte) | |||||||
| 发 送 | 01 | 10 | 00 | 00 | 00 | 03 | 06 | 00 | 0A |
| Registerwert 高位(1 Byte) | Registerwert 低位(1 Byte) | Registerwert 高位(1 Byte) | Registerwert 低位(1 Byte) | CRC | |||||
| 00 | 0B | 00 | 0C | 0F | 46 |
返回Befehl: 01 10 00 00 00 03 80 08
| 动作 | AusrüstungNr.(1 Byte) | Funktionscode(1 Byte) | Ausgang Adresse高位(1 Byte) | Ausgang Adresse低位(1 Byte) | Register.总数高位(1 Byte) | Register.总数低位(1 Byte) | CRC(1 Byte) | (1 Byte) |
| Senden Sie | 01 | 10 | 00 | 00 | 00 | 03 | 80 | 08 |
6. 0F Funktionscode: 写多个位Operationen
例如: 置 ON 0X4800~0X4803
0X4800~0X4807:PLC Y0~Y7 0X4810 :PLC Y10
Befehle senden: 01 0F 48 00 00 09 02 FF 01 AD 48
| 动作 | AusrüstungNr. (1 Byte) | Funktionscode (1 Byte) | Ausgang Adresse 高位(1 Byte) | Ausgang Adresse 低位(1 Byte) | 位总数 高位 (1 Byte) | 位总数 低位 (1 Byte) | 寄位总 Anzahl der Bytes (1 Byte) | 位的值 低位 (1Byte) | 位的值 高位 (1Byte) |
| Senden SieDaten | 01 | 0F | 48 | 00 | 00 | 09 | 02 | FF | 01 |
| CRC | |||||||||
| AD | 48 |
返回Befehl: 01 0F 48 00 00 09 82 6D
| 动作 | AusrüstungNr. (1 Byte) | Funktionscode (1 Byte) | Ausgang Adresse高位 (1 Byte) | Ausgang Adresse低位 (1 Byte) | 位总数高位(1 Byte) | 位总数低位(1 Byte) | CRC | |
| 返回 | 01 | 0F | 48 | 00 | 00 | 09 | 82 | 6D |
Antwort veröffentlichen