LC Drive MODBUS User Guide
LC Drive MODBUS User Guide
0 Dated: 020719
UM_MODBUS_v1.0 Dated: 020719
Contents
MODBUS Communications: .................................................................................................................... 3
Modbus Protocol Overview: ............................................................................................................... 3
Read Parameter: ............................................................................................................................. 3
Write Parameter (Single Register): ................................................................................................. 3
Write Parameter (Multiple Register): ............................................................................................. 4
Read Single Bit Parameter (Coil): .................................................................................................... 4
Write Single Bit Parameter (Relay): ................................................................................................ 4
Single Register Parameters: .................................................................................................................... 5
CONNECT/DISCONNECT COMMAND : ................................................................................................ 6
SLAVE ADDRESS: ................................................................................................................................. 7
MICROSTEP ......................................................................................................................................... 7
PITCH ................................................................................................................................................... 8
CURRENT ............................................................................................................................................. 8
ACC: ..................................................................................................................................................... 9
DCC:................................................................................................................................................... 10
BAUDRATE:........................................................................................................................................ 11
Single register Commands: ................................................................................................................... 12
SET_HOME_POSITION:...................................................................................................................... 12
START: Start ...................................................................................................................................... 13
HOLD: Hold........................................................................................................................................ 13
RELEASE: Release .............................................................................................................................. 14
SET_DEFAULT_CODE: ........................................................................................................................ 14
Multiple register Write (commands): ................................................................................................... 15
RUN: .................................................................................................................................................. 15
MOVE: ............................................................................................................................................... 16
GO_HOME: ........................................................................................................................................ 17
Auto cycle programming: ...................................................................................................................... 17
AUTO_CYCLE: .................................................................................................................................... 20
Single Bit value Write registers : ........................................................................................................... 23
UM_MODBUS_v1.0 Dated: 020719
MODBUS Communications:
Modbus Protocol Overview:
Stepper Motor Drive Configuration and Control can also be done from remote
location via MODBUS communication. Following sub-sections describe the MODBUS function
codes used and, addresses for each parameter for display and configuration.
The Configured parameters can only be read from the PC application using function code
0x03, and modified using function code 0x06 for single 16 bit register value and for Modify/Write
more than one register Multiple register value using function code 0x10 .
When Motor drive run in Auto cycle Mode Input relays are used to control cycle start stop
these are single bit values. So that to modify switch status function code 0x05. For each cycle state
(start at and stop at) output coils status is read by using function code 0x01.
By Default Values:
Slave ID=0x01
Baud rate= 19200 bits/sec
Parity bit= none
Stop bit=1
Read Parameter:
Function Code 0x03(Read Holding Registers)
Request
Function code 1 Byte 0x03
Starting Address 2 Bytes 0x0000 to 0xFFFF
Quantity of Registers 2 Bytes 1 to 125
Response
Function code 1 Byte 0x03
Byte count 1 Byte 2 x N*
Register value *N x 2 Bytes N Data
*N = Quantity of Registers
Error
Error code 1 Byte 0x86
Exception code 1 Byte 01 or 02 or 03 or 04
For configuration parameters exception code 03 indicate that the data send is out of the
boundary limit.
Response
Function code 1 Byte 0x06
Starting Address 2 Bytes 0x0000 to 0xFFFF
Register Value (Data) 2 Bytes 0x0000 to 0xFFFF
UM_MODBUS_v1.0 Dated: 020719
Error
Error code 1 Byte 0x86
Exception code 1 Byte 01 or 02 or 03 or 04
For configuration parameters exception code 03 indicate that the data send is out of the
boundary limit.
Response
Function code 1 Byte 0x10
Starting Address 2 Bytes 0x0000 to 0xFFFF
Quantity of Registers 2 Bytes 1 to 123 (0x7B)
Error
Error code 1 Byte 0x90
Exception code 1 Byte 01 or 02 or 03 or 04
Here is an example of a request to write two registers starting at 2 to 00 0A and 01 02 hex:
Response
Function code 1 Byte 0x01
Byte count 1 Byte 2 x N*
Coil Status n Byte n = N or N+1
*N = Quantity of Outputs / 8, if the remainder is different of 0 => N = N+1
Error
Error code 1 Byte Function code + 0x80
Exception code 1 Byte 01 or 02 or 03 or 04
Write Single Bit Parameter (Relay):
Function Code 0x05
Request
Function code 1 Byte 0x05
Starting Address 2 Bytes 0x0000 to 0xFFFF
Output Value 2 Bytes 0x0000 or 0xFF00
UM_MODBUS_v1.0 Dated: 020719
Response
Function code 1 Byte 0x05
Starting Address 2 Bytes 0x0000 to 0xFFFF
Output Value 2 Bytes 0x0000 or 0xFF00
Error
Error code 1 Byte 0x85
Exception code 1 Byte 01 or 02 or 03 or 04
0x02:ODD
0x00: 1 stop bit
MB_Stop_Bit
Stop Bit 0x03 1 0x00 0 to 2 0x01: 2 Stop bit
(W)
0x02: 1.5 Stop bit
MB_TVAL_RU
Current 0x12 1 0x29 0 to 127
N
(WR) Used to set Current.
MB_STEP_MO Set Micro steps Full step,
Microstep 0x1A DE 1 0x07 1,2,4,8,16 Half steps, 1/4th steps,
(WR) 1/16th steps.
Pitch Value is always
MB_PITCH
Pitch 0x22 1 0x0000 100*100 multiplied by 100 to give
(WR)
value in integer format
Primary MB_PRIMARY If Motor has gear box set
0x23 1 0x0001
Gears _GEAR(WR) 1 to 500 gear ratio (Primary value)
MB_SECOND If Motor has gear box set
Secondary
0x24 ARY_GEAR(W 1 0x0001 1 to 500 gear ratio (Secondary
Gears
R) Value)
Auto Cycle 0x01B OUTPUT 1 0x00 0 : OFF Bit 0: O/P1
Outputs B STATUS 1 : ON Bit 1: O/P2
(R) Bit 2: O/P3
Bit 3: O/P4
Bit 4: O/P5
Bit 5: O/P6
Bit 6: O/P7
Bit 7: O/P8
Note : R- Read Only, W- Write Only, WR- Write read Both.
CONNECT/DISCONNECT COMMAND :
This command is used to connect device to Modbus. For 0x00 disconnect and for 0x01 connect.
SLAVE ADDRESS:
The following command is used to change the slave address (Device ID).
In this for Broadcast id 0 (Zero) used to send command to all devices connected over
MODBUS. It has limitation that for broadcast address there will be no any response. So PC
application does get any information about device that device is connected or not.
In broadcast mode we can’t send some parameter, which are definite for particular
device like Micro-steps, current, Gear ratio etc.
MICROSTEP
This command is used to set micro-steps. Micro-steps can be read by using function code 0x03.
And to write micro-step function code is 0x06.
PITCH
This command is used to set Pitch value. Pitch value can be read by using function code
0x03. And write by using 0x06.
CURRENT
This command is used to set Current. Current can be read by using function code
0x03. And write by using 0x06. The current value is Hex code value not current in ampere
selected from application drop down current list.
2Amp Drive:
Current in Ampere Hex Code
0.25 0x07
0.40 0x0C
0.50 0x0F
0.60 0x13
0.75 0x17
0.85 0x1B
1.00 0x1F
UM_MODBUS_v1.0 Dated: 020719
1.20 0x26
1.33 0x2A
1.50 0x2F
1.70 0x36
1.80 0x39
2.00 0x3F
4.5Amp Drive:
Current in Ampere Hex Code
0.50 0x06
1.00 0x0C
1.50 0x13
1.70 0x15
2.00 0x19
3.00 0x26
3.20 0x29
3.50 0x2C
4.00 0x33
4.50 0x39
6Amp Drive:
Current in Ampere Hex Code
2.00 0x19
2.50 0x20
3.00 0x26
3.50 0x2C
4.00 0x33
4.50 0x39
5.00 0x40
5.50 0x46
6.00 0x4D
6.50 0x53
ACC:
This command is used to set Acceleration. Acceleration can be read by using function
code 0x03. And write by using 0x06. Acceleration value is multiplied by 10 as float value
required more number of bytes.
UM_MODBUS_v1.0 Dated: 020719
E.g: Suppose, for speed 100 rpm with ACC of 0.1 sec with 2 microstep
Range of acceleration is 14.55 to 59590 step/s2 with resolution of 14.55 step/s2 for
LC- Drive. If the for combination of speed, Micro-step and acceleration time will set
acceleration to maximum value 0x0FFF.
But we give acceleration in terms Time to reach desired speed from zero speed. Unit
of time is second. The range of values of acceleration in Time is 0 to 9.9 sec.
Note:
Command: 01, 06, 00, 0C, 00, 01
01 -> Slave Address
06* -> Function Code
00* -> LSB Address of Holding Register
0C* -> MSB Address of Holding Register
00, 01-> ACC value
(* indicates these values are fixed)
DCC:
This command is used to set deceleration. Deceleration can be read by using function
code 0x03. And write by using 0x06. Deceleration value is multiplied by 10 as float value
required more number of bytes.
BAUDRATE:
This command is used to set or to Change Baud rate.
BR :
BR VALUE (BPS)
0x00 1200
0x01 1800
0x02 2400
0x03 4800
0x04 7200
0x05 9600
0x06 19200
0x07 38400
0x08 57600
0x09 72000
0x0A 115200
0x0B 128000
OPCODE: OPCODE gives types of operation have to perform on the drive. Following table
specifies values of OPCODE.
Command OPCODE
RUN 0x01
MOVE 0x02
GO_HOME 0x03
SET HOME 0x04
START 0x05
STOP 0x06
HOLD 0x07
RELEASE 0x08
SET_DEFAULT_CODE 0x0A
SET_HOME_POSITION:
This is command to drive to set home position. For command holding register address
is same. But command op-code for set home position is 0x04.
Slave Address Function Code Holding ADDR Op-Code
0x01 0x06 0x0025 0x0004
Command: 01, 06, 00,25,00,04
01 -> Slave Address
06* -> Function Code
00* -> LSB Address of Holding Register
25* -> MSB Address of Holding Register
00, 04* -> Op-code for SET_HOME position
(* indicates these values are fixed)
START: Start
This is command to drive to start Motor. For command holding register address is
same. But command op-code for motor start is 0x05.
Slave Address Function Code Holding ADDR Op-Code
0x01 0x06 0x0025 0x0005
STOP: Stop
This is command to drive to staop Motor. For command holding register address is
same. But command op-code for motor stop is 0x06.
Slave Address Function Code Holding ADDR Op-Code
0x01 0x06 0x0025 0x0006
HOLD: Hold
This is command to drive to Hold Motor. For command holding register address is
same. But command op-code for motor hold is 0x07.
Slave Address Function Code Holding ADDR Op-Code
0x01 0x06 0x0025 0x0007
RELEASE: Release
This is command to drive to Release Motor. For command holding register address is
same. But command op-code for motor release is 0x08.
Slave Address Function Code Holding ADDR Op-Code
0x01 0x06 0x0025 0x0008
SET_DEFAULT_CODE:
This command is used in Auto cycle programming. When program is send to device
then by sending this command we can set sent auto cycle program as default program for device.
Holding register address is same. But command op-code for motor start is 0x0A.
Operational Commands:
RUN:
Parameters Passed: unit of speed, Speed, Direction.
Slave Function Holding QTY of Byte Op-Code Data
Address Code ADDR Register Count
0x01 0x10 0x0025 0x0003 0x06 0x01 DIR Unit of Speed
Speed
Note:
Unit of Speed:
Unit of Speed VALUE
0x00 RPM
0x01 RPH
0x02 MM_PER_SEC
SPEED: Ranges from 5 to 4780 RPM.(Rotary Mode)
Ranges from 5 to 4780 RPM.(Linear Mode)
DIR :
DIR VALUE
0x00 Clockwise
0x01 Counter clockwise
Example:
Command : 01,10,00,25,00,03,06,01,00,00,00,00,C8
01 -> Slave Address
10* -> Function Code
00* -> LSB Address of Holding Register
25* -> MSB Address of Holding Register
00, 03* -> Quantity of registers to be write in holding register
UM_MODBUS_v1.0 Dated: 020719
Response: 01,10,00,25,00,03
MOVE:
Parameters Passed: unit of speed, Speed, Direction, Movement type, Number of steps.
Slave Function Holding QTY of Byte Op-Code Data
Address Code ADDR Register Count
0x01 0x10 0x0025 0x0005 0x0A 0x02 DIR and Unit of Speed No. of
Movement Speed Steps
Type
Note:
No. of Steps: 0 to 4194303 value
Unit of Speed:
Unit of Speed VALUE
0x00 RPM
0x01 RPH
0x02 MM_PER_SEC
SPEED: Ranges from 5 to 4780 RPM.(Rotary Mode)
Ranges from 5 to 4780 RPM.(Linear Mode)
DIR :
DIR VALUE
0x00 Clockwise
0x01 Counter clockwise
Example:
Command : 01,10,00,25,00,05,0A,02,0C,00,00,00,C8,00,00,01,90
01 -> Slave Address
10* -> Function Code
00* -> LSB Address of Holding Register
25* -> MSB Address of Holding Register
00, 05* -> Quantity of registers to be write in holding register
0A* -> Total Byte count to be write in move command
02* -> Op-Code for MOVE command
0C -> Counter clockwise direction with movement type of Step input
00 -> Speed is in RPM
00, 00, C8 -> total Speed value that is 200 rpm
00,00,01,90 -> No. of steps (400 steps)
(* indicates these values are fixed)
Response: 01,10,00,25,00,05
UM_MODBUS_v1.0 Dated: 020719
GO_HOME:
Parameters Passed: unit of speed, Speed
Slave Function Holding QTY of Byte Op-Code Data
Address Code ADDR Register Count
0x01 0x10 0x0025 0x0003 0x06 0x03 n0x00 Unit of Speed
Speed
Note:
Unit of Speed:
Unit of Speed VALUE
0x00 RPM
0x01 RPH
0x02 MM_PER_SEC
Example:
Command : 01,10,00,25,00,03,06,03,00,00,00,C8
01 -> Slave Address
10* -> Function Code
00* -> LSB Address of Holding Register
25* -> MSB Address of Holding Register
00, 03* -> Quantity of registers to be write in holding register
06* -> Total Byte count to be write in run command
03* -> Op-Code for GO_HOME command
00 -> Speed is in RPM
00, 00, C8 -> total Speed value that is 200 rpm
(* indicates these values are fixed)
Response: 01,10,00,25,00,03
The following table give the message format for auto cycle programming. This
message used to send one auto cycle program. We can send one by one cycle program to
device.
UM_MODBUS_v1.0 Dated: 020719
Go-Home : Ignore
Byte 12 : Stop At Relay
bit 0 :
0 Direct
1 Relay
bit 1 - 3 : Relay No.
000 : SW1
001 : SW2
010 : SW3
011 : SW4
100 : SW5
101 : SW6
110 : SW7
111 : SW8
bit 4 : Relay Status
0 : OFF (stop when OFF)
1 : ON (stop when ON)
Byte 13 : Start At Relay
bit 0 :
0 Direct
1 Relay
bit 1 - 3 : Relay No.
000 : SW1
001 : SW2
010 : SW3
011 : SW4
100 : SW5
101 : SW6
110 : SW7
111 : SW8
bit 4 : Relay Status
0 : OFF (stop when OFF)
1 : ON (stop when ON)
Byte 14 : Output Coil Status
After Stop
bit 0 : OP1
bit 1 : OP2
bit 2 : OP3
bit 3 : OP4
bit 4 : OP5
bit 5 : OP6
bit 6 : OP7
bit 7 : OP8
0 : Low ,1 : High.
Byte 15 : Output Coil Status
After Start
bit 0 : OP1
bit 1 : OP2
bit 2 : OP3
bit 3 : OP4
bit 4 : OP5
bit 5 : OP6
bit 6 : OP7
bit 7 : OP8
0 : OFF ,1 : ON.
UM_MODBUS_v1.0 Dated: 020719
AUTO_CYCLE:
The below table contains message format used in Auto cycle programming.
Data Field:
Data
Next DIR & A D unit Speed No. of Start stop Start stop
Cycle Cycle Type & C E Of speed Steps At At At at
No. Movement type C C switch Switch o/p o/p
Outputs Switch
Low High
1 00 1
2 00 2
3 00 4
4 00 8
5 00 10
6 00 20
7 00 40
8 00 80
Example:
Command for Cycle 1 for Move:
01,10,00,2A,00,08,10,02,30,02,02,00,00,00,64,00,00,01,90,11,13,00,00
01 -> Slave Address
10* -> Function Code
00* -> LSB Address of Holding Register for Cycle 1
2A* -> MSB Address of Holding Register for Cycle 1
00, 08* -> Quantity of registers to be write in holding register
10* -> Total Byte count to be write in AUTO command
02 -> Next Cycle No.
30 -> Move the motor with provided steps in clockwise direction
02 -> Acceleration
02 -> Deceleration
00 -> Speed in RPM
00, 00, 64 -> 100 Rpm in hexadecimal
00,00,01,90 -> 400 steps in hexadecimal value
11 -> Start the cycle at switch 1 high
13 - > Stop the cycle at switch 2 high.
00 -> No output
00-> No output
(* indicates these values are fixed)
Response: 01,10,00,2A,00,08
UM_MODBUS_v1.0 Dated: 020719
(********--------------------------------Instructions----------------------------------------********
The Holding Register address of next cycle number use following formula
Holding Register address = Holding Address of Cycle 1 + (Next Cycle No - 1)*8
Example:
Next Cycle No is 2
So,
Holding Register address for Cycle 2 = 2A + (2-1)*8
= 2A +8
= 32
00 -> NA
00 -> Speed unit in RPM
00, 00, 64-> 200 (RPM) in hexadecimal
00,00,00,00 -> NA
00-> Start cycle direct.
00 -> Stop cycle direct.
00 -> No output
00-> No output
(* indicates these values are fixed)
Response: 01,10,00,3A,00,08
Response: 01,05,00,01,FF,00
Points to remember:
All the Above values are in hexadecimal format.
Speed can be in mm/sec in linear mode give specific unit.