Schneider Electric Modicon M258 User Guide
Pubblicità
Pubblicità
Modicon M258 Logic Controller
EIO0000004153 09/2020
Modicon M258 Logic
Controller
Pulse Width Modulation
M258 Expert I/O Library Guide
09/2020 www.schneider-electric.com
2
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.
You agree not to reproduce, other than for your own personal, noncommercial use, all or part of this document on any medium whatsoever without permission of Schneider Electric, given in writing. You also agree not to establish any hypertext links to this document or its content.
Schneider Electric does not grant any right or license for the personal and noncommercial use of the document or its content, except for a non-exclusive license to consult it on an "as is" basis, at your own risk. All other rights are reserved.
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.
© 2020 Schneider Electric. All rights reserved.
EIO0000004153 09/2020
Table of Contents
Safety Information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
About the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Expert I/O Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Add an Expert function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Embedded Expert I/O Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 2 Generalities. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PWM Naming Convention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Synchronization and Enable Functions . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 3 Pulse Width Modulation (PWM) . . . . . . . . . . . . . . . . . . .
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PWM_M258: Command a Pulse Width Modulation Signal . . . . . . . . .
Programming the PWM Function Block. . . . . . . . . . . . . . . . . . . . . . . .
Chapter 4 Frequency Generator (FreqGen) . . . . . . . . . . . . . . . . . .
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Frequency_Generator_M258: Commanding a Square Wave Signal. .
Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Appendices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Appendix A General Information . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Dedicated Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
General Information on Function Block Management . . . . . . . . . . . . .
Appendix B Function and Function Block Representation . . . . . . . .
Differences Between a Function and a Function Block . . . . . . . . . . . .
How to Use a Function or a Function Block in IL Language . . . . . . . .
How to Use a Function or a Function Block in ST Language . . . . . . .
Appendix C Data Unit Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
EXPERT_ERR_TYPE: Type for Error Variable on an Expert Function
Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
45
46
47
49
37
39
41
43
50
51
55
59
30
32
35
36
24
25
26
28
15
18
21
23
11
12
5
7
59
61
65
EIO0000004153 09/2020
3
4
EIO0000004153 09/2020
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, service, 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.
EIO0000004153 09/2020
5
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.
6
EIO0000004153 09/2020
About the Book
At a Glance
Document Scope
This documentation acquaints you with the pulse width modulated output and frequency generator functions offered within the Modicon M258 Logic Controller.
This documentation describes the data types and functions of the M258 PWM/FreqGen library.
In order to use this manual, you must:
Have a thorough understanding of the M258, including its design, functionality, and implemen -
tation 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 can be used with the M258 PWM/FreqGen library.
Validity Note
This document has been updated for the release of EcoStruxure TM Machine Expert V1.2.5.
The technical characteristics of the devices described in the present document also appear online.
To access the information online, go to the Schneider Electric home page
https://www.se.com/ww/en/download/
.
The characteristics that are described in the present document should be the same as those characteristics that appear online. In line with our policy of constant improvement, we may revise content over time to improve clarity and accuracy. If you see a difference between the document and online information, use the online information as your reference.
EIO0000004153 09/2020
7
8
Related Documents
Title of Documentation
Modicon M258 Logic Controller Programming Guide
Modicon M258 Logic Controller Hardware Guide
Reference Number
EIO0000004135 (ENG)
EIO0000004136 (FRE)
EIO0000004137 (GER)
EIO0000004138 (SPA)
EIO0000004139 (ITA)
EIO0000004140 (CHS)
EIO0000004159 (ENG)
EIO0000004160 (FRE)
EIO0000004161 (GER)
EIO0000004162 (SPA)
EIO0000004163 (ITA)
EIO0000004164 (CHS)
You can download these technical publications and other technical information from our website at https://www.se.com/ww/en/download/ .
Product Related Information
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.
1 For 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.
EIO0000004153 09/2020
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.
Terminology Derived from Standards
The technical terms, terminology, symbols and the corresponding descriptions in this manual, or that appear in or on the products themselves, are generally derived from the terms or definitions of international standards.
In the area of functional safety systems, drives and general automation, this may include, but is not limited to, terms such as
safety
,
safety function error
,
error message
,
dangerous
, etc.
,
safe state
,
fault
,
fault reset
,
malfunction
,
failure
,
Among others, these standards include:
Standard
IEC 61131-2:2007
ISO 13849-1:2015
EN 61496-1:2013
ISO 12100:2010
EN 60204-1:2006
ISO 14119:2013
ISO 13850:2015
IEC 62061:2015
IEC 61508-1:2010
IEC 61508-2:2010
IEC 61508-3:2010
IEC 61784-3:2016
Description
Programmable controllers, part 2: Equipment requirements and tests.
Safety of machinery: Safety related parts of control systems.
General principles for design.
Safety of machinery: Electro-sensitive protective equipment.
Part 1: General requirements and tests.
Safety of machinery - General principles for design - Risk assessment and risk reduction
Safety of machinery - Electrical equipment of machines - Part 1: General requirements
Safety of machinery - Interlocking devices associated with guards - Principles for design and selection
Safety of machinery - Emergency stop - Principles for design
Safety of machinery - Functional safety of safety-related electrical, electronic, and electronic programmable control systems
Functional safety of electrical/electronic/programmable electronic safetyrelated systems: General requirements.
Functional safety of electrical/electronic/programmable electronic safetyrelated systems: Requirements for electrical/electronic/programmable electronic safety-related systems.
Functional safety of electrical/electronic/programmable electronic safetyrelated systems: Software requirements.
Industrial communication networks - Profiles - Part 3: Functional safety fieldbuses - General rules and profile definitions.
EIO0000004153 09/2020
9
10
Standard
2006/42/EC
2014/30/EU
2014/35/EU
Description
Machinery Directive
Electromagnetic Compatibility Directive
Low Voltage Directive
In addition, terms used in the present document may tangentially be used as they are derived from other standards such as:
Standard
IEC 60034 series
IEC 61800 series
IEC 61158 series
Description
Rotating electrical machines
Adjustable speed electrical power drive systems
Digital data communications for measurement and control – Fieldbus for use in industrial control systems
(
Finally, the term hazards, and is defined as it is for a
2006/42/EC zone of operation
) and
ISO 12100:2010
may be used in conjunction with the description of specific
.
hazard zone
or
danger zone
in the
Machinery Directive
NOTE: The aforementioned standards may or may not apply to the specific products cited in the present documentation. For more information concerning the individual standards applicable to the products described herein, see the characteristics tables for those product references.
EIO0000004153 09/2020
Modicon M258 Logic Controller
Introduction
EIO0000004153 09/2020
Introduction
Chapter 1
Introduction
What Is in This Chapter?
This chapter contains the following topics:
Topic
Expert I/O Overview
Add an Expert function
Embedded Expert I/O Mapping
Page
EIO0000004153 09/2020
11
Introduction
Expert I/O Overview
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 Controller Power Distribution Module (CPDM)
Each embedded expert I/O module (DM72F•) can support expert functions
( see page 15 )
Embedded Expert I/O Configuration
To configure the expert I/Os, double-click the Expert node in the Devices tree.
This figure presents the configuration tab screenshot:
12
This table presents the function of the different parameters:
Parameter
Run/Stop Input
Alarm Output
Rearming Output Mode
Function
Define one input to be used as Run/Stop input
.
Define one output to be used as alarm output
.
Define the rearming output mode
.
EIO0000004153 09/2020
Introduction
Run/Stop Input
This table presents the different states:
Input states
State 0
A rising edge
State 1
Result
Stops the controller and ignores external Run commands.
From the STOPPED state, initiates a start-up of an application in RUNNING state.
The application can be controlled by:
EcoStruxure Machine Expert (Run/Stop)
the application (Controller command) a network command
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 M258 Logic 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 M258 Logic Controller, Programming Guide)
.
WARNING
UNINTENDED MACHINE OR PROCESS START-UP
Verify 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).
EIO0000004153 09/2020
13
Introduction
Rearming Output Mode
Fast outputs of DM72F• modules are push/pull technology. In the case of an error detected (shortcircuit or over temperature), the output is put in tri-state and the condition is signaled by status bit
(DM72F• channel IB1.0) and PLC_R.i_wLocalIOStatus (refer to the Modicon M258 Logic Controller
System Functions and Variables PLCSystem Library Guide).
Two behaviors are possible:
Automatic rearming: as soon as the detected error is corrected, the output is set again according
to the current value assigned to it and the diagnostic value is reset.
Manual rearming: when an error is detected, the status is memorized and the output is forced to tri-state until user manually clears the status (see I/O mapping channel).
In the case of a short-circuit or current overload, the common group of outputs automatically enters into thermal protection mode (all outputs in the group are set to 0), and are then periodically rearmed (each second) to test the connection state. However, you must be aware of the effect of this rearming on the machine or process being controlled.
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.
14
EIO0000004153 09/2020
Introduction
Add an Expert function
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 (FreqGen)
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 12 )
.
Adding an Expert Function
To add an Expert function (Event_Latch, HSC, PWM or Frequency Generator) to your controller, select the Expert function you want in the Hardware Catalog, drag it to the Devices tree, and drop it on one of the highlighted nodes.
For more information on adding a device to your project, refer to:
• Using the Drag-and-drop Method
(see EcoStruxure Machine Expert, Programming Guide)
• Using the Contextual Menu or Plus Button
(see EcoStruxure Machine Expert, Programming
Guide)
To add an Encoder function, select the Standard Encoder in the Hardware Catalog, drag it to the
Devices tree, and drop it on one of the highlighted nodes.
EIO0000004153 09/2020
15
Introduction
The following expert functions can be added:
Function
Event_Latch
HSC
PWM
Frequency
Generator
Encoder
Description
With the Event_Latch function, the Embedded Expert inputs can be configured as event or latch.
The HSC functions can execute fast counts of pulses from sensors, encoders, switches, etc. that are connected to dedicated fast inputs.
Refer to...
Event_Latch configuration
(see Modicon M258 Logic
Controller, Programming Guide)
M258 HSC Library
(see Modicon M258 Logic
Controller, High Speed
Counting, M258 Expert I/O
Library Guide)
M258 PWM library The PWM function generates a square wave signal on dedicated output channels with a variable duty cycle.
The Frequency Generator function generates a square wave signal on dedicated output channels with a fixed duty cycle (50%).
The goal of this function is to connect an encoder to acquire a position.
This function can be installed on an Embedded Expert
I/O interface and supports only an incremental encoder.
You can configure a linear or rotary axis.
M258 HSC Library
(see Modicon M258 Logic
Controller, High Speed
Counting, M258 Expert I/O
Library Guide)
Expert Function Assignment
Expert functions assignment according to the interface (columns exclude each other):
I/F
Interface
DM72F0
DM72F1
Expert Functions
Simple functions:
Fast I/O: Event or latched
HSC Simple
Up to 4
Up to 4
HSC_Main
1
1
Encoder
1
1
PWM
1
1
1
1
Frequency
Generator
For more details, refer to Expert I/O Mapping
( see page 18 )
.
16
EIO0000004153 09/2020
Introduction
Expert Function I/O within Regular I/O
Expert Function I/O within Regular I/O:
Inputs can be read through memory variable standard even if configured in expert function.
An Input can not be configured in an expert function if it has already been configured as a
Run/Stop.
An Output can not be configured in an expert function if it has already been configured as an
Alarm.
%Q will not have any impact on reflex output.
Short-Circuit management still applies on all outputs. Status of outputs are available.
All I/O that are not used by expert functions are available as fast or regular I/O.
When inputs are used in expert functions (Latch, HSC,…), integrator filter is replaced by antibounce filter
(see Modicon M258, Logic Controller, Hardware Guide)
in expert function screen.
. Filter value will be configured
EIO0000004153 09/2020
17
Introduction
Embedded Expert I/O Mapping
I/O Mapping for Expert Functions on DM72F•
Embedded Expert I/O mapping by expert function:
I0
M
I1 I2
Event_Latch 0/4
Event_Latch 1/5
Event_Latch 2/6
Event_Latch 3/7
HSC Simple 0/4
HSC Simple 1/5
HSC Simple 2/6
HSC Simple 3/7
HSC Main 0/1
PWM 0/1
SYNC
EN
Frequency Generator 0/1 Outputs
SYNC
Standard Encoder
EN
Input A
Input B
SYNC
CAP
EN
REF
Outputs
M Mandatory
C Depends on Configuration
Input B
SYNC
CAP
EN
REF
Outputs
Outputs
Input
Input
Input
Input
Input A
Input A
Input A
Input A
Input A
M
M
M
M
M
C
M
M
M
C
C
C
C
I3 I4 I5 Q0 Q1
M
M
C
C
C
C
C
C
C
C
C
M
C
M
C C
18
EIO0000004153 09/2020
Introduction
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
1
2
Action
In the Devices tree tab, expand the Expert node.
Right-click DM72F• and select IO Summary in context menu.
Example of IO Summary:
EIO0000004153 09/2020
19
Introduction
20
EIO0000004153 09/2020
Modicon M258 Logic Controller
Generalities
EIO0000004153 09/2020
Generalities
Chapter 2
Generalities
Overview
This chapter provides general information of the Pulse Width Modulation (PWM) functions.
The functions provide simple, yet powerful solutions for your application. In particular, they are useful for controlling movement. However, the use and application of the information contained herein require expertise in the design and programming of automated control systems. Only you, the user, machine builder or integrator, can be aware of all the conditions and factors present during installation and setup, operation, and maintenance of the machine or related processes, and can therefore determine the automation and associated equipment and the related safeties and interlocks which can be effectively and properly used. When selecting automation and control equipment, and any other related equipment or software, for a particular application, you must also consider any applicable local, regional, or national standards and/or regulations.
WARNING
REGULATORY INCOMPATIBILITY
Ensure that all equipment applied and systems designed comply with all applicable local, regional, and national regulations and standards.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
The functions provided by the expert functions libraries were conceived and designed assuming that you incorporate the necessary safety hardware into your application architecture, such as, but not limited to, appropriate limit switches and emergency stop hardware and controlling circuitry. It is implicitly assumed that functional safety measures are present in your machine design to prevent undesirable machine behavior such as over-travel or other forms of uncontrolled movement.
Further, it is assumed that you have performed a functional safety analysis and risk assessment appropriate to your machine or process.
WARNING
UNINTENDED EQUIPMENT OPERATION
Ensure that a risk assessment is conducted and respected according to EN/ISO 12100 during the design of your machine.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
EIO0000004153 09/2020
21
Generalities
What Is in This Chapter?
This chapter contains the following topics:
Topic
PWM Naming Convention
Synchronization and Enable Functions
Page
22
EIO0000004153 09/2020
PWM Naming Convention
Definition
In this document, use the following naming convention:
Name
SYNC
EN
IN_SYNC
IN_EN
OUT_PWM
Description
Synchronization function
.
Enable function
.
Physical input dedicated to the SYNC function.
Physical input dedicated to the EN function.
Physical output dedicated to the PWM.
Generalities
EIO0000004153 09/2020
23
Generalities
Synchronization and Enable Functions
Introduction
This section presents the functions used by the PWM:
Synchronization function
Enable function
Each function uses the 2 following function block bits:
EN_(function) bit: Setting this bit to 1 allows the (function) to operate on an external physical
input if configured.
F_(function) bit: Setting this bit to 1 forces the (function).
The following diagram explains how the function is managed:
NOTE: (function) stands either for Enable (for Enable function) or Sync (for Synchronization function).
If the physical input is required, enable it in the configuration screen
( see page 29 )
.
Synchronization Function
The Synchronization function is used to interrupt the current PWM cycle and then restart a new cycle.
Enable Function
The Enable function is used to activate the PWM:
24
EIO0000004153 09/2020
Modicon M258 Logic Controller
Pulse Width Modulation (PWM)
EIO0000004153 09/2020
Pulse Width Modulation (PWM)
Chapter 3
Pulse Width Modulation (PWM)
What Is in This Chapter?
This chapter contains the following topics:
Topic
Description
Configuration
PWM_M258: Command a Pulse Width Modulation Signal
Programming the PWM Function Block
Page
EIO0000004153 09/2020
25
Pulse Width Modulation (PWM)
Description
Overview
The pulse width modulation function generates a programmable pulse wave signal on a dedicated output with adjustable duty cycle and frequency.
NOTE: Enable the functionality either by setting F_Enable to 1, or by an external event with the
IN_EN input and EN_Enable =1, otherwise the output (OUT_PWM) stays to 0.
When a Pulse Width Modulation (PWM) is configured on an Expert I/O module, no other functions
( see page 12 )
.
Signal Form
The signal form depends on the following input parameters:
Frequency configurable from 0.1 Hz to 20 kHz with a 0.1 Hz step
Duty Cycle of the output signal from 0% to 100%
Duty Cycle=Tp/T
Tp pulse width
T pulse period (1/Frequency)
Modifying the duty cycle in the program modulates the width of the signal. Below is an illustration of an output signal with varying duty cycles.
26
EIO0000004153 09/2020
Pulse Width Modulation (PWM)
The duty cycle is shown for a precision of 1% for each step of 80 Hz. When duty cycle is below 4% or above 96%, depending on the frequency, the deviation is above 1% as illustrated in the graphic below:
EIO0000004153 09/2020
27
Pulse Width Modulation (PWM)
Configuration
Overview
Two pulse width modulation functions can be configured on the controller.
Adding a Pulse Width Modulation Function
To add a pulse width modulation function to your controller, select PWM in the Hardware Catalog, drag it to the Devices tree, and drop it on one of the highlighted nodes.
For more information on adding a device to your project, refer to:
• Using the Drag-and-drop Method
(see EcoStruxure Machine Expert, Programming Guide)
• Using the Contextual Menu or Plus Button
(see EcoStruxure Machine Expert, Programming
Guide)
Accessing the Parameters
To access the PWM function parameters, proceed as follows:
Step
1
2
Action
In the Devices tree, double-click MyController → Expert → DM72Fx → PWM.
Select the PWM Configuration tab.
28
EIO0000004153 09/2020
Pulse Width Modulation (PWM)
Parameters
The pulse width modulation function has the following parameters:
Parameter Value
SYNC input
EN input
Location
Bounce filter
SYNC Edge
Location
Bounce filter
Rising
Falling
Both
Disabled
I1.4
0.002
0.004
0.012
0.04
0.12
0.4
1.2
4
Disabled
I1.2
0.002
0.004
0.012
0.04
0.12
0.4
1.2
4
Default
Value
0.002
Description
Disabled Select the controller input used for presetting the pulse generator function.
Set the filtering value to reduce the bounce effect on the SYNC input.
Rising Select the condition to preset the pulse generator function with the SYNC input.
Disabled Select the controller input used for enabling the pulse generator function.
0.002
Set the filtering value to reduce the bounce effect on the EN input.
Synchronizing with an External Event
On a rising edge on the IN_SYNC physical input (with EN_Sync = 1), the current cycle is interrupted and the PWM restarts a new cycle.
This illustration provides a pulse diagram for the Pulse Width Modulation function block with use of IN_SYNC input:
EIO0000004153 09/2020
29
Pulse Width Modulation (PWM)
PWM_M258: Command a Pulse Width Modulation Signal
Overview
The Pulse Width Modulation function block commands a pulse width modulated signal output at the specified frequency and duty cycle.
Graphical Representation
IL and ST Representation
To see the general representation in IL or ST language, refer to the
Differences Between a
Function and a Function Block ( see page 50 )
Input Variables
This table describes the input variables:
Inputs
EN_Enable
F_Enable
EN_SYNC
F_SYNC
Frequency
Duty
Type
BOOL
BOOL
BOOL
BOOL
DWORD
BYTE
Comment
TRUE = authorizes the PWM enable via the IN_EN input (if configured).
TRUE = forces the Enable function.
TRUE = authorizes the restart via the IN_Sync input of the internal timer relative to the time base (if configured).
On a rising edge, forces a restart of the internal timer relative to the time base.
Frequency of the Pulse Width Modulation output signal in tenths of
Hz (range: 1 (0.1 Hz)...200,000 (20 kHz)).
Duty cycle of the Pulse Width Modulation output signal in % (range:
0...100).
30
EIO0000004153 09/2020
Pulse Width Modulation (PWM)
Output Variables
This table describes the output variables:
Outputs Type
InFrequency BOOL
Busy
Error
ErrID
BOOL
BOOL
Comment
TRUE = the Pulse Width Modulation signal is currently being output at the specified frequency and duty cycle.
Busy is used to indicate that a command change is in progress: the frequency is changed.
Set to TRUE when the Enable command is set and the Frequency
Generator signal is not output at the specified Frequency.
Reset to FALSE when InFrequency or Error is set, or when the
Enable command is reset.
When a command change execution is immediate, Busy remains
FALSE .
TRUE = indicates that an error was detected.
When Error is set: type of the detected error.
EIO0000004153 09/2020
31
Pulse Width Modulation (PWM)
Programming the PWM Function Block
Procedure
Follow these steps to program a PWM function block:
Step Action
1 Select the Libraries tab in the Software Catalog and click Libraries.
Select Controller → M258 → M258 Expert IO → OutputGenerator → PWM_M258 in the list, dragand-drop the item onto the POU window.
2
Select the function block instance by clicking .
The Input Assistant dialog is displayed. Select the global variable which references to the added
PWM ( see page 28 ) during the configuration and confirm.
32
NOTE: If the function block instance is not visible, verify if the PWM is configured.
3 The inputs/outputs are detailed in the function block
.
The interaction between the inputs/outputs are detailed in the General Information
.
EIO0000004153 09/2020
Pulse Width Modulation (PWM)
Program Illustration
This illustration shows an example of a PWM_M258 function block programmed.
EIO0000004153 09/2020
33
Pulse Width Modulation (PWM)
34
EIO0000004153 09/2020
Modicon M258 Logic Controller
Frequency Generator (FreqGen)
EIO0000004153 09/2020
Frequency Generator (FreqGen)
Chapter 4
Frequency Generator (FreqGen)
What Is in This Chapter?
This chapter contains the following topics:
Topic
Description
Configuration
Frequency_Generator_M258: Commanding a Square Wave Signal
Programming
Page
EIO0000004153 09/2020
35
Frequency Generator (FreqGen)
Description
Overview
The frequency generator function generates a square wave signal on dedicated output channels with a fixed duty cycle (50%).
Frequency is configurable from 0.1 Hz to 100 kHz with a 0.1 Hz step.
When a frequency generator is configured on an Expert I/O module, no other functions can be
( see page 12 )
.
36
EIO0000004153 09/2020
Frequency Generator (FreqGen)
Configuration
Overview
Two frequency generator functions can be configured on the controller.
Adding a Frequency Generator Function
To add a frequency generator function, proceed as follows:
Step
1
4
5
2
3
Action
Select the FreqGen in the Hardware Catalog, drag it to the Devices tree, and drop it on one of the highlighted nodes.
For more information on adding a device to your project, refer to:
• Using the Drag-and-drop Method
• Using the Contextual Menu or Plus Button
Guide)
(see EcoStruxure Machine Expert, Programming Guide)
(see EcoStruxure Machine Expert, Programming
Double-click FreqGen and open the Frequency Generator Configuration tab.
Set the parameters as shown in the table below.
Double-click the Pulse Generators node of your controller in the Devices Tree.
Double-click the Pulse generation function value and select FreqGen.
Result: The frequency generator configuration parameters are displayed.
Parameters
The frequency generator function has the following parameters:
Parameter
SYNC input Location
Bounce filter
SYNC EDGE
Value
Disabled
(default)
I2
0.002 (default)
0.004
0.012
0.04
0.12
0.4
1.2
4
Rising
Falling
Both
Type
BOOL
ENUM
ENUM
Description
Enables the IN_SYNC physical input to be used for synchronization.
Defines the value of the IN_SYNC filter value.
Defines the IN_SYNC edge on which synchronization occurs.
EIO0000004153 09/2020
37
Frequency Generator (FreqGen)
Parameter
EN input Location
Bounce filter
Value
Disabled
(default)
I4
0.002 (default)
0.004
0.012
0.04
0.12
0.4
1.2
4
Type
BOOL
ENUM
Description
Enables the IN_EN physical input to be used for enabling the functionality.
Defines the value of the IN_EN filter value.
Synchronizing with an External Event
On a rising edge on the IN_SYNC physical input (with EN_Sync = 1), the current cycle is interrupted and the FreqGen restarts a new cycle.
This illustration provides a pulse diagram for the frequency generator function block with use of
IN_SYNC input:
38
EIO0000004153 09/2020
Frequency Generator (FreqGen)
Frequency_Generator_M258: Commanding a Square Wave Signal
Overview
The Frequency Generator function block commands a square wave signal output at the specified frequency.
Graphical Representation (LD/FBD)
IL and ST Representation
To see the general representation in IL or ST language, refer to the
Differences Between a
Function and a Function Block ( see page 50 )
Input Variables
This table describes the input variables:
Inputs
EN_Enable
F_Enable
EN_SYNC
F_SYNC
Frequency
Type
BOOL
BOOL
BOOL
BOOL
DWORD
Comment
TRUE = authorizes the Frequency Generator enable via the IN_EN input
(if configured).
TRUE = forces the Enable function.
TRUE = authorizes the restart via the IN_SYNC input of the internal timer relative to the time base (if configured).
On rising edge, forces a restart of the internal timer relative to the time base.
Frequency of the Frequency Generator output signal in tenths of Hz.
(Range: min 1 (0.1Hz)...max 1,000,000 (100kHz)
EIO0000004153 09/2020
39
Frequency Generator (FreqGen)
Output Variables
This table describes the output variables:
Outputs
InFrequency
Busy
Error
ErrID
Type
BOOL
BOOL
BOOL
Comment
TRUE = the Frequency Generator signal is output at the specified Frequency.
Busy is used to indicate that a command change is in progress: the frequency is changed.
Set to TRUE when the Enable command is set and the Frequency
Generator signal is not output at the specified Frequency.
Reset to FALSE when InFrequency or Error is set, or when the Enable command is reset.
When a command change execution is immediate, Busy remains FALSE .
TRUE = indicates that an error was detected.
When Error is set: type of the detected error.
40
EIO0000004153 09/2020
Frequency Generator (FreqGen)
Programming
Procedure
Follow these steps to program a Frequency Generator function block:
Step Action
1 Select the Libraries tab in the Software Catalog and click Libraries.
Select Controller → M258 → M258 Expert IO → OutputGenerator → FrequencyGenerator_M258 in the list; drag-and-drop the item onto the POU window.
2
Select the function block instance by clicking .
The Input Assistant screen is displayed. Select the global variable which references to the added
FreqGen
during the configuration and confirm.
NOTE: If the function block instance is not visible, verify if the frequency generator is configured.
3 The inputs/outputs are detailed in the function block
The interaction between the inputs/outputs are detailed in the General Information
EIO0000004153 09/2020
41
Frequency Generator (FreqGen)
Program Illustration
The following illustration shows an example of a Frequency Generator_M258 function block programmed.
42
EIO0000004153 09/2020
Modicon M258 Logic Controller
EIO0000004153 09/2020
Appendices
Overview
This appendix extracts parts of the programming guide for technical understanding of the library documentation.
What Is in This Appendix?
The appendix contains the following chapters:
Chapter
A
B
C
Chapter Name
General Information
Function and Function Block Representation
Data Unit Types
Page
EIO0000004153 09/2020
43
44
EIO0000004153 09/2020
Modicon M258 Logic Controller
General Information
EIO0000004153 09/2020
General Information
Appendix A
General Information
What Is in This Chapter?
This chapter contains the following topics:
Topic
Dedicated Features
General Information on Function Block Management
Page
EIO0000004153 09/2020
45
General Information
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:
A
B
Input Bounce Filter Value (ms) Maximum Counter Frequency
Expert
0.000
0.001
200 kHz
200 kHz
0.002
0.005
0.01
0.05
0.1
200 kHz
100 kHz
50 kHz
25 kHz
5 kHz
0.5
1
5
1 kHz
500 Hz
100 Hz
A is the counting input of the counter.
B is the counting input of the dual phase counter.
Maximum Counter Frequency
Regular
1 kHz
1 kHz
1 kHz
1 kHz
1 kHz
1 kHz
1 kHz
1 kHz
500 Hz
100 Hz
Dedicated Outputs
Outputs used by the high speed expert functions can only be accessed through the function block.
They cannot be read or written directly within the application.
WARNING
UNINTENDED EQUIPMENT OPERATION
Do not use the same function block instance in different program tasks.
Do not modify or otherwise change the function block reference (AXIS) while the function block is executing.
Failure to follow these instructions can result in death, serious injury, or equipment damage.
46
EIO0000004153 09/2020
General Information
General Information on Function Block Management
Management of Input Variables
The variables are used with the rising edge of the Execute input. To modify any variable, it is necessary to change the input variables and to trigger the function block again.
According to IEC 61131-3, if any variable of a function block input is missing (= open), then the value from the previous invocation of this instance will be used. In the first invocation the initial value is applied.
Management of Output Variables
The Done , Error , Busy , and CommandAborted outputs are mutually exclusive; only one of them can be TRUE on one function block. When the Execute input is TRUE, one of these outputs is
TRUE.
At the rising edge of the Execute input, the Busy output is set. It remains set during the execution of the function block and is reset at the rising edge of one of the other outputs ( Done , Error ).
The Done output is set when the execution of the function block is successfully completed.
If an error is detected, the function block terminates by setting the Error output, and the error code is contained within the ErrId output.
The Done , Error , ErrID , and CommandAborted outputs are set or reset with the falling edge of
Execute input:
reset if the function block execution is finished.
set for at least one task cycle if the function block execution is not finished.
When an instance of a function block receives a new Execute before it is finished (as a series of commands on the same instance), the function block does not return any feedback, like Done , for the previous action.
Error Handling
All blocks have two outputs that can report error detection during the execution of the function block:
Error = The rising edge of this bit informs that an error was detected.
ErrID = The error code of the error detected.
When an Error occurs, the other output signals, such as Done are reset.
EIO0000004153 09/2020
47
General Information
48
EIO0000004153 09/2020
Modicon M258 Logic Controller
Function and Function Block Representation
EIO0000004153 09/2020
Function and Function Block Representation
Appendix B
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.
What Is in This Chapter?
This chapter contains the following topics:
Topic
Differences Between a Function and a Function Block
How to Use a Function or a Function Block in IL Language
How to Use a Function or a Function Block in ST Language
Page
EIO0000004153 09/2020
49
Function and Function Block Representation
Differences Between a Function and a Function Block
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.
Examples: boolean operators ( AND ), calculations, conversion ( BYTE_TO_INT )
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 :
50
EIO0000004153 09/2020
Function and Function Block Representation
How to Use a Function or a Function Block in IL Language
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.
Using a Function in IL Language
This procedure describes how to insert a function in IL language:
2
3
4
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 EcoStruxure Machine Expert, Programming Guide) .
Create the variables that the function requires.
If the function has 1 or more inputs, start loading the first input using LD instruction.
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
6
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.
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:
Function without input parameter:
IsFirstMastCycle
Graphical Representation with input parameters:
SetRTCDrift
EIO0000004153 09/2020
51
Function and Function Block Representation
In IL language, the function name is used directly in the operator column:
Function
IL example of a function without input parameter:
IsFirstMastCycle
Representation in POU IL Editor
IL example of a function with input parameters:
SetRTCDrift
52
EIO0000004153 09/2020
Function and Function Block Representation
Using a Function Block in IL Language
This procedure describes how to insert a function block in IL language:
4
5
2
3
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 EcoStruxure Machine Expert, Programming Guide) .
Create the variables that the function block requires, including the instance name.
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.
Each parameter (I/O) is an instruction:
Values to inputs are set by " := ".
Values to outputs are set by " => ".
In the CAL right-side field, replace ???
with the instance name.
Replace other ???
with an appropriate variable or immediate value.
To illustrate the procedure, consider this example with the TON Function Block graphically presented below:
Function Block
TON
Graphical Representation
EIO0000004153 09/2020
53
Function and Function Block Representation
In IL language, the function block name is used directly in the operator column:
Function Block
TON
Representation in POU IL Editor
54
EIO0000004153 09/2020
Function and Function Block Representation
How to Use a Function or a Function Block in ST Language
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.
Using a Function in ST Language
This procedure describes how to insert a function in ST language:
2
3
Step
1
Action
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 EcoStruxure Machine Expert, Programming Guide) .
Create the variables that the function requires.
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:
Function
SetRTCDrift
Graphical Representation
The ST language of this function is the following:
Function
SetRTCDrift
Representation in POU ST Editor
PROGRAM MyProgram_ST
VAR myDrift: SINT(-29..29) := 5; myDay: DAY_OF_WEEK := SUNDAY; myHour: HOUR := 12; myMinute: MINUTE; myRTCAdjust: RTCDRIFT_ERROR;
END_VAR myRTCAdjust:= SetRTCDrift(myDrift, myDay, myHour, myMinute);
EIO0000004153 09/2020
55
Function and Function Block Representation
Using a Function Block in ST Language
This procedure describes how to insert a function block in ST language:
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 EcoStruxure Machine Expert, 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:
Function Block
TON
Graphical Representation
56
EIO0000004153 09/2020
Function and Function Block Representation
This table shows examples of a function block call in ST language:
Function Block
TON
Representation in POU ST Editor
EIO0000004153 09/2020
57
Function and Function Block Representation
58
EIO0000004153 09/2020
Modicon M258 Logic Controller
Data Unit Types
EIO0000004153 09/2020
Data Unit Types
Appendix C
Data Unit Types
EXPERT_ERR_TYPE: Type for Error Variable on an Expert Function Block
Enumerated Type Description
The table below lists the values for the enumerated data type ENUM:
Enumerator
EXPERT_NO_ERROR
EXPERT_UNKNOWN
Value Description
00 hex No error detected.
01 hex The reference EXPERT is incorrect or not configured.
EXPERT_UNKNOWN_PARAMETER
EXPERT_INVALID_PARAMETER
02 hex The parameter reference is incorrect.
03 hex The value of the parameter is incorrect.
EXPERT_COM_ERROR 04 hex A communication problem was detected with the EXPERT module.
EXPERT_CAPTURE_NOT_CONFIGURED 05 hex Capture is not configured.
EIO0000004153 09/2020
59
Data Unit Types
60
EIO0000004153 09/2020
Modicon M258 Logic Controller
Glossary
EIO0000004153 09/2020
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 00 hex to FF hex.
C
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.
control network
A network containing logic controllers, SCADA systems, PCs, HMI, switches, ...
Two kinds of topologies are supported:
flat: all modules and devices in this network belong to same subnet.
2 levels: the network is split into an operation network and an inter-controller network.
These two networks can be physically independent, but are generally linked by a routing device.
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).
EIO0000004153 09/2020
61
Glossary
F
FAST I/O
FAST input/output
Specific I/O modules with some electrical features (for example, response time) while the treatment of these channels are done directly by the controller
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 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
HSC
(
high-speed counter
inputs.
) A function that counts pulses on the controller or on expansion module
I
I/O
(
input/output
)
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).
62
EIO0000004153 09/2020
Glossary
INT
(
integer
) A whole number encoded in 16 bits.
L
LD
(
ladder diagram
IEC 61131-3).
) 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
N
network
A system of interconnected devices that share a common data path and protocol for communications.
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.
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).
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.
EIO0000004153 09/2020
63
Glossary
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.
64
EIO0000004153 09/2020
Modicon M258 Logic Controller
Index
EIO0000004153 09/2020
Index
D
data unit types
EXPERT_ERR_TYPE,
46
59
E
error handling
Error,
47
47
EXPERT_ERR_TYPE
59
F
frequency generator configuration, description,
24
36
37
41
FrequencyGenerator_M258 commanding a square wave signal , function blocks
FrequencyGenerator_M258,
30
50
51
55
24
39
39
functions differences between a function and a
how to use a function or a function block
how to use a function or a function block
M
management of status variables
Busy,
Done,
Error,
47
47
47
47
47
47
P
Programming
PWM,
32
pulse width modulation configuration, description,
PWM signal,
32
30
PWM_M258 commanding a pulse width modulation
30
26
28
EIO0000004153 09/2020
65
Index
66
EIO0000004153 09/2020
Scarica
Pubblicità