0% found this document useful (0 votes)
118 views164 pages

AX Series Controller Programming Guide

The AX series programmable controller programming manual provides essential information for using the AX70 and AX71 programmable controllers, including basic commands, motion control commands, and INVT commands. It is intended for personnel with electrical knowledge and includes a change history, preface, and online support details. The manual is subject to change without prior notice and emphasizes compliance with export control regulations for military applications.

Uploaded by

demarsch
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
118 views164 pages

AX Series Controller Programming Guide

The AX series programmable controller programming manual provides essential information for using the AX70 and AX71 programmable controllers, including basic commands, motion control commands, and INVT commands. It is intended for personnel with electrical knowledge and includes a change history, preface, and online support details. The manual is subject to change without prior notice and emphasizes compliance with export control regulations for military applications.

Uploaded by

demarsch
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 164

AX series programmable controller programming manual Change history

No. Change description Version Release date

1 First release. V1.0 September 2020


AX series programmable controller programming manual Preface

Preface
Thank you for choosing AX series programmable controller (programmable controller for short).

This manual contains the information necessary to use the programmable controller. Please read this manual carefully

before using the product. Then you can fully understand the functions, performance, and system build-up, which helps to

give full play to the advanced performance.

Target audience
Personnel with electrical professional knowledge (such as qualified electrical engineers or personnel with equivalent

knowledge)

Applicable product
AX70 programmable controller

AX71 programmable controller

Online support
You can also obtain product documentation and technical support from INVT website:

http://www.invt.com

If the product is ultimately used for military affairs or weapon manufacture, comply with the export control regulations in

the Foreign Trade Law of the People's Republic of China and complete related formalities.

The manual is subject to change without prior notice.

i
AX series programmable controller programming manual Contents

Contents
Preface ................................................................................................................................................................................ i

Target audience ............................................................................................................................................................ i

Applicable product......................................................................................................................................................... i

Online support ............................................................................................................................................................... i

Contents............................................................................................................................................................................. ii

1 Basic commands ............................................................................................................................................................ 1

1.1 Description of commands in standard.lib ............................................................................................................... 1

1.1.1 Strings .......................................................................................................................................................... 1

1.1.2 Bistable function blocks................................................................................................................................ 4

1.1.3 Triggers ........................................................................................................................................................ 5

1.1.4 Counters ...................................................................................................................................................... 6

1.1.5 Timers .......................................................................................................................................................... 8

1.2 Description of commands in Util.lib ...................................................................................................................... 11

1.2.1 BCD conversion ......................................................................................................................................... 11

1.2.2 Bit/byte functions........................................................................................................................................ 12

1.2.3 Mathematical auxiliary function blocks ....................................................................................................... 13

1.2.4 Regulators.................................................................................................................................................. 15

1.2.5 Signal generator......................................................................................................................................... 19

1.2.6 Operation function block ............................................................................................................................ 22

1.2.7 Analog value processing ............................................................................................................................ 24

2 Motion control commands .......................................................................................................................................... 26

2.1 Description of the SM3_Basic library ................................................................................................................... 26

2.1.1 MC_Power ................................................................................................................................................. 26

2.1.2 MC_Halt ..................................................................................................................................................... 27

2.1.3 MC_Home .................................................................................................................................................. 28

2.1.4 MC_MoveAbsolute ..................................................................................................................................... 30

2.1.5 MC_AccelerationProfile.............................................................................................................................. 33

2.1.6 MC_MoveAdditive ...................................................................................................................................... 35

2.1.7 MC_MoveRelative ...................................................................................................................................... 37

2.1.8 MC_MoveSuperImposed ........................................................................................................................... 40

2.1.9 MC_MoveVelocity ...................................................................................................................................... 43

ii
AX series programmable controller programming manual Contents

2.1.10 MC_PositionProfile .................................................................................................................................. 45

2.1.11 MC_ReadActualPosition .......................................................................................................................... 46

2.1.12 MC_ReadBoolParameter ......................................................................................................................... 48

2.1.13 MC_ReadAxisError .................................................................................................................................. 49

2.1.14 MC_ReadStatus....................................................................................................................................... 50

2.1.15 MC_ReadParameter ................................................................................................................................ 52

2.1.16 MC_Reset ................................................................................................................................................ 54

2.1.17 MC_Stop .................................................................................................................................................. 55

2.1.18 MC_VelocityProfile ................................................................................................................................... 57

2.1.19 MC_WriteBoolParameter ......................................................................................................................... 59

2.1.20 MC_WriteParameter ................................................................................................................................ 61

2.1.21 MC_AbortTrigger...................................................................................................................................... 62

2.1.22 MC_ReadActualTorque ............................................................................................................................ 64

2.1.23 MC_ReadActualVelocity .......................................................................................................................... 65

2.1.24 MC_SetPosition ....................................................................................................................................... 66

2.1.25 MC_TouchProbe ...................................................................................................................................... 68

2.1.26 MC_MoveContinuousAbsolute................................................................................................................. 70

2.1.27 MC_MoveContinuousRelative.................................................................................................................. 72

2.1.28 MC_Jog.................................................................................................................................................... 74

2.1.29 MC_Inch................................................................................................................................................... 76

2.1.30 SMC3_PersistPosition ............................................................................................................................. 78

2.1.31 SMC3_PersistPositionSingleturn ............................................................................................................. 80

2.1.32 SMC3_PersistPosition Logical ................................................................................................................. 82

2.1.33 SMC_Homing........................................................................................................................................... 84

2.1.34 MC_Camin ............................................................................................................................................... 89

2.1.35 MC_Camout ............................................................................................................................................. 97

2.1.36 MC_CamTableSelect ............................................................................................................................... 99

2.1.37 MC_GearIn ............................................................................................................................................ 101

2.1.38 MC_GearOut .......................................................................................................................................... 103

2.1.39 MC_GearInPos ...................................................................................................................................... 105

2.1.40 MC_Phasing .......................................................................................................................................... 109

3 INVT commands ......................................................................................................................................................... 112

3.1 Communication commands ................................................................................................................................ 112

3.1.1 ModbusRTU master node ........................................................................................................................ 112

iii
AX series programmable controller programming manual Contents

3.1.2 ModbusRTU slave node........................................................................................................................... 115

3.1.3 ModbusTCP master node ........................................................................................................................ 116

3.1.4 ModbusTCP slave node ........................................................................................................................... 119

3.2 Pulse commands................................................................................................................................................ 120

3.2.1 MC_InitSys_Invt ....................................................................................................................................... 120

3.2.2 MC_Axis................................................................................................................................................... 121

3.2.3 MC_Power_Invt ....................................................................................................................................... 123

3.2.4 MC_Stop_Invt .......................................................................................................................................... 124

3.2.5 MC_Reset_Invt ........................................................................................................................................ 125

3.2.6 MC_JOG_Invt .......................................................................................................................................... 126

3.2.7 MC_JOGP_Invt ........................................................................................................................................ 127

3.2.8 MC_MoveAbsolute_Invt ........................................................................................................................... 129

3.2.9 MC_MoveRelative_Invt ............................................................................................................................ 130

3.2.10 MC_MoveVelocity_Invt........................................................................................................................... 132

3.2.11 MC_ReadActualPosition_Invt ................................................................................................................. 133

3.2.12 MC_ActiveSpeed_Invt............................................................................................................................ 134

3.2.13 MC_HOME_Invt ..................................................................................................................................... 135

3.2.14 AMC_Reset_Invt .................................................................................................................................... 136

3.2.15 AMC_Stop_Invt ...................................................................................................................................... 137

3.2.16 AMC_ActiveSpeed_Invt ......................................................................................................................... 139

3.2.17 AMC_MoveAbsolute_Invt ....................................................................................................................... 140

3.2.18 AMC_MoveRelative_Invt ........................................................................................................................ 142

3.2.19 AMC_ArcDel_Invt ................................................................................................................................... 144

3.2.20 MC_SendData_Invt ................................................................................................................................ 146

3.2.21 MC_GetVersion_Invt .............................................................................................................................. 147

3.2.22 MC_SetPosition_Invt ............................................................................................................................. 147

3.2.23 MC_ReadParameter_Invt ...................................................................................................................... 148

3.2.24 MC_ReadStatus_Invt ............................................................................................................................. 150

3.3 Enhanced commands ........................................................................................................................................ 152

3.3.1 FB_ReinitDrv............................................................................................................................................ 152

3.3.2 FB_AxisEasyControl ................................................................................................................................ 154

3.3.3 FB_Relative_INVT ................................................................................................................................... 156

iv
AX series programmable controller programming manual Basic commands

1 Basic commands

1.1 Description of commands in standard.lib


By default, Invtmatic Studio provides the library standard.lib, including all standard functions and function modules
compliant with IEC61131-3. Though the development system can identify operators, standard modules are definitely
imported to a project as a library.

1.1.1 Strings

1.1.1.1 LEN
This function is used to obtain the length of a character string. The input variable STR is of the STRING type, and the
return value is of the INT type.

Example in FBD:

Example in ST:

VarINT1 := LEN ('SUSI');

1.1.1.2 LEFT
This function is used to obtain certain characters from the left of a source character string. The input variable STR is of
the STRING type, the input variable SIZE is of the INT type, and the return value is of the STRING type.

LEFT (STR, SIZE) is used to obtain the characters with the length specified by SIZE, starting from the left of the
character string STR.

Example in FBD:

Example in ST:

VarSTRING1 := LEFT ('SUSI',3);

1.1.1.3 RIGHT
This function is used to obtain certain characters from the right of a source character string. The input variable STR is of
the STRING type, the input variable SIZE is of the INT type, and the return value is of the STRING type.

RIGHT (STR, SIZE) is used to obtain the characters with the length specified by SIZE, starting from the right of the
character string STR.

Example in FBD:

-1-
AX series programmable controller programming manual Basic commands

Example in ST:

VarSTRING1 := RIGHT ('SUSI',3);

1.1.1.4 MID
This function is used to obtain certain characters from a source character string. The input variable STR is of the
STRING type, the input variables LEN and POS are of the INT type, and the return value is of the STRING type.

MID (STR, LEN, POS) is used to obtain the characters with the length specified by LEN, starting from the character with
the position specified by POS of the character string STR.

Example in FBD:

Example in ST:

VarSTRING1 := MID ('SUSI',2,2);

1.1.1.5 CONCAT
This function is used to combine two character strings in series. The input variables STR1 and STR2, and the return
value are of the STRING type.

Example in FBD:

Example in ST:

VarSTRING1 := CONCAT ('SUSI','WILLI');

1.1.1.6 INSERT
This function is used to insert another character string at a specified position into a source character string.

The input variables STR1 and STR2 are of the STRING type, the input variable POS is of the INT type, and the return
value is of the STRING type.

INSERT(STR1, STR2, POS) is used to insert the character string STR2 next to the position specified by POS into the
character string STR1.

Example in FBD:

-2-
AX series programmable controller programming manual Basic commands

Example in ST:

VarSTRING1 := INSERT ('SUSI','XY',2);

1.1.1.7 DELETE
This function is used to delete specified characters from a specified position of a source character string.

The input variable STR is of the STRING type, the input variables LEN and POS are of the INT type, and the return value
is of the STRING type.

DELETE (STR, L, POS) is used to delete certain characters from the character string STR, while L specifies the length of
characters to be deleted and POS specifies the character deletion start position.

Example in FBD:

Example in ST:

Var1 := DELETE ('SUXYSI',2,3);

1.1.1.8 REPLACE
This function is used to replace certain characters at a specified position of a source character string with another given
character string.

The input variables STR1 and STR2 are of the STRING type, the input variables L and P are of the INT type, and the
return value is of the STRING type.

REPLACE(STR1, STR2, L, P) is used to replace certain characters with the character string STR2 for the character
string STR1, while L specifies the length of characters to be replaced and P specifies the character replacing start
position.

Example in FBD:

Example in ST:

VarSTRING1 := REPLACE (’SUXYSI’,’K’,2,2);

1.1.1.9 FIND
This function is used to search a character string for certain characters. The input variables STR1 and STR2 are of the

-3-
AX series programmable controller programming manual Basic commands

STRING type, and the return value is of the INT type.

FIND(STR1, STR2) is used to find where STR2 occurs in STR1 for the first time. If STR2 is not found in STR1, the
message is displayed: "OUT:=0"

Example in FBD:

Example in ST:

arINT1 := FIND ('abcdef','de');

1.1.2 Bistable function blocks

1.1.2.1 SR
This function module gives priority to setting. Q1 = SR (SET1, RESET) equals Q1 = (NOT RESET AND Q1) OR SET1.

The input variables SET1 and RESET, and the output variable Q1 are of the BOOL type.

Declaration example:

SRInst : SR ;

Example in FBD:

Example in ST:

SRInst(SET1:= VarBOOL1 , RESET:=VarBOOL2 );

VarBOOL3 := SRInst.Q1 ;

1.1.2.2 RS
This function module gives priority to resetting. Q1 = RS (SET, RESET1) equals Q1 = NOT RESET1 AND (Q1 OR SET).

The input variables SET1 and RESET, and the output variable Q1 are of the BOOL type.

Declaration example:

RSInst : RS ;

Example in FBD:

Example in ST:

-4-
AX series programmable controller programming manual Basic commands

RSInst(SET:= VarBOOL1 , RESET1:=VarBOOL2 );

VarBOOL3 := RSInst.Q1 ;

1.1.3 Triggers

1.1.3.1 R_TRIG
This function block is used to detect the rise edge.

For input, CLK: BOOL; The boolean input signal is used to detect the rise edge.

For output, Q: BOOL; If CLK has detected the rise edge, the output is True.

Only if the value of the input variable CLK is False, the values of the output variable Q and the medium auxiliary variable
M are always False. When the value of CLK changes to True, the value of Q changes to True first and then that of M is
set to True. In a word, every time when the function block is invoked, Q returns False if CLK changes from the rise edge
to the fall edge.

Declaration example:

RTRIGInst : R_TRIG ;

Example in FBD:

Example in ST:

RTRIGInst(CLK:= VarBOOL1);

VarBOOL2 := RTRIGInst.Q;

1.1.3.2 F_TRIG
This function block is used to detect the fall edge.

For input, CLK: BOOL; The boolean input signal is used to detect the fall edge.

For output, Q: BOOL; If CLK has detected the fall edge, the output is True.

Only if the value of the input variable CLK is True, the values of the output variable Q and the medium auxiliary variable
M are always False. When the value of CLK changes to False, the value of Q changes to True first and then that of M is
set to True. In a word, every time when the function block is invoked, Q returns False if CLK changes from the fall edge to
the rise edge.

Declaration example:

FTRIGInst : F_TRIG ;

Example in FBD:

Example in ST:

-5-
AX series programmable controller programming manual Basic commands

FTRIGInst(CLK:= VarBOOL1);

VarBOOL2 := FTRIGInst.Q;

1.1.4 Counters

1.1.4.1 CTU
This function block is used to count up.

For input:

CU: BOOL; The rise edge triggers the counting up of CV.

RESET: BOOL; When the value is TRUE, CV is reset to 0.

PV: WORD; It indicates the upper limit of CV counting.

For output:

Q: BOOL; When CV reaches the counting upper limit PV, the value is TRUE.

CV: WORD; The value is continuously added by 1 until it reaches CV.

If the value of RESET is TRUE, the counting value CV is initialized to 0. If there is a rise edge when CU changes from
FALSE to TRUE, the value of CV is added by 1. If CV is greater than or equal to the counting upper limit PV, the value of
Q is TRUE.

Declaration example:

CTUInst :CTU ;

Example in FBD:

Example in ST:

CTUInst(CU:= VarBOOL1, RESET:=VarBOOL2 , PV:= VarWORD1);

VarBOOL3 := CTUInst.Q ;

VarWORD2 := CTUInst.CV;

1.1.4.2 CTD
This function block is used to count down

For input:

CD: BOOL; The rise edge triggers the counting down of CV.

LOAD: BOOL; When the value is TRUE, CV is set to the upper limit PV.

PV: WORD; It indicates the initial value for the counting down of CV.

For output:

Q: BOOL; When CV reaches 0, the value is TRUE.

CV: WORD; The value is continuously reduced by 1 until it reaches 0.

-6-
AX series programmable controller programming manual Basic commands

If the value of LOAD is TRUE, the counting value CV is initialized to the counting upper limit PV. If there is a rise edge
when CD changes from FALSE to TRUE and CV is greater than 0, the value of CV is reduced by 1 (that is, the value of
CV cannot be less than 0). If CV is 0, the value of Q is TRUE.

Declaration example:

CTDInst:CTD ;

Example in FBD:

Example in ST:

CTDInst(CD:= VarBOOL1, LOAD:=VarBOOL2 , PV:= VarWORD1);

VarBOOL3 := CTDInst.Q ;

VarWORD2 := CTDInst.CV;

1.1.4.3 CTUD
This function block is used to count up and down.

For input:

CU: BOOL; The rise edge triggers the counting up of CV.

CD: BOOL; The rise edge triggers the counting down of CV.

RESET: BOOL; When the value is TRUE, CV is reset to 0.

LOAD: BOOL; When the value is TRUE, CV is set to the upper limit PV.

PV: WORD; It indicates the initial value for the counting up or down of CV.

For output:

QU: BOOL; When CV reaches the counting upper limit PV, the value is TRUE.

QD BOOL; When CV reaches 0, the value is TRUE.

CV: WORD; The value is continuously reduced by 1 until it reaches 0.

If there is a rise edge when CU changes from FALSE to TRUE, the value of CV is added by 1. If there is a rise edge when
CD changes from FALSE to TRUE and CV is greater than 0, the value of CV is reduced by 1. If CV is greater than or
equal to PV, the value of QU is TRUE. If CV is 0, the value of QD is TRUE.

Declaration example:

CTUDInst :CUTD ;

Example in FBD:

-7-
AX series programmable controller programming manual Basic commands

Example in ST:

CTUDInst(CU := VarBOOL1, CD:= VarBOOL2, RESET := VarBOOL3, LOAD:=VarBOOL4 , PV:= VarWORD1);

VarBOOL5 := CTUDInst.QU ;

VarBOOL6 := CTUDInst.QD ;

VarWORD2 := CTUDInst.CV;

1.1.5 Timers

1.1.5.1 TP
This function block serves as a timer.

For input:

IN: BOOL; The rise edge triggers timing on the ET end.

PT: TIME; It indicates the upper limit of ET timing period.

For output:

Q: BOOL; When ET is performing timing, the value is TRUE.

ET: TIME; It indicates the present status of time.

If the value of IN is FALSE, the value of Q is FALSE, and the value of ET is 0. If the value of IN is TRUE, timing starts on
the ET end, which is calculated in millisecond and does not stop until ET is equal to PT. Once when ET is equal to PT,
this constant is kept. If IN is TRUE and ET is less than or equal to PT, Q is TURE; otherwise, Q is FALSE.

Therefore, Q is TRUE in the timing period defined by PT. The timing sequence diagram of TP is as follows:

Declaration example:

TPInst : TP ;

Example in FBD:

-8-
AX series programmable controller programming manual Basic commands

Example in ST:

