You are on page 1of 79

Description

www.festo.com
Library for
Festo Motion_FHPP_3 library motor controllers with FHPP
(CODESYS V3.5 and TwinCat 3)

10.03.2020
Table of Contents
1 Important instructions................................................................................................................................... 1
1.1 Designated use ................................................................................................................................... 1
1.2 Safety instructions .............................................................................................................................. 2
1.3 Danger categories ............................................................................................................................... 2
1.4 Marking special information ............................................................................................................... 3

2 Overview ........................................................................................................................................................ 5
2.1 General Information ............................................................................................................................ 5
2.2 Requirements ..................................................................................................................................... 5
2.3 General information on Festo motor controllers .................................................................................. 6
2.4 Festo Handling and Positioning Profile (FHPP) .................................................................................... 7
2.4.1 FHPP+..................................................................................................................................... 8
2.5 FHPP Operating modes ....................................................................................................................... 8
2.6 Function blocks for Festo motor controllers ........................................................................................ 9
2.7 Basic program structure ...................................................................................................................... 9

3 FML_READ: Prepare the input data ............................................................................................................. 11


3.1 FML_Read: Functional description .................................................................................................... 11
3.2 FML_Read: Inputs and outputs ......................................................................................................... 12
3.3 FML_Read_CMXH: Functional description ......................................................................................... 14
3.4 FML_Read_CMXH: Inputs and outputs .............................................................................................. 14
3.5 The DT_FML_REF structure ............................................................................................................... 15
3.6 FML_Read: CANopen - Passing the input data .................................................................................. 16
3.7 FML_Read: IO-Link - Passing the input data ...................................................................................... 18
3.8 FML_Read: Modbus/TCP - Passing the input data ............................................................................. 20
3.8.1 Preparing a Modbus/TCP Slave ............................................................................................ 20
3.9 Working with FHPP+ input objects .................................................................................................... 23
3.9.1 Variable assignment to the FML_Read FB for FHPP+ ............................................................. 24
3.9.2 Access to the FHPP+ objects ................................................................................................. 25

4 FHPP_CTRL - Control function block ............................................................................................................ 27


4.1 FHPP_CTRL: Functional description ................................................................................................... 27
4.2 FHPP_CTRL: Inputs and Outputs ....................................................................................................... 28
4.3 FHPP_CTRL_CMXH: Functional description ....................................................................................... 32
4.4 FHPP_CTRL_CMXH: Inputs and Outputs ............................................................................................ 33

5 Parameterisation function blocks................................................................................................................ 37


5.1 Parameterisation function blocks: Overview ..................................................................................... 37
5.2 FPC_DIAG- Get actual error ............................................................................................................... 38
5.3 FPC_DIAG_BUFFER - read diagnostic memory ................................................................................... 39
5.4 FPC_DIRMP - Dynamic parameters for direct mode ........................................................................... 41
5.5 FPC_FILE - Transfer parameter sets ................................................................................................... 42
5.6 FPC_FILE_ARRAY - Transfer parameter sets ....................................................................................... 44
5.7 FPC_MULTI - Transfer multiple parameters ........................................................................................ 46
5.8 FPC_DATA_OBJECT - Object transfer .................................................................................................. 48
5.9 FPC_PNU - Transfer a single FHPP parameter .................................................................................... 49
5.10 Status and error messages of the parameter FBs .......................................................................... 50
5.10.1 The "DT_FML_Status" structure ......................................................................................... 50
5.10.2 Status Information ............................................................................................................. 50
5.10.3 Fault messages .................................................................................................................. 51

3
Printed Documentation

6 FML_Write: Prepare the output data ........................................................................................................... 53


6.1 FML_Write: Functional description .................................................................................................... 53
6.2 FML_Write: Inputs and outputs ......................................................................................................... 53
6.3 FML_Write_CMXH: Functional description ........................................................................................ 54
6.4 FML_Write_CMXH: Inputs and outputs ............................................................................................. 54
6.5 FML_Write: CANopen - passing the output data ................................................................................ 55
6.6 FML_Write: IO-Link -passing the output data .................................................................................... 56
6.7 FML_Write: Modbus/TCP - passing the output data ......................................................................... 57
6.8 Working with FHPP+ output objects .................................................................................................. 58
6.8.1 Variable assignment to the FML_Write FB for FHPP+ ............................................................ 59
6.8.2 Assigning values to the FHPP+ objects ................................................................................. 60

7 Visualising function blocks ......................................................................................................................... 61


7.1 Visualisation: Overview .................................................................................................................... 61
7.2 Visualising of a control function block............................................................................................... 62
7.2.1 Creation of a visualisation .................................................................................................... 63
7.2.2 Linking the visualisation....................................................................................................... 63
7.3 Visualising of a parameterisation function block............................................................................... 64
7.3.1 Creation of a visualisation .................................................................................................... 64
7.3.2 Linking the visualisation....................................................................................................... 65

8 Examples ..................................................................................................................................................... 67
8.1 Controlling a Festo motor controller .................................................................................................. 67
8.1.1 Basic program structure ....................................................................................................... 68
8.1.2 Prerequisites for ready status............................................................................................... 68
8.1.3 Establishing the ready state ................................................................................................. 68
8.1.4 Homing ................................................................................................................................ 68
8.1.5 Setting and operation of "Record selection" ........................................................................ 68
8.1.6 Setting and operation of "Direct mode position control" ..................................................... 69
8.1.7 Setting and operation of "Direct mode force / torque control" ............................................ 69
8.1.8 Setting and operation of "Direct mode speed control" ......................................................... 70
8.2 Parameterising a Festo motor controller ........................................................................................... 71
8.2.1 Basic program structure ....................................................................................................... 71
8.2.2 Prerequisites for communication .......................................................................................... 71
8.2.3 Reading parameters ............................................................................................................. 72
8.2.4 Writing parameters............................................................................................................... 72

9 Glossary ...................................................................................................................................................... 73

10 Index ................................................................................................................................................ 75

4
1 Important instructions
1.1 Designated use
The function blocks (FB) of the Festo Motion_FHPP_3 library are used to control and parameterise
o the CMMD-AS-C8-3A double motor controller,
o the CMMO-ST-C5-1-LKP motor controller,
o the CMMP-AS motor controller family,
o the CMMS-AS motor controller,
o the CMMS-ST motor controller,
o the CMXH-ST motor controller family,
o the SFC-DC motorcontroller family,
o the EMCA-EC motor unit,
o and the MTR-DCI motor unit.

The EMCA-EC motor unit is also called "motor controller" hereinafter.

You can use them to conveniently integrate the many functions of the device into your CODESYS control
program. Function blocks are integrated into the user program for each motor unit or motor controller (each axis)
and called cyclically using a separate instance. Simultaneous use of other function blocks for controlling the
same device is not permitted.
Read the "Safety instructions" and instructions on the designated use of the relevant devices, components and
modules. If additional commercially available components such as sensors and actuators are connected, the
specified limits for pressures, temperatures, electrical data, torques, etc. must not be exceeded.

Target group
This manual is intended exclusively for technicians trained in control and automation technology, who have
experience in installation, commissioning, programming and diagnostics of positioning systems and the relevant
fieldbuses.

Service
If you have a technical problem, please contact your local Festo service partner or use the respective contact
form at the following website.
www.festo.com/contact

1
Printed Documentation

1.2 Safety instructions


When commissioning and programming positioning systems, you must observe the safety regulations in the
manuals and operating instructions for the components used.
The user must make sure there is nobody within the positioning range of the connected actuators or axis
systems. Access to the possible danger area must be prevented by suitable measures such as barriers and
warning signs.

Warning
Pneumatic and electric axes can move with high force and at high speed. Collisions can lead to serious
injury to people and damage to components.
• Make sure that nobody can place their hand in the positioning range of the axes or other
connected actuators and that there are no objects in the positioning path while the system is
still connected to a power supply.

Warning
Parameterisation errors can cause injury to people and damage to property.
• Only enable the controller if the axis system has been installed and parameterised by
technically qualified staff.

1.3 Danger categories


This Help contains information on the possible dangers that can occur if the product is not used as designated.
This information is marked with a signal word (warning, caution, etc.), placed on a grey background and
additionally marked with a pictogram. A distinction is made between the following danger warnings:

Warning
... means that serious injury to people and damage to property can occur if this warning is not
observed.

Caution
... means that injury to people and damage to property can occur if this warning is not observed.

Note
... means that damage to property can occur if this warning is not observed.

You can find information on how special information is represented under "Marking special information".

2
Important instructions

1.4 Marking special information


Pictograms
The following pictograms mark passages in the text that contain special information.

Information: Recommendations, tips and references to other sources of information.

Text markings
1. Figures denote activities that must be carried out in the order specified.
• Bullets denote activities that may be carried out in any desired order.
o denote general listings.

Further conventions
[Project | New] Menu items are framed in square brackets, for example the [New] command in the [Project]
menu opens a new project.
"OK" The names of windows, dialogs and buttons, e.g. "Message window," "Dearchivate project,"
"OK" as well as designations are displayed in inverted commas.
CTRL Names of keys on the PC keyboard are represented in the text with uppercase letters
(e.g. ENTER KEY, CTRL, C, F1 etc.).
CTRL+C For some functions you need to press two keys simultaneously. For example, press and hold
down the CTRL key and also press the C key. This is written in the text as CTRL+C.
If "click" or "double-click" is mentioned, this always applies to the left-hand mouse button.
If the right-hand mouse button is to be used, this will be explicitly mentioned.

3
2 Overview
2.1 General Information
The "Festo_Motion_FHPP_3.library" is a library for CODESYS V3 provided by Festo. The following Festo motor
controllers can be controlled with this library:
oCMMD-AS-C8-3A double motor controller,
oCMMO-ST-C5-1-LKP motor controller,
oCMMP-AS motor controller family,
oCMMS-AS and CMMS-ST motor controller families,
oCMXH-ST motor controller family,
oSFC-DC motor controller family,
oEMCA-EC motor unit,
oMTR-DCI motor unit.
Communication takes place via the specific fieldbus communication protocol.
Actuation of the Festo motor controllers takes place via the Festo Handling and Positioning Profile (FHPP).
The library contains function blocks for controlling and parameterising the individual drives.
Refer to the documentation for the motor controller for further information on operating and configuring the
relevant motor controller type.

Architecture
Each motor controller is integrated into the CODESYS project using a controller-specific hardware configuration.
o All function blocks that access I/O data directly to control a motor controller requires a copy of the
input data and output data as transit variables.
o All function blocks that access I/O data directly to parameterise a motor controller requires a copy of
the input data and output data of the Festo Parameter Channel (FPC) as transit variables.

An instance of the function blocks for control must be generated for each motor controller instance.

Integrating the library


The Festo Motion_FHPP_3 library is located under "Library Manager" in CODESYS V3 provides by Festo.

• Use the "Add Library" command to integrate the library.


All elements from this library are assigned to the namespace "FML".

2.2 Requirements
During installation of CODESYS V3 provided by Festo, the supplied device files are installed
automatically and stored in the device repository
Device files that are not supplied can be installed via the standard CODESYS dialog "Device
Repository".

Please add the "Festo_Motion_FHPP_3.library" to the package "CODESYS provided by Festo" with the Library
manager tool.

For adding a CODESYS library to a project, you will find information in the general CODESYS help at
item "Library Manager".

5
Printed Documentation

2.3 General information on Festo motor controllers


The following sections contain information on the motion function blocks for Festo motor controllers. The
following additional manuals are required for a complete understanding:

Documentation on Festo motor controllers


