|
Encoder Free Protocol
Baud rate: 4800bps, 9600bps, 19200bps, 38400bps, 57600bps, 115200bps
Default baud rate 115200bps
When there is no verification, the data bit is 8 bits and the stop bit is 1 bit.
When performing odd or even parity, the data bit is 9 bits and the stop bit is 1 bit, with the 9th bit of the data bit being the parity bit
1Active Mode
In active mode, the encoder sends data to the upper computer at regular intervals, with a fixed length of 13 bytes. The structure is as follows:
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
frame header |
Encoder address |
delimiter |
Current position value of encoder |
end of frame |
frame Head: Fixed as the character '@', ASCII code value is 0x40
Encoder address: 2-byte string display, valid range 1~99, default is 01
divide partition Symbol: Fixed as character '#', ASCII code value is 0x23
Encoder current position value: Display of 8-byte string
frame Tail: Fixed as a space character, ASCII code value is 0x20
|
Example data frame displayed in hexadecimal format
40 30 31 23 30 30 31 32 33 34 35 36 20
|
Convert to decimal and display as
@01#00123456(space)(Note:(space) representsSpace symbol, not actually displayed)
|
Explanation: Encoder address 1, current position value 123456 |
In active mode, the data transmission interval is related to the baud rate.
Baud rate |
sending interval |
Sending frames takes up time |
4800bps |
35ms |
≈25ms |
9600bps |
25ms |
≈13ms |
19200bps |
20ms |
≈7ms |
38400bps |
15ms |
≈4ms |
56700bps |
15ms |
≈3ms |
115200bps |
10ms |
≈2ms |
2passive mode
2.1 Sending commands from the upper computer
The passive mode upper computer sends instructions with a fixed length of 14 bytes, and the frame structure is as follows
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
frame header |
address |
command |
parameter |
parameter value |
end of frame |
frame Head: Fixed as the character '@', ASCII code value is 0x40
Encoder address: 2-byte string display, valid range 1~99, default is 01
fate order Code: 0-Read encoder position; 1. Read encoder parameters; 2- Write encoder parameters
ginseng Number: The number of the parameter to be operated on during reading and writing, in uppercase letters, as shown in the parameter table. When the command code is 0, this byte can be any value.
ginseng number Value: Write the specific value of the parameter as an 8-byte string, valid when the command code is 2, and can be any value when the command is 0 or 1.
frame Tail: Fixed as a space character, ASCII code value is 0x20
|
Example Setting Address Data Frame hexadecimal Display
40 30 31 32 41 30 30 30 30 30 30 39 39 20
|
Convert to decimal and display as
@012A00000099(space)(Note:(space) representsSpace symbol, not actually displayed)
|
@ |
01 |
2 |
A |
00000099 |
Fixed frame header |
current
equipmentaddress
|
Settings
parameter value
|
Parameter number, indicating the address of the slave device |
Settings
New values for parameters
|
|
Explained as:Send a command to modify the device address to the encoder with address 1 and set a new location
Address is 99
|
2.2 Encoder Return Command
The return data format varies depending on the command code.
When the command code is 0, the returned data format is the same as the active mode data frame.
When the command is 1 or 2, the return data format is the same.
The instruction with a fixed data length of 13 bytes has the following frame structure:
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
frame header |
address |
parameter |
parameter value |
end of frame |
frame Head: Fixed as the character '@', ASCII code value is 0x40
Encoder address: 2-byte string display, valid range 1~99, default is 01
ginseng Number: The parameter numbers are detailed in the parameter table
ginseng number Value: The specific value of the parameter is represented by an 8-byte string
frame Tail: Fixed as a space character, ASCII code value is 0x20
|
Example setting address returns data frame displayed in hexadecimal format
40 30 31 41 30 30 30 30 30 30 39 39 20
|
Convert to decimal and display as
@01A00000099(space) (Note:(space) representsSpace symbol, not actually displayed)
|
@ |
01 |
A |
00000099: |
|
Fixed frame header
|
Current device address |
Parameter number, indicating the address of the slave device |
Set new values for parameters |
2.3 Parameter Table
Parameter Number |
functionInstructions |
match place say bright |
A |
Device slave address |
1~99 |
B |
Communication baud rate |
0
│
4800
|
1
│
9600
|
2
│
19200
|
3
│
38400
|
4
│
57600
|
5
│
115200
|
C |
check digit |
0-No verification |
1-odd parity |
2-even parity |
D |
Protocol Type |
1-Active agreement |
2-Passive protocol |
3-MODBUS |
E |
Single/Multiple Loop Mode |
0- Single Loop Mode |
1- Multi cycle mode |
F |
Reciprocating/cyclic mode |
0- reciprocating mode |
1- Loop mode |
G |
Rotation method |
0- Clockwise |
1- Counter clockwise |
H |
Single cycle resolution |
1~4096 |
I |
Analog output module resolution |
0-12 digits |
1-16 bits |
J |
Output current upper limit value |
20mA reference value |
12 digits: 3775 |
16 digits: 52416 |
K |
Lower limit value of output current |
4mA reference value |
12 digits: 655 |
16 digits: 10483 |
L |
Loop position value |
1~16777216
|
M |
Reciprocating position value |
N |
Corresponding position value of current output upper limit |
O |
Position value corresponding to the lower limit of current output |
0~16777216 |
P |
Set value |
When writing, the encoder zeros and positions |
Encoder MODBUS protocol
This agreement uses MODBUS-RTU format
When there is no verification, data bit 8 and stop bit 1
When performing odd or even parity, data bit 9 stops at 1, where the 9th bit of the data bit is the parity bit
When the encoder is in normal mode, only command code 0x03 read register operation is supported
When in programming mode, it supports command codes 0x06 and 0x10 to write register operations
All types of data are read with high bits first and low bits second
|
Example of angle reading instruction
Sending data:01 03 00 15 00 02 D5 CF
|
Note: |
command |
01 |
03 |
00 15 |
00 02 |
D5 CF |
explanation |
address |
read operation |
40022
position
|
Read two in a row
register
|
CRC check |
Return data: 01 03 04 00 00 02 E7 BB 19 |
Note: |
command |
01 |
03 |
04 |
00 00 02 E7 |
BB 19 |
explanation |
address |
read operation |
data length |
data |
CRC check |
Parameter table:
register address |
Variable Description |
data type |
match place say bright |
40001 |
Device slave address |
32-bit
unsigned
Long integer
|
1~99 |
40002 |
Communication baud rate |
0
│
4800
|
1
│
9600
|
2
│
19200
|
3
│
38400
|
4
│
57600
|
5
│
115200
|
40003 |
check digit |
0- No verification |
1- Odd verification |
2- Even verification |
40004 |
Protocol Type |
1- Active Protocol |
2- Passive Protocol |
3 – MODBUS |
40005 |
Single/Multiple Loop Mode |
0- Single Loop Mode |
1- Multi cycle mode |
40006 |
Reciprocating/cyclic mode |
0- reciprocating mode |
1- Loop mode |
40007 |
Rotation method |
0- Clockwise |
1- Counter clockwise |
40008 |
Single cycle resolution |
1~4096 |
40009 |
Analog output module resolution |
0-12 digits |
1-16 bits |
40010 |
Output current upper limit value |
20mAcalibrationreference value |
12 digits: 3276 |
16 digits: 52416 |
40011 |
Lower limit value of output current |
4mAcalibrationreference value |
12 digits: 655 |
16 digits: 10483 |
40012 |
Loop position value |
1~16777216
|
40013 |
40014 |
Reciprocating position value |
40015 |
40016 |
Corresponding position value of current output upper limit |
40017 |
40018 |
Position value corresponding to the lower limit of current output |
0~16777216 |
40019 |
40020 |
Set value |
When writing, the encoder zeros and positions |
40021 |
40022 |
Current position value of encoder |
read-only |
40023 |
|