6.2 EcatPlcAxis


There are at most 8 PLC axes, which should be COE drives, can be linked to the EtherCAT controller. Set <CheckIn> to engage the axis and <EcatPhysPos> to indicate the connection order in ECATPARA.xml before using it. According to the setting in xml, the 8 PLC axes are named as plc.ecatPlcAxis[0]~plc.ecatPlcAxis[7] in PLC.H.


ecatPlcAxis related signals are as follows:

Signal

Function

plc.ecatPlcAxis[n].cmd.flag

command flag

plc.ecatPlcAxis[n].cmd.data[0]

command data0

plc.ecatPlcAxis[n].cmd.data[1]

command data1

plc.ecatPlcAxis[n].cmd.isSend

set by system to state that whether command is transmitted properly or not

plc.ecatPlcAxis[n].cmd.finish

set to 1 by system when the command is done

plc.ecatPlcAxis[n].sts.actualPos

current position of motor

Plc.ecatPlcAxis[n].sts.index

index signal is probed or not

plc.ecatPlcAxis[n].sts.isReady

is ready or not

plc.ecatPlcAxis[n].sts.isWarn

has warning or not

plc.ecatPlcAxis[n].sts.isAlarm

has alarm or not


1. Status data of PLC axis

The system will keep updating the status of PLC axes, including:

(1) Current position of motor (Obj. 0x6064)

(2) Status of index signal detecting

(3) Axis is ready or not

(4) Axis has warning or not

(5) Axis has alarm or not


2. Command data of PLC axis

Request system to do the specific action and data transmission by setting cmd.flag and cmd.data in PlcRun. And system would return finish signal and corresponding data after it is done. For example:

if(plc.ecatPlcAxis [0].cmd.flag == ECAT_AXIS _SET_MODE && plc.ecatPlcAxis [0].cmd.finish){

       if(plc.ecatPlcAxis [0].cmd.isSend){                //Transmission done successfully

               plc.ecatPlcAxis [0].cmd.flag = 0;

       }else{……}                                            //Failed to send failed

}else{

       plc.ecatPlcAxis [0].cmd.flag = ECAT_AXIS_SET_MODE;

       plc.ecatPlcAxis [0].cmd.data[0] = ECAT_AXIS _PPMODE;

}


3. Motion mode of PLC axis

PLC axis can run in two types of motion mode, profile position mode and profile velocity mode. 8 axes can be set individually according to the application, the activation process for these two modes are as follows:


(1) Profile Position Mode

1.

Enable servo

(ECAT_AXIS_SET_SRVON)

2.

Switch to PP mode

(ECAT_AXIS_SET_MODE)

3.

Set axial acceleration

(ECAT_AXIS_SET_ACCEL)

4.

Set axial velocity of PP mode

(ECAT_AXIS_SET_PP_VEL)

5.

Set target position and start moving

(ECAT_AXIS_SET_PP_POS)


Enable the servo first, and switch motion mode to PP mode (ECAT_AXIS_PPMODE). Then set moving speed and axial acceleration value according to the requirement. After steps above, user can set the target position and start moving with the given profile. Velocity and acceleration only need to be set once in the beginning unless user want to make another moving profile. It only needs the command of target position to do axial movement after the profile is determined.


(2) Profile Velocity Mode        

1.

Enable servo

(ECAT_AXIS _SET_SRVON)

2.

Switch to PV mode

(ECAT_AXIS_SET_MODE)

3.

Set axial acceleration

(ECAT_AXIS_SET_ACCEL)

4.

Set target velocity of PV mode

(ECAT_AXIS_SET_PV_VEL)


Enable the servo first, and switch motion mode to PV mode (ECAT_AXIS_PVMODE). Then set axial acceleration value according to the requirement. After steps above, user can set the target velocity and start moving with the given profile. Be aware that the movement starts immediately once the target velocity is set to a nonzero value. User could use the command of pause to block out the unexpected movement.


The following table lists all EtherCAT PLC axis related commands:

Command

Function

Description

Read command (return value will be written in data[0])

ECAT_AXIS_GET_MODE

Read axial motion mode

1: PP mode, 3: PV mode

ECAT_AXIS_GET_ACCEL

Read axial acceleration


ECAT_AXIS_GET_PP_VEL

Read axial velocity of PP mode


ECAT_AXIS_GET_PV_VEL

Read axial velocity of PV mode


Write command (put the setting value in data[0])

ECAT_AXIS_SET_MODE

Set axial motion mode

ECAT_AXIS_PPMODE/

ECAT_AXIS_PVMODE

ECAT_AXIS_SET_ACCEL

Set axial acceleration

Axial acceleration value (Note 1)

ECAT_AXIS_SET_SRVON

Switch on/off servo

0: Disable, 1: Enable

ECAT_AXIS_SET_PAUSE

Pause axial motion

0: No pause, 1: Pause

ECAT_AXIS_SET_PV_VEL

Set target velocity of PV mode

PV mode velocity value

ECAT_AXIS_SET_PP_VEL

Set axial velocity of PP mode

PP mode velocity value

ECAT_AXIS_SET_PP_POS

Set target position of PP mode and start the motion

PP mode target position

  • data [1]: Move mode (Note 2)
  • bit0 0: no confirm ending, 1: wait till arrival
  • bit1 0: absolute position, 1: relative position

ECAT_AXIS_SET_PP_BRK

Break current movement (PP mode only)


ECAT_AXIS_CLR_ABS

Reset axial absolute position


ECAT_AXIS_CLR_IDX

Reset axial index


Note 1.

The unit of parameters (speed, acceleration, position, etc.) are based on the calculating unit of drives. User can look up from the manual of drives.

Note 2.

"No confirm ending" means that system return the cmd.finish signal immediately after the movement is triggered. Other commands could be called, like breaking current movement, during the moving. Otherwise, "Wait till arrival" means that system would not return the cmd.finish signal until the target position is reached. So the movement could not be interrupted by other call.