Documentation Contents
Brief description and manuals at Festo Support Portal Brief description: Important instructions on
(see catalogue also) commissioning and preliminary information.
Manuals: Contents as described below.
Manuals P.BE-... Installation, commissioning and diagnosis of electric
axes with the respective Festo motor controller.
Help system for the Festo Configuration Tool Functional descriptions for the Festo Configuration
(contained in FCT software) Tool configuration software.
Help system for CODESYS V3 pbF library How to use the motion function blocks for Festo
"Festo_Motion_FHPP_3.library" (this Help) motor controllers.

Note
Always read the information and safety instructions contained in this documentation.

6
Overview

2.4 Festo Handling and Positioning Profile (FHPP)


Festo has developed an optimised data profile especially tailored to the target applications for handling and
positioning tasks, the "Festo Handling and Positioning Profile (FHPP)."
The FHPP enables uniform control and programming for the various fieldbus systems and controllers from Festo.
The FHPP defines the following for the user:
o Operating modes,
o I/O data structure,
o Parameter objects,
o Sequence control.

Figure: The FHPP principle

Control and status bytes


Control via the fieldbus takes place via 8 bits of I/O data. The triggering of control functions and the analysis of
status messages of the function block is mostly performed using single-bit operations.
The function block FHPP_CTRL for controlling a motor controller are described in an own chapter.

Parameter channel
The controller can access all parameter values of the controller by means of the parameter channel. A further 8
bytes of I/O data are used for this purpose.
The function blocks for parameter transfer are described in a separate chapter.

7
Printed Documentation

2.4.1 FHPP+
FHPP+ allows a cyclic exchange of parameters between the motor controller and the PLC. Therefore up to
additional 24 bytes are defined in the I/O section of the device.

FHPP is only supported by the motor controller families CMMP-AS and EMCA-EC!

The FHPP+ service allows:


o Transfer of up to 10 FHPP+ Objects from the motor controller to the PLC.
o Transfer of up to 10 FHPP+ Objects from the PLC to the motor controller.
Data preparation and access to the FHPP+ Objects is described at different pages:

• Working with FHPP+ input objects (from the motor controller)


• Working with FHPP+ output objects (to the motor controller)

2.5 FHPP Operating modes


Record selection
Saved positioning records can be processed in record selection mode. For this purpose, positioning records are
parameterised with the Festo Configuration Tool or taught via the control panel during commissioning.

Direct application
In direct application operating mode, the important data is transferred directly via the control bytes.
o Target positions and velocities can be ascertained and specified by the controller during runtime,
depending on the operating status.
o No limitations due to the number of saved positioning records.
In direct mode values can be taught/parameterised via the PLC.
The following direct mode types can be selected:
o Direct application - position mode
o Direct application -force/torque mode
o Direct application - velocity mode

8
Overview

2.6 Function blocks for Festo motor controllers


The names of the function blocks for Festo motor controllers start with the motor controller designation,
e.g. CMMO-ST This is followed by the designation of the function block, e.g. CTRL for a control function block.
The Festo Motion_FHPP_3 library contains the following function blocks (FB):
o A transfer FB "FML_Read" for preparing the incoming motor controller data for the control FB and the
parameter FBs,
o A control FB "FHPP_CTRL" for controlling the respective Festo motor controller,
o Some parameterisation FB "FPC_xxx" for transferring individual parameters from and to the respective
Festo motor controller,
o A transfer FB "FML_Write" for transferring the output data to the motor controller in the specific data
format.
Note
The CMXH-ST motor controller controls a 2-axis-system. Therefore, there are special control and
transfer FBs for this motor controller.
They are each explicitly documented.

The library namespace for the Festo Motion_FHPP_3 library is "FML". This prefix is used to have a
worldwide unique name for a specific function block.
The prefix is placed before the function block name, separated by a dot.

2.7 Basic program structure


A control program using the Festo FBs has the following basic structure:

1. Instance of FML_Read Preparing the incoming data from the motor controller
2. Instance of FHPP_CTRL Function block for control the motor controller
If required: Instances of FPC_xxx Some parameter FBs
3. Instance of FML_Write Prepare the outgoing data to the motor controller

More information is given in chapter "Examples".

9
3 FML_READ: Prepare the input data
3.1 FML_Read: Functional description
The function block FML_Read prepares the raw data from the motor controller and stores them in normalized
form in a data structure of type DT_FML_REF for the control FB and the parameters FBs.
o Normalising big / little endian fieldbus data.
o Normalising the special data format of Modbus/TCP.
Note
This FB must be called before the execution of the control and parameter FBs!

Figure: Function block FML_Read as shown in the library manager

11
Printed Documentation

3.2 FML_Read: Inputs and outputs


The following table shows the inputs and outputs of the function block.

Signal Name Scope Data Type Description


FML_REF VAR_IN_OUT DT_FML_REF This data structure holds all necessary data to
control and parameterise a motor controller.
DeviceType VAR_INPUT E_FML_DEVICE_TYPE Define the device type - see table below
Modbus VAR_INPUT BOOL Modbus/TCP using
= TRUE: Modbus/TCP is used, special data
preparing will be done
= FALSE: Another fieldbus is used
HighByteFirst VAR_INPUT BOOL Byte order "big / little endian" of the raw
fieldbus data
= TRUE: "Big Endian": High byte first
= FALSE: "Little Endian": Low byte first

FPC_active VAR_INPUT BOOL Use of the "Parameter Channel" for


parameterisation FBs additional to the control
data
= TRUE: The parameter channel is used.
Parameter data will be prepared additionally.
= FALSE: The parameter channel is not used,
only control data will be prepared.

FHPP_PLUS_active VAR_INPUT BOOL FHPP+ is used, parameters will be normalised.


PlcConfigFHPP_PLUS_IN VAR_INPUT UDINT PLC Configuration from the "FHPP+ Editor"
(1) page -Answer to PLC" folder of the related
motor controller in the FCT-project.
FHPP_Source VAR_INPUT ARRAY [0..7] OF Copy of the control input data (from motor
BYTE controller)
FPC_Source VAR_INPUT ARRAY [0..7] OF Copy of the parameter-input data (from motor
BYTE controller)
FHPP_PLUS_Source1 (1) VAR_INPUT ARRAY [0..7] OF Copy of the 1st. FHPP+ package
BYTE
FHPP_PLUS_Source2 (1) VAR_INPUT ARRAY [0..7] OF Copy of the 2nd. FHPP+ package
BYTE
FHPP_PLUS_Source3 (1) VAR_INPUT ARRAY [0..7] OF Copy of the 3th. FHPP+ package
BYTE
Error VAR_OUTPUT BOOL Status and error messages, see chapter
"Status and error messages"
= FALSE: No error detected
= TRUE: Error detected with more information
in Status
Status VAR_OUTPUT DT_FML_STATUS Status and error messages, see chapter
"Status and error messages".

Remark (1): If FHPP+ is used (FHPP_PLUS_active := TRUE) this values must be set See "Normalising of FHPP+
objects".

12
FML_READ: Prepare the input data

Device type for the input variable DeviceType


For the different device types (motor controllers) some properties have to be adjusted in the function blocks.
TYPE E_FML_DEVICE_TYPE :(
CMMO_ST := 10,
EMCA_EC := 20,
CMMP_AS := 30,
CMMS_AS := 40,
CMMS_ST := 50,
CMMD_AS := 60,
SFC_DC := 70,
MTR_DCI := 80,
CMXH_ST := 90 // For FML_Read_CMXH only
)INT;
END_TYPE

13
Printed Documentation

3.3 FML_Read_CMXH: Functional description


The function block FML_Read_CMXH prepares the raw data from the motor controller CMXH-ST and stores them
in normalized form in a data structure of type DT_FML_REF for the control FB and the parameters FBs.
o Normalising big / little endian fieldbus data.
o Normalising the special data format of Modbus/TCP.
Note
The FML_Read_CMXH function block supports the CMXH-ST motor controller only!

Note
This FB must be called before the execution of the control and parameter FBs!

Figure: FML_Read_CMXH Function block as shown in the library manager

3.4 FML_Read_CMXH: Inputs and outputs


The following table shows the inputs and outputs of the function block.

Signal Name Scope Data Type Description


FML_REF VAR_IN_OUT DT_FML_REF This data structure holds all necessary data to control
and parameterise a motor controller.
DeviceType VAR_INPUT E_FML_DEVICE_TYPE Define the device type - fix CMXH-ST here
Modbus VAR_INPUT BOOL Modbus/TCP using
= TRUE: Modbus/TCP is used, special data preparing
will be done
= FALSE: Another fieldbus is used
HighByteFirst VAR_INPUT BOOL Byte order "big / little endian" of the raw fieldbus data
= TRUE: "Big Endian": High byte first
= FALSE: "Little Endian": Low byte first

FPC_active VAR_INPUT BOOL Use of the "Parameter Channel" for parameterisation


FBs additional to the control data
= TRUE: The parameter channel is used. Parameter data
will be prepared additionally.
= FALSE: The parameter channel is not used, only control
data will be prepared.

FHPP_Source VAR_INPUT ARRAY [0..15] OF Copy of the control input data for 2 axis (from motor
BYTE controller)
FPC_Source VAR_INPUT ARRAY [0..7] OF BYTE Copy of the parameter-input data (from motor controller)
Error VAR_OUTPUT BOOL Status and error messages, see chapter "Status and
error messages"
= FALSE: No error detected
= TRUE: Error detected with more information in Status
Status VAR_OUTPUT DT_FML_STATUS Status and error messages, see chapter "Status and
error messages".

14
FML_READ: Prepare the input data

3.5 The DT_FML_REF structure


This data structure holds all necessary data to control and parameterise a motor controller.

Some components of this structure must be known and used by the customer, especially when
FHPP+ is used.

Component Data Type Description


FHPP DT_FHPP Structure for the management of the input and output variables
of the FHPP_CTRL FB.
FPC DT_FPC Structure for the management of the input and output variables
of the parameter FBs.
FHPP_PLUS DT_FHPP_PLUS Structure for the management of the input and output variables
of FHPP+ objects.
Modbus BOOL
HighByteFirst BOOL
Input variables from the related FB FML_Read instance.
FPC_active BOOL
DeviceType E_FML_DEVICE_TYPE
MemberID INT Consecutive number of the related motor controller. This
number is used to manage multiple access with parameter FBs
to the same device. the number will be automatically assigned.
MemberIDmax INT Next free number for a further prepared motor controller.
Done BOOL
Err BOOL
PNU INT
Subindex DINT Data block for FPC access to the motor controller. The
components are typically copies of the input variables from a
Value DINT parameter FB or it is calculated internally.
ReqID E_FML_FPC_REQ_ID
FPCC_Packet DT_FML_FPC_FILE_TRANSFER
FPCC_Modus DINT
ActPNU INT
ActSubindex DINT
ActValue DINT Data block with answer data from the motor controller.
Typically they are copied to the output variables of a parameter
RespID E_FML_FPC_RESP_ID FB.
FPCS_Packet DT_FML_FPC_FILE_TRANSFER
FPCS_Modus DINT

15
Printed Documentation

3.6 FML_Read: CANopen - Passing the input data


To prepare the input data from the motor controller, the respective I / O data must be passed to the function
block FML_Read.
The following figures show an example of the device configuration with a CANopen master.

Figure: Device configuration example with a CMMP-AS as a CANopen slave

Figure: CANopen I/O mapping with control array FHPP_IN and parameter array FPC_IN

16
FML_READ: Prepare the input data

The following figure shows the data passing to the FML_Read function block:

Figure: Passing the data to the FML_Read function block (FUP editor)

Passing the data with the ST editor


fbReadData(FML_REF := struCAN,
Modbus := FALSE,
HighByteFirst := FALSE,
DeviceType := CMMP_AS,
FPC_active := TRUE,
PlcConfigFHPP_PLUS_IN := 44224,
FHPP_Source := FHPP_IN,
FPC_Source := FPC_IN
FHPP_PLUS_Source1 := FHPP_PLUS_1
FHPP_PLUS_Source2 := FHPP_PLUS_2);

