Modbus
1. Set Modbus Program
Command Code: 0x5701 EXTERN_PROGRAM_SET
json
{
"robot": 1,
"programid": 1,
"jobname": "xxxx"
}| Parameter | Type | Required | Description |
|---|---|---|---|
| robot | int | Yes | Robot number, range 1-4 |
| programid | int | Yes | Program ID, range 1-300 |
| jobname | string | Yes | Job file name (without extension) |
2. Query Modbus Program
Command Code: 0x5702 EXTERN_PROGRAM_INQUIRE
json
{
"robot": 1,
"startprogramid": 1,
"num": 10
}| Parameter | Type | Required | Description |
|---|---|---|---|
| robot | int | Yes | Robot number, range 1-4 |
| startprogramid | int | Yes | Program start ID |
| num | int | Yes | Number of programs to retrieve, range 1-10 |
3. Query Modbus Program Response
Command Code: 0x5703 EXTERN_PROGRAM_RESPOND
json
{
"robot": 1,
"startprogramid": 1,
"jobnamelist": ["xxx", "", "yyyy"]
}| Parameter | Type | Required | Description |
|---|---|---|---|
| robot | int | Yes | Robot number, range 1-4 |
| startprogramid | int | Yes | Program start ID |
| jobnamelist | array | Yes | Job file name list, 10 elements total; fill with empty string if none |
4. Set Controller Modbus Type
Command Code: 0x5711
json
{
"RTU": {
"baudrate": 115200,
"port": 2,
"slaveId": 1
},
"TCP": {
"IP": "192.168.1.11",
"port": 502
},
"master-slave": 1,
"scancycle": 100,
"stoprun": 0,
"type": "TCP"
}| Category | Parameter | Type | Required | Description |
|---|---|---|---|---|
| RTU | baudrate | string | Yes | Baud rate for Modbus RTU communication |
| RTU | port | int | Yes | Serial port number for Modbus RTU communication |
| RTU | slaveId | int | Yes | Slave device ID for Modbus RTU communication |
| TCP | IP | string | Yes | Server IP address for Modbus TCP communication |
| TCP | port | int | Yes | Port number for Modbus TCP communication |
| General | master-slave | string | Yes | Master-slave mode: 0 for master mode, 1 for slave mode |
| General | scancycle | int | Yes | Scan cycle, unit: milliseconds |
| General | stoprun | bool | Yes | Run/stop flag: 0 for not stopped, 1 for stopped |
| General | type | string | Yes | Communication type, either RTU or TCP |
5. Query Controller Modbus Type
Command Code: 0x5712
json
{}Controller response (0x5713):
json
{
"RTU": {
"baudrate": 115200,
"port": 2,
"slaveId": 1
},
"TCP": {
"IP": "192.168.1.11",
"port": 502
},
"enable": true,
"master-slave": 1,
"scancycle": 100,
"stoprun": 0,
"type": "TCP"
}| Category | Parameter | Type | Required | Description |
|---|---|---|---|---|
| RTU | baudrate | string | Yes | Baud rate for Modbus RTU communication |
| RTU | port | int | Yes | Serial port number for Modbus RTU communication |
| RTU | slaveId | int | Yes | Slave device ID for Modbus RTU communication |
| TCP | IP | string | Yes | Server IP address for Modbus TCP communication |
| TCP | port | int | Yes | Port number for Modbus TCP communication |
| General | enable | bool | Yes | Whether Modbus communication is enabled |
| General | master-slave | string | Yes | Master-slave mode: 0 for master mode, 1 for slave mode |
| General | scancycle | int | Yes | Scan cycle, unit: milliseconds |
| General | stoprun | bool | Yes | Run/stop flag: 0 for not stopped, 1 for stopped |
| General | type | string | Yes | Communication type, either RTU or TCP |
6. Controller Modbus Enable
Command Code: 0x5714
json
{
"enable": false
}| Parameter | Type | Required | Description |
|---|---|---|---|
| enable | bool | Yes | Whether to enable Modbus communication: false to disable, true to enable |
7. Set Modbus Heartbeat Detection
Command Code: 0x5715 MODBUS_CHECKHEART_SET
json
{
"checkheart": true
}| Parameter | Type | Required | Description |
|---|---|---|---|
| checkheart | bool | Yes | Modbus heartbeat detection switch |
8. Query Modbus Heartbeat Detection
Command Code: 0x5716 MODBUS_CHECKHEART_INQUIRE
json
{}Controller response (0x5717):
json
{
"checkheart": true
}| Parameter | Type | Required | Description |
|---|---|---|---|
| checkheart | bool | Yes | Modbus heartbeat detection status: true enabled, false disabled |
9. Query Whether Controller as Slave Station is Connected
Command Code: 0x5718
Request:
json
{}Response:
json
{
"ModbusConnect": false
}| Parameter | Type | Required | Description |
|---|---|---|---|
| ModbusConnect | bool | Yes | Connection status: false not connected, true connected |
10. Controller as Master Station Parameter Settings
Command Code: 0x5719
json
{
"masterStation": {
"RTU": {
"baudrate": 115200,
"checkBit": "E",
"dataBit": 5,
"port": 2,
"slaveId": 1,
"stopBit": 1
},
"TCP": {
"IP": "192.168.10.56",
"port": 503
},
"processNumber": 1,
"type": "TCP"
},
"startAddress": false
}| Category | Parameter | Type | Required | Description |
|---|---|---|---|---|
| masterStation | type | string | Yes | Communication type: RTU or TCP |
| masterStation | processNumber | int | Yes | Process number |
| masterStation.RTU | baudrate | int | Yes | Baud rate |
| masterStation.RTU | checkBit | string | Yes | Parity bit: e.g. "E" (even parity), "O" (odd parity), "N" (no parity) |
| masterStation.RTU | dataBit | int | Yes | Data bit |
| masterStation.RTU | port | int | Yes | Serial port number |
| masterStation.RTU | slaveId | int | Yes | Slave device ID |
| masterStation.RTU | stopBit | int | Yes | Stop bit |
| masterStation.TCP | IP | string | Yes | TCP server IP address |
| masterStation.TCP | port | int | Yes | TCP port number |
| General | startAddress | bool | Yes | Start address switch |
11. Query Controller Information as Master Station
Command Code: 0x5744
json
{
"processNumber": 2
}| Parameter | Type | Required | Description |
|---|---|---|---|
| processNumber | int | Yes | Process number |
12. Query Master Station Information Response
Command Code: 0x5745
json
{
"RTU": {
"baudrate": 115200,
"checkBit": "E",
"dataBit": 5,
"port": 3,
"slaveId": 56,
"stopBit": 1
},
"TCP": {
"IP": "192.168.1.14",
"port": 503
},
"modbus_state": false,
"response_time_out": 100,
"startAddress": true,
"type": "RTU"
}| Category | Parameter | Type | Required | Description |
|---|---|---|---|---|
| RTU | baudrate | int | Yes | Baud rate |
| RTU | checkBit | string | Yes | Parity bit |
| RTU | dataBit | int | Yes | Data bit |
| RTU | port | int | Yes | Serial port number |
| RTU | slaveId | int | Yes | Slave device ID |
| RTU | stopBit | int | Yes | Stop bit |
| TCP | IP | string | Yes | TCP server IP address |
| TCP | port | int | Yes | TCP port number |
| General | modbus_state | bool | Yes | MODBUS status |
| General | response_time_out | int | Yes | Response timeout, unit: milliseconds |
| General | startAddress | bool | Yes | Start address switch |
| General | type | string | Yes | Communication type: RTU or TCP |
13. Command Code Summary
| Command Code | Function | Direction |
|---|---|---|
| 0x5701 | Set Modbus program | Host PC → Controller |
| 0x5702 | Query Modbus program | Host PC → Controller |
| 0x5703 | Query Modbus program response | Controller → Host PC |
| 0x5711 | Set controller Modbus type | Host PC → Controller |
| 0x5712 | Query controller Modbus type | Host PC → Controller |
| 0x5713 | Query controller Modbus type response | Controller → Host PC |
| 0x5714 | Controller Modbus enable | Host PC → Controller |
| 0x5715 | Set Modbus heartbeat detection | Host PC → Controller |
| 0x5716 | Query Modbus heartbeat detection | Host PC → Controller |
| 0x5717 | Query Modbus heartbeat detection response | Controller → Host PC |
| 0x5718 | Query slave station connection status | Host PC → Controller |
| 0x5719 | Set master station parameters | Host PC → Controller |
| 0x5744 | Query master station information | Host PC → Controller |
| 0x5745 | Query master station information response | Controller → Host PC |