PLCopen programming

A complete list of G functions is contained in the overview of commands in the Appendix under PLCopen programming.

The scope of the Motion Control Platform (MCP) provides a number of function blocks (FB) for motion tasks. These FBs act on a single axis and are operated via the PLC. Each axis in the system is configured in the system as a so-called Single Axis Interpolator (SAI).

Alternatively these axes also can be addressed by the NC program because an SAI is always configured in the system as a conventional spindle. Special NC commands are therefore provided for the following FBs. These commands permit a PLCopen-conforming programming in NC syntax.




Axis motion to an absolute position


Relative axis motion to the commanded position


Relative axis motion to the current position


Relative axis motion to a motion already active


Endless axis motion at the specified velocity


Stopping an axis motion


Gear coupling with a gear ratio


Releasing a gear coupling


Phase offset of couplings


Measurement of axis positions

The topology below displays the basic arrangement of SAI (spindle) axes within the overall system:

An SAI axis is addressed in the NC program in spindle-specific programming syntax. It must therefore be configured in the NC channel by its address letters and other data analogous to the configuration of a spindle in the channel parameter list. The most important settings in the channel parameter list are:

For more information, see the documentation [1] Section: Configuring spindles- and the Section Parametrising spindles.

The PLCopen functions

require additional specific SAI characteristics of the (spindle) axis which are configured in the axis parameters. The required settings are contained in the documentation [2]-Section: SAI settings.

Each NC command of the corresponding FB is presented below. The syntax of these NC commands and the units of the programmed values are based on the corresponding input pins (VAR_INPUT) of the assigned FBs.

General syntax of an (SAI) NC command:

<spindle_name>[ <FB name> <Input_pin1> < Input_pin2> < Input_pin n...> { \ } ]

The axis name at the start of the NC command addresses the (SAI) spindle axis which is addressed by the NC channel.

The description of the input pins and the units and value ranges are also contained in the documentation [9].



All input pin values are programmed in metric units. In initial state the values must be specified in the specified internal units (e.g. 0.1 µm). The parameter P-CHAN-00182 can be changed to specify values in default units (e.g. mm).

The input pin "Execute" is always assigned implicitly by programming the NC command. This is why no specific keyword is provided for this pin.

The line separator '\' can be used within the [...] brackets to obtain a clear programming of the command over multiple lines.

The keywords "Id" and "WaitSyn" for job synchronisation in the NC program have no corresponding PINs in the PLC. The two keywords are available as of CNC Build V3.01.3100.01

By default PLCopen functions are executed irrespective of other NC program processing. There is no synchronisation between PLCopen single-axis jobs and path motion.

However, wait conditions can be defined to synchronise PLCopen functions with the program run. There are two options here:

  1. Synchronisation at block end:

Defining the “WaitSyn” keyword causes the CNC to wait for the completion of the PLCopen job before continuing to the next NC block. If several PLCopen jobs are programmed in the NC line, continuation only takes place when all the jobs specified for the “WaitSyn” keyword are completed.

<spindle_name>[ <FB name> [WaitSyn] <input_pin2> <input pin n...> { \ } ]

Programing Example


N10 G01 X100 F10000

N20 S[MC_MoveAbsolute WAIT_SYN POSITION=900000 …]

;Continue to block N30 when spindle S has reached ;Position 90°

N30 G01 X200 F100

  1. Late synchronisation

The “Id” keyword can be used to assign a job ID to a PLCopen job. The #WAIT MC_STATUS SYN [ID<JobNo>] command can wait for the end of the PLCopen job at a later time.

<spindle_name>[ <FB name> [Id<expr>] <input_pin2> <input pin n...> { \ } ]

#WAIT MC_STATUS SYN [ID<expr> {ID<expr>} …]

If several PLCopen jobs with identical job numbers are started, the job number is assigned to the last PLCopen function commanded. It is then possible that the job last started may be subject to later synchronisation at job end.

Programing Example


N10 G01 X100 F10000

N20 S[MC_MoveAbsolute Id100 POSITION=900000 …]

N30 G01 X200

N40 S2[MC_MoveVelocity Id200 Velocity=10000 …}

N50 G01 X300


;Continue to block N70 takes place when spindle S

;reaches position 90° and spindle S2 reaches the speed 10°/s

N70 G0 X0