Bus communication protocol

Application of integrated stepping motor in Hollysys LE5109 PLC--Modbus communic
Release Date : 2019-03-08 13:21:57
About the manual


1.1 Introduction

Welcome to NiMotion integrated motors, we are committed to providing you with high-end motion control systems and product solutions. The integrated stepping motor of Beijing Limaisheng Control Technology Co., Ltd. uses RS-485 bus communication control, and the standard MODBUS-RTU protocol is supported on the protocol.


This manual is applicable to the motion control of the integrated motor (Modbus bus) produced by Beijing Limax Control Technology Co., Ltd. using the LE5109 PLC. This manual provides the motion start and stop command, position mode motion command, home position return motion command, set zero point, set the origin and other commands in the AutoThink software programming environment. The motion control command can be repeated multiple times, and only need to assign different slave addresses. And variables can be. It is convenient for the user to use the PLC to perform motion control programming on the integrated motor.

2 instruction list

2.1 Start function block ---- Start

• Instruction Description: This command is used to control the axis to switch from a no-fault state to a ready-to-start state.
 
• Parameter Description:




• Example of instruction use:


• Program description: When the rising edge of EN1 is set, the motor with the MODBUS slave address of 1 is switched from the no-fault state to the ready-to-start state.


2.2 Enabling Function Blocks ---HOLD

• Instruction Description: This command is used to control the axis to switch from the ready to start state to the enabled state.



• Example of instruction use:

Program Description: When the rising edge of EN1 is set, the motor with the MODBUS slave address of 1 is switched from the ready-to-start state to the enabled state.


2.3 Operation Stop Function Block ---- Operation_Stop

• Explanation of the command: This command is used to control the deceleration deceleration set by the axis according to the operation stop mode until the stop, or the deceleration stop can be performed.

• Parameter Description:



• Example of instruction use:

Program description: When the rising edge of EN1 is set, the motor with MODBUS slave address 1 is switched from the running state to the operating stop state.


2.4 Emergency stop operation function block ---- Emergency_Stop

• Command Description: This command is used to control the deceleration deceleration set by the axis in the emergency stop mode until it stops. It can also be stopped without deceleration.

• Parameter Description:



• Example of instruction use:


• Program description: When the EN rising edge is set, the motor with the MODBUS slave address of 1 is switched from the running state to the emergency stop state.



2.5 Operation Mode Selection Function Block --- PatternSelection


• Instruction Description: This command is used to change the operating mode of the current control axis.。

• Parameter Description:


• Example of instruction use:


• Program description: When the rising edge of EN1 is set, the operating mode of the Modbus slave whose PLC slave is 1 is set to the position mode.



2.6 Relative Run Function Block --- Relative_Move 

• Instruction Description: This command is used to control the axis to move from the current position to the set speed, acceleration and deceleration.

• Parameter Description:’


• Program usage examples:

• Program description: When the rising edge of EN1 is set, the slave motor with PLC slave address 1 starts from the current position and runs 10,000 pulses in the forward direction according to the set speed, acceleration and deceleration.



2.7 Origin Return Function Block --- GO_HOME

• Command Description: This command is used to control the axis to perform the homing action according to the set homing mode and speed.

• Parameter Description:



• Program usage examples:

• Program Description: When the rising edge of EN1 is set, the slave motor whose PLC slave address is 1 changes from the enabled state to the home position return state.



2.8 Setting the origin function block --- SET_HOME

• Instruction Description: This command is used to set the mechanical origin position of the control axis.

• Parameter Description:


• Example of instruction use:

• Program description: When the rising edge of EN1 is set, the current position of the MODBUS slave address is 1 and the integrated motor is set to the machine origin.



2.9 Setting the zero function block---SET_ZERO

• Instruction Description: This command is used to set the zero position of the control axis.

• Parameter Description:


• Example of instruction use:


• Program Description: When the rising edge of EN1 is set, the current position of the MODBUS slave address is 1 and the integrated motor is set to zero.



3 Motion Control Programming Example

3.1 Motion Control Path Example

• In order to facilitate the user's understanding of the integrated motor motion control command, this document will give an example of the position mode in detail. Li Maisheng PLC is used as the host computer. In the integrated motor position mode, the current position is used as the starting point, according to the set. Speed, acceleration, and deceleration move forward by 10,000 pulse distances.

• PLC programming control process: ready to start → enable → forward mode 10000 pulses in position mode → motor is switched from running state to enabled state.
 
3.2 Hardware Engineering Network

Hardware introduction:

• PLC: Hollysys LE5109 • Integrated closed-loop stepper motor: Model STM5776A-485-OFS-A

 • 24V power supply • Several power cords • One integrated closed-loop stepper motor Modbus communication line • Programming software: AutoThink.




3.3 Establish PLC Engineering

First, use the Hollyn LE series programming software AutoThink.exe to open, and then you can see the integrated motor movement of the integrated motor that has been written and tested in the LE-LE series PLC application in the tree structure of the left window. Start and stop command, position mode motion command, home position return motion command, set zero point, set the origin and other command function blocks, the command function block supports multiple repeated calls, the user only needs to configure
The function block variable name can be used to facilitate the user to use the PLC to perform motion control programming on the integrated motor.




