8. Appendix - UFACTORY Private TCP Control
Modbus TCP is an application-layer messaging protocol with three frame types: ASCII, RTU, and TCP. Standard Modbus interfaces include RS232, RS422, RS485, and Ethernet, using master/slave communication.
Gripper G2 uses the UFACTORY Private TCP protocol, which is similar to but not identical with standard Modbus TCP.
Private TCP communication process:
- Establish TCP connection
- Prepare Private TCP message
- Send message using send command
- Wait for response on same connection
- Read response using recv command to complete data exchange
- Close TCP connection when communication task ends
Parameters: Default TCP port: 502
Protocol ID: 0x00 0x02 (control - currently only this ID)
All data parsing in this section uses big-endian format.
8.1 Read Registers
Read Registers | |||
---|---|---|---|
Request Format | |||
Modbus TCP Header | Transaction ID | 2 Bytes | 0x00, 0x01 |
Protocol ID | 2 Bytes | 0x00, 0x02 | |
Length | 2 Bytes | 0x00, 0x08 | |
Register | 1 Byte | 0x7C | |
Parameters | Status | 1 Byte | 0x00 |
Internal Use | Host ID | 1 Byte | 0x09 |
Modbus RTU Data | Gripper ID | 1 Byte | 0x08 |
Function Code | 1 Byte | 0x03 | |
Start Address | 2 Bytes | Address | |
Register Count | 2 Bytes | N* | |
Response Format | |||
Modbus TCP Header | Transaction ID | 2 Bytes | 0x00, 0x01 |
Protocol ID | 2 Bytes | 0x00, 0x02 | |
Length | 2 Bytes | 6+N*x2 | |
Register | 1 Byte | 0x7C | |
Status | 1 Byte | 0x00 | |
Internal Use | Host ID | 1 Byte | 0x09 |
Modbus RTU Data | Gripper ID | 1 Byte | 0x08 |
Function Code | 1 Byte | 0x03 | |
Byte Count | 1 Byte | N*x2 | |
Register Values | Nx2 Bytes | Value |
Note: N* = Register count
8.2 Write Registers
Write Registers | |||
---|---|---|---|
Request Format | |||
Modbus TCP Header | Transaction ID | 2 Bytes | 0x00, 0x01 |
Protocol ID | 2 Bytes | 0x00, 0x02 | |
Length | 2 Bytes | 9+Nx2 | |
Register | 1 Byte | 0x7C | |
Internal Use | Host ID | 1 Byte | 0x09 |
Modbus RTU Data | Gripper ID | 1 Byte | 0x08 |
Function Code | 1 Byte | 0x10 | |
Start Address | 2 Bytes | Address | |
Register Count | 2 Bytes | N* | |
Byte Count | 1 Byte | N*x2 | |
Register Values | N*x2 Bytes | Value | |
Response Format | |||
Modbus TCP Header | Transaction ID | 2 Bytes | 0x00, 0x01 |
Protocol ID | 2 Bytes | 0x00, 0x02 | |
Length | 2 Bytes | 0x00, 0x09 | |
Register | 1 Byte | 0x7C | |
Parameters | Status | 1 Byte | 0x00 |
Internal Use | Host ID | 1 Byte | 0x09 |
Modbus RTU Data | Gripper ID | 1 Byte | 0x08 |
Function Code | 1 Byte | 0x10 | |
Start Address | 2 Bytes | Address | |
Register Count | 2 Bytes | N* |
8.3 Private TCP Examples
- Enable gripper. Address (0x0100)
Tx: 00 01 00 02 00 0B 7C 09 08 10 01 00 00 01 02 00 01
Rx: 00 01 00 02 00 09 7C 00 09 08 10 01 00 00 01
- Set gripper position to 400. Address (0x0700)
Tx: 00 01 00 02 00 0D 7C 09 08 10 07 00 00 02 04 00 00 01 90
Rx: 00 01 00 02 00 09 7C 00 09 08 10 07 00 00 02
- Read error code. Address (0x000F)
Tx: 00 01 00 02 00 08 7C 09 08 03 00 0F 00 01
Rx: 00 01 00 02 00 08 7C 30 09 08 03 02 00 00
- Set gripper enable, position(850), speed(3000), force(50). Address (0x0Cxx)
Tx: 00 01 00 02 00 11 7C 09 08 10 0C 00 00 05 0A 00 01 0B B8 00 32 03 52
Rx: 00 01 00 02 00 09 7C 30 09 08 10 0C 00 00 05