Use the encoder axis

Adding a motion object to an existing project folder is explained in the section Create an axis object.
1. Select the Encoder Axis module to add at least one encoder axis to the motion configuration.
2. Alternatively, you can automatically add and link an encoder axis when scanning the I/O configuration using the project tree in Solution Explorer.

Option 1: Operation in simulation mode

If the encoder axis is to be operated exclusively in simulation mode - or even during operation - the following two parameters must be set:

3. In the Simulation Data Source parameter, select the object ID of the axis whose setpoint values are to be output as actual values for the encoder axis.
4. If necessary, create an additional simulation axis.

Option 2: Operation with hardware

If the encoder axis is to be used with hardware, it must be linked to the appropriate device in the I/O configuration. If the encoder axis has not yet been automatically linked in the tree view in Solution Explorer when scanning the I/O configuration, you can do so by following the steps in the section Link an axis object to hardware.

Add the encoder axis to the PLC program and link it

A PLC project has been created, and the Tc3_Mc3Ptp library has been added as a reference.
5. Insert an instance of the type ENCODER_AXIS_REF into your PLC program.

Example:

PROGRAM MAIN
VAR
    myEncoder : Tc3_Mc3Ptp.ENCODER_AXIS_REF;
END_VAR
6. Follow a similar procedure to that described in the Link a PLC to an axis object section to establish a link between the PLC and the motion object.
An encoder axis has been added to the motion node in the tree view and linked to the PLC.

Create a PLC program with an encoder axis

When using MC3 in the PLC, note that a distinction is made between a classic axis of the type AXIS_REF and an encoder axis of the type ENCODER_AXIS_REF. This makes it possible to determine in XAE, at compile time, whether a programmed function is supported (see also Overview: MC3 types). For example, motion commands (MC_MoveAbsolute, MC_Halt, …) and certain administrative commands (MC_Power) cannot be used with an encoder axis.

Use the encoder axis 1:

Use of unsupported function blocks

Programming unsupported function blocks results in error messages during compilation.