Motion Control Command Function Block for Integrated Motors in the Hollysys LE Series Applications



3.4 PLC programming

3.4.1 Calling the Modbus-RTU communication function block



The Modbus_RTU communication function block has been called in this project, and the logic control instruction and the Modbus_RTU communication function block are partially processed. There is no need to consider Modbus_RTU communication processing when programming.



Modbus-RTU communication function block call

Parameter Description: 


• EN_R: Function block enable, rising edge enable, active high • Port: communication port selection • RW: read/write settings • Data_Address: register address where the slave stores data

• DataLength: read/write data length • TBL: the first byte address of the data stored in the master station • Timeout: modbus master module timeout time • INT_EN: (0: interrupt enable disable 1: interrupt enable)

• Error: Error message     

 

3.4.2 Calling the Start Command Function Block

      
Drag the Start command function block to the main program editing window at the window structure of the right window of the AutoThink programming software, and the Start function block can be successfully called.





3.4.3 Calling the HOLD instruction function block


Drag the HOLD instruction function block to the main window of the program editing at the window structure of the right window of the AutoThink programming software. The HOLD instruction function block can be successfully called.



3.4.4 Calling the Relative_Move Instruction Function Block

Drag the Relative_Move command function block to the main program editing main window at the window structure of the right window of the AutoThink programming software.
The Relative_Move instruction function block can be called successfully.


Parameter Description:

Address: slave address, set to 1 in this program
Direction: running direction, the program running direction is positive, set to 1
Position: The running target position, the target of this program is 10000 pulses, set to 10000



3.4.5 Calling the inquiry subroutine

Drag the xunwen subroutine to the program editing main window at the window structure of the right window of the AutoThink programming software, and the xunwen subroutine can be called successfully.



Ask the subroutine introduction:

• After the PLC is switched from the STOP state to the RUN state, the integrated motor inquiry subroutine will be called continuously by the main program, and the real-time running position and running state of the integrated motor will be inquired every 50ms.
Then, the inquired slave position is stored in the PLC register %MD852, and the inquired slave motor real-time motion state is stored in the PLC register %MW860. Users can take advantage of integrated motors
The real-time position and real-time motion state are programmed accordingly.



3.5 PLC program detailed



Program description:

1. After the PLC is switched from the STOP state to the RUN state, the integrated motor inquiry subroutine will be continuously called by the main program, and the real-time running position and running state of the integrated motor will be inquired every 50ms. Then, the inquired slave position is stored in the PLC register %MD852, and the inquired slave motor real-time motion state is stored in the PLC register %MW860. Users can write the corresponding process actions using the real-time position and real-time motion state of the integrated motor.

2. The integrated motor is ready to start: the PLC variable %IX0.3 is turned on, the rising edge of EN1 is set, the Start command function block is called, and the subroutine is called by the timer interrupt, and then the Start command function block will be sent by calling the ModbusMaster485 interface through the internal variable. In the telegram, the motor with the MODBUS slave address of 1 is switched from the no-fault state to the ready-to-start state.  

3. Integrated motor enable: PLC variable %IX0.1 is turned on, EN1 rising edge is set, HOLD command function block is called, and timer interrupt interrogation subroutine is called, then HOLD command function block will call ModbusMaster through internal variable.
The 485 interface sends a start message, and the motor with the MODBUS slave address of 1 is switched from the ready start state to the enable state.

4. Integrated motor operation: PLC variable %IX0.4 is turned on, EN1 rising edge is set, call the Relative_Move instruction function block, and the timer interrupts the subroutine, then the Relative_Move instruction function block will be called by internal variables.
The ModbusMaster485 interface sends relative messages. The motor with the MODBUS slave address of 1 is switched from the enabled state to the running state, and 10,000 pulses are forwardly operated in the position mode.

5. After the action is completed, the integrated motor has the running state switched to the stop state. 


4 Summary

It can be seen from the above examples that the NiMotion integrated stepping motor has high integration degree, can greatly reduce the wiring and is easy to install than the conventional motion scheme, and can fully save the installation space, anti-burnout and other damage protection measures, and is particularly suitable for replacement.
Use of multiple motor devices. At the same time, NiMotion integrated stepping motor integrates IO and synchronization functions, CAN & CANOPEN & Modbus bus connection, distributed control. Convenient for users to monitor production, data collection and data
Analysis, resulting in a highly flexible, personalized, networked production chain. To meet the development needs of Industry 4.0, Industrial Internet, Internet of Things, and cloud computing, it provides an alternative to traditional steps for users' intelligent manufacturing while saving user costs.
The solution into the motor.


5 other

• Other contents or parts of this manual are prohibited from being reproduced or copied without authorization.

• Product performance, specifications and appearance may be improved and will change without prior notice. Please understand.

• We strive to make the content as accurate as possible. If you find any problems or errors or omissions, please contact Beijing Limai Control Technology Co., Ltd.