The raw fieldbus data need special attention to the specific byte / word arrangement.
Typical values for CANopen are (for Festo controllers CECC and CPX-CEC):
o Modbus := FALSE;
o HighByteFirst := FALSE;

17
Printed Documentation

3.7 FML_Read: IO-Link - Passing the input data


To prepare the input data from the motor controller, the respective I / O data must be passed to the function
block FML_Read.

Note
The master must be implemented according to the IO-Link specification 1.1! A matching IODD device
description file can be found in the Festo Support Portal.

The following figures show an example of the device configuration with an IO-Link master.

Figure: Device configuration example with one used IO-Link port

Figure: IO-Link I/O mapping with control array FHPP_IN and parameter array FPC_IN

18
FML_READ: Prepare the input data

The following figure shows the data passing to the FML_Read function block:

Figure: Passing the data to the FML_Read function block (FUP editor)

Passing the data with the ST editor


fbReadData(FML_REF := struIOLink,
Modbus := FALSE,
HighByteFirst := FALSE,
DeviceType := CMMO_ST,
FPC_active := TRUE,
PlcConfigFHPP_PLUS_IN := 0,
FHPP_Source := FHPP_IN,
FPC_Source := FPC_IN);

The raw fieldbus data need special attention to the specific byte / word arrangement.
Typical values for IO-Link are (for Festo controllers CECC and CPX-CEC):
o Modbus := FALSE;
o HighByteFirst := FALSE;

19
Printed Documentation

3.8 FML_Read: Modbus/TCP - Passing the input data


To prepare the input data from the motor controller, the respective I / O data must be passed to the function
block FML_Read.

Note
Not all devices support Modbus / TCP. The operating instructions of the motor controller must be
checked before use.

The following figures show an example of the device configuration with a Modbus/TCP Master.

Figure: Device configuration example with a Modbus/TCP Slave

3.8.1 Preparing a Modbus/TCP Slave

For CMMO-ST and CMMP-AS as of firmware 4.0.1501.2.3:

Necessary actions:

1. Activating the "Modbus Slave-channel" folder


2. Open the "ModbusChannel" window with the "Add Channel..." button
3. Assigning a name (optional)
4. Selection of Access Type "Read/Write Multiple Registers (Function code 23)"
5. Adjust the Offset (0x0000)
6. Defining the Length:
• For "FHPP Standard": 4 (Words)
• For "FHPP Standard + FPC: 8 (Words)
• For CMMP-AS with additional FHPP+: A valid value (12 or 16)
7. Closing the window with the "OK" button

20
FML_READ: Prepare the input data

For CMMP-AS (before Firmware 4.0.1501.2.3):

1. Activating the "Modbus Slave-channel" folder


2. Open the "ModbusChannel" window with the "Add Channel..." button
3. Assigning a name (e.g. "Input")
4. Selection of Access Type "Read Holding Registers ("Function code 3)"
5. Adjust the Offset (0x0000)
6. Defining the Length:
• For "FHPP Standard": 4 (Words)
• For "FHPP Standard + FPC: 8 (Words)
• For additional FHPP+: A valid value (12 or 16)
7. Closing the window with the "OK" button
8. Step 2 ...6 must be repeated for the output data with:
• Access Type "Write Multiple Registers (Function code 16)"
• A different name (e.g. "Output")
• The same Length as above

Figure: Modbus/TCP I/O mapping with control array FHPP_IN and parameter array FPC_IN

21
Printed Documentation

The following figure shows the data passing to the FML_Read function block:

Figure: Passing the data to the FML_Read function block (FUP editor)

Passing the data with the ST editor


fbReadData(FML_REF := struMB,
Modbus := TRUE,
HighByteFirst := TRUE,
DeviceType := CMMO_ST,
FPC_active := TRUE,
PlcConfigFHPP_PLUS_IN := 0,
FHPP_Source := FHPP_IN,
FPC_Source := FPC_IN);

The raw fieldbus data need special attention to the specific byte / word arrangement.
Typical values for Modbus/TCP are (for Festo controllers CECC and CPX-CEC):
o Modbus := TRUE;
o HighByteFirst := TRUE;

22
FML_READ: Prepare the input data

3.9 Working with FHPP+ input objects


With some motor controllers up to 10 FHPP objects can be transferred cyclically to the PLC (and vice versa).

Note
Not all devices support FHPP+. The operating instructions of the motor controller must be checked
before use.

Each object has up to 4 byte (32 bit) width and must be adapted to the fieldbus transfer specialities:
o Big- or little endian for objects with 2 or 4 byte width.
o The Modbus/TCP special word alignment.

The FML_Read function block normalises the FHPP+ objects transferred from the motor controller to
the PLC.

The transferred FHPP+ objects are described with the PlcConfigFHPP_PLUS_IN variable. Each digit represents the
width of an FHPP+ object.
o 1 stands for an object with 8 bit width,
o 2 stands for an object with 16 bit width,
o 4 stands for an object with 32 bit width.
All other digits are not used!
Up to 10 FHPP+ objects with different sizes may be transferred. The objects are arranged in 8-byte packages. Up
to 3 FHPP+ packages are possible.
The access to the FHPP+ objects is described below.

Example from an FPC project with 3 FHPP+ objects

In the example "Control Data" and "Parameter Channel" are used, therefore 16 byte are available for FHPP+. The
FHPP+ objects size is given right of "PLC Configuration".
The "PLC Configuration" must be assigned to PlcConfigFHPP_PLUS_IN := 44224.
The meaning of the digits from left to right:
o 4 = 32 bit object (FHPP+ object 1)
o 4 = 32 bit object (FHPP+ object 2)
o 2 = 16 bit object (FHPP+ object 3)
o 2 = 16 bit place holder
o 4 = 32 bit place holder
Therefore 2 FHPP+ packets are used.

23
Printed Documentation

3.9.1 Variable assignment to the FML_Read FB for FHPP+


