The VD2 series servo drive has Modbus communication function, which could cooperate with the host computer for parameter modification, parameter query, monitoring volume servo status query and control. The servo drive is used as a slave device.
Modbus communication
Hardware wiring
The position of RS485 communication port (take VD2B as an example) is as the figure below.
Figure 8-1 The position of RS485 communication port of VD2B drive
For the position of the RS485 communication port of other models, see 4.5 Communication signal wiring.
The servo drive adopts RS485 half-duplex communication mode. The 485 bus should adopt the hand-in-hand structure instead of the star structure or the bifurcated structure. The star structure or bifurcation structure will produce reflected signals, which will affect the 485 communication.
![]() |
✎The wiring must use shielded twisted pair, stay away from strong electricity, do not run in parallel with the power line, let alone bundle it together! ✎In a half-duplex connection, only one servo drive can communicate with the host computer at the same time. If two or more servo drives upload data at the same time, bus competition will occur. Not only will it lead to communication failure, it may also cause some components to generate large currents and damage the components. |
Figure 8-2 RS485 communication network wiring diagram
The terminal of RS485 network should use a terminating resistors of 120Ω to weaken the reflection of the signal. Intermediate networks cannot use terminating resistors.
No point in the RS485 network can be directly grounded. All devices in the network must be well grounded through their own grounding terminals.
![]() |
Under no circumstances can the grounding wire form a closed loop. |
When wiring, consider the drive capability of the computer/PLC and the distance between the computer/PLC and the servo drive. If the drive capacity is insufficient, a repeater is needed.
Modbus communication protocol analysis
Modbus data frame format
The VD2 series servo drives currently support the RTU communication format. The typical data frame format is shown in the table.
There should be a message interval not less than 3.5 characters at the beginning | Address | Function code | Data | CRC check code |
---|---|---|---|---|
1 byte | 1 byte | N bytes | 2 bytes |
Description of supported function codes
The host reads and writes data to the servo through Modbus RTU format (03, 06 function codes). The corresponding Modbus function codes are as follows:
Operate | Command code |
---|---|
Read 16-bit/32-bit function code | 0x03 |
Write 16-bit function code | 0x06 |
Write 32-bit function code | 0x10 |
Read function code: 0x03
Request format:
Address | Function code | Initial address | Number of reads | CRC check code | ||
high byte | low byte | high byte | low byte | |||
1 byte | 03 | 1 byte | 1 byte | 1 byte | 1 byte | 2 bytes |
Correct response format:
Address | Function code | Number of bytes of returned data | Register 1 | … | CRC check code | |
high byte | low byte | |||||
1 byte | 03 | 1 byte | 1 byte | 1 byte | … | 2 bytes |
Write function code: 0x06
Request format:
Address | Function code | Register address | Data | CRC check code | ||
high byte | low byte | high byte | low byte | |||
1 byte | 06 | 1 byte | 1 byte | 1 byte | 1 byte | 2 bytes |
Response format:
Address | Function code | Register address | Data | CRC check code | ||
high byte | low byte | high byte | low byte | |||
1 byte | 06 | 1 byte | 1 byte | 1 byte | 1 byte | 2 bytes |
If the setting is successful, the original is returned
There should be a message interval not less than 3.5 characters at the beginning | Address | Function code | Data | CRC check code |
1 byte | 1 byte | N bytes | 2 bytes |
CRC check
The servo uses a 16-bit CRC check, and the host computer must also use the same check rule, otherwise the CRC check will make mistake. When transmitting, the low bit is in the front and the high bit is at the back. The CRC code are as follows:
Uint16 crc = 0xffff;
Uint16 i;
while(uLen--)
{
crc ^=(Uint16) *pBuf++;
for(i=0; i<8; i++)
{
if(crc & 0x0001)
{
crc = (crc >> 1) ^ 0xa001;
}
else
{
crc = crc >> 1;
}
}
}
return crc;
}
return crc;
}
Error response frame
Address | Function code | Error code | CRC check code |
---|---|---|---|
1 byte | Command code+0x80 | Error code | 2 bytes |
When an error occurs, set the function code bit7 issued by the host to 1, and return (for example, 0x03 returns 0x83, 0x06 returns 0x86); the description of the error code are as follows.
Error code | Coding description |
---|---|
0x0001 | Illegal command code |
0x0002 | Illegal data address |
0x0003 | Illegal data |
0x0004 | Slave device failure |
Communication example
03 Function code read
Read the monitoring volume U0-31 bus voltage, the Modbus register address corresponding to this variable is 7716 (0x1E24)
Request format:
Address | Function code | Register address | Data | CRC check code | ||
high byte | low byte | high byte | low byte | |||
01 | 03 | 1E | 24 | 00 | 01 | C2 29 |
The slave responds normally:
Address | Function code | Number of bytes | Data | CRC high byte | |
high byte | low byte | ||||
01 | 03 | 02 | 0C | 4F | FC B0 |
For example: The value read is 0x0C4F, which means that the voltage is 315.1V.
06 Function Code Write
P1-10 the maximum speed threshold is set to 3000rpm. This variable corresponds to the Modbus address: 266 (0x010A)
Request format:
Address | Function code | Register address | Data | CRC check code | ||
high byte | low byte | high byte | low byte | |||
01 | 06 | 01 | 0A | 0B | B8 | AF, 76 |
The slave responds normally:
Address | Function code | Register address | Data | CRC check code | ||
high byte | low byte | high byte | low byte | |||
01 | 06 | 01 | 0A | 0B | B8 | AF, 76 |
10 Function code write
P07-09 set the 1st segment position to 2000, and this variable corresponds to the Modbus address: 1801 (0x0709).
Request format:
Address | Function code | Initial address | Number of register | Number of data | Data 1 | Data 2 | CRC check code | |||||
high byte | low byte | high byte | low byte | high byte | low byte | high byte | low byte | high byte | low byte | |||
01 | 10 | 07 | 09 | 00 | 02 | 04 | 00 | 00 | 07 | D0 | 16 | 59 |
The slave responds normally:
Address | Function code | Register address | Data | CRC check code | |||
high byte | low byte | high byte | low byte | high byte | low byte | ||
01 | 10 | 07 | 09 | 00 | 02 | 90 | BE |
Servo communication parameter setting
Figure 8-3 Modbus communication parameter setting process
Set the servo address P12-1
When multiple servos are in network communication, each servo can only have a unique address, otherwise it will cause abnormal communication and fail to communicate.
Set the serial port baud rate P12-2
The communication rate of the servo and the communication rate of the host computer must be set consistently, otherwise the communication cannot be carried out.
Set the serial port data format P12-3
The data bit check methods of servo communication are:
- Odd parity
- Even parity
- No parity
- The stop bit: 1 stop bit and 2 stop bits.
The data frame format of the servo and the host computer must be consistent, otherwise the communication cannot be carried out.
Set that whether the function code changed by Modbus communication is written into EEPROM in real time [P12-4]
When the host computer modifies the servo function code through communication, it can choose to store it in EEPROM in real time, which has the function of power-off storage.
If the value of the function code only needs to be rewritten once, and the value is used later, the function of real-time writing of the function code to EEPROM can be enabled.
If you need to change the value of the function code frequently, it is recommended to turn off the function of real-time writing to EERPOM of function code, otherwise the EEPROM will be shortened due to frequent erasing and writing of the EEPROM.
![]() |
After the EEPROM is damaged, the servo will have an non resettable fault! |
Set the high and low order of the 32-bit monitoring data
Part of the monitoring volume is 32-bit length and occupies 2 consecutive bias numbers. The user needs to set the order of the data high bit and low bit correctly, otherwise it will cause data reading and writing errors!
For example, U0-54 (position within 1 circle of absolute encoder) occupies two consecutive offset numbers, which are 0x1E3D and 0x1E3E respectively. Assuming the value of U0-54 is 0x12345678, the correct data sequence bit should be 0x1E3D=0x5678 , 0x1E3E=0x1234 (little endian mode: low byte first, high byte behind.)
The description of related function codes are as follows.
Function code | Name | Setting method | Effective time | Default value | Range | Definition | Unit |
---|---|---|---|---|---|---|---|
P12-02 | Baud rate | Operation setting | Effective immediately | 2 | 0 to 5 |
| - |
P12-03 | Serial data format | Operation setting | Effective immediately | 0 | 0 to 3 |
| - |
P12-04 | Modbus communication data is written into EEPROM | Operation setting | Effective immediately | 0 | 0 to 1 |
| - |
Modbus communication variable address and value
Variable address description
Modbus registers are divided into two categories:
- The first category is servo function code parameters (address: 0x0001 to 0x0D08), this part of the register is readable and writable (that is, 0x03 and 0x06 are supported);
- The second category is the monitoring volume of the servo (address: 0x1E01 to 0x2010), this part of the register is only readable (0x03 function is supported).
Servo function code representation: PXX-YY.
- XX: represents the function code group number,
- YY: represents the bias within the function code group;;
During servo communication, the communication address of the function code is a 16-bit address, which is composed of the function code group number (high 8 bits) + group bias (low 8 bits), for example, the Modbus address corresponding to P12-1 (servo address) is 0x0C01.
Servo monitor volume representation: Uxx-yy.
- xx: represents the monitoring volume group number,
- yy: represents the bias within the monitoring volume group;
During Modbus communication, the starting address of the monitoring volume is 0x1E01, and the conversion relationship of the address is similar to the representation way of the function code.
For example, U0-01 (servo status) corresponds to the Modbus address is 0x1E01.
In order to facilitate actual use, this manual provides both decimal and hexadecimal address identification, it is shown in the following table:
Function code | Modbus address (Hexadecimal) | Modbus address (Decimal) | Category | Name |
---|---|---|---|---|
P0-1 | 0x0001 | 1 | Basic settings | Control mode |
For detailed parameter addresses, please refer to "11.1 Lists of parameters".
Variable value type description
When writing function codes with signed numbers, you need to convert the pre-written data into hexadecimal complements. The conversion rules are as follows:
- The data is positive or 0: complement code = original code
- The data is negative: complement code = 0xFFFF-absolute value of data + 0x0001
For example:
- The 16-bit signed positive number +100, the original code is 0x0064, and the complement is: 0x0064.
- The 16-bit signed positive number -100, its hexadecimal complement is: 0xFFFF-0x0064 + 0x0001 = 0xFF9C.
- If it is an unsigned number, just pass it directly according to its original code. For example, if the decimal number is 32768, write 0x8000 directly.
Numerical unit description
Some values have units and decimals, such as 0.1%, 0.1Hz, 0.01ms, and the corresponding value conversion is required when reading and writing. The methods are as follows:
- When the unit is 0.1%: 1 represents 0.1%, 10 represents 1.0%, 1000 represents 100.0%. Therefore, writing 1000 means setting to 100.0%; on the contrary, if it is reading 1000, it means that the value is 100.0%;
- When the unit is 0.01ms: 1 means 0.01ms, 50 means 0.5ms, 10000 means 100ms. Therefore, writing 1000 means setting to 10.00ms; on the contrary, if 1000 is read, it means 10.00ms;
The other units can be deduced by this, and integer remains unchanged.