Difference between revisions of "CanServo/Protocol/Control/en"
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
| Line 1: | Line 1: | ||
CAN servo is controlled by sending CAN packets with CAN ID set in Register [[CanServo/ID2/en]] and data following the message format below.  | CAN servo is controlled by sending CAN packets with CAN ID set in Register [[CanServo/ID2/en]] and data following the message format below.  | ||
According to the message type ( write, read, etc ) of CAN Data, the register containing servo operation data can be changed or read.  | According to the message type ( write, read, etc, first byte in data part ) of CAN Data, the register containing servo operation data can be changed or read.  | ||
* As a simple example, when the following packet is sent, all received servos change the value of Register 0x30 to 0x1234.  | * As a simple example, when the following packet is sent, all received servos change the value of Register 0x30 to 0x1234.  | ||
** CAN ID = 0  | ** CAN ID = 0  | ||
Revision as of 17:18, 20 September 2021
CAN servo is controlled by sending CAN packets with CAN ID set in Register CanServo/ID2/en and data following the message format below. According to the message type ( write, read, etc, first byte in data part ) of CAN Data, the register containing servo operation data can be changed or read.
- As a simple example, when the following packet is sent, all received servos change the value of Register 0x30 to 0x1234.
- CAN ID = 0
 - CAN DATA = 'w', 0, 0x30, 0x34, 0x12
 - DLC = 5
 
 
There are 11 types of messages in 8 data bytes of CAN Packet, 3 old types and 8 new types.
The first byte indicates the kind of message.
The second byte is the servo ID.
Here, Target Servo ID must match the value of CanServo/ID1/en of Servo.
Or if 0 is specified, all servos will react.
For the exact procedure, refer to CanServo/Packet Accept Rule/en.
V0: Old Format:
- Old Write Command
- write 1 register
- 0x96, (target servo id), (address), 2, (data low byte), (data high byte), (chksum)
 - DLC = 7
 
 
 - write 1 register
 
- Old Read Command
- read 1 register
- 0x96, (target servo id), (address), 0, (chksum)
 - DLC = 5
 
 
 - read 1 register
 
- Old Return Message
- return 1 register
- 0x69, (servo id), (address), 2, (data low byte), (data high byte), (chksum)
 - DLC = 7
 
 
 - return 1 register
 
- Old message's chksum
- add all bytes before chksum, except first byte
 
 
V1: New Format: (checksum removed)
- Write Command
- write 1 register
- 'w', (target servo id), (address), (data low byte), (data high byte)
 - DLC = 5
 
 - write 2 registers
- 'W', (target servo id), (address 0), (data 0 low byte), (data 0 high byte), (address 1), (data 1 low byte), (data 1 high byte)
 - DLC = 8
 
 
 - write 1 register
 
- Read Command
- read 1 register
- 'r', (target servo id), (address)
 - DLC = 3
 
 - read 2 registers
- 'R', (target servo id), (address 0), (address 1)
 - DLC = 4
 
 
 - read 1 register
 
- Write and Read Command
- write and read: 1 register
- 'x', (target servo id), (address), (data low byte), (data high byte)
 - DLC = 5
 
 - write and read: 2 registers
- 'X', (target servo id), (address 0), (data 0 low byte), (data 0 high byte), (address 1), (data 1 low byte), (data 1 high byte)
 - DLC = 8
 
 
 - write and read: 1 register
 
- Return Message : Servo --> Host
- return 1 register
- 'v', (servo id), (address), (data low byte), (data high byte)
 - DLC = 5
 
 - return 2 registers
- 'V', (servo id), (address 0), (data 0 low byte), (data 0 high byte), (address 1), (data 1 low byte), (data 1 high byte)
 - DLC = 8
 
 
 - return 1 register