TPInst(IN := VarBOOL1, PT:= T#5s);

VarBOOL2 :=TPInst.Q;

1.1.5.2 TON
This function block serves as a timer that is enabled with a delay.

For input:

IN: BOOL; The rise edge triggers timing on the ET end.

PT: TIME; It indicates the upper limit (that is, the delay time) of ET timing period.

For output:

Q: BOOL; When the timing of ET reaches the upper limit PT, a rise edge is output.

ET: TIME; It indicates the present status of time.

TP(IN, PT, Q, ET): IN is an input variable of the BOOL type and PT is an input variable of the TIME type. Q is an output
variable of the BOOL type and ET is an output variable of the TIME type. If the value of IN is FALSE, the value of Q is
FALSE, and the value of ET is 0.

If the value of IN is TRUE, timing starts on the ET end, which is calculated in millisecond and does not stop until ET is
equal to PT. Once when ET is equal to PT, this constant is kept. If IN is TRUE and ET is equal to PT, Q is TURE.
Otherwise, Q is FALSE. Therefore, Q has a rise edge after the delay (that is, the time defined by PT) is completed.

The timing sequence diagram of TON is as follows:

Declaration example:

TONInst : TON ;

Example in FBD:

Example in ST:

TONInst(IN := VarBOOL1, PT:= T#5s);

-9-
AX series programmable controller programming manual Basic commands

1.1.5.3 TOF
This function block serves as a timer that is disabled with a delay.

For input:

IN: BOOL; The fall edge triggers timing on the ET end.

PT: TIME; It indicates the upper limit (that is, the delay time) of ET timing period.

For output:

Q: BOOL; When the timing of ET reaches the upper limit PT, a fall edge is output.

ET: TIME; It indicates the present status of time.

TOF(IN, PT, Q, ET): If IN is TRUE, Q is TRUE. If the value of IN is FALSE, timing starts on the ET end, which is
calculated in millisecond and does not stop until ET is equal to PT. Once when ET is equal to PT, this constant is kept. If
IN is FALSE and ET is equal to PT, Q is TURE; otherwise, Q is TRUE. Therefore, Q has a fall edge after the delay is
completed.

The timing sequence diagram of TOF is as follows:

Declaration example:

TOFInst :TOF ;

Example in FBD:

Example in ST:

TOFInst(IN := VarBOOL1, PT:= T#5s);

VarBOOL2 :=TOFInst.Q;

1.1.5.4 RTC
This function block serves as a real-time timer.

For input:

EN: BOOL; The rise edge triggers timing on the CDT end.

PDT:DATE_AND_TIME; It indicates the start date and time of timing.

-10-
AX series programmable controller programming manual Basic commands

For output:

Q: BOOL; When the CDT end starts timing, the output is TRUE.

CDT: DATE_AND_TIME; It indicates the present date and time of timing.

VarBOOL2:=RTC(EN, PDT, Q, CDT): When EN is FALSE, Q is FALSE, and CDT is DT#1970-01-01-00:00:00. Once
when EN changes to TRUE (having a rise edge) and keeps the value, the CDT end starts counting up, using PDT as the
initial value, accurate to seconds. When EN is reset to FALSE, CDT is reset to the initial value DT#1970-01-01-00:00:00.

Declaration example:

RTCInst:RTC ;

Example in FBD:

Example in ST:

RTCInst (EN:=VarBOOL1, PDT:=DT#2006-03-30-14:00:00, Q=>VarBOOL2, CDT=>VarTimeCur);

1.2 Description of commands in Util.lib


The library Util.lib contains a variety of function blocks for BCD conversion, bit/byte functions, mathematical auxiliary
functions, and analog value processing.

1.2.1 BCD conversion

1.2.1.1 BCD_TO_INT
This function is used to convert the bytes in BCD format into integers.

The input variable is of the BYTE type, and the output variable is of the INT type.

If the byte to be converted is not in the BCD format, the output is -1.

Example in ST:

i:=BCD_TO_INT(73); (* Result is 49 *)

k:=BCD_TO_INT(151); (* Result is 97 *)

l:=BCD_TO_INT(15); (* Output -1, because it is not in BCD format *)

1.2.1.2 INT_TO_BCD
This function is used to convert integers into the bytes in BCD formats.

The input variable is of the INT type, and the output variable is of the BYTE type.

If the integer cannot be converted into the BCD format, the output is 255.

Example in ST:

i:=INT_TO_BCD(49); (* Result is 73 *)

k:=BCD_TO_INT(97); (* Result is 151 *)

l:=BCD_TO_INT(100); (* Error! Output: 255 *)

-11-
AX series programmable controller programming manual Basic commands

1.2.2 Bit/byte functions

1.2.2.1 EXTRACT
In this function, the input variable X is of the DWORD type, and the input variable N is of the BYTE type. The output
variable is of the BOOL type, and the output is the digit at bit N of the input variable X, in which N is counted from bit 0.

Example in ST:

FLAG:=EXTRACT(X:=81, N:=4);

(* Result : TRUE, because 81 is binary 1010001, so the 4th bit is 1 *)

FLAG:=EXTRACT(X:=33, N:=0);

(* Result : TRUE, because 33 is binary 100001, so the bit '0' is 1 *)

1.2.2.2 PACK
This function is used to combine the eight input variables B0, B1, ... and B7 of the BOOL type into a data value of the
BYTE type.

The function UNPACK has a tight relationship with the function PACK.

1.2.2.3 PUTBIT
In this function, the input variables X, N, and B are of the DWORD type, BYTE type, and BOOL type respectively.

PUTBIT is used to set the digit at bit N of X to B, in which N is counted from bit 0.

Example in ST:

var1:=38; (* binary 100110 *)

var2:=PUTBIT(A,4,TRUE); (* Result: 54 = 2#110110 *)

var3:=PUTBIT(A,1,FALSE); (* Result: 36 = 2#100100 *)

1.2.2.4 UNPACK
This function is used to split the input variable B of the BYTE type into eight output variables B0, B1, ... and B7 of the
BOOL type. This function is opposite to the function PACK.

Example in FBD:

UP
PACK UNPACK
TRUE B0 PACK B B0 TRUE
FALSE B1 B1 FALSE
TRUE B2 B2 TRUE
FALSE B3 B3 FALSE
FALSE B4 B4 FALSE
TRUE B5 B5 TRUE
FALSE B6 B6 FALSE
FALSE B7 B7 FALSE

-12-
AX series programmable controller programming manual Basic commands

1.2.3 Mathematical auxiliary function blocks

1.2.3.1 DERIVATIVE
This function block is used to determine local approximate derivatives.

The input variables IN and TM are of the REAL and DWORD types respectively, with the time accurate to milliseconds.
RESET is of the BOOL type, and this function block is reset when the value of RESET is TRUE. The output variable OUT
is of the REAL type.

To obtain a most accurate result, DERIVATIVE approximately uses the last four values to decrease inaccuracy generated
by input parameters.

Example in FBD:

DERIVATIVE input and output:

1.2.3.2 INTEGRAL
This function block is used for approximate integral.

Similar to DERIVATIVE, the input variables IN and TM are of the REAL and DWORD types respectively, with the time
accurate to milliseconds. RESET is of the BOOL type, and this function block is reset when the value of RESET is TRUE.
The output variable OUT is of the REAL type.

The integral is the approximate value of the two step functions, and the average value of the data is an approximate
integral.

Example in FBD:

INTEGRAL input and output:

-13-
AX series programmable controller programming manual Basic commands

1.2.3.3 LIN_TRAFO
This function block converts the real numbers in the range determined by the upper limit and lower limit into real numbers
in the range determined by the other upper limit and lower limit.

The following expression is based on such conversion:

(IN – IN_MIN) : (IN_MAX – IN) = (OUT – OUT_MIN) : (OUT_MAX – OUT)

Input variables:

Variable Data type Description


IN REAL Input variable
IN_MIN REAL Lower limit in the variable range
IN_MAX REAL Upper limit in the variable range
OUT_MIN REAL Lower limit in the output range
OUT_MAX REAL Upper limit in the output range

Output variables:

Variable Data type Description


OUT REAL Output value
An error occurred: TRUE, if IN_MIN = IN_MAX, or IN is out of the
ERROR BOOL
specified input range.

Application example:

A temperature is provided by a voltage value (input IN). However, the temperature will be converted into temperature
values (output OUT). The range of the input (voltage) value is restricted by IN_MIN=0 and IN_MAX=10. The range of the
output (temperature) value is restricted by OUT_MIN=-20 and OUT_MAX=40.

Therefore, the input of a 5V voltage value will cause the output of a 10°C temperature.

-14-
AX series programmable controller programming manual Basic commands

1.2.3.4 STATISTICS_INT
This function block is used to calculate data for standard data collection.

The input variable IN is of the INT type. When the input variable RESET of the BOOL type is TRUE, all data values are
initialized again.

Among the output variables, MN is the minimum value of IN, MX is the maximum value of IN, and AVG is the average
value. The three output variables are of the INT type.

Example in FBD:

1.2.3.5 STATISTICS_REAL
This function block is similar to STATISTICS_INT. The only difference is that the input variable IN and output variables
MN, MX, and AVG of this function block are of the REAL type.

1.2.3.6 VARIANCE
This function block is used to calculate the variance of input data.

The input variables IN and RESET are of the REAL and BOOL types respectively, and the output variable OUT is of the
REAL type.

This function block is used to calculate the variance of input data. When RESET=TRUE, VARIANCE is reset.

The standard deviation can be easily obtained by calculating the square root of variance.

1.2.4 Regulators

1.2.4.1 PD
This function block is used to regulate proportions and differentials.

Input variables:

Variable Data type Description


ACTUAL REAL Actual value of the control variable.
SET_POINT REAL Description value and command value.
Proportional coefficient used to represent the proportional gain of the
KP REAL
P- part.
Differential time used to represent the time calculated in seconds of
TV REAL
the D- part. For example, "0.5" indicates 500 seconds.
Y_MANUAL REAL Used to define the output value Y when MANUAL=TRUE.
Y_OFFSET REAL Offset value of the operation value Y.
Lower limit and upper limit of the operation value Y. If Y reaches a limit
Y_MIN, Y_MAX REAL
value, LIMITS_ACTIVE is set to TRUE and Y is kept within the

-15-
AX series programmable controller programming manual Basic commands

Variable Data type Description


formulated range. This function block works only when Y_MIN <
Y_MAX.
If it is TRUE, manual operating is activated, and the output value is
MANUAL BOOL
defined through Y_MANUAL.
Setting the value to TRUE will reset the controller. During
RESET BOOL
re-initialization, Y is equal to Y_OFFSET.

Output variables:

Variable Data type Description


Y REAL Operation value, defined by the function block (see the following).
When the value is TRUE, Y reaches the given limit value (Y_MIN or
LIMITS_ACTIVE BOOL
Y_MAX).

Example in FBD:

Y_OFFSET, Y_MIN, and Y_MAX are used to convert numbers in specified ranges.

MANUAL can be used to enable or disable manual operating. RESET is used to reset the controller.

During normal operating (MANUAL = RESET = LIMITS_ACTIVE = FALSE), the controller calculates the deviation value
SET_POINT- ACTUAL and stores the time-related derivatives de/dt as internal variables.

The output value Y can be obtained by using the following:

𝛿∆
Y = KP ∙ (∆ + TV ) + Y_OFFSET
𝛿𝑡

In the formula, ∆=SET_POINT- ACTUAL

Therefore, except for the P-part and the present deviation (D-part) of the controller, all the others have an impact on the
calculation output.

In addition, Y is restricted to the range defined by Y_MIN and Y_MAX. If Y reaches a limit value, LIMITS_ACTIVE is set
to TRUE. If there is no calculation limit value, Y_MIN and Y_MAX must be set to 0.

Once MANUAL=TRUE, Y is written into Y_MANUAL.

A P adjustment can be achieved by setting TV=0.

-16-
AX series programmable controller programming manual Basic commands

1.2.4.2 PID
This function block is used to regulate proportions, integrals, and differentials.

Input variables:

Variable Data type Description


ACTUAL REAL; Actual value of the control variable.
SET_POINT REAL; Expected value, command variable.
Proportional coefficient. The value cannot be 0 for the unity gain in the
KP REAL; P- part; otherwise, the function block does not perform any
calculations.
Reset time. The unit gain in the i part is fixed to seconds. For example,
"0.5" is 500 milliseconds, the value must be greater than 0; otherwise,
TN REAL; the function block does not perform any calculations. A smaller TN
value obtains a greater integral part, including the variable value. A
greater TN value obtains a smaller integral part.
When the differential functions, the unit gain in the D- part is fixed to
TV REAL;
seconds. For example, "0.5" is 500 milliseconds.
Y_MANUAL REAL; The output value is Y when MANUAL = TRUE.
Y_OFFSET REAL; Offset operation variable Y.
A smaller resp value indicates a higher upper limit of the operation
variable Y. If Y exceeds a limit value, LIMITS_ACTIVE is set to TRUE
Y_MIN, Y_MAX REAL;
and Y is kept within the formulated range. Only when Y_MIN <
Y_MAX, the control takes effect.
If it is TRUE, manual operating is activated, and the operation variable
MANUAL BOOL
is defined through Y_MANUAL.
During initialization in which Y is equal to Y_OFFSET, setting the value
RESET BOOL
to TRUE will reset the controller.

Output variables:

Variable Data type Description


Operation variable value, defined by the function block (see the
Y REAL;
following).
The value TRUE indicates that Y is out of the range defined by Y_MIN
LIMITS_ACTIVE BOOL
and Y_MAX.
OVERFLOW BOOL The value TRUE indicates overflow.

Example in FBD:

-17-
AX series programmable controller programming manual Basic commands

Y_OFFSET, Y_MIN, and Y_MAX are used to convert numbers in specified ranges.

MANUAL can be used to enable or disable manual operating. RESET is used to reset the controller.

During normal operating (MANUAL = RESET = LIMITS_ACTIVE = FALSE), the controller calculates the deviation value
SET_POINT- ACTUAL and stores the time-related derivatives de/dt as internal variables.

The output value Y can be obtained by using the following:

1 𝛿∆
Y = KP ∙ (∆ + ∫ 𝑒dt + TV ) + Y_OFFSET
𝑇𝑁 𝛿𝑡

In the formula, ∆=SET_POINT - ACTUAL

Therefore, except for the P-part and the present deviation (D-part) of the controller, all the others have an impact on the
calculation output.

The PID controller can be easily converted into a PI controller by setting TV=0.

Incorrect controller parameter settings may cause overflow if the incorrect integral part becomes larger. Therefore, for
safety purpose, the output can invoke OVERFLOW, in which the value is TRUE. This happens only when the control
system is unstable due to incorrect parameter settings. At the same time, the controller is suspended and can be
reactivated only through re-initialization.

1.2.4.3 PID_FIXCYCLE
Example in FBD:

The function of this function module is the same as that of the PID controller. The difference is that its cycle time is set by
CYCLE (seconds) instead of being automatically measured by an internal function.

-18-
AX series programmable controller programming manual Basic commands

1.2.5 Signal generator

1.2.5.1 BLINK
This function block is used to generate a pulse signal. The input variable ENABLE is of the BOOL type, and the input
variables TIMELOW and TIMEHIGH are of the TIME type. The output variable OUT is of the BOOL type.

If ENABLE is set to TRUE, BLINK is enabled. The value of OUT is TRUE within the time period specified by TIMEHIGH,
while it is FALSE within the time period specified by TIMELOW.

Example in CFC:

1.2.5.2 FREQ_MEASURE
This function block is used to measure the (average) frequency value (Hz) of the Boolean input signal. Measuring
periods can be specified. A measuring period is the interval between two signal rising edges.

Input variables:

Variable Data type Description


IN BOOL Input signal.
Sequence number of a period, which is the interval between two signal
PERIODS INT
rising edges. Options: 1 to 10
RESET BOOL Used to reset all parameters to 0.

Output variables:

Variable Data type Description


OUT REAL Result frequency [Hz]
The value is FALSE until the first measuring ends or if the period is
VALID BOOL
greater than 3*OUT (indicating an input fault).

Example in FBD:

1.2.5.3 GEN
This function block is used to generate standard oscillation periods.

The input variable MODE can predefine the GEN_MODE type; BASE is of the BOOL type; PERIOD is of the TIME type;
CYCLES and AMPLITUDE are of the INT type; RESET is of the BOOL type.

-19-
AX series programmable controller programming manual Basic commands

MODE is used to define oscillation generation mode. Among them, the enumerated values TRIANGLE and
TRIANGLE_POS are triangle waves; SAWTOOTH_RISE indicates incremental sawtooth waves; SAWTOOTH_FALL
indicates decremental sawtooth waves; RECTANGLE indicates square waves; SINUS and COSINUS indicate sine
waves and cosine waves respectively.

BASE is used to define whether to use the set time to define the cyclic period (BASE=TRUE) or use a specific period
value that represents the number of times the function block is invoked to define the cyclic period (BASE=FALSE).

PERIOD or CYCLS is used to define the corresponding cyclic period.

AMPLITUDE is used to define the amplitude generated.

When RESET=TRUE, the signal generator is reset to 0.

-20-
AX series programmable controller programming manual Basic commands

-21-
AX series programmable controller programming manual Basic commands

Example in CFC:

1.2.6 Operation function block

1.2.6.1 CHARCURVE
This function block is used to express values in linear manner.

The input variable IN is of the INT type, used to set the value to be processed; N is of the BYTE type, used to set the
number of points. P is a predefined POINT-type value based on two integers (X and Y), and array P[0..10] is used to
generate characteristic lines.

The output variable OUT is of the INT type, used to output processed data; ERR is of the BYTE type, used to display
errors.

The points P[0]..P[N-1] in the array must be sorted according to their X values; otherwise, ERR receives the value 1. If
the value of IN is not between P[0].X and P[N-1].X, ERR=2, and OUT contains the corresponding limit value P[0].Y or
P[N-1].Y .

If the value of N is out of the range 2–11, ERR=4.

Example in FBD:

-22-
AX series programmable controller programming manual Basic commands

Example in ST:

First, define array P.

VAR

...

CHARACTERISTIC_LINE:CHARCURVE;

KL:ARRAY[0..10] OF POINT:=[(X:=0,Y:=0),(X:=250,Y:=50),

(X:=500,Y:=150),(X:=750,Y:=400),7((X:=1000,Y:=1000))];

COUNTER:INT;

...

END_VAR

Then, supply CHARCURVE with a constantly increasing value, such as:

COUNTER:=COUNTER+10;

CHARACTERISTIC_LINE(IN:=COUNTER,N:=5,P:=KL);

Track the display effect:

1.2.6.2 RAMP_INT
This function block is used to limit the rising or falling rates of the input values.

The input variables IN, ASCEND and DESCEND are of the INT type, among which, IN is the input value, while ASCEND
and DESCEND are the maximum increment value and decrement value in a given time respectively. TIMEBASE is a
TIME type, used to set a given time. When the value of RESET is TRUE, RAMP_INT is reinitialized.

The output variable OUT is of the INT type, and it contains the numbers of which the rising rate and falling rate have
been restricted.

-23-
AX series programmable controller programming manual Basic commands

When the value of TIMEBASE is t#0S, ASCEND and DESCEND are irrelevant with the time interval, but kept the same.

Example in CFC:

1.2.6.3 RAMP_REAL
With similar functions, RAMP_REAL differs from RAMP_INT only in the following: The input variables IN, ASCEND, and
DESCEND, and the output variable OUT of RAMP_REAL are of the REAL type.

1.2.7 Analog value processing

1.2.7.1 HYSTERESIS
This function block contains three INT-type variables IN, HIGH and LOW. The output variable OUT is of the BOOL type.

If IN is lower than the lower limit LOW, the value of OUT is TRUE. If IN is higher than the lower limit HIGH, the value of
OUT is FALSE.

Example in FBD:

-24-
AX series programmable controller programming manual Basic commands

1.2.7.2 LIMITALARM
This function block is used to check whether input values are within the set ranges and which limits are exceeded.

The input variables IN, HIGH and LOW are all of the INT type. The output variables O, U, and IL are all of the BOOL type.

When IN reaches the input upper limit HIGH, O is set to TRUE; when IN is lower than LOW, U is set to TRUE. When IN is
between LOW and HIGH, IL is set to TRUE.

Example in FBD:

-25-
AX series programmable controller programming manual Motion control commands

2 Motion control commands

2.1 Description of the SM3_Basic library


2.1.1 MC_Power
MC_Power: used to enable the servo drive.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_Power(
Axis:= ,
Enable:= ,
bRegulatorOn:= ,
Axis bDriveStart:= ,
MC_Power Status=> ,
enabling bRegulatorRealState=> ,
bDriveStartRealState=> ,
Busy=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
A rising edge of the input will
Execution
Enable BOOL TRUE, FALSE FALSE start the processing of the
condition
function block.
Execution
bRegulatorOn BOOL TRUE, FALSE FALSE
condition
Execution
bDriveStart BOOL TRUE, FALSE FALSE
condition

 Output variable

Valid Initial
Output variable Name Data type Description
range value
TRUE, It becomes TRUE when the
Status Enabling BOOL FALSE
FALSE Enabled state is entered.
bRegulatorRealState BOOL TRUE, FALSE It becomes TRUE after

-26-
AX series programmable controller programming manual Motion control commands

Valid Initial
Output variable Name Data type Description
range value
FALSE bRegulatorOn is set to TRUE.
TRUE, It becomes TRUE after
bDriveStartRealState BOOL FALSE
FALSE bDriveStart is set to TRUE.
TRUE, It becomes TRUE after the
Busy Executing BOOL FALSE
FALSE command is accepted.
TRUE, It becomes TRUE when a fault
Error Error flag BOOL FALSE
FALSE occurs.
When an error occurs, the error
ErrorID Error ID SMC_ERROR
ID is output.

(3) Function description

When Enable is set to TRUE, the axis specified by Axis enters the operable state. Setting the axis status to operable can
implement axis control. When Enable is set to FALSE, the axis specified by Axis exits the operable state. After exiting the
operable state, the axis does not accept any command, and therefore axis control cannot be implemented. In addition,
the axis abnormally responds to motion commands, but the axis can execute the MC_Power and MC_Reset commands.

2.1.2 MC_Halt
MC_Halt: used to stop the motion of a specified axis.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_Halt(
Axis:= ,
Command Execute:= ,
Deceleration:= ,
to stop an Jerk:= ,
MC_Halt
axis Done=> ,
Busy=> ,
normally CommandAborted=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
A rising edge of the input will
Execution
Execute BOOL TRUE, FALSE FALSE start the processing of the
condition
function block.
Deceleration Deceleration LREAL Positive 0 Function block deceleration

-27-
AX series programmable controller programming manual Motion control commands

Initial
Input variable Name Data type Valid range Description
value
2
number or 0 speed (μ/S )
Execution Positive Specified jump [Command
Jerk LREAL 0 3
condition number or 0 unit/S ]

 Output variable

Valid Initial Description


Output variable Name Data type
range value
Command It is set to TRUE after the axis
TRUE,
Done execution BOOL FALSE command is executed
FALSE
completion completely.
Command
TRUE, It is set to TRUE when the axis
Busy being BOOL FALSE
FALSE command is being executed.
executed
Command TRUE, It is set to TRUE when the axis
CommandAborted BOOL FALSE
interruption FALSE command is interrupted.
TRUE, It is set to TRUE when an error
Error Error flag BOOL FALSE
FALSE occurs.
When an error occurs, the
ErrorID Error ID SMC_ERROR 0
error ID is output.

(3) Function description

Starting this function block can stop the motion of an axis, but the execution of this function block can be terminated
when another motion axis command is started. This function block can be executed only when the axis is in running state.
This function block is started at the rising edge of the input variable execution condition. The axis status changes from
Discrete Motion during function block execution and to Standstill after the function block execution.

2.1.3 MC_Home
MC_Home: used to determine the home position of an axis.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_Home(
Axis:= ,
Execute:= ,

Axis homing Position:= ,


MC_Home Done=> ,
command Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );

-28-
AX series programmable controller programming manual Motion control commands

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
A rising edge of the input will
Execution
Execute BOOL TRUE, FALSE FALSE start the processing of the
condition
function block.
Position that
Position the axis LREAL Data range 0 Home position of the axis.
reaches

 Output variable

Initial
Output variable Name Data type Valid range Description
value
Command It is set to TRUE after the axis
Done execution BOOL TRUE, FALSE FALSE command is executed
completion completely.
Command
It is set to TRUE when the axis
Busy being BOOL TRUE, FALSE FALSE
command is being executed.
executed
Command It is set to TRUE when the axis
CommandAborted BOOL TRUE, FALSE FALSE
interruption command is interrupted.
It is set to TRUE when an error
Error Error flag BOOL TRUE, FALSE FALSE
occurs.
When an error occurs, the error
ErrorID Error ID SMC_ERROR 0
ID is output.

(3) Function description

This function block is used for homing and it is started at the rising edge of the input variable execution condition. The
position that the axis of the input variable reaches is the Home position. This function block can be executed only when
the axis is in the Standstill state. In addition, the servo homing mode must be set before the execution, and the axis must
be in the Homing state during the execution.

There are two methods for setting the homing mode:

Method 1: Manually setting servo function codes

Method 2: Setting startup parameters of AX series slave nodes. If communication modes are used, index and sub-index
data must be set.

-29-
AX series programmable controller programming manual Motion control commands

Item Index Sub-index Description


Homing method 0x6098 Set parameters according to specific servo manuals.
Origin finding Generally the speed is defined relatively high, reducing the
0x6099 0x01
speed zero return time.
Zero finding speed 0x6099 0x02 Generally the speed is defined relatively low.
ACC/DEC for
0x609A Acceleration or deceleration during homing.
homing
Homing timeout If the homing time exceeds the specified time, the system
0x2005 0x24
time reports "Err.601".

The setting interface is similar to the following:

2.1.4 MC_MoveAbsolute
MC_MoveAbsolute: used to specify the destination position of absolute coordinates for positioning.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_MoveAbsolute(
Axis:= ,
Execute:= ,
Axis Position:= ,
Velocity:= ,
absolute Acceleration:= ,
MC_Move Deceleration:= ,
position
Jerk:= ,
Absolute
control Direction:= ,
Done=> ,
command Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.

 Input variable

-30-
AX series programmable controller programming manual Motion control commands

Valid Initial
Input variable Name Data type Description
range value
A rising edge of the input will
Execution TRUE,
Execute BOOL FALSE start the processing of the
condition FALSE
function block.
Position that
Position the axis LREAL Data range 0 Absolute position of the axis.
reaches
Max. speed at which the axis
Running
Velocity LREAL Data range 0 runs to reach the destination
speed
position.
Acceleration when the speed
Acceleration Acceleration LREAL Data range 0
increases.
Deceleration when the speed
Deceleration Deceleration LREAL Data range 0
reduces.
Slope change value of the
Jerk Jump LREAL Data range 0 curve acceleration or
deceleration.
Negative: Move reversely.
Shortest: Select a direction
depending on the shortest
Negative,
distance.
Shortest,
Command Positive: Move forward.
Direction MC_DIRECTION Positive, Shortest
polarity Current: Move at the current
Current,
direction.
Fastest
Fastest: Automatically choose
to move at fastest manner.
(Valid only in rotary mode)

 Output variable

Valid Initial
Output variable Name Data type Description
range value
Command It is set to TRUE after the axis
TRUE,
Done execution BOOL FALSE command is executed
FALSE
completion completely.
Command TRUE, It is set to TRUE when the axis
Busy BOOL FALSE
being executed FALSE command is being executed.
Command TRUE, It is set to TRUE when the axis
CommandAborted BOOL FALSE
interruption FALSE command is interrupted.
TRUE, It is set to TRUE when an error
Error Error flag BOOL FALSE
FALSE occurs.
When an error occurs, the error
ErrorID Error ID SMC_ERROR 0
ID is output.

-31-
AX series programmable controller programming manual Motion control commands

(3) Function description

This function block is the axis absolute-position command. Before executing this function block, the axis is in the Standstill
state. After the function block is started at the rising edge, the axis is in the Discrete Motion state and moves to the
specified position. When Jerk is 0, the axis performs trapezoidal acceleration/deceleration movement; when Velocity,
Acceleration, Deceleration and Jerk are not empty, the axis performs S-curve acceleration/deceleration movement.
 Trapezoidal acceleration/deceleration action

 S-curve acceleration/deceleration action

(4) Timing diagram


 The axis must be in the Standstill state.
 The function block is started at the rising edge.
 For the function block, when Done is TRUE, the execution is completed; otherwise, Busy is TRUE.

-32-
AX series programmable controller programming manual Motion control commands

2.1.5 MC_AccelerationProfile
MC_AccelerationProfile: indicates the motion model of the time segment and acceleration/deceleration profile.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_AccelerationProfile(
Axis:= ,
TimeAcceleration:=
,
Execute:= ,
MC_ Acceleration ArraySize:= ,
AccelerationScale:=
Acceleration profile
,
Profile command Offset:= ,
Done=> ,
Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.
Acceleration Acceleration time and data
time and MC_TA_ description of the axis. The
TimeAcceleration
description REF acceleration data consists of
of the axis multiple groups of data.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
A rising edge of the input will
Execution
Execute BOOL TRUE, FALSE FALSE start the processing of the
condition
function block.
Number of arrays used in the
ArraySize Dynamic arrays INT Data range 0
motion profile.
Comprehensive Positive Scale factor of acceleration or
AccelerationScale LREAL 1
factor number or 0 deceleration in MC_TA_REF.
Overall offset value of
Offset Offset LREAL 0
acceleration and deceleration.

 Output variable

Initial
Output variable Name Data type Valid range Description
value
Command It is set to TRUE after the axis
Done BOOL TRUE, FALSE FALSE
execution command is executed

-33-
AX series programmable controller programming manual Motion control commands

Initial
Output variable Name Data type Valid range Description
value
completion completely.
Command
It is set to TRUE when the axis
Busy being BOOL TRUE, FALSE FALSE
command is being executed.
executed
Command It is set to TRUE when the axis
CommandAborted BOOL TRUE, FALSE FALSE
interruption command is interrupted.
It is set to TRUE when an error
Error Error flag BOOL TRUE, FALSE FALSE
occurs.
When an error occurs, the error
ErrorID Error ID SMC_ERROR 0
ID is output.

(3) Function description

This function block is used to specify the motion model of the time segment and acceleration/deceleration profile. During
the function block execution, the axis is in the Discrete Motion state, and it uses the data in TimeAcceleration. The axis
must be in the Standstill state before the function block execution and in the Discrete Motion state during the execution.
This function block is started at the rising edge. The execution of this function block superimposes the speeds of the axis
that is in the Discrete Motion state, which may cause system faults.

(4) Timing diagram

-34-
AX series programmable controller programming manual Motion control commands

2.1.6 MC_MoveAdditive
MC_MoveAdditive: used for positioning when a specified distance is superimposed to the original position of an axis.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_MoveAdditive(
Axis:= ,
Execute:= ,
Distance:= ,
Absolute Velocity:= ,
MC_ motion Acceleration:= ,
Deceleration:= ,
MoveAdditive superimpostion Jerk:= ,
Done=> ,
command
Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
A rising edge of the input will
Execution
Execute BOOL TRUE, FALSE FALSE start the processing of the
condition
function block.
Position that
Superimposed position data of
Distance the axis LREAL Data range 0
the axis.
reaches
Max. speed at which the axis
Running
Velocity LREAL Data range 0 runs to reach the destination
speed
position.
Acceleration when the speed
Acceleration Acceleration LREAL Data range 0
increases.
Deceleration when the speed
Deceleration Deceleration LREAL Data range 0
reduces.
Slope change value of the curve
Jerk Jump LREAL Data range 0
acceleration or deceleration.

 Output variable

-35-
AX series programmable controller programming manual Motion control commands

Initial
Output variable Name Data type Valid range Description
value
Command It is set to TRUE after the axis
Done execution BOOL TRUE, FALSE FALSE command is executed
completion completely.
Command
It is set to TRUE when the axis
Busy being BOOL TRUE, FALSE FALSE
command is being executed.
executed
Command It is set to TRUE when the axis
CommandAborted BOOL TRUE, FALSE FALSE
interruption command is interrupted.
It is set to TRUE when an error
Error Error flag BOOL TRUE, FALSE FALSE
occurs.
When an error occurs, the error
ErrorID Error ID SMC_ERROR 0
ID is output.

(3) Function description

The startup command is Execute, the rising edge triggers the function block, and Distance specifies the superimposed
data of the axis. If the running state of this function block is Discrete Motion, the CommandAbort values of other
commands are set; in the standstill state, this command can run independently to achieve relative positioning
requirements; if Acceleration or Deceleration is zero, the command execution is abnormal, but the axis is in the Discrete
Motion state; when Jerk is 0, the axis performs trapezoidal acceleration or deceleration motion; when Velocity,
Acceleration, Deceleration and Jerk are not empty, it performs S-curve acceleration or deceleration motion.

 Trapezoidal acceleration/deceleration action

 S-curve acceleration/deceleration action

-36-
AX series programmable controller programming manual Motion control commands

(4) Timing diagram

 Example

 Timing description

2.1.7 MC_MoveRelative
MC_Move Relative: used for positioning by specify the moving distance from the current position.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_MoveRelative(
Axis:= ,
Execute:= ,
Distance:= ,
Axis Velocity:= ,
MC_ relative Acceleration:= ,
Deceleration:= ,
MoveRelative positioning Jerk:= ,
Done=> ,
command
Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

-37-
AX series programmable controller programming manual Motion control commands

Initial
I/O variable Name Data type Valid range Description
value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
A rising edge of the input will
Execution
Execute BOOL TRUE, FALSE FALSE start the processing of the
condition
function block.
Relative
Distance position of LREAL Data range 0 Relative position of motion.
motion
Max. speed at which the axis
Running
Velocity LREAL Data range 0 runs to reach the destination
speed
position.
Acceleration when the speed
Acceleration Acceleration LREAL Data range 0
increases.
Deceleration when the speed
Deceleration Deceleration LREAL Data range 0
reduces.
Slope change value of the curve
Jerk Jump LREAL Data range 0
acceleration or deceleration.

 Output variable

Initial
Output variable Name Data type Valid range Description
value
Command It is set to TRUE after the axis
Done execution BOOL TRUE, FALSE FALSE command is executed
completion completely.
Command
It is set to TRUE when the axis
Busy being BOOL TRUE, FALSE FALSE
command is being executed.
executed
Command It is set to TRUE when the axis
CommandAborted BOOL TRUE, FALSE FALSE
interruption command is interrupted.
It is set to TRUE when an error
Error Error flag BOOL TRUE, FALSE FALSE
occurs.
When an error occurs, the error
ErrorID Error ID SMC_ERROR 0
ID is output.

(3) Function description

The axis must be in the Standstill state before the function block execution and in the Discrete Motion state during the
execution. Pay attention to the axis status during the execution to prevent other commands from interrupting the
command execution of the axis. The startup command is Execute, and the rising edge triggers the function block. The

-38-
AX series programmable controller programming manual Motion control commands

startup command can repeatedly make the rising edge valid when the axis is in the Discrete Motion state, which always
refreshes the position. When Acceleration or Deceleration is 0, the command execution is abnormal, but the axis is in the
Discrete Motion state.

 Trapezoidal acceleration/deceleration action

 S-curve acceleration/deceleration action

(4) Timing diagram

After the Execute command is executed, the rising edge triggers the function block. When Busy is set, the function block
is being executed. After the execution is completed, Done is set.

-39-
AX series programmable controller programming manual Motion control commands

2.1.8 MC_MoveSuperImposed
MC_MoveSuperImposed: used to superimpose speed and position data on the speed and position data in the running
command, which brings no change to the entire original command execution time model.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_MoveSuperImposed(
Axis:= ,
Execute:= ,
Distance:= ,
VelocityDiff:= ,
Relative motion
MC_Move Acceleration:= ,
superimposition Deceleration:= ,
SuperImposed Jerk:= ,
command Done=> ,
Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

Valid Initial
I/O variable Name Data type Description
range value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.

 Input variable

Valid Initial
Input variable Name Data type Description
range value
A rising edge of the input will
Execution TRUE,
Execute BOOL FALSE start the processing of the
condition FALSE
function block.
Relative
Distance position of LREAL Data range 0 The data is a relative position.
motion
Superimposition Superimposition speed for axis
VelocityDiff LREAL Data range 0
speed running.
Acceleration when the speed
Acceleration Acceleration LREAL Data range 0
increases.
Deceleration when the speed
Deceleration Deceleration LREAL Data range 0
reduces.
Slope change value of the
Jerk Jump LREAL Data range 0 curve acceleration or
deceleration.

 Output variable

-40-
AX series programmable controller programming manual Motion control commands

Valid Initial
Output variable Name Data type Description
range value
Command It is set to TRUE after the axis
TRUE,
Done execution BOOL FALSE command is executed
FALSE
completion completely.
Command TRUE, It is set to TRUE when the axis
Busy BOOL FALSE
being executed FALSE command is being executed.
Command TRUE, It is set to TRUE when the axis
CommandAborted BOOL FALSE
interruption FALSE command is interrupted.
TRUE, It is set to TRUE when an error
Error Error flag BOOL FALSE
FALSE occurs.
When an error occurs, the
ErrorID Error ID SMC_ERROR 0
error ID is output.

(3) Function description

This function block is the position and speed superimposition command. The startup command is Execute, and the rising
edge triggers the function block. VelocityDiff and Distance are superimposed to the speed and position of other
commands. In the motion mode, MC_MoveSuperImposed can be superimposed onto any other command. This function
block can solve the error compensation for the clearance between the belt and gear, which can ensure motion
consistency. To execute the function block, you need to set the parameter superimposition position.

 Trapezoidal acceleration/deceleration action

 S-curve acceleration/deceleration action

-41-
AX series programmable controller programming manual Motion control commands

(4) Timing diagram

 Example

 Timing description

-42-
AX series programmable controller programming manual Motion control commands

2.1.9 MC_MoveVelocity
MC_MoveVelocity: used to simulate speed control by using the servo drive position control mode.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_MoveVelocity(
Axis:= ,
Execute:= ,
Velocity:= ,
Acceleration:= ,
Speed
MC_ Deceleration:= ,
control Jerk:= ,
MoveVelocity Direction:= ,
command InVelocity=> ,
Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
A rising edge of the input will
Execution
Execute BOOL TRUE, FALSE FALSE start the processing of the
condition
function block.
Running
Velocity LREAL Data range 0 Specified speed for running.
speed
Acceleration when the speed
Acceleration Acceleration LREAL Data range 0
increases.
Deceleration when the speed
Deceleration Deceleration LREAL Data range 0
reduces.
Slope change value of the curve
Jerk Jump LREAL Data range 0
acceleration or deceleration.
positive,
Running
Direction MC_Direction negative, current Running direction.
direction
current

 Output variable

Initial
Output variable Name Data type Valid range Description
value
Done Command BOOL TRUE, FALSE FALSE It is set to TRUE after the axis

-43-
AX series programmable controller programming manual Motion control commands

Initial
Output variable Name Data type Valid range Description
value
execution command is executed
completion completely.
Command
It is set to TRUE when the axis
Busy being BOOL TRUE, FALSE FALSE
command is being executed.
executed
Command It is set to TRUE when the axis
CommandAborted BOOL TRUE, FALSE FALSE
interruption command is interrupted.
It is set to TRUE when an error
Error Error flag BOOL TRUE, FALSE FALSE
occurs.
When an error occurs, the error
ErrorID Error ID SMC_ERROR 0
ID is output.

(3) Function description

The startup command is Execute, and the rising edge triggers this function block. The drive performs speed control
according to the value of Velocity. InVelocity indicates that the running speed in the function block has reached the
specified value.

(4) Timing diagram

 Example

 Timing description

-44-
AX series programmable controller programming manual Motion control commands

2.1.10 MC_PositionProfile
MC_PositionProfile: indicates the motion model of the time segment and position profile.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_PositionProfile(
Axis:= ,
TimePosition:= ,
Execute:= ,
Position ArraySize:= ,
MC_ PositionScale:= ,
profile
Offset:= ,
PositionProfile
command Done=> ,
Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.
Running time and position data
Running time description of the axis. The
TimePosition and position MC_TP_REF data consists of multiple groups
description of data.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
A rising edge of the input will
Execution
Execute BOOL TRUE, FALSE FALSE start the processing of the
condition
function block.
Number of arrays used in the
ArraySize Array size INT Data range 0
motion profile.
Comprehensive Positive Position scaling factor in
PositionScale LREAL 0
factor number or 0 MC_TP_REF.
Overall offset value of the
Offset Offset LREAL 0
position.

 Output variable

Initial
Output variable Name Data type Valid range Description
value
Command It is set to TRUE after the axis
Done BOOL TRUE, FALSE FALSE
execution command is executed

-45-
AX series programmable controller programming manual Motion control commands

Initial
Output variable Name Data type Valid range Description
value
completion completely.
Command
It is set to TRUE when the axis
Busy being BOOL TRUE, FALSE FALSE
command is being executed.
executed
Command It is set to TRUE when the axis
CommandAborted BOOL TRUE, FALSE FALSE
interruption command is interrupted.
It is set to TRUE when an error
Error Error flag BOOL TRUE, FALSE FALSE
occurs.
SMC_ERRO When an error occurs, the error
ErrorID Error ID 0
R ID is output.

(3) Function description

This function block is used to specify the motion model of the time segment and position profile, using the data in
TimePosition. Before executing this function block, the axis is in the Standstill state. This function block is started at the
rising edge. The axis is in the Discrete Motion state during the function block execution.

(4) Timing diagram

2.1.11 MC_ReadActualPosition
MC_ReadActualPosition: used to read the actual position of the drive and save it to a user-defined variable.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_ReadActualPosition(
Actual Axis:= ,
MC_ Enable:= ,
position Valid=> ,
ReadActual
Busy=> ,
reading
Position Error=> ,
command ErrorID=> ,
Position=> );

(2) Related variables

-46-
AX series programmable controller programming manual Motion control commands

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
A rising edge of the input will
Execution
Enable BOOL TRUE, FALSE FALSE start the processing of the
condition
function block.

 Output variable

Initial
Output variable Name Data type Valid range Description
value
Obtainable Set to TRUE when the drive
Valid flag of BOOL TRUE, FALSE FALSE position can be obtained
position data correctly.
Command
It is set to TRUE when the axis
Busy being BOOL TRUE, FALSE FALSE
command is being executed.
executed
It is set to TRUE when an error
Error Error flag BOOL TRUE, FALSE FALSE
occurs.
When an error occurs, the error
ErrorID Error ID SMC_ERROR 0
ID is output.
Obtained axis
Position LREAL Axis position 0 Axis position data that is read.
position

(3) Function description

This function block is started at the rising edge and it can read the axis position value. When Valid is TRUE, the read
position value is valid. This function block can be repeatedly invoked, and the invoking does not affect the other.

(4) Timing diagram

-47-
AX series programmable controller programming manual Motion control commands

2.1.12 MC_ReadBoolParameter
MC_ReadBoolParameter: used to read the bit parameters of the drive axis and saves them to user-defined variables.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_ReadBoolParameter(
Axis:= ,
Enable:= ,
Axis bit
MC_ ParameterNumber:= ,
parameter Valid=> ,
ReadBoolParameter Busy=> ,
reading Error=> ,
ErrorID=> ,
Value=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
Execution When it is set to TRUE, this
Enable BOOL TRUE, FALSE FALSE
condition function block is started.
Axis
Access index, sub-index, and
ParameterNumber parameter DINT 0
number of the axis parameter.
number

Note:

ParameterNumber (DINT) = -DWORD_TO_DINT(SHL(USINT_TO_DOWRD(usiDataLength), 24) (Data length in the


object dictionary)

+ SHL(UINT_TO_DWORD(uiIndex), 8) (Index in the object dictionary-16 bits)

+ usisubIndex (Sub-index in the object dictionary-8 bits)

usiDataLength: Fill in according to the number of bytes: Byte 1 is 16#01; byte 2 is 16#02; byte 4 is 16#04 and so on.

 Output variable

Initial
Output variable Name Data type Valid range Description
value
Obtainable
Set to TRUE when the drive
Valid flag of BOOL TRUE, FALSE FALSE
position can be obtained correctly.
position data
Busy Command BOOL TRUE, FALSE FALSE It is set to TRUE when the axis

-48-
AX series programmable controller programming manual Motion control commands

Initial
Output variable Name Data type Valid range Description
value
being command is being executed.
executed
It is set to TRUE when an error
Error Error flag BOOL TRUE, FALSE FALSE
occurs.
SMC_ERR When an error occurs, the error ID
ErrorID Error ID 0
OR is output.
Obtained
Value BOOL TRUE, FALSE FALSE The axis error code is read.
axis position.

(3) Function description

Bit data status is read from the drive by executing MC_ReadBoolParam, which is valid when Enable is TRUE. The
function block can be repeatedly executed, without mutual affecting. When Valid is TRUE, the bit status data is valid;
when Busy is TRUE, the function block is being executed.

(4) Timing diagram

2.1.13 MC_ReadAxisError
MC_ReadAxisError: used to read axis error information and save it to user-defined variables.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_ReadAxisError(
Axis:= ,
Enable:= ,
Valid=> ,
MC_ Axis error Busy=> ,
Error=> ,
Read AxisErro reading
ErrorID=> ,
AxisError=> ,
AxisErrorID=> ,
SWEndSwitchActive=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.

-49-
AX series programmable controller programming manual Motion control commands

 Input variable

Initial
Input variable Name Data type Valid range Description
value
Execution When it is set to TRUE, this
Enable BOOL TRUE, FALSE FALSE
condition function block is started.

 Output variable

Initial
Output variable Name Data type Valid range Description
value
Set to TRUE when the drive
Error data
Valid BOOL TRUE, FALSE FALSE position can be obtained
obtaining flag
correctly.
Command It is set to TRUE when the
Busy being BOOL TRUE, FALSE FALSE axis command is being
executed executed.
It is set to TRUE when an
Error Error flag BOOL TRUE, FALSE FALSE
error occurs.
When an error occurs, the
ErrorID Error ID SMC_ERROR TRUE, FALSE FALSE
error ID is output.
Axis error When an error is read, the
AxisError BOOL TRUE, FALSE FALSE
flag corresponding flag is set.
Axis error
AxisErrorID DWORD 0 The axis error code is read.
code
The software limit switch
Software limit
SWEndSwitchActive BOOL TRUE, FALSE FALSE status is checked during
switch status
command reading.

(3) Function description

This function block is used to read axis error information, and it is valid when Enable is TRUE. When Valid is TRUE,
AxisError and AxisErrorID are valid data values; when Busy is TRUE, the current function block is being executed. This
function block can be repeatedly executed without mutual affecting.

2.1.14 MC_ReadStatus
MC_Read Status: used to read axis status data and save it to user-defined variables.

(1) Command format

-50-
AX series programmable controller programming manual Motion control commands

Command Name Expressed in diagram Expressed in ST


MC_ReadStatus(
Axis:= ,
Enable:= ,
Valid=> ,
Busy=> ,
Error=> ,
ErrorID=> ,
Disabled=> ,
Axis
MC_ Errorstop=> ,
status Stopping=> ,
ReadStatus StandStill=> ,
reading DiscreteMotion=> ,
ContinuousMotion=> ,
SynchronizedMotion=> ,
Homing=> ,
ConstantVelocity=> ,
Accelerating=> ,
Decelerating=> ,
FBErrorOccured=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
Execution TRUE, When it is set to TRUE, this
Enable BOOL FALSE
condition FALSE function block is started.

 Output variable

Initial
Output variable Name Data type Valid range Description
value
Set to TRUE when the drive
Error data TRUE,
Valid BOOL FALSE position can be obtained
obtaining flag FALSE
correctly.
Command
TRUE, It is set to TRUE when the axis
Busy being BOOL FALSE
FALSE command is being executed.
executed
TRUE, It is set to TRUE when an error
Error Error flag BOOL FALSE
FALSE occurs.
TRUE, When an error occurs, the error
ErrorID Error ID SMC_ERROR FALSE
FALSE ID is output.
TRUE, Set to TRUE when the axis is
Disabled Axis disabled BOOL FALSE
FALSE disabled.
Axis error TRUE, Set to TRUE when the axis is
Errorstop BOOL FALSE
status FALSE running abnormally.

-51-
AX series programmable controller programming manual Motion control commands

Initial
Output variable Name Data type Valid range Description
value
Axis in stop TRUE, Set to TRUE when the axis is in
Stoping BOOL FALSE
process FALSE the stop process.
Set to TRUE when the axis is in
Standard TRUE, the StandStill state (able to
StandStill BOOL FALSE
status of axis FALSE run).

Discrete
TRUE, Set to TRUE when the axis is in
DiscreteMotion motion status BOOL FALSE
FALSE the DiscreteMotion state.
of axis
Continuous
TRUE, Set to TRUE when the axis is in
ContinuousMotion motion status BOOL FALSE
FALSE the ContinuousMotion state.
of axis
Synchronous
TRUE, Set to TRUE when the axis is in
SynchronizedMotion running BOOL FALSE
FALSE the SynchronizedMotion state.
status of axis
Homing TRUE, Set to TRUE when the axis is in
Homing BOOL FALSE
status of axis FALSE the Homing state.
Axis running
TRUE, Set to TRUE when the axis
ConstantVelocity speed BOOL FALSE
FALSE reaches the running speed.
reached
Acceleration TRUE, Set to TRUE when the axis is in
Accelerating BOOL FALSE
status of axis FALSE the Accelerating state.
Deceleration TRUE, Set to TRUE when the axis is in
Dccelerating BOOL FALSE
status of axis FALSE the Dccelerating state.
Axis function Set to TRUE when the axis
TRUE,
FBErrorOccured block error BOOL FALSE function block encounters an
FALSE
flag error.

(3) Function description

Axis status is read by executing MC_ReadStatus, which is valid when Enable is TRUE. This function block can be
repeatedly executed, without mutual affecting.

To execute the function block, set Enable to TRUE. When Valid is TRUE, the axis status data is valid; when Busy is
TRUE, the function block is being executed.

2.1.15 MC_ReadParameter
MC_ReadParameter: used to read drive axis parameters of the drive axis and saves them to user-defined variables.

(1) Command format

-52-
AX series programmable controller programming manual Motion control commands

Command Name Expressed in diagram Expressed in ST


MC_ReadParameter(
Axis:= ,
Enable:= ,
Axis
MC_ ParameterNumber:= ,
parameter Valid=> ,
ReadParameter Busy=> ,
reading Error=> ,
ErrorID=> ,
Value=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
Execution When it is set to TRUE, this
Enable BOOL TRUE, FALSE FALSE
condition function block is started.
Axis
Access index, sub-index, and
ParameterNumber parameter DINT 0
number of the axis parameter.
number

Note:

ParameterNumber (DINT) = -DWORD_TO_DINT(SHL(USINT_TO_DOWRD(usiDataLength), 24) (Data length in the


object dictionary)

+ SHL(UINT_TO_DWORD(uiIndex), 8) (Index in the object dictionary-16 bits)

+ usisubIndex (Sub-index in the object dictionary-8 bits)

usiDataLength: Fill in according to the number of bytes: Byte 1 is 16#01; byte 2 is 16#02; byte 4 is 16#04 and so on.

 Output variable

Initial
Output variable Name Data type Valid range Description
value
Obtainable Set to TRUE when the drive
Valid flag of position BOOL TRUE, FALSE FALSE position can be obtained
data correctly.
Command
It is set to TRUE when the axis
Busy being BOOL TRUE, FALSE FALSE
command is being executed.
executed
It is set to TRUE when an error
Error Error flag BOOL TRUE, FALSE FALSE
occurs.
When an error occurs, the error
ErrorID Error ID SMC_ERROR 0
ID is output.

-53-
AX series programmable controller programming manual Motion control commands

Initial
Output variable Name Data type Valid range Description
value
Obtained axis
Value BOOL TRUE, FALSE FALSE The axis error code is read.
position.

(3) Function description

Bit data status is read from the drive by executing MC_ReadBoolParam, which is valid when Enable is TRUE. The
function block can be repeatedly executed, without mutual affecting. When Valid is TRUE, the bit status data is valid;
when Busy is TRUE, the function block is being executed.

(4) Timing diagram

2.1.16 MC_Reset
MC_Reset: used to reset all errors of an axis.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_Reset(
Axis:= ,
Axis error
Execute:= ,
MC_Reset reset Done=> ,
Busy=> ,
command Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
The rising edge will start the
Execution
Execute BOOL TRUE, FALSE FALSE processing of the function
condition
block.

 Output variable

-54-
AX series programmable controller programming manual Motion control commands

Initial
Output variable Name Data type Valid range Description
value
Command It is set to TRUE after the axis
Done execution BOOL TRUE, FALSE FALSE command is executed
completion completely.
Command
It is set to TRUE when the axis
Busy being BOOL TRUE, FALSE FALSE
command is being executed.
executed
It is set to TRUE when an error
Error Error flag BOOL TRUE, FALSE FALSE
occurs.
When an error occurs, the
ErrorID Error ID SMC_ERROR 0
error ID is output.

(3) Function description

This function can change the axis status from Errorstop to Standstill when the axis is in normal communication. If the axis
cannot be reset from the Errostop state and Axis.bCommunication is FALSE, you must re-establish the communication
between the master and slave axes.

(4) Timing diagram

2.1.17 MC_Stop
MC_Stop: used to instruct an axis to decelerate to stop.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_Stop(
Axis:= ,
Execute:= ,
Axis stop Deceleration:= ,
MC_Stop Jerk:= ,
command Done=> ,
Busy=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

-55-
AX series programmable controller programming manual Motion control commands

Valid Initial
I/O variable Name Data type Description
range value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.

 Input variable

Valid Initial
Input variable Name Data type Description
range value
Execution TRUE, The rising edge will start the
Execute BOOL FALSE
condition FALSE processing of the function block.
Positive
Function block deceleration speed
Deceleration Deceleration LREAL number or 0 2
(μ/S )
0
Positive
3
Jerk Jump LREAL number or 0 Specified jump [Command unit/S ]
0

 Output variable

Valid Initial
Output variable Name Data type Description
range value
Command
TRUE, It is set to TRUE after the axis
Done execution BOOL FALSE
FALSE command is executed completely.
completion
Command
TRUE, It is set to TRUE when the axis
Busy being BOOL FALSE
FALSE command is being executed.
executed
TRUE, It is set to TRUE when an error
Error Error flag BOOL FALSE
FALSE occurs.
When an error occurs, the error ID
ErrorID Error ID SMC_ERROR 0
is output.

(3) Function description

This function block is used to stop the motion of an axis that is in normal running. It does not take effect to the axis when
it is in the Stopping state.

If the axis is in the Stopping state, Execute is Flase, and Done is TRUE, and the axis status changes to Standstill. The
function block can be executed only when the axis is in the Motion state. The function block is started at the rising edge.
If Busy is TRUE when MC_Stop is in the execution process, the restart of MC_Stop will cause the axis to enter the
Errorstop state.

(4) Timing diagram

 Example

Flag bit difference in executing MC_MoveVelocity and MC_Stop:

-56-
AX series programmable controller programming manual Motion control commands

2.1.18 MC_VelocityProfile
MC_VelocityProfile: indicates the motion model of the time segment and speed profile.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_VelocityProfile(
Axis:= ,
TimeVelocity:= ,
Execute:= ,
Speed ArraySize:= ,
MC_ VelocityScale:= ,
profile
Offset:= ,
VelocityProfile
command Done=> ,
Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

I/O variable Name Data type Valid range Initial value Description
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.
TimeVelocity Running MC_TV_REF Runing time and speed data

-57-
AX series programmable controller programming manual Motion control commands

I/O variable Name Data type Valid range Initial value Description
time and description of the axis. The
description data consists of multiple
of axis groups of data.

 Input variable

Input variable Name Data type Valid range Initial value Description
The rising edge will start the
Execution
Execute BOOL TRUE, FALSE FALSE processing of the function
condition
block.
Dynamic Number of arrays used in the
ArraySize INT 0
arrays motion profile.
Speed Positive
VelocityScale LREAL 1 Speed scaling factor.
factor number or 0
Overall offset value of the
Offset Offset LREAL 0
speed.

 Output variable

Output variable Name Data type Valid range Initial value Description
Command It is set to TRUE after the
Done execution BOOL TRUE, FALSE FALSE axis command is executed
completion completely.
Command It is set to TRUE when the
Busy being BOOL TRUE, FALSE FALSE axis command is being
executed executed.
It is set to TRUE when an
Error Error flag BOOL TRUE, FALSE FALSE
error occurs.
When an error occurs, the
ErrorID Error ID SMC_ERROR 0
error ID is output.

(3) Function description

This function block is used to specify the motion model of the time segment and speed profile. The axis running mode is
Continuous Motion, and the function block uses the data in TimeVelocity. The axis must be in the Standstill state before
the function block execution and in the Discrete Motion state during the execution. This function block is started at the
rising edge. This function block can be repeatedly executed when the axis is in the Discrete Motion state. TimeVelocity is
of the MC_TV_REF data type.

MC_TV_REF is described as follows:

Member Type Initial value Description


Number_of_pairs INT 0 Number of profile path segments.
Absolute motion (TRUE) or
IsAbsolute BOOL TRUE
relative motion (FALSE).
MC_TV_Array ARRAY[1..N] OF SMC_TV Data arrays of time and speed.

-58-
AX series programmable controller programming manual Motion control commands

SMC_TV is described as follows:

Member Type Initial value Description


delta_time TIME TIME#0ms Time of a speed segment.
Velocity LREAL 0 Speed that is recorded currently.

Note: The entire speed process represents the S curve with acceleration and deceleration, and the speed of each profile
segment is calculated by superimposition; during repeated running, the speed is also superimposed to avoid the
occurrence of speed limit exceeding; before repeated running, the axis status must be set to Standstill.

(4) Timing diagram

2.1.19 MC_WriteBoolParameter
MC_WriteBoolParameter: used to set the bit parameters of the drive axis.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_WriteBoolParameter(
Axis:= ,
Execute:= ,
MC_ Axis bit
ParameterNumber:= ,
WriteBool parameter Value:= ,
Done=> ,
Parameter setting Busy=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
Execution TRUE, When it is set to TRUE, this
Enable BOOL FALSE
condition FALSE function block is started.

-59-
AX series programmable controller programming manual Motion control commands

Initial
Input variable Name Data type Valid range Description
value
Axis
Access index, sub-index, and
ParameterNumber parameter DINT 0
number of the axis parameter.
number
TRUE,
Value Setting BOOL FALSE Used to set the bit parameters.
FALSE

Note:

ParameterNumber (DINT) = -DWORD_TO_DINT(SHL(USINT_TO_DOWRD(usiDataLength), 24) (Data length in the


object dictionary)

+ SHL(UINT_TO_DWORD(uiIndex), 8) (Index in the object dictionary-16 bits)

+ usisubIndex (Sub-index in the object dictionary-8 bits)

usiDataLength: Fill in according to the number of bytes: Byte 1 is 16#01; byte 2 is 16#02; byte 4 is 16#04 and so on.

 Output variable

Output Initial
Name Data type Valid range Description
variable value
Set to TRUE when the setting
Done Setting result BOOL TRUE, FALSE FALSE
operation succeeds.
Command It is set to TRUE when the axis
Busy BOOL TRUE, FALSE FALSE
being executed command is being executed.
It is set to TRUE when an error
Error Error flag BOOL TRUE, FALSE FALSE
occurs.
When an error occurs, the error
ErrorID Error ID SMC_ERROR 0
ID is output.

(3) Function description

Axis bit parameters are set by executing MC_WriteBoolParameter, which is started at the rising edge. This function block
can be repeatedly executed, without mutual affecting.

(4) Timing diagram

The function block can be triggered only at the rising edge.

When Done is TRUE, the setting operation is successful.

When Busy is TRUE, the function block is being executed.

 Timing description

-60-
AX series programmable controller programming manual Motion control commands

2.1.20 MC_WriteParameter
MC_WriteParameter: used to set the bit parameters of the drive axis.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_WriteParameter(
Axis:= ,
Execute:= ,
MC_ Axis
ParameterNumber:= ,
Write parameter Value:= ,
Done=> ,
Parameter setting Busy=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

I/O variable Name Data type Valid range Initial value Description
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.

 Input variable

Input variable Name Data type Valid range Initial value Description
Execution When it is set to TRUE, this
Enable BOOL TRUE, FALSE FALSE
condition function block is started.
Axis Access index, sub-index, and
ParameterNumber parameter DINT 0 number of the axis
number parameter.
Used to set the bit
Value Setting BOOL TRUE, FALSE FALSE
parameters.

Note:

ParameterNumber (DINT) = -DWORD_TO_DINT(SHL(USINT_TO_DOWRD(usiDataLength), 24) (Data length in the


object dictionary)

+ SHL(UINT_TO_DWORD(uiIndex), 8) (Index in the object dictionary-16 bits)

+ usisubIndex (Sub-index in the object dictionary-8 bits)

usiDataLength: Fill in according to the number of bytes: Byte 1 is 16#01; byte 2 is 16#02; byte 4 is 16#04 and so on.

 Output variable

Output
Name Data type Valid range Initial value Description
variable
Set to TRUE when the setting
Done Setting result BOOL TRUE, FALSE FALSE
operation succeeds.
Command It is set to TRUE when the axis
Busy BOOL TRUE, FALSE FALSE
being executed command is being executed.
It is set to TRUE when an error
Error Error flag BOOL TRUE, FALSE FALSE
occurs.

-61-
AX series programmable controller programming manual Motion control commands

Output
Name Data type Valid range Initial value Description
variable
When an error occurs, the error
ErrorID Error ID SMC_ERROR 0
ID is output.

(3) Function description

Axis bit parameters are set by executing MC_WriteParameter, which is started at the rising edge. This function block can
be repeatedly executed, without mutual affecting.

(4) Timing diagram

The function block can be triggered only at the rising edge.

When Done is TRUE, the setting operation is successful.

When Busy is TRUE, the function block is being executed.

 Timing description

2.1.21 MC_AbortTrigger
MC_AbortTrigger: used to terminate the association features of latch related events, in conjunction with
MC_Touchprobe.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_AbortTrigger(
Axis:= ,
Event TriggerInput:= ,
MC_ Execute:= ,
association
Done=> ,
AbortTrigger
terminating Busy=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.
Trigger Description such as trigger
TruggerInput TRIIGGER_REF
signal signal and attributes.

 TRIIGGER_REF description:

-62-
AX series programmable controller programming manual Motion control commands

Data
I/O variable Name Initial value Description
type
Used to select a function to lock in the
drive mode.
0: Rising edge latching for probe 1
iTriggerNumber INT --1
1: Falling edge latching for probe 1
2: Rising edge latching for probe 2
3: Falling edge latching for probe 2
TRIIGGER_
Used to specify the latching trigger
REF
mode.
bFastLatching BOOL TRUE
TRUE: Drive mode
FALSE: Controller mode
When bFastLatching=FLASE, the
bInput BOOL
controller inputs a signal for trigger.
bActive BOOL Valid signal for trigger.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
Execution When it is set to TRUE, this
Enable BOOL TRUE, FALSE FALSE
condition function block is started.

 Output variable

Initial
Output variable Name Data type Valid range Description
value
Setting Set to TRUE when the setting
Done BOOL TRUE, FALSE FALSE
result operation succeeds.
Command It is set to TRUE when the
Busy being BOOL TRUE, FALSE FALSE axis command is being
executed executed.
It is set to TRUE when an
Error Error flag BOOL TRUE, FALSE FALSE
error occurs.
When an error occurs, the
ErrorID Error ID SMC_ERROR 0
error ID is output.

(3) Function description

The MC_AbortTrigger function block is used to terminate the association between the trigger signal/attribute and the
related trigger command. To execute the function block, set Execute to TRUE. When Valid is TRUE, the setting operation
is successful; when Busy is TRUE, the function block is being executed.

-63-
AX series programmable controller programming manual Motion control commands

2.1.22 MC_ReadActualTorque
MC_ReadActualTorque: used to read the actual torque of the drive and save it to a user-defined variable.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_ReadActualTorque(
Actual Axis:= ,
MC_ Enable:= ,
torque Valid=> ,
ReadActual
Busy=> ,
reading
Torque Error=> ,
command ErrorID=> ,
Torque=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
Execution When it is set to TRUE, this
Enable BOOL TRUE, FALSE FALSE
condition function block is started.

 Output variable

Initial
Output variable Name Data type Valid range Description
value
Set to TRUE when the drive
Actual torque
Valid BOOL TRUE, FALSE FALSE torque can be obtained
obtaining flag
correctly.
Command It is set to TRUE when the
Busy being BOOL TRUE, FALSE FALSE axis command is being
executed executed.
It is set to TRUE when an
Error Error flag BOOL TRUE, FALSE FALSE
error occurs.
When an error occurs, the
ErrorID Error ID SMC_ERROR - 0
error ID is output.
Actual torque Actual torque data that is
Torque LREAL Torque 0
obtaining read.

(3) Function description

Actual torque data is read by executing MC_ReadActualTorque, which is valid when the electrical level is enabled. This
function block can be repeatedly executed, without mutual affecting.

(4) Timing diagram

-64-
AX series programmable controller programming manual Motion control commands

Enable must be TRUE.

When Valid=TRUE, the read torque is valid.

When Busy is TRUE, the function block is being executed.

 Timing description

2.1.23 MC_ReadActualVelocity
MC_ReadActualVelocity: used to read the actual speed of the drive and save it to a user-defined variable.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_ReadActualVelocity(
Actual Axis:= ,
Enable:= ,
MC_ speed Valid=> ,
Busy=> ,
ReadActualVelocity reading
Error=> ,
command ErrorID=> ,
Velocity=> );

(2) Related variables

 I/O variable

I/O variable Name Data type Valid range Initial value Description
Reference to axis, that is, an instance
Axis Axis AXIS_REF - -
of AXIS_REF_SM3.

 Input variable

Input variable Name Data type Valid range Initial value Description
Execution TRUE, When it is set to TRUE, this function
Enable BOOL FALSE
condition FALSE block is started.

 Output variable

Output Initial
Name Data type Valid range Description
variable value
Actual torque Set to TRUE when the drive torque
Valid BOOL TRUE, FALSE FALSE
obtaining flag can be obtained correctly.
Command It is set to TRUE when the axis
Busy BOOL TRUE, FALSE FALSE
being executed command is being executed.

-65-
AX series programmable controller programming manual Motion control commands

Output Initial
Name Data type Valid range Description
variable value

Error Error flag BOOL TRUE, FALSE FALSE It is set to TRUE when an error occurs.

When an error occurs, the error ID is


ErrorID Error ID SMC_ERROR - 0
output.
Actual speed
Velocity LREAL Speed 0 Actual speed data that is read.
obtaining

(3) Function description

Actual speed data is read by executing MC_ReadActualVelocity, which is valid when the electrical level is enabled. This
function block can be repeatedly executed, without mutual affecting.

(4) Timing diagram

Enable must be TRUE.

When Valid=TRUE, the read torque is valid.

When Busy is TRUE, the function block is being executed.

 Timing description

2.1.24 MC_SetPosition
MC_SetPosition: used to set the position data in the command as the position data of an axis, without causing any
movement for setting position data. It is designed for shifting the coordinate system of an axis.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_SetPosition(
Axis:= ,
Execute:= ,
MC_ Position Position:= ,
Mode:= ,
SetPosition change Done=> ,
Busy=> ,
Error=> ,
ErrorID=> );

(2) Related variables

-66-
AX series programmable controller programming manual Motion control commands

 I/O variable

I/O Initial
Name Data type Valid range Description
variable value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.

 Input variable

Input Initial
Name Data type Valid range Description
variable value
The rising edge will start the
Execute Execution condition BOOL TRUE, FALSE FALSE processing of the function
block.
Position Axis position data LREAL - 0 Position data.
Position mode.
Mode Setting BOOL TRUE, FALSE FALSE TRUE: relative
FALSE: absolute

 Output variable

Output Initial
Name Data type Valid range Description
variable value
It is set to TRUE when the
Command being
Busy BOOL TRUE, FALSE FALSE axis command is being
executed
executed.
It is set to TRUE when an
Error Error flag BOOL TRUE, FALSE FALSE
error occurs.
When an error occurs, the
ErrorID Error ID SMC_ERROR - 0
error ID is output.
Actual speed Actual speed data that is
Velocity LREAL Speed 0
obtaining read.

(3) Function description

Axis position parameters are set by executing MC_SetPosition, without any movement caused but with cordinate system
offset caused. This function block is started at the rising edge and it can be repeatedly executed without mutual affecting.

(4) Timing diagram

The function block can be triggered only at the rising edge.

When Done is TRUE, the setting operation is successful. When Busy is TRUE, the function block is being executed.

 Timing description

-67-
AX series programmable controller programming manual Motion control commands

2.1.25 MC_TouchProbe
MC_TouchProbe: used to save the axis position when a trigger event is raised.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_TouchProbe(
Axis:= ,
TriggerInput:= ,
Execute:= ,
WindowOnly:= ,
External
MC_ FirstPosition:= ,
locking LastPosition:= ,
TouchProbe Done=> ,
enabling Busy=> ,
Error=> ,
ErrorID=> ,
RecordedPosition=> ,
CommandAborted=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.
TRIIGGER_ Association attributes such as
TruggerInput Trigger signal
REF trigger signal and attributes.

 Input variable

Valid Initial
Input variable Name Data type Description
range value
The rising edge will start the
Execution TRUE,
Execute BOOL FALSE processing of the function
condition FALSE
block.
TRUE,
WindowOnly Trigger window BOOL FALSE
FALSE
Trigger start Used to specify the start
FirstPosition LREAL 0
position position for receiving trigger.
Trigger end Used to specify the end
LastPosition LREAL 0
position position for receiving trigger.

 Output variable

Valid Initial
Output variable Name Data type Description
range value
Command
TRUE, It is set to TRUE when the axis
Busy being BOOL FALSE
FALSE command is being executed.
executed

Error Error flag BOOL TRUE, FALSE It is set to TRUE when an error

-68-
AX series programmable controller programming manual Motion control commands

Valid Initial
Output variable Name Data type Description
range value
FALSE occurs.

When an error occurs, the error


ErrorID Error ID SMC_ERROR 0
ID is output.
Actual speed
Velocity LREAL Speed 0 Actual speed data that is read.
obtaining
Trigger
Position where the trigger
RecordedPosition recording LREAL
occurs.
position
Command TRUE, It is set to TRUE when the axis
CommandAbort BOOL FALSE
interruption FALSE command is interrupted.

(3) Function description

The actual position of the axis is recorded when TruggerInput of the MC_TouchProbe function block is triggered. When
the rising edge executes drive latching, the latching signal collected by the drive is in the recording position.

(4) Timing diagram

The function block can be triggered only at the rising edge.

When Done is TRUE, the setting operation is successful.

 Timing description

-69-
AX series programmable controller programming manual Motion control commands

2.1.26 MC_MoveContinuousAbsolute
MC_MoveContinuousAbsolute: used to specify that an axis runs at the continous absolute speed (the unit is axis
depended). The absolute position is specified by Distance and running end speed is specified by EndVelocity.

(1) Command format

Command Name Expressed in diagram Expressed in ST


SMC_MoveContinuousAbsolute(
Axis:= ,
Execute:= ,
Position:= ,
Axis Velocity:= ,
EndVelocity:= ,
absolute EndVelocityDirection:=
MC_
position ,
MoveContinuo Acceleration:= ,
continuous Deceleration:= ,
usAbsolute Jerk:= ,
control
Direction:= ,
command InEndVelocity=> ,
Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

Valid Initial
I/O variable Name Data type Description
range value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.

 Input variable

Valid Initial
Input variable Name Data type Description
range value
Execution TRUE, The rising edge will start the
Execute BOOL FALSE
condition FALSE processing of the function block.
Relative
Data
Distance position of LREAL 0 Relative position of motion.
range
motion
Data Max. speed at which the axis runs
Velocity Running speed LREAL 0
range to reach the destination position.
Running end Data Running speed after command
EndVelocity LREAL 0
speed range execution.
Direction of positive, Options: positive, negative,
EndVelocity-
running at end MC_Direction negative, Current current;
Direction
speed current; Not allowed: shortest, fastest
Data Acceleration when the speed
Acceleration Acceleration LREAL 0
range increases.
Data Deceleration when the speed
Deceleration Deceleration LREAL 0
range reduces.

-70-
AX series programmable controller programming manual Motion control commands

Valid Initial
Input variable Name Data type Description
range value
For linear/straight-line axes:
positive, negative;
Running Data
Direction shortest shortest For rotary/circular axes: positive,
direction range
negative,
current, shortest, fastest

 Output variable

Valid Initial
Output variable Name Data type Description
range value
Command
TRUE, Set to TRUE after the position in
InEndVelocity position BOOL FALSE
FALSE the command is reached.
reaching
Command TRUE, It is set to TRUE when the axis
Busy BOOL FALSE
being executed FALSE command is being executed.
TRUE, It is set to TRUE when an error
Error Error flag BOOL FALSE
FALSE occurs.
When an error occurs, the error ID
ErrorID Error ID SMC_ERROR 0
is output.
Command TRUE, It is set to TRUE when the axis
CommandAbort BOOL FALSE
interruption FALSE command is interrupted.

(3) Function description

This function block is the axis absolute position command, in which Distance specifies the axis absolute position. The
axis must be in the Standstill state before the function block execution and in the Discrete Motion state during the
execution. The axis status must be controlled throughout the complete running process. The startup command is
Execute, and the rising edge triggers the function block. The startup command can repeatedly make the rising edge valid
when the axis is in the Discrete Motion state, which always refreshes the position. When Acceleration or Deceleration is
0, the command execution is abnormal, but the axis is in the Discrete Motion state.

(4) Timing diagram

The function block can be executed only when the axis is in the Standstill state.

The function block can be triggered only at the rising edge.

When Done is TRUE, the setting operation is successful. When Busy is TRUE, the function block is being executed.

 Timing description

-71-
AX series programmable controller programming manual Motion control commands

2.1.27 MC_MoveContinuousRelative
MC_MoveContinuous Relative: used to specify that an axis runs at the continuous absolute speed (the unit is axis
depended). The absolute position is specified by Distance and running end speed is specified by EndVelocity.

(1) Command format

Command Name Expressed in diagram Expressed in ST


SMC_MoveContinuousRelative
(
Axis:= ,
Execute:= ,
Axis Distance:= ,
Velocity:= ,
absolute EndVelocity:= ,
MC_
position EndVelocityDirection:
MoveContinuo = ,
continuous Acceleration:= ,
usRelative Deceleration:= ,
control
Jerk:= ,
command InEndVelocity=> ,
Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

Valid Initial
I/O variable Name Data type Description
range value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.

 Input variable

Valid Initial
Input variable Name Data type Description
range value
Execution TRUE, The rising edge will start the
Execute BOOL FALSE
condition FALSE processing of the function block.
Relative
Distance position of LREAL Data range 0 Relative position of motion.
motion
Running Max. speed at which the axis runs
Velocity LREAL Data range 0
speed to reach the destination position.
Running end Running speed after command
EndVelocity LREAL Data range 0
speed execution.
Direction of Positive, Options: positive, negative,
EndVelocity-
running at MC_Direction Negative, Current current; Not allowed: shortest,
Direction
end speed current fastest
Acceleration when the speed
Acceleration Acceleration LREAL Data range 0
increases.
Deceleration when the speed
Deceleration Deceleration LREAL Data range 0
reduces.

-72-
AX series programmable controller programming manual Motion control commands

Valid Initial
Input variable Name Data type Description
range value
For linear/straight-line axes:
Running positive, negative; For
Direction shortest Data range shortest
direction rotary/circular axes: positive,
negative, current, shortest, fastest

 Output variable

Valid Initial
Output variable Name Data type Description
range value
Command
TRUE, Set to TRUE after the position in
InEndVelocity position BOOL FALSE
FALSE the command is reached.
reaching
Command
TRUE, It is set to TRUE when the axis
Busy being BOOL FALSE
FALSE command is being executed.
executed
TRUE, It is set to TRUE when an error
Error Error flag BOOL FALSE
FALSE occurs.
When an error occurs, the error ID
ErrorID Error ID SMC_ERROR 0
is output.
Command TRUE, It is set to TRUE when the axis
CommandAbort BOOL FALSE
interruption FALSE command is interrupted.

(3) Function description

The axis must be in the Standstill state before the function block execution and in the Discrete Motion state during the
execution. Pay attention to the axis status during the execution to prevent other commands from interrupting the
command execution of the axis. The startup command is Execute, and the rising edge triggers the function block. The
startup command can repeatedly make the rising edge valid when the axis is in the Discrete Motion state, which always
refreshes the position. When Acceleration or Deceleration is 0, the command execution is abnormal, but the axis is in the
Discrete Motion state.

(4) Timing diagram

The function block can be executed only when the axis is in the Standstill state.

The function block can be triggered only at the rising edge.

When Done is TRUE, the setting operation is successful. When Busy is TRUE, the function block is being executed.

 Timing description

-73-
AX series programmable controller programming manual Motion control commands

2.1.28 MC_Jog
MC_Jog: used to instruct an axis to jog at a specified speed.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_Jog(
Axis:= ,
JogForward:= ,
JogBackward:= ,
Axis Velocity:= ,
Acceleration:= ,
MC_Jog jogging
Deceleration:= ,
command Jerk:= ,
Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorId=> );

(2) Related variables

 I/O variable

Valid Initial
I/O variable Name Data type Description
range value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.

 Input variable

Valid Initial
Input variable Name Data type Description
range value
Valid at If it is TRUE, the axis moves
TRUE,
JogForward forward BOOL FALSE forward. If it is FALSE, the
FALSE
jogging axis stops moving forward.
Valid at If it is TRUE, the axis moves
TRUE,
JogBackward reverse BOOL FALSE reversely. If it is FALSE, the
FALSE
jogging axis stops moving reversely.
Positive
Target speed.
Velocity Target speed LREAL number or 0
Unit: [Command unit/s]
0
Positive
Acceleration.
Acceleration Acceleration LREAL number or 0
Unit: [Command unit/s]
0
Positive
Deceleration.
Deceleration Deceleration LREAL number or 0
Unit: [Command unit/s]
0
Slope change value of the
Jerk Jump LREAL Data range 0 curve acceleration or
deceleration.

 Output variable

-74-
AX series programmable controller programming manual Motion control commands

Initial
Output variable Name Data type Valid range Description
value
It is set to TRUE when the
Command TRUE,
Busy BOOL FALSE axis command is being
being executed FALSE
executed.
Command TRUE, It is set to TRUE when the
CommandAborted BOOL FALSE
interruption FALSE axis command is interrupted.
TRUE, It is set to TRUE when an
Error Error flag BOOL FALSE
FALSE error occurs.
When an error occurs, the
ErrorID Error ID SMC_ERROR 0
error ID is output.

(3) Function description

The function block is used to instruct the axis to jog at the target speed. When the axis needs to run forward, set
JogForward to TRUE; when the axis needs to run forward, set JogBackward to TRUE. When both JogForward and
JogBackward are set to TRUE at the same time, the axis does not move. If the speed value in MC_Jog exceeds the max.
jogging speed in the axis parameters, the axis moves at the max. jogging speed.

(4) Timing diagram

When JogForward or JogBackward is set to TRUE, the value of Busy changes to TRUE; when the falling edge of
JogForward or JogBackward starts deceleration and stops the axis also, the value of Busy changes to FALSE.

If another command is used to terminate the execution of this function block, the value of CommandAborted changes to
TRUE, and the value of Busy changes to FALSE.

 Timing description

-75-
AX series programmable controller programming manual Motion control commands

2.1.29 MC_Inch
MC_Inch: used to cause a gradual motion on an axis, which is carried out step by step.

(1) Command format

Command Name Expressed in diagram Expressed in ST


SMC_Inch(
Axis:= ,
InchForward:= ,
InchBackward:= ,
Axis Distance:= ,
relative Velocity:= ,
MC_Inch Acceleration:= ,
positioning Deceleration:= ,
Jerk:= ,
command
Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorId=> );

(2) Related variables

 I/O variable

Valid Initial
I/O variable Name Data type Description
range value
Reference to axis, that is, an instance
Axis Axis AXIS_REF - -
of AXIS_REF_SM3.

 Input variable

Valid Initial
Input variable Name Data type Description
range value
If InchForward is TRUE, the axis runs
at the given speed in the forward
direction until it reaches the
destination. The input must be set to
FALSE and then TRUE to restart the
Forward TRUE, running.
InchForward BOOL FALSE
inching FALSE If InchForward is set to FALSE before
the destination is reached, the axis
decelerates to 0 at once, and Busy is
set to FALSE. If InchBackward is set
to TRUE in simulation mode, the axis
does not move.
If InchBackward is TRUE, the axis
runs at the given speed in the reverse
direction until it reaches the
Reverse TRUE,
InchBackward BOOL FALSE destination. The input must be set to
inching FALSE
FALSE and then TRUE to restart the
running.
If both InchBackward and InchForward

-76-
AX series programmable controller programming manual Motion control commands

Valid Initial
Input variable Name Data type Description
range value
are set to TRUE at the same time, the
axis does not move.
Moving Data
Distance LREAL 0 Moving distance.
distance range
Running Data Max. speed at which the axis runs to
Velocity LREAL 0
speed range reach the destination position.
Data Acceleration when the speed
Acceleration Acceleration LREAL 0
range increases.
Data
Deceleration Deceleration LREAL 0 Deceleration when the speed reduces.
range

 Output variable

Valid Initial
Output variable Name Data type Description
range value
Command
TRUE, It is set to TRUE when the axis
Busy being BOOL FALSE
FALSE command is being executed.
executed
Command TRUE, It is set to TRUE when the axis
CommandAborted BOOL FALSE
interruption FALSE command is interrupted.
TRUE,
Error Error flag BOOL FALSE It is set to TRUE when an error occurs.
FALSE
When an error occurs, the error ID is
ErrorID Error ID SMC_ERROR 0
output.

(3) Function description

The axis must be in the Standstill state before the function block execution and in the Discrete Motion state during the
execution. Pay attention to the axis status during the execution to prevent other commands from interrupting the
command execution of the axis. When Acceleration or Deceleration is 0, the command execution is abnormal, but the
axis is in the Discrete Motion state.

(4) Timing diagram

InchForward and InchBackward must be set to TRUE or FALSE.

When Busy is TRUE, the function block is being executed.

 Timing description

-77-
AX series programmable controller programming manual Motion control commands

2.1.30 SMC3_PersistPosition
SMC3_PersistPosition: used to persist the axis position of a multi-turn absolute encoder with real axis. (The controller that
is restarted due to power failure uses the position recorded before the power failure.) If the servo motor uses an absolute
encoder, use this function block.

(1) Command format

Command Name Expressed in diagram Expressed in ST


SMC3_PersistPosition(
Axis:= ,
PersistentData:= ,
Axis bEnable:= ,
SMC3_Persi bPositionRestored=> ,
position
bPositionStored=> ,
sitPosition
persisting bBusy=> ,
bError=> ,
eErrorID=> ,
eRestoringDiag=> );

(2) Related variables

 I/O variable

Valid Initial
I/O variable Name Data type Description
range value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.
Data to SMC3_PersistPosition_ Structure of position data
PersistentData
persist Data stored at power failure.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
TRUE indicates executing the
function block, while FALSE
Enable Enabling BOOL TRUE, FALSE FALSE
indicates not executing the
function block.

 Output variable

Initial
Output variable Name Data type Valid range Description
value
TRUE indicates the position
Position
bPositionRestored BOOL data is restored after the axis
restoring
restart.
TRUE indicates the position
Position data
bPositionStored BOOL data is stored after the function
storing
block is invoked.
Command
It is set to TRUE when the axis
Busy being BOOL TRUE, FALSE FALSE
command is being executed.
executed

-78-
AX series programmable controller programming manual Motion control commands

Initial
Output variable Name Data type Valid range Description
value
It is set to TRUE when an error
Error Error flag BOOL TRUE, FALSE FALSE
occurs.
When an error occurs, the error
ErrorID Error ID SMC_ERROR 0
ID is output.
Diagnosis information for
position restoring
SMC3_PPD_RESTORING_O
K: Position restoring success
SMC3_PPD_AXIS_PROP_CH
ANGED: Failed to restore the
position due to axis parameter
Diagnosis SMC3_Persist- changes.
eRestoringDiag
restoring PositionDiag SMC3_PPD_DATA_STORED_
DURING_WRITING: The
function block copies data from
the axis data structure but not
from PersistentData.
Possible causes:
Asynchronous persistent
variables, and controller crash

(3) Function description

When the PLC is restarted and bEnable is TRUE, bPositionRestroed is TRUE.

(4) Timing diagram

When Busy is TRUE, the function block is being executed.

-79-
AX series programmable controller programming manual Motion control commands

2.1.31 SMC3_PersistPositionSingleturn
SMC3_PersistPositionSingleturn: used to persist the axis position of a single-turn absolute encoder with real axis. (The
controller that is restarted due to power failure uses the position recorded before the power failure.) If the servo motor
uses a single-turn absolute encoder, use this function block.

(1) Command format

Command Name Expressed in diagram Expressed in ST


SMC3_PersistPositionSingle
turn(
Axis:= ,
PersistentData:= ,
bEnable:= ,
SMC3_Persisit Axis
usiNumberOfAbsoluteBi
Position position ts:= ,
bPositionRestored=> ,
Singleturn persisting bPositionStored=> ,
bBusy=> ,
bError=> ,
eErrorID=> ,
eRestoringDiag=> );

(2) Related variables

 I/O variable

Valid Initial
I/O variable Name Data type Description
range value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.
Data to SMC3_PersistPosition_ Structure of position data
PersistentData
persist Data stored at power failure.

 Input variable

Valid Initial
Input variable Name Data type Description
range value
TRUE indicates executing the function
TRUE,
Enable Enabling BOOL FALSE block, while FALSE indicates not
FALSE
executing the function block.

 Output variable

Valid Initial
Output variable Name Data type Description
range value
Position TRUE indicates the position data is
bPositionRestored BOOL
restoring restored after the axis restart.
Position TRUE indicates the position data is
bPositionStored data BOOL stored after the function block is
storing invoked.
Comman
TRUE, It is set to TRUE when the axis
Busy d being BOOL FALSE
FALSE command is being executed.
executed

-80-
AX series programmable controller programming manual Motion control commands

Valid Initial
Output variable Name Data type Description
range value
TRUE,
Error Error flag BOOL FALSE It is set to TRUE when an error occurs.
FALSE
When an error occurs, the error ID is
ErrorID Error ID SMC_ERROR 0
output.
Diagnosis information in position
restoring
SMC3_PPD_RESTORING_OK:
Position restoring success
SMC3_PPD_AXIS_PROP_CHANGE
D: Failed to restore the position due to
Diagnosis SMC3_Persist- axis parameter changes.
eRestoringDiag
restoring PositionDiag SMC3_PPD_DATA_STORED_DURIN
G_WRITING: The function block
copies data from the axis data
structure but not from PersistentData.
Possible causes: Asynchronous
persistent variables, and controller
crash

(3) Function description

When the PLC is restarted and bEnable is TRUE, bPositionRestroed is TRUE.

(4) Timing diagram

When Busy is TRUE, the function block is being executed.

-81-
AX series programmable controller programming manual Motion control commands

2.1.32 SMC3_PersistPosition Logical


used to persist the axis position of a single-turn absolute encoder with real axis. (The controller that is restarted due to
power failure uses the position recorded before the power failure.) If the servo motor uses a single-turn absolute encoder,
use this function block.

(1) Command format

Command Name Expressed in diagram Expressed in ST


SMC3_PersistPositionLogical(
Axis:= ,
PersistentData:= ,
Axis bEnable:= ,
SMC3_PersisitP bPositionRestored=> ,
position
osition Logical bPositionStored=> ,
persisting bBusy=> ,
bError=> ,
eErrorID=> ,
eRestoringDiag=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.
Data to SMC3_PersistPosition_ Structure of position data
PersistentData
persist Data stored at power failure.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
TRUE indicates executing the
function block, while FALSE
Enable Enabling BOOL TRUE, FALSE FALSE
indicates not executing the
function block.

 Output variable

Initial
Output variable Name Data type Valid range Description
value
TRUE indicates the position
Position
bPositionRestored BOOL data is restored after the axis
restoring
restart.
Position TRUE indicates the position
bPositionStored data BOOL data is stored after the function
storing block is invoked.
Comman
It is set to TRUE when the axis
Busy d being BOOL TRUE, FALSE FALSE
command is being executed.
executed

-82-
AX series programmable controller programming manual Motion control commands

Initial
Output variable Name Data type Valid range Description
value
It is set to TRUE when an error
Error Error flag BOOL TRUE, FALSE FALSE
occurs.
When an error occurs, the error
ErrorID Error ID SMC_ERROR 0
ID is output.
Diagnosis information in
position restoring
SMC3_PPD_RESTORING_O
K: Position restoring success
SMC3_PPD_AXIS_PROP_CH
ANGED: Failed to restore the
position due to axis parameter
Diagnosis SMC3_Persist- changes.
eRestoringDiag
restoring PositionDiag SMC3_PPD_DATA_STORED_
DURING_WRITING:
The function block copies data
from the axis data structure but
not from PersistentData.
Possible causes:
Asynchronous persistent
variables, and controller crash

(3) Function description

When the PLC is restarted and bEnable is TRUE, bPositionRestroed is TRUE.

(4) Timing diagram

When Busy is TRUE, the function block is being executed.

-83-
AX series programmable controller programming manual Motion control commands

2.1.33 SMC_Homing
Axis homing command, different from MC_Home. MC_Home specifies the homing mode controlled by the servo controller,
while SMC_Homing specifies the homing mode controlled by the PLC.

(1) Command format

Command Name Expressed in diagram Expressed in ST


SMC_Homing(
Axis:= ,
bExecute:= ,
fHomePosition:= ,
fVelocitySlow:= ,
fVelocityFast:= ,
fAcceleration:= ,
fDeceleration:= ,
fJerk:= ,
nDirection:= ,
Axis
bReferenceSwitch:= ,
SMC_Homing homing fSignalDelay:= ,
nHomingMode:= ,
command bReturnToZero:= ,
bIndexOccured:= ,
fIndexPosition:= ,
bIgnoreHWLimit:= ,
bDone=> ,
bBusy=> ,
bCommandAborted=> ,
bError=> ,
nErrorID=> ,
bStartLatchingIndex=> );

(2) Related variables

 I/O variable

Valid Initial
I/O variable Name Data type Description
range value
Reference to axis, that is, an
Axis Axis AXIS_REF - -
instance of AXIS_REF_SM3.

 Input variable

Valid Initial
Input variable Name Data type Description
range value
TRUE indicates executing the
function block, while FALSE
TRUE,
bExecute Enabling BOOL FALSE indicates not executing the
FALSE
function block.

Home position after zeroing,


Home
fHomePosition LREAL 0 using the unit after user
position
calibration.
Used to drive out of the
fVelocitySlow Low speed LREAL 0
reference switch.
Used until the reference switch
fVelocityFast High speed LREAL 0
is found.

-84-
AX series programmable controller programming manual Motion control commands

Valid Initial
Input variable Name Data type Description
range value
fAcceleration Acceleration LREAL 0 Acceleration setting
fDeceleration Deceleration LREAL 0 Deceleration setting
fJerk Jerk value LREAL 0
Homing Homing start direction. Refer to
nDirection MC_DIRECTION Negative
direction MC_DIRECTION.
Reference switch status.
TRUE: The reference switch is
Reference TRUE,
bReferenceSwitch BOOL FALSE open.
switch FALSE
FALSE: The reference switch
is closed.
Reference switch transmission
time, used to compensate for
fSignalDelay Delay LREAL 0
the deadzone time.
Unit: second
Homing SMC_HOMING_ Refer to
nHomingMode
mode MODE SMC_HOMING_MODE.
TRUE: The axis moves to
position zero after homing.
Note: If fHomePosition=10, the
Returning to TRUE, axis position is 10 after
bReturnTozero BOOL FALSE
position zero FALSE homing, and when
bReturnTozero is TRUE, the
axis reversely moves by 10
units to position zero.
TRUE: Index pulse is detected.
TRUE, It is valid at the homing modes
bIndexOccured BOOL FALSE
FALSE FAST_BSLOW_I_S_STOP
and FAST_SLOW_I_S_STOP.
Position where the index
fIndexPosition LREAL 0
occurs.
TRUE: The hardware position
limit switch is disabled.
Ignoring If the same physical switch is
TRUE,
bIgnoreHWLimit hardware BOOL FALSE used both the hardware
FALSE
position limit position limit switch and
reference switch, hardware
control is set to false.

 Output variable

-85-
AX series programmable controller programming manual Motion control commands

Valid Initial
Output variable Name Data type Description
range value
TRUE,
bDone BOOL FALSE TRUE, homing completed
FALSE
TRUE, TRUE: The function block is
Busy BOOL FALSE
FALSE being executed.
TRUE: The function block is
TRUE,
bCommandAborted BOOL FALSE interrupted by other action
FALSE
commands.
TRUE, It is set to TRUE when an error
Error BOOL FALSE
FALSE occurs.
When an error occurs, the error
ErrorID SMC_ERROR 0
ID is output.
TRUE, Generated by bIndexOccured
bStartLatchingIndex BOOL FALSE
FALSE and fIndexPosition.

The homing modes are described as follows:

Initial
Mode Type Description
value
The axis follows the set direction to
the home switch at a high speed, and
leaves the home switch at a low speed
in the reverse direction after touching
SMC_HOMING_
FAST_BSLOW_S_STOP 0 the home switch. After leaving, the
MODE
controller executes MC_setPosition to
set the present position to the setting
of fHomePosition, and then executes
MC_stop.
The axis follows the set direction to
the home switch at a high speed, and
leaves the home switch at a low speed
in the reverse direction after touching
SMC_HOMING_ the home switch. After leaving, the
FAST_BSLOW_STOP_S 1
MOD controller executes MC_stop to stop
the axis, and then executes
MC_setPosition to set the present
position to the setting of
fHomePosition.
The axis follows the set direction to
the home switch at a high speed, and
SMC_HOMING_
FAST_BSLOW_I_S_STOP 2 leaves the home switch at a low speed
MOD
in the reverse direction after touching
the home switch. When receiving the

-86-
AX series programmable controller programming manual Motion control commands

Initial
Mode Type Description
value
bIndexOccured signal, the controller
executes MC_setPosition and then
MC_stop.
The axis follows the set direction to
the home switch at a high speed, and
leaves the home switch at a low speed
after touching the home switch. After
SMC_HOMING_
FAST_SLOW_S_STOP 4 leaving, the controller executes
MOD
MC_setPosition to set the present
position to the setting of
fHomePosition, and then executes
MC_stop.
The axis follows the set direction to
the home switch at a high speed, and
leaves the home switch at a low speed
FAST_SLOW_STOP_S after touching the home switch. After
FAST_SLOW_STOP_S SMC_HOMING_ 5 leaving, the controller executes
MOD MC_stop to stop the axis, and then
executes MC_setPosition to set the
present position to the setting of
fHomePosition.
The axis follows the set direction to
the home switch at a high speed, and
leaves the home switch at a low speed
in the reverse direction after touching
FAST_SLOW_I_S_STOP SMC_HOMING_MOD 6
the home switch. When receiving the
bIndexOccured signal, the controller
executes MC_setPosition and then
MC_stop.

(3) Function description

After SMC_HOMING is started at the rising edge of bExecute, the axis moves at the speed specified by fVelocityFast in
the direction specified by nDirection, which does not end until bReferenceSwitch = FALSE. The axis slowly stops and
leaves the reference switch at the speed specified by fVelocitySlow in the reverse direction. When bReferenceSwitch =
TRUE, homing is completed.

After the homing command is enabled, the status change sequence of bReferenceSwitch is ON->OFF->ON, the homing
is completed on the rising edge of OFF->ON, and the reference position is set. Reference position = fHomePostion +
[ (fSignalDelay*1000 + 1 DC cycle)/1000] * fVelocitySlow, which actually compensates for the bReferenceSwitch
sampling delay and one-communication-cycle displacement delay

If bReturnToZero=TRUE, the reference position is set to {fHomePostion + [ (fSignalDelay*1000 + 1 DC cycle)/1000] *


fVelocitySlow} at the rising edge of OFF->ON of bReferenceSwitch, the axis moves to position zero at the speed
specified by fVelocityFast.

-87-
AX series programmable controller programming manual Motion control commands

Note: After the Done signal is completed, the axis position is set to fHomePosition. The setting time is related to
nHomingMode. (For details, see SMC_HOMING_MODE.)

(4) Timing diagram

a. When bReferenceSwitch=TRUE:

b. When bReferenceSwitch=FALSE:

-88-
AX series programmable controller programming manual Motion control commands

2.1.34 MC_Camin
MC_Camin: used to designate a cam table to start the execution of the e-cam actions, and specify the offset value,
scaling ratio and working mode of the master and slave axes according to application requirements.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_CamIn(
Master:= ,
Slave:= ,
Execute:= ,
MasterOffset:= ,
SlaveOffset:= ,
MasterScaling:= ,
SlaveScaling:= ,
StartMode:= ,
Cam CamTableID:= ,
VelocityDiff:= ,
MC_Camin action
Acceleration:= ,
start Deceleration:= ,
Jerk:= ,
TappetHysteresis:= ,
InSync=> ,
Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> ,
EndOfProfile=> ,
Tappets=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Reference to axis, that is, an
Master Master axis AXIS_REF - -
instance of AXIS_REF_SM3.
Reference to axis, that is, an
Slave Slave axis AXIS_REF
instance of AXIS_REF_SM3.

Note: The master axis and slave axis must be different axes. Otherwise, errors may be reported.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
Cam function The rising edge starts the
Execute BOOL TRUE, FALSE FALSE
entry execution of the function block.
Negative
The phase of the master axis
Master axis number,
MasterOffset LREAL 0 is moved by the specified
offset positive
offset value.
number, or 0
Negative The phase of the slave axis is
Slave axis
SlaveOffset LREAL number, 0 moved by the specified offset
offset
positive value.

-89-
AX series programmable controller programming manual Motion control commands

Initial
Input variable Name Data type Valid range Description
value
number, or 0
Pre-compiling
The phase of the master axis
scaling factor
MasterScaling LREAL >0.0 1 is scaled up or down by the
of the master
specified value.
axis
Pre-compiling
The phase of the slave axis is
scaling factor
SlaveScaling LREAL >0.0 1 scaled up or down by the
of the slave
specified value.
axis
0: Absolute position
Output mode 1: Relative position
of the slave 2: ramp_in (ramp switching in)
MC_
StartMode axis in absolute 3: ramp_in_pos (forward
StartMode
relative to ramp switching in)
cam 4: ramp_in_neg (reverse ramp
switching in)
Used to define a cam table, in
MC_
CamTableID Table ID conjunction with output points
CAM_ID
of MC_CamTableSelect.
Max. speed, different from
VelocityDiff LREAL
ramp_in
Acceleration LREAL Acceleration for ramp_in
Deceleration LREAL Deceleration for ramp_in
Jerk LREAL Jerk for ramp_in
TappetHysteresis LREAL Damping factor of the tappet

 Output variable

Initial
Output variable Name Data type Valid range Description
value
After the master and slave
axes establish a cam
Cam taking
InSync BOOL TRUE, FALSE FALSE relationship, InSync is set.
effect
When the execution condition
is OFF, InSync is reset.
When Execute inputs the rising
edge, it is set to TRUE, which
indicates that the cam
Synchronous
Busy BOOL TRUE, FALSE FALSE relationship is being coupled,
running
Cam_out is used for reset. The
command execution condition
reset cannot reset the status.

-90-
AX series programmable controller programming manual Motion control commands

Initial
Output variable Name Data type Valid range Description
value
Set to TRUE when the slave
Command
CommandAborted BOOL TRUE, FALSE FALSE axis is interrupted by other
interruption
control commands.
Error is set when an error is
detected.
Error Error flag BOOL TRUE, FALSE FALSE Error is reset when the
command execution condition
is OFF.
SMC_ERRO When an error occurs, the
ErrorID Error ID 0
R error ID is output.
If Periodic is 0 when
MC_CamTableSelect is
executed, EndOfProfile is set
Profile after the cam profile is
EndOfProfile BOOL FALSE
completion completed for one time, and
EndOfProfile is reset when the
command execution condition
is OFF.
Associated cam tappet, which
SMC_
Tappets can be read by
TappetData
MC_GetTappetValue.

(3) Function description

Under the condition that correct cam tables are selected and axes do not encounter errors, the Execute rising edge
triggers the function block. In a cam motion system, to invoke a cam profile, invoke the MC_CamTableSelect command
to select the corresponding cam table, and then execute MC_CamIn; to change the cam profile, invoke the
MC_CamTableSelect command to reselect a cam table. You need to use the Camout command to unbind the cam
coupling relationship between the master axis and slave axis. When the command is being executed, if another
command is applied to the slave axis at this time, the cam coupling relationship between the master axis and slave axis
is unbound, and Command-Aborted outputs TRUE.

(4) Timing diagram

 Cyclic mode (MC_CamTableSelect.Periodic is TRUE):

Note: The MC_Camout command only unbinds the cam coupling relationship between the master axis and slave
axis. If the slave axis speed is not 0 during the unbinding, the slave axis does not automatically decelerate to 0,
which indicates using MC_STOP is required.

-91-
AX series programmable controller programming manual Motion control commands

 Non-cyclic mode (MC_CamTableSelect.Periodic is FALSE):

(5) Function block description

-92-
AX series programmable controller programming manual Motion control commands

 Command start condition

The command can be started in any state during master axis stop, position control, speed control, and synchrization
control.

The calculation method of the engaging points in the cam profile is as follows:

The following formula is obtained according to the figure:

Position_Slave = SlaveScaling*CAM(MasterScaling*MasterPosition + MasterOffset ) + SlaveOffset

The positions of the master and slave axes in the formula do not represent the actual physical axis positions, but the
positions of the master and slave axes related to the cam function curve.

The relationship between the master/slave axis positions and the master/slave real axis position is described in detail.

Note: The positions of the master and slave axes refer to the positions of the master and slave axes required by
the cam function curve, but not the physical real axis positions of the master and slave axes.

 Relationship between the cyclic mode and EndOfProfile:

Whether the cyclic or non-cyclic mode determines whether the e-cam needs to be performed again after the master axis
reaches the end position.

In non-cyclic mode: Periodic is False in the MC_CamTableSelect command.

In non-cyclic mode, when the cam is completed, EndofProfile outputs TRUE; when Execute inputs FALSE, EndofProfile
outputs FALSE. At this time, the cam only runs one master axis cycle.

Note: The master axis cycle indicates the range from the start position to the end position of the master axis of
the e-cam.

 Relationship between the cyclic mode and EndOfProfile:

Whether the cyclic or non-cyclic mode determines whether the e-cam needs to be performed again after the master axis
reaches the end position.

In non-cyclic mode: Periodic is False in the MC_CamTableSelect command.

In non-cyclic mode, when the cam is completed, EndofProfile outputs TRUE; when Execute inputs FALSE, EndofProfile
outputs FALSE. At this time, the cam only runs one master axis cycle.

Note: The master axis cycle indicates the range from the start position to the end position of the master axis of
the e-cam.

In cyclic mode: Periodic is TRUE in the MC_CamTableSelect command.

-93-
AX series programmable controller programming manual Motion control commands

At this time, after completing one master axis cycle, the cam starts the next cycle, and the TRUE output of the
EndofProfile signal only maintains one cycle.

Note: When the cam master-axis position is greater than or equal to the cam end position, the EndofProfile signal
outputs TRUE, and the cam master-axis position is updated to (Cam start position + Actual position - End position). For
example: The start position and end position of the cam master axis are 0 and 360, the master-slave axis scaling is set to
1, the master-slave axis offset value is set to 0, the task cycle is 2ms, and the master axis speed is 100. When the cam
master-axis position in a certain task cycle is 359.99, the output of EndofProfile in the next cycle is TRUE and the master
axis position becomes 359.99+100*0.002-360=0.19.

The start position and end position of the cam profile designed in cyclic mode need to maintain a smooth transition;
otherwise, jumping may be caused.

For example, if the start speed is 0 and the end speed is not 0, jumping is caused when the master axis transits from the
end of the cycle and the beginning of the new cycle.

-94-
AX series programmable controller programming manual Motion control commands

The master/slave axis absolute/relative mode relationship in StartMode and MC_CamTableSlect is as follows:

Absolute mode: At the beginning of a new e-cam cycle, the calculation of the e-cam has no relationship with the present
slave axis position. If the start position of the slave axis relative to the master axis is different from the end position of the
slave axis relative to the master axis, jumping is caused.

Relative mode: The new e-cam cycle changes according to the present position of the slave axis; that is, the position of
the slave axis at the end of the previous e-cam cycle is considered as "slave axis offset" in the present e-cam movement,
therefore added. However, if the position of the slave axis corresponding to the start position of the master axis is not 0 in
the e-cam definition, jumping is caused.

Ramp input: Potential jumping at the beginning of the e-cam is prevented by adding a compensation movement. (The
movement is based on VelocityDiff, acceleration, and deceleration. Therefore, as long as the slave axis is rotating, the
forward ramp input can only use forward compensation, and the reverse ramp input can only use reverse compensation.
For the slave axis in linear motion, the compensation direction can be realized automatically, that is, the forward ramp
input and the reverse ramp input can be interpreted by the ramp input.)

The relationship table is as follows:

MC_CamTableSelect.MasterAbsolute Master axis mode


absolute Absolute mode
relative Relative mode

MC_CamIn.StartMode MC_CamTableSelect.SlaveAbsolute Slave axis mode


absolute TRUE Absolute mode
absolute FALSE Relative mode
relative TRUE Relative mode
relative FALSE Relative mode
ramp_in TRUE Absolute mode of ramp switching in
ramp_in FALSE Relative mode of ramp switching in
Absolute mode of forward ramp switching
ramp_in_pos TRUE
in

-95-
AX series programmable controller programming manual Motion control commands

MC_CamIn.StartMode MC_CamTableSelect.SlaveAbsolute Slave axis mode


ramp_in_pos FALSE Relative mode of forward ramp switching in
Absolute mode of reverse ramp switching
ramp_in_neg TRUE
in
ramp_in_neg FALSE Relative mode of reverse ramp switching in

The relationship is described as follows:

Cam master-axis range: 0–360; cam slave-axis range: 0–180; cyclic mode; master/slave axis offset value: 0;
master/slave axis scaling ratio: 1 The designed cam table is shown in the following figure.

StartMode=0 (Absolute mode)

In MC_CamTableSlect, when MasterAbsolute is set to FALSE and SlaveAbsolute is set to TRUE, the master axis is
working in relative mode and the slave axis is working in absolute mode. When the Execute rising edge starts the cam,
the master axis of the cam starts from the "start position" (0) in the cam table, the cam slave axis is calculated and output
according to the above-mentioned "cam table engaging formula". The real axis command position of the slave axis
equals the output value of the engaging calculation. For example, if the start position of the cam slave axis is 0, and the
real axis position of the slave axis is 20 when the cam is started, the real axis position command of the slave axis is 0 at
the start, which causes jumping.

Note: In this case, jumping occurs when the slave axis (real axis) start position is not the slave axis start
position of the cam.

-96-
AX series programmable controller programming manual Motion control commands

When MC_CamTableSlect instruction MasterAbsolute is set to FALSE and SlaveAbsolute is set to FALSE, the master
axis is working in relative mode and the slave axis is working in relative mode. When the Execute rising edge starts the
cam, the master axis of the cam starts from the "start position" (0) in the cam table, the cam slave axis is calculated and
output according to the above-mentioned "cam table engaging formula". The real axis command position of the slave
axis is equal to [Output value of engaging calculation, or cam slave-axis position) plus (Real axis position of the slave
axis at startup).

For example, when the cam is started, if the real axis position of the slave axis is 20, and the slave axis start position in
the cam table is 0, then the real axis command position of the slave axis is 20 when the cam is started, the position in the
following is 20 plus the calculated value of the cam table, and the highest value is 20 plus the max. calculated value (180)
of the cam table, that is, 200.

2.1.35 MC_Camout
MC_Camout: used to unbind the cam coupling relationship of the slave axis. Note: After executing this command, the
slave axis continues to run at the speed used before the unbinding. Therefore, this command needs to be used in
conjunction with commands such as MC_Stop.

(1) Command format

Expressed in
Command Name Expressed in diagram
ST
MC_CamOut(
Slave:= ,
Cam coupling Execute:= ,
MC_Camout Done=> ,
unbinding Busy=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

-97-
AX series programmable controller programming manual Motion control commands

I/O variable Name Data type Valid range Initial value Description
Reference to axis, that is, an
Slave Slave axis AXIS_REF
instance of AXIS_REF_SM3.

 Input variable

Input variable Name Data type Valid range Initial value Description
Cam function The rising edge starts the
Execute BOOL TRUE, FALSE FALSE
exit execution of the function block.

 Output variable

Output
Name Data type Valid range Initial value Description
variable
The cam coupling relationship
Done Completion BOOL TRUE, FALSE FALSE with the master slave has been
unbound.
Synchronous The command is being
Busy BOOL TRUE, FALSE FALSE
running executed.
Error is set when an error is
Error Error flag BOOL TRUE, FALSE FALSE
detected.
When an error occurs, the error
ErrorID Error ID SMC_ERROR 0
ID is output.

(3) Function description

The command is used to unbind the cam coupling relationship of the slave axis. At the rising edge, the cam coupling
relationship of the slave axis is unbound. After the unbinding, the salve axis may stop or may not. If the slave axis speed
is not 0 before the command is executed, the cam coupling relationship is unbound after the DONE signal is completed,
but the slave axis still runs at the speed before the switching out. If the slave axis does not have a cam coupling
relationship, ERROR is output.

(4) Timing diagram

-98-
AX series programmable controller programming manual Motion control commands

2.1.36 MC_CamTableSelect
MC_CamTableSelect: used to select cam tables, in conjunction with MC_CamIn.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_CamTableSelect(
Master:= ,
Slave:= ,
CamTable:= ,
Execute:= ,
Cam
Periodic:= ,
MC_CamTableSelect table MasterAbsolute:= ,
SlaveAbsolute:= ,
selection Done=> ,
Busy=> ,
Error=> ,
ErrorID=> ,
CamTableID=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Reference to axis, that is, an
Master Master axis AXIS_REF
instance of AXIS_REF_SM3.
Reference to axis, that is, an
Slave Slave axis AXIS_REF
instance of AXIS_REF_SM3.
Mapped to cam table
Table description, that is, an instance
CamTable MC_CAM_REF
selection of MC_CAM_REF.

Note: The master axis and slave axis must be different axes. Otherwise, errors may be reported. The cam table
specified by CamTable must be correct; otherwise, errors may be reported. The master and slave axes may be
virtual axes and may be virtual axes.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
The rising edge starts the
Execute Enabling BOOL TRUE, FALSE FALSE
execution of the function block.
Used to specify whether the cam
table is executed only once or
Repeated
Periodic BOOL TRUE, FALSE FALSE repeatedly.
mode
TRUE: Repeatedly
FALSE: Not repeatedly
Master axis Used to specify whether the
MasterAbsolute absolute BOOL TRUE, FALSE FALSE coordinate system of master axis
mode tracking uses an absolute or

-99-
AX series programmable controller programming manual Motion control commands

Initial
Input variable Name Data type Valid range Description
value
relative position.
1: Absolute position
0: Relative position
Used with StartMode in
MC_CamIn to specify whether
the present command position of
Slave axis
the slave axis is the absolute or
SlaveAbsolute absolute BOOL TRUE, FALSE FALSE
relative position output of the cam
mode
table.
1: Absolute position
0: Relative position

 Output variable

Initial
Output variable Name Data type Valid range Description
value
The cam coupling relationship
Done Completion BOOL TRUE, FALSE FALSE with the master slave has been
unbound.
Synchronous
Busy BOOL TRUE, FALSE FALSE The command is being executed.
running
Error is set when an error is
Error Error flag BOOL TRUE, FALSE FALSE
detected.
When an error occurs, the error
ErrorID Error ID SMC_ERROR 0
ID is output.
Used to select the effective cam
Effective cam
CamTableID MC_CAM_ID ID, which is used together with
ID
CamTableID in MC_CamIn.

(3) Function description

The command specifies the cam table required for e-cam running. Therefore, before using this command, you must edit
the cam table (with a cam editor or online). The specified cam table can be executed at the rising edge or refreshed after
cam table update. When the Done signal is TRUE, the variable CamTableID is output and takes effect. During command
execution, Busy is TRUE; when Done is TRUE, Busy is FALSE. For details about MasterAbsolute, SlaveAbsolute, and
Periodic, see MC_CamIn.

-100-
AX series programmable controller programming manual Motion control commands

2.1.37 MC_GearIn
MC_GearIn: used to set the gear ratio between the slave axis and the master axis to perform electronic gearing.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_GearIn(
Master:= ,
Slave:= ,
Execute:= ,
RatioNumerator:= ,
E-gear RatioDenominator:= ,
Acceleration:= ,
MC_GearIn function
Deceleration:= ,
block Jerk:= ,
InGear=> ,
Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Reference to axis, that is, an
Master Master axis AXIS_REF
instance of AXIS_REF_SM3.
Reference to axis, that is, an
Slave Slave axis AXIS_REF
instance of AXIS_REF_SM3.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
The function block is started at
Execute Enabling BOOL TRUE, FALSE FALSE
the rising edge.
Positive
Numerator of number,
RatioNumerator DINT 1 Numerator of the gear ratio
the gear ratio negative
number
Denominator
Positive
RatioDenominator of the gear UDINT 1 Denominator of the gear ratio
number
ratio
Positive
Acceleration Acceleration LREAL Acceleration
number or 0
Positive
Deceleration Deceleration LREAL Deceleration
number or 0
Positive
Jerk Jump LREAL Jerk value
number or 0

 Output variable

-101-
AX series programmable controller programming manual Motion control commands

Initial
Output variable Name Data type Valid range Description
value
Gear ratio TRUE: The slave axis reaches
InGear BOOL TRUE, FALSE FALSE
reached the target speed.
Synchronous The command is being
Busy BOOL TRUE, FALSE FALSE
running executed.
TRUE: The function block is
CommandAborted Interruption BOOL TRUE, FALSE FALSE interrupted by another control
command.
Error is set when an error is
Error Error flag BOOL TRUE, FALSE FALSE
detected.
When an error occurs, the error
ErrorID Error ID SMC_ERROR 0
ID is output.

(3) Function description

The e-gear action is started at the rising edge. To unbind the coupling after executing the e-gear, the GearOut command
must be used. This command is a speed e-gear function, and the synchronization distance loss caused during
acceleration will not be automatically compensated. When the Busy signal is TRUE during command execution, if the
slave axis target speed is not reached, the new rising edge of Execute will not affect it. When the Busy signal is TRUE
during command execution, if the slave axis target speed is reached, the new rising edge of Execute will not affect it.
When the target speed is reached, InGear is TRUE, and then:

Slave axis movement amount = Master axis movement amount * RatioNumerator/RatioDenominator

If the master axis speed changes in real time, exercise caution before using this command.

Note: Do not use the MC_SetPosition command during command execution to avoid accidents caused by the
rapid motor running.

(4) Timing diagram

-102-
AX series programmable controller programming manual Motion control commands

The timing diagram of the restart after gear ratio parameter change is as follows:

2.1.38 MC_GearOut
MC_GearOut: used to terminate the MC_GearIn and MC_GearInPos commands that are being executed.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_GearOut(
Slave:= ,
E-gear coupling Execute:= ,
MC_GearOut Done=> ,
disconnection Busy=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

I/O Initial
Name Data type Valid range Description
variable value
Reference to axis, that is, an
Slave Slave axis AXIS_REF
instance of AXIS_REF_SM3.

 Input variable

Input Initial
Name Data type Valid range Description
variable value
The function block is started at the
Execute Enabling BOOL TRUE, FALSE FALSE
rising edge.

 Output variable

-103-
AX series programmable controller programming manual Motion control commands

Output Initial
Name Data type Valid range Description
variable value
TRUE: The e-gear coupling of the
Done Completion BOOL TRUE, FALSE FALSE
slave axis is disconnected.
Synchronous
Busy BOOL TRUE, FALSE FALSE The command is being executed.
running
Error is set when an error is
Error Error flag BOOL TRUE, FALSE FALSE
detected.
When an error occurs, the error ID
ErrorID Error ID SMC_ERROR 0
is output.

(3) Function description

The e-gear action switching out is started at the rising edge. If Execute is TRUE and ERROR is False, Busy is TRUE and
Done is TRUE.

After the e-gear action is switched out, the slave axis speed used before the switching out is used. Therefore, the slave
axis is stopped in conjunction with the MC_Stop command. At the falling edge, Done is FALSE.

(4) Timing diagram

-104-
AX series programmable controller programming manual Motion control commands

2.1.39 MC_GearInPos
MC_GearInPos: used to set the e-gear ratio between the slave axis and the master axis to perform electronic gearing. It
specifies the master axis position, slave axis position, and master axis distance from the synchronization start to switch
in e-gear actions.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_GearInPos(
Master:= ,
Slave:= ,
Execute:= ,
RatioNumerator:= ,
E-gear RatioDenominator:= ,
MasterSyncPosition:=
coupling ,
SlaveSyncPosition:= ,
MC_GearInPos switching
MasterStartDistance:=
-in ,
AvoidReversal:= ,
position StartSync=> ,
InSync=> ,
Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

Valid Initial
I/O variable Name Data type Description
range value
Reference to axis, that is, an
Master Master axis AXIS_REF
instance of AXIS_REF_SM3.
Reference to axis, that is, an
Slave Slave axis AXIS_REF
instance of AXIS_REF_SM3.

 Input variable

Valid Initial
Input variable Name Data type Description
range value
TRUE, The function block is started at
Execute Enabling BOOL FALSE
FALSE the rising edge.
Numerator of the TRUE, Numerator of the master/slave
RatioNumerator DINT
gear ratio FALSE speed ratio
Denominator of Denominator of the master/slave
RatioDenominator DINT
the gear ratio speed ratio
Master axis Master axis position when the
MasterSyncPosition synchronization LREAL master/slave axis gear ratios are
position coupled.
Slave axis Slave axis position when the
SlaveSyncPosition synchronization LREAL master/slave axis gear ratios are
position coupled.

-105-
AX series programmable controller programming manual Motion control commands

Valid Initial
Input variable Name Data type Description
range value

According to this position value,


-MasterSyncPosition, and the
SlaveSyncPosition value, a
Master axis smooth curve is calculated to
position of make the slave axis gear
MasterStartDistance LREAL
synchronization synchronized with the master
execution axis gear when the slave axis is
at SlaveSyncPosition. The
master axis range of the curve is
[MasterStartDistance,
MasterSyncPosition].
Set to FALSE if the physical
position of the slave axis leads.
Set to TRUE if the slave axis
cannot implement reverse
Disabling TRUE, running physically or the reverse
AvoidReversal BOOL FALSE
reverse running FALSE running may cause danger. It is
applicable only to modal axes. If
reverse running cannot be
avoided, the axis will stop due to
exceptions.

 Output variable

Valid Initial
Output variable Name Data type Description
range value
TRUE, TRUE: The e-gear coupling is
StartSync Coupling start BOOL FALSE
FALSE started.
TRUE: The e-gear coupling is
TRUE, completed, and the master/slave
InSync Coupling BOOL FALSE
FALSE axis gear ratios are being
coupled.
Synchronous TRUE,
Busy BOOL FALSE The command is being executed.
running FALSE
TRUE: The function block is
Command TRUE,
CommandAborted BOOL FALSE interrupted by another control
interruption FALSE
command.
TRUE, Error is set when an error is
Error Error flag BOOL FALSE
FALSE detected.
When an error occurs, the error
ErrorID Error ID SMC_ERROR 0
ID is output.

-106-
AX series programmable controller programming manual Motion control commands

(3) Function description

The command is started at the rising edge.

After the action starts, the slave axis accelerates or decelerates at the target speed that is the master axis speed
multiplied by the gear ratio.

The essential of the process from the synchronization start to the end is an e-cam where the slave axis follows the
master axis in the synchronization interval. At this time, the command automatically designs a cam profile according to
the master axis range (MasterSyncPosition-MasterStartDistance, MasterSyncPosition), the slave axis range (current
position, SlaveSyncPosition), and the gear ratios. When synchronization is performed, the slave axis follows the master
axis to complete the cam action.

Note: If the master and slave axes work in linear mode, ensure that the above-mentioned parameters are set
properly; otherwise, the gear action cannot be performed correctly. Therefore, it is recommended that the
master and slave axes work in cyclic mode when this command is used.

For example: Both the master and slave axes move forward in linear mode. If the master axis position >
MasterSyncPosition-MasterStartDistance, or the slave axis position > SlaveSyncPosition, when the command is
executed, the e-gear movement cannot be switched in.

The timing diagram instances with different parameters are provided:

When the master axis works in cyclic mode (360 cycles) and the slave axis works in cyclic mode (360 cycles):

a) MasterSyncPosition=280, MasterStartDistance=50, SlaveSyncPosition=60, Master axis speed=50,


AvoidReversal=FALSE

b) MasterSyncPosition=300, MasterStartDistance=370, SlaveSyncPosition=60, Master axis speed=50,


AvoidReversal=FALSE

-107-
AX series programmable controller programming manual Motion control commands

c) MasterSyncPosition=300, MasterStartDistance=50, SlaveSyncPosition=60, Master axis speed=50,


AvoidReversal=FALSE, Slave axis start position > 60

-108-
AX series programmable controller programming manual Motion control commands

When the synchronization is completed, InGear is TRUE, the target speed is reached also, and then:

Slave axis movement amount = Master axis movement amount * RatioNumerator/ RatioDenominator

For AvoidReversal: If the slave axis is a modal axis and the master axis speed (a gear ratio multiple) is not relative to
the slave axis speed, MC_GearInPos will try to avoid the reversal of the slave axis. It attempts to "stretch" the movement
of the slave axis by adding 5 slave axis cycles. If the "stretch" is invalid, an error occurs and the slave axis stops
abnormally. If the slave axis speed is related to the master axis speed (a gear ratio multiple), an error occurs and the
slave axis stops abnormally. If the slave axis is a modal axis in linear mode, an error occurs when Execute inputs the
rising edge.

(4) Timing diagram

2.1.40 MC_Phasing
MC_Phasing: used to specify the phase difference between the master axis and slave axis.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_Phasing(
Master:= ,
Slave:= ,
Execute:= ,
Electronic PhaseShift:= ,
Velocity:= ,
gear (e-gear) Acceleration:= ,
MC_Phasing
Deceleration:= ,
coupling
Jerk:= ,
disconnection Done=> ,
Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );

(2) Related variables

-109-
AX series programmable controller programming manual Motion control commands

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Reference to axis, that is, an
Master Master axis AXIS_REF
instance of AXIS_REF_SM3.
Reference to axis, that is, an
Slave Slave axis AXIS_REF
instance of AXIS_REF_SM3.

 Input variable

Valid Initial
Input variable Name Data type Description
range value
TRUE, The function block is started at
Execute Enabling BOOL FALSE
FALSE the rising edge.
Phase
difference Phase difference between the
between the master axis and slave axis. A
PhaseShift LREAL 0
master axis positive number indicates the
and slave slave axis lags.
axis
Max. speed at phase shift
Velocity Speed LREAL 0
execution
Max. acceleration at phase shift
Acceleration Acceleration LREAL 0
execution
Max. deceleration at phase shift
Deceleration Deceleration LREAL 0
execution
Max. jerk at phase shift
Jerk Jerk LREAL 0
execution

 Output variable

Valid Initial
Output variable Name Data type Description
range value
TRUE, TRUE: The e-gear coupling of
Done Completion BOOL FALSE
FALSE the slave axis is disconnected.
Synchronous TRUE,
Busy BOOL FALSE The command is being executed.
running FALSE
TRUE: The function block is
Command TRUE,
CommandAborted BOOL FALSE interrupted by another control
interruption FALSE
command.
TRUE, Error is set when an error is
Error Error flag BOOL FALSE
FALSE detected.
When an error occurs, the error
ErrorID Error ID SMC_ERROR 0
ID is output.

(3) Function description

-110-
AX series programmable controller programming manual Motion control commands

The phase shift is executed at the rising edge of Execute. The slave axis automatically calculates a smooth curve,
completing the phase shift relative to the master axis. The master/slave axis phase difference is the value of PhaseShift
in the input signal. When the value is a positive number, the slave axis lags behind the master axis.

After the phase shift is completed, Done is TRUE.

The master/slave axis phase difference is compensated according to PhaseShift, Velocity, Acceleration, and
Deceleration.

When the master/slave axis phase difference reaches PhaseShift, the Done signal is output.

During the command execution, if the master axis command position and feedback position remain unchanged, the
slave axis is adjusted. Then the master/slave axis phase difference is PhaseShift.

The final result of this command is the phase shift between the given axis values, and therefore the actual feedback
value of a real axis may be inconsistent with the final shift.

(4) Timing diagram

The master and slave axes move in 360 cycles, and the adjustment is performed at the rising edge of the Execute signal.
After the adjustment is completed, the phase shift between the slave axis and the master axis is the value of PhaseShift.

-111-
AX series programmable controller programming manual INVT commands

3 INVT commands

3.1 Communication commands


3.1.1 ModbusRTU master node
The following describes the variables in the ModbusRTU master node command library.

 Variable definitions

Variable
Category Type Function Remarks
name
Indicates whether to
activate the 0: No
Execute1 BOOL
initialization of serial 1: Yes
port.
Baud1 DINT Baud rate. Example: 115200
Example: 8 bits (7 bits
Databits1 INT Data bits.
disallowed in ASCII)
INPUT
Example: 1 stop bit; 2
Stopbits1 INT Stop bits.
stop bits
0: No parity
ModbusRTU_ Parity1 INT Read/write flag. 1: Even parity
Master_Init_COM1 2: Odd parity
Slave1 UINT Slave node ID. 1–128
Timeout1 DINT Timeout time. Example: 1000
0: The command is
being executed.
bDone1 BOOL Completion flag.
1: The command has
been completed.
OUTPUT
0: No error
Error1 BOOL Error flag.
1: An error occurred.
See the ModbusRTU
ErrorID1 INT Error ID.
error ID table.
Indicates whether to
0: No
xExecute1 BOOL activate the read/write
1: Yes
function.
ModbusRTU_ 0X01, 0x03, 0x05,
Fun_Code1 INPUT INT Function code.
Master_Fun_COM1 0x06, 0x0f, 0x10
Addr1 UINT IP address. 0x0000–0xFFFF
Read: 1–250
DataCount1 UINT Data count.
Write: 1–240

-112-
AX series programmable controller programming manual INVT commands

Variable
Category Type Function Remarks
name
Points to the address
POINTER
DataPtr1 Data pointer. where the data to
TO INT
read or write is stored.
0: No error
Error1 BOOL Error flag.
1: An error occurred.
OUTPUT
See the ModbusRTU
ErrorID1 INT Error ID.
error ID table.

When serial port 2 serves as the ModbusRTU_Master master node, the variable count is the same, with the only
difference that the number at the variable name end changes from 1 to 2, for example, ModbusRTU_Master_Init_COM2.

 Use instructions

Step 1 Set data for connecting the ModbusRTU master node to the slave node.

Category Variable Function Example


Indicates whether Enable := TRUE
Execute1 to enable the slave
node.
Baud1 Baud rate Baud1 := 19200
ModbusRTU_Master_Init_COM1 Databits1 Data bits. Port :=8
Stopbits Stop bits. Unit := 1
Parity1 Parity bit Parity1:=2
Slave1 Slave node ID. Slave1:= 12
Timeout1 Timeout time. Delay Time := 1000

When defining the ModbusRTU slave node to be connected, refer to the preceding table for configuration. The following
is an example (in ST) for reference:

-113-
AX series programmable controller programming manual INVT commands

Variable definitions

Parameters for the slave


node to connect

Function parameters

Figure 3.1 Parameter setting example for connecting the ModbusRTU master node to the slave node

Step 2 After setting the parameters for connecting the ModbuRTU master node to the slave node, set the communication
function.

The setting parameters are described in the following table, and a setting example is also provided.

Variable Function Example


Indicates whether to enable RTU
xExecute1 RW:= TRUE
communication.
Fun_Code1 Function code Fun_Code1:=0x03
Addr1 R/W register start address. Addr := 2001
DataCount1 R/W register count. Conut := 12
Points to the address where the
DataPtr1 ADR (DATE_RTU1)
data to read or write is stored.

-114-
AX series programmable controller programming manual INVT commands

Figure 3.2 Parameter setting example for communication between the ModbusRTU master node and the slave node

3.1.2 ModbusRTU slave node


The following describes the variables in the ModbusRTU slave node command library.

 Variable definitions

Category Variable name Type Function Remarks

Indicates
whether to
0: No
Execute1 BOOL activate the
1: Yes
initialization of
serial port.

Baud1 DINT Baud rate Example: 115200

Databits1 INT Data bits. Example: 8 bits, 7 bits

ModbusRTU_Slave1 Stopbits1 INPUT INT Stop bits. Example: 1 stop bit; 2 stop
bits

0: No parity
Read/write
Parity1 INT 1: Even parity
flag.
2: Odd parity

Slave_Addr1 UINT Slave node ID. 1–128

Indicates 0: No
Enable1 BOOL
whether to 1: Yes

-115-
AX series programmable controller programming manual INVT commands

Category Variable name Type Function Remarks

activate the
read/write
function.

Completion 0: Incompleted
Done1 BOOL
flag. 1: Completed
OUTPUT
See the ModbusRTU error
ErrorID1 BYTE Error ID.
ID table.

 Use instructions

Step 1 Set serial port parameters, and establish the connection between the ModbusRTU master node and slave node.

Category Variable Function Example

Indicates whether to enable the


Execute1 Enable := TRUE
slave node.

Baud1 Baud rate Baud1 := 19200

Databits1 Data bits. Port :=8

ModbusRTU_Slave1 Stopbits Stop bits. Unit := 1

Parity1 Parity bit Parity1:=2

Delay Time :=
Timeout1 Timeout time.
1000

Slave_Addr1 Slave node ID. Slave1:= 12

Configure the slave node by referring to the ModbusRTU master node serial port parameters and the parameters in the
preceding table. (The variable Slave_Addr1 in the preceding table corresponds to Slave1 of the master node.)

Step 2 Exchange data between the ModbusRTU master node and slave node.

Set Execute1 to activate the ModbusRTU slave node. If the master node function code is 0x03 reading the holding
register, or the master node function code is 0x10 writing multiple registers, define a storage zone in the variable area, of
which the size cannot be smaller than the size of data that the ModbusTCP master node will write. If the master node
function code is 0x0F writing multiple coils, the operation is similar.

3.1.3 ModbusTCP master node


The following describes the variables in the ModbusTCP master node command library.

 Variable definitions

Variable
Type Function Remarks
name
Indicates whether to
0: No
Enable BOOL activate the ModbusTCP
1: Yes
function.
INPUT
IP STRING Slave node IP address. Example: 192.168.1.13
Port DINT Slave node port number. Example: 502
Unit INT Slave node ID. Non-negative integer

-116-
AX series programmable controller programming manual INVT commands

Variable
Type Function Remarks
name
DelayTime INT Response delay. Non-negative integer
Indicates whether to 0: No
Fun_Enable BOOL
enable the function code. 1: Yes
0x03: Read multiple registers.
fun_code BYTE Function code.
0x10: Write multiple registers.
Addr UINT R/W register address. Example: 2000, 2001
Count INT R/W register count. Up to 120 in a batch.
Indicates whether to write
CoilSingleData INT 0 or 1
a single coil.
POINTER Used to save the bit data to read and
BitPtr Bit data pointer.
TO BOOL write.
Used to store the location information of
POINTER
DataPtr R/W pointer. the data read or to store the data to be
TO INT
written to registers.
0: The command is being executed.
Done BOOL Completion flag.
1: The command has been completed.
OUTPUT
Error BOOL Error flag. 0: No error 1: An error occurred.
ErrorID INT Error ID. See the ModbusTCP error ID table.

 Use instructions

Step 1 Perform settings for connecting the ModbusTCP master node to the slave node.

In the project monitoring state, set the parameters for connecting to the ModbusTCP slave node. See the following table.

Variable Function Example


Enable Indicates whether to enable the slave node. Enable := TRUE
IP address ModbusTCP slave node IP address. IP := ‘192.168.1.13’
Port ModbusTCP slave node port number. Port := ‘502’
Unit ModbusTCP slave node ID. Unit := 3
Delay Time Function start timeout time. Delay Time := 1000

When the master node accesses a single slave node, the preceding variables need to be assigned. The following
provides an example (in FDB):

-117-
AX series programmable controller programming manual INVT commands

Figure 3.3 Parameter setting example for connecting the ModbusTCP master node to the slave node

The function block in the preceding figure represents an independent connection between the ModbusTCP master node
and slave node. If you want to add another ModbusTCP master/slave node connection, create a new function block and
set the parameters by referring to the example.

Step 2 After setting the parameters for connecting the ModbuTCP master node to the slave node, set the communication
function. The setting parameters are described in the following table, and a setting example is also provided.

Variable Function Example


Fun_Enable Indicates whether to enable the function code. Fun_Enable:= TRUE
fun_code Function of reading/writing multiple register coils. Fun_code := 3
Addr R/W register start address. Addr := 2001
Count R/W register count. Conut := 12
DataPtr Points to the address where the data to read or write is stored. ADR (DATE_TCP)

-118-
AX series programmable controller programming manual INVT commands

Figure 3.4 Parameter setting example for communication between the ModbusTCP master node and the slave node

In the preceding figure, each operation block represents a ModbusTCP request. As shown in the figure, the connection is
defined for one ModbusTCP master node and slave node. The first and third operation blocks indicate (0x03) reading the
holding registers from different slave nodes, while the second and fourth operation blocks indicate writing a certain
amount of data to the registers of different slave nodes.

If you want to add more communication requirements on the same ModbusTCP master node and slave node, you can
create the required operation blocks for the connection, and set communication parameters by referring to the example.

3.1.4 ModbusTCP slave node


The following describes the variables in the ModbusTCP slave node command library.

 Variable definitions

Variable Type Function Remarks


Indicates whether to activate the 0: No
Enable BOOL
ModbusTCP_Slave function. 1: Yes
INPUT
Port DINT Slave node port number. The default value 502 is used.
Unit INT Slave node ID. Slave node ID (1–247)
0: The command is being
executed.
Done BOOL Completion flag.
1: The command has been
executed.
Local IP address (change
IP OUTPUT STRING Slave node IP address.
disallowed).
0: No error 1: An error
Error BOOL Error flag
occurred.
See the ModbusTCP error ID
ErrorID INT Error ID.
table.

 Use instructions

-119-
AX series programmable controller programming manual INVT commands

Step 1 The ModbusTCP master node reads data from the ModbusTCP slave node.

Set Enable to 1 to activate the ModbusTCP slave node. If the master node function code is 0x03 reading holding register,
set InputSize, set the data arrays with the size specified by InputSize to store the data to read, and assign data array
addresses to the Inputs pointer. If the master node function code is 0x01 reading coils, the operation is similar.

Step 2 The ModbusTCP master node writes data to the ModbusTCP slave node.

Set Enable to 1 to make the ModbusRTU slave node in activated state. If the master node function code is 0x10 writing
multiple registers, define a storage zone in the variable area, of which the size cannot be smaller than the size of data
that the ModbusTCP master node will write. If the master node function code is 0x0F writing multiple coils, the operation
is similar.

3.2 Pulse commands


3.2.1 MC_InitSys_Invt
MC_InitSys_Invt: initialization command of the motion control module axis.

(1) Command format

Command Name Expressed in diagram Expressed in ST


Axis
MC_InitSys_Invt initialization MC_InitSys_Invt_0(Done=> );

command

(2) Related variables

 Input variable

Input Data Valid Initial


Name Description
variable type range value
TRUE: Pulse type.
FALSE: Bus type.
Execution TRUE,
Mode BOOL TRUE You must restart the controller after the setting
condition FALSE
change. Otherwise, unknown situation may
occur during running.
Running cycle. For the pulse type, the value
must be 1. For the bus type, the value must
Execution be greater than 0.
Period UINT - 1
condition You must restart the controller after the setting
change. Otherwise, unknown situation may
occur during running.

 Output variable

Output Data Valid Initial


Name Description
variable type range value
Command TRUE, TRUE: Initialization completed.
Done BOOL FALSE
execution FALSE FALSE: Initialization incompleted.

-120-
AX series programmable controller programming manual INVT commands

Output Data Valid Initial


Name Description
variable type range value
completion
TRUE, TRUE: An axis error occurs.
Error Axis error flag BOOL FALSE
FALSE FALSE: No axis error occurs.
Default value: 0
ErrorID Error ID UINT - 0 Value > 100: Alarm ID.
Value < 100: Error ID.

(3) Function description

The function block is used to initialize a motion control module. When Done is TRUE, the initialization is completed.
Otherwise, the initialization is not completed.

3.2.2 MC_Axis
MC_Axis: axis defintion command.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_Axis(
AxisID:= ,
MaxVelocity:= ,
MaxAcceleration:= ,
MaxHomeSpeed:= ,
MaxVim2Speed:= ,
MaxVim1Speed:= ,
Axis MaxJogSpeed:= ,
MaxDeceleration:= ,
MC_Axis definition
LimitEnable:= ,
command MaxPLimit:= ,
MaxNLimit:= ,
PulseData:= ,
DistanceData:= ,
MaxJerkTime:= ,
Mode:= ,
Error=> ,
ErrorID=> );

(2) Related variables

 Input variable

Data
Input variable Name Valid range Initial value Description
type
AxisID Axis ID BYTE 0–3 0 Axis ID (0–3).
Max. running Max. running speed of the
MaxVelocity LREAL 1–5000 2000
speed of axis present axis. Unit: mm/min
Max.
Positive number Max. acceleration of the
MaxAcceleration acceleration LREAL 1800000 2
or 0 present axis. Unit: mm/min
of axis
Max. homing Max. homing speed of the
MaxHomeSpeed LREAL 1–5000 1000
speed of axis present axis. Unit: mm/min
Max. homing Max. running speed at step 2 of
MaxVim2Speed LREAL 1–50 20
speed at the present axis. Unit: mm/min

-121-
AX series programmable controller programming manual INVT commands

Data
Input variable Name Valid range Initial value Description
type
step 2 of axis
Max. homing
Max. homing speed at step 1 of
MaxVim1Speed speed at LREAL 50–600 200
the present axis. Unit: mm/min
step 1 of axis
Max. jogging Max. jogging speed of the
MaxJogSpeed LREAL 1–5000 1000
speed of axis present axis. Unit: mm/min
Max.
Positive number Max. deceleration of the
MaxDeceleration deceleration LREAL 1800000 2
or 0 present axis. Unit: mm/min
speed of axis
TRUE: Enable the software
position limit function.
Software
FALSE: Disable the software
LimitEnable position limit BOOL TRUE, FALSE TRUE
position limit function. (Not
flag
considered in single-axis speed
mode)
Max. forward Positive number Max. forward limit position of
MaxPLimit LREAL 999999.999
limit position or 0 the present axis. Unit: mm
Max. reverse Negative number Max. reverse limit position of
MaxNLimit LREAL -999999.999
limit position or 0 the present axis. Unit: mm
Number of
pulses Number of pulses required for
Positive number
PulseData required for UDINT 10000 one rotation of the present axis.
or 0
one rotation Unit: pulse
of axis
Distance of
one Positive number Distance of one revolution of
DistanceData LREAL 10
revolution of or 0 the present axis. Unit: mm
axis
Duration of
Duration of the max. jerk of the
MaxJerkTime the max. jerk UINT 10–400 100
present axis.
of axis
Control mode of the present
axis.
Axis control 0: "Pulse + Sign" mode
Mode USINT 0–2 2
mode 1: FWD/REV pulse train mode
2: Quadrature encoding pulse
mode

 Output variable

-122-
AX series programmable controller programming manual INVT commands

Data
Output variable Name Valid range Initial value Description
type
Axis error TRUE: An axis error occurs.
Error BOOL TRUE, FALSE FALSE
flag FALSE: No axis error occurs.
Default value: 0
ErrorID Error ID UINT —— 0 Value > 100: Alarm ID.
Value < 100: Error ID.

(3) Function description

It is used to declare the axis ID and control parameters.

3.2.3 MC_Power_Invt
MC_Power_Invt: axis enabling command.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_Power_Invt(
Axis:= ,
Enable:= ,
AxisError:= ,
Axis enabling AxisEnable:= ,
MC_Power_Invt
Status=> ,
command
Valid=> ,
Busy=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Used to specify the axis ID (0–3)
Axis Axis MC_Axis - -
and axis control settings.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
Execution Function block enabling bit,
Enable BOOL TRUE, FALSE FALSE
condition triggered at high level.
TRUE: Report an alarm.
AxisError Axis alarm flag BOOL TRUE, FALSE FALSE
FALSE: Do not report an alarm.
TRUE: The axis has been
Axis enabling
AxisEnable BOOL TRUE, FALSE FALSE enabled.
flag
FALSE: The axis is not enabled.

 Output variable

-123-
AX series programmable controller programming manual INVT commands

Output Initial
Name Data type Valid range Description
variable value
TRUE: Ready to run
Status Ready to run BOOL TRUE, FALSE FALSE
FALSE: Not ready to run
TRUE: The axis has been
Axis enabling
Valid BOOL TRUE, FALSE FALSE enabled.
flag
FALSE: The axis is not enabled.
TRUE: The function block is
being executed.
Busy Executing BOOL TRUE, FALSE FALSE
FALSE: The function block is not
executed.
TRUE: An axis error occurs.
Error Axis error flag BOOL TRUE, FALSE FALSE
FALSE: No axis error occurs.
Default value: 0
ErrorID Error ID UINT - 0 Value > 100: Alarm ID.
Value < 100: Error ID.

(3) Function description

It is used to enable the motion control module axis. During the control process, the motion module uses the axis to
perform related operation control functions only after the axis does not generate any alarm and the servo enabling is
completed. The output reflects the function block running status, whether errors occur, and error information if any.

3.2.4 MC_Stop_Invt
MC_Stop_Invt: axis stop command.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_Stop_Invt(
Axis:= ,
Enable:= ,
Deceleration:= ,
Axis stop JerkTime:= ,
MC_Stop_Invt
Mode:= ,
command
Done=> ,
Busy=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Used to specify the axis ID (0–3)
Axis Axis MC_Axis - -
and axis control settings.

 Input variable

-124-
AX series programmable controller programming manual INVT commands

Initial
Input variable Name Data type Valid range Description
value
Execution Function block enabling bit,
Enable BOOL TRUE, FALSE FALSE
condition triggered at the rising edge.
Deceleration. Unit: mm/min²
Positive number (When the deceleration is set
Deceleration Deceleration LREAL 1800000
or 0 improperly, the deceleration in
the axis control function is used.)
JerkTime Jerk duration UINT 0–400 0 Jerk duration.
Deceleration TRUE: Decelerate to stop.
Mode BOOL TRUE, FALSE TRUE
stop mode FALSE: Stop immediately.

 Output variable

Output Initial
Name Data type Valid range Description
variable value
Command TRUE: Initialization completed.
Done execution BOOL TRUE, FALSE FALSE FALSE: Initialization
completion incompleted.
TRUE: The function block is
Busy Executing BOOL TRUE, FALSE FALSE being executed. FALSE: The
function block is not executed.
TRUE: An axis error occurs.
Error Axis error flag BOOL TRUE, FALSE FALSE
FALSE: No axis error occurs.
Default value: 0
ErrorID Error ID UINT - 0 Value > 100: Alarm ID.
Value < 100: Error ID.

(3) Function description

It is used by the control module. It supports single-axis stop during the control process, and supports T-type and S-type
acceleration and deceleration planning. JerkTime>0 corresponds to S-type acceleration and deceleration planning, while
JerkTime=0 corresponds to T-type acceleration and deceleration planning. It supports the deceleration stop and
immediate stop control modes.

3.2.5 MC_Reset_Invt
MC_Reset_Invt: axis reset command.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_Reset_Invt(
Axis:= ,
Axis reset Enable:= ,
MC_Reset_Invt Done=> ,
command Busy=> ,
Error=> ,
ErrorID=> );

(2) Related variables

-125-
AX series programmable controller programming manual INVT commands

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Used to specify the axis ID (0–3)
Axis Axis MC_Axis - -
and axis control settings.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
Execution Function block enabling bit,
Enable BOOL TRUE, FALSE FALSE
condition triggered at the rising edge.

 Output variable

Output Initial
Name Data type Valid range Description
variable value
Command TRUE: Initialization completed.
Done execution BOOL TRUE, FALSE FALSE FALSE: Initialization
completion incompleted.
TRUE: The function block is
Busy Executing BOOL TRUE, FALSE FALSE being executed. FALSE: The
function block is not executed.
Axis error TRUE: An axis error occurs.
Error BOOL TRUE, FALSE FALSE
flag FALSE: No axis error occurs.
Default value: 0
ErrorID Error ID UINT - 0 Value > 100: Alarm ID.
Value < 100: Error ID.

(3) Function description

It is used by the axis reset control module for single-axis control. If the stop function is performed in any situation, you
must use this module to cancel the stop state.

3.2.6 MC_JOG_Invt
MC_JOG_Invt: jogging command.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_JOG_Invt(
Axis:= ,
JogDirection:= ,
RunStart:= ,
Jogging Velocity:= ,
MC_JOG_Invt Acceleration:= ,
command Deceleration:= ,
Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );

(2) Related variables

-126-
AX series programmable controller programming manual INVT commands

 I/O variable

Data Initial
I/O variable Name Valid range Description
type value
Used to specify the axis ID (0–
Axis Axis MC_Axis - -
3) and axis control settings.

 Input variable

Data Initial
Input variable Name Valid range Description
type value
Motion TRUE: Forward motion
JogDirection BOOL TRUE, FALSE FALSE
direction FALSE: Reverse motion
Execution Function block enabling bit,
RunStart BOOL TRUE, FALSE FALSE
condition triggered at the rising edge.
Positive number
Velocity Speed LREAL 500 Jogging speed. Unit: mm/min
or 0
Positive number
Acceleration Acceleration LREAL 1800000 Acceleration. Unit: mm/min²
or 0

 Output variable

Data Initial
Output variable Name Valid range Description
type value
TRUE: The function block is
Busy Executing BOOL TRUE, FALSE FALSE being executed. FALSE: The
function block is not executed.
Command
TRUE: Interrupted
CommandAborted interruption BOOL TRUE, FALSE FALSE
FALSE: Not interrupted
flag
Axis error TRUE: An axis error occurs.
Error BOOL TRUE, FALSE FALSE
flag FALSE: No axis error occurs.
Default value: 0
ErrorID Error ID UINT - 0 Value > 100: Alarm ID.
Value < 100: Error ID.

(3) Function description

It is used to enable a single axis to jog. It allows you to set the jogging speed, acceleration and deceleration of the axis.
The output returns the function block execution status, whether an error occurs, and error information if any.

3.2.7 MC_JOGP_Invt
MC_JOGP_Invt: axis point-to-point (PTP) motion command.

(1) Command format

-127-
AX series programmable controller programming manual INVT commands

Command Name Expressed in diagram Expressed in ST


MC_JOGP_Invt(
Axis:= ,
JogDirection:= ,
RunStart:= ,
Velocity:= ,
PTP motion Acceleration:= ,
MC_JOGP_Invt Deceleration:= ,
command Distance:= ,
Done=> ,
Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

Data Initial
I/O variable Name Valid range Description
type value
Used to specify the axis ID (0–3)
Axis Axis MC_Axis - -
and axis control settings.

 Input variable

Data Initial
Input variable Name Valid range Description
type value
Motion TRUE: Forward motion
JogDirection BOOL TRUE, FALSE FALSE
direction FALSE: Reverse motion
Execution Function block enabling bit,
RunStart BOOL TRUE, FALSE FALSE
condition triggered at the rising edge.
Positive number
Velocity Speed LREAL 500 PTP motion speed. Unit: mm/min
or 0
Positive number
Acceleration Acceleration LREAL 1800000 Acceleration. Unit: mm/min²
or 0
Moving
Distance LREAL Data range 0.5 Moving distance. Unit: mm
distance

 Output variable

Data Initial
Output variable Name Valid range Description
type value
Command TRUE: Initialization completed.
Done execution BOOL TRUE, FALSE FALSE FALSE: Initialization
completion incompleted.
TRUE: The function block is
Busy Executing BOOL TRUE, FALSE FALSE being executed. FALSE: The
function block is not executed.
Command
TRUE: Interrupted
CommandAborted interruption BOOL TRUE, FALSE FALSE
FALSE: Not interrupted
flag

-128-
AX series programmable controller programming manual INVT commands

Data Initial
Output variable Name Valid range Description
type value
Axis error TRUE: An axis error occurs.
Error BOOL TRUE, FALSE FALSE
flag FALSE: No axis error occurs.
Default value: 0
ErrorID Error ID UINT - 0 Value > 100: Alarm ID.
Value < 100: Error ID.

(3) Function description

It is used to enable a single axis to perform PTP motion. It allows you to set the motion speed, acceleration and
deceleration of the axis. The axis can be positioned to 0.001mm through the function. The output returns the function
block execution status, whether an error occurs, and error information if any.

3.2.8 MC_MoveAbsolute_Invt
MC_MoveAbsolute_Invt: single-axis absolute position control command.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_MoveAbsolute_Invt(
Axis:= ,
Enable:= ,
Single-axis Position:= ,
Velocity:= ,
absolute
MC_Move Acceleration:= ,
position Deceleration:= ,
Absolute_Invt JerkTime:= ,
control Done=> ,
command Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Used to specify the axis ID (0–3)
Axis Axis MC_Axis - -
and axis control settings.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
Execution Function block enabling bit,
Enable BOOL TRUE, FALSE FALSE
condition triggered at the rising edge.
Position Distance LREAL Data range 0 Distance
Velocity Speed LREAL Positive number 1000 Speed. Unit: mm/min
Positive number
Acceleration Acceleration LREAL 1800000 Acceleration. Unit: mm/min²
or 0
JerkTime Jerk duration UINT 0–400 0 Jerk duration.

-129-
AX series programmable controller programming manual INVT commands

 Output variable

Initial
Output variable Name Data type Valid range Description
value
Command TRUE: Initialization completed.
Done execution BOOL TRUE, FALSE FALSE FALSE: Initialization
completion incompleted.
TRUE: The function block is
Busy Executing BOOL TRUE, FALSE FALSE being executed. FALSE: The
function block is not executed.
Command
TRUE: Interrupted
CommandAborted interruption BOOL TRUE, FALSE FALSE
FALSE: Not interrupted
flag
Axis error TRUE: An axis error occurs.
Error BOOL TRUE, FALSE FALSE
flag FALSE: No axis error occurs.
Default value: 0
ErrorID Error ID UINT - 0 Value > 100: Alarm ID.
Value < 100: Error ID.

(3) Function description

It is used for single-axis absolute position control. It supports T-type and S-type acceleration and deceleration planning.
JerkTime>0 corresponds to S-type acceleration and deceleration planning, while JerkTime=0 corresponds to T-type
acceleration and deceleration planning. The output returns the function block execution status, whether an error occurs,
and error information if any.

3.2.9 MC_MoveRelative_Invt
MC_MoveRelative_Invt: single-axis relative position control command.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_MoveRelative_Invt(
Axis:= ,
Enable:= ,
Position:= ,
Single-axis Velocity:= ,
MC_MoveRelative relative-position Acceleration:= ,
Deceleration:= ,
_Invt control JerkTime:= ,
Done=> ,
command
Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Used to specify the axis ID (0–3)
Axis Axis MC_Axis - -
and axis control settings.

-130-
AX series programmable controller programming manual INVT commands

 Input variable

Initial
Input variable Name Data type Valid range Description
value
Execution Function block enabling bit,
Enable BOOL TRUE, FALSE FALSE
condition triggered at the rising edge.
Position Distance LREAL Data range 0 Distance
Velocity Speed LREAL Positive number 1000 Speed. Unit: mm/min
Positive number
Acceleration Acceleration LREAL 1800000
or 0 Acceleration. Unit: mm/min²
Jerk
JerkTime UINT 0–400 0 Jerk duration.
duration

 Output variable

Initial
Output variable Name Data type Valid range Description
value
Command TRUE: Initialization completed.
Done execution BOOL TRUE, FALSE FALSE FALSE: Initialization
completion incompleted.
TRUE: The function block is
Busy Executing BOOL TRUE, FALSE FALSE being executed. FALSE: The
function block is not executed.
Command
TRUE: Interrupted
CommandAborted interruption BOOL TRUE, FALSE FALSE
FALSE: Not interrupted
flag
Axis error TRUE: An axis error occurs.
Error BOOL TRUE, FALSE FALSE
flag FALSE: No axis error occurs.
Default value: 0
ErrorID Error ID UINT - 0 Value > 100: Alarm ID.
Value < 100: Error ID.

(3) Function description

It is used for single-axis relative position control. It supports T-type and S-type acceleration and deceleration planning.
JerkTime>0 corresponds to S-type acceleration and deceleration planning, while JerkTime=0 corresponds to T-type
acceleration and deceleration planning. The output returns the function block execution status, whether an error occurs,
and error information if any.

-131-
AX series programmable controller programming manual INVT commands

3.2.10 MC_MoveVelocity_Invt
MC_MoveVelocity_Invt: single-axis speed control command.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_MoveVelocity_Invt(
Axis:= ,
Enable:= ,
Direction:= ,
Single-axis Velocity:= ,
MC_MoveVel speed Acceleration:= ,
Deceleration:= ,
ocity_Invt control JerkTime:= ,
InVelocity=> ,
command
Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Used to specify the axis ID (0–
Axis Axis MC_Axis - -
3) and axis control settings.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
Execution Function block enabling bit,
Enable BOOL TRUE, FALSE FALSE
condition triggered at the rising edge.
Direction.
Motion
Direction BOOL TRUE, FALSE TRUE TRUE: Forward
direction
FALSE: Reverse
Positive number
Velocity Speed LREAL 500
or 0 Speed. Unit: mm/min
Positive number
Acceleration Acceleration LREAL 1800000
or 0 Acceleration. Unit: mm/min²
Jerk
JerkTime UINT 0–400 0 Jerk duration.
duration

 Output variable

Initial
Output variable Name Data type Valid range Description
value
Flag
indicating TRUE: The speed value is
InVelocity BOOL TRUE, FALSE FALSE
the speed reached for the first time.
value is

-132-
AX series programmable controller programming manual INVT commands

Initial
Output variable Name Data type Valid range Description
value
reached for
the first time
TRUE: The function block is
Busy Executing BOOL TRUE, FALSE FALSE being executed. FALSE: The
function block is not executed.
Command
TRUE: Interrupted
CommandAborted interruption BOOL TRUE, FALSE FALSE
FALSE: Not interrupted
flag
Axis error TRUE: An axis error occurs.
Error BOOL TRUE, FALSE FALSE
flag FALSE: No axis error occurs.
Default value: 0
ErrorID Error ID UINT - 0 Value > 100: Alarm ID.
Value < 100: Error ID.

(3) Function description

It is used for single-axis speed control. It is the flag indicating no need to complete homing in the control process. It
supports T-type and S-type acceleration and deceleration planning. JerkTime>0 corresponds to S-type acceleration and
deceleration planning, while JerkTime=0 corresponds to T-type acceleration and deceleration planning. The output
returns the function block execution status, whether an error occurs, and error information if any.

3.2.11 MC_ReadActualPosition_Invt
MC_ReadActualPosition_Invt: axis actual position reading command.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_ReadActualPosition_Invt(
Axis actual Axis:= ,
MC_ReadActual position Enable:= ,
Busy=> ,
Position_Invt reading Value=> ,
Error=> ,
command
ErrorID=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Used to specify the axis ID (0–
Axis Axis MC_Axis - -
3) and axis control settings.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
Execution Function block enabling bit,
Enable BOOL TRUE, FALSE FALSE
condition triggered at the rising edge.

-133-
AX series programmable controller programming manual INVT commands

 Output variable

Initial
Output variable Name Data type Valid range Description
value
TRUE: The function block is
Busy Executing BOOL TRUE, FALSE FALSE being executed. FALSE: The
function block is not executed.
Position
Value LREAL Data range 0 Position parameter return value.
value
Axis error TRUE: An axis error occurs.
Error BOOL TRUE, FALSE FALSE
flag FALSE: No axis error occurs.
Default value: 0
ErrorID Error ID UINT - 0 Value > 100: Alarm ID.
Value < 100: Error ID.

(3) Function description

It is used to read the actual position of an axis. The input variable Axis determines which axis is read. The output variable
Value returns the actual coordinate position of the axis.

3.2.12 MC_ActiveSpeed_Invt
MC_ActiveSpeed_Invt: axis actual speed reading command.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_ActiveSpeed_Invt(
Axis actual Axis:= ,
MC_ActiveSpeed speed Enable:= ,
Busy=> ,
_Invt reading Error=> ,
ErrorID=> ,
command
ActiveSpeed=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Used to specify the axis ID (0–3)
Axis Axis MC_Axis - -
and axis control settings.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
Execution Function block enabling bit,
Enable BOOL TRUE, FALSE FALSE
condition triggered at high level.

 Output variable

-134-
AX series programmable controller programming manual INVT commands

Initial
Output variable Name Data type Valid range Description
value
TRUE: The function block is
Busy Executing BOOL TRUE, FALSE FALSE being executed. FALSE: The
function block is not executed.
Axis error TRUE: An axis error occurs.
Error BOOL TRUE, FALSE FALSE
flag FALSE: No axis error occurs.
Default value: 0
ErrorID Error ID UINT - 0 Value > 100: Alarm ID.
Value < 100: Error ID.
ActiveSpeed Speed LREAL Data range 0 Speed parameter return value.

(3) Function description

It is used to read the actual speed of an axis. The input variable Axis determines which axis is read. The output variable
ActiveSpeed returns the actual running speed of the axis.

3.2.13 MC_HOME_Invt
MC_HOME_Invt: axis homing command.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_HOME_Invt(
Axis:= ,
HomeSpeed:= ,
Vmin:= ,
Vmin2:= ,
Enable:= ,
Axis DecPositon:= ,
Acceleration:= ,
MC_HOME_Invt homing
Deceleration:= ,
command Direction:= ,
Mode:= ,
Done=> ,
Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Used to specify the axis ID (0–3)
Axis Axis MC_Axis - -
and axis control settings.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
Homing
HomeSpeed LREAL Positive number 800 Homing speed
speed

-135-
AX series programmable controller programming manual INVT commands

Initial
Input variable Name Data type Valid range Description
value
Running speed at the
Vmin Speed 1 LREAL 50–600 200
deceleration block.
Running speed when waiting for
Vmin2 Speed 2 LREAL 1–50 30
the Z signal of motor.
Execution Function block enabling bit,
Enable BOOL TRUE, FALSE FALSE
condition triggered at the rising edge.
Deceleration
DecPositon BOOL TRUE, FALSE FALSE Deceleration block signal
block signal
Positive number
Acceleration Acceleration LREAL 1800000 Acceleration. Unit: mm/min²
or 0
Homing direction.
Homing
Direction BOOL TRUE, FALSE TRUE TRUE: Forward
direction
FALSE: Reverse
Homing Homing mode (It does not work
Mode UINT - 1
mode currently.)

 Output variable

Initial
Output variable Name Data type Valid range Description
value
TRUE: The mechanical origin is
Command
found.
Done execution BOOL TRUE, FALSE FALSE
FALSE: The mechanical origin
completion
is not found.
TRUE: The function block is
Busy Executing BOOL TRUE, FALSE FALSE being executed. FALSE: The
function block is not executed.
Axis error TRUE: An axis error occurs.
Error BOOL TRUE, FALSE FALSE
flag FALSE: No axis error occurs.
Default value: 0
ErrorID Error ID UINT - 0 Value > 100: Alarm ID.
Value < 100: Error ID.
ActiveSpeed Speed LREAL Data range 0 Speed parameter return value.

(3) Function description

It is used for an axis to find the zero point control function of the mechanism. The homing module can be customized
according to the structure of the mechanism. Currently, only one homing method is supported. The homing of four axes
is supported at the same time. The output returns the function block execution status, whether an error occurs, and error
information if any.

3.2.14 AMC_Reset_Invt
AMC_Reset_Invt: multi-axis reset command.

(1) Command format

-136-
AX series programmable controller programming manual INVT commands

Command Name Expressed in diagram Expressed in ST


AMC_Reset_Invt(
Multi-axis Enable:= ,
Done=> ,
AMC_Reset_Invt reset
Busy=> ,
command Error=> ,
ErrorID=> );

(2) Related variables

 Input variable

Initial
Input variable Name Data type Valid range Description
value
Execution Function block enabling bit,
Enable BOOL TRUE, FALSE FALSE
condition triggered at the rising edge.

 Output variable

Initial
Output variable Name Data type Valid range Description
value
TRUE: The mechanical origin is
Command
found.
Done execution BOOL TRUE, FALSE FALSE
FALSE: The mechanical origin
completion
is not found.
TRUE: The function block is
Busy Executing BOOL TRUE, FALSE FALSE being executed. FALSE: The
function block is not executed.
TRUE: An axis error occurs.
Error Axis error flag BOOL TRUE, FALSE FALSE
FALSE: No axis error occurs.
Default value: 0
ErrorID Error ID UINT - 0 Value > 100: Alarm ID.
Value < 100: Error ID.

(3) Function description

It is used by the axis reset control module for multi-axis control. If the stop function is performed in any situation, you
must use this module to cancel the stop state.

3.2.15 AMC_Stop_Invt
AMC_Stop_Invt: multi-axis stop command.

(1) Command format

Command Name Expressed in diagram Expressed in ST


AMC_Stop_Invt(
Enable:= ,
Deceleration:= ,
Multi-axis stop JerkTime:= ,
AMC_Stop_Invt Mode:= ,
command Done=> ,
Busy=> ,
Error=> ,
ErrorID=> );

-137-
AX series programmable controller programming manual INVT commands

(2) Related variables

 Input variable

Initial
Input variable Name Data type Valid range Description
value
Execution Function block enabling bit,
Enable BOOL TRUE, FALSE FALSE
condition triggered at the rising edge.
Deceleration. Unit: mm/min²
(When the deceleration is set
Positive number
Deceleration Deceleration LREAL 1800000 improperly, the deceleration in
or 0
the axis control function is
used.)
JerkTime Jerk duration UINT 0–400 0 Jerk duration.
TRUE: Decelerate to stop.
Mode Stop mode BOOL TRUE, FALSE TRUE
FALSE: Stop immediately.

 Output variable

Initial
Output variable Name Data type Valid range Description
value
Command TRUE: The axis has stopped.
Done execution BOOL TRUE, FALSE FALSE FALSE: The axis is decelerating
completion to stop.
TRUE: The function block is
being executed.
Busy Executing BOOL TRUE, FALSE FALSE
FALSE: The function block is not
executed.
TRUE: An axis error occurs.
Error Axis error flag BOOL TRUE, FALSE FALSE
FALSE: No axis error occurs.
Default value: 0
ErrorID Error ID UINT - 0 Value > 100: Alarm ID.
Value < 100: Error ID.

(3) Function description

It is used to stop the control module. It supports stopping specified axes during the control process, and supports T-type
and S-type acceleration and deceleration planning. JerkTime>0 corresponds to S-type acceleration and deceleration
planning, while JerkTime=0 corresponds to T-type acceleration and deceleration planning. It supports the deceleration
stop and immediate stop control modes.

-138-
AX series programmable controller programming manual INVT commands

3.2.16 AMC_ActiveSpeed_Invt
AMC_ActiveSpeed_Invt: multi-axis composite speed reading command.

(1) Command format

Command Name Expressed in diagram Expressed in ST


Multi-axis
AMC_ActiveSpeed_Invt(
composite Enable:= ,
Busy=> ,
AMC_ActiveSpeed_Invt speed
Error=> ,
reading ErrorID=> ,
ActiveSpeed=> );
command

(2) Related variables

 Input variable

Initial
Input variable Name Data type Valid range Description
value
Execution Function block enabling bit,
Enable BOOL TRUE, FALSE FALSE
condition triggered at high level.

 Output variable

Initial
Output variable Name Data type Valid range Description
value
TRUE: The function block is
being executed.
Busy Executing BOOL TRUE, FALSE FALSE
FALSE: The function block is
not executed.
TRUE: An axis error occurs.
Error Axis error flag BOOL TRUE, FALSE FALSE
FALSE: No axis error occurs.
Default value: 0
ErrorID Error ID UINT - 0 Value > 100: Alarm ID.
Value < 100: Error ID.
ActiveSpeed Speed LREAL Data range 0 Axis actual speed.

(3) Function description

It is used to read the actual speeds of specified axes. The output variable ActiveSpeed returns the actual running speeds
of the axes.

-139-
AX series programmable controller programming manual INVT commands

3.2.17 AMC_MoveAbsolute_Invt
AMC_MoveAbsolute_Invt: multi-axis absolute position control command.

(1) Command format

Command Name Expressed in diagram Expressed in ST


AMC_MoveAbsolute_Invt(
Axis1_Use:= ,
Axis2_Use:= ,
Axis3_Use:= ,
Axis4_Use:= ,
Enable:= ,
Multi-axis Position1:= ,
Position2:= ,
absolute
AMC_Move Position3:= ,
position Position4:= ,
Absolute_Invt Velocity:= ,
control Acceleration:= ,
command Deceleration:= ,
JerkTime:= ,
Done=> ,
Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 Input variable

Valid Initial
Input variable Name Data type Description
range value
Use flag of axis 1.
TRUE,
Axis1_Use Use flag of axis 1 BOOL FALSE TRUE: Used
FALSE
FALSE: Not used
Use flag of axis 2.
TRUE,
Axis2_Use Use flag of axis 2 BOOL FALSE TRUE: Used
FALSE
FALSE: Not used
Use flag of axis 3.
TRUE,
Axis3_Use Use flag of axis 3 BOOL FALSE TRUE: Used
FALSE
FALSE: Not used
Use flag of axis 4.
TRUE,
Axis4_Use Use flag of axis 4 BOOL FALSE TRUE: Used
FALSE
FALSE: Not used
Execution TRUE, Function block enabling bit,
Enable BOOL FALSE
condition FALSE triggered at the rising edge.
Position1 Distance of axis 1 LREAL Data range 0 Distance of axis 1
Position2 Distance of axis 2 LREAL Data range 0 Distance of axis 2
Position3 Distance of axis 3 LREAL Data range 0 Distance of axis 3
Position4 Distance of axis 4 LREAL Data range 0 Distance of axis 4
Positive
Velocity Speed LREAL number or 500 Speed. Unit: mm/min
0

-140-
AX series programmable controller programming manual INVT commands

Valid Initial
Input variable Name Data type Description
range value
Positive
Acceleration Acceleration LREAL number or 1800000 Acceleration. Unit: mm/min²
0
JerkTime Jerk duration UINT 0–400 0 Jerk duration.

 Output variable

Valid Initial
Output variable Name Data type Description
range value
Completion flag. TRUE: The
Command
TRUE, specified position is reached.
Done execution BOOL FALSE
FALSE FALSE: The specified position
completion
is not reached.
TRUE: The function block is
TRUE,
Busy Executing BOOL FALSE being executed. FALSE: The
FALSE
function block is not executed.
Command TRUE, TRUE: Interrupted.
CommandAborted BOOL FALSE
interruption flag FALSE FALSE: Not interrupted.
TRUE, TRUE: An axis error occurs.
Error Axis error flag BOOL FALSE
FALSE FALSE: No axis error occurs.
Default value: 0
ErrorID Error ID UINT - 0 Value > 100: Alarm ID.
Value < 100: Error ID.

(3) Function description

The multi-axis absolute position mode supports simultaneous movement of four axes. The absolute position is specified
by Position. You need to set the corresponding movement direction, speed, acceleration, and other information and
make Enable to start the function block by changing the value from FALSE to TRUE, and specify the axes to move from
the present positions to the absolute positions.

The multi-axis absolute position mode has the same principle as the single-axis absolute position mode. The difference
is that the multi-axis absolute position mode can control multiple axes to move to absolute positions at the same time.

The multi-axis absolute position mode supports T-type and S-type acceleration and deceleration planning.

-141-
AX series programmable controller programming manual INVT commands

3.2.18 AMC_MoveRelative_Invt
AMC_MoveRelative_Invt: multi-axis relative position control command.

(1) Command format

Command Name Expressed in diagram Expressed in ST


AMC_MoveRelative_Invt(
Axis1_Use:= ,
Axis2_Use:= ,
Axis3_Use:= ,
Axis4_Use:= ,
Enable:= ,
Multi-axis Position1:= ,
Position2:= ,
relative
AMC_Move Position3:= ,
position Position4:= ,
Relative_Invt Velocity:= ,
control Acceleration:= ,
command Deceleration:= ,
JerkTime:= ,
Done=> ,
Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 Input variable

Data Initial
Input variable Name Valid range Description
type value
Use flag of axis 1.
Use flag of
Axis1_Use BOOL TRUE, FALSE FALSE TRUE: Used
axis 1
FALSE: Not used
Use flag of axis 2.
Use flag of
Axis2_Use BOOL TRUE, FALSE FALSE TRUE: Used
axis 2
FALSE: Not used
Use flag of axis 3.
Use flag of
Axis3_Use BOOL TRUE, FALSE FALSE TRUE: Used
axis 3
FALSE: Not used
Use flag of axis 4.
Use flag of
Axis4_Use BOOL TRUE, FALSE FALSE TRUE: Used
axis 4
FALSE: Not used
Execution Function block enabling bit,
Enable BOOL TRUE, FALSE FALSE
condition triggered at the rising edge.
Distance of
Position1 LREAL Data range 0 Distance of axis 1
axis 1
Distance of
Position2 LREAL Data range 0 Distance of axis 2
axis 2
Distance of
Position3 LREAL Data range 0 Distance of axis 3
axis 3
Position4 Distance of LREAL Data range 0 Distance of axis 4

-142-
AX series programmable controller programming manual INVT commands

Data Initial
Input variable Name Valid range Description
type value
axis 4
Positive
Velocity Speed LREAL 500 Speed. Unit: mm/min
number or 0
Positive
Acceleration Acceleration LREAL 1800000 Acceleration. Unit: mm/min²
number or 0
JerkTime Jerk duration UINT 0–400 0 Jerk duration.

 Output variable

Data Initial
Output variable Name Valid range Description
type value
Completion flag.
Command
TRUE: The specified position is
Done execution BOOL TRUE, FALSE FALSE
reached. FALSE: The specified
completion
position is not reached.
TRUE: The function block is
being executed.
Busy Executing BOOL TRUE, FALSE FALSE
FALSE: The function block is not
executed.
Command
CommandAborted interruption BOOL TRUE, FALSE FALSE Interrupted.
flag
Axis error TRUE: An axis error occurs.
Error BOOL TRUE, FALSE FALSE
flag FALSE: No axis error occurs.
Default value: 0
ErrorID Error ID UINT - 0 Value > 100: Alarm ID.
Value < 100: Error ID.

(3) Function description

The multi-axis relative position mode supports simultaneous movement of four axes. The relative position is specified by
Position. You need to set the corresponding movement direction, speed, acceleration, and other information and make
Enable to start the function block by changing the value from FALSE to TRUE, and specify the axes to move from the
present positions to the relative positions.

The multi-axis relative position mode has the same principle as the single-axis relative position mode. The difference is
that the multi-axis relative position mode can control multiple axes to move to relative positions at the same time.

The multi-axis relative position mode supports T-type and S-type acceleration and deceleration planning.

-143-
AX series programmable controller programming manual INVT commands

3.2.19 AMC_ArcDel_Invt
AMC_ArcDel_Invt: planar arc interpolation command.

(1) Command format

Command Name Expressed in diagram Expressed in ST


AMC_ArcDel_Invt(
Axis1:= ,
Axis2:= ,
Enable:= ,
Start1:= ,
Start2:= ,
End1:= ,
End2:= ,
Plane arc DelCenterAxis1:= ,
DelCenterAxis2:= ,
AMC_ArcDel_Invt interpolation
Direction:= ,
command Velocity:= ,
Acceleration:= ,
Deceleration:= ,
JerkTime:= ,
Done=> ,
Busy=> ,
CommandAborted=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 Input variable

Data Initial
Input variable Name Valid range Description
type value
Used to specify the ID (0–3) and
Axis1 Axis 1 MC_AXIS - -
control settings of axis 1.
Used to specify the ID (0–3) and
Axis2 Axis 2 MC_AXIS - -
control settings of axis 2.
Execution Function block enabling bit,
Enable BOOL TRUE, FALSE
condition triggered at the rising edge.
Start position
Start1 LREAL Data range 0 Start position of axis 1
of axis 1
Start position
Start2 LREAL Data range 0 Start position of axis 2
of axis 2
End position of
End1 LREAL Data range 0 End position of axis 1
axis 1
End position of
End2 LREAL Data range 0 End position of axis 2
axis 2
Distance from
the start of axis Distance from the start of axis 1
DelCenterAxis1 LREAL Data range 0
1 to the circle to the circle center
center
Distance from Distance from the start of axis 2
DelCenterAxis2 LREAL Data range 0
the start of axis to the circle center

-144-
AX series programmable controller programming manual INVT commands

Data Initial
Input variable Name Valid range Description
type value
2 to the circle
center
Running TRUE: Clockwise
Direction BOOL TRUE, FALSE FALSE
direction FALSE: Counterclockwise
Positive
Velocity Speed LREAL 500 Speed. Unit: mm/min
number or 0
Positive
Acceleration Acceleration LREAL 1800000 Acceleration. Unit: mm/min²
number or 0
JerkTime Jerk duration UINT 0–400 0 Jerk duration.

 Output variable

Initial
Output variable Name Data type Valid range Description
value
Completion flag.
Command TRUE: The specified position is
Done execution BOOL TRUE, FALSE FALSE reached.
completion FALSE: The specified position is
not reached.
TRUE: The function block is
Busy Executing BOOL TRUE, FALSE FALSE being executed. FALSE: The
function block is not executed.
Command
TRUE: Interrupted.
CommandAborted interruption BOOL TRUE, FALSE FALSE
FALSE: Not interrupted.
flag
TRUE: An axis error occurs.
Error Axis error flag BOOL TRUE, FALSE FALSE
FALSE: No axis error occurs.
Default value: 0
ErrorID Error ID UINT - 0 Value > 100: Alarm ID.
Value < 100: Error ID.

(3) Function description

It is used for planar arc interpolation. It supports T-type and S-type acceleration and deceleration planning. JerkTime>0
corresponds to S-type acceleration and deceleration planning, while JerkTime=0 corresponds to T-type acceleration and
deceleration planning. It supports clockwise and counterclockwise running. Using this module needs to specify the start
and end positions and the distance from the start to the circle center. Only three planes XY/XZ/ZY are allowed to perform
circular interpolation, and errors are reported if additional axis arc interpolation is involved. The output returns the
function block execution status, whether an error occurs, and error information if any.

-145-
AX series programmable controller programming manual INVT commands

3.2.20 MC_SendData_Invt
MC_SendData: command of sending data to the underlayer.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_SendData_Invt_0(
Mode:= ,
Axis1Pulse=> ,
Axis2Pulse=> ,
MC_SendData Data sending Axis3Pulse=> ,
Axis4Pulse=> ,
_Invt command
Axis1Direction=> ,
Axis2Direction=> ,
Axis3Direction=> ,
Axis4Direction=> );

(2) Related variables

 Input variable

Initial
Input variable Name Data type Valid range Description
value
Execution TRUE: Pulse type
Mode BOOL TRUE, FALSE TRUE
condition FALSE: Bus type

 Output variable

Initial
Output variable Name Data type Valid range Description
value
Pulse
Axis1Pulse feedback of UINT - - Pulse feedback of axis 1
axis 1
Pulse
Axis2Pulse feedback of UINT - - Pulse feedback of axis 2
axis 2
Pulse
Axis3Pulse feedback of UINT - - Pulse feedback of axis 3
axis 3
Pulse
Axis4Pulse feedback of UINT - - Pulse feedback of axis 4
axis 4
Direction of axis 1.
Direction of
Axis1Direction BOOL TRUE, FALSE - TRUE: Forward
axis 1
FALSE: Reverse
Direction of axis 2.
Direction of
Axis2Direction BOOL TRUE, FALSE - TRUE: Forward
axis 2
FALSE: Reverse
Direction of axis 3.
Direction of
Axis3Direction BOOL TRUE, FALSE - TRUE: Forward
axis 3
FALSE: Reverse

-146-
AX series programmable controller programming manual INVT commands

Initial
Output variable Name Data type Valid range Description
value
Direction of axis 4.
Direction of
Axis4Direction BOOL TRUE, FALSE - TRUE: Forward
axis 4
FALSE: Reverse

(3) Function description

It is used to convert axis control data to pulse data and send it to the FPGA for processing. An application program can
invoke this function block only once since multiple invoking will cause position deviation.

3.2.21 MC_GetVersion_Invt
MC_GetVersion_Invt: command for obtaining the motion control library version.

(1) Command format

Command Name Expressed in diagram Expressed in ST


Command for
MC_Get obtaining the
MC_GetVersion_Invt(Version=> );
Version_Invt motion control
library version

(2) Related variables

 Output variable

Initial
Output variable Name Data type Valid range Description
value
Motion control - -
Motion control library version
Version library version STRING

(3) Function description

It is used to obtain the motion control library version. The output variable Version returns the version number.

3.2.22 MC_SetPosition_Invt
MC_SetPosition_Invt: axis position setting command.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_SetPosition_Invt(
Axis:= ,
Enable:= ,
Axis position
MC_SetPosition Position:= ,
setting Relative:= ,
_Invt Done=> ,
command Busy=> ,
Error=> ,
ErrorID=> );

(2) Related variables

 I/O variable

-147-
AX series programmable controller programming manual INVT commands

Initial
I/O variable Name Data type Valid range Description
value
Used to specify the axis ID (0–3)
Axis Axis MC_Axis
- - and axis control settings.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
Execution Function block enabling bit,
Enable BOOL TRUE, FALSE FALSE
condition triggered at the rising edge.
Positive
Position Position value LREAL 0 Position value
number or 0
Relative position
TRUE: Relative position
Relative flag of a logic BOOL TRUE, FALSE FALSE
FALSE: Absolute position
address

 Output variable

Output Initial
Name Data type Valid range Description
variable value
Done Completion flag BOOL TRUE, FALSE FALSE Completion flag.
TRUE: The function block is
being executed.
Busy Executing BOOL TRUE, FALSE FALSE
FALSE: The function block is not
executed.
TRUE: An axis error occurs.
Error Axis error flag BOOL TRUE, FALSE FALSE
FALSE: No axis error occurs.
Default value: 0
ErrorID Error ID UINT - 0 Value > 100: Alarm ID.
Value < 100: Error ID.

(3) Function description

It is used to set the axis actual position, which is determined by Axis, Position, and Relative.

3.2.23 MC_ReadParameter_Invt
MC_ReadParameter_Invt: axis parameter reading command.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_ReadParameter_Invt(
Axis Axis:= ,
Enable:= ,
MC_ReadPara parameter ParameterNumber:= ,
Valid=> ,
meter_Invt reading
Value=> ,
command Error=> ,
ErrorID=> );

(2) Related variables

-148-
AX series programmable controller programming manual INVT commands

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Used to specify the axis ID (0–3)
Axis Axis MC_Axis - -
and axis control settings.

 Input variable

Initial
Input variable Name Data type Valid range Description
value
Execution Function block enabling bit,
Enable BOOL TRUE, FALSE FALSE
condition triggered at the rising edge.
Parameter
ParameterNumber DINT - 100 Parameter number
number

 Output variable

Initial
Output variable Name Data type Valid range Description
value
Execution
Valid BOOL TRUE, FALSE FALSE Execution validity flag
validity flag
Parameter
Value LREAL - 0 Parameter return value
return value
Axis error flag.
Axis error
Error BOOL TRUE, FALSE FALSE TRUE: An axis error occurs.
flag
FALSE: No axis error occurs.
Error ID.
Default value: 0
ErrorID Error ID UINT - 0
Value > 100: alarm
Value <100: error

(3) Function description

It is used to read the parameters of a specified axis.

-149-
AX series programmable controller programming manual INVT commands

3.2.24 MC_ReadStatus_Invt
MC_ReadStatus_Invt: axis motion reading command.

(1) Command format

Command Name Expressed in diagram Expressed in ST


MC_ReadStatus_Invt(
Axis:= ,
Enable:= ,
Valid=> ,
Busy=> ,
Homeing=> ,
JogC=> ,
JogP=> ,
Axis motion
MC_ReadStatus MoveAbs=> ,
reading MoveRel=> ,
_Invt MoveVel=> ,
command Errorstop=> ,
StandStill=> ,
AMCAbs=> ,
AMCRel=> ,
AMCArc=> ,
Stoping=> ,
Limited=> ,
Disabled=> );

(2) Related variables

 I/O variable

Initial
I/O variable Name Data type Valid range Description
value
Used to specify the axis ID (0–3)
Axis Axis MC_Axis - -
and axis control settings.

 Input variable

Input Initial
Name Data type Valid range Description
variable value
Execution Function block enabling bit,
Enable BOOL TRUE, FALSE FALSE
condition triggered at high level.

 Output variable

Output Initial
Name Data type Valid range Description
variable value
Execution validity
Valid BOOL TRUE, FALSE FALSE
flag Execution validity flag
TRUE: The function block is
Busy Executing BOOL TRUE, FALSE FALSE being executed. FALSE: The
function block is not executed.
TRUE: In single-axis homing
Single-axis motion
Homeing BOOL TRUE, FALSE FALSE
homing status flag FALSE: No single-axis homing
motion
JogC Manual single-axis BOOL TRUE, FALSE FALSE TRUE: In manual single-axis

-150-
AX series programmable controller programming manual INVT commands

Output Initial
Name Data type Valid range Description
variable value
running flag continuous motion
FALSE: No manual single-axis
continuous motion
TRUE: In manual single-axis
Single-axis jogging
JogP BOOL TRUE, FALSE FALSE
jogging flag FALSE: No manual single-axis
jogging
TRUE: In single-axis absolute
Single-axis
position running
MoveAbs absolute position BOOL TRUE, FALSE FALSE
FALSE: No single-axis absolute
running flag
position running
TRUE: In single-axis relative
Single-axis
position running
MoveRel relative position BOOL TRUE, FALSE FALSE
FALSE: No single-axis relative
running flag
position running
TRUE: In the running at the
Flag of running at
single-axis speed
MoveVel the single-axis BOOL TRUE, FALSE FALSE
FALSE: No running at the
speed
single-axis speed
TRUE: Report an alarm and
Errorstop Alarm flag BOOL TRUE, FALSE FALSE stop.
FALSE: Do not report an alarm.
Flag of keeping TRUE: Keep standstill.
StandStill BOOL TRUE, FALSE FALSE
standstill FALSE: In running.
TRUE: In multi-axis absolute
Multi-axis absolute
position running
AMCAbs position running BOOL TRUE, FALSE FALSE
FLASE: No multi-axis absolute
flag
position running
TRUE: In multi-axis relative
Multi-axis relative
position running
AMCRel position running BOOL TRUE, FALSE FALSE
FLASE: No multi-axis relative
flag
position running
TRUE: In multi-axis arc
Multi-axis arc
interpolation running
AMCArc interpolation BOOL TRUE, FALSE FALSE
FLASE: No multi-axis arc
running flag
interpolation running
Flag of TRUE: Decelerate to stop.
Stoping decelerating to BOOL TRUE, FALSE FALSE FALSE: Do not decelerate to
stop stop.
TRUE: Being limited.
Limited Limit flag BOOL TRUE, FALSE FALSE
FALSE: Not limited.

-151-
AX series programmable controller programming manual INVT commands

Output Initial
Name Data type Valid range Description
variable value
(If limiting has occurred, the
value is reset to FALSE.)
E-cam running TRUE: In e-cam running
CAMIN BOOL TRUE, FALSE FALSE
flag FALSE: No e-cam running
TRUE: The axis is available.
Axis availability
Disabled BOOL TRUE, FALSE FALSE FALSE: The axis is not
flag
available.

(3) Function description

It is used to read the motion of a specified axis.

3.3 Enhanced commands


3.3.1 FB_ReinitDrv
FB_ReinitDrv: automatic reconnection command for servo disconnection.

(1) Command format

Command Name Expressed in diagram Expressed in ST


FB_ReinitDrv(
apAxis:= ,
pEtherCATMaster
SoftMotion:= ,
Automatic bEnable:= ,
bForceReinitETC
reconnection
:= ,
FB_ReinitDrv command for bForceReinitDrv
:= ,
servo bReinitSuccess=
disconnection > ,
iAxisCnt=> ,
bBusy=> ,
bError=> ,
iErrorID=> );

(2) Related variables

 I/O variable

Valid Initial
I/O variable Name Data type Description
range value
Axis pointer array,
ARRAY[1..16] supporting assignment of
Axis pointer OF POINTER up to 16 axis pointers. A
apAxis - NULL
array TO pointer without any value
AXIS_REF_SM3 assigned points to the
address 0 by default.
EtherCAT
POINTER TO EtherCAT master node
pEtherCATMasterSoftMotion master node - NULL
IODrvEtherCAT pointer
pointer

-152-
AX series programmable controller programming manual INVT commands

 Input variable

Valid Initial
Input variable Name Data type Description
range value
TRUE indicates executing
the function block, while
TRUE,
bEnable Enabling BOOL FALSE FALSE indicates not
FALSE
executing the function
block.
EtherCAT communication
is forcibly reset at the
Forcible rising edge. It is used to
EtherCAT TRUE, manually enable
bForceReinitEtherCAT BOOL FALSE
master node FALSE communication reset
reset when a function block
does not detect an axis
failure.

 Output variable

Valid Initial
Output variable Name Data type Description
range value
TRUE: Communication
reset success, and the
TRUE,
bReinitSuccess Reset success BOOL FALSE axis is operational.
FALSE
FALSE: Communication
reset failure.
Number of axes
iAxisCnt Axis count INT 1–16 0
connected.
TRUE indicates executing
the function block, while
Command TRUE,
bBusy BOOL FALSE FALSE indicates not
being executed FALSE
executing the function
block.
An error occurred when
TRUE,
bError Fault BOOL FALSE executing the function
FALSE
block.
iErrorID Error ID INT - 0 Error ID.

(3) Function description

It is an automatic reconnection command for servo disconnection. It is used to implement the real-time detection of the
servo communication status and the automatic reconnection after the communication is disconnected. After the
communication is successful, relevant information is returned and the servo alarm is cleared. The function block
supports the input of up to 16 axes.

-153-
AX series programmable controller programming manual INVT commands

3.3.2 FB_AxisEasyControl
FB_AxisEasyControl: single-axis easy control command.

(1) Command format

Command Name Expressed in diagram Expressed in ST


FB_AxisEasyControl(
axisEasyControl:= ,
bEnable:= ,
bPower:= ,
eHomeType:= ,
bHomeSignal:= ,
eRunMode:= ,
bRun:= ,
bReset:= ,
bReinit:= ,
Single- lrPositionOrDistance:= ,
FB_AxisEasy axis easy lrVelocity:= ,
lrAcceleration:= ,
Control control lrDeceleration:= ,
eDirection:= ,
command
lrJerk:= ,
bContinueJog:= ,
bJogFwd:= ,
bJogBwd:= ,
bStop:= ,
tTimeOut:= ,
bDone=> ,
bBusy=> ,
bError=> ,
eErrorID=> );

(2) Related variables

 I/O variable

Valid Initial
I/O variable Name Data type Description
range value
axisEasyControl Axis AXIS_REF_SM3 - - Reference to axis.

 Input variable

Valid Initial
Input variable Name Data type Description
range value
Enabling TRUE, It is set to TRUE to
bEnable BOOL FALSE
command FALSE execute the command.
TRUE, It is set to TRUE for
bPower Power on BOOL FALSE
FALSE power on.
Homing Data It is used to set the
eHomeType MoveCtrl_HomeType 0
method range homing method.
TRUE,
bHomeSignal Homing signal BOOL FALSE External homing signal.
FALSE
Data It is used to set the run
eRunMode Run mode MoveCtrl_Mode 0
range mode.
The running mode is
TRUE,
bRun Running BOOL FALSE triggered at the rising
FALSE
edge.

-154-
AX series programmable controller programming manual INVT commands

Valid Initial
Input variable Name Data type Description
range value
TRUE,
bReset Axis reset BOOL FALSE Axis reset
FALSE

Axis TRUE, It is set to TRUE to


bReinit BOOL FALSE
re-initialization FALSE re-initialize the axis.

Position or Data It is set to the distance or


lrPositionOrDistance LREAL 0
distance range position to move.
Data
lrVelocity Speed LREAL 0 Running speed.
range
Data
lrAcceleration Acceleration LREAL 0 Acceleration value.
range
Data
lrDeceleration Deceleration LREAL 0 Deceleration value.
range
Homing Data
eDirection MC_DIRECTION Homing initial direction
direction range
Slope change value of the
Data
lrJerk Jump LREAL 0 curve acceleration or
range
deceleration.
It is set to TRUE to
Continuous TRUE,
bContinueJog BOOL FALSE perform continuous
jogging FALSE
jogging.
Forward TRUE, It is set to TRUE to
bJogFwd BOOL FALSE
jogging FALSE perform forward jogging.
Reverse TRUE, It is set to TRUE to
bJogBwd BOOL FALSE
jogging FALSE perform reverse jogging.
TRUE, It is set to TRUE to stop
bStop Axis stop BOOL FALSE
FALSE the axis.
When the motion timeout
Data
tTimeOut Timeout time. TIME 30S time is exceeded, the axis
range
is stopped.

 Output variable

Valid Initial
Output variable Name Data type Description
range value
Command It is set to TRUE after the
TRUE,
bDone execution BOOL FALSE command is executed
FALSE
completion completely.
It is set to TRUE when the
Command TRUE,
bBusy BOOL FALSE command is being
being executed FALSE
executed.
bError Fault BOOL TRUE, FALSE It is set to TRUE when an

-155-
AX series programmable controller programming manual INVT commands

Valid Initial
Output variable Name Data type Description
range value
FALSE error occurs.
eErrorID Error ID SMC_ERROR - 0 Error ID.

(3) Function description

To quickly invoke and use single-axis motion control functions, the function block encapsulates the power-on function,
homing function, jogging function, relative motion, absolute motion, specific-speed running, stop, and reset functions of
the Codesys axis module. If you want to use single-axis motion control functions, you only need to invoke this function
block, improving application program development efficiency.

3.3.3 FB_Relative_INVT
FB_Relative_INVT: relative motion suspension command.

(1) Command format

Command Name Expressed in diagram Expressed in ST


FB_Relative_INVTt(
Axis:= ,
bExecute:= ,
bStopExe:= ,
Relative lrDistance:= ,
lrVelocity:= ,
motion lrAcceleration:= ,
FB_Relative_INVT
lrDeceleration:= ,
suspension
lrJerk:= ,
command bDone=> ,
bBusy=> ,
bCommandAborted=> ,
bError=> ,
eErrorID=> );

(2) Related variables

 I/O variable

Valid Initial
I/O variable Name Data type Description
range value
Axis Axis AXIS_REF_SM3 - - Motion axis

 Input variable

Valid Initial
Input variable Name Data type Description
range value
TRUE,
bExecute Enabling BOOL FALSE It is triggered at the rising edge.
FALSE
Set it to TRUE to suspend the
External TRUE,
bStopExe BOOL FALSE running and set it to FALSE to
suspension FALSE
resume the running.
Destination
position of Relative position data of the
lrDistance LREAL Data range 0
relative axis.
motion
lrVelocity Speed LREAL Positive 0 Max. speed at which the axis

-156-
AX series programmable controller programming manual INVT commands

Valid Initial
Input variable Name Data type Description
range value
number or runs to reach the destination
0 position.
Positive Acceleration when the speed
lrAcceleration Acceleration LREAL 0
number increases.
Positive Deceleration when the speed
lrDeceleration Deceleration LREAL 0
number reduces.
Positive Slope change value of the
lrJerk Jump LREAL number or 0 curve acceleration or
0 deceleration.

 Output variable

Valid Initial
Output variable Name Data type Description
range value
Command It is set to TRUE after the
TRUE,
bDone execution BOOL FALSE command is executed
FALSE
completion completely.
Command
TRUE, It is set to TRUE when the
bBusy being BOOL FALSE
FALSE command is being executed.
executed
Command TRUE, It is set to TRUE when the axis
bCommandAborted BOOL FALSE
interruption FALSE command is interrupted.
TRUE, It is set to TRUE when an error
bError Fault BOOL FALSE
FALSE occurs.
A non-zero value indicates that
eErrorID Error ID SMC_ERROR Data range 0
an exception occurs.

(3) Function description

The function block implements the relative motion function on the Codesys platform, which can be suspended. During
axis running, when bStopExe is set to TRUE, the running is suspended; when bStopExe is reset to FALSE again, the
axis moves to the position specified by lrDistance.

-157-

You might also like