Modicon LMC058 Motion Controller: High Speed Counting LMC058 Expert I/O Library Guide
Modicon LMC058 Motion Controller: High Speed Counting LMC058 Expert I/O Library Guide
EIO0000000554 04/2014
www.schneider-electric.com
The information provided in this documentation contains general descriptions and/or technical
characteristics of the performance of the products contained herein. This documentation is not
intended as a substitute for and is not to be used for determining suitability or reliability of these
products for specific user applications. It is the duty of any such user or integrator to perform the
appropriate and complete risk analysis, evaluation and testing of the products with respect to the
relevant specific application or use thereof. Neither Schneider Electric nor any of its affiliates or
subsidiaries shall be responsible or liable for misuse of the information contained herein. If you
have any suggestions for improvements or amendments or have found errors in this publication,
please notify us.
No part of this document may be reproduced in any form or by any means, electronic or
mechanical, including photocopying, without express written permission of Schneider Electric.
All pertinent state, regional, and local safety regulations must be observed when installing and
using this product. For reasons of safety and to help ensure compliance with documented system
data, only the manufacturer should perform repairs to components.
When devices are used for applications with technical safety requirements, the relevant
instructions must be followed.
Failure to use Schneider Electric software or approved software with our hardware products may
result in injury, harm, or improper operating results.
Failure to observe this information can result in injury or equipment damage.
© 2014 Schneider Electric. All rights reserved.
2 EIO0000000554 04/2014
Table of Contents
Safety Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
About the Book. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Part I High Speed Counter and Encoder Overview . . . . 13
Chapter 1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Expert I/O Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Add an Expert function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Embedded Expert I/O Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Hardware Encoder Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Chapter 2 High Speed Counter Overview . . . . . . . . . . . . . . . . . . . 25
Simple Type Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Main Type Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Choosing your HSC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Chapter 3 Encoder Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Standard Encoder Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Motion Encoder Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Part II One-shot Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Chapter 4 One-shot Mode Principle . . . . . . . . . . . . . . . . . . . . . . . . 37
One-shot Mode Principle Description . . . . . . . . . . . . . . . . . . . . . . . . . 37
Chapter 5 One-shot with a Simple Type . . . . . . . . . . . . . . . . . . . . 39
Synopsis Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Configuration of the Simple Type in One-shot Mode . . . . . . . . . . . . . 41
Programming the Simple Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Adjusting Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Chapter 6 One-shot With a Main Type . . . . . . . . . . . . . . . . . . . . . . 45
Synopsis Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Configuration of the Main Type in One-shot Mode . . . . . . . . . . . . . . 47
Programming the Main Type. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Adjusting Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Part III Modulo-loop Mode . . . . . . . . . . . . . . . . . . . . . . . . . 53
Chapter 7 Modulo-loop Principle . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Modulo-loop Mode Principle Description . . . . . . . . . . . . . . . . . . . . . . . 55
EIO0000000554 04/2014 3
Chapter 8 Modulo-loop with a Simple Type . . . . . . . . . . . . . . . . . 59
Synopsis Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Configuration of the Simple Type in Modulo-loop Mode . . . . . . . . . . 61
Programming the Simple Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Adjusting Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Chapter 9 Modulo-loop With a Main Type . . . . . . . . . . . . . . . . . . . 65
Synopsis Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Configuration of the Main Type in Modulo-loop Mode . . . . . . . . . . . . 67
Programming the Main Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Adjusting Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Part IV Free-large Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Chapter 10 Free-large Mode Principle . . . . . . . . . . . . . . . . . . . . . . . 75
Free-large Mode Principle Description. . . . . . . . . . . . . . . . . . . . . . . . . 76
Limits Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Chapter 11 Free-large With a Main Type . . . . . . . . . . . . . . . . . . . . . 81
Synopsis Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Configuration of the Main Type in Free-large Mode . . . . . . . . . . . . . . 83
Programming the Main Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Adjusting Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Part V Event Counting Mode . . . . . . . . . . . . . . . . . . . . . . 89
Chapter 12 Event Counting Principle . . . . . . . . . . . . . . . . . . . . . . . 91
Event Counting Mode Principle Description. . . . . . . . . . . . . . . . . . . . 91
Chapter 13 Event Counting With a Main Type . . . . . . . . . . . . . . . . 93
Synopsis Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Configuration of the Main Type in Event Counting Mode . . . . . . . . . 95
Programming the Main Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Adjusting Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Part VI Frequency Meter Type . . . . . . . . . . . . . . . . . . . . . . 101
Chapter 14 Frequency Meter Principle . . . . . . . . . . . . . . . . . . . . . . 103
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Chapter 15 Frequency Meter Type . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Synopsis Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Adjusting Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Part VII Period Meter Type . . . . . . . . . . . . . . . . . . . . . . . . . 113
Chapter 16 Period Meter Type Principle . . . . . . . . . . . . . . . . . . . . . 115
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
4 EIO0000000554 04/2014
Chapter 17 Period Meter Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Synopsis Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Part VIII Encoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Chapter 18 Incremental Mode With an Encoder . . . . . . . . . . . . . . . 125
18.1 Incremental Mode Principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Incremental Mode Principle Description. . . . . . . . . . . . . . . . . . . . . . . 126
18.2 Standard Encoder on an Expert I/O Module . . . . . . . . . . . . . . . . . . . 130
Synopsis Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Configuration of the Standard Encoder on an Expert I/O Module . . 132
Programming the Standard Encoder . . . . . . . . . . . . . . . . . . . . . . . . . 135
Adjusting Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
18.3 Standard Encoder on the Encoder Interface . . . . . . . . . . . . . . . . . . 139
Synopsis Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Configuration of the Standard Encoder on the Encoder Interface . . 141
Programming the Standard Encoder . . . . . . . . . . . . . . . . . . . . . . . . . 144
Adjusting Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
18.4 Motion Encoder on an Expert I/O Module. . . . . . . . . . . . . . . . . . . . . 148
Synopsis Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Configuration of the Motion Encoder on an Expert I/O Module . . . . 150
18.5 Motion Encoder on the Encoder Interface . . . . . . . . . . . . . . . . . . . . 152
Synopsis Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Configuration of the Motion Encoder on the Encoder Interface . . . . 154
Chapter 19 SSI Mode With an Encoder . . . . . . . . . . . . . . . . . . . . . . 157
19.1 SSI Principle Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
SSI Mode Principle Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
19.2 Standard Encoder in SSI Mode on an Encoder Interface. . . . . . . . . 160
Standard Encoder Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Configuration of the Standard Encoder on an Encoder Interface . . . 162
Programming the Standard Encoder . . . . . . . . . . . . . . . . . . . . . . . . . 164
19.3 Motion Encoder in SSI Mode on the Encoder Interface . . . . . . . . . . 167
Motion Encoder Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
Configuration of the Motion Encoder on the Encoder Interface . . . . 169
EIO0000000554 04/2014 5
Part IX Optional Functions . . . . . . . . . . . . . . . . . . . . . . . . 171
Chapter 20 Comparison Function . . . . . . . . . . . . . . . . . . . . . . . . . . 173
20.1 Comparison with a Main Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
Comparison Principle with a Main type or an Encoder . . . . . . . . . . . . 175
Configuration of the Comparison on a Main Type or an Encoder. . . . 179
External Event Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Chapter 21 Capture Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
21.1 Capture with a Main Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
Capture Principle with a Main Type . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Configuration of the Capture on a Main Type . . . . . . . . . . . . . . . . . . . 186
21.2 Capture with an Encoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
Capture with an Encoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Configuration of the Capture on an Encoder. . . . . . . . . . . . . . . . . . . . 191
Chapter 22 Preset and Enable Functions . . . . . . . . . . . . . . . . . . . . 193
Preset Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Free-large or Period Meter Preset Conditions . . . . . . . . . . . . . . . . . . . 196
Enable Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
Appendices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Appendix A General Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Dedicated Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
General Information on Administrative and Motion Function Block
Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
Appendix B Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
IMMEDIATE_ERR_TYPE: Type for Error Variable of the GetImmediat-
eValue Function Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
MC_IMMEDIATE_ERR_TYPE: Type for Error Variable of the
MC_GetImmediateValue_LMC058 Function Block . . . . . . . . . . . . . . . 207
EXPERT_ERR_TYPE: Type for Error Variable of EXPERT Function
Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
EXPERT_PARAMETER_TYPE: Type for Parameters to Get or to Set
on EXPERTFunction Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
EXPERT_REF: EXPERT Reference Value . . . . . . . . . . . . . . . . . . . . . 210
EXPERT_TIMEBASE_TYPE: Type for HSC Time Base Variable . . . . 211
Appendix C Function Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
C.1 LMC058 Motion Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
MC_GetImmediateValue_LMC058: Read Counter Value of a
MotionEncoder Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
MC_Reset_LMC058: Clear the Detected Error on the SoftMotion
Encoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
6 EIO0000000554 04/2014
C.2 LMC058 EXPERT IO Library. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
EXPERTGetImmediateValue: Read Counter Value of HSC or Encoder
Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
EXPERTGetCapturedValue: Returns Content of Capture Registers . 222
EXPERTGetDiag: Provides Detail of Detected Error on a Principal
EXPERT I/O Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
EXPERTGetParam: Returns Parameters of Principal EXPERT I/O
Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
EXPERTSetParam: Adjust Parameters of a HSC . . . . . . . . . . . . . . . . 229
Encoder_LMC058: Encoder Function Block . . . . . . . . . . . . . . . . . . . . 231
HSCMain_LMC058: HSC Main Function Block. . . . . . . . . . . . . . . . . . 234
HSCSimple_LMC058: HSC Simple Function Block . . . . . . . . . . . . . . 238
Appendix D Function and Function Block Representation . . . . . . 241
Differences Between a Function and a Function Block . . . . . . . . . . . . 242
How to Use a Function or a Function Block in IL Language . . . . . . . . 243
How to Use a Function or a Function Block in ST Language . . . . . . . 246
Glossary ......................................... 249
Index ......................................... 255
EIO0000000554 04/2014 7
8 EIO0000000554 04/2014
Safety Information
Important Information
NOTICE
Read these instructions carefully, and look at the equipment to become familiar with the device
before trying to install, operate, or maintain it. The following special messages may appear
throughout this documentation or on the equipment to warn of potential hazards or to call attention
to information that clarifies or simplifies a procedure.
EIO0000000554 04/2014 9
PLEASE NOTE
Electrical equipment should be installed, operated, serviced, and maintained only by qualified
personnel. No responsibility is assumed by Schneider Electric for any consequences arising out of
the use of this material.
A qualified person is one who has skills and knowledge related to the construction and operation
of electrical equipment and its installation, and has received safety training to recognize and avoid
the hazards involved.
10 EIO0000000554 04/2014
About the Book
At a Glance
Document Scope
This documentation will acquaint you with the High Speed Counter (HSC) and Encoder functions
and variables offered within the LMC058 controller.
This documentation describes the functions and variables of the LMC058 HSC and Encoder
library.
In order to use this manual, you must:
Have a thorough understanding of the LMC058, including its design, functionality, and
implementation within control systems.
Be proficient in the use of the following IEC 61131-3 PLC programming languages:
Function Block Diagram (FBD)
Ladder Diagram (LD)
Structured Text (ST)
Instruction List (IL)
Sequential Function Chart (SFC)
Only DM72F• expert module and Encoder module can be used with the LMC058 HSC and Encoder
library.
Validity Note
This document has been updated with the release of SoMachine V4.1.
Related Documents
EIO0000000554 04/2014 11
Title of Documentation Reference Number
Modicon LMC058 Logic Controller Hardware Guide EIO0000000438 (Eng),
EIO0000000439 (Fre),
EIO0000000440 (Ger),
EIO0000000441 (Spa),
EIO0000000442 (Ita),
EIO0000000443 (Chs)
You can download these technical publications and other technical information from our website
at www.schneider-electric.com.
WARNING
LOSS OF CONTROL
The designer of any control scheme must consider the potential failure modes of control paths
and, for certain critical control functions, provide a means to achieve a safe state during and
after a path failure. Examples of critical control functions are emergency stop and overtravel
stop, power outage and restart.
Separate or redundant control paths must be provided for critical control functions.
System control paths may include communication links. Consideration must be given to the
implications of unanticipated transmission delays or failures of the link.
Observe all accident prevention regulations and local safety guidelines.1
Each implementation of this equipment must be individually and thoroughly tested for proper
operation before being placed into service.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
1For additional information, refer to NEMA ICS 1.1 (latest edition), "Safety Guidelines for the
Application, Installation, and Maintenance of Solid State Control" and to NEMA ICS 7.1 (latest
edition), "Safety Standards for Construction and Guide for Selection, Installation and Operation of
Adjustable-Speed Drive Systems" or their equivalent governing your particular location.
WARNING
UNINTENDED EQUIPMENT OPERATION
Only use software approved by Schneider Electric for use with this equipment.
Update your application program every time you change the physical hardware configuration.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
12 EIO0000000554 04/2014
Modicon LMC058 Motion Controller
High Speed Counter and Encoder Overview
EIO0000000554 04/2014
Part I
High Speed Counter and Encoder Overview
Overview
This part provides an overview description, available modes, functionality and performances of the
different HSC types and encoder types.
EIO0000000554 04/2014 13
High Speed Counter and Encoder Overview
14 EIO0000000554 04/2014
Modicon LMC058 Motion Controller
Introduction
EIO0000000554 04/2014
Chapter 1
Introduction
Introduction
EIO0000000554 04/2014 15
Introduction
Introduction
The controller base provides:
2 embedded expert I/O modules (DM72F0 and DM72F1) with:
5 fast inputs
2 regular inputs
2 fast outputs
1 Hardware Encoder port that can support:
Incremental encoder
Parameter Function
Run/Stop Input Define one input to be used as Run/Stop input (see page 17).
Alarm Output Define one output to be used as alarm output (see page 17).
Rearming Output Mode Define the rearming output mode (see page 18).
16 EIO0000000554 04/2014
Introduction
Run/Stop Input
This table presents the different states:
NOTE: Run/Stop input is managed even if the option Update IO while in stop is not selected in
the PLC settings tab (see Modicon LMC058 Motion Controller, Programming Guide).
Inputs assigned to configured expert functions can not be configured as Run/Stop.
For further details about controller states and states transitions, refer to Controller State Diagram
(see Modicon LMC058 Motion Controller, Programming Guide).
WARNING
UNINTENDED MACHINE OR PROCESS START-UP
Be sure the state of security of your machine or process environment before applying power
to the Run/Stop input.
Use the Run/Stop input to help prevent the unintentional start-up from a remote location.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
Alarm Output
This output is set logical 1 when the controller is in the RUNNING state and the application program
is not stopped at a breakpoint.
Outputs assigned to configured expert functions can not be configured as the Alarm output.
NOTE:
The alarm output is set to 0 when:
a task is stopped at a breakpoint, the alarm output signals that the controller has stopped
executing the application.
an error is detected on the expert I/O (power interruption, short-circuit detection).
EIO0000000554 04/2014 17
Introduction
WARNING
UNINTENDED MACHINE START-UP
Inhibit the automatic rearming of outputs if this feature is an undesirable behavior for your
machine or process.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
18 EIO0000000554 04/2014
Introduction
Introduction
Each DM72F• expert module can support expert functions. Expert functions are defined as either
simple or complex. Only one type can be configured per module:
simple functions:
High Speed Counter Simple
Event_Latch I/O
complex functions:
High Speed Counter Main
Encoder
Frequency Generator (FG)
Pulse Width Modulation (PWM)
When an I/O is not used by an expert function, it can be used as a regular I/O.
NOTE:
When a regular input is used as Run/Stop, it can not be used by an expert function.
When a regular output is used as Alarm, it can not be used by an expert function.
For more details, refer to Embedded expert I/O Configuration (see page 16).
EIO0000000554 04/2014 19
Introduction
DM72F0 Up to 4 1 1 1 1 1
DM72F1 Up to 4 1 1 1 1 1
Encoder Not allowed Not allowed 1 1 Not Not allowed
allowed
For more details, refer to Expert I/O Mapping (see page 22).
20 EIO0000000554 04/2014
Introduction
When inputs are used in expert functions (Latch, HSC,…), integrator filter is replaced by anti-
bounce filter (see Modicon LMC058, Motion Controller, Hardware Guide). Filter value will be
configured in expert function screen.
EIO0000000554 04/2014 21
Introduction
I0 I1 I2 I3 I4 I5 Q0 Q1
Event_Latch 0/4 Input M
Event_Latch 1/5 Input M
Event_Latch 2/6 Input M
Event_Latch 3/7 Input M
HSC Simple 0/4 Input A M
HSC Simple 1/5 Input A M
HSC Simple 2/6 Input A M
HSC Simple 3/7 Input A M
HSC Main 0/1 Input A M
Input B C
SYNC C
CAP C
EN C
REF C
Outputs C C
PWM 0/1 Outputs M
SYNC C
EN C
Frequency Generator 0/1 Outputs M
SYNC C
EN C
Standard Encoder Input A M
Input B M
SYNC C
CAP C
EN C
REF C
Outputs C C
M Mandatory
C Depends on Configuration
22 EIO0000000554 04/2014
Introduction
I0 I1 I2 I3 I4 I5 Q0 Q1
Motion Encoder Input A M
Input B M
Input Z M
CAP C
M Mandatory
C Depends on Configuration
IO Summary
The IO Summary window displays the DM72F• I/O and the I/O used by expert functions.
The IO Summary window is accessible from DM72F• nodes:
Step Action
1 In the Devices tree tab, expand the Expert node.
2 Right-click DM72F• and select IO Summary in context menu.
Example of IO Summary:
EIO0000000554 04/2014 23
Introduction
Introduction
The controller has a specific hardware encoder interface that can support:
Incremental encoder
SSI absolute encoder
Encoder function
The goal of this function is to connect an encoder to acquire a position so that it can be used as
Master Axis for motion drives on CAN.
This function can be implemented on an Embedded Expert I/O interface and a hardware Encoder
interface. The Encoder can be Incremental or absolute SSI on a hardware Encoder interface. The
Embedded Expert I/O interface supports only an Incremental Encoder.
You can configure a linear or rotary axis for incremental encoder.
I/O mapping
Input of Embedded Expert I/O modules (DM72F•) used by standard encoder function:
DM72F0 I6 DM72F1 I6
CAP0 C
CAP1 C
EN C
REF C
Input of Embedded Expert I/O modules (DM72F•) used by Motion encoder function:
DM72F0 I6 DM72F1 I6
CAP0 C
CAP1 C
C = depends on configuration
24 EIO0000000554 04/2014
Modicon LMC058 Motion Controller
High Speed Counter Overview
EIO0000000554 04/2014
Chapter 2
High Speed Counter Overview
Overview
This chapter provides a main description of the different types of High Speed Counters.
EIO0000000554 04/2014 25
High Speed Counter Overview
Overview
The Simple type is a single input counter.
Any operation on the counter (enable, sync) and any action triggered (when count value is
reached) is executed in the context of a task.
With the Simple type, you cannot trigger an event or a reflex output.
Performance
The maximum frequency admissible on an Expert I/O interface is 100 kHz.
26 EIO0000000554 04/2014
High Speed Counter Overview
Overview
The Main type is a counter that uses up to 6 fast inputs and 2 reflex outputs.
Optional Features
Optional features can be configured depending on the selected mode:
hardware inputs to operate the counter (enable, preset) or capture the current counting value
up to 4 thresholds
up to 4 events (1 by threshold) can be associated with external tasks
up to 2 reflex outputs
Performance
The maximum frequency admissible on an Expert I/O interface is 100 kHz.
EIO0000000554 04/2014 27
High Speed Counter Overview
HSC Matrix
The table below provides an overview of all the HSC available with their specifications according
to the mode requested:
28 EIO0000000554 04/2014
High Speed Counter Overview
EIO0000000554 04/2014 29
High Speed Counter Overview
30 EIO0000000554 04/2014
Modicon LMC058 Motion Controller
Encoder Overview
EIO0000000554 04/2014
Chapter 3
Encoder Overview
Encoder Overview
Overview
This chapter provides a general overview of the encoders.
EIO0000000554 04/2014 31
Encoder Overview
Overview
The goal of this function is to connect an encoder to acquire a position.
This function can be installed on the embedded Expert I/O module (DM72F0 and DM72F1) and
the Encoder interface (Sub-D).
On the Encoder interface, the power supply is monitored. A power supply error detected is cleared
automatically when the power supply recovers.
Optional Feature
Optional features can be configured depending on the selected mode:
hardware inputs to operate the counter (enable, preset) or capture the current counting value
up to 4 thresholds
up to 4 events (1 by threshold) can be associated with external tasks
up to 2 reflex outputs
Performance
Maximum admissible frequency:
Expert I/O module: 100 kHz.
Encoder interface: 200 kHz.
32 EIO0000000554 04/2014
Encoder Overview
General
The goal of this function is to connect an encoder to acquire a position. This function can be used
as Master Axis for motion drives on CANmotion.
This function can be implemented on the Expert I/O module (DM72F0 and DM72F1) and the
Encoder interface (Sub-D).
The Motion Encoder configuration is split in 2 parts:
A hardware part: Motion Encoder; described in this document.
A software part: SoftMotion encoder; described in the online help CoDeSys part,
Editors/Devices Editors/SoftMotion Device Editor.
The Motion Encoder is managed by function blocks from the LMC058 Motion library and
SoftMotion (See online help Programming with SoMachine part, SoftMotion/Programming
Interface/SoftMotion Libraries/SM3_Basic_library).
On the Encoder interface, the power supply is monitored. A power supply error detected
(SMC_DI_VOLTAGE_DISABLED) is cleared automatically when the power supply recovers.
Optional Feature
In addition, the Motion Encoder provides a capture function.
Performance
Maximum admissible frequency:
Expert I/O module: 100 kHz.
Encoder interface: 200 kHz.
EIO0000000554 04/2014 33
Encoder Overview
34 EIO0000000554 04/2014
Modicon LMC058 Motion Controller
One-shot Mode
EIO0000000554 04/2014
Part II
One-shot Mode
One-shot Mode
Overview
This part describes the use of a HSC in One-shot Mode.
EIO0000000554 04/2014 35
One-shot Mode
36 EIO0000000554 04/2014
Modicon LMC058 Motion Controller
One-shot Mode Principle
EIO0000000554 04/2014
Chapter 4
One-shot Mode Principle
Overview
The counter is activated by a synchronization edge, and the preset value is loaded.
When counting is enabled, each pulse applied to the input decrements the current value. The
counter stops when its current value reaches 0.
The counter value remains at 0 even if new pulses are applied to the input.
A new synchronization is needed to activate the counter again.
Principle Diagram
1
Sync Condition
2 4
Enable Condition
Preset Value
Counter Current Value
3 Time
0
EIO0000000554 04/2014 37
One-shot Mode Principle
Stage Action
1 On the rising edge of the Sync condition, the preset value is loaded in the counter
(regardless of the current value) and the counter is activated.
2 When Enable condition = 1, the current counter value decrements on each pulse on
input A until it reaches 0.
3 The counter waits until the next rising edge of the Sync condition.
Note: At this point, pulses on input A have no effect on the counter.
4 When Enable condition = 0, the counter ignores the pulses from input A and retains
its current value until the Enable condition again = 1. The counter resumes counting
pulses from input A on the rising edge of the Enable input from the held value.
NOTE: Enable and Sync conditions depends on configuration. These are described in the Enable
(see page 198) and Preset (see page 194) function.
38 EIO0000000554 04/2014
Modicon LMC058 Motion Controller
One-shot With a Simple Type
EIO0000000554 04/2014
Chapter 5
One-shot with a Simple Type
Overview
This chapter describes how to implement a High Speed Counter in One-shot mode using a Simple
type.
EIO0000000554 04/2014 39
One-shot With a Simple Type
Synopsis Diagram
Synopsis Diagram
This diagram provides an overview of the Simple type in One-shot mode:
A is the counting input of the High Speed Counter. Simple type counting for One-shot mode
only counts up.
40 EIO0000000554 04/2014
One-shot With a Simple Type
Configuration Procedure
Follow this procedure to configure a Simple type in One-shot mode:
Step Action
1 Double-click Expert →DM72F• →HSCSimple•.
2 Select the HSC Simple Configuration tab.
3 Set the value of the General →Counting Mode parameter to One-Shot.
4 Select the value of the Counting inputs →A input →Bounce filter parameter.
5 Enter the value of the Range →Preset parameter.
NOTE: The IO Summary window displays the DM72F• I/O mapping. You can see the I/O used by
expert function.
Programmable Filter
The filtering value on the Simple type input determines the counter maximum frequency as shown
in the table:
EIO0000000554 04/2014 41
One-shot With a Simple Type
Overview
A Simple type is always managed by an HSCSimple (see page 238) function block.
NOTE: At build, a detected error code is given if the HSCSimple function block is used to manage
a different HSC type.
Step Description
1 Select the Libraries tab in the Software Catalog and click Libraries.
Select Controller →LMC058 →LMC058 Expert IO →HSC →HSCSimple_LMC058 in the list,
drag-and-drop the item onto the POU window.
2 Type the Simple type instance name (defined in configuration) or select the function block
instance by clicking:
Using the input assistant, the HSC instance can be selected at the following path: Global
Variables →<MyController> →PLC Logic →IoConfig_Globals.
42 EIO0000000554 04/2014
One-shot With a Simple Type
EIO0000000554 04/2014 43
One-shot With a Simple Type
Adjusting Parameters
Overview
The list of parameters described in the table can be read or modified by using the
EXPERTGetParam (see page 227) or EXPERTSetParam (see page 229) function blocks.
NOTE: Parameters set via the program override the parameters values configured in the HSC
configuration window. Initial configuration parameters are restored on cold or warm start
(see Modicon LMC058 Motion Controller, Programming Guide).
Adjustable Parameters
This table provides the list of parameters from the EXPERT_PARAMETER_TYPE (see page 209)
that can be read or modified while the program is running:
Parameter Description
EXPERT_PRESET to get or set the Preset value of an HSC
44 EIO0000000554 04/2014
Modicon LMC058 Motion Controller
One-shot With a Main Type
EIO0000000554 04/2014
Chapter 6
One-shot With a Main Type
Overview
This chapter describes how to implement a High Speed Counter in One-shot mode using a Main
type.
EIO0000000554 04/2014 45
One-shot With a Main Type
Synopsis Diagram
Synopsis Diagram
This diagram provides an overview of the Main type in One-shot mode:
Optional Function
In addition to the One-shot mode, the Main type can provide the following functions:
Comparison function (see page 173)
Capture function (see page 183)
Preset function (see page 194)
Enable function (see page 198)
46 EIO0000000554 04/2014
One-shot With a Main Type
Configuration Procedure
Follow this procedure to configure a Main type in One-shot mode:
Step Action
1 Double-click Expert →DM72F• →HSCMain.
2 Select the HSC Main Configuration tab.
3 Set the value of the General →Counting Mode parameter to One-Shot.
4 Select the value of the Counting inputs →A input →Bounce filter parameter.
5 Enter the value of the Range →Preset parameter.
6 Optionally, select the value of the SYNC, EN and CAP auxiliary inputs from the from the drop-
down menu, to enable the preset function (see page 194), Enable function (see page 198) and
Capture function (see page 184) with a physical input.
7 Optionally, select the Number of thresholds. This enables the Compare function and reflex
outputs can be configured (see page 173).
8 When Stop Event is set to Yes, the external event (BLOCK0_HSCSTOP or BLOCK1_HSCSTOP)
must be used to trigger an external task (see page 180).
NOTE: The IO Summary window displays the DM72F• I/O mapping. You can see the I/O used by
expert function.
Programmable Filter
The filtering value on the Main type input determines the counter maximum frequency as shown
in the table below:
EIO0000000554 04/2014 47
One-shot With a Main Type
Overview
Main type is always managed by an HSCMain function block.
NOTE: At build, a detected error code is given if the HSCMain function block is used to manage a
different HSC type.
Step Description
1 Select the Libraries tab in the Software Catalog and click Libraries.
Select Controller →LMC058 →LMC058 Expert IO →HSC →HSCMain_LMC058 in the list,
drag-and-drop the item onto the POU window.
2 Type the Main type instance name (defined in configuration) or select the function block
instance by clicking:
Using the input assistant, the HSC instance can be selected at the following path: Global
Variables →<MyController> →PLC Logic →IoConfig_Globals.
48 EIO0000000554 04/2014
One-shot With a Main Type
EN_Out0 BOOL TRUE = enables physical output Output0 to echo the Reflex0 value (if
configured).
EN_Out1 BOOL TRUE = enables physical output Output1 to echo the Reflex1 value (if
configured).
F_Enable BOOL Forces the Enable condition (see page 198).
F_Preset BOOL Forces the Preset condition (see page 194).
F_Out0 BOOL TRUE = forces Output0 to 1 (if Reflex0 is configured).
F_Out1 BOOL TRUE = forces Output1 to 1 (if Reflex1 is configured).
ACK_Modulo BOOL On rising edge, resets modulo-flag.
ACK_Preset BOOL On rising edge, resets Preset_Flag.
ACK_Cap BOOL On rising edge, resets Cap_Flag.
SuspendCompare BOOL TRUE = compare results are suspended:
TH0, TH1, TH2, TH3 , Reflex0, Reflex1, Out0, Out1 output bits of
the block maintain their last value.
Physical Outputs Output0 and Output1 maintain their last value.
Events are masked.
EIO0000000554 04/2014 49
One-shot With a Main Type
50 EIO0000000554 04/2014
One-shot With a Main Type
Adjusting Parameters
Overview
The list of parameters described in the table can be read or modified by using the
EXPERTGetParam (see page 227) or EXPERTSetParam (see page 229) function blocks.
NOTE: Parameters set via the program override the parameters values configured in the HSC
configuration window. Initial configuration parameters are restored on cold or warm start
(see Modicon LMC058 Motion Controller, Programming Guide).
Adjustable Parameters
This table provides the list of parameters from the EXPERT_PARAMETER_TYPE (see page 209)
which can be read or modified while the program is running:
Parameter Description
EXPERT_PRESET to get or set the Preset value of an HSC
EXPERT_THRESHOLD0 to get or set the Threshold 0 value of an HSC
EXPERT_THRESHOLD1 to get or set the Threshold 1 value of an HSC
EXPERT_THRESHOLD2 to get or set the Threshold 2 value of an HSC
EXPERT_THRESHOLD3 to get or set the Threshold 3 value of an HSC
EXPERT_REFLEX0 to get or set output 0 reflex mode of an EXPERT function
EXPERT_REFLEX1 to get or set output 0 reflex mode of an EXPERT function
EIO0000000554 04/2014 51
One-shot With a Main Type
52 EIO0000000554 04/2014
Modicon LMC058 Motion Controller
Modulo-loop Mode
EIO0000000554 04/2014
Part III
Modulo-loop Mode
Modulo-loop Mode
Overview
This part describes the use of a HSC in Modulo-loop mode.
EIO0000000554 04/2014 53
Modulo-loop Mode
54 EIO0000000554 04/2014
Modicon LMC058 Motion Controller
Modulo-loop Principle
EIO0000000554 04/2014
Chapter 7
Modulo-loop Principle
Modulo-loop Principle
Overview
The Modulo-loop mode can be used for repeated actions on a series of moving objects, such as
packaging and labeling applications.
Principle
On a rising edge of the Sync condition (see page 194), the counter is activated and the current
value is reset to 0.
When counting is enabled (see page 198):
Incrementing direction: the counter increments until it reaches the modulo value. At the next
pulse, the counter is reset to 0, a modulo flag is set to 1, and the counting continues.
Decrementing direction: the counter decrements until it reaches 0. At the next pulse, the counter
is set to the modulo value, a modulo flag is set to 1, and the counting continues.
Input Modes
This table shows the 8 types of input modes available:
Reverse Quadrature X2
Reverse Quadrature X4
EIO0000000554 04/2014 55
Modulo-loop Principle
B
1 4 8
5
Sync Condition
Enable Condition
2 3
Modulo Value
7
Time
0 6
Stage Action
1 On the rising edge of Sync condition, the current value is reset to 0 and the counter
is activated.
2 When Enable condition = 1, each pulses on A increments the counter value.
3 When the counter reaches the (modulo-1) value, the counter loops to 0 at the next
pulse and the counting continues. Modulo_Flag is set to 1.
4 On the rising edge of Sync condition, the current counter value is reset to 0.
5 When Enable condition = 1, each pulse on B decrements the counter.
6 When the counter reaches 0, the counter loops to (modulo-1) at the next pulse and
the counting continues.
7 When Enable condition = 0, the pulses on the inputs are ignored.
8 On the rising edge of Sync condition, the current counter value is reset to 0.
NOTE: Enable and Sync conditions depends on configuration. These are described in the Enable
(see page 198) and Preset (see page 194) function.
56 EIO0000000554 04/2014
Modulo-loop Principle
Normal Quadrature X1 -1 0 1 2 3 2 1 0 -1
Normal Quadrature X2 -1 0 1 2 3 4 5 6 7 6 5 4 3 2 1 0 -1
Normal Quadrature X4 -1 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 15 1 1 1 1 1 9 8 7 6 5 4 3 2 1 0 -1
0 1 2 3 4 4 3 2 1 0
Reverse Quadrature X1 3 2 1 0 -1 0 1 2 3
Reverse Quadrature X2 7 6 5 4 3 2 1 0 -1 0 1 2 3 4 5 6 7
Reverse Quadrature X4 15 1 1 1 1 1 9 8 7 6 5 4 3 2 1 0 -1 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 15
43 2 1 0 0 1 2 3 4
EIO0000000554 04/2014 57
Modulo-loop Principle
58 EIO0000000554 04/2014
Modicon LMC058 Motion Controller
Modulo-loop with a Simple Type
EIO0000000554 04/2014
Chapter 8
Modulo-loop with a Simple Type
Overview
This chapter describes how to implement a High Speed Counter in Modulo-loop mode using a
Simple type.
EIO0000000554 04/2014 59
Modulo-loop with a Simple Type
Synopsis Diagram
Synopsis Diagram
This diagram provides an overview of the Simple type in Modulo-loop mode:
60 EIO0000000554 04/2014
Modulo-loop with a Simple Type
Configuration Procedure
Follow this procedure to configure a Simple type in Modulo-loop mode:
Step Action
1 Double-click Expert →DM72F• →HSCSimple•.
2 Select the HSC Simple Configuration tab.
3 Set the value of the General →Counting Mode parameter to Modulo-loop.
4 Select the value of the Counting inputs →A input →Bounce filter parameter.
5 Enter the value of the Range →Modulo parameter.
NOTE: The IO Summary window displays the DM72F• I/O mapping. You can see the I/O used by
expert function.
Programmable Filter
The filtering value on the Simple type input determines the counter maximum frequency as shown
in this table:
EIO0000000554 04/2014 61
Modulo-loop with a Simple Type
Overview
A Simple type is always managed by an HSCSimple (see page 238) function block.
NOTE: At build, a detected error code is given if the HSCSimple function block is used to manage
a different HSC type.
Step Description
1 Select the Libraries tab in the Software Catalog and click Libraries.
Select Controller →LMC058 →LMC058 Expert IO →HSC →HSCSimple_LMC058 in the list,
drag-and-drop the item onto the POU window.
2 Type the Simple type instance name (defined in configuration) or select the function block
instance by clicking:
Using the input assistant, the HSC instance can be selected at the following path: Global
Variables →<MyController> →PLC Logic →IoConfig_Globals.
62 EIO0000000554 04/2014
Modulo-loop with a Simple Type
EIO0000000554 04/2014 63
Modulo-loop with a Simple Type
Adjusting Parameters
Overview
The list of parameters described in the table can be read or modified by using the
EXPERTGetParam (see page 227) or EXPERTSetParam (see page 229) function blocks.
NOTE: Parameters set via the program override the parameters values configured in the HSC
configuration window. Initial configuration parameters are restored on cold or warm start
(see Modicon LMC058 Motion Controller, Programming Guide).
Adjustable Parameters
This table provides the list of parameters from the EXPERT_PARAMETER_TYPE (see page 209)
that can be read or modified while the program is running:
Parameter Description
EXPERT_MODULO to get or set the modulo value of an HSC
64 EIO0000000554 04/2014
Modicon LMC058 Motion Controller
Modulo-loop With a Main Type
EIO0000000554 04/2014
Chapter 9
Modulo-loop With a Main Type
Overview
This chapter describes how to implement a High Speed Counter in Modulo-loop mode using a
Main type.
EIO0000000554 04/2014 65
Modulo-loop With a Main Type
Synopsis Diagram
Synopsis Diagram
This diagram provides an overview of the Main type in Modulo-loop mode:
Optional Function
In addition to the Modulo-loop mode, the Main type can provide the following functions:
Comparison function (see page 173)
Capture function (see page 183)
Preset function (see page 194)
Enable function (see page 198)
66 EIO0000000554 04/2014
Modulo-loop With a Main Type
Configuration Procedure
Follow this procedure to configure a Main type in Modulo-loop mode:
Step Action
1 Double-click Expert →DM72F• →HSCMain.
2 Select the HSC Main Configuration tab.
3 Set the value of the General →Counting Mode parameter to Modulo-loop.
4 Select the value of the General →Input Mode parameter.
5 Select the value of the Counting inputs →A input →Bounce filter parameter.
If necessary, select the value of the Counting inputs →B input →Bounce filter parameter.
6 Enter the value of the Range →Modulo parameter.
7 Optionnally, you can enable these functions:
capture function (see page 183)
comparison function (see page 173)
enable function (see page 198)
preset function (see page 194)
NOTE: The IO Summary window displays the DM72F• I/O mapping. You can see the I/O used by
expert function.
Programmable Filter
The filtering value on the Main type input determines the counter maximum frequency as shown
in this table:
EIO0000000554 04/2014 67
Modulo-loop With a Main Type
Input Parameter
The value of the Input mode parameter determines the counting behavior:
Normal Quadrature X1 A physical encoder always provides 2 signals 90° shift that first allows the
counter to count pulses and detect direction
1 count by encoder cycle
Normal Quadrature X2 A physical encoder always provides 2 signals 90° shift that first allows the
counter to count pulses and detect direction
2 counts by encoder cycle
Normal Quadrature X4 A physical encoder always provides 2 signals 90° shift that first allows the
counter to count pulses and detect direction
4 counts by encoder cycle
Reverse Quadrature X1 A physical encoder always provides 2 signals 90° shift that first allows the
counter to count pulses and detect direction
1 count by encoder cycle
Reverse Quadrature X2 A physical encoder always provides 2 signals 90° shift that first allows the
counter to count pulses and detect direction
2 counts by encoder cycle
Reverse Quadrature X4 A physical encoder always provides 2 signals 90° shift that first allows the
counter to count pulses and detect direction
4 counts by encoder cycle
68 EIO0000000554 04/2014
Modulo-loop With a Main Type
Overview
Main type is always managed by an HSCMain function block.
NOTE: At build, a detected error code is given if the HSCMain function block is used to manage a
different HSC type.
Step Description
1 Select the Libraries tab in the Software Catalog and click Libraries.
Select Controller →LMC058 →LMC058 Expert IO →HSC →HSCMain_LMC058 in the list,
drag-and-drop the item onto the POU window.
2 Type the Main type instance name (defined in configuration) or select the function block
instance by clicking:
Using the input assistant, the HSC instance can be selected at the following path: Global
Variables →<MyController> →PLC Logic →IoConfig_Globals.
EIO0000000554 04/2014 69
Modulo-loop With a Main Type
EN_Out0 BOOL TRUE = enables physical output Output0 to echo the Reflex0 value (if
configured).
EN_Out1 BOOL TRUE = enables physical output Output1 to echo the Reflex1 value (if
configured).
F_Enable BOOL Forces the Enable condition (see page 198). Takes priority over
EN_Enable input.
F_Preset BOOL Forces the Preset condition (see page 194). Takes priority over
EN_Preset input.
F_Out0 BOOL TRUE = forces Output0 to 1 (if Reflex0 is configured in SoMachine
HSC Embedded Functions). Takes priority over EN_Out0.
F_Out1 BOOL TRUE = forces Output1 to 1 (if Reflex1 is configured in SoMachine
HSC Embedded Functions). Takes priority over EN_Out1.
ACK_Modulo BOOL On rising edge, resets Modulo_Flag.
ACK_Preset BOOL On rising edge, resets Preset_Flag.
ACK_Cap BOOL On rising edge, resets Cap_Flag.
SuspendCompare BOOL TRUE = compare results are suspended:
TH0, TH1, TH2, TH3 , Reflex0, Reflex1, Out0, Out1 output bits of
the block maintain their last value.
Physical Outputs Output0 and Output1 maintain their last value.
Events are masked.
70 EIO0000000554 04/2014
Modulo-loop With a Main Type
EIO0000000554 04/2014 71
Modulo-loop With a Main Type
Adjusting Parameters
Overview
The list of parameters described in the table can be read or modified by using the
EXPERTGetParam (see page 227) or EXPERTSetParam (see page 227) function blocks.
NOTE: Parameters set via the program override the parameters values configured in the HSC
configuration window. Initial configuration parameters are restored on cold or warm start
(see Modicon LMC058 Motion Controller, Programming Guide).
Adjustable Parameters
This table provides the list of parameters from the EXPERT_PARAMETER_TYPE (see page 209)
that can be read or modified while the program is running:
Parameter Description
EXPERT_MODULO to get or set the Modulo value of an HSC
EXPERT_THRESHOLD0 to get or set the Threshold 0 value of an HSC
EXPERT_THRESHOLD1 to get or set the Threshold 1 value of an HSC
EXPERT_THRESHOLD2 to get or set the Threshold 2 value of an HSC
EXPERT_THRESHOLD3 to get or set the Threshold 3 value of an HSC
EXPERT_REFLEX0 to get or set output 0 reflex mode of an EXPERT function
EXPERT_REFLEX1 to get or set output 0 reflex mode of an EXPERT function
72 EIO0000000554 04/2014
Modicon LMC058 Motion Controller
Free-large Mode
EIO0000000554 04/2014
Part IV
Free-large Mode
Free-large Mode
Overview
This part describes the use of an HSC in Free-large mode.
EIO0000000554 04/2014 73
Free-large Mode
74 EIO0000000554 04/2014
Modicon LMC058 Motion Controller
Free-large Mode Principle
EIO0000000554 04/2014
Chapter 10
Free-large Mode Principle
Overview
This chapter describes the principle of the Free-large mode.
EIO0000000554 04/2014 75
Free-large Mode Principle
Overview
The Free-large mode can be used for axis monitoring or labeling in cases where the incoming
position of each part has to be known.
Principle
In the Free-large mode, the module behaves like a standard up and down counter.
When counting is enabled (see page 198), the counter counts as follows in:
Incrementing direction: the counter increments.
Decrementing direction: the counter decrements.
The counter is activated by a preset edge (see page 196) which loads the preset value.
The current counter is stored in the capture register by using the Capture (see page 183) function.
If the counter reaches the counting limits, the counter will react according to the Limits
Management (see page 79) configuration.
Input Modes
This table shows the 8 types of input modes available:
Reverse Quadrature X2
Reverse Quadrature X4
76 EIO0000000554 04/2014
Free-large Mode Principle
A (pulse)
4
B (pulse)
1 3 6
Preset Condition
2 5 7
Enable Condition
Counter Value
Preset Value
Stage Action
1 On the rising edge of Preset condition, the current value is set to the preset value
and the counter is activated.
2 When Enable condition = 1, each pulse on A increment the counter value.
3 On the rising edge of Preset condition, the current value is set to the preset value.
4 When Enable condition = 1, each pulse on B decrements the counter value.
5 When Enable condition = 0, the pulses on A or B are ignored.
6 On the rising edge of Preset condition, the current value is set to the preset value.
7 When Enable condition = 1, the pulses on B decrements the counter value.
EIO0000000554 04/2014 77
Free-large Mode Principle
Normal Quadrature X1 -1 0 1 2 3 2 1 0 -1
Normal Quadrature X2 -1 0 1 2 3 4 5 6 7 6 5 4 3 2 1 0 -1
Normal Quadrature X4 -1 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 15 1 1 1 1 1 9 8 7 6 5 4 3 2 1 0 -1
0 1 2 3 4 4 3 2 1 0
Reverse Quadrature X1 3 2 1 0 -1 0 1 2 3
Reverse Quadrature X2 7 6 5 4 3 2 1 0 -1 0 1 2 3 4 5 6 7
Reverse Quadrature X4 15 1 1 1 1 1 9 8 7 6 5 4 3 2 1 0 -1 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 15
43 2 1 0 0 1 2 3 4
78 EIO0000000554 04/2014
Free-large Mode Principle
Limits Management
Overview
When the counter limit is reached, the counter can have 2 behaviors depending on configuration:
Lock on limits
Rollover
Lock on Limits
In the case of overflow or underflow counter: the current counter value is maintained to the limit
value, the validity bit goes to 0, and the Error bit indicates that this detected error until the counter
is preset again.
Count Value
+ 2M
- 2M
Validity
Preset
Rollover
In the case of overflow or underflow of the counter, the current counter value goes automatically
to the opposite limit value.
Modulo_Flag (resp. Overflow_Flag for Encoder) output is set to 1.
Count Value
+ 2M
- 2M
EIO0000000554 04/2014 79
Free-large Mode Principle
80 EIO0000000554 04/2014
Modicon LMC058 Motion Controller
Free-large With a Main Type
EIO0000000554 04/2014
Chapter 11
Free-large With a Main Type
Overview
This chapter describes how to implement a High Speed Counter in Free-large mode using a Main
type.
EIO0000000554 04/2014 81
Free-large With a Main Type
Synopsis Diagram
Synopsis Diagram
This diagram provides an overview of the Main type in Free-large mode:
Optional Function
In addition to the Free-large mode, the Main type can provide the following functions:
Comparison function (see page 173)
Capture function (see page 183)
Preset function (see page 194)
Enable function (see page 198)
82 EIO0000000554 04/2014
Free-large With a Main Type
Configuration Procedure
Follow this procedure to configure a Main type in Free-large mode:
Step Action
1 Double-click Expert →DM72F• →HSCMain.
2 Select the HSC Main Configuration tab.
3 Set the value of the General →Counting Mode parameter to Free-large.
4 Select the value of the General →Input Mode parameter.
5 Select the value of the Counting inputs →A input →Bounce filter parameter.
If necessary, select the value of the Counting inputs →B input →Bounce filter parameter.
6 Enter the value of the Range →Preset parameter.
The Limits defines the behavior of the counter when limits are reached.
7 Optionnally, you can enable these functions:
capture function (see page 183)
comparison function (see page 173)
enable function (see page 198)
preset function (see page 194)
NOTE: The IO Summary window displays the DM72F• I/O mapping. You can see the I/O used by
expert function.
Programmable Filter
The filtering value on the Main type input determines the counter maximum frequency as shown
in this table:
EIO0000000554 04/2014 83
Free-large With a Main Type
Overview
Main type is always managed by an HSCMain function block.
NOTE: At build, a detected error code is given if the HSCMain function block is used to manage a
different HSC type.
Step Description
1 Select the Libraries tab in the Software Catalog and click Libraries.
Select Controller →LMC058 →LMC058 Expert IO →HSC →HSCMain_LMC058 in the list,
drag-and-drop the item onto the POU window.
2 Type the Main type instance name (defined in configuration) or select the function block
instance by clicking:
Using the input assistant, the HSC instance can be selected at the following path: Global
Variables →<MyController> →PLC Logic →IoConfig_Globals.
84 EIO0000000554 04/2014
Free-large With a Main Type
EN_Out0 BOOL TRUE = enables physical output Output0 to echo the Reflex0 value (if
configured).
EN_Out1 BOOL TRUE = enables physical output Output1 to echo the Reflex1 value (if
configured).
F_Enable BOOL Forces the Enable condition (see page 198).
F_Preset BOOL Forces the Preset condition (see page 194)
F_Out0 BOOL TRUE = forces Output0 to 1 (if Reflex0 is configured).
F_Out1 BOOL TRUE = forces Output1 to 1 (if Reflex1 is configured).
ACK_Modulo BOOL On rising edge, resets Modulo_Flag.
ACK_Preset BOOL On rising edge, resets Preset_Flag.
ACK_Cap BOOL On rising edge, resets Cap_Flag.
SuspendCompare BOOL TRUE = compare results are suspended:
TH0, TH1, TH2, TH3 , Reflex0, Reflex1, Out0, Out1 output bits of
the block maintain their last value.
Physical Outputs Output0 and Output1 maintain their last value.
Events are masked.
EIO0000000554 04/2014 85
Free-large With a Main Type
86 EIO0000000554 04/2014
Free-large With a Main Type
Adjusting Parameters
Overview
The list of parameters described in the table can be read or modified by using the
EXPERTGetParam (see page 227) or EXPERTSetParam (see page 229) function blocks.
NOTE: Parameters set via the program override the parameters values configured in the HSC
configuration window. Initial configuration parameters are restored on cold or warm start
(see Modicon LMC058 Motion Controller, Programming Guide).
Adjustable Parameters
This table provides the list of parameters from the EXPERT_PARAMETER_TYPE (see page 209)
which can be read or modified while the program is running:
Parameter Description
EXPERT_PRESET to get or set the Preset value of the HSC
EXPERT_THRESHOLD0 to get or set the Threshold 0 value of an HSC
EXPERT_THRESHOLD1 to get or set the Threshold 1 value of an HSC
EXPERT_THRESHOLD2 to get or set the Threshold 2 value of an HSC
EXPERT_THRESHOLD3 to get or set the Threshold 3 value of an HSC
EXPERT_REFLEX0 to get or set output 0 reflex mode of an expert function
EXPERT_REFLEX1 to get or set output 0 reflex mode of an expert function
EIO0000000554 04/2014 87
Free-large With a Main Type
88 EIO0000000554 04/2014
Modicon LMC058 Motion Controller
Event Counting Mode
EIO0000000554 04/2014
Part V
Event Counting Mode
Overview
This part describes the use of an HSC in Event Counting mode.
EIO0000000554 04/2014 89
Event Counting Mode
90 EIO0000000554 04/2014
Modicon LMC058 Motion Controller
Event Counting Principle
EIO0000000554 04/2014
Chapter 12
Event Counting Principle
Overview
The Event Counting mode allows you to count a sequence of events during a given period of time.
Principle
The counter assesses the number of pulses applied to the input for a predefined period of time.
The counting register is updated at the end of each period with the number of events received.
The synchronization can be used over the time period. This restarts the counting event for a new
predefined time period. The counting restarts at the edge Sync condition (see page 194).
Principle Diagram
Stage Action
1 When Enable condition = 1, the counter accumulates the number of events (pulses) on the physical
input during a predefined period of time.
If Validity = 0, the current value is not relevant.
2 Once the first period of time has elapsed, the counter value is set to the number of events counted
over the period and Validity is set to 1.
The counting restarts for a new period of time.
EIO0000000554 04/2014 91
Event Counting Principle
Stage Action
3 On the rising edge of the Sync condition:
the accumulated value is reset to 0
the current value is not updated
the counting restarts for a new period of time
4 Once the period of time has elapsed, the counter value is set to the number of events counted over
the period.
The counting restarts for a new period of time.
NOTE:
On the Main type, when the Enable condition is:
Set to 0: the current counting is aborted and CurrentValue is maintained to the previous valid
value.
Set to 1: the accumulated value is reset to 0, the CurrentValue remains unchanged, and the
counting restarts for a new period of time.
92 EIO0000000554 04/2014
Modicon LMC058 Motion Controller
Event Counting With a Main Type
EIO0000000554 04/2014
Chapter 13
Event Counting With a Main Type
Overview
This chapter describes how to implement a High Speed Counter in Event Counting mode using
a Main type.
EIO0000000554 04/2014 93
Event Counting With a Main Type
Synopsis Diagram
Synopsis Diagram
This diagram provides an overview of the Main type in Event Counting mode.
Optional Function
In addition to the Event Counting mode, the Main type provides the following functions:
Preset function (see page 194)
Enable function (see page 198)
94 EIO0000000554 04/2014
Event Counting With a Main Type
Configuration Procedure
Follow this procedure to configure a Main type in Event Counting mode:
Step Action
1 Double-click Expert →DM72F• →HSCMain.
2 Select the HSC Main Configuration tab.
3 Set the value of the General →Counting Mode parameter to Event.
4 Select the value of the Counting inputs →A input →Bounce filter parameter.
5 Set the time base value from Range →Time base.
6 Optionally, select the value of the SYNC auxiliary input from the drop down to enable the Preset
function (see page 194) with a physical input.
NOTE: The IO Summary window displays the DM72F• I/O mapping. You can see the I/O used by
expert function.
Programmable Filter
The filtering value on the Main type input determines the counter maximum frequency as shown
in the table:
EIO0000000554 04/2014 95
Event Counting With a Main Type
Overview
Main type is always managed by an HSCMain function block.
NOTE: At build, a detected error code is given if the HSCMain function block is used to manage a
different HSC type.
Step Description
1 Select the Libraries tab in the Software Catalog and click Libraries.
Select Controller →LMC058 →LMC058 Expert IO →HSC →HSCMain_LMC058 in the list,
drag-and-drop the item onto the POU window.
2 Type the Main type instance name (defined in configuration) or select the function block
instance by clicking:
Using the input assistant, the HSC instance can be selected at the following path: Global
Variables →<MyController> →PLC Logic →IoConfig_Globals.
96 EIO0000000554 04/2014
Event Counting With a Main Type
EIO0000000554 04/2014 97
Event Counting With a Main Type
98 EIO0000000554 04/2014
Event Counting With a Main Type
Adjusting Parameters
Overview
The list of parameters described in the table can be read or modified by using the
EXPERTGetParam (see page 227) or EXPERTSetParam (see page 229) function blocks.
NOTE: Parameters set via the program override the parameters values configured in the HSC
configuration window. Initial configuration parameters are restored on cold or warm start
(see Modicon LMC058 Motion Controller, Programming Guide).
Adjustable Parameters
This table provides the list of parameters from the EXPERT_PARAMETER_TYPE (see page 209)
which can be read or modified while the program is running:
Parameter Description
EXPERT_TIMEBASE to get or set the Timebase value of the HSC
EIO0000000554 04/2014 99
Event Counting With a Main Type
Part VI
Frequency Meter Type
Overview
This part describes the use of an HSC in Frequency meter type.
Chapter 14
Frequency Meter Principle
Description
Overview
The Frequency meter type measures an event frequency in Hz.
The Frequency meter type calculates the number of pulses in time intervals of 1 s. An updated
value in Hz is available every 10 ms.
When there is a variation in the frequency, the value restoration time is 1 s with a value precision
of 1 Hz.
Operation Limits
The maximum frequency that the module can measure on the A input is 200 kHz. Beyond 200 kHz,
the counting register value may decrease until it reaches 0.
The maximum duty cycle at 200 kHz is 60%.
Chapter 15
Frequency Meter Type
Overview
This chapter describes how to implement a High Speed Counter in Frequency meter type.
Synopsis Diagram
Synopsis Diagram
This diagram provides an overview of the Main type in Frequency meter type:
Optional Function
In addition to the Frequency meter type, the Main type can provide the following function:
Enable function (see page 198)
Configuration
Configuration Procedure
Follow this procedure to configure a Main type in Frequency meter mode:
Step Action
1 Double-click Expert →DM72F• →HSCMain.
2 Select the HSC Main Configuration tab.
3 Set the value of the General →Counting Mode parameter to Frequency meter.
4 Select the value of the Counting inputs →A input →Bounce filter parameter.
5 Set the time base value from Range →Time base.
6 Optionally, select the value of the EN auxiliary input from the drop down to enable the Enable
function (see page 198) with a physical input.
NOTE: The IO Summary window displays the DM72F• I/O mapping. You can see the I/O used by
expert function.
Programmable Filter
The filtering value on the Frequency Meter type input determines the counter maximum frequency
as shown in this table:
Programming
Overview
Main type is always managed by an HSCMain function block.
NOTE: At build, a detected error code is given if the HSCMain function block is used to manage a
different HSC type.
Step Description
1 Select the Libraries tab in the Software Catalog and click Libraries.
Select Controller →LMC058 →LMC058 Expert IO →HSC →HSCMain_LMC058 in the list, drag-
and-drop the item onto the POU window.
2 Type the Main type instance name (defined in configuration) or select the function block instance
by clicking:
Using the input assistant, the HSC instance can be selected at the following path: Global
Variables →<MyController> →PLC Logic →IoConfig_Globals.
Adjusting Parameters
Overview
The list of parameters described in the table below can be read or modified by using the
EXPERTGetParam (see page 227) or EXPERTSetParam (see page 229) function blocks.
NOTE: Parameters set via the program override the parameters values configured in the HSC
configuration window. Initial configuration parameters are restored on cold or warm start
(see Modicon LMC058 Motion Controller, Programming Guide).
Adjustable Parameters
This table provides the list of parameters from the EXPERT_PARAMETER_TYPE (see page 209)
which can be read or modified while the program is running:
Parameter Description
EXPERT_TIMEBASE to get or set the Timebase value of the HSC
Part VII
Period Meter Type
Overview
This part describes the use of an HSC in Period meter type.
Chapter 16
Period Meter Type Principle
Description
Overview
Use the Period meter type to:
determine the duration of an event
determine the time between 2 events
set and measure the execution time for a process
Operating Limits
The module can perform a maximum of 1 measurement every 5 ms.
The shortest pulse that can be measured is 100 μs, even if the unit defined in the configuration is
1 μs.
The maximum duration that can be measured is 1,073,741,823 units.
Chapter 17
Period Meter Type
Overview
This chapter describes how to implement a High Speed Counter in Period meter type.
Synopsis Diagram
Synopsis Diagram
This diagram provides an overview of the Main type in Period meter type:
Optional Function
In addition to the Period meter type, the Main type can provide the following function:
Enable function (see page 198)
Configuration
Configuration Procedure
Follow this procedure to configure a Main type in Period meter mode:
Step Action
1 Double-click Expert →DM72F• →HSCMain.
2 Select the HSC Main Configuration tab.
3 Set the value of the General →Counting Mode parameter to Period meter.
4 Set the period meter mode from General →PeriodMeter Mode.
5 Select the value of the Counting inputs →A input →Bounce filter parameter.
6 Optionally, select the value of the EN auxiliary input from the drop down to enable the Enable
function (see page 198) with a physical input.
7 Set the resolution value from Range →Resolution.
8 Set the time-out value from Range →Timeout.
NOTE: The IO Summary window displays the DM72F• I/O mapping. You can see the I/O used by
expert function.
Programmable Filter
The filtering value on the Main type input determines the counter maximum frequency as shown
in the table:
Programming
Overview
Main type is always managed by an HSCMain function block.
NOTE: At build, a detected error code is given if the HSCMain function block is used to manage a
different HSC type.
Step Description
1 Select the Libraries tab in the Software Catalog and click Libraries.
Select Controller →LMC058 →LMC058 Expert IO →HSC →HSCMain_LMC058 in the list, drag-
and-drop the item onto the POU window.
2 Type the Main type instance name (defined in configuration) or select the function block instance
by clicking:
Using the input assistant, the HSC instance can be selected at the following path: Global
Variables →<MyController> →PLC Logic →IoConfig_Globals.
Part VIII
Encoder
Encoder
Overview
This part describes how to implement an encoder.
Chapter 18
Incremental Mode With an Encoder
Overview
This chapter describes how to use an Encoder in Incremental mode.
Section 18.1
Incremental Mode Principle
Overview
Use of the Incremental mode to connect incremental encoders.
Principle
The Incremental mode behaves like a standard up/down counter.
When the Enable condition (see page 198) is false, the counter ignores the pulses applied to the
counting inputs A/B.
In the Incremental mode, the counter must be preset at least one time to operate.The current
counter value is loaded with the Preset value each time the Preset condition (see page 194)
occurs.
The current counter can be stored in the capture register by configuring the Capture conditions
(see page 187).
Axis Types
The following table shows the 2 available axis types:
Principle Diagram
The input mode in Incremental mode is always a quadrature:
Normal Quadrature X1 -1 0 1 2 3 2 1 0 -1
Normal Quadrature X2 -1 0 1 2 3 4 5 6 7 6 5 4 3 2 1 0 -1
Normal Quadrature X4 -1 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 15 1 1 1 1 1 9 8 7 6 5 4 3 2 1 0 -1
0 1 2 3 4 4 3 2 1 0
Reverse Quadrature X1 3 2 1 0 -1 0 1 2 3
Reverse Quadrature X2 7 6 5 4 3 2 1 0 -1 0 1 2 3 4 5 6 7
Reverse Quadrature X4 15 1 1 1 1 1 9 8 7 6 5 4 3 2 1 0 -1 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 15
43 2 1 0 0 1 2 3 4
Stage Action
1 On the rising edge of Preset condition, the current value is set to the preset value and the counter
is activated.
2 When the Enable condition = 1, the counter starts to increment when the counting direction is up.
3 The rising edge on the Preset condition loads the Preset value.
4 When the Enable condition = 1, the counter starts to decrement when the counting direction is down.
5 When the Enable condition = 0, the counter ignores the pulses applied to the counting inputs A/B.
6 The rising edge on the Preset condition loads the preset value.
7 When the Enable condition = 1, the counter starts to decrement when the counting direction is down.
NOTE: Enable and Preset conditions depends on configuration. These are described in the Enable
(see page 198) and Preset (see page 196) function.
Slack
The counter applies an hysteresis if the rotation is inverted. The value of slack defines the number
of points that are not acknowledged by the counter during the rotation inversion.
This takes into account the slack between the encoder/motor axis and the mechanical axis (e.g.
an encoder measuring the position of a mat).
This behavior is illustrated in the following figure:
Section 18.2
Standard Encoder on an Expert I/O Module
Overview
This section describes the configuration in Incremental Mode of a Standard Encoder on an
Expert I/O module.
Synopsis Diagram
Synopsis Diagram
The following diagram provides an overview of the Standard Encoder in Incremental mode:
Optional Function
In addition to the Incremental mode, the Standard Encoder can provide the following functions:
Compare (see page 173)
Capture (see page 187)
Enable with a physical input (see page 198)
Preset a physical input (see page 194)
Configuration Window
Follow this procedure to configure the Standard Encoder type in Incremental mode:
Step Action
1 In the Devices tree, double-click MyController →Expert →DM72Fx →Standard_Encoder.
Result: The configuration window is displayed.
2 Select the Standard Encoder Configuration tab.
WARNING
INACCURATE ENCODER VALUE
Respect the mathematical rule of modulo ((Modulo x Increment)/Unit = Integer) to avoid
slipping.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
Programmable Filter
The filtering value on the Standard Encoder input determines the counter maximum frequency,
as shown in the table below:
Overview
A Standard Encoder is always managed by an Encoder_LMC058 (see page 231) function block.
Step Action
1 Select the Libraries tab in the Software Catalog and click Libraries.
Select Controller →LMC058 →LMC058 Expert IO →ENCODER →ENCODER_LMC058 in the list,
drag-and-drop the item onto the POU window.
2 Type the Encoder_LMC058 instance name or select the function block instance by clicking on:
Using the input assistant, the Encoder_LMC058 instance can be selected at the following path:
Global Variables →PLC Logic →IoConfig_Globals.
EN_Out0 BOOL TRUE = authorizes physical output Output0 to echo the Reflex0 value.
EN_Out1 BOOL TRUE = authorizes physical output Output1 to echo the Reflex1 value.
F_Enable BOOL Forces the Enable condition (see page 198).
F_Preset BOOL Forces the Preset condition.
F_Out0 BOOL TRUE = forces physical output Output0 to 1 (if Reflex0 is configured)
(see page 174).
F_Out1 BOOL TRUE = forces physical output Output1 to 1 (if Reflex1 is configured)
(see page 174).
ACK_Overflow BOOL On rising edge, resets Overflow_Flag
ACK_Preset BOOL On rising edge, resets Preset_Flag (see page 194).
ACK_Cap0 BOOL On rising edge, resets Cap0_Flag (see page 187).
ACK_Cap1 BOOL On rising edge, resets Cap1_Flag (see page 187).
SuspendCompare BOOL TRUE = the comparator operation results are frozen (see page 173):
TH0, TH1, TH2, TH3, Reflex0, Reflex1 output bits maintain their last
value.
Physical outputs Output0 and Output1 maintain their last value.
Events are masked.
Adjusting Parameters
Overview
The list of parameters described in the table below can be read or modified by the using the
EXPERTGetParam (see page 227) or EXPERTSetParam (see page 229) function blocks.
Adjustable Parameters
This table provides the list of parameters from the EXPERT_PARAMETER_TYPE (see page 209)
which can be modified while the program is running:
Parameter Description
EXPERT_PRESET to get or set the Preset value of the Encoder
EXPERT_THRESHOLD0 to get or set the Threshold 0 value of an Encoder
EXPERT_THRESHOLD1 to get or set the Threshold 1 value of an Encoder
EXPERT_THRESHOLD2 to get or set the Threshold 2 value of an Encoder
EXPERT_THRESHOLD3 to get or set the Threshold 3 value of an Encoder
EXPERT_OFFSET to get or set OFFSET of an Encoder in Rotary axis mode
EXPERT_MODULO to get or set MODULO of an Encoder in Rotary axis mode
EXPERT_SLACK to get or set Slack of an Encoder
EXPERT_SCALING to get or set the Scaling parameter of an Encoder
The scaling parameter (ParamValue of the function block) is made of 2
sub-parameters:
High significant INT = Increments
Low significant INT = Units
EXPERT_REFLEX0 to get or set output 0 reflex mode of an EXPERT function
EXPERT_REFLEX1 to get or set output 0 reflex mode of an EXPERT function
Section 18.3
Standard Encoder on the Encoder Interface
Overview
This section describes the configuration in Incremental Mode of the Standard Encoder on the
Encoder interface.
Synopsis Diagram
Synopsis Diagram
The following diagram provides an overview of the Standard Encoder in Incremental mode on
the Encoder interface:
Optional Function
In addition to the Incremental mode, the Standard Encoder can provide the following functions:
Compare (see page 173)
Capture (see page 187)
Enable with a physical input (see page 198)
Preset with physical inputs (see page 196)
Configuration Window
Follow this procedure to configure the Standard Encoder type in Incremental mode:
Step Action
1 In the Devices tree, double-click MyController →Expert →Encoder →Standard_Encoder_1.
Result: The configuration window is displayed.
2 Select the Standard Encoder Configuration tab.
Configuration Parameters
This table describes the properties of the Standard Encoder Configuration tab in Incremental
mode:
WARNING
INACCURATE ENCODER VALUE
Respect the mathematical rule of modulo ((Modulo x Increment)/Unit = Integer) to avoid
slipping.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
Programmable Filter
The filtering value on the Standard Encoder input influences the counter maximum frequency, as
shown in the table below:
Overview
A Standard Encoder is always managed by an Encoder_LMC058 (see page 231) function block.
Step Action
1 Select the Libraries tab in the Software Catalog and click Libraries.
Select Controller →LMC058 →LMC058 Expert IO →ENCODER →ENCODER_LMC058 in the list,
drag-and-drop the item onto the POU window.
2 Type the Encoder_LMC058 instance name or select the function block instance by clicking:
Using the input assistant, the Encoder_LMC058 instance can be selected at the following path:
Global Variables →PLC Logic →IoConfig_Globals.
EN_Out0 BOOL TRUE = authorizes physical output 0 to echo the Reflex0 value.
EN_Out1 BOOL TRUE = authorizes physical output 1 to echo the Reflex1 value.
F_Enable BOOL Forces the Enable condition (see page 198).
F_Preset BOOL Forces the Preset condition.
F_Out0 BOOL TRUE = forces physical output 0 to 1 (if Reflex0 is configured)
(see page 174).
F_Out1 BOOL TRUE=forces physical output 1 to 1 (if Reflex1 is configured)
(see page 174).
ACK_Overflow BOOL On rising edge, resets Overflow_Flag
ACK_Preset BOOL On rising edge, resets Preset_Flag (see page 194).
ACK_Cap0 BOOL On rising edge, resets Cap0_Flag (see page 187).
ACK_Cap1 BOOL On rising edge, resets Cap1_Flag (see page 187).
SuspendCompare BOOL TRUE = the comparator operation results are frozen (see page 173):
TH0, TH1, TH2, TH3, Reflex0, Reflex1 output bits maintain their
last value.
Physical Outputs 0, 1 maintain their last value.
Events are masked.
Adjusting Parameters
Overview
The list of parameters described in the table below can be read or modified by the using the
EXPERTGetParam (see page 227) or EXPERTSetParam (see page 229) function blocks.
Adjustable Parameters
This table provides the list of parameters from the EXPERT_PARAMETER_TYPE (see page 209)
which can be modified while the program is running:
Parameter Description
EXPERT_PRESET to get or set the Preset value of the Encoder
EXPERT_THRESHOLD0 to get or set the Threshold 0 value of an Encoder
EXPERT_THRESHOLD1 to get or set the Threshold 1 value of an Encoder
EXPERT_THRESHOLD2 to get or set the Threshold 2 value of an Encoder
EXPERT_THRESHOLD3 to get or set the Threshold 3 value of an Encoder
EXPERT_OFFSET to get or set OFFSET of an Encoder
EXPERT_SLACK to get or set Slack of an Encoder
EXPERT_TIMEBASE to get or set timebase of an Encoder
EXPERT_SCALING to get or set the Scaling parameter of an Encoder
The scaling parameter (ParamValue of the function block) is made of 2 sub-
parameters:
High significant INT = Increments
Low significant INT = Units
EXPERT_REFLEX0 to get or set output 0 reflex mode of an EXPERT function
EXPERT_REFLEX1 to get or set output 0 reflex mode of an EXPERT function
Section 18.4
Motion Encoder on an Expert I/O Module
Overview
This section describes the configuration in Incremental Mode of a Motion Encoder on an Expert
I/O module.
Synopsis Diagram
Synopsis Diagram
The following diagram provides an overview of the Motion Encoder in Incremental mode:
Optional Function
In addition to the Incremental mode, the Motion Encoder can provide the following function:
Capture (see page 187)
A Motion Encoder supports all SM3_Basic library SoftMotion functions (preset, touch prob, etc...).
In addition, an MC_GetImmediateValue_LMC058 (see page 215) function is available in the
LMC058 Motion library.
Configuration Window
To configure the Motion Encoder type in Incremental mode, double-click MyController →Expert
→DM72Fx in the Devices tree.
Result: The Motion Encoder Configuration window is displayed.
Programmable Filter
The filtering value on the Motion Encoder input determines the counter maximum frequency as
shown in the table below:
Section 18.5
Motion Encoder on the Encoder Interface
Overview
This section describes the configuration in Incremental Mode of a Motion Encoder on the
Encoder interface.
Synopsis Diagram
Synopsis Diagram
The following diagram provides an overview of the Motion Encoder in Incremental mode on the
Encoder interface:
Optional Function
In addition to the Incremental mode, the Motion Encoder can provide the following function:
Capture (see page 187)
A Motion Encoder supports all SM3_Basic library SoftMotion functions (preset, touch prob, etc...).
In addition, an MC_GetImmediateValue_LMC058 (see page 215) function is available in the
LMC058 Motion library.
Configuration Window
To configure the Motion Encoder type in Incremental mode, double-click MyController →Expert
→Encoder →Motion_Encoder_1.
Result: the Motion Encoder Configuration window is displayed.
Configuration Parameters
This table describes the properties of the Motion Encoder Configuration tab in Incremental
mode:
Programmable Filter
The filtering value on the Motion Encoder input determines counter maximum frequency as
shown in the table below:
Chapter 19
SSI Mode With an Encoder
Overview
This chapter describes each of the encoders available in SSI Mode.
Section 19.1
SSI Principle Description
General
The SSI (Synchronous Serial Interface) mode allows the connection of an absolute encoder.
The position of the absolute encoder is read by an SSI link.
Principle Diagram
The figure below represents an SSI frame:
Clock sequence
1 2 3 4 5 6 0 n+1
Clock from the controller
to the encoder
t
tm
tp < 20Ms tm < 20Ms t < tm
tp
Data Information
The data content can be configured to adjust the information from the absolute Encoder:
Section 19.2
Standard Encoder in SSI Mode on an Encoder Interface
Overview
This section describes the configuration in SSI mode of a Motion Encoder on the Encoder
interface.
Synopsis Diagram
The following diagram provides an overview of the Standard Encoder in SSI mode on the
Encoder interface:
Optional Function
In addition to the SSI mode, the Standard Encoder can provide the following function:
Capture (see page 187)
Configuration Window
Follow this procedure to configure the Standard Encoder type in SSI mode:
Step Action
1 In the Devices tree, double-click MyController →Expert →Encoder →Standard_Encoder_1.
Result: The configuration window is displayed.
2 Select the Standard Encoder Configuration tab.
Configuration Parameters
This table describes the properties of the Standard Encoder Configuration tab in SSI mode:
Overview
A Standard Encoder is always managed by an Encoder_LMC058 (see page 231) function block.
Step Action
1 Select the Libraries tab in the Software Catalog and click Libraries.
Select Controller →LMC058 →LMC058 Expert IO →ENCODER →ENCODER_LMC058 in the list,
drag-and-drop the item onto the POU window.
2 Type the Encoder_LMC058 instance name or select the function block instance by clicking:
Using the input assistant, the Encoder_LMC058 instance can be selected at the following path:
Global Variables →PLC Logic →IoConfig_Globals.
Section 19.3
Motion Encoder in SSI Mode on the Encoder Interface
Overview
This section describes the configuration in SSI mode of a Motion Encoder on the Encoder
interface.
Synopsis Diagram
The following diagram provides an overview of the Motion Encoder in SSI mode on the Encoder
interface:
Optional Function
In addition to the SSI mode, the Motion Encoder can provide the following function:
Capture (see page 187)
A Motion Encoder supports all SM3_Basic library SoftMotion functions (preset, touch prob, etc...).
In addition, a MC_GetImmediateValue_LMC058 (see page 215) and a MC_Reset_LMC058
(see page 217) functions are available in the LMC058 Motion library.
Configuration Window
To configure the Motion Encoder type in SSI mode, double-click MyController →Expert →
Encoder →Motion_Encoder_1.
Result: the Motion Encoder Configuration window is displayed.
Configuration Parameters
This table describes the properties of the Motion Encoder Configuration tab in SSI mode:
Part IX
Optional Functions
Optional Functions
Overview
This part provides information on optional functions for HSC.
Chapter 20
Comparison Function
Comparison Function
Section 20.1
Comparison with a Main Type
Overview
This section provides information on the comparison function with a Main type or an encoder.
Overview
The compare block with the Main type manages Thresholds, Reflex outputs and Events in the
following modes:
One-shot (see page 39)
Modulo-loop (see page 53)
Free-Large (see page 73)
The compare block with an Encoder manages Thresholds, Reflex outputs and Events.
Comparison is configured in the Configuration screen (see page 179) by activating at least one
threshold.
Comparison can be used to trigger:
programming action on thresholds (see page 176)
an event on threshold associated with an external task (see page 176)
reflex outputs (see page 176)
Principle of a Comparison
The Main type or an Encoder can manage up to 4 thresholds.
A threshold is a configured value that is compared to the current counting value. Thresholds are
used to define up to 5 zones or to react to a value crossing.
They are defined by configuration and can also be adjusted in the application program by using the
EXPERTSetParam (see page 229) function block.
If Thresholdx (x= 0, 1, 2, 3) is configured and comparison is enabled (EN_Compare = 1), output
pin THx of the HSCMain_LMC058 (Encoder_LMC058) function block is:
set when counter value >= Thresholdx
reset when counter value < Thresholdx
Threshold 1
Threshold 0
EN_Compare
TH1
TH0
Threshold Behavior
Using thresholds comparison status available in the task context (TH0 to TH2 output pins of the
function block) is suitable for an application with a low time constant.
It can be used, for example, to monitor the liquid level in a tank.
Configuring Event
Configuring an event on threshold crossing allows to trigger an external task (see page 180). You
can choose to trigger an event when a configured threshold is crossed downward, upward, or both.
Threshold 3
Threshold 2
Threshold 1
Threshold 0
t
State
TH3
TH2
TH1
TH0
t
State
Reflex1
Reflex0
t
State
EN_Out1
EN_Out0
t
State
OUT_1
OUT_0
t
WARNING
UNINTENDED EQUIPMENT OPERATION
Do not change the Threshold values without using the SuspendCompare input if
EN_Compare = 1.
Verify that TH0 is less than TH1, that TH1 is less than TH2, and that TH2 is less than TH3 before
reactivating the threshold compare function.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
While EN_Compare = 1, the comparison is active, and it is necessary to follow this procedure:
Step Action
1 Set SuspendCompare to 1.
The comparison is frozen at the current value:
TH0, TH1, Reflex0, Reflex1, Out0, Out1 output bits of the block maintain their last value.
Physical Outputs 0, 1 maintain their last value
Events are masked
Configuration Procedure
Follow this procedure to configure the comparison function on a Main type or an Encoder:
Step Action
1 In the Devices tree, double-click the Expert →DM72F• →HSCMain or Standard_Encoder
node.
2 Select the HSC Main Configuration or Standard Encoder Configuration tab.
3 In the Number of thresholds parameter, select the number of thresholds to use.
4 Select the thresholds values.
NOTE: Follow this rule to configure the threshold values: TH0 < TH1 < TH2 < TH3
5 Optionally, provide an event condition (see page 180).
6 Optionally, configure the Reflex Output behavior (see page 175).
Procedure
The following procedure describes how to configure an external event (see Modicon LMC058
Motion Controller, Programming Guide) to activate a task:
Step Action
1 In the Applications tree tab, add a task.
2 Double-click the task node to associate to an external event.
3 In the Type dropdown menu, select External.
4 In the External Event dropdown menu, select the event to associate to the task (see the list
below).
External Events
This table provides a description of the possible external events to associate to a task:
Chapter 21
Capture Function
Capture Function
Overview
This chapter provides information on capture function for HSC.
Section 21.1
Capture with a Main Type
Overview
This section provides information on the capture function with a Main type.
Overview
The capture function stores the current counter value upon an external input signal.
The capture function is available in Main type with the following modes:
One-shot (see page 45)
Modulo-loop (see page 65)
Free-large (see page 81)
Principle of a Capture
This graphic illustrates how the capture works in Modulo-loop mode:
1 2 4
CAP
EN_Cap
5
ACK_Cap
Cap_Flag
Counting
Stage Action
1 When EN_Cap = 0, the function is not operational.
2 When EN_Cap = 1, the edge on CAP captures the current counter value and puts it into the Capture
register, and triggers the rising edge of Cap_Flag.
3 Get the stored value using EXPERTGetCapturedValue (see page 222).
4 While Cap_Flag = 1, any new edge on the physical input CAP is ignored.
5 The rising edge of HSCMain_LMC058 (see page 234) function block input ACK_Cap triggers the
falling edge Cap_Flag output.
A new capture is authorized.
Configuration Procedure
Follow this procedure to configure the capture function on a Main type:
Step Action
1 In the Devices tree, double-click the Expert →DM72F• →HSCMain or Standard_Encoder
node.
2 Select the HSC Main Configuration or Standard Encoder Configuration tab.
3 Select a value for the Capture →CAP input →Location parameter.
4 Select a value for the Capture →CAP input →Bounce filter parameter.
5 Define the triggering mode of the Capture →Mode parameter.
Section 21.2
Capture with an Encoder
Overview
This section provides informations on the capture function with an Standard Encoder or Motion
Encoder.
Overview
The capture function stores the current counter value upon an external input signal.
Each Encoder have 2 registers of capture (CAP0 and CAP1). Those registers can be used in 2
ways:
Up to 2 position captures
1 distance capture
Principle of a Capture
This graphic illustrates how the position capture works (only one register is shown):
1 2 4
CAP
EN_Cap
5
ACK_Cap
Cap_Flag
Counting
Stage Action
1 When En_Cap = 0, the function is not operational.
2 When EN_Cap = 1, the edge on CAP captures the current counter value and puts it into the Capture
register, and triggers the rising edge of Cap_Flag.
3 Get the stored value using EXPERTGetCapturedValue (see page 222).
4 While Cap_Flag = 1, any new edge on the physical input CAP is ignored.
Stage Action
5 The rising edge of Encoder (see page 234) function block input ACK_Cap triggers the falling edge
Cap_Flag output.
A new capture is authorized.
Position
Y
Measure
X
Time
1 2 3
CAP
Cap0_Flag
4
ACK_Cap0
Capture register 1 X
Capture register 2 Y
Stage Action
1 The rising edge of CAP captures the current counter value and puts it into the first capture register.
2 The falling edge of CAP captures the current counter value and puts it into the second Capture
register, and triggers the rising edge of Cap0_Flag.
3 Get the stored value using EXPERTGetCapturedValue (see page 222).
The EXPERTGetCapturedValue (see page 222) function block can get:
the position at the rising edge
the position at the falling edge
distance value
4 While Cap0_Flag = 1, any new edge on the physical input CAP is ignored.
Stage Action
5 The rising edge of Encoder (see page 234) function block input ACK_Cap triggers the falling edge
Cap_Flag output.
A new capture is authorized.
NOTE: In the case of a rotary axis, the distance is always positive even if the position at the falling
edge is smaller than the position at the rising edge.
Step Action
1 In the Devices tree, double-click the Expert →DM72Fx →Standard_Encoder or
Motion_Encoder.
2 Select the configuration tab.
3 Select a value for the Capture →CAP input →Location parameter.
4 Select a value for the Capture →CAP input →Bounce filter parameter.
5 If necessary, select CAP0 Mode and CAP1 Mode parameters.
6 If necessary, enable the Capture distance parameter.
Step Action
1 In the Devices tree, double-click the Expert →Encoder →Standard_Encoder or
Motion_Encoder.
2 Select the configuration tab.
3 Select a value for the Capture →CAP 0 input or CAP 1 input →Location parameter.
4 Select a value for the Capture →CAP 0 input or CAP 1 input →Bounce filter parameter.
5 If necessary, select CAP0 Mode and CAP1 Mode parameters.
6 If necessary, enable the Capture distance parameter.
Chapter 22
Preset and Enable Functions
Overview
This chapter provides information on preset and enable functions for a HSC or an Encoder.
Preset Function
Overview
The preset function is used to set/reset the counter operation.
The preset function authorizes counting function, synchronization, and start in the following
counting modes:
One shot counter: preset and start the counter
Modulo-loop counter: reset and start the counter
Event counting: restart the internal time base at the beginning
NOTE: Sync condition for a Simple HSC type corresponds to the function block inputs Sync.
Description
This function is used to synchronize the counter depending on the status and the configuration of
the optional SYNC physical input and the function block inputs F_Preset and EN_Preset.
This diagram illustrates the Sync conditions of the HSC:
The function block output Preset_Flag is set 1 when the Sync Condition is reached.
The Sync condition operates on a rising edge.
Configuration
This procedure describes how to configure a preset function:
Step Action
1 In the Devices tree, double-click MyController →DM72F• →HSCMain.
2 Select the HSC Main Configuration tab.
3 Select the value of the Control inputs →SYNC input →Location parameter.
4 Select the value of the Control inputs →SYNC input →Bounce filter parameter.
5 Select the value of the Control inputs →Edge detection parameter.
Transition Type
The transition type of the SYNC physical input is determined by the Edge detection parameter.
There are 3 available transitions, defined by configuration:
Rising edge of the SYNC input
Falling edge of the SYNC input
Both edges of the SYNC input
Value Description
Sync Rising Detection done on rising edge.
Sync Falling Detection done on falling edge.
Sync Both Detection done on rising edge and on falling edge.
Overview
In Free-large mode, the Preset condition is create by using 2 inputs:
SYNC (respectively Z for the Encoder)
REF
At the Rising Edge of the Input SYNC if the Input REF is Active High
The counter synchronizes upon the encoder reference point when the REF signal is TRUE, as
shown below:.
SYNC
REF
time
Cross symbol shows the preset time
At the First SYNC Pulse after the REF Input Signal Rising:
SYNC
REF
time
Cross symbol shows the preset time
At the first SYNC Pulse after the REF Input Signal Falling:
SYNC
REF
time
Enable Function
Overview
The enable function is used to authorize the counting operation.
Description
This function is used to authorize changes to the current counter value depending on the status of
the optional EN physical input and the function block inputs F_Enable and EN_Enable.
The diagrams illustrates the enable conditions:
As long as the function is not enabled, the counting pulses are ignored.
NOTE: Enable condition for a Simple type corresponds to the function block inputs Enable.
Configuration
This procedure describes how to configure an enable function:
Step Action
1 In the Devices tree, double-click MyController →DM72F• →HSCMain.
2 Select the HSC Main Configuration tab.
3 Select the value of the Control inputs →EN input →Location parameter.
4 Select the value of the Control inputs →EN input →Bounce filter parameter.
EIO0000000554 04/2014
Appendices
Overview
The appendices provides an overview of data types, function blocks and general information about
the function blocks used.
Appendix A
General Information
General Information
Overview
The information described in this chapter is common for PTO and HSC features.
Dedicated Features
Bounce Filter
This table shows the maximum counter frequencies determined by the filtering values used to
reduce the bounce effect on the input:
Dedicated Outputs
Outputs used by the Pulse Train Output, Pulse Width Modulation, and High Speed Counters or an
Encoder can only be accessed through the function block. They can not be read or written directly
within the application.
WARNING
UNINTENDED EQUIPMENT OPERATION
Do not use the same instance of a function block in more than 1 task.
Do not modify function block references (••_REF_IN) while the function block is active
(executing).
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
Appendix B
Data Types
Data Types
Overview
This chapter describes the data types of the HSC Library.
Name Value
EXPERT_100ms 00 hex
EXPERT_1s 01 hex
EXPERT_10s 02 hex
EXPERT_60s 03 hex
Appendix C
Function Blocks
Function Blocks
Overview
This chapter describes the functions and the function blocks of the HSC and encoder part of the
EXPERT I/O Library.
Section C.1
LMC058 Motion Library
Overview
This section describes the functions in the LMC058 Motion library.
Function Description
This function allows you to read the counter value of a Motion Encoder bypassing the controller
cycle.
Graphical Representation
IL and ST Representation
To see the general representation in IL or ST language, refer to Function and Function Block
Representation (see page 241).
Adding a MC_GetImmediateValue_LMC058
Step Description
1 Select the Libraries tab in the Software Catalog and click Libraries.
2 Select Controller →LMC058 →LMC058 Motion →MC_GetImmediateValue_LMC058 in the
list, drag-and-drop the item onto the POU window.
3 Link the Axis input to the Axis_Ref output of the Motion Encoder.
Function Description
This function allows you to clear the SoftMotion Encoder in case of an error detected. See online
help Programming with SoMachine part, SoftMotion/Programming Interface/SoftMotion
Libraries/SM3_Basic_library.
Graphical Representation
IL and ST Representation
To see the general representation in IL or ST language, refer to Function and Function Block
Representation (see page 241).
Adding a MC_Reset_LMC058
Step Description
1 Select the Libraries tab in the Software Catalog and click Libraries.
2 Select Controller →LMC058 →LMC058 Motion →MC_Reset_LMC058 in the list, drag-and-
drop the item onto the POU window.
3 Link the Axis input to the Axis_Ref output of the Motion Encoder.
Section C.2
LMC058 EXPERT IO Library
Overview
This section describes the function blocks related to the HSC or the Standard Encoder of the
LMC058 EXPERT IO library.
Function Description
This administrative function permits to read the counter value of an HSC or Encoder bypassing the
controller cycle.
Graphical Representation
IL and ST Representation
To see the general representation in IL or ST language, refer to Function and Function Block
Representation (see page 241).
Step Description
1 Select the Libraries tab in the Software Catalog and click Libraries.
Select Controller →LMC058 →LMC058 Expert IO →Administrative →
EXPERTGetImmediateValue in the list, drag-and-drop the item onto the POU window.
2 Link the EXPERT_REF_IN input to the HSC_REF output of the HSC.
Function Description
This administrative function block returns the content of a capture register.
Graphical Representation
IL and ST Representation
To see the general representation in IL or ST language, refer to Function and Function Block
Representation (see page 241).
NOTE: In case of detected error, variables take the last value captured.
NOTE: For more information about Done, Busy and Execution pins, refer to General Information
on Function Block Management (see page 203).
Step Description
1 Select the Libraries tab in the Software Catalog and click Libraries.
Select Controller →LMC058 →LMC058 Expert IO →Administrative →
EXPERTGetCapturedValue in the list, drag-and-drop the item onto the POU window.
2 Link the EXPERT_REF_IN input to the HSC_REF output of the HSC.
Function Description
This administrative function block returns the details of a detected HSC error.
Graphical Representation
IL and ST Representation
To see the general representation in IL or ST language, refer to Function and Function Block
Representation (see page 241).
NOTE: For more information about Done, Busy and Execution pins, refer to General Information
on Function Block Management (see page 203).
This table indicates the diagnostic values:
11(1) – Absolute SSI encoder status bit 0. Refer to your encoder user
guide.
12(1) – Absolute SSI encoder status bit 1. Refer to your encoder user
guide.
13(1) – Absolute SSI encoder status bit 2. Refer to your encoder user
guide.
14(1) – Absolute SSI encoder status bit 3. Refer to your encoder user
guide.
15(1) – –
(1) In case of a detected SSI error set the Enable condition (see page 198) to 0 to acknowledge the error
condition.
Step Description
1 Select the Libraries tab in the Software Catalog and click Libraries.
Select Controller →LMC058 →LMC058 Expert IO →Administrative →EXPERTGetDiag in
the list, drag-and-drop the item onto the POU window.
2 Link the EXPERT_REF_IN input to the HSC_REF output of the HSC.
Function Description
This administrative function block returns a parameter value of an HSC.
Graphical Representation
IL and ST Representation
To see the general representation in IL or ST language, refer to Function and Function Block
Representation (see page 241).
NOTE: For more information about Done, Busy and Execution pins, refer to General Information
on Function Block Management (see page 203).
Step Description
1 Select the Libraries tab in the Software Catalog and click Libraries.
Select Controller →LMC058 →LMC058 Expert IO →Administrative →EXPERTGetParam
in the list, drag-and-drop the item onto the POU window.
2 Link the EXPERT_REF_IN input to the HSC_REF output of the HSC.
Function Description
This administrative function block modifies the value of a parameter of an HSC.
Graphical Representation
IL and ST Representation
To see the general representation in IL or ST language, refer to Function and Function Block
Representation (see page 241).
NOTE: For more information about Done, Busy, and Execution pins, refer to General
Information on Function Block Management (see page 203).
Step Description
1 Select the Libraries tab in the Software Catalog and click Libraries.
Select Controller →LMC058 →LMC058 Expert IO →Administrative →EXPERTSetParam
in the list, drag-and-drop the item onto the POU window.
2 Link the EXPERT_REF_IN input to the HSC_REF output of the HSC.
Function Description
This function block controls a Encoder type counter.
The function block instance name must match the name defined by the configuration.
Graphical Representation
IL and ST Representation
To see the general representation in IL or ST language, refer to Function and Function Block
Representation (see page 241).
EN_Out0 BOOL TRUE = enables Output0 to echo the Reflex0 value (if
configured, on DM72F modules).
EN_Out1 BOOL TRUE = enables Output1 to echo the Reflex1 value (if
configured, on DM72F modules).
F_Enable BOOL Forces the Enable condition (see page 198).
In case of a detected SSI error setting the F_Enable input to 0
acknowledges the error.
F_Preset BOOL Forces the Preset condition.
F_Out0 BOOL TRUE = forces Output0 to 1 (if Reflex0 is configured).
F_Out1 BOOL TRUE = forces Output1 to 1 (if Reflex1 is configured).
ACK_Overflow BOOL On rising edge, resets the Overflow_Flag.
ACK_Preset BOOL On rising edge, resets Preset_Flag.
ACK_Cap0 BOOL On rising edge, resets Cap0_Flag.
ACK_Cap1 BOOL On rising edge, resets Cap1_Flag.
SuspendCompare BOOL TRUE = the comparator operation results are frozen:
TH0, TH1, TH2, TH3, Reflex0, Reflex1 output bits
maintain their last value.
Hardware Outputs 0, 1 maintain their last value.
Events are masked. EN_Compare, EN_Reflex0,
EN_Reflex1, F_Out0, F_Out1 remain operational while
SupendCompare is set.
Function Description
This function block controls a Main type counter with the following functions:
up/down counting
frequency-meter
thresholds
events
The HSC Main function block is mandatory when using Main counter.
The function block instance name must match the name defined by the configuration.
The function block instance name must match the name defined by configuration. Hardware
related information managed by this function block is synchronized with the MAST task cycle.
WARNING
UNINTENDED OUTPUT VALUES
Only use the Function Block instance in the MAST task.
Do not use the same Function Block instance in a different task.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
NOTE: Forcing the logical output values of the FB is allowed by SoMachine but it will have no
impact on hardware related outputs if the function is active (executing).
Graphical Representation
IL and ST Representation
To see the general representation in IL or ST language, refer to Function and Function Block
Representation (see page 241).
EN_Out0 BOOL TRUE = enables Output0 to echo the Reflex0 value (if configured in
One shot, Modulo loop, Free large modes).
EN_Out1 BOOL TRUE = enables Output1 to echo the Reflex1 value (if configured in
One shot, Modulo loop, Free large modes).
F_Enable BOOL TRUE = authorizes changes to the current counter value.
Function Description
This function block controls a Simple type counter with the following reduced functions:
one-way counting
no threshold
The HSCSimple function block is mandatory when using a Simple counter type.
The function block instance name must match the name defined by the configuration.
The function block instance name must match the name defined by configuration. Hardware
related information managed by this function block is synchronized with the MAST task cycle.
WARNING
UNINTENDED OUTPUT VALUES
Only use the Function Block instance in the MAST task.
Do not use the same Function Block instance in a different task.
Failure to follow these instructions can result in death, serious injury, or equipment
damage.
NOTE: Forcing the logical output values of the FB is allowed by SoMachine but it will have no
impact on hardware related outputs if the function is active (executing).
Graphical Representation
IL and ST Representation
To see the general representation in IL or ST language, refer to Function and Function Block
Representation (see page 241).
Appendix D
Function and Function Block Representation
Overview
Each function can be represented in the following languages:
IL: Instruction List
ST: Structured Text
LD: Ladder Diagram
FBD: Function Block Diagram
CFC: Continuous Function Chart
This chapter provides functions and function blocks representation examples and explains how to
use them for IL and ST languages.
Function
A function:
is a POU (Program Organization Unit) that returns one immediate result.
is directly called with its name (not through an instance).
has no persistent state from one call to the other.
can be used as an operand in other expressions.
Function Block
A function block:
is a POU (Program Organization Unit) that returns one or more outputs.
needs to be called by an instance (function block copy with dedicated name and variables).
each instance has a persistent state (outputs and internal variables) from one call to the other
from a function block or a program.
Examples: timers, counters
In the example, Timer_ON is an instance of the function block TON:
General Information
This part explains how to implement a function and a function block in IL language.
Functions IsFirstMastCycle and SetRTCDrift and Function Block TON are used as
examples to show implementations.
Step Action
1 Open or create a new POU in Instruction List language.
NOTE: The procedure to create a POU is not detailed here. For more information, refer to Adding
and Calling POUs (see SoMachine, Programming Guide).
2 Create the variables that the function requires.
3 If the function has 1 or more inputs, start loading the first input using LD instruction.
4 Insert a new line below and:
type the name of the function in the operator column (left field), or
use the Input Assistant to select the function (select Insert Box in the context menu).
5 If the function has more than 1 input and when Input Assistant is used, the necessary number of lines
is automatically created with ??? in the fields on the right. Replace the ??? with the appropriate
value or variable that corresponds to the order of inputs.
6 Insert a new line to store the result of the function into the appropriate variable: type ST instruction
in the operator column (left field) and the variable name in the field on the right.
To illustrate the procedure, consider the Functions IsFirstMastCycle (without input parameter)
and SetRTCDrift (with input parameters) graphically presented below:
IL example of a function
with input parameters:
SetRTCDrift
Step Action
1 Open or create a new POU in Instruction List language.
NOTE: The procedure to create a POU is not detailed here. For more information, refer to Adding and
Calling POUs (see SoMachine, Programming Guide).
2 Create the variables that the function block requires, including the instance name.
Step Action
3 Function Blocks are called using a CAL instruction:
Use the Input Assistant to select the FB (right-click and select Insert Box in the context menu).
Automatically, the CAL instruction and the necessary I/O are created.
4 In the CAL right-side field, replace ??? with the instance name.
5 Replace other ??? with an appropriate variable or immediate value.
To illustrate the procedure, consider this example with the TON Function Block graphically
presented below:
In IL language, the function block name is used directly in the operator column:
General Information
This part explains how to implement a Function and a Function Block in ST language.
Function SetRTCDrift and Function Block TON are used as examples to show implementations.
Step Action
1 Open or create a new POU in Structured Text language.
NOTE: The procedure to create a POU is not detailed here. For more information, refer to Adding
and Calling POUs (see SoMachine, Programming Guide).
2 Create the variables that the function requires.
3 Use the general syntax in the POU ST Editor for the ST language of a function. The general
syntax is:
FunctionResult:= FunctionName(VarInput1, VarInput2,.. VarInputx);
To illustrate the procedure, consider the function SetRTCDrift graphically presented below:
Step Action
1 Open or create a new POU in Structured Text language.
NOTE: The procedure to create a POU is not detailed here. For more information on adding,
declaring and calling POUs, refer to the related documentation (see SoMachine, Programming
Guide).
2 Create the input and output variables and the instance required for the function block:
Input variables are the input parameters required by the function block
Output variables receive the value returned by the function block
3 Use the general syntax in the POU ST Editor for the ST language of a Function Block. The general
syntax is:
FunctionBlock_InstanceName(Input1:=VarInput1, Input2:=VarInput2,...
Ouput1=>VarOutput1, Ouput2=>VarOutput2,...);
To illustrate the procedure, consider this example with the TON function block graphically
presented below:
Glossary
A
application
A program including configuration data, symbols, and documentation.
B
byte
A type that is encoded in an 8-bit format, ranging from 16#00 to 16#FF in hexadecimal
representation.
C
CAN
(controller area network) A protocol (ISO 11898) for serial bus networks, designed for the intercon-
nection of smart devices (from multiple manufacturers) in smart systems and for real-time industrial
applications. Originally developed for use in automobiles, CAN is now used in a variety of industrial
automation control environments.
CANmotion
A CANopen-based motion bus with an additional mechanism that provides synchronization
between the motion controller and the drives.
CFC
(continuous function chart) A graphical programming language (an extension of the IEC 61131-3
standard) based on the function block diagram language that works like a flowchart. However, no
networks are used and free positioning of graphic elements is possible, which allows feedback
loops. For each block, the inputs are on the left and the outputs on the right. You can link the block
outputs to the inputs of other blocks to create complex expressions.
controller
Automates industrial processes (also known as programmable logic controller or programmable
controller).
CPDM
(controller power distribution module) The connection of the controller to the external 24 Vdc power
supplies and the beginning of the power distribution for the local configuration.
E
encoder
A device for length or angular measurement (linear or rotary encoders).
F
FB
(function block) A convenient programming mechanism that consolidates a group of programming
instructions to perform a specific and normalized action, such as speed control, interval control, or
counting. A function block may comprise configuration data, a set of internal or external operating
parameters and usually 1 or more data inputs and outputs.
function
A programming unit that has 1 input and returns 1 immediate result. However, unlike FBs, it is
directly called with its name (as opposed to through an instance), has no persistent state from one
call to the next and can be used as an operand in other programming expressions.
Examples: boolean (AND) operators, calculations, conversions (BYTE_TO_INT)
function block
A programming unit that has 1 or more inputs and returns 1 or more outputs. FBs are called through
an instance (function block copy with dedicated name and variables) and each instance has a
persistent state (outputs and internal variables) from 1 call to the other.
Examples: timers, counters
function block diagram
One of the 5 languages for logic or control supported by the standard IEC 61131-3 for control
systems. Function block diagram is a graphically oriented programming language. It works with a
list of networks where each network contains a graphical structure of boxes and connection lines
representing either a logical or arithmetic expression, the call of a function block, a jump, or a return
instruction.
H
hex
(hexadecimal)
HSC
(high-speed counter)
I
I/O
(input/output)
ID
(identifier/identification)
IEC 61131-3
Part 3 of a 3-part IEC standard for industrial automation equipment. IEC 61131-3 is concerned with
controller programming languages and defines 2 graphical and 2 textual programming language
standards. The graphical programming languages are ladder diagram and function block diagram.
The textual programming languages include structured text and instruction list.
IL
(instruction list) A program written in the language that is composed of a series of text-based
instructions executed sequentially by the controller. Each instruction includes a line number, an
instruction code, and an operand (refer to IEC 61131-3).
INT
(integer) A whole number encoded in 16 bits.
L
LD
(ladder diagram) A graphical representation of the instructions of a controller program with symbols
for contacts, coils, and blocks in a series of rungs executed sequentially by a controller (refer to
IEC 61131-3).
LMC058
Lexium motion controller A Modicon logic controller
N
network
A system of interconnected devices that share a common data path and protocol for
communications.
node
An addressable device on a communication network.
P
POU
(program organization unit) A variable declaration in source code and a corresponding instruction
set. POUs facilitate the modular re-use of software programs, functions, and function blocks. Once
declared, POUs are available to one another.
program
The component of an application that consists of compiled source code capable of being installed
in the memory of a logic controller.
PTO
(pulse train outputs) a fast output that oscillates between off and on in a fixed 50-50 duty cycle,
producing a square wave form. The PTO is especially well suited for applications such as stepper
motors, frequency converters, and servo motor control, among others.
PWM
(pulse width modulation) A fast output that oscillates between off and on in an adjustable duty
cycle, producing a rectangular wave form (though you can adjust it to produce a square wave). The
PTO is well adapted to simulate or approximate an analog output in that it regulates the voltage of
the output over its period making it useful in light dimming or speed control applications, among
others.
R
reflex output
Among the outputs of HSC are the reflex outputs associated to a threshold value that is compared
to the counter value depending on the configuration of the HSC. The reflex outputs switch to either
on or off depending on the configured relationship with the threshold.
run
A command that causes the controller to scan the application program, read the physical inputs,
and write to the physical outputs according to solution of the logic of the program.
S
ST
(structured text) A language that includes complex statements and nested instructions (such as
iteration loops, conditional executions, or functions). ST is compliant with IEC 61131-3.
STOP
A command that causes the controller to stop running an application program.
T
task
A group of sections and subroutines, executed cyclically or periodically for the MAST task or
periodically for the FAST task.
A task possesses a level of priority and is linked to inputs and outputs of the controller. These I/O
are refreshed in relation to the task.
A controller can have several tasks.
V
variable
A memory unit that is addressed and modified by a program.
Index
A E
adjusting functions Enable
EXPERTGetParam, 227 Function, 198
EXPERTSetParam, 229 Encoder
Capture, 188
Function Blocks, 231
B Encoder Modes
Busy Incremental, 126
Management of Status Variables, 203 SSI absolute, 158
ErrID
Error Handling, 203
C Management of Status Variables, 203
Capture Error
Encoder, 188 Error Handling, 203
HSCMain, 185 Management of Status Variables, 203
CommandAborted Error Handling
Management of Status Variables, 203 ErrID, 203
Comparison Error, 203
HSCMain, 175 Event Counting
Counter Blocks HSC Modes of Embedded HSC, 91
HSCMain, 234 Execute
HSCSimple, 238 Management of Status Variables, 203
EXPERT_ERR_TYPE
Data Types, 208
D EXPERT_PARAMETER_TYPE
Data Types Data Types, 209
EXPERT_ERR_TYPE, 208 EXPERT_TIMEBASE_TYPE
EXPERT_PARAMETER_TYPE, 209 Data Types, 211
EXPERT_TIMEBASE_TYPE, 211 EXPERTGetCapturedValue
HSC_REF, 210 Function Blocks, 222
MC_IMMEDIATE_ERR_TYPE, 206, 207 EXPERTGetDiag
dedicated features, 202 Function Blocks, 224
diagnostic functions EXPERTGetImmediateValue
EXPERTGetDiag, 224 Functions, 220
Done EXPERTGetParam, 227
Management of Status Variables, 203 EXPERTSetParam
Function Blocks, 229
P
period meter
configuration, 119
description, 115
programming, 120
synopsis, 118
S
SSI absolute
Encoder Modes, 158