SERVO MR-J5-G and MR-JET-G control via CC-Link IE Field Basic - Control by dedicated function block

SERVO MR-J5-G and MR-JET-G control via CC-Link IE Field Basic - Control by dedicated function block

This article describes how to use dedicated function block to control servo MR-J5-G or MR-JET-G via CC-Link IE Field Basic. Attached to this article you can find sample projects for iQ-F and iQ-R PLCs and library files. You can also refer to the movie at the end of this article to see how to proceed step by step.

This is the continuation of the articles that describes how to set servo parameters and who to establish communication with drives. If you need such information refer to the articles:
  1. SERVO MR-J5-G and MR-JET-G control via CC-Link IE Field Basic - Servo amplifier configuration
  2. SERVO MR-J5-G and MR-JET-G control via CC-Link IE Field Basic - Network configuration

Library content

Attached sample projects and libraries for both iQ-R and FX5 PLC contains function blocks and sample programs to control servo amplifier using CC-Link IE Field Basic as well as function blocks and sample programs to execute acyclic communication using SLMP. 

  1. ServoControl - sample program based on fbServoAxisControl_J5JET function block, predefined for 16 axes. If less axes will be used redundant part of the code should be removed.
  2. SingleObjectReadWrite - sample program that allows to read or write single object, defined by index and sub-index, from the servo amplifier via SLMP comunication
  3. OverrideServoParameters - sample program that reads predefined in SVParameterInitialValued servo parameters from the amplifier, compares those values with predefined values in the initial program and if there are differences writes all predefined parameters to the amplifier. It can be executed each system startup to secure proper values of the servo parameters. 
  4. ReadWritePDOMapping - sample program that allows to read current PDO mapping from the amplifier and write modified PDO mapping to the amplifier. It allows to modify list of servo objects that is exchanged with PLC using cyclic communication via CC-Link IE FIeld Basic.

Before using function block to control servo axis

Function block fbServoAxisControl_J5JET uses Input/Output variable io_stAxisData to exchange data between function block and CC-Link IE Field Basic network. 


Structured type variable that is connected to this input have to be defined as a global label with assigned devices used by the axis that FB will control. Assignment has to mach to the network configuration and refresh setting. In the sample project you can find global label list J5JET_CCLIEFB_Global that contains predefined structures for first 16 axis. 

Functionality of dedicated function block

fbServoAxisControl_J5JET uses  Mapping  mode 3, so to use this function block it is necessary to set 2 in parameter PN22.0. It is supported on servo amplifiers with firmware version D4 or later.
If you need to update your amplifier please refer to the article: SERVO MR-J5 and MR-JET firmware update
MR-J5/MR-JET dedicated function block allows to execute all most common operations of the drive. It allows basic servo control and monitoring like servo ON, axis halt and error reset, monitor of the position, speed and torque. This function block allows to operate servo in homing mode (hm), positioning mode (pp), velocity mode (pv) and torque mode (tq).  


Inputs

i_bEN - activates function block and data refresh with the drive

i_bServoOn - turns servo ON
i_bQuickStop - stops drive with torque removal
i_bHaltAxis - stops positioning currently being performed, when deactivated drive continue positioning

i_bErrorReset - resets amplifier error, drive became operational at falling edge
i_wPositiveTorqueLimit - general positive torque limit active in position, velocity and torque mode in 0.1% of nominal motor torque
i_wNegativeTorqueLimit general positive torque limit active in position, velocity and torque mode in 0.1% of nominal motor torque
i_dAccelerationTime time in [ms] required for the servo motor to reach the rated speed. 
i_dDecelerationTime - time in [ms] required for the servo motor to decelerate from the rated speed to zero.
i_dJogSpeed - target velocity in speed control mode / jog mode in 0.01rpm
i_bJogFwd - stars rotating forward with i_dJogSpeed
i_bJogRev stars rotating revers with i_dJogSpeed
i_bStartHPR - starts homing base on parameters set in servo drive
i_dTargetPosition - target position used under positioning control
i_dPositioningSpeed - positioning speed in 0.01rpm
i_bStartAbsPositioning - starts absolute positioning 
i_bStartIncPositioning - starts incremental positioning 
i_bEnableTorqueMode - enables torque control mode
i_wTargetTorque - target torque in torque control mode in 0.1% of nominal motor torque
i_dVelocityLimitValue - speed limit value in torque control mode in 0.01rpm
i_dTorqueSlope - torque slope in torque control mode in 0.1%/s

Outputs

o_bCommunicationReady - proper communication with drive
o_bServoReady - servo is ready to operate
o_bAxisError - servo error, start not possible 
o_bHPRRequest - homing request, positioning not possible without homing
o_bHPRComplete - homing just completes without error
o_bHPRError - homing not completed properly
o_bPositioningComplete - positioning completed and servo in position defined by position window (Obj.6067h and Obj.6068h)
o_bInTorqueMode - servo works in torque control mode
o_dCurrentPosition - current, real position of the servo motor in positioning units
o_dCurrentSpeed - current motor speed in 0.01rpm
o_dDropPulses - deviation between the setpoint position and the current drive position
o_wCurrentTorque - actual motor torque in 0.1% of nominal motor torque
o_uServoAlarmCode - servo error code 
o_bAbsolutePositionErased - absolute position lost
o_bStatusDI1_LSP - status of input DI1, by default hardware limit switch positive
o_bStatusDI2_LSN - status of input DI2, by default hardware limit switch negative
o_bStatusDI3_DOG - status of input DI3, by default homing sensor
o_bStatusEM2 - status of forced stop input