Rules for the input variables:
o The PLC Configuration is given to PlcConfigFHPP_PLUS_IN as an DINT value.
o For each used FHPP+ package a pointer to the input data array must be given.
o FHPP_PLUS_Source1 for the 1st packet (this is always present when FHPP+ is used.
o FHPP_PLUS_Source2 is needed when 2 FHPP+ packages are used.
o FHPP_PLUS_Source3 may be used, if the "Parameter channel" is not used. Then 3 FHPP+ packages are
possible.

Figure: CANopen I/O Configuration with 2 FHPP+ packages

24
FML_READ: Prepare the input data

The assignment to the FML_Read input variables is shown in the following figure:

Figure: Assignment of the input variables to the FML_Read type function block in a FDB-type POU

Assignment of the input variables in a ST-type POU


fbReadData( FML_REF := struCAN,
DeviceType := EMCA_EC,
Modbus := FALSE,
HighByteFirst := FALSE,
FPC_active := TRUE,
PlcConfigFHPP_PLUS_IN := 44224;
FHPP_Source := FHPP_IN,
FPC_Source := FPC_IN
FHPP_PLUS_Source1 := FHPP_PLUS_1
FHPP_PLUS_Source2 := FHPP_PLUS_2);

3.9.2 Access to the FHPP+ objects


The FHPP+ objects are prepared and stored into a structure with 10 variables of DINT type.

The reading access is done with a <DT_FML_REF>.FHPP_PLUS.IN.Object<x> instruction part.


with <DT_FML_REF> = Instance of the structure DT_FML_REF,
and <x> = object number 1..10

Example code in ST:


LocInput := struCAN.FHPP_PLUS.IN.Object1; // Local inputs of the drive
PosiRise := struCAN.FHPP_PLUS.IN.Object2; // Position at rising edge

25
4 FHPP_CTRL - Control function block
4.1 FHPP_CTRL: Functional description
The FHPP_CTRL function block is used to control a Festo motor controller. The input and output variables resides
in the DT_FML_REF structure.

Note
The associated FML_Read instance must be called before a call to the FHPP_CTRL instance, because
FML_Read prepares the input data from the motor controller.
After the FHPP_CTRL execution the associated FML_Write instance must be called to prepare the
output data for the motor controller in the correct format for fieldbus transfer.

Figure: FHPP_CTRL function block as seen in the library manager

For the FHPP_CTRL function block a special visualisation VIS_FHPP_CTRL is present.


The example in chapter "Visualising a control function block" shows a simple application.

27
Printed Documentation

4.2 FHPP_CTRL: Inputs and Outputs


The following table contains a list of all inputs and outputs that the function block has to control a motor
controller.

InOut Variables - VAR_IN_OUT


Signal
Data Type Description
name
This data structure holds all necessary data to control and parameterise a motor
FML_REF DT_FML_REF
controller.

Input Variables - VAR_IN

Signal Name Data Type Description


EnableDrive BOOL Enable drive
= TRUE: Enable the drive
= FALSE: Disable the drive
Stop BOOL Stop
= TRUE: Enable operation
= FALSE: Stop active (cancel emergency ramp + positioning
task). The drive stops with maximum braking ramp, the
positioning task is reset.
Brake BOOL Release brake
= TRUE: Release brake
= FALSE: Activate brake
Note: Release of the brake is only possible with a disabled
controller. An enabled controller has the full control of the
brake.
ResetFault BOOL Acknowledge fault
With a rising edge a fault is acknowledged and the fault
value is deleted.
If the fault stays further after the acknowledge, at first the
error source must be eliminated.
HMIAccessLocked BOOL Software access blocked
Control of access to the local (integrated) diagnostic
interface of the controller.
= TRUE: The FCT software will only monitor the controller,
active control of the device is not possible by the software.
= FALSE: The FCT software can assume control of the device.
For CMMO-ST and EMCA-EC device types: The integrated
WEB server has the same behaviour than FCT.
OPM INT FHPP operating mode
= 0: Record selection
= 1: Direct application - position mode
= 5: Direct application - force / torque mode
= 9: Direct application - velocity mode
Halt BOOL Halt
= TRUE: Halt is not active
= FALSE: Halt activated (does not cancel emergency ramp +
positioning task). The axis stops with a defined braking
ramp, the positioning task remains active (the remaining
path can be deleted with "ClearRemainingPosition").
StartTask BOOL Start positioning task
With a rising edge the current nominal values are transferred
and the action selected by OPM will be started.
StartHoming BOOL Start homing
A rising edge homing will start a homing run with the
configured parameters.

28
FHPP_CTRL - Control function block

Signal Name Data Type Description


JoggingPos BOOL Jogging positive
The drive moves with the specified velocity in the direction of
larger actual values, as long as the bit is set. The movement
begins with the rising edge and ends with the falling edge.
JoggingNeg BOOL Jogging negative
The drive moves with the specified velocity in the direction of
smaller actual values, see JoggingPos.
TeachActualValue BOOL Teach value
With a falling edge the current actual position value is
transferred to the nominal value register of the currently
addressed record.
ClearRemainingPosition BOOL Delete remaining path
In the "Halt" status, a rising edge causes the positioning
task to be deleted and transfer to the "Ready" status.
Relative BOOL Absolute/relative
= FALSE: Nominal value is absolute
= TRUE: Nominal value is relative to the last nominal value
DeactivateStrokeLimit BOOL Deactivating the stoke limit control
= FALSE: Stroke limit monitoring active
= TRUE: Stroke limit monitoring not active
RecordNo INT Record number (record selection only)
SetValueVelocity BYTE Velocity setpoint as a % of the reference value (limited to
100%)
• Direct application - positioning mode: Target
velocity
• Direct application - force/torque mode for CMMO-ST
or EMCA-EC: velocity limit
SetValuePosition DINT Position setpoint in the positioning unit
(Only for direct application - positioning mode)
SetValueForceRamp BYTE Force /torque ramp setpoint as a % of the reference
value (limited to 100%)
(Only for direct application - force/torque mode)
SetValueForce DINT Force / torque setpoint as a % of the reference value
(Only for direct application - force/torque mode)
SetValueRotRamp BYTE Velocity ramp setpoint as a % of the reference value (limited
to 100%)
(Only for direct application - velocity mode)
SetValueRotSpeed DINT Velocity setpoint in velocity unit
(Only for direct application - velocity mode)
ExecuteFunction (1) BOOL CMMP-AS only: Activating the cam disc function
= TRUE: Cam disc function active
= FALSE: Cam disc function inactive
SetFunctionNumber (1) INT Cam disc function number:
1 =Synchronisation on external input
2 =Synchronisation on external input with cam disc function
3 =Synchronisation on virtual master with cam disc function
SetFunctionGroup (1) INT Cam disc function group:
0: Only valid value

Remark (1): This input variables are working only with the CMMP-AS family.

29
Printed Documentation

Output Variables - VAR_OUT


Signal Name Data Type Description
OPMString STRING(80) Feedback of the selected FHPP operating mode + control
mode
Record selection = 'Record Mode selected'
Direct application - position mode = 'Directmode
Positioncontrol selected'
Direct application - force/torque mode = 'Directmode
Forcecontrol selected'
Direct application - velocity mode = 'Directmode
Velocitycontrol selected'
StateOPMString STRING(80) Feedback of active FHPP operating mode + control mode
Record selection = 'Record Mode active'
Direct application - position mode = 'Directmode
Positioncontrol active
Direct application -force/torque mode = 'Directmode
Forcecontrol active'
Direct application -velocity mode = 'Directmode
Velocitycontrol active'
DriveEnabled BOOL Controller enabled
= FALSE: Drive disabled, controller not active
= TRUE: Drive (controller) enabled
Ready BOOL Operation enabled
= FALSE: Stop active
= TRUE: Operation enabled
Warning BOOL Warning
= FALSE: No warning present
= TRUE: Warning present
Fault BOOL Fault
= FALSE: No fault
= TRUE: Fault present or fault reaction active. Fault code in
diagnostic memory.
SupplyVoltagePresent BOOL Load voltage present
= FALSE: No load voltage
= TRUE: Load voltage present
ControlFCT_HMI BOOL Software device control
= FALSE: Device control free (e.g. PLC/fieldbus)
= TRUE: Device control by software (PLC control is locked)
StateOPM INT Feedback of FHPP operating mode + control mode
= 0: Record selection
= 1: direct application - position mode
= 5: direct application - force/torque mode
= 9: direct application - velocity mode
HaltActive BOOL Halt
= FALSE: Halt is active
= TRUE: Halt is not active, axis can be moved
AckStart BOOL Acknowledge start
= FALSE: Ready for start signal
= TRUE: Start carried out. Reset the start signal at this time.
MC BOOL Motion Complete
= FALSE: Positioning task active
= TRUE: Positioning task completed, possibly with fault
Note: MC is set after device is switched on (status "Drive
blocked").
AckTeach BOOL Acknowledge teach
= FALSE: Ready for teaching
= TRUE: Teaching carried out, actual value has been
transferred

30
FHPP_CTRL - Control function block

Signal Name Data Type Description


DriveIsMoving BOOL Axis is moving
= FALSE: Velocity of axis < limit
= TRUE: Velocity of axis >= limit
FollowingError BOOL Following error
= FALSE: No following error
= TRUE: Following error active
StandstillControl BOOL Standstill monitoring
= FALSE: After MC axis remains in tolerance window
= TRUE: After MC axis exits tolerance window
HomingValid BOOL Drive has a valid homing position
= FALSE: A homing run must be carried out
= TRUE: Homing information is valid
VelocityLimitReached BOOL Velocity limit reached (only with torque control)
= TRUE: Velocity limit reached
= FALSE: Velocity limit not reached
StrokeLimitReached BOOL Stroke limit reached
= FALSE: Normal behaviour: Stroke limit not reached
= TRUE: Stroke limit has reached
RC1 BOOL First record continuation carried out
= FALSE: A continuation condition was not configured or not
satisfied
= TRUE: The first continuation condition was satisfied
RCC BOOL Record continuation completed - valid as soon as MC is
available.
= FALSE: Record sequencing aborted. At least one
continuation condition was not satisfied
= TRUE: Record sequence was processed until the end.
ActualRecordNo INT Record number (Record selection only)
ActualPosition DINT Actual position
(Only for direct application - position mode)
ActualVelocity DINT Actual velocity as a % of the reference value
(Only for direct application - position mode)
ActualForce DINT Actual force / torque as a % of the reference value
(Only for direct application - force/torque mode)
ActualRotRamp DINT Actual Velocity ramp as a % of the reference value
(Only for direct application - velocity mode)
ActualRotSpeed DINT Actual velocity
(Only for direct application - velocity mode)

31
Printed Documentation

4.3 FHPP_CTRL_CMXH: Functional description


The FHPP_CTRL_CMXH function block is used to control the CMXH-ST motor controller. The input and output
variables resides in the DT_FML_REF structure.

Note
The associated FML_Read_CMXH instance must be called before a call to the FHPP_CTRL_CMXH
instance, because FML_Read_CMXH prepares the input data from the motor controller.
After the FHPP_CTRL_CMXH execution the associated FML_Write_CMXH instance must be called to
prepare the output data for the motor controller in the correct format for fieldbus transfer.

Note
The FHPP_CTRL_CMXH function block supports the CMXH-ST motor controller only!

Figure: FHPP_CTRL_CMXH function block as seen in the library manager

For the FHPP_CTRL_CMXH function block a special visualisation VIS_FHPP_CTRL_CMXH is present.


The example in chapter "Visualising a control function block" shows a simple application.

32
FHPP_CTRL - Control function block

4.4 FHPP_CTRL_CMXH: Inputs and Outputs


The following table contains a list of all inputs and outputs that the FHPP_CTRL_CMXH function block has to
control the CMXH-ST motor controller.

InOut Variables - VAR_IN_OUT


Signal
Data Type Description
name
This data structure holds all necessary data to control and parameterise a motor
FML_REF DT_FML_REF controller.

Input Variables - VAR_IN

Signal Name Data Type Description


EnableDrive BOOL Enable drive
= TRUE: Enable the drive
= FALSE: Disable the drive
Stop BOOL Stop
= TRUE: Enable operation
= FALSE: Stop active (cancel emergency ramp + positioning
task). The drive stops with maximum braking ramp, the
positioning task is reset.
Brake BOOL Release brake
= TRUE: Release brake
= FALSE: Activate brake
Note: Release of the brake is only possible with a disabled
controller. An enabled controller has the full control of the
brake.
ResetFault BOOL Acknowledge fault
With a rising edge a fault is acknowledged and the fault value
is deleted.
If the fault stays further after the acknowledge, at first the
error source must be eliminated.
HMIAccessLocked BOOL Software access blocked
Control of access to the local (integrated) diagnostic interface
of the controller.
= TRUE: The FCT software will only monitor the controller,
active control of the device is not possible by the software.
= FALSE: The FCT software can assume control of the device.
OPM INT FHPP operating mode
= 0: Record selection
= 1: Direct application - position mode
StartTask BOOL Start positioning task
With a rising edge the current nominal values are transferred
and the action selected by OPM will be started.
StartHoming BOOL Start homing
A rising edge homing will start a homing run with the
configured parameters.
JoggingPosX BOOL Jogging positive for the X axis or the Y axis
JoggingPosY BOOL The axis moves with the specified velocity in the direction of
larger actual values, as long as the bit is set. The movement
begins with the rising edge and ends with the falling edge.
JoggingNegX BOOL Jogging negative for the X axis or the Y axis
JoggingNegY BOOL The axis moves with the specified velocity in the direction of
smaller actual values, see JoggingPosX/Y.

33
Printed Documentation

Signal Name Data Type Description


Relative BOOL Absolute/relative
= FALSE: Nominal value is absolute
= TRUE: Nominal value is relative to the last nominal value
RecordNo INT Record number (record selection only)
SetValueVelocity BYTE Velocity setpoint as a % of the reference value (limited to
100%)
• Direct application - positioning mode: Target
velocity
• Direct application - force/torque mode for CMMO-ST
or EMCA-EC: velocity limit
SetValuePositionX DINT Position setpoint in the positioning unit for the X axis or the Y
axis
SetValuePositionY DINT
(Only for direct application - positioning mode)

Output Variables - VAR_OUT


Signal Name Data Type Description
OPMString STRING(80) Feedback of the selected FHPP operating mode + control
mode
Record selection = 'Record Mode selected'
Direct application - position mode = 'Directmode
Positioncontrol selected'
StateOPMString STRING(80) Feedback of active FHPP operating mode + control mode
Record selection = 'Record Mode active'
Direct application - position mode = 'Directmode
Positioncontrol active
DriveEnabled BOOL Controller enabled
= FALSE: Drive disabled, controller not active
= TRUE: Drive (controller) enabled
Ready BOOL Operation enabled
= FALSE: Stop active
= TRUE: Operation enabled
Warning BOOL Warning
= FALSE: No warning present
= TRUE: Warning present
Fault BOOL Fault
= FALSE: No fault
= TRUE: Fault present or fault reaction active. Fault code in
diagnostic memory.
SupplyVoltagePresent BOOL Load voltage present
= FALSE: No load voltage
= TRUE: Load voltage present
ControlFCT_HMI BOOL Software device control
= FALSE: Device control free (e.g. PLC/fieldbus)
= TRUE: Device control by software (PLC control is locked)
StateOPM INT Feedback of FHPP operating mode + control mode
= 0: Record selection
= 1: direct application - position mode
AckStart BOOL Acknowledge start
= FALSE: Ready for start signal
= TRUE: Start carried out. Reset the start signal at this time.

34
FHPP_CTRL - Control function block

Signal Name Data Type Description


MC BOOL Motion Complete
= FALSE: Positioning task active
= TRUE: Positioning task completed, possibly with fault
Note: MC is set after device is switched on (status "Drive
blocked").
DriveIsMoving BOOL Axis is moving
= FALSE: Velocity of axis < limit
= TRUE: Velocity of axis >= limit
FollowingError BOOL Following error
= FALSE: No following error
= TRUE: Following error active
StandstillControl BOOL Standstill monitoring
= FALSE: After MC axis remains in tolerance window
= TRUE: After MC axis exits tolerance window
HomingValid BOOL Drive has a valid homing position
= FALSE: A homing run must be carried out
= TRUE: Homing information is valid
IsRelative BOOL Absolute/relative
= FALSE: Actual values are absolute
= TRUE: Actual values are relative to the last nominal values
ActualRecordNo INT Record number (Record selection only)
ActualPositionX DINT Actual position of the X axis or the Y axis
ActualPositionY DINT (Only for direct application - position mode)

ActualVelocity DINT Actual velocity as a % of the reference value


(Only for direct application - position mode)

35
5 Parameterisation function blocks
5.1 Parameterisation function blocks: Overview
The table shows the existing parameterisation FBs with the motor controllers that they support.

FB Name CMMD-AS CMMO-ST CMMP-AS CMMS-AS CMMS-ST EMCA-EC CMXH-ST


FPC_DATA_OBJECT X - X X X - -
FPC_DIAG X X X X X X X
FPC_DIAG_BUFFER X X X X X X X
FPC_DIPMP X X X X X X X
FPC_FILE - (X) - - - (X) -
FPC_FILE_ARRAY - X - - - X -
FPC_MULTI X X X X X X X
FPC_PNU X X X X X X X

X = The motor controller supports the function block with CODESYS 3.5 and TwinCAT 3.
(X) = the function block is only present in the CODESYS 3.5 library (not in the TwinCAT 3 version).
- = The function block is not usable with this motor controller.

Note
The associated FML_Read(1) instance must be called before a call to the FPC_xxx instance, because
FML_Read prepares the input data from the motor controller. The FPC_active input of this FB must be
set to TRUE.
After the FPC_xxx execution the associated FML_Write(1) instance must be called to prepare the
output data for the motor controller in the correct format for fieldbus transfer.
Remark (1): The special modules FML_Read_CMXH and FML_Write_CMXH must be used for the CMXH-
ST motor controller!

For all FPC_xxx function block a special visualisation VIS_FPC_XXX is present.


The example in chapter "Visualising a parameterisation function block" shows a simple application.

37
Printed Documentation

5.2 FPC_DIAG- Get actual error


The FPC_DIAG function block reads an active error from the motor controller.

Figure: FPC_DIAG function block as seen in the library manager

Inputs and outputs


Signal Name Scope Data Type Description
FML_REF VAR_IN_OUT DT_FML_REF This data structure holds all necessary data to
control and parameterise a motor controller.
Execute VAR_INPUT BOOL Starts the transfer with a rising edge (FALSE ->
TRUE)
The most recent diagnostic value will be read.
Done VAR_OUTPUT BOOL Transfer status
= FALSE: Transfer is active (or not started yet)
= TRUE: Transfer has finished

Error VAR_OUTPUT BOOL Status and error messages, see chapter "Status
and error messages"
= FALSE: No error detected
= TRUE: Error detected with more information in
Status

Status VAR_OUTPUT DT_FML_STATUS Status and error messages, see chapter "Status
and error messages".
MessageNumber VAR_OUTPUT INT Received message number.
If MessageNumber = 0, no error is present.
MessageDescription VAR_OUTPUT STRING Related error description ("--" if no error)

38
Parameterisation function blocks

5.3 FPC_DIAG_BUFFER - read diagnostic memory


The FPC_DIAG_BUFFER function block read the diagnostic memory of the motor controller into a given buffer.

The diagnostic memory content is stored in an "ARRAY[1..200] OF FHPP_PRM_DIAGMESSAGE".


For visualisation the related VIS_FPC_DIAG_BUFFER is recommended.

Figure: FPC_DIAG_BUFFER function block as seen in the library manager

The diagnosis buffer size differs for the motor controller types:
• CMMO-ST, CMXH-ST and EMCA-EC: 200 entries
• CMMP-AS: 32 entries
• SFC-DC and MTR-DCI: 16 entries
• CMMS-xx and CMMD-AS: 4 entries

Inputs and outputs


Signal Scope Data Type Description
Name
FML_REF VAR_IN_OUT DT_FML_REF This data structure holds all necessary data
to control and parameterise a motor
controller.
Execute VAR_INPUT BOOL Starts the transfer with a rising edge (FALSE -
> TRUE).
The content of the diagnostic buffer is read
and stored in the given array "DiagBuff"
Done VAR_OUTPUT BOOL Transfer status
= FALSE: Transfer is active (or not started
yet)
= TRUE: Transfer has finished

Error VAR_OUTPUT BOOL Status and error messages, see chapter


"Status and error messages"
= FALSE: No error detected
= TRUE: Error detected with more
information in Status

Status VAR_OUTPUT DT_FML_STATUS Status and error messages, see chapter


"Status and error messages".
ValidEntries VAR_OUTPUT INT Shows the number of entries in the
diagnostic buffer of the motor controller
ParamNo VAR_OUTPUT INT Number of the actual handled diagnostic
buffer entry
DiagBuff VAR_OUTPUT ARRAY [1..200] OF Array for the diagnosis data
FHPP_PRM_DIAGMESSAGE The content of the diagnostic buffer is
transferred into this array.

39
Printed Documentation

Declaration of the diagnosis buffer structure


DiagBuff ARRAY [1..200] OF FHPP_PRM_DIAGMESSAGE;
TYPE FHPP_PRM_DIAGMESSAGE :
STRUCT
DiagEvent : INT; // Diagnosis event from PNU 200
DiagMsgNumber : DINT; // Diagnosis number from PNU 201
DiagTimeStamp: : DWORD; // Time stamp of the diagnosis entry
DiagMsgDescription : STRING; // Description of the diagnosis entry
END_STRUCT
END_TYPE

40
Parameterisation function blocks

5.4 FPC_DIRMP - Dynamic parameters for direct mode


The FPC_DIRMP function block reads or writes some relevant parameters for the direct operation mode (position
control).

Figure: FPC_DIRMP function block as seen in the library manager

The function block transfers 3 parameters (sorted by PNU):

PNU Parameter
540.1 Basic velocity
541.1 Acceleration
542.1 deceleration

Inputs and outputs


Signal Name Scope Data Type Description

FML_REF VAR_IN_OUT DT_FML_REF This data structure holds all necessary data to control and
parameterise a motor controller.
Execute VAR_INPUT BOOL Starts the transfer with a rising edge (FALSE -> TRUE).
The parameters are transferred in the given order
Write VAR_INPUT BOOL Read or write
= FALSE: Read the parameters from motor controller
= TRUE: Write the parameters to the motor controller
Velocity VAR_INPUT DINT PNU 540.1: Basic velocity (only for Write)
Acceleration VAR_INPUT DINT PNU 541.1: Acceleration (only for Write)
Deceleration VAR_INPUT DINT PNU 542.1: deceleration (only for Write)
Done VAR_OUTPUT BOOL Transfer status
= FALSE: Transfer is active (or not started yet)
= TRUE: Transfer has finished

Error VAR_OUTPUT BOOL Status and error messages, see chapter "Status and error
messages"
= FALSE: No error detected
= TRUE: Error detected with more information in Status

Status VAR_OUTPUT DT_FML_STATUS Status and error messages, see chapter "Status and error
messages".
ActVelocity VAR_OUTPUT DINT PNU 540.1: Actual Basic velocity
ActAcceleration VAR_OUTPUT DINT PNU 541.1: Actual acceleration
ActDecceleration VAR_OUTPUT DINT PNU 542.1: Actual deceleration

41
Printed Documentation

5.5 FPC_FILE - Transfer parameter sets


With this function module complete parameter sets will be stored in the file system of the CODESYS PLC and also
transferred back to the motor controller.
The FPC_FILE function block
o stores with "Upload" a full parameter set from the motor controller into a file at the PLC file system,
o transfers with "Download" a full parameter set from the PLC file into the motor controller.

Note
The FPC_FILE function block is only usable with the CMMO-ST and EMCA-EC controller type!
The function block is only present in the CODESYS 3.5 library (not for TwinCAT 3)!

Functional description
o The transfer direction is selected with the "Upload" or "Download" input to "TRUE" state.
o The parameter set are stored in a fix named folder of the PLC file system.
o For CMMO-ST: Folder name = "CMMOparameter".
o For EMCA-EC: Folder name = "EMCAparameter"
o "Upload" will overwrite a file with the given name in "FileName" when it exists.
o A communication error will abort a transfer immediately.
o At an error during Upload the related file is deleted.
o Each transfer unit is monitored by a time-out.
o The overall transfer may use a couple of minutes!

Figure: FPC_FILE function block as seen in the library manager

42
Parameterisation function blocks

Inputs and outputs


Signal Name Scope Data Type Description
FML_REF VAR_IN_OUT DT_FML_REF This data structure holds all necessary data to control
and parameterise a motor controller.
Execute VAR_INPUT BOOL Starts the transfer with a rising edge (FALSE -> TRUE).
The parameter transfer is started
FileName (1) VAR_INPUT STRING Name of the file in the PLC file system.
o Upload: File to save the parameter set.
o Download: File as source for the parameter set
transfer
Upload (2) VAR_INPUT BOOL Transfer a parameter set to the file with the given
name.
The file will be created or overwritten.
Download (2) VAR_INPUT BOOL Transfer a parameter set from the given file to the
motor controller
Done VAR_OUTPUT BOOL Transfer status
= FALSE: Transfer is active (or not started yet)
= TRUE: Transfer has finished

Error VAR_OUTPUT BOOL Status and error messages, see chapter "Status and
error messages"
= FALSE: No error detected
= TRUE: Error detected with more information in
Status

Status VAR_OUTPUT DT_FML_STATUS Status and error messages, see chapter "Status and
error messages".
CountByte VAR_OUTPUT DINT Shows the current byte counter during an active
transfer
FileSize VAR_OUTPUT DINT Size of the whole parameter set (also file size).

Remark (1): Please document the used file names safely to remember it for a later Download!
Remark (2): Only one of the both signals "Upload" or "Download" should be set!

43
Printed Documentation

5.6 FPC_FILE_ARRAY - Transfer parameter sets


With this function module a complete parameter set will be stored in a byte array (ARRAY [0..n] OF BYTE) and
also transferred back to the motor controller.
The FPC_FILE_ARRAY function block
o stores with "Upload" a parameter set from the motor controller in a specified byte array,
o transfers with "Download" a parameter set from the specified byte array to the motor controller.

Note
The FPC_FILE_ARRAY function block is only usable with the CMMO-ST and EMCA-EC controller type!

Recommended size of the byte array: approx. 24000 bytes ( <Name>: ARRAY [0..24000]
OF BYTE; ).

Functional description
o The transfer direction is selected with the "Upload" or "Download" input to "TRUE" state.
o The parameter set is stored in a declared byte array.
o If the byte array holds a parameter set, an "Upload" will overwrite it.
o A communication error will abort a transfer immediately.
o Each transfer unit is monitored by a time-out.
o The overall transfer may use a couple of minutes!

Figure: FPC_FILE_ARRAY function block as seen in the library manager

44
Parameterisation function blocks

Inputs and outputs


Signal Name Scope Data Type Description
FML_REF VAR_IN_OUT DT_FML_REF This data structure holds all necessary data to control
and parameterise a motor controller.
Execute VAR_INPUT BOOL Starts the transfer with a rising edge (FALSE -> TRUE).
The parameter transfer is started
Upload (1) VAR_INPUT BOOL Transfer a parameter set to the given byte array.
Download (1) VAR_INPUT BOOL Transfer a parameter set from the given byte array to the
motor controller
SizeOfFileArray VAR_INPUT UINT Size of the byte array that holds the parameter set.
Typical given with SIZEOF(<byte array>)
function
AdrOfFileArray VAR_INPUT POINTER TO Address of the byte array that holds the parameter set.
BYTE Typical given with ADR(<byte array>) function
Done VAR_OUTPUT BOOL Transfer status
= FALSE: Transfer is active (or not started yet)
= TRUE: Transfer has finished

Error VAR_OUTPUT BOOL Status and error messages, see chapter "Status and error
messages"
= FALSE: No error detected
= TRUE: Error detected with more information in Status

Status VAR_OUTPUT DT_FML_STATUS Status and error messages, see chapter "Status and error
messages".
CountByte VAR_OUTPUT DINT Shows the current byte counter during an active transfer
FileSize VAR_OUTPUT DINT Size of the whole parameter set (also used bytes in the
byte array).

Remark (1): Only one of the both signals "Upload" or "Download" should be set!

45
Printed Documentation

5.7 FPC_MULTI - Transfer multiple parameters


The FPC_MULTI function block transfers a given list of parameters to or from the motor controller.

The parameter list is given as an ARRAY[1..n] OF DT_FML_PRM_DESCRIPTION.

Figure: FPC_MULTI function block as seen in the library manager

Inputs and outputs


Signal Scope Data Type Description
Name
FML_REF VAR_IN_OUT DT_FML_REF This data structure holds all necessary data to control and
parameterise a motor controller.
Execute VAR_INPUT BOOL Starts the transfer with a rising edge (FALSE -> TRUE).
The parameters are transferred in the given order
SizeOfParam VAR_INPUT UINT Size of the parameter array intended for transfer ,
typically calculated with "SIZEOF(<Array>)"
AdrOfParam VAR_INPUT POINTER_TO_BYTE Address of the parameter array intended for transfer ,
typically given from "ADR(<Array>)"
Done VAR_OUTPUT BOOL Transfer status
= FALSE: Transfer is active (or not started yet)
= TRUE: Transfer has finished
The reading results are contained in the parameter array
under "Value
Error VAR_OUTPUT BOOL Status and error messages, see chapter "Status and error
messages"
= FALSE: No error detected
= TRUE: Error detected with more information in Status
Status VAR_OUTPUT DT_FML_STATUS Status and error messages, see chapter "Status and error
messages".
ParamNr VAR_OUTPUT UINT Number of the parameter currently being transferred

46
Parameterisation function blocks

Composition of the DT_FML_PRM_DESCRIPTION structure


TYPE DT_FML_PRM_DESCRIPTION :
STRUCT
PNU : INT ; // Parameter number of the specified parameter
SUBINDEX : INT; // Subindex of the specified parameter
ACCESS : INT; // 0 = Read parameter / 1 = Write parameter
VALUE : DINT ; // Result read out or written value
END_STRUCT
END_TYPE

Values for ACCESS


o 0 = Read PNU
o 1 = Write PNU

Example of a parameter array


MultiParam : ARRAY [0..5] OF DT_PRM_PRM_DESCRIPTION :=
[(PNU:=404, SUBINDEX:=2, ACCESS:= 1, VALUE:=100),
(PNU:=404, SUBINDEX:=3, ACCESS:= 1, VALUE:=200),
(PNU:=404, SUBINDEX:=4, ACCESS:= 1, VALUE:=300),
(PNU:=404, SUBINDEX:=5, ACCESS:= 1, VALUE:=400),
(PNU:=404, SUBINDEX:=6, ACCESS:= 1, VALUE:=500)];

The example writes to the "Target Value" (PNU=404) of the records 2..6 in the record table.

47
Printed Documentation

5.8 FPC_DATA_OBJECT - Object transfer


The FPC_DATA_OBJECT function block transfers a single device specific object from or to the motor controller.

Note
The FPC_DATA_OBJECT function block is only usable with the CMMD-AS, the CMMP-AS and the
CMMS-AS/-ST controller types!

Note
The device specific objects are not published! If required, please contact the Festo Service.

Figure: FPC_DATA_OBJECT function block as seen in the library manager

Inputs and outputs


Signal Scope Data Type Description
Name
FML_REF VAR_IN_OUT DT_FML_REF This data structure holds all necessary data to control and
parameterise a motor controller.
Execute VAR_INPUT BOOL Starts the transfer with a rising edge (FALSE -> TRUE).
Write VAR_INPUT BOOL Read or write
= FALSE: Read the device specific object
= TRUE: Write the device specific object
Object (1) VAR_INPUT INT Number of the device specific object
Subindex VAR_INPUT INT Subindex of the device specific object
Value VAR_INPUT DINT Value in case of "Write"
Done VAR_OUTPUT BOOL Transfer status
= FALSE: Transfer is active (or not started yet)
= TRUE: Transfer has finished

Error VAR_OUTPUT BOOL Status and error messages, see chapter "Status and error
messages"
= FALSE: No error detected
= TRUE: Error detected with more information in Status

Status VAR_OUTPUT DT_FML_STATUS Status and error messages, see chapter "Status and error
messages".
ActObject VAR_OUTPUT INT Number of the actual transferred device specific object
ActSubindex VAR_OUTPUT INT Subindex of the actual transferred device specific object
ActValue VAR_OUTPUT DINT Object value in case of "Read"

Remark 1:
The device specific objects are not published! If required, please contact the Festo Service.

48
Parameterisation function blocks

5.9 FPC_PNU - Transfer a single FHPP parameter


The FPC_PNU function block transfers a single parameter to or from the respective motor controller.

Figure: FPC_PNU function block as seen in the library manager

Inputs and outputs


Signal Scope Data Type Description
Name
FML_REF VAR_IN_OUT DT_FML_REF This data structure holds all necessary data to control and
parameterise a motor controller.
Execute VAR_INPUT BOOL Starts the transfer with a rising edge (FALSE -> TRUE).
Write VAR_INPUT BOOL Read or write
= FALSE: Read the FHPP parameter
= TRUE: Write the FHPP parameter
PNU VAR_INPUT INT Number of the corresponding parameter
Subindex VAR_INPUT INT Subindex of the corresponding parameter
Value VAR_INPUT DINT Parameter value when writing a parameter
Done VAR_OUTPUT BOOL Transfer status
= FALSE: Transfer is active (or not started yet)
= TRUE: Transfer has finished

Error VAR_OUTPUT BOOL Status and error messages, see chapter "Status and error
messages"
= FALSE: No error detected
= TRUE: Error detected with more information in Status

Status VAR_OUTPUT DT_FML_STATUS Status and error messages, see chapter "Status and error
messages".
ActPNU VAR_OUTPUT INT Current number of the corresponding parameter
ActSubindex VAR_OUTPUT INT Current subindex of the corresponding parameter
ActValue VAR_OUTPUT DINT Parameter value when reading a parameter

49
Printed Documentation

5.10 Status and error messages of the parameter FBs

The both FML_Read and FML_Write FBs uses the status and error system in a similar way.

At FB execution and at data transfer between the PLC and the motor controller many faults may occur. These are
signalled in a couple of two output variables:

Error: BOOL A fault is active, if it has TRUE state.


Status: DT_FML_STATUS Additional information to the fault or status is given here.

Note
If Error = TRUE: a fault is active. Additional information is stored in the Status structure (see chapter
"Fault messages").
If Error = FALSE: The Status structure may hold a FB status information (see chapter "Status
Information").

If DONE = TRUE and Error = FALSE then the function block has finished correctly.

5.10.1 The "DT_FML_Status" structure


TYPE DT_FML_STATUS:
STRUCT
Err : BOOL; // Error Bit
Cat : DINT; // Status Category
ID : DINT; // Status ID
Msg : STRING; // Status Message
END_STRUCT
END_TYPE

Structure Data
Content
component Type
TRUE: a fault is active, additional Information is given in the other three structure
components.
Err BOOL
FALSE: No fault is active.
The state of the Err component will be copied to the Error output variable!
Category to identify the source of the fault (or FB status)
0: No fault and no status is active - all things runs well.
Cat DINT 1: The function block has a fault detected or there is a status information present.
2: Reserved
3: The function block has detected a transmission fault (FPC).
ID DINT Fault or status number (see Tables below)
Msg STRING An fault description, related to the ID structure component

5.10.2 Status Information


A status information is typically present at the execution phase of the function block (Execute = TRUE, Done =
FALSE).
Relevant status information in the ID structure component:
0: All things are OK. No fault or status information s active.
2: The function block is in its execution phase (Execute = TRUE, Done = FALSE);
10: The data connection to the assigned motor controller is in use by another parameter function block. This
prevents that several data transfer operations of various modules are started simultaneously. This status
disappears when the other function block has ended his action.

50
Parameterisation function blocks

5.10.3 Fault messages


If a fault is active, then the output variable Error = TRUE. In the Cat, ID and Msg structure components of the
DT_FML_STATUS structure some information is present, to describe and identify the fault.
The fault numbers in ID and there related descriptions in Msg are different for the given category in Cat.

Fault messages at Cat = 1


ID Msg (related description)
20 FB: timeout of function block
30 FB: device type is not valid
40 FB: wrong access value
50 FB: pointer to zero
51 FB: pointer wrong size
60 FB: FHPP+ data configuration not valid

Fault messages at Cat = 3 - general


ID Msg (related description)
0 FPC: non-permitted PNU
1 FPC: parameter is read only
2 FPC: lower or upper limit value exceeded
3 FPC: wrong subindex
4 FPC: no array
5 FPC: incorrect data type
6 FPC: setting not permitted (only reset allowed)
7 FPC: describing element cannot be modified
8 FPC: PPO-Write requested in IR does not exist
9 FPC: description data do not exist
10 FPC: access group incorrect
11 FPC: no control rights
12 FPC: password incorrect
13 FPC: text not readable in cyclic exchange
14 FPC: name not readable in cyclic exchange
15 FPC: text array does not exist
16 FPC: PPO-Write missing
17 FPC: order cannot be processed because of operating status
18 FPC: other Errors
19 FPC: date not readable in cyclic exchange
20 FPC: non-permitted value
22 FPC: non-permitted Attributes, number of elements, PNU or IND
23 FPC: write request: non-permitted format
24 FPC: write request: Number of values not permitted
101 FPC: ReqID is not supported
102 FPC: parameter is write only

51
Printed Documentation

Fault messages at Cat = 3 - for the FPC_FILE and FPC_FILE_ARRAY FBs


These two functional blocks have a separate ID range with four digits .

ID Msg (related description)


1001 FPC: wrong sequence number
1002 FPC: timeout between two packets
1003 FPC: wrong packet format
1004 FPC: false instruction
1005 FPC: read error
1006 FPC: write error
1007 FPC: data volume is not correct
1008 FPC: parameter file error
1009 FPC: fault not receipt
1010 FPC: timeout
1011 FPC: file open error
1012 FPC: file close error
1013 FPC: file delete error
1014 FPC: directory create error
1015 FPC: file not exist
1016 FPC: file read error
1017 FPC: get size error
1018 FPC: file write error
1019 FPC: no or double direction selected
1020 FPC: filename is empty
1021 FPC: size of parameter file too short/long
1022 FPC: parameter file is not complete

52
6 FML_Write: Prepare the output data
6.1 FML_Write: Functional description
The FML_Write function block prepares the output data for the motor controller and transfers it. Data preparing
consist of:
o Byte arrangement for big / little endian transfer via fieldbus,
o Special word arrangement if Modbus/TCP is used.
Note
The related instance of this FB must be called after execution of the control FB and the
parameterisation FBs!

Figure: FML_Write function block as seen in the library manager

6.2 FML_Write: Inputs and outputs


The following table shows the inputs and outputs of the function block.

Signal Name Scope Data Type Description


FML_REF VAR_IN_OUT DT_FML_REF This data structure holds all necessary data to
control and parameterise a motor controller.
PlcConfigFHPP_PLUS_OUT VAR_INPUT UDINT PLC Configuration from the "FHPP+ Editor"
page -Message from PLC" folder of the related
motor controller in the FCT-project.
FHPP_Target VAR_OUTPUT ARRAY [0..7] OF Control output data to the motor controller
BYTE
FPC_Target VAR_OUTPUT ARRAY [0..7] OF Parameter output data to the motor controller
BYTE
FHPP_PLUS_Target1 (1) VAR_OUTPUT ARRAY [0..7] OF Output data for the 1st FHPP+ package
BYTE
FHPP_PLUS_Target2 (1) VAR_OUTPUT ARRAY [0..7] OF Output data for the 2ndt FHPP+ package
BYTE
FHPP_PLUS_Target3 (1) VAR_OUTPUT ARRAY [0..7] OF Output data for the 3th FHPP+ package
BYTE
Error VAR_OUTPUT BOOL Status and error messages, see chapter
"Status and error messages"
= FALSE: No error detected
= TRUE: Error detected with more information
in Status

Status VAR_OUTPUT DT_FML_STATUS Status and error messages, see chapter


"Status and error messages".

53
Printed Documentation

6.3 FML_Write_CMXH: Functional description


The FML_Write_CMXH function block prepares the output data for the CMXH-ST motor controller and transfers it.
Data preparing consist of:
o Byte arrangement for big / little endian transfer via fieldbus,
o Special word arrangement if Modbus/TCP is used.
Note
The FHPP_CTRL_CMXH function block supports the CMXH-ST motor controller only!

Note
The related instance of this FB must be called after execution of the control FB and the
parameterisation FBs!

Figure: FML_Write function block as seen in the library manager

6.4 FML_Write_CMXH: Inputs and outputs


The following table shows the inputs and outputs of the function block.

Signal Scope Data Type Description


Name
FML_REF VAR_IN_OUT DT_FML_REF This data structure holds all necessary data to control and
parameterise a motor controller.
FHPP_Target VAR_OUTPUT ARRAY [0..15] OF Control output data to the motor controller
BYTE
FPC_Target VAR_OUTPUT ARRAY [0..7] OF Parameter output data to the motor controller
BYTE
Error VAR_OUTPUT BOOL Status and error messages, see chapter "Status and error
messages"
= FALSE: No error detected
= TRUE: Error detected with more information in Status

Status VAR_OUTPUT DT_FML_STATUS Status and error messages, see chapter "Status and error
messages".

54
FML_Write: Prepare the output data

6.5 FML_Write: CANopen - passing the output data


The FML_Write function block copies the data from the DT_FML_REF structure to the output data for the motor
controller in a correct format.
The following figures show an example of the device configuration with a CANopen master.

Figure: CANOpen I/O mapping with control array FHPP_OUT and parameter array FPC_OUT

The following figure shows the data passing to the FML_Write function block:

Figure: Passing the data to the FML_Read function block (FUP editor)

Passing the data with the ST editor


fbWriteData(FML_REF:= struCAN,
FHPP_Target -> FHPP_OUT,
FPC_Target -> FPC_OUT);

55
Printed Documentation

6.6 FML_Write: IO-Link -passing the output data


The FML_Write function block copies the data from the DT_FML_REF structure to the output data for the motor
controller in a correct format.
The following figures show an example of the device configuration with an IO-Link master.

Figure: Device configuration example with one used IO-Link port

The following figure shows the data passing to the FML_Write function block:

Figure: Passing the data to the FML_Read function block (FUP editor)

Passing the data with the ST editor


fbWriteData(FML_REF:= struIO,
FHPP_Target -> FHPP_OUT,
FPC_Target -> FPC_OUT);

56
FML_Write: Prepare the output data

6.7 FML_Write: Modbus/TCP - passing the output data


The FML_Write function block copies the data from the DT_FML_REF structure to the output data for the motor
controller in a correct format.
The following figures show an example of the device configuration with a Modbus/TCP master.

Figure: Device configuration example with a Modbus/TCP Slave

The following figure shows the data passing to the FML_Write function block:

Figure: Passing the data to the FML_Read function block (FUP editor)

Passing the data with the ST editor


fbWriteData(FML_REF:= struMB,
FHPP_Target -> FHPP_OUT,
FPC_Target -> FPC_OUT);

57
Printed Documentation

6.8 Working with FHPP+ output objects


With some motor controllers up to 10 FHPP objects can be transferred cyclically to the motor controller (and vice
versa).

Note
Not all devices support FHPP+. The operating instructions of the motor controller must be checked
before use.

Each object has up to 4 byte (32 bit) width and must be adapted to the fieldbus transfer specialities:
o Big- or little endian for objects with 2 or 4 byte width.
o The Modbus/TCP special word alignment.

The FML_Write function block prepares the FHPP+ objects for the transmission to the motor
controller.

The transferred FHPP+ objects are described with the PlcConfigFHPP_PLUS_OUT variable. Each digit represents
the width of an FHPP+ object.
o 1 stands for an object with 8 bit width,
o 2 stands for an object with 16 bit width,
o 4 stands for an object with 32 bit width.
All other digits are not used!
Up to 10 FHPP+ objects with different sizes may be transferred. The objects are arranged in 8-byte packages. Up
to 3 FHPP+ packages are possible.
The access to the FHPP+ objects is described below.

Example from an FPC project with 3 FHPP+ objects

In the example "Control Data" and "Parameter Channel" are used, therefore 16 byte are available for FHPP+. The
FHPP+ objects size is given right of "PLC Configuration".
The "PLC Configuration" must be assigned to PlcConfigFHPP_PLUS_OUT := 44224.
The meaning of the digits from left to right:
o 4 = 32 bit object (FHPP+ object 1)
o 4 = 32 bit object (FHPP+ object 2)
o 2 = 16 bit object (FHPP+ object 3)
o 2 = 16 bit place holder
o 4 = 32 bit place holder

58
FML_Write: Prepare the output data

6.8.1 Variable assignment to the FML_Write FB for FHPP+


Ruled for the variables:
o The PLC Configuration is given to PlcConfigFHPP_PLUS_OUT as an DINT value.
o For each used FHPP+ package a pointer to the output data array must be given.
o FHPP_PLUS_Target1 for the 1st packet (this is always present when FHPP+ is used.
o FHPP_PLUS_Target2 is needed when 2 FHPP+ packages are used.
o FHPP_PLUS_Target3 may be used, if the "Parameter channel" is not used. Then 3 FHPP+ packages are
possible.

Figure: CANopen I/O Configuration with 2 FHPP+ packages

The assignment to the FML_Write variables is shown in the following figure:

Figure: Assignment of the variables to the FML_Write type function block in a FDB-type POU

59
Printed Documentation

Assignment of the variables in a ST-type POU


fbWriteData( FML_REF := struCAN,
PlcConfigFHPP_PLUS_OUT := EMCA_EC,
FHPP_Target -> FHPP_OUT,
FPC_Target -> FPC_OUT,
FHPP_PLUS_Target1 := FHPP_Plus_Out1
FHPP_PLUS_Target2 := FHPP_Plus_Out2);

6.8.2 Assigning values to the FHPP+ objects


The FHPP+ object must be stored in a underlying structure of DT_FML_REF. The FML_Write FB will then format
the objects for the transfer to the motor controller.

The variable content must be stored in <DT_FML_REF>.FHPP_PLUS.OUT.Object<x>.


with <DT_FML_REF> = instance of the structure DT_FML_REF,
and <x> = object number 1..10

Example code in ST:


struCAN.FHPP_PLUS.OUT.Object1 := 1200; // Mass of the part to move
struCAN.FHPP_PLUS.OUT.Object2 := 650; // Start delay for next move

60
7 Visualising function blocks
7.1 Visualisation: Overview
The table shows all present function blocks with its associated visualisation.

Function Block Visualisation


FHPP_CTRL VIS_FHPP_CTRL
FHPP_CTRL_CMXH VIS_FHPP_CTRL_CMXH
FPC_DATA_OBJECT VIS_FPC_DATA_OBJECT
FPC_DIAG VIS_FPC_DIAG
FPC_DIAG_BUFFER VIS_FPC_DIAG_BUFFER
FPC_DIPMP VIS_FPC_DIRMP
FPC_FILE VIS_FPC_FILE
FPC_FILE_ARRAY VIS_FPC_FILE_ARRAY
FPC_MULTI VIS_FPC_MULTI
FPC_PNU VIS_FPC_PNU

Refer to the "Visualisation" section in the general CODESYS Help for information on how to create a
visualisation object.

61
Printed Documentation

7.2 Visualising of a control function block


For the FHPP_CTRL function block there is also a visualisation element, which makes initial commissioning
easier.

Figure: Visualisation element for the motor controller CMMO_ST_CTRL (example)

Control: The input data of a function block linked to the visualisation is displayed in the left half of the
visualisation.
o Active boolean input data is shown with an orange square.
o The input fields may be used for input of numeric values.
Display: The output of a function block linked to the visualisation is displayed in the right half of the
visualisation.
o Active boolean input data is shown with a green square.
o The active Fault and Warning-LEDs shows a red coloured square.
o Numeric values are typically shown in the right of the corresponding set value.
Data elements which are not used for the active operating mode are shown with different colours:
o A blue coloured signal is used for the active function.
o A light gray coloured signal is therefore not used.

62
Visualising function blocks

7.2.1 Creation of a visualisation

1. Insert a frame element in the editing area of the visualization.


2. In the window "Available visualizations", select and insert the desired element.
3. Adjust the size and position of the frame.

The desired visualization element appears in the editing window of the visualization.

Hints for creating a visualization object can be found in the general CODESYS help in the chapter
"Visualization".

7.2.2 Linking the visualisation


The visualisation element for the selected function block is added to a visualisation object. You can select the
visualisation object using the "Frame Selection" context command.
The desired visualisation element appears in the editing window for the visualisation object.

Refer to the "Visualisation" section in the general CODESYS Help for information on how to create a
visualisation object.

1. Adjust the size and position of the visualisation element if necessary. To do this, click on the element
and use the borders.
2. For configuration, click on the visualisation element with the left mouse button. In the "Property" area
of the editing window (➔ [View] [Element Properties]) you can make various settings for displaying and
linking the visualisation element.
3. Click in the edit field of the "Object" "m_Input_INST" and then on the button for opening the "Input
Assistant" window.

Figure: Visualisation - "Property" dialog

4. Link the visualisation element with the corresponding instance (name of axis).
There are two options here:
o In the line "m_Input_INST", enter the name of the function block in combination with the higher-level
program name.
o Double-click in the input line using the mouse. Using the left mouse button, click on the button that is
now displayed in the line at right. The "Input Assistant" window opens, where you can select the
corresponding instance. Confirm the selection with "OK."

63
Printed Documentation

7.3 Visualising of a parameterisation function block


For each parameterisation function block there is also a visualisation element, which makes initial
commissioning easier.

Figure: Visualisation element for the FPC_PNU function block (example)

Control: The input data of a function block linked to the visualisation is displayed in the left half of the
visualisation.
o Active boolean input data is shown with an orange square.
o The input fields may be used for input of numeric values.

Display: The output of a function block linked to the visualisation is displayed in the right half of the
visualisation.
o Active boolean input data is shown with a green square.
o The active Error-LED shows a red coloured square.
o Numeric values are typically shown in the right of the corresponding set value.
o The Status structure elements are shown in the lower right corner:
• Status.Cat as the "Status Category" value,
• Status.ID as the "Status ID" value,
• Status.Msg as an textual fault description in the last line.

7.3.1 Creation of a visualisation

4. Insert a frame element in the editing area of the visualization.


5. In the window "Available visualizations", select and insert the desired element.
6. Adjust the size and position of the frame.

The desired visualization element appears in the editing window of the visualization.

Hints for creating a visualization object can be found in the general CODESYS help in the chapter
"Visualization".

64
Visualising function blocks

7.3.2 Linking the visualisation


The visualisation element for the selected function block is added to a visualisation object. You can select the
visualisation object using the "Frame Selection" context command.
The desired visualisation element appears in the editing window for the visualisation object.

Refer to the section "Visualisation" in the general CODESYS Help for information on how to create a
visualisation object.

1. Adjust the size and position of the visualisation element if necessary. To do this, click on the element
and use the borders.
2. For configuration, click on the visualisation element with the left mouse button. In the "Property" area
of the editing window (➔ [View] [Element Properties]) you can make various settings for displaying and
linking the visualisation element.
3. Click in the edit field of the "Object" "m_Input_INST" and then on the button for opening the "Input
Assistant" window.

Figure: Visualisation - "Property" dialog

4. Link the visualisation element with the corresponding instance (name of axis).
There are two options here:
o In the line "m_Input_INST", enter the name of the function block in combination with the higher-level
program name.
o Double-click in the input line using the mouse. Using the left mouse button, click on the button that is
now displayed in the line at right. The "Input Assistant" window opens, where you can select the
corresponding instance. Confirm the selection with "OK."

65
8 Examples
8.1 Controlling a Festo motor controller
This example uses the motor controller CMMO-ST with the corresponding function block FHPP_CTRL.

Figure: Example of function block FHPP_CTRL

With this function block, the motor controller CMMO-ST can be controlled using the following four operating and
control mode combinations:
o Record selection
o Direct mode position control
o Direct mode torque control
o Direct mode speed control

The set operating and control mode is only accepted and displayed with the start of a movement, i.e.
with a rising edge at the "StartTask" input.

67
Printed Documentation

8.1.1 Basic program structure


To ensure that the program runs correctly, the following sequence must be followed during function block calls :

1. Calling the FML_READ instance. There, the input data of the motor controller are prepared
in the structure FML_REF.
2. Calling the FHPP_CTRL instance. This controls the assigned motor controller.
3. Calling the FML_WRITE. instace. There, the output data to the motor controller from
FML_REF are correctly arranged.

8.1.2 Prerequisites for ready status


o Motor unit is switched on
o Load voltage is present
o Control sovereignty lies with the PLC
For the CMMO-ST motor controller, the additional input signal DIN6 may be required for the "Ready" state.

8.1.3 Establishing the ready state


User action Feedback from motor unit
-- SupplyVoltagePresent = TRUE
EnableDrive = TRUE DriveEnabled = TRUE
MC = TRUE
Stop = TRUE Ready = TRUE
Halt = TRUE HaltActive = FALSE

8.1.4 Homing
User action Feedback
StartHoming = FALSE -> TRUE AckStart = TRUE
MC = FALSE
DriveIsMoving = TRUE
HaltActive = TRUE
-- DriveIsMoving = FALSE,
MC = TRUE, DriveIsReferenced = TRUE, HaltActive = TRUE (homing
completed)

8.1.5 Setting and operation of "Record selection"


(Example with record # 4)

User action Feedback


OPM = 0 OPMString = 'Record Mode selected'
StateOPMString = 'Record Mode active'
StateOPM = 0
RecordNo = 4 --
StartTask FALSE -> TRUE OPMString = 'Record Mode selected'
StateOPMString = 'Record Mode active'
StateOPM = 0
AckStart = TRUE
MC = FALSE
DriveIsMoving = TRUE
ActualRecordNo = 4
ActualPosition = ...
-- DriveIsMoving = FALSE
MC = TRUE (positioning completed)

68
Examples

8.1.6 Setting and operation of "Direct mode position control"


User action Feedback
OPM = 1 OPMString = 'Directmode Positioncontrol selected'
StateOPMString = 'Directmode Positioncontrol active'
StateOPM = 1
SetValueVelocity = ... --
SetValuePosition = ... --
StartTask = FALSE -> TRUE OPMString = 'Directmode Positioncontrol active'
StateOPMString = 'Directmode Positioncontrol active'
StateOPM = 1
AckStart = TRUE
MC = FALSE
DriveIsMoving = TRUE
ActualVelocity = ...
ActualPosition = ...
-- DriveIsMoving = FALSE
MC = TRUE (positioning completed)

8.1.7 Setting and operation of "Direct mode force / torque control"


User action Feedback
OPM = 5 OPMString = 'Directmode Forcecontrol selected'
StateOPMString = Previous operating and control mode as STRING
StateOPM = Previous operating and control mode as INT
SetValueForce = ... --
SetValueForceRamp := ... (1)
SetValueVelocity := ... (2)
DeactivateStrokeLimit := ... (3) --
StartTask =FALSE -> TRUE OPMString = 'Directmode Forcecontrol active'
StateOPMString = 'Directmode Forcecontrol active'
StateOPM = 5
AckStart = TRUE
MC = FALSE
DriveIsMoving = TRUE
ActualForce = ...
ActualPosition = ...
-- DriveIsMoving = FALSE
MC = TRUE (torque specification reached)

Remark 1: SetValueForceRamp only with CMMP-AS device type.


Remark 2: SetValueVelocity only with CMMO-ST and EMCA-EC device types.
Remark 3: DeactivateStrokeLimit may be used for stroke limitation.

69
Printed Documentation

8.1.8 Setting and operation of "Direct mode speed control"


User action Feedback
OPM = 9 OPMString = 'Directmode Velocitycontrol selected'
StateOPMString = Previous operating and control mode as STRING
StateOPM = Previous operating and control mode as INT
SetValueRotRamp = ... --
SetValueRotSpeed = ... --
StartTask = FALSE -> TRUE OPMString = 'Directmode Velocitycontrol active'
StateOPMString = 'Directmode Velocitycontrol active'
StateOPM = 9
AckStart = TRUE
MC = FALSE
DriveIsMoving = TRUE
ActualRotRamp = ...
ActualRotSpeed = ...
-- DriveIsMoving = FALSE
MC = TRUE (speed specification reached)

70
Examples

8.2 Parameterising a Festo motor controller


This example uses the motor controller CMMO-ST with the corresponding function block FPC_PNU.

Figure: Example of function block FPC_PNU

With this function block


o you can read a single parameter from motor controller
o or write a single parameter to the motor controller.

Note
For a description of the parameters supported by the various motor controllers according to FHPP,
please refer to the respective product documentation.

8.2.1 Basic program structure


To ensure that the program runs correctly, the following sequence must be followed during function block calls :

1. Calling the FML_READ instance. There, the input data of the motor controller are prepared
in the structure FML_REF.
2. Calling the FHPP_CTRL instance. This controls the assigned motor controller.
3. Calling the FML_WRITE. instace. There, the output data to the motor controller from
FML_REF are correctly arranged.

8.2.2 Prerequisites for communication


o The motor controller is switched on
o Control sovereignty lies with the PLC

71
Printed Documentation

8.2.3 Reading parameters


(Example with homing method)

User action Feedback


Write = False No feedback
PNU = 1011
Subindex = 1
Execute = FALSE -> TRUE Done = TRUE
Error = FALSE
Status.Err = FALSE; Status.Msg = 'no Error'
ActPNU = 1011
ActSubindex = 1
ParamValueRD = ...

8.2.4 Writing parameters


(Example with acceleration homing method)

User action Feedback


Write = TRUE No feedback
PNU = 1013
Subindex = 1
ParamValueWR = ...
Execute = FALSE -> TRUE Done = TRUE
Error = FALSEStatus.Err = FALSE; Status.Msg = 'no Error''
ActPNU = 1013
ActSubindex = 1
ParamValueRD = ...

The values written to the motor controller with the function block ..._PRM_SINGLE are stored in a volatile
memory and are valid until the control voltage of 24 V at the motor controller is interrupted.
In a non-volatile memory, the values can be assumed permanently by describing PNU 127 Subindex 2 with the
value 1.

The following actions must be performed in order for the described parameters to be assumed permanently:

User action Feedback


Write = TRUE No feedback
PNU = 127
Subindex = 2
ParamValueWR = TRUE
Execute = FALSE -> TRUE Done = TRUE
Error = FALSEStatus.Err = FALSE; Status.Msg = 'no Error'
ActPNU = 127
ActSubindex = 2
ParamValueRD = 0

72
9 Glossary

C
Consistency: A data range, which is defined as consistent, is transmitted complete, i.e. in a bus cycle.

D
Device: Device is a synonym for a Festo motor controller

E
EDS file: Electronic data sheet, which describes the functions and features of a CANopen device in
standardised form.

F
Festo Configuration Tool (FCT): Commissioning software with uniform project and data management for all
supported device types. The special requirements of a device type are supported by means of plug-ins
with the necessary descriptions and dialogs.
Festo Handling and Positioning Profile (FHPP): Uniform field bus data profile for positioning controllers
from Festo.
Festo Parameter Channel (FPC): FHPP-specific parameter channel version.
FHPP: Uniform fieldbus data profile for positioning controllers from Festo.
FPC: FHPP-specific parameter PKW version (Festo Parameter Channel).

H
Homing: Homing defines the reference position and thereby the origin of the measuring reference system of
an axis.
Homing method: Method for defining the reference position.

J
Jog mode: Manual movement in positive or negative direction.

N
Node ID: Used for unique identification of a bus station.

73
Printed Documentation

P
Package: The package allows the installation of target system-specific files for the control of Festo
CODESYS motor controllers. The program can be found in the Start menu under "Programs" in the
selection "CODESYS V3"
PDO: Process Data Object.
PKE: Integral part of the parameter channel (PKW) which contains the task and reply identifiers (AK) and the
parameter number (PNU).
PKW: Telegram part used for transmitting parameters. PKW refers to a parameter identification value (see
also "Festo Parameter Channel (FPC)").
PNU: Parameters which can be transmitted via the parameter channel are addressed with the parameter
number (PNU). The parameter number is an integral part of the parameter identifier (PKE) and serves
for identifying or addressing the individual parameter.
Position record: Positioning command defined in the record table, consisting of target position, positioning
mode, positioning speed and accelerations.
Profile position mode: Operating mode for processing a position record or a direct positioning task.
Project zero point (PZ): Measuring reference point for all positions in positioning tasks. The project zero
point forms the basis for all absolute position specifications (e.g. in the record table or with direct
control via the control interface or diagnostic interface). The basis point for the project zero point is the
axis zero point.

R
Reference point (REF): Basis point for the incremental measuring system. The reference point defines a
known orientation or position within the positioning path of the drive.

S
Subindex (IND): Integral part of the parameter channel (PKW) which addresses an element of an array
parameter (subparameter number).

T
Teach mode: Operating mode for setting positions by moving to the target position e.g. when creating
position sets.

74
Index

10 Index
B FPC ...........................................5, 14, 20, 23, 48, 61
big / little endian ........................................... 11, 53
I
C Input Variables .................................. 12, 14, 23, 28
CANopen.....................................5, 6, 16, 23, 55, 61
L
CMMD-AS .................................................... 5, 6, 33
Library Manager .............................. 5, 6, 11, 27, 45
CMMP-AS......................................... 5, 6, 33, 35, 45
CMMS-AS..................................................... 5, 6, 33 M
CMMS-ST ..................................................... 5, 6, 33 Modbus .......... 11, 12, 14, 16, 18, 20, 23, 53, 59, 61
Configuration5, 7, 12, 16, 18, 20, 23, 48, 54, 55, 57, N
59, 61, 66, 69
Namespace ...................................................... 5, 10
D
O
DeviceType .............................12, 14, 16, 18, 20, 23
Operating mode......................................... 8, 28, 66
Direct application ............................................ 8, 28
OPM .............................................................. 28, 71
DT_FML_REF .. 11, 12, 14, 23, 27, 28, 34, 35, 37, 39,
41, 43, 45, 47, 54, 55, 57, 59, 61 Output Variables ............................... 14, 27, 28, 48

E P
EMCA-EC .................................................... 5, 33, 35 Parameter Channel ................................ 5, 8, 23, 61
Error messages .................................................... 48 PLC ................... 8, 12, 23, 28, 39, 48, 54, 61, 71, 75
PNU ..................................14, 35, 37, 43, 47, 48, 75
F Position mode ................................................. 8, 28
FCT ...................................................... 7, 12, 28, 54
Positioning Profile ................................................. 8
Festo Configuration Tool .................................... 7, 8
FHPP ....... 6, 8, 12, 14, 20, 23, 28, 47, 48, 54, 61, 75 R
FHPP_CTRL ....................... 10, 14, 27, 28, 65, 66, 71 Record Mode ................................................. 28, 71
FHPP+ ........................................................ 8, 23, 61 Record selection ........................................ 8, 28, 71
Fieldbus 1, 5, 6, 8, 11, 12, 16, 18, 20, 23, 27, 33, 53, S
61
Signal Name .. 12, 28, 34, 35, 37, 39, 41, 43, 45, 47,
FML_Read 10, 11, 12, 14, 16, 18, 20, 23, 27, 33, 48, 54
55, 57, 59
FML_Write ...... 10, 27, 33, 48, 53, 54, 55, 57, 59, 61 V
Force/torque mode ................................................ 8 Velocity mode .................................................. 8, 28

75

You might also like