The LenzeIOSystem.lib and LenzeIOSystemVxxxx.lib function libraries can be used for
the following Lenze PLC devices:
TypeAs of hardware versionAs of software version
Drive PLCEPL10200_xIVC2.x
Drive PLCEPL10200_xTVC2.x
9300 Servo PLCEVS93xx_xI2K2.x
9300 Servo PLCEVS93xx_xT2K2.x
ECSxAECSxAxxx1C7.0
Important note:
The software is supplied to the user as described in this document. Any risks resulting from its quality or use remain the responsibility
of the user. The user must provide all safety measures protecting against possible maloperation.
We do not take any liability for direct or indirect damage, e.g. profit loss, order loss or any loss regarding business.
ã 2006 Lenze Drive Systems GmbH
No part of this documentation may be copied or made available to third parties without the explicit written approval of Lenze Drive
Systems GmbH.
All information given in this documentation has been carefully selected and tested for compliance with the hardware and software
described. Nevertheless, discrepancies cannot be ruled out. We do not accept any responsibility or liability for any damage that may
occur. Required corrections will be included in updates of this documentation.
All product names mentioned in this documentation are trademarks of the corresponding owners.
This Manual contains information on the LenzeIOSystem.lib and LenzeIOSystemVxxxx function
libraries for the Drive PLC Developer Studio.
1.1.1Conventions used in this Manual
This Manual uses the following conventions to distinguish between different types of information:
Variable identifiers
are printed in italics in the explanatory text:
· "By means of bReset..."
Tip!
Information about the conventions used for variables of Lenze system blocks, function blocks and
functions can be obtained from the appendix of the DDS online documentation "Introduction into
IEC 61131−3 programming". The conventions ensure universal and uniform labelling and support
the readability of PLC programs.
Lenze functions/function blocks
can be identified by the name. They always begin with an "L_":
· "By means of the L_IOPar..."FB
Program listings
are itemised in the "Courier" font, the keywords being printed bold:
· "IF(ReturnValue < 0)THEN..."
L
LenzeIOSystem.lib EN 1.7
1−1
Function library LenzeIOSystem.lib
Preface and general information
1.1About this Manual
1.1.2Structure of the descriptions
The descriptions of the individual functions/function blocks as well as system blocks in this Manual
are structured in a standardised manner according to the following pattern:
FunctionFunction block (FB)/
Headline with function and identifier
Declaration of the function:
· Data type of the return value
· Function identifier
· List of the transfer parameters
Short description with the most important features
Graph showing the function
including all corresponding
variables
· Transfer parameters
· Return value
Table giving information on the
transfer parameters:
· Identifiers
· Data type
· Possible settings
· Information
Table giving information on the
return value:
· Data type of the return value
· Possible return values and their
meaning
Further information
(comments, tips, application examples, etc.)
system block (SB)
−
System block/function block chart
including all corresponding
variables
· Input variables
· Output variables
Table giving information about
input and output variables:
· Identifiers
· Data type
· Variable type
· Possible settings
· Information
−
1.1.3Pictographs used in this Manual
Pictohraphs usedSignal words
Warning of
material damage
More notesTip!
Stop!Warns of potential damage to material.
Note!
1.1.4Terminology used
TermIn this Manual used for
DDSDrive PLC Developer Studio
FBFunction block
GDCGlobal Drive Control (parameter setting program from Lenze)
Parameter codesCodes for setting the function of a function block
PLC· 9300 servo PLC
SBSystem block
· Drive PLC
· ECSxA "Application" axis module
Possible consequences if disregarded:
Damage of the controller/drive system or its environment.
Indicates a tip or note.
1−2
LenzeIOSystem.lib EN 1.7
L
Function library LenzeIOSystem.lib
Preface and general information
1.2Version identifiers of the function library
1.2Version identifiers of the function library
The version of the function library can be found under the global constant
C_w[Function library name]Version .
Version identifiers as of PLC software version 7.x:
· In the example, "01050000" stands for version "1.05".
Example
value
Version: 01050000
L
LenzeIOSystem.lib EN 1.7
1−3
Function library LenzeIOSystem.lib
Preface and general information
1−4
LenzeIOSystem.lib EN 1.7
L
Function library LenzeIOSystem.lib
Introduction
2.1Introduction
2Introduction
2.1Introduction
The user is offered suitable function blocks in function libraries to enable decentralised I/O system
support by Lenze PLC products.
These function blocks are integrated in an IEC 61131 program and assist in the parameterisation of
the I/O system as well as in process data processing. Furthermore, they provide digital and analog
I/O system input and output information.
LenzeI/OSystem.lib
This library provides all setting options. User configuration via user codes is not required.
2.2Design concept
The function libraries contain two types of function blocks.
· Parameter data blocks
· Process data blocks
Parameter data blocks
These function blocks allow the modification of index information in the decentralised I/O system and
the transmission of specified data. These data are transmitted only once to the I/O system during the
initialisation phase.
· Parameterising communication
– These blocks parameterise communication relationships
(Identifier assignment for PDO communication, transmission method, transmission period,
etc.) between PLC and I/O system.
– These settings are mandatory for data exchange.
· Parameterising modules and monitoring functions
– The function blocks are required for
individual parameterisation of analog modules,
individual parameterisation of counter modules,
communication monitoring
Process data blocks
These function blocks provide assistance for evaluating and further processing the current process
data information from the I/O system inputs in the PLC program.
Information and data can be transferred into the process via the output modules.
· Process data blocks to transmit and receive I/O data between PLC and I/O system.
· Process data blocks for I/O signal conversion.
L
LenzeIOSystem.lib EN 1.7
2−1
Function library LenzeIOSystem.lib
Introduction
2.3Minimum configuration
2.3Minimum configuration
A minimum configuration must be established to integrate the I/O system, consisting of one
parameter data block L_IOParPDO15 to parameterise communication relationships and one
process data block L_IOData15 to evaluate the input/output information.
The information of the parameter block is transmitted to the I/O system and the function block for
PLC I/O system process data exchange.
Data exchange between the output of the parameter block and the input of the process data block
is possible with the help of a global variable.
Note!
The function libraries for the decentralised I/O system are based on unassigned CAN objects, so that
the CAN driver must be initialised via block L_CANInit.
The block L_CANInit is located in the Lenze library LenzeCanDrv.lib.
wDrvNr
10
dwRelocCobld
0
L_CanInit
L_CanInit
CTRL
10 = System bus
0 = ID range 832..895 (Servo PLC only)
Note!
The identifier range is limited in the case of the 9300 Servo PLC.
Use of function blocks L_IOParPDO15 and L_IOParPDO610 requires adjustment of the
Cob IDs from PDO4 onwards.
2−2
LenzeIOSystem.lib EN 1.7
L
Function library LenzeIOSystem.lib
Application examples
3.1Modular decentralised I/O system
3Application examples
The examples were generated with DDS version 2.0. Examples concerning the I/O system are given
in the directory C:\Programme\Lenze\DDS_P_2_20\Projects\IOSystem\Samples
3.1Modular decentralised I/O system
The modular decentralised I/O system with eight digital inputs and outputs is integrated into a PLC
program with the help of LenzeIOSystem.lib.
During this process, the following steps must be carried out in the given order:
1. Initialise the CAN driver
2. Parameterise the communication conditions
3. Program the process data exchange between PLC and I/O system
4. Initialise the codes
Initialising the CAN driver
Communication between the PLC and the I/O system is based on "unassigned CAN objects"
(control, alarm, diagnostics...). These objects are available in DDS from version 2.x onwards.
To initialise the unassigned CAN objects, the function L_CANInit must be requested once only in the
system POU PLC_ColdStart.
Parameterising the communication conditions
Function block L_IOParPDO15 for parameterising the communication conditions of PDO1−PDO5 is
integrated into the SFC editor and necessarily is to be used in every project. This function block
specifies the communication parameters in the I/O system.
The values are transferred to the process data block L_IOData15 as a structure (STRUCT) in order
to match the communication parameters of the devices (controller and I/O system).
On program execution, this step is executed only once at the beginning.
L
LenzeIOSystem.lib EN 1.7
3−1
Function library LenzeIOSystem.lib
Application examples
3.1Modular decentralised I/O system
Then the Parameter program that must be generated in the SFC editor follows. With the invocation
of the function block instance, the step Parameter_data has the action generated in the FBD editor.
Note!
· Enter a minimum time of ten seconds for step Init via the menu command ExtrasÞStep
attibutes.... Correct entry: T#10s
Make sure that step Parameter_data is not executed before the initialisation phase of the I/O system
is complete. This is achieved with a minimum time of ten seconds.
As this POU must be processed cyclically, the program is invoked in the PLC_PRG (main program).
The sequential function chart ensures a cyclic task.
The parameterisation process is started via the initial action in step Parameter_data.
Once the parameterisation is complete, the final action in step Parameter_data sets input bExecute
to FALSE and variable bStart to TRUE.
Variable bStart ensures that step Parameter_data is executed
· on switching on
· on reset and subsequent starting.
When the parameterisation is complete, the PLC_PRG (main program) stops in step Init. It does not
impose an extra burden on the target system during subsequent program operation.
3−2
LenzeIOSystem.lib EN 1.7
L
Function library LenzeIOSystem.lib
Application examples
3.1Modular decentralised I/O system
Programming the process data exchange between PLC and I/O system
The CFC editor is used to generate a program named Process.
· Declare an instance of function block L_IOData15 in Process.
· Generate two inputs in the CFC editor, assign names g_bParDone15 and g_ParData15 and
attach these to the corresponding inputs of function block L_IOData15 as shown in the figure.
Several conversion blocks are available to evaluate input data and to transfer output data.
Function block L_IOData15 transmits output data to the I/O system and receives input data from
there.
At input DataFrom_IOParPDO15, CAN communication relationships between PLC and I/O system
are transmitted from parameterisation block L_IOParPDO15 to process data block L_IOData15.
Process data transmission is started after parameterisation via a High signal at input
bEnablePDOTransfer.
Data conversion for evaluating individual channels
The program Process can be extended as follows:
· Use the menu command ExtrasÞOrder to indicate the sequence.
· Drag the individual function blocks to their positions in order to make the program sequence
comprehensible.
L
LenzeIOSystem.lib EN 1.7
3−3
Function library LenzeIOSystem.lib
Application examples
3.1Modular decentralised I/O system
3−4
Function block L_IOData15 supplies the transmit and receive data as 8 byte information via the CAN
telegram.
The two converters convert the information into individual bytes.
A digital input and output module maps the individual bits.
Initialising the codes
Initialise the following codes in the PLC
· Code C0352
Subcode 0 = 1
Defines PLC as a CAN master so that the configuration enters the Operational state.
· Code C0356
Subcode 1 = 10000
Increases the boot−up time to10s
· Code C2104
Subcode 0 = 1
Starts the PLC program automatically after switching on the mains
LenzeIOSystem.lib EN 1.7
L
Function library LenzeIOSystem.lib
Application examples
3.2Compact decentralised I/O system
3.2Compact decentralised I/O system
The compact module EPM − T832 with 24 digital inputs and 8 digital outputs is integrated into a PLC
program with the help of LenzeIOSystem.lib.
During this process, the following steps must be carried out in the given order:
1. Initialise the CAN driver
2. Parameterise the communication conditions
3. Program the process data exchange between PLC and I/O system
4. Initialise the codes
Initialising the CAN driver
Communication between the PLC and the I/O system is based on "unassigned CAN objects"
(control, alarm, diagnostics...). These objects are available in DDS from version 2.x onwards.
To initialise the unassigned CAN objects, the function L_CANInit must be requested once only in the
system POU PLC_ColdStart.
Parameterising the communication conditions
Function block L_IOParCompactModule for parameterising the communication conditions is
integrated into the SFC editor and necessarily is to be used in every project. This function block
specifies the communication parameters in the I/O system.
The values are transferred to the process data block L_IOCompactModule as a structure (STRUCT)
in order to match the communication parameters of the devices (controller and I/O system).
On program execution, this step is executed once only at the beginning.
Then the Parameter program that must be generated in the SFC editor follows. With the invocation
of the function block instance, the step ParCompact has the action generated in the FBD editor.
L
LenzeIOSystem.lib EN 1.7
3−5
Function library LenzeIOSystem.lib
Application examples
3.2Compact decentralised I/O system
Note!
· Enter a minimum time of ten seconds for step Init via the menu command ExtrasÞStep
attributes.... Correct entry: T#10s
Make sure that step Parameter_data is not executed before the initialisation phase of the I/O system
is complete. This is achieved with a minimum time of ten seconds.
As this POU must be processed cyclically, the program is invoked in the PLC_PRG (main program).
The sequential function chart ensures a cyclic task.
The parameterisation process is started via the initial action in step ParCompact.
Once the parameterisation is complete, the final action in step ParCompact sets input bExecute to
FALSE and variable bStart to TRUE.
Variable bStart ensures that step ParCompact is executed
· on switching on
· on reset and subsequent starting.
When the parameterisation is complete, the PLC_PRG (main program) stops in step Init. It does not
impose an extra burden on the target system during subsequent program operation.
Programming the process data exchange between PLC and I/O system
The CFC editor is used to generate a program named Process.
· Declare an instance of function block L_IOCompactModule in Process.
· Generate two inputs in the CFC editor, assign names g_bParDone15 and g_ParData15 and
attach these to the corresponding inputs of function block L_IOCompactModule as shown in
the figure.
3−6
Several conversion blocks are available to evaluate input data and to transfer output data.
Function block L_IOCompactModule transmits output data to the I/O system and receives input
data from there.
LenzeIOSystem.lib EN 1.7
L
Function library LenzeIOSystem.lib
Application examples
3.2Compact decentralised I/O system
At input DataFrom_IOParPDO15, CAN communication relationships between PLC and I/O system
are transmitted from parameterisation block L_IOParCompactModule to process data blockL_IOCompactModule.
Process data transmission is started after parameterisation via a High signal at input
bEnablePDOTransfer.
Data conversion for evaluating individual channels
The program Process can be extended as follows:
· Use the menu command ExtrasÞOrder to indicate the sequence.
· Drag the individual function blocks to their positions in order to make the program sequence
comprehensible.
L
Function block L_IOCompactModule supplies the transmit and receive data as 8*8 byte information
via the CAN telegram.
The two converters convert the information into individual bits.
A digital input and output module maps the individual bits.
If the example for eight inputs / outputs is to be extended to 24 inputs, two further function blocks
L_IODInModule must be generated and linked via converter L_IOConvByteArrayToByte.
LenzeIOSystem.lib EN 1.7
3−7
Function library LenzeIOSystem.lib
Application examples
3.2Compact decentralised I/O system
Initialising the codes
Initialise the following codes in the PLC
· Code C0352
Subcode 0 = 1
Defines PLC as a CAN master so that the configuration enters the Operational state.
· Code C0356
Subcode 1 = 10000
Increases the boot−up time to10s
· Code C2104
Subcode 0 = 1
Starts the PLC program automatically after switching on the mains
3−8
LenzeIOSystem.lib EN 1.7
L
Function library LenzeIOSystem.lib
4Function blocks for parameterisation
This chapter contains information on function blocks for parameterisation.
The following functions and modules are parameterised:
· Monitoring function
· Analog input modules
· Analog output modules
· Counter modules
· Link between PLC control and I/O system
· Link between PLC control and compact module
Function blocks
L
LenzeIOSystem.lib EN 1.7
4−1
Function library LenzeIOSystem.lib
Function blocks
4.1L_IOParComGuarding − Monitoring function
4.1L_IOParComGuarding − Monitoring function
This function block parameterises, via the input setting, the monitoring functions provided by the I/O
system.
Included are
· NodeGuarding, Heartbeat and a Lenze−specific monitoring function,
· setting the output channels’ switching behaviour in the case of an error via input
byErrorBehavior.
The function block output indicates the transmission status.
L_IOParComGuarding
bExecute
byNodeAdr
tGuardTime
byLifeTimeFactor
tHeartbeatConsumerTime
byHearbeatConsumerAdr
tHeartbeatProducerTime
byErrorBehavior
tTimeOutPDO1_DataToIO
CTRL
EPM-T110
EPM-T111
Ixxxh
nState
tTimeOutPDO10_DataToIO
tTimeOutPDO1_DataFromIO
tTimeOutPDO10_DataFromIO
DataTo_IOData15
DataTo_IOData610
Note!
Use the FBs of LenzeCanDSxDrv.lib for evaluating the functions NodeGuarding and Heartbeat.
byHeartbeatConsumerAdrByteNode ID of the device to be monitored. (HeartbeatProducer Node ID)
An NMT master must poll the I/O system within the guard time period.
Default t = 0 ms
t = 0 − 65535 ms
Life Time Factor x Guard Time = Life Time.
Once this period has expired, the I/O system is switched into a predefined status.
The I/O system is switched into a predefined status if no telegram is received from
the Heartbeat Producer within this interval.
t = 0 − 65535 ms
4−2
LenzeIOSystem.lib EN 1.7
L
Function library LenzeIOSystem.lib
Function blocks
4.1L_IOParComGuarding − Monitoring function
(Variable type: VAR_INPUT)ð Inputs
Variable nameInformation/possible settingsData type
tHeartbeatProducerTimeTimeSet the transmission time for one heartbeat telegram t = 0 − 65535ms
byErrorBehaviorByteSet the bus status / behaviour on critical device error
0 Pre−Operational (default)
1 No status change
2 Stop
3 Reset after 2 seconds
tTimeOutPDO1_DataToIO
...
tTimeOutPDO10_DataToIO
tTimeOutPDO1_DataFromIO
...
tTimeOutPDO10_DataFromIO
TimeMonitoring period for process input data (Lenze−specific).
If no data are received at the selected PDO within the monitoring period, the I/O
system assumes the status set under byErrorBehavior.
Default t = 0 ms
t = 0 − 65535 ms
TimeMonitoring period for process output data.
If no data are transmitted from the I/O system to the PLC at the selected PDO within
the monitoring period, function block L_IODataXXX signals a time monitoring error.
Default t = 0 ms
t = 0 − 65535 ms
Outputs ð(Variable type: VAR_OUTPUT)
IdentifierData typeValue/meaning
nStateIntegerStates
DataTO_IOData15StructStructure for process data block L_IOData15.
DataTO_IOData610StructStructure for process data block L_IOData610
If a transmission error occurs during the parameterisation process, or the input data
are incorrect, the parameterisation process is aborted and an error number is
indicated at output nState.
Any errors are reset via an edge reversal at input bExecute or on program restart.
0 Transmit command is executed.
1 Transmit command sent − processing in process
2001 Error occurred during bus transfer
2002 Transmit command timed out
2004 Access denied − wrong target system: Subindex does not exist
2005 Access denied − wrong target system: Index does not exist
2013 Access denied − wrong target system: Invalid value range
2111 Access denied − wrong target system: More than 4 digits
specified after comma, or no fixed−comma−format index
2117 Communication channel does not exist − also refer Set byCom
channel
2120 Too many modules connected − parameter transfer aborted
−10xx Incorrect value at function block input.
XX := Number of faulty input (counting direction down),
parameterisation impossible.
Remedy: Change input value, restart data transmission
Transfer process output data monitoring periods to process data block L_IOData15.
Global struct−type variable
Transfer process output data monitoring periods to process data block
L_IOData610.
Global struct−type variable
L
LenzeIOSystem.lib EN 1.7
4−3
Function library LenzeIOSystem.lib
Function blocks
4.2L_IOParAlnModule − Parameterisation function
4.2L_IOParAlnModule − Parameterisation function
By means of the L_IOParAInModule function block, the analog input modules (EPM−T310 / 311 /
T312) are parameterised. Parameterisation is started by a high edge on the input bExecute.
Each module has four channels, whereby each channel can be set individually.
The following is provided:
· Voltage measurement
· Current measurement
· Resistance measurement
· Temperature measurement
On the output of the function block, the transmission status and the information on the connected
modules are displayed.
L_IOParAInModule
bExecute
CTRL
nState
byNodeAdr
byAnalogModuleNo
BEnableDiagnosticAlarm *
bEnableAnalogInterrupt
byFunctionInput_CH1
BySampleRate_CH1 *
BySelectionFcn_CH1 *
ByHysteresis_CH1 *
ByTriggerSelection_CH1 *
ByTriggerValue_CH1 *
byFunctionInput_CH4
BySampleRate_CH4 *
BySelectionFcn_CH4 *
ByHysteresis_CH4 *
ByTriggerSelection_CH4 *
ByTriggerValue_CH4 *
*
Input/function is exclusively supported by type EPM−T310.
· The analog module that is mounted first has the slot number 1.
· Maximally 16 analog modules can be attached.
Enable diagnostics alarm
TRUE Diagnostics alarm is enabled
Enable analog data transmission
TRUE Data transmission is enabled
Parameterise function
Default ±10V function code = 3B
^ 6−1
Select number of conversions per second
0 15 conversions
1 30 conversions
2 60 conversions
3 123 conversions
4 168 conversions
5 202 conversions
6 3.7 conversions
7 7.5 conversions
Selection
0 Selection deactivated
1 Use 2 of 3 values
2 Use 4 of 6 values
Hysteresis
0 Hysteresis deactivated
1 Hysteresis ±8
2 Hysteresis ±16
Transmission result
0 Use default settings
1 Upper limit value exceeded
2 Lower limit value not reached
3 Input value has changed by a defined value.
Value selection for a transmission event
2 Default
h
L
LenzeIOSystem.lib EN 1.7
4−5
Function library LenzeIOSystem.lib
Function blocks
4.2L_IOParAlnModule − Parameterisation function
Outputs ð(Variable type: VAR_OUTPUT)
IdentifiersData typeValue/meaning
nStateInteger
States
If a transmission error occurs during the parameterisation process or the input data
are incorrect, the parameterisation process is aborted and an error number is
indicated at output nState.
Errors are reset via an edge reversal at input bExecute or on
program restart.
0 Transmit request is executed.
The module is parameterised.
1 Transmit request dropped
Processing is running
2001 Error occurred during bus transfer
2002 Transmit request timed out
2004 Access denied
Incorrect target system: index does not exist
2005 Access denied
Incorrect target system: subindex does not exist
2013 Access denied
Incorrect target system: invalid value range
2111 Access denied
Incorrect target system: more than 4 decimal positions
specified or no fixed point format index
2117 Communication channel does not exist
byCom−Channelsetting
−10xx Incorrect value at function block input.
XX := number of the faulty input (counting direction
downwards), parameterisation impossible.
Remedy: change input value, restart data transmission
4−6
LenzeIOSystem.lib EN 1.7
L
Function library LenzeIOSystem.lib
Function blocks
4.3L_IOParAOutModule − Parameterisation function
4.3L_IOParAOutModule − Parameterisation function
By means of the L_IOParAOutModule function block, the analog output modules (EPM−T320 /
T321 / T322) are parameterised. Parameterisation is started by a high edge on the input bExecute.
Each module has four channels, whereby each channel can be set individually.
The following is provided:
· Voltage measurement
· Current measurement
The function block output indicates the transmission status.
L_IOParAOutModule
bExecute
byNodeAdr
byAnalogModuleNo
BEnableDiagnosticAlarm *
CTRL
nState
EPM-T110
EPM-T111
byFunctionOutput_CH1
byFunctionOutput_CH2
byFunctionOutput_CH3
byFunctionOutput_CH4
*
Input/function is exclusively supported by type EPM−T320.