152
EIO0000000363.03 www.schneider-electric.com EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM Library Guide 05/2010

EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Embed Size (px)

Citation preview

Page 1: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

EIO0000000363 05/2010

EIO

0000

0003

63.0

3

www.schneider-electric.com

Modicon M238 Logic ControllerPulse Train Output, Pulse Width ModulationM238 PTOPWM Library Guide

05/2010

Page 2: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

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.

© 2010 Schneider Electric. All rights reserved.

2 EIO0000000363 05/2010

Page 3: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Table of Contents

Safety Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7About the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

Part I M238 Embedded Functions. . . . . . . . . . . . . . . . . . . . 11Chapter 1 M238 Embedded Functions . . . . . . . . . . . . . . . . . . . . . . . 13

PTO_PWM Embedded Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13Part II Pulse Train Output (PTO) . . . . . . . . . . . . . . . . . . . . . 17

Chapter 2 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19Pulse Train Output (PTO) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

Chapter 3 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21PTO Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22Configuration Parameters Description . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

Chapter 4 PTO Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29PTOSimple Function Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30Programming the PTOSimple Function Block. . . . . . . . . . . . . . . . . . . . . . 32

Chapter 5 Motion Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355.1 Moving to a Reference Point: PTOHome . . . . . . . . . . . . . . . . . . . . . . . . . 36

Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37PTOHome Function Block. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39Programming the PTOHome Function Block . . . . . . . . . . . . . . . . . . . . . . 41

5.2 Stopping the Axis: PTOStop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43PTOStop Function Block. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44Programming the PTOStop Function Block . . . . . . . . . . . . . . . . . . . . . . . 46

5.3 Move Relative: PTOMoveRelative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48PTOMoveRelative Function Block. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49Programming the PTOMoveRelative Function Block . . . . . . . . . . . . . . . . 51

5.4 Move speed: PTOMoveVelocity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53PTOMoveVelocity Function Block. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54Programming the PTOMoveVelocity Function Block . . . . . . . . . . . . . . . . 56

EIO0000000363 05/2010 3

Page 4: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

5.5 Command Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57Motion State Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58Allowed Sequence of Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

Chapter 6 Administrative Commands . . . . . . . . . . . . . . . . . . . . . . . . 616.1 Adjusting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63PTOGetParam Function Block. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64PTOSetParam Function Block. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66Programming the PTOGetParam or PTOSetParam Function . . . . . . . . . 68

6.2 Diagnostic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69PTOGetDiag Function Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70Programming the PTOGetDiag Function Block . . . . . . . . . . . . . . . . . . . . 72

Part III Pulse Width Modulation and Frequency Generator 73Chapter 7 PWM/FG Generalities. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

PWM/FG Naming Convention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76Synchronization and Enable Function . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

Chapter 8 Frequency Generator (FG) . . . . . . . . . . . . . . . . . . . . . . . . 79Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80Frequency Generator Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81FrequencyGenerator Function Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84Programming the FrequencyGenerator Function Block. . . . . . . . . . . . . . 86

Chapter 9 Pulse Width Modulation (PWM) . . . . . . . . . . . . . . . . . . . . 89Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90Pulse Width Modulation Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . 92PWM Function Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95Programming the PWM Function Block. . . . . . . . . . . . . . . . . . . . . . . . . . 97

Appendices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99Appendix A General Information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

Dedicated Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102General Information on Administrative and Motion Function Block Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

Appendix B Function and Function Block Representation . . . . . . . . 105Differences Between a Function and a Function Block . . . . . . . . . . . . . . 106How to Use a Function or a Function Block in IL Language . . . . . . . . . . 107How to Use a Function or a Function Block in ST Language . . . . . . . . . 110

4 EIO0000000363 05/2010

Page 5: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Appendix C Data Unit Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113PTO_DIRECTION: Type for Direction of a Move on PTO Axis Variable. . 114PTO_PARAMETER_TYPE: Type for Parameter of PTO axis to Set or to Get Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115PTO_REF: Type for PTO Reference Value Variable . . . . . . . . . . . . . . . . 116PTOPWM_ERR_TYPE: Type for Detected Error Variable which can Occur on PTO or PWM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117

Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149

EIO0000000363 05/2010 5

Page 6: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

6 EIO0000000363 05/2010

Page 7: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

§

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.

EIO0000000363 05/2010 7

Page 8: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

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 the installation, and has received safety training to recognize and avoid the hazards involved.

8 EIO0000000363 05/2010

Page 9: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

About the Book

At a Glance

Document Scope

This documentation will acquaint you with the pulse train output (PTO), pulse width modulation (PWM) and Frequency Generator (FG) output functions offered within the M238 controller.

This documentation describes the data types and functions of the M238 PTOPWM library.

In order to use this manual, you must:Have a thorough understanding of the M238, 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)

Validity Note

This document has been updated with the release of SoMachine V2.0.

Related Documents

Title of Documentation Reference Number

M238 Logic Controller Programming Guide EIO0000000384 (ENG); EIO0000000385 (FRE); EIO0000000386 (GER); EIO0000000387 (ITA); EIO0000000388 (SPA); EIO0000000389 (CHS)

EIO0000000363 05/2010 9

Page 10: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

You can download these technical publications and other technical information from our website at www.schneider-electric.com.

Product Related Information

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.

User Comments

We welcome your comments about this document. You can reach us by e-mail at [email protected].

WARNINGLOSS 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.

WARNINGUNINTENDED 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.

10 EIO0000000363 05/2010

Page 11: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

EIO0000000363 05/2010

I

M238 Embedded Functions

EIO0000000363 05/2010

M238 Embedded Functions

11

Page 12: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

M238 Embedded Functions

12 EIO0000000363 05/2010

Page 13: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

EIO0000000363 05/2010

1

M238 Embedded Functions

EIO0000000363 05/2010

M238 Embedded Functions

PTO_PWM Embedded Function

Overview

The PTO embedded function can provide 3 different functions:PTO The PTO (Pulse Train Output) implements digital technology (see M238 Logic

Controller, Hardware Guide) that provides precise positioning for open loop control of motor drives.

PWM The PWM (Pulse Width Modulation) function generates a programmable square wave signal on a dedicated output (see M238 Logic Controller, Hardware Guide)with adjustable duty cycle and frequency.

FG The FG (Frequency Generator) function generates a square wave signal on dedicated output (see M238 Logic Controller, Hardware Guide) channels with a fixed duty cycle (50%).

Access the Configuration Menu

Follow these steps to access to the PTO_PWM embedded function configuration Window with the Configuration menu:

Step Description

1 Click on the Configuration menu:

2 Double click on the controller you want.NOTE: You can also right-click on the controller you want and select Edit Parameters.

13

Page 14: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

M238 Embedded Functions

PTO_PWM Configuration Window

This figure is a sample PTO_PWM configuration window used to configure a PTO, PWM or FG:

3 In the Task Pane click on Embedded Functions → PTO_PWM:

Step Description

14 EIO0000000363 05/2010

Page 15: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

M238 Embedded Functions

The following table describes the fields of the PTO_PWM configuration window:

Mark Action

1 Select the PTO tab to access each of the PTO_PWM Configuration window.

2 Select one of these tabs according to the PTO_PWM channel you need to configure.

3 After choosing the type of HSC (Simple or Main) you want, use the field Variable to change the instance name.

4 If the parameters are collapsed, you can expand them by clicking the plus signs. You then have access to the settings of each parameter.

5 Configuration window where the embedded function is used for:a PTO (see page 17)a PWM (see page 73)a FG (see page 73)

6 When you click on the IO Summarize button, the IO summary window appears. It allows to check your configuration I/O mapping.

EIO0000000363 05/2010 15

Page 16: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

M238 Embedded Functions

16 EIO0000000363 05/2010

Page 17: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

EIO0000000363 05/2010

II

PTO

EIO0000000363 05/2010

Pulse Train Output (PTO)

Overview

This part describes general principles of Pulse Train Outputs.

What's in this Part?

This part contains the following chapters:

Chapter Chapter Name Page

2 Overview 19

3 Configuration 21

4 PTO Management 29

5 Motion Commands 35

6 Administrative Commands 61

17

Page 18: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO

18 EIO0000000363 05/2010

Page 19: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

EIO0000000363 05/2010

2

PTO - Overview

EIO0000000363 05/2010

Overview

Pulse Train Output (PTO)

Introduction

The PTO (Pulse Train Output) implements digital technology that provides precise positioning for open loop control of motor drives.

The PTO, PWM, and Frequency Generator functions use the same dedicated outputs. Only one out of these 3 functions can be used on the same channel. Using different functions on channel 0 and channel 1 is allowed.

Concept

The PTO function provides a square wave output for a specified number of pulses and a specified velocity (frequency).

PTO is used to control the positioning or speed of the axis of a rotating device.

PTO Commands

The PTOSimple (see page 29) function block manages the PTO.

Motion commands are managed by 4 motion function blocks:(PTOHome (see page 36)): moving to the reference position(PTOStop (see page 42)): stop moving(PTOMoveRelative (see page 47)): moving of a programmed distance(PTOMoveVelocity (see page 52)): moving at a programmed speed

Adjustments and diagnostics are managed by 3 administrative blocks:PTOSetParam (see page 62): Modify a parameterPTOGetParam (see page 62): Read a parameterPTOGetDiag (see page 69): Identify a detected error

19

Page 20: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Overview

Performance

The maximum generated frequency is 100 kHz.

The 2 PTO channels can be used simultaneously but can only control independent axes. Therefore the embedded PTO function can be used for:

single axis point-to-point motion2-axis simultaneous point-to-point motion (each axis is managed independently).

but not for:2-axis synchronized point-to-point motion,2-axis interpolation motion.

20 EIO0000000363 05/2010

Page 21: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

EIO0000000363 05/2010

3

PTO - Configuration

EIO0000000363 05/2010

Configuration

Overview

This chapter describes how to configure a PTO.

What's in this Chapter?

This chapter contains the following topics:

Topic Page

PTO Configuration 22

Configuration Parameters Description 26

21

Page 22: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Configuration

PTO Configuration

Overview

2 PTO channels can be configured on the controller.

Reminder: The PTO function is not available on AC controllers (TM238LFAC24DR•• and TM238LDA24DR).

Hardware Configuration

Each PTO channel is associated to 2 fast outputs and 1 auxiliary standard input (see M238 Logic Controller, Hardware Guide).

Open the Configuration Window

Use this procedure to open the PTO configuration window:

Step Action

1 Select the Configuration tab and double-click on your controller.

2 Click on Embedded Functions

3 Click on PTO_PWM

4 Select PTO in the Mode entry of the configuration window.

5 The instance of the PTO is created, it can be renamed in the Variable field.Default names are: PTO00 and PTO01.

22 EIO0000000363 05/2010

Page 23: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Configuration

Configuration Window Description

The following picture provides an example of a configuration window on PTO1:

EIO0000000363 05/2010 23

Page 24: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Configuration

The following table describes each parameter available when the embedded PTO_PWM is configured in PTO mode:

Parameter Value Unit Description

Mode PTO - The Mode selected is PTO.

Output Mode (see page 26) Pulse/DirectionDirection/PulseClockWise/CounterClockWiseCounterClockWise/ClockWise

- Mode of generation of outputs

Acceleration/Deceleration (see page 27)

Acc./Dec. Unit ms*Hz/ms

- Acceleration/Deceleration Unit

Acc. max. 20*...65000 - Acceleration rate maximum value

Dec. max. 20*...65000 - Deceleration rate maximum value

Dec. Fast Stop 20...32500 (100 *) - Deceleration rate used in case of a fast stop. (Drive Ready input low, limits exceeded, detected errors)

Frequency (see page 27)

Start 0*...65535 Hz Start frequency.0 = no use of start frequency parameter.

Stop 0*...65535 Hz Stop frequency.0 = no use of stop frequency parameter.

Maximum 1...100000 * Hz Maximum frequency

Auxiliary Inputs (see page 28)

AUX Not used *Drive ReadyOrigin

- Specific input dedicated to the Drive Ready information or to the reference point detection (origin)

AUX Filter 0.04 *0.41.24

ms Filtering value reduces the effect of bounce on the auxiliary input

Homing (see page 28)

Homing Mode Cam Backward *Cam Forward

- Start behind the reference point (Cam Forward) or in front of the reference point (Cam Backward).Available if AUX is set to the Origin value.

Homing Acc. 20...65000 (100 *) ms Acceleration during homing (≤ Acc. max.)

Homing Dec. 20...65000 (100 *) ms Deceleration during homing (≤ Dec. max.)

Legend *: Parameter default value

24 EIO0000000363 05/2010

Page 25: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Configuration

Configure a PTO Channel

Use the following procedure to configure a PTO channel:

The configuration defined can be viewed as a configuration profile:

Step Action

1 Enable the PTO channel: In the list box Mode parameter → select PTO.

2 In the list box Output Mode parameter → Select the Mode of generation of outputs in the value column.

3 Configure the Acc./Dec. Unit, Acc.max, Dec. max, and Dec. Fast stop (see page 27) parameters.

4 Configure the Frequency (see page 27) (= Velocity) parameters (Start, Stop, and Maximum).

5 Enable the AUX input (see page 28).

6 Configure the AUX input filtering value (if enabled at step 5).

7 If you have selected Origin in AUX input, then configure the Homing mode and the Homing Acceleration/Deceleration (see page 28) parameters.

EIO0000000363 05/2010 25

Page 26: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Configuration

Configuration Parameters Description

Output Modes

There are 4 possible output modes:Pulse/DirectionDirection/PulseClockWise/CounterClockWiseCounterClockWise/ClockWise

The Pulse/Direction mode generates 2 signals on the PTO outputs:on output 0: pulse which provides the motor operating speed.on output 1: direction which provides the motor rotation direction.

The Direction/Pulse mode generates 2 signals on the PTO outputs:on output 0: direction which provides the motor rotation direction.on output 1: pulse which provides the motor operating speed.

The following diagram gives an example of a timing diagram in Pulse/Direction mode:

The ClockWise/CounterClockWise mode generates a signal that defines the motor operating speed. This signal is implemented either on the PTO output 0 or on the PTO output 1 depending on the motor rotation direction:

on output 0: the motor runs in clockwise.on output 1: the motor runs in counterclockwise.

The CounterClockWise/ClockWise mode generates a signal that defines the motor operating speed. This signal is implemented either on the PTO output 0 or on the PTO output 1 depending on the motor rotation direction:

on output 0: the motor runs in counterclockwise.on output 1: the motor runs in clockwise.

26 EIO0000000363 05/2010

Page 27: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Configuration

The following diagram gives an example of a timing diagram in ClockWise/CounterClockWise mode:

Frequency

Acceleration/Deceleration

Parameter Description

Start Start frequency is the initial frequency value when a motion command begins.If the Start frequency is null, Start frequency is the lowest calculated frequency with a minimum value of 1Hz.

Stop Stop frequency is the final frequency value before a motion command stops.If the Stop frequency is null, Stop frequency is the lowest calculated frequency with a minimum value of 1Hz.

Maximum Frequency which cannot be exceeded by any command in the application program.

Parameter Value Description

Acc./Dec. Unit ms The Acceleration value represents the time to go from 0 to the maximum frequency.The Deceleration value represents the time to go from the maximum frequency to 0.

Hz/ms The Acceleration and the Deceleration expressed in Hz/ms.

Acc. max.Dec. max.

- Acc./Dec. which cannot be exceeded by any motion command in the application program.ms The value specifies the lowest value of Acc./Dec. that can be used.Hz/ms The value specifies the highest value of Acc./Dec. that can be used.

Dec. Fast stop - Defines the value of Deceleration rate used to stop the PTO signal in case of a detected error:

motion command errorcommand sequence errorcontroller leaves RUN modeDrive Ready input low

EIO0000000363 05/2010 27

Page 28: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Configuration

The following example shows a possible configuration of Acceleration/Deceleration and Frequency parameters:

In your application program, using a PTOMoveVelocity command with an Acceleration of 10000 ms (equivalent to 20 kHz / 10000 ms = 2 Hz/ms) and a target velocity of 10 kHz, the velocity will be reached after (10 kHz-5 kHz) / 2 Hz/ms= 2500 ms.

Auxiliary Input

The auxiliary input parameter has 2 possible settings:Drive Ready

TRUE = Authorizes the PTO moving commands.FALSE = An axis error is triggered and any move ongoing is aborted by a Fast stop.The input DIS_AuxInput of the PTOSimple function block (see page 30) can be used to disable the drive ready monitoring.

Origin Indicates the reference point for the PTOHome (see page 36)

Homing

To program a move to the reference position, the following parameters are mandatory defined during configuration:Auxiliary Input: Configured as Origin input.Homing Mode: Start behind the reference position (Cam Forward) or in front of the

reference position (Cam Backward)Homing Acc.: Acceleration during homing (20 to 65000)Homing Dec.: Deceleration during homing (20 to 65000)

Parameter Value

Acc./Dec. Unit ms

Start Frequency 5000

Maximum Frequency 20000

28 EIO0000000363 05/2010

Page 29: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

EIO0000000363 05/2010

4

PTO Management

EIO0000000363 05/2010

PTO Management

Overview

This chapter describes the PTOSimple function block used to manage the axis.

What's in this Chapter?

This chapter contains the following topics:

Topic Page

PTOSimple Function Block 30

Programming the PTOSimple Function Block 32

29

Page 30: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO Management

PTOSimple Function Block

Overview

The PTOSimple function block manages the PTO.

The function block must be called in each cycle of the MAST task.

The function block instance name is the name defined by configuration.

Graphical Representation

IL and ST Representation

To see the general representation in IL or ST language, refer to the Function and Function Block Representation chapter (see page 105).

I/O Variables Description

The following table describes the input variables:

Inputs Type Comment

ResetError BOOL On rising edge, resets the PTO detected error.

DIS_AuxInput BOOL TRUE = disables the auxiliary input when configured as Drive Ready input.This pin has no effect when auxiliary input is not used or configured as Origin input.

30 EIO0000000363 05/2010

Page 31: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO Management

The following table describes the output variables:

Outputs Type Comment

PTO_REF PTO_REF (see page 116)

Reference to the PTO axis.To be used with the PTO_REF_IN input pin of the Administrative and Motion function blocks.

PTOError BOOL TRUE = indicates that an error was detected. PTOGetDiag (see page 70) function block may be used to get more information about this detected error.

Moving BOOL TRUE = indicates that the PTO axis is moving.

Stopping BOOL TRUE = indicates that the PTO axis is stopping.

Frequency DWORD Current velocity (frequency) of the move.

Distance DWORD Distance traveled by the last move of the PTO axis (in number of pulses).

EIO0000000363 05/2010 31

Page 32: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO Management

Programming the PTOSimple Function Block

Procedure

To program the PTOSimple function block, do the following:

Step Action

1 With the Input Assistant, add the PTOSimple function block from the following path: Function Block (Libraries) → SEC_PTOPWM → PTO → PTOSimple and click Ok

32 EIO0000000363 05/2010

Page 33: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO Management

2Look for the function block instance by clicking on .

The Input Assistant screen appears. Select the variable that you defined during the configuration (see page 22) and confirm.

NOTE: If the function block instance is not visible, check if the PTO is configured

3 The inputs/outputs are detailed in the function block (see page 30).

Step Action

EIO0000000363 05/2010 33

Page 34: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO Management

34 EIO0000000363 05/2010

Page 35: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

EIO0000000363 05/2010

5

PTO - Motion Commands

EIO0000000363 05/2010

Motion Commands

Overview

This chapter describes the motion commands.

What's in this Chapter?

This chapter contains the following sections:

Section Topic Page

5.1 Moving to a Reference Point: PTOHome 36

5.2 Stopping the Axis: PTOStop 42

5.3 Move Relative: PTOMoveRelative 47

5.4 Move speed: PTOMoveVelocity 52

5.5 Command Sequence 57

35

Page 36: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

5.1 Moving to a Reference Point: PTOHome

Overview

This section describes the PTOHome function block.

What's in this Section?

This section contains the following topics:

Topic Page

Description 37

PTOHome Function Block 39

Programming the PTOHome Function Block 41

36 EIO0000000363 05/2010

Page 37: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

Description

Overview

The PTOHome function block is used to set the axis to a reference position.

Cam Forward and Backward in the Homing Mode

The Cam Forward (start behind reference position) is described in the following diagram:

NOTE: If the function is initiated when the Origin input = 0, an error is detected and the command is aborted.

EIO0000000363 05/2010 37

Page 38: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

The Cam Backward (start in front of reference position) is described in the following diagram:

NOTE: If the function is initiated when the Origin input = 0, an error is detected and the command is aborted.

38 EIO0000000363 05/2010

Page 39: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

PTOHome Function Block

Function Description

This function block commands a move to the reference position. It requires the Origin (see page 28) input to be configured and wired, else the function block sets the Error output.

As soon as the axis has reached the home position, the output Done is set to TRUE.

Graphical Representation

IL and ST Representation

To see the general representation in IL or ST language, refer to the Function and Function Block Representation chapter (see page 105).

I/O Variables Description

The following table describes the input variables:

Inputs Type Comment

PTO_REF_IN PTO_REF (see page 116)

Reference to the PTO axis.To be connected to the PTO_REF of the PTOSimple or the PTO_REF_OUT of the Administrative or Motion output pins function blocks.

Execute BOOL On rising edge, starts the function block execution.When FALSE, resets the outputs of the function block when its execution terminates.

HighVelocity DWORD Value of the maximum initial Homing search velocity in Hz.Range: 1Hz...100kHzLowVelocity≤HighVelocity≤Frequency max

LowVelocity DWORD Value of the maximum final Homing approach velocity in Hz.Range: 1Hz...100 kHzLowVelocity≤HighVelocity

EIO0000000363 05/2010 39

Page 40: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

The following table describes the output variables:

NOTE: For more information about Done, Busy, CommandAborted and Execution pins, refer to General Information on Function Block Management (see page 103)

Outputs Type Comment

PTO_REF_OUT PTO_REF (see page 116)

Reference to the PTO axis.To be connected with the PTO_REF_IN input pin of the Administrative and Motion function blocks.

Done BOOL TRUE = indicates that the command is finished.Function block execution is finished.

Busy BOOL TRUE = indicates that the command is in progress.

CommandAborted BOOL TRUE = indicates that the command was aborted due to another move command.Function block execution is finished.

Error BOOL TRUE = indicates that an error was detected.Function block execution is finished.

ErrID PTOPWM_ERR_TYPE (see page 117)

When Error is TRUE: type of the detected error.

40 EIO0000000363 05/2010

Page 41: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

Programming the PTOHome Function Block

Procedure

To program the PTOHome function block, do the following:

When the movement is launched, it cannot be changed (only aborted) while the reference position (origin input) is not reached.

Any aborted motion command cannot be completed after having being stopped. The motion command must be restarted from beginning.

The PTOHome movement is aborted when:a PTOStop function block is called,the sequence of commands (see page 57) is not supported,the application is stopped,an error is detected.

Step Action

1 With the Input Assistant, add the PTOHome function block from the following path: Function Block (Libraries) → SEC_PTOPWM → PTO → Motion → PTOHome and click Ok

2 Declare the function block instance.

3 Associate the PTO_REF_IN input of the function block to the PTO_REF output of the PTOSimple function block.NOTE: A unique PTOSimple instance is needed per PTO Channel in the application.

4 The inputs/outputs are detailed in the function block (see page 39).The interaction between the inputs/outputs are detailed in the General Information (see page 101).The interaction between the motion commands are detailed in the Command Sequence (see page 57).

EIO0000000363 05/2010 41

Page 42: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

5.2 Stopping the Axis: PTOStop

Overview

This section describes the PTOStop.

What's in this Section?

This section contains the following topics:

Topic Page

Description 43

PTOStop Function Block 44

Programming the PTOStop Function Block 46

42 EIO0000000363 05/2010

Page 43: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

Description

Overview

This function block commands a controlled stop of the axis (deceleration to stop), and aborts any motion ongoing.

After the axis has been completely stopped, a new motion is not allowed as long as the Execute input remains TRUE or an axis error was detected and has not been reset (see page 30).

EIO0000000363 05/2010 43

Page 44: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

PTOStop Function Block

Function Description

This function block commands a controlled stop of the axis (deceleration to stop), and aborts any motion ongoing.

Graphical Representation

IL and ST Representation

To see the general representation in IL or ST language, refer to the Function and Function Block Representation chapter (see page 105).

I/O Variables Description

The following table describes the input variables:

Inputs Type Comment

PTO_REF_IN PTO_REF (see page 116)

Reference to the PTO axis.To be connected to the PTO_REF of the PTOSimple or the PTO_REF_OUT of the Administrative or Motion output pins function blocks.

Execute BOOL On rising edge, starts the fonction block execution.When FALSE, resets the outputs of the function block when its execution terminates.

Deceleration DWORD Deceleration in Hz/ms or in ms (according to configuration).Range Hz/ms: 1...Dec. max.Range ms: Dec. max....100000

44 EIO0000000363 05/2010

Page 45: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

The following table describes the output variables:

NOTE: For more information about Done, Busy, CommandAborted and Execution pins, refer to General Information on Function Block Management (see page 103)

Outputs Type Comment

PTO_REF_OUT PTO_REF (see page 116)

Reference to the PTO axis.To be connected with the PTO_REF_IN input pin of the Administrative and Motion function blocks.

Done BOOL TRUE = indicates that the command is finished.Function block execution is finished.

Busy BOOL TRUE = indicates that the command is in progress.

Error BOOL TRUE = indicates that an error was detected.Function block execution is finished.

ErrID PTOPWM_ERR_TYPE (see page 117)

When Error is TRUE: type of detected error.

EIO0000000363 05/2010 45

Page 46: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

Programming the PTOStop Function Block

Procedure

To program the PTOStop function block, do the following:

Step Action

1 With the Input Assistant, add the PTOStop function block from the following path: Function Block (Libraries) → SEC_PTOPWM → PTO → Motion → PTOStop and click Ok.

2 Declare the function block instance.

3 Associate the PTO_REF_IN input of the function block to the PTO_REF output of the PTOSimple function block.NOTE: A unique PTOSimple instance is needed per PTO Channel in the application.

4 The inputs/outputs are detailed in the function block (see page 44).The interaction between the inputs/outputs are detailed in the General Information (see page 101).The interaction between the motion commands are detailed in the Command Sequence (see page 57).

46 EIO0000000363 05/2010

Page 47: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

5.3 Move Relative: PTOMoveRelative

Overview

This section describes the PTOMoveRelative function block.

What's in this Section?

This section contains the following topics:

Topic Page

Description 48

PTOMoveRelative Function Block 49

Programming the PTOMoveRelative Function Block 51

EIO0000000363 05/2010 47

Page 48: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

Description

Overview

This function block is used to manage a complete movement of the axis from the current position to a specified target position.

The target position is directly specified by its distance, in pulses, from the current position of the axis.

The velocity of the axis will follow a trapezoidal profile:

NOTE: The Frequency represents the Velocity. The 2 terms are equivalent.

Special Case

If the set target velocity cannot be reached before attaining the target position, the axis velocity will then follow a triangular profile:

48 EIO0000000363 05/2010

Page 49: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

PTOMoveRelative Function Block

Function Description

This function block commands a move of a distance relative to the current position.

The move profile depends on the specified velocity, deceleration and acceleration values.

Graphical Representation

IL and ST Representation

To see the general representation in IL or ST language, refer to the Function and Function Block Representation chapter (see page 105).

I/O Variables Description

The following table describes the input variables:

Inputs Type Comment

PTO_REF_IN PTO_REF (see page 116)

Reference to the PTO axis.To be connected to the PTO_REF of the PTOSimple or the PTO_REF_OUT of the Administrative or Motion output pins function blocks.

Execute BOOL On rising edge, starts the function block execution.When FALSE, resets the outputs of the function block when its execution terminates.

Velocity DWORD Maximum velocity in Hz (not necessarily reached.)Range: 1...Frequency max

Distance DWORD Distance of the move in number of pulses.Range: 1...4294967295

EIO0000000363 05/2010 49

Page 50: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

NOTE: The acceleration and deceleration ramps cannot exceed 4,294,967,295 pulses. At the maximum frequency of 100 kHz, it would limit the duration of acc/dec ramps to 80 seconds.

The following table describes the output variables:

NOTE: For more information about Done, Busy, CommandAborted and Execution pins, refer to General Information on Function Block Management (see page 103)

Acceleration DWORD Acceleration in Hz/ms or in ms (according to configuration).Range Hz/ms: 1...Acc. max.Range ms: Acc. max....100000

Deceleration DWORD Deceleration in Hz/ms or in ms (according to configuration).Range Hz/ms: 1...Dec. max.Range ms: Dec. max....100000

Direction PTO_DIRECTION (see page 114)

Direction of the move.

Outputs Type Comment

PTO_REF_OUT PTO_REF (see page 116)

Reference to the PTO axis.To be connected with the PTO_REF_IN input pin of the Administrative and Motion function blocks.

Done BOOL TRUE = indicates that the command is finished.Function block execution is finished.

Busy BOOL TRUE = indicates that the command is in progress.

Active BOOL This output is set at the moment the function block takes control of the motion of the according axis.

CommandAborted BOOL TRUE = indicates that the command was aborted due to another move command.Function block execution is finished.

Error BOOL TRUE = indicates that an error was detected.Function block execution is finished.

ErrID PTOPWM_ERR_TYPE (see page 117)

When Error is TRUE: type of the detected error.

Inputs Type Comment

50 EIO0000000363 05/2010

Page 51: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

Programming the PTOMoveRelative Function Block

Procedure

To program the PTOMoveRelative function block, do the following:

Any aborted motion command cannot be completed after having being stopped. The motion command must be restarted from beginning.

When the movement is launched, it cannot be changed (only aborted) while its profile execution is not complete.

The PTOMoveRelative movement is aborted when:a PTOStop function block is called,the Drive Ready Input (if defined at configuration time) becomes inactive,the sequence of commands (see page 59) is not supported,the application is stopped,an error is detected.

Step Action

1 With the Input Assistant, add the PTOMoveRelative function block from the following path: Function Block (Libraries) → SEC_PTOPWM → PTO → Motion → PTOMoveRelative and click Ok.

2 Declare the function block instance.

3 Associate the PTO_REF_IN input of the function block to the PTO_REF output of the PTOSimple function block.NOTE: A unique PTOSimple instance is needed per PTO Channel in the application.

4 The inputs/outputs are detailed in the function block (see page 49).The interaction between the inputs/outputs are detailed in the General Information (see page 101).The interaction between the motion commands are detailed in the Command Sequence (see page 57).

EIO0000000363 05/2010 51

Page 52: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

5.4 Move speed: PTOMoveVelocity

Overview

This section describes the PTOMoveVelocity function block.

What's in this Section?

This section contains the following topics:

Topic Page

Description 53

PTOMoveVelocity Function Block 54

Programming the PTOMoveVelocity Function Block 56

52 EIO0000000363 05/2010

Page 53: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

Description

Overview

The speed control mode is used to manage the speed of a motor, to program this mode, you must use PTOMoveVelocity function block.

The PTOMoveVelocity function block is used to generate a pulse train output at a specified frequency (velocity) through an acceleration or deceleration ramp.

It commands a continuous motion of the axis at the specified velocity.

To end the motion, a PTOStop function block must be used.

NOTE: In order to stop continuous motion, you must use the PTOStop function block. Attempting to use PTOMoveVelocity with a velocity value of 0 is considered an error. The Fast Stop will be triggered while the PTOSimple and PTOMoveVe-locity function blocks will indicate the detected error condition.

EIO0000000363 05/2010 53

Page 54: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

PTOMoveVelocity Function Block

Function Description

This function block commands a continuous move at a specified velocity.

This velocity is reached according to specified acceleration and deceleration values.

Graphical Representation

IL and ST Representation

To see the general representation in IL or ST language, refer to the Function and Function Block Representation chapter (see page 105).

I/O Variables Description

The following table describes the input variables:

Inputs Type Comment

PTO_REF_IN PTO_REF (see page 116)

Reference to the PTO axis.To be connected to the PTO_REF of the PTOSimple or the PTO_REF_OUT of the Administrative or Motion output pins function blocks.

Execute BOOL On rising edge, starts the function block execution.When FALSE, resets the outputs of the function block when its execution terminates.

Velocity DWORD Target velocity in Hz.Range: 1...Frequency max

Acceleration DWORD Acceleration in Hz/ms or in ms (according to configuration).Range Hz/ms: 1...Acc. max.Range ms: Acc. max....100000

54 EIO0000000363 05/2010

Page 55: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

NOTE: The acceleration and deceleration ramps cannot exceed 4,294,967,295 pulses. At the maximum frequency of 100 kHz, it would limit the duration of acc/dec ramps to 80 seconds.

The following table describes the output variables:

NOTE: For more information about Done, Busy, CommandAborted and Execution pins, refer to General Information on Function Block Management (see page 103)

Deceleration DWORD Deceleration in Hz/ms or in ms (according to configuration).Range Hz/ms: 1...Dec. max.Range ms: Dec. max....100000

Direction PTO_DIRECTION (see page 114)

Direction of the move.

Outputs Type Comment

PTO_REF_OUT PTO_REF (see page 116)

Reference to the PTO axis.To be connected with the PTO_REF_IN input pin of the Administrative and Motion function blocks.

InVelocity BOOL TRUE = indicates that target velocity is reached.The move is ongoing and function block execution is finished.

Busy BOOL TRUE = indicates that the command is in progress.

CommandAborted BOOL TRUE = indicates that the command was aborted due to another move command.Function block execution is finished.

Error BOOL TRUE = indicates that an error was detected.Function block execution is finished.

ErrID PTOPWM_ERR_TYPE (see page 117)

When Error is TRUE: type of the detected error.

Inputs Type Comment

EIO0000000363 05/2010 55

Page 56: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

Programming the PTOMoveVelocity Function Block

Procedure

To program the PTOMoveVelocity function block, do the following:

Any aborted motion commands cannot be completed after having being stopped. The motion command must be restarted from beginning.

The PTOMoveVelocity movement is aborted when:a PTOStop function block is called,the Drive Ready Input (if defined at configuration time) becomes inactive,the sequence of commands (see page 59) is not supported,the application is stopped,an error is detected.

Step Action

1 With the Input Assistant, add the PTOMoveVelocity function block from the following path: Function Block (Libraries) → SEC_PTOPWM → PTO → Motion → PTOMoveVelocity and click Ok

2 Declare the function block instance.

3 Associate the PTO_REF_IN input of the function block to the PTO_REF output of the PTOSimple function block.NOTE: A unique PTOSimple instance is needed per PTO Channel in the application.

4 The inputs/outputs are detailed in the function block (see page 54).The interaction between the inputs/outputs are detailed in the General Information (see page 101).The interaction between the motion commands are detailed in the Command Sequence (see page 57).

56 EIO0000000363 05/2010

Page 57: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

5.5 Command Sequence

Overview

This section describes sequence of commands.

What's in this Section?

This section contains the following topics:

Topic Page

Motion State Diagram 58

Allowed Sequence of Commands 59

EIO0000000363 05/2010 57

Page 58: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

Motion State Diagram

State Diagram

Any sequence of motion commands must respect the following state diagram:

Done=1PTOStop: Done=1 & Execute=0Standstill

Continous Motion

Stopping

ErrorStop

Discrete Motion

ResetError=1

PTOStop

PTOError

PTOErrorPTOErrorPTOError

PTOHomePTOMoveRelativePTOMoveVelocity

58 EIO0000000363 05/2010

Page 59: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

Allowed Sequence of Commands

Description

The PTO channel can respond to a new command while executing (and before completing) the current command according to the following table. "Accept" means that the new command will begin execution even if the previous command has not completed execution. "Reject" means the new command will be ignored and will result in the declaration of an error. For more details, see the explanation after the table.

Next Command “Accept”

“Accept” means the sequence of commands is supported:Current command: The current command is aborted. If the command was not

completed yet, the CommandAborted output pin is set on the function block which initiated the current command.

Next command: The new command is accepted and its execution starts.Axis state: The axis goes to Discrete Motion (PTOMoveRelative, PTOHome),

Continuous Motion (PTOMoveVelocity) or the Stopping state (PTOStop) according to new command type.

Next Command “Reject”

“Reject” means the sequence of commands is not supported:Current command: The current command is aborted. If the command was not

completed yet, the CommandAborted output pin is set on the function block.Next command: The new command is rejected. Error output pin is set on the

function block.Axis state: The axis goes to ErrorStop state.

The move is stopped with the deceleration set in Dec. Fast Stop configuration parameter (see page 22).An error is reported on the PTOSimple (see page 30) function block (the PTOError output pin is set on the function block).Bit 25 (Command rejected) is set in PTO diagnostic (reminder: to read PTO diagnostic, the PTOGetDiag (see page 70) function block must be used).The error must be acknowledged (using the ResetError input pin of the PTOSimple function block) before a new command can be accepted.

Current Command

PTOHome PTOMoveRelative PTOMoveVelocity PTOStop

Next Command

PTOHome Reject Reject Reject Reject

PTOMoveRelative Reject Reject Reject Reject

PTOMoveVelocity Reject Reject Accept Reject

PTOStop Accept Accept Accept Reject

EIO0000000363 05/2010 59

Page 60: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PTO - Motion Commands

60 EIO0000000363 05/2010

Page 61: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

EIO0000000363 05/2010

6

Administrative Commands

EIO0000000363 05/2010

Administrative Commands

Overview

This chapter describes the administratives function blocks to adjust and diagnose a PTO function.

What's in this Chapter?

This chapter contains the following sections:

Section Topic Page

6.1 Adjusting 62

6.2 Diagnostic 69

61

Page 62: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Administrative Commands

6.1 Adjusting

Overview

This chapter describes adjusting of PTO.

What's in this Section?

This section contains the following topics:

Topic Page

Description 63

PTOGetParam Function Block 64

PTOSetParam Function Block 66

Programming the PTOGetParam or PTOSetParam Function 68

62 EIO0000000363 05/2010

Page 63: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Administrative Commands

Description

Overview

2 function blocks can be used to adjust the PTO function:PTOGetParam (see page 64), that allow to read the parameterPTOSetParam (see page 66), that allow to write the parameter

Adjustable Parameters

Those function blocks allow to read and write the following parameters:Start FrequencyStop FrequencyDeceleration Fast Stop

NOTE: Parameters you set via your program have priority over the initial parameters values configured in the PTO configuration window (see page 22). Initial configuration parameters are restored on cold or warm start (see Modicon M238 Logic Controller, Programming Guide).

EIO0000000363 05/2010 63

Page 64: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Administrative Commands

PTOGetParam Function Block

Function Description

This function block returns the value of the specified parameter of the PTO axis.

Graphical Representation

IL and ST Representation

To see the general representation in IL or ST language, refer to the Function and Function Block Representation chapter (see page 105).

I/O Variables Description

The following table describes the input variables:

Inputs Type Comment

PTO_REF_IN PTO_REF (see page 116)

Reference to the PTO axis.To be connected to the PTO_REF of the PTOSimple or the PTO_REF_OUT of the Administrative or Motion output pins function blocks.

Execute BOOL On rising edge, starts the function block execution.When FALSE, resets the outputs of the function block when its execution terminates.

Param PTO_PARAMETER_TYPE (see page 115)

Parameter to read.

64 EIO0000000363 05/2010

Page 65: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Administrative Commands

The following table describes the output variables:

NOTE: For more information about Done, Busy, CommandAborted and Execution pins, refer to General Information on Function Block Management (see page 103)

Outputs Type Comment

PTO_REF_OUT PTO_REF (see page 116)

Reference to the PTO axis.To be connected with the PTO_REF_IN input pin of the Administrative and Motion function blocks.

Done BOOL TRUE = indicates that the ParamValue is valid.Function block execution is finished.

Busy BOOL TRUE = indicates that the function block execution is in progress.

Error BOOL TRUE = indicates that an error was detected.Function block execution is finished.

ErrID PTOPWM_ERR_TYPE (see page 117)

When Error is TRUE: type of the detected error.

ParamValue DWORD When Done is TRUE: Parameter value is valid.

EIO0000000363 05/2010 65

Page 66: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Administrative Commands

PTOSetParam Function Block

Function Description

This function block modifies the value of the specified parameter of the PTO axis.

Graphical Representation

IL and ST Representation

To see the general representation in IL or ST language, refer to the Function and Function Block Representation chapter (see page 105).

I/O Variables Description

The following table describes the input variables:

Inputs Type Comment

PTO_REF_IN PTO_REF (see page 116)

Reference to the PTO axis.To be connected to the PTO_REF of the PTOSimple or the PTO_REF_OUT of the Administrative or Motion output pins function blocks.

Execute BOOL On rising edge, starts the function block execution.When FALSE, resets the outputs of the function block when its execution terminates.

Param PTO_PARAMETER_TYPE (see page 115)

Parameter to set.

Param_Value DWORD Parameter value to write.

66 EIO0000000363 05/2010

Page 67: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Administrative Commands

The following table describes the output variables:

NOTE: For more information about Done, Busy, CommandAborted and Execution pins, refer to General Information on Function Block Management (see page 103)

Outputs Type Comment

PTO_REF_OUT PTO_REF (see page 116)

Reference to the PTO axis.To be connected with the PTO_REF_IN input pin of the Administrative and Motion function blocks.

Done BOOL TRUE = indicates that ParamValue is valid.Function block execution is finished.

Busy BOOL TRUE = indicates that the function block execution is in progress.

Error BOOL TRUE = indicates that an error was detected.Function block execution is finished.

ErrID PTOPWM_ERR_TYPE (see page 117)

When Error is set: type of the detected error.

EIO0000000363 05/2010 67

Page 68: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Administrative Commands

Programming the PTOGetParam or PTOSetParam Function

Procedure

Step Action

1 With the Input Assistant, add the PTOGetParam or PTOSetParam function block from the following path: Function Block (Libraries) → SEC_PTOPWM → PTO → Administrative → PTOGetParam or PTOSetParam and click Ok.

2 Declare the function block instance.

3 Associate the PTO_REF_IN input of the function block to the PTO_REF output of the PTOSimple function block.NOTE: A unique PTOSimple instance is needed per PTO Channel in the application.

4 The inputs/outputs are detailed in the function blocks PTOGetParam (see page 64) or PTOSetParam (see page 66).The interaction between the inputs/outputs are detailed in the General Information (see page 101).

68 EIO0000000363 05/2010

Page 69: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Administrative Commands

6.2 Diagnostic

Overview

This chapter describes the function block available to diagnose the PTO function.

What's in this Section?

This section contains the following topics:

Topic Page

PTOGetDiag Function Block 70

Programming the PTOGetDiag Function Block 72

EIO0000000363 05/2010 69

Page 70: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Administrative Commands

PTOGetDiag Function Block

Function Description

This function block returns the details of a detected PTO error.

Graphical Representation

IL and ST Representation

To see the general representation in IL or ST language, refer to the Function and Function Block Representation chapter (see page 105).

I/O Variables Description

The following table describes the input variables:

Inputs Type Comment

PTO_REF_IN PTO_REF (see page 116)

Reference to the PTO axis.To be connected to the PTO_REF of the PTOSimple or the PTO_REF_OUT of the Administrative or Motion output pins function blocks.

Execute BOOL On rising edge, starts the function block execution.When FALSE, resets the outputs of the function block when its execution terminates.

70 EIO0000000363 05/2010

Page 71: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Administrative Commands

The following table describes the output variables:

NOTE: For more information about Done, Busy, CommandAborted and Execution pins, refer to General Information on Function Block Management (see page 103)

Outputs Type Comment

PTO_REF_OUT PTO_REF (see page 116)

Reference to the PTO axis.To be connected with the PTO_REF_IN input pin of the Administrative and Motion function blocks.

Done BOOL TRUE = indicates that PTODiag is valid.Function block execution is finished.

Busy BOOL TRUE = indicates that the function block execution is in progress.

Error BOOL TRUE = indicates that an error was detected.Function block execution is finished.

ErrID PTOPWM_ERR_TYPE (see page 117)

When Error is TRUE: type of the detected error.

PTODiag DWORD When Done is TRUE: Diagnostic value is valid (see table below).

DWORD bit Meaning

0...3 Not used

4 Internal detected error

5,6 Not used

7 Configuration detected error

8...16 Not used

17 Drive not ready (auxiliary input DriveReady is FALSE)

18...20 Not used

21 Homing detected error

22 Invalid Frequency

23 Invalid Acceleration

24 Invalid Deceleration

25 Command rejected

26...31 Not used

EIO0000000363 05/2010 71

Page 72: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Administrative Commands

Programming the PTOGetDiag Function Block

Procedure

In the case of a detected error during the system operating, you can use the PTOGetDiag function to find the reasons.

To implement the PTOGetDiag function, do the following:

Step Action

1 With the Input Assistant, add the PTOGetDiag function block from the following path: Function Block (Libraries) → SEC_PTOPWM → PTO → Administrative → PTOGetDiag and click Ok.

2 Declare the function block instance.

3 Associate the PTO_REF_IN input of the function block to the PTO_REF output of the PTOSimple function block.NOTE: A unique PTOSimple instance is needed per PTO Channel in the application.

4 The inputs/outputs are detailed in the function block (see page 70).The interaction between the inputs/outputs are detailed in the General Information (see page 101).

72 EIO0000000363 05/2010

Page 73: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

EIO0000000363 05/2010

III

Pulse Width Modulation and Frequency Generator

EIO0000000363 05/2010

Pulse Width Modulation and Frequency Generator

Overview

This part describes the principles of Pulse Width Modulation (PWM)/Frequency Generator (FG).

What's in this Part?

This part contains the following chapters:

Chapter Chapter Name Page

7 PWM/FG Generalities 75

8 Frequency Generator (FG) 79

9 Pulse Width Modulation (PWM) 89

73

Page 74: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Pulse Width Modulation and Frequency Generator

74 EIO0000000363 05/2010

Page 75: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

EIO0000000363 05/2010

7

PWM/FG Generalities

EIO0000000363 05/2010

PWM/FG Generalities

Overview

This chapter provides general information regarding the PWM and FG.

What's in this Chapter?

This chapter contains the following topics:

Topic Page

PWM/FG Naming Convention 76

Synchronization and Enable Function 77

75

Page 76: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PWM/FG Generalities

PWM/FG Naming Convention

Definition

Pulse Width Modulation and Frequency Generator use 1 physical output and up to 2 physical inputs. In this document, we use the following naming convention:

Name Description

SYNC Synchronization function (see page 77)

EN Enable function (see page 77)

IN_SYNC Physical input dedicated to the SYNC function.

IN_EN Physical input dedicated to the EN function.

OUT_PWM Physical output dedicated to the PWM or FG.

76 EIO0000000363 05/2010

Page 77: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PWM/FG Generalities

Synchronization and Enable Function

Introduction

This section presents the functions used by the PWM/FG:Synchronization functionEnable 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) is used for synchronization or enable function.

If you need to use the physical input, you must enable it in the configuration screen (see Modicon LMC058 Motion Controller, Pulse Width Modulation, LMC058 Expert I/O Library Guide).

Synchronization Function

The synchronization function is used to interrupt the current PWM/FG cycle and then restart a new cycle.

Enable Function

The enable function is used to activate the PWM/FG.

F_(function)(function)

&EN_(function)

IN_(function)Physical input

>1

EIO0000000363 05/2010 77

Page 78: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PWM/FG Generalities

78 EIO0000000363 05/2010

Page 79: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

EIO0000000363 05/2010

8

PWM/FG Principles - FG

EIO0000000363 05/2010

Frequency Generator (FG)

Overview

This chapter describes the Frequency Generator.

What's in this Chapter?

This chapter contains the following topics:

Topic Page

Description 80

Frequency Generator Configuration 81

FrequencyGenerator Function Block 84

Programming the FrequencyGenerator Function Block 86

79

Page 80: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PWM/FG Principles - FG

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 1 Hz to 100 kHz with a 1 Hz step

The PTO, PWM, and Frequency Generator functions use the same dedicated outputs. Only one out of these 3 functions can be used on the same channel. Using different functions on channel 0 and channel 1 is allowed.

80 EIO0000000363 05/2010

Page 81: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PWM/FG Principles - FG

Frequency Generator Configuration

Introduction

2 frequency generator channels can be configured on the controller.

Reminder: The Frequency Generator function is not available on AC controllers (TM238LFAC24DR•• and TM238LDA24DR).

Hardware

Each Frequency Generator channel has the same I/O mapping than the PWM channel with 1 fast output and 2 auxiliary standard inputs (see M238 Logic Controller, Hardware Guide).

Open the Configuration Window

Use this procedure to open the Frequency Generator configuration window:

Step Action

1 Select the Configuration tab and double-click on your controller.

2 Click on Embedded Functions

3 Click on PTO_PWM

4 Select Frequency Generator in the Mode entry of the configuration window.

EIO0000000363 05/2010 81

Page 82: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PWM/FG Principles - FG

Configuration Window Description

The following illustration provides an example of a configuration window on channel 0:

82 EIO0000000363 05/2010

Page 83: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PWM/FG Principles - FG

The following table describes each parameter for a Frequency Generator channel:

Configure a Frequency Generator Channel

Use the following procedure to configure a Frequency Generator channel:

Parameter Value Unit Description

Mode Frequency Generator - The Mode selected is Frequency Generator.

Auxiliary Inputs

EN Disabled *Enabled

- Enables the IN_EN physical input to be used for enabling the functionality.

EN Filter 0.04*0.41.24

ms Defines the value of the IN_EN filter value.

SYNC Disabled *Enabled

- Enables the IN_SYNC input to be used for synchronization.

SYNC Filter

0.04*0.41.24

ms Defines the value of the IN_SYNC filter value.

SYNC Edge

Rising Edge *Falling Edge

- Defines the IN_SYNC edge on which synchronization occurs.

Legend * Parameter default value

Step Action

1 Enable the Frequency Generator channel: In the list box Mode parameter → select Frequency Generator.Result: SoMachine creates a variable named FreqGen00 or FreqGen01 depending on the selected channel.NOTE: You can rename the variable by entering a new name in the Variable field.

Programming tip: You must remember the name to use the instance in a POU.

2 In the listbox of EN parameter, enable/disable the IN_EN physical input.

3 Configure the filter value of the IN_EN input (if enabled in step 2).

4 In the listbox of SYNC parameter, enable/disable the IN_SYNC physical input.

5 Configure the filter value of the IN_SYNC input (if enabled in step 4).

6 Configure the edge (rising or falling) for IN_SYNC signal detection (if enabled in step 4).

EIO0000000363 05/2010 83

Page 84: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PWM/FG Principles - FG

FrequencyGenerator Function Block

Frequency Generator

This 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 Function and Function Block Representation chapter (see page 105).

Description of I/O Variables

The following table describes the input variables:

Inputs Type Comment

EN_Enable BOOL TRUE = authorizes the Frequency Generator enable via the IN_EN input (if configured).

F_Enable BOOL TRUE = Forces the Enable function.

EN_SYNC BOOL TRUE = authorizes the restart via the IN_SYNC input of the internal timer relative to the time base (if configured).

F_SYNC BOOL On rising edge, forces a restart of the internal timer relative to the time base.

Frequency DWORD Frequency of the Frequency Generator output signal in Hz.(Range: 1...100,000)

84 EIO0000000363 05/2010

Page 85: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PWM/FG Principles - FG

The following table describes the output variables:

Outputs Type Comment

InFrequency BOOL TRUE = the Frequency Generator signal is output at the specified Frequency.

Busy BOOL Set to TRUE when the Enable command is set and the Frequency is changed.Reset to FALSE when InFrequency or Error is set, or when the Enable command is reset.

Error BOOL TRUE = indicates that an error was detected.

ErrID PTOPWM_ERR_TYPE (see page 117)

When Error is set: type of the detected error.

EIO0000000363 05/2010 85

Page 86: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PWM/FG Principles - FG

Programming the FrequencyGenerator Function Block

Procedure

Use these steps to program a frequency generator function:

Step Action

1 Insert the FrequencyGenerator function block available in the Function Block (Libraries) → SEC_PTOPWM → FrequencyGenerator.

2Look for the function block instance by clicking on .The Input Assistant screen appears. Select the variable that you defined during the configuration (see page 83) and confirm.

NOTE: If the function block instance is not visible, check if the frequency generator is configured.

3 The inputs/outputs are detailed in the function block (see page 84).The interaction between the inputs/outputs are detailed in the General Information (see page 101).

86 EIO0000000363 05/2010

Page 87: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PWM/FG Principles - FG

Program Illustration

The following illustration shows an example of a FrequencyGenerator function block programmed.

EIO0000000363 05/2010 87

Page 88: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PWM/FG Principles - FG

88 EIO0000000363 05/2010

Page 89: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

EIO0000000363 05/2010

9

PWM/FG Principles - PWM

EIO0000000363 05/2010

Pulse Width Modulation (PWM)

Overview

This chapter describes the Pulse Width Modulation.

What's in this Chapter?

This chapter contains the following topics:

Topic Page

Description 90

Pulse Width Modulation Configuration 92

PWM Function Block 95

Programming the PWM Function Block 97

89

Page 90: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PWM/FG Principles - PWM

Description

Overview

The PWM function generates a programmable square wave signal on a dedicated output with adjustable duty cycle and frequency.

NOTE: The functionality must be enabled 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.

The PTO, PWM, and Frequency Generator functions use the same dedicated outputs. Only one out of these 3 functions can be used on the same channel. Using different functions on channel 0 and channel 1 is allowed.

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 stepDuty Cycle of the output signal from 0% to 100%

Duty Cycle=Tp/T

Tp pulse widthT pulse period (1/Frequency)

90 EIO0000000363 05/2010

Page 91: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PWM/FG Principles - PWM

When duty cycle is below 5% or above 95%, depending on the frequency, the error is above 1% as illustrated in the graphic below:

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.

100error >1%

Duty Cycle(%)

Frequency(kHz)

9998979695

543210

40 8 12 16 20

Optimal functioning

error >1%

EIO0000000363 05/2010 91

Page 92: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PWM/FG Principles - PWM

Pulse Width Modulation Configuration

Overview

2 PWM channels can be configured on the controller.

Reminder: The PWM function is not available on AC controllers (TM238LFAC24DR•• and TM238LDA24DR).

Hardware

Each PWM channel is associated to 1 fast output and 2 auxiliary standard inputs (see M238 Logic Controller, Hardware Guide).

Open the Configuration Window

Use this procedure to open the PWM configuration window:

Step Action

1 Select the Configuration tab and double-click on your controller.

2 Click on Embedded Functions

3 Click on PTO_PWM

4 Select PWM in the Mode entry of the configuration window.

92 EIO0000000363 05/2010

Page 93: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PWM/FG Principles - PWM

Configuration Window Description

The following illustration provides an example of a configuration window on channel 0:

EIO0000000363 05/2010 93

Page 94: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PWM/FG Principles - PWM

The following table describes each parameter available when the embedded PTO_PWM is configured in PWM mode:

Configure a PWM Channel

Use the following procedure to configure a PWM channel:

Parameter Value Unit Description

Mode PWM - The Mode selected is PWM

Auxiliary Inputs

EN Disabled*Enabled

- Enables the IN_EN physical input to be used for enabling the functionality.

EN Filter 0.04*0.41.24

ms Defines the value of the IN_EN filter value.

SYNC Disabled*Enabled

- Enables the IN_SYNC input to be used for synchronization.

SYNC Filter 0.04*0.41.24

ms Defines the value of the IN_SYNC filter value.

SYNC Edge Rising Edge*Falling Edge

- Defines the IN_SYNC edge on which synchronization occurs.

Legend * Parameter default value

Step Action

1 Enable the PWM channel: In the list box of Mode parameter → select PWM.Result: SoMachine creates a variable named PWM00 or PWM01 depending on the selected channel.NOTE: You can rename the variable by entering a new name in the Variable field.

Programming tip: You must remember the name to use the instance in a POU.

2 In the listbox of EN parameter, enable/disable the IN_EN physical input.

3 Configure the filter value of the IN_EN input (if enabled in step 2).

4 In the listbox of SYNC parameter, enable/disable the IN_SYNC physical input.

5 Configure the filter value of the IN_SYNC input (if enabled in step 4).

6 Configure the edge (rising or falling) for IN_SYNC signal detection (if enabled in step 4).

94 EIO0000000363 05/2010

Page 95: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PWM/FG Principles - PWM

PWM Function Block

Function Description

This function block commands a Pulse Width Modulation 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 Function and Function Block Representation chapter (see page 105).

Description of I/O Variables

The following table describes the input variables:

Inputs Type Comment

EN_Enable BOOL TRUE = authorizes the PWM enable via the IN_Enable input (if configured)

F_Enable BOOL TRUE = Forces the Enable function.

EN_SYNC BOOL TRUE = authorizes the restart via the IN_Sync input of the internal timer relative to the time base (if configured).

F_SYNC BOOL On rising edge, forces a restart of the internal timer relative to the time base.

Frequency DWORD Frequency of the PWM output signal in tenth of Hz (range: min 1(0.1Hz)...max 200,000(20kHz)).

Duty BYTE Duty cycle of the PWM output signal in % (range: min 0...max 100).

EIO0000000363 05/2010 95

Page 96: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PWM/FG Principles - PWM

The following table describes the output variables:

Outputs Type Comment

InFrequency BOOL TRUE = the PWM signal is output at the specified Frequency and Duty cycle.

Busy BOOL Set to TRUE when the Enable command is set and the Frequency or Duty is changed.Reset to FALSE when InFrequency or Error is set, or when the Enable command is reset.

Error BOOL TRUE = indicates that an error was detected.

ErrID PTOPWM_ERR_TYPE (see page 117)

When Error is set: type of the detected error.

96 EIO0000000363 05/2010

Page 97: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PWM/FG Principles - PWM

Programming the PWM Function Block

Procedure

Follow these steps to program a PWM function:

Step Action

1 Insert the PWM function block available in the Function Block (Libraries) → SEC_PTOPWM → PWM.

2Look for the function block instance by clicking on .The Input Assistant screen appears. Select the global variable which references to the added PWM (see page 92) during the configuration and confirm.

NOTE: If the function block instance is not visible, check if the PWM is configured.

3 The inputs/outputs are detailed in the function block (see page 95).The interaction between the inputs/outputs are detailed in the General Information (see page 101).

EIO0000000363 05/2010 97

Page 98: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

PWM/FG Principles - PWM

Program Illustration

The following illustration shows an example of a FrequencyGenerator function block programmed.

98 EIO0000000363 05/2010

Page 99: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

EIO0000000363 05/2010

Appendices

Overview

This appendix extracts parts of the programming guide for technical understanding of the library documentation.

What's in this Appendix?

The appendix contains the following chapters:

Chapter Chapter Name Page

A General Information 101

B Function and Function Block Representation 105

C Data Unit Types 113

EIO0000000363 05/2010 99

Page 100: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

100 EIO0000000363 05/2010

Page 101: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

EIO0000000363 05/2010

A

General Information

EIO0000000363 05/2010

General Information

Overview

The information described in this chapter is common for PTO and HSC administrative and motion functions.

What's in this Chapter?

This chapter contains the following topics:

Topic Page

Dedicated Functions 102

General Information on Administrative and Motion Function Block Management

103

101

Page 102: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

General Information

Dedicated Functions

Proceeding by the Usage of Dedicated Functions

The outputs used by the High Speed Counters (HSC), Pulse Train Output (PTO), Pulse Width Modulation (PWM) and Frequency Generator (FG) functions cannot be read or written by the application, but only through the dedicated function blocks.

When using these dedicated functions, observe the following precautions to avoid unintended equipment operation with the functions and the equipment they control:

Do not use the same function block instance in different program tasks.Do not change the function block reference (••_REF_IN) while the function block is active (executing).

WARNINGUNINTENDED 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.

102 EIO0000000363 05/2010

Page 103: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

General Information

General Information on Administrative and Motion Function Block Management

Management of Input Variables

At the Execute input rising edge, the function block starts.

Any further modifications of the input variables are not taken in account.

Following the IEC 61131-3 standards, if any variable input to a function block is missing, that is, left open or unconnected, then the value from the previous invocation of the instance of the function block will be used. In the first invocation, the initial, configured value is applied in this case. Therefore, it is best that a function block always have known values attributed to its inputs to help avoid difficulties in debugging your program. For HSC and PTO function blocks, it is best to use the instance only once, and that instance must be in the main task.

Management of Output Variables

The Done, InVelocity, or InFrequency output is mutually exclusive with Busy, CommandAborted, and Error outputs: only one of them can be TRUE on one function block. If the Execute input is TRUE, one of these outputs is TRUE.

At the rising edge of the Execute input, the Busy output is set. This Busy output remains set during the function block execution, and is reset at the rising edge of one of the other outputs (Done, InVelocity, InFrequency, CommandAborted, and Error).

The Done, InVelocity, or InFrequency output is set when the function block execution has been completed successfully.

When a function block execution is interrupted by another one, the CommandAborted output is set instead.

When a function block execution ends owing to a detected error, the Error output is set and the detected error number is given through the ErrId output.

The Done, InVelocity, InFrequency, Error, ErrID, and CommandAborted outputs are reset with the falling edge of Execute. If Execute input is reset before the execution is finished, then the outputs are set for one task cycle at the execution ending.

When an instance of a function block receives a new Execute before it is finished, the function block does not return any feedback, like Done, for the previous action.

Error Handling

All blocks have 2 outputs that can report a detected error during the execution of the function block:

Error = TRUE when an error is detected.ErrID When Error = TRUE, returns the detected error ID.

EIO0000000363 05/2010 103

Page 104: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

General Information

104 EIO0000000363 05/2010

Page 105: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

EIO0000000363 05/2010

B

Function and Function Block Representation

EIO0000000363 05/2010

Function and Function Block Representation

Overview

Each function can be represented in the following languages:IL: Instruction ListST: Structured TextLD: Ladder DiagramFBD: Function Block DiagramCFC: Continuous Function Chart

This chapter provides functions and function blocks representation examples and explains how to use them for IL and ST languages.

What's in this Chapter?

This chapter contains the following topics:

Topic Page

Differences Between a Function and a Function Block 106

How to Use a Function or a Function Block in IL Language 107

How to Use a Function or a Function Block in ST Language 110

105

Page 106: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

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 resultis directly called with its name (not through an Instance)has no persistent state from one call to the othercan 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 outputsis always called through 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

Examples: timers, counters

In the example below, Timer_ON is an instance of the Function Block TON:

106 EIO0000000363 05/2010

Page 107: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

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

The following procedure describes how to insert a function in IL language:

To illustrate the procedure, consider the Functions IsFirstMastCycle (without input parameter) and SetRTCDrift (with input parameters) graphically presented below:

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 the SoMachine global help.

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), oruse the Input Assistant to select the function (select Insert Box in contextual 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.

Function Graphical Representation

without input parameter:IsFirstMastCycle

with input parameters:SetRTCDrift

EIO0000000363 05/2010 107

Page 108: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Function and Function Block Representation

In IL language, the function name is used directly in the Operator Column:

Using a Function Block in IL language

The following procedure describes how to insert a function block in IL language:

Function Representation in SoMachine POU IL Editor

IL example of a function without input parameter:IsFirstMastCycle

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 the SoMachine global help.

2 Create the variables that the function block requires, including the instance name.

108 EIO0000000363 05/2010

Page 109: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Function and Function Block Representation

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:

3 Function Blocks are called using a CAL instruction:Use the Input Assistant to select the FB (right-click and select Insert Box in contextual menu).Automatically, the CAL instruction and the necessary I/O are created.

Each parameter (I/O) is an instruction:Value to inputs are set by ":=".Values to outputs are set by "=>".

4 In the CAL right-side field, replace ??? with the instance name.

5 Replace other ??? with an appropriate variable or immediate value.

Step Action

Function Block Graphical Representation

TON

Function Block Representation in SoMachine POU IL Editor

TON

EIO0000000363 05/2010 109

Page 110: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

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

The following procedure describes how to insert a function in ST language:

To illustrate the procedure, consider the function SetRTCDrift graphically presented below:

The ST language of this function is the following:

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 the SoMachine global help.

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);

Function Graphical Representation

SetRTCDrift

Function Representation in SoMachine POU ST Editor

SetRTCDrift PROGRAM MyProgram_STVAR 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);

110 EIO0000000363 05/2010

Page 111: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Function and Function Block Representation

Using a Function Block in ST Language

The following procedure describes how to insert a function block in ST language:

To illustrate the procedure, consider this example with the TON function block 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, refer to the SoMachine global help.

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 blockOutput 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,...);

Function Block Graphical Representation

TON

EIO0000000363 05/2010 111

Page 112: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Function and Function Block Representation

The following table shows examples of a function block call in ST language:

Function Block Representation in SoMachine POU ST Editor

TON

112 EIO0000000363 05/2010

Page 113: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

EIO0000000363 05/2010

C

M238 PTO / PWM Library - Data Unit Types

EIO0000000363 05/2010

Data Unit Types

Overview

This chapter describes the data unit types of the M238 PTO / PWM Library.

What's in this Chapter?

This chapter contains the following topics:

Topic Page

PTO_DIRECTION: Type for Direction of a Move on PTO Axis Variable 114

PTO_PARAMETER_TYPE: Type for Parameter of PTO axis to Set or to Get Variable

115

PTO_REF: Type for PTO Reference Value Variable 116

PTOPWM_ERR_TYPE: Type for Detected Error Variable which can Occur on PTO or PWM

117

113

Page 114: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

M238 PTO / PWM Library - Data Unit Types

PTO_DIRECTION: Type for Direction of a Move on PTO Axis Variable

Enumerated Type Description

The enumeration data type ENUM is used in combination with PTO motions and contains the following values:

Enumerator Value Description

PTO_POSITIVE 00 hex Direction is positive according to configuration.

PTO_NEGATIVE 01 hex Direction is negative according to configuration.

PTO_CURRENT 02 hex Maintain last direction.

114 EIO0000000363 05/2010

Page 115: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

M238 PTO / PWM Library - Data Unit Types

PTO_PARAMETER_TYPE: Type for Parameter of PTO axis to Set or to Get Variable

Enumerated Type Description

The enumeration data type ENUM is used in combination with PTOGetParam and PTOSetParam and contains the following values:

Enumerator Value Description

PTO_START_FREQUENCY 00 hex Start velocity of a PTO motion.

PTO_STOP_FREQUENCY 01 hex Stop velocity of a PTO motion.

PTO_EMY_DEC 02 hex Deceleration of a PTO emergency stop.

EIO0000000363 05/2010 115

Page 116: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

M238 PTO / PWM Library - Data Unit Types

PTO_REF: Type for PTO Reference Value Variable

Data Type Description

The PTO_REF is a byte used to identify the PTO_REF function associated to the administrative block.

116 EIO0000000363 05/2010

Page 117: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

M238 PTO / PWM Library - Data Unit Types

PTOPWM_ERR_TYPE: Type for Detected Error Variable which can Occur on PTO or PWM

Enumerated Type Description

For PTO, PWM and Frequency Generator function blocks, the enumeration data type ENUM contains the following values:

Enumerator Value Description

NO_ERROR 00 hex No error detected

PTO_UNKNOW_REF 01 hex Unknown axis reference or misconfigured axis.

PTO_UNKNOW_PARAMETER 02 hex Unknown parameter type.

PTO_INVALID_PARAMETER 03 hex Invalid parameter value or incorrect combination of parameter values for the requested move.

PTO_COM_ERROR 04 hex Communication error detected with the PTO interface.

PTO_AXIS_ERROR 05 hex Axis error detected (for instance state machine invalid).

EIO0000000363 05/2010 117

Page 118: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

M238 PTO / PWM Library - Data Unit Types

118 EIO0000000363 05/2010

Page 119: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

EIO0000000363 05/2010

Glossary

0-9

%IAccording to the IEC standard, %I represents an input bit (for example a language object of type digital IN).

%IWAccording to the IEC standard, %IW represents an input word register (for example a language object of type analog IN).

%MWAccording to the IEC standard, %MW represents a memory word register (for example a language object of type memory word).

%QAccording to the IEC standard, %Q represents an output bit (for example a language object of type digital OUT).

%QWAccording to the IEC standard, %QW represents an output word register (for example a language object of type analog OUT).

EIO0000000363 05/2010 119

Page 120: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

1-phase counterA 1-phase counter uses 1 hardware input as counter input. It usually counts up or counts down when there is pulse signal in the input.

2-phase counterA 2-phase counter uses the phase difference between 2 input counter signals to count up or count down.

A

AFBapplication function block

analog inputAn analog input module contains circuits that convert an analog DC input signal to a digital value that can be manipulated by the processor. By implication, the analog input is usually direct. That means a data table value directly reflects the analog signal value.

analog outputAn analog output module contains circuits that transmit an analog DC signal proportional to a digital value input to the module from the processor. By implication, these analog outputs are usually direct. That means a data table value directly controls the analog signal value.

application sourceThe application source file can be uploaded to the PC to reopen a SoMachine project. This source file can support a full SoMachine project (for example, one that includes HMI application).

ARPThe address resolution protocol is the IP network layer protocol for Ethernet that maps an IP address to a MAC (hardware) address.

120 EIO0000000363 05/2010

Page 121: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

ARRAYAn ARRAY is a table containing elements of a single type. The syntax is as follows: ARRAY [<limits>] OF <Type>

Example 1: ARRAY [1..2] OF BOOL is a 1-dimensional table with 2 elements of type BOOL.

Example 2: ARRAY [1..10, 1..20] OF INT is a 2-dimensional table with 10x20 elements of type INT.

ARWanti-reset windup

ASCIIThe american standard code for information interchange is a communication protocol for representing alphanumeric characters (letters, numbers, and certain graphic and control characters).

assigned variableA variable is "assigned" if its location in controller memory can be known. For example, the Water_pressure variable is said to be assigned through its association with memory location %MW102.Water_pressure.

ATCanalog tension control

ATVATV is the model prefix for Altivar drives. (For example, “ATV312” refers to the Altivar 312 variable speed drive.)

AWGThe american wire gauge standard specifies wire gauges in North America.

EIO0000000363 05/2010 121

Page 122: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

B

BCDThe binary coded decimal format represents decimal numbers between 0 and 9 with a set of 4 bits (a nybble/nibble, also titled as Halfbyte). In this format, the 4 bits used to encode decimal numbers have an unused range of combinations. For example, the number 2,450 is encoded as 0010 0100 0101 0000

BOOLA Boolean type is the basic data type in computing. A BOOL variable can have one of these values: 0 (FALSE), 1 (TRUE). A bit that is extracted from a word is of type BOOL, for example: %MW10.4 is a fifth bit a memory word number 10.

Boot applicationFiles that contain machine dependent parameters:

machine namedevice name or IP addressModbus Serial Line addressRouting table

BOOTPThe bootstrap protocol is a UDP network protocol that can be used by a network client to automatically obtain an IP address (and possibly other data) from a server. The client identifies itself to the server using the client’s MAC address. The server—which maintains a pre-configured table of client device MAC addresses and associated IP addresses—sends the client its pre-configured IP address. BOOTP was originally used as a method that enabled diskless hosts to be remotely booted over a network. The BOOTP process assigns an infinite lease of an IP address. The BOOTP service utilizes UDP ports 67 and 68.

bpsbit per second as a definition of transmission rate, also given in conjunction with multiplicator kilo (kbps) and mega (mbps).

BSHBSH is a Lexium servo motor from Schneider Electric.

122 EIO0000000363 05/2010

Page 123: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

bus baseA bus base is a mounting device that is designed to seat an electronic module on a DIN rail and connect it to the TM5 bus for M258 and LMC058 controllers. Each base bus extends the TM5 data and to the power buses and the 24 Vdc I/O power segment. The electronic modules are added to the TM5 system through their insertion on the base bus. The base bus also supplies the articulation point for the terminal blocks.

BYTEWhen 8 bits are grouped together, they are called a BYTE. You can enter a BYTE either in binary mode or in base 8. The BYTE type is encoded in an 8-bit format that ranges from 16#00 to 16#FF (in hexadecimal format).

C

CANThe controller area network protocol (ISO 11898) for serial bus networks is designed for the interconnection of smart devices (from multiple manufacturers) in smart systems for real-time industrial applications. CAN multi-master systems ensure high data integrity through the implementation of broadcast messaging and advanced diagnostic mechanisms. Originally developed for use in automobiles, CAN is now used in a variety of industrial automation control environments.

CANmotionCANmotion is a CANopen-based motion bus with an additional mechanism that provides synchronization between the motion controller and the drives.

CANopenCANopen is an open industry-standard communication protocol and device profile specification.

CFCThe continuous function chart (an extension of the IEC61131-3 standard) is a graphical programming language that works like a flowchart. By adding simple logicals blocks (AND, OR, etc.), each function or function block in the program is represented in this graphical format. For each block, the inputs are on the left and the outputs on the right. Block outputs can be linked to inputs of other blocks in order to create complex expressions.

EIO0000000363 05/2010 123

Page 124: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

CiACAN in automation is a non-profit group of manufacturers and users dedicated to developing and supporting CAN-based higher layer protocols.

CIPWhen the common industrial protocol is implemented in a network’s application layer, it can communicate seamlessly with other CIP-based networks without regard to the protocol. For example, the implementation of CIP in the application layer of an Ethernet TCP/IP network creates an EtherNet/IP environment. Similarly, CIP in the application layer of a CAN network creates a DeviceNet environment. In that case, devices on the EtherNet/IP network can communicate with devices on the DeviceNet network through CIP bridges or routers.

CMUThe current measurement unit is used to convert the relative current value (%) provided by TeSys into a real ISO value (A).

configurationThe configuration includes the arrangement and interconnection of hardware components within a system and the hardware and software selections that determine the operating characteristics of the system.

controllerA controller (or “programmable logic controller,” or “programmable controller”) is used to automate industrial processes.

controller status outputThe controller status output is a special function used in circuits that are external to the controller that control the power supply to the output devices or the controller’s power supply.

CPDMcontroller power distribution module

CRCA network message's cyclic redundancy check field contains a small number of bits that produce a checksum. The message is calculated by the transmitter according to the message’s content. Receiving nodes then recalculate the field. Any discrepancy in the two CRC fields indicates that the transmitted message and the received message are different.

124 EIO0000000363 05/2010

Page 125: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

CSAThe canadian standards association defines and maintains standards for industrial electronic equipment in hazardous environments.

CTSClear to send is a data transmission signal and acknowledges the RDS signal from the transmitting station.

cyclic taskThe cyclic scan time has a fixed duration (interval) specified by the user. If the current scan time is shorter than the cyclic scan time, the controller waits until the cyclic scan time has elapsed before starting a new scan.

D

data logThe controller logs events relative to the user application in a data log.

DCEData communications equipment describes devices (often modems) that start, stop, and sustain network sessions.

DeratingDerating describes a reduction in an operating specification. For devices in general it is usually a specified reduction in nominal power to facilitate operation at increased ambient conditions like higher temperatures or higher altitudes.

DHCPThe dynamic host configuration protocol is an advanced extension of BOOTP. DHCP is a more advanced, but both DHCP and BOOTP are common. (DHCP can handle BOOTP client requests.)

digital I/OA digital input or output has an individual circuit connection at the electronic module that corresponds directly to a data table bit that holds the value of the signal at that I/O circuit. It gives the control logic digital access to I/O values.

EIO0000000363 05/2010 125

Page 126: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

DINDeutsches Institut für Normung is a German institution that sets engineering and dimensional standards.

DINTA double integer type is encoded in a 32-bit format.

DNSThe domain name system is the naming system for computers and devices connected to a LAN or the Internet.

drop cableA drop cable is the unterminated derivation cord used to connect a TAP to a device.

DSRData set ready is a data transmission signal.

DTMWith device type managers representing the field device in SoMachine, direct communications are possible to every single field device via SoMachine, the controller and the field bus, thus avoiding the need for individual cable connections.

DWORDA double word type is encoded in a 32-bit format.

E

EDSElectronic data sheet contains for example the properties of a device e.g. parameters and settings of a drive.

EEPROMElectrically erasable programmable read-only memory is a type of non-volatile memory used to store data that must be saved when power is removed.

126 EIO0000000363 05/2010

Page 127: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

EIAThe electronic industries alliance is the trade organization for establishing electrical/electronic and data communication standards (including RS-232 and RS-485) in the United States.

EIA rackAn electronic industries alliance rack is a standardized (EIA 310-D, IEC 60297 and DIN 41494 SC48D) system for mounting various electronic modules in a stack or rack that is 19 inches (482.6 mm) wide.

electronic moduleIn a programmable controller system, most electronic modules directly interface to the sensors, actuators, and external devices of the machine/process. This electronic module is the component that mounts in a bus base and provides electrical connections between the controller and the field devices. Electronic modules are offered in a variety of signal levels and capacities. (Some electronic modules are not I/O interfaces, including power distribution modules and transmitter/receiver modules.)

ENEN identifies one of many European standards maintained by CEN (European Committee for Standardization), CENELEC (European Committee for Electrotechnical Standardization), or ETSI (European Telecommunications Standards Institute).

encoderAn encoder is a device for length or angular measurement (linear or rotary encoders).

EquipmentAn Equipment is a part of the Machine.

ERCeccentric roller conveyor

ESDelectrostatic discharge

EIO0000000363 05/2010 127

Page 128: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

EthernetEthernet is a physical and data link layer technology for LANs, also known as IEE 802.3.

EtherNet/IPThe ethernet industrial protocol is an open communications protocol for manufacturing automation solutions in industrial systems. EtherNet/IP is in a family of networks that implements Common Industrial Protocol at its upper layers. The supporting organization (ODVA) specifies EtherNet/IP to accomplish global adaptability and media independence.

expansion busThe expansion bus is an electronic communication bus between expansion modules and a CPU.

expansion I/O moduleAn expansion input or output module is either a digital or analog module that adds additional I/O to the base controller.

expert I/OExpert I/Os are dedicated modules or channels for advanced features. These features are generally embedded in the module in order to not use the ressources of the PLC Controller and to allow a fast response time, depending of the feature. Regarding the function, it could be considered as a “stand alone” module, because the function is independant of the Controller processing cycle, it just exchanges some information with the Controller CPU.

F

FAST I/OFAST I/Os are specific I/Os with some electrical features (response time, for example) but the treatment of these channels is done by the Controller CPU.

FAST taskThe FAST task is a periodic, high-priority task of a short duration that is run on a processor through its programming software. The task’s fast speed keeps it from interfering with the execution of lower priority master (MAST) tasks. A FAST task is useful when fast periodic changes in discrete inputs need to be monitored.

128 EIO0000000363 05/2010

Page 129: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

FBA function block performs a specific automation function, such as speed control, interval control, or counting. A function block comprises configuration data and a set of operating parameters.

FBDA function block diagram is a graphically oriented programming language, compliant with IEC 61131-3. It works with a list of networks whereby each network contains a graphical structure of boxes and connection lines which represents either a logical or arithmetic expression, the call of a function block, a jump, or a return instruction.

FDTField device tool for standardized communications between field devices and SoMachine.

FEFunctional ground is the point of a system or device that must be grounded to help prevent equipment damage.

FGfrequency generator

firmwareThe firmware represents the operating system on a controller.

Flash memoryFlash memory is nonvolatile memory that can be overwritten. It is stored on a special EEPROM that can be erased and reprogrammed.

FTPFile transfer protocol is a standard network protocol (built on a client-server architecture), to exchange and manipulate files over TCP/IP based networks.

EIO0000000363 05/2010 129

Page 130: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

functionA function:

is a POU that returns 1 immediate resultis directly called with its name (as opposed to through an instance)has no persistent state from one call to the nextcan be used as an operand in expressions

Examples: boolean (AND) operators, calculations, conversions (BYTE_TO_INT)

function block (FB)See FB.

function block diagram (FBD)See FBD.

FWDforward

G

GVLThe global variable list manages global variables that are available in every application POU.

H

HE10Rectangular connector for electrical signals with frequencies below 3MHz, complying with IEC60807-2.

HMIA human-machine interface is an operator interface (usually graphical) for industrial equipment.

hot swappingHot swapping is the replacement of a component with a like component while the system remains operational. The replacement component begins to function automatically after it is installed.

130 EIO0000000363 05/2010

Page 131: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

HSChigh-speed counter

HVACHeating ventilation and air conditioning applications monitor and control indoor environments.

I

I/Oinput/output

I/O scanAn input/output scan continuously polls I/O modules to collect data bits and status, error, and diagnostics information. This process monitors inputs and controls outputs.

I/O terminalAn input/output terminal on the front of an expansion I/O module connects input and output signals.

ICMPThe internet control message protocol reports errors and provides information related to datagram processing.

IECThe international electrotechnical commission is a non-profit and non-governmental international standards organization that prepares and publishes international standards for all electrical, electronic, and related technologies.

IEC 61131-3The IEC 61131-3 is an international electrotechnical commission standard for industrial automation equipment (like controllers). IEC 61131-3 deals with controller programming languages and defines 2 graphical and 2 textual programming language standards:

graphical: ladder diagram, function block diagramtextual: structured text, instruction list

EIO0000000363 05/2010 131

Page 132: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

IEEEThe institute of electrical and electronics engineers is a non-profit international standards and conformity assessment body for advances in all fields of electrotechnology.

IEEE 802.3IEEE 802.3 is a collection of IEEE standards defining the physical layer, and the media access control (MAC) sublayer of the data link layer, of wired Ethernet.

ILA program written in the instruction list language is composed of a series of instructions executed sequentially by the controller. Each instruction includes a line number, an instruction code, and an operand. (IL is IEC 61131-3 compliant.)

immediate addressingThe direct method of addressing memory objects, including physical inputs and outputs, used in programming instructions as operands and parameters by using their direct address (for example, %Iwx or %QWx).

The use of immediate addressing in your program may avoid the need to create symbols for these objects, but there are also disadvantages. For example, if you change the program’s configuration by adding or deleting devices or I/O modules or slices, the immediate addresses used as programming instruction operands and/or parameters are not updated and must be corrected manually, which may cause extensive program modifications and lead to incorrect programming instructions. (See symbolic addressing.)

input filterAn input filter is a special function that rejects input noises. It is useful for eliminating input noises and chatter in limit switches. All inputs provide a level of input filtering using the hardware. Additional filtering with software is also configurable through the programing or the configuration software.

input terminalAn input terminal on the front of an expansion I/O module connects input signals from input devices (such as sensors, push buttons, and limit switches). For some modules, input terminals accept both sink and source DC input signals.

132 EIO0000000363 05/2010

Page 133: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

instruction list language (IL)Refer to IL.

INTA single integer is encoded in 16 bits.

IPThe internet protocol is part of the TCP/IP protocol family that tracks the Internet addresses of devices, routes outgoing messages, and recognizes incoming messages.

IP 20Ingress protection rating according to IEC 60529. IP20 modules are protected against ingress and contact of objects larger than 12.5 mm. The module is not protected against harmful ingress of water.

IP 67Ingress protection rating according to IEC 60529. IP67 modules are completely protected against ingress of dust and contact. Ingress of water in harmful quantity is not possible when the enclosure is immersed in water up to 1m.

K

Kdderivative gain

Kiintegral gain

Kpproportional gain

EIO0000000363 05/2010 133

Page 134: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

L

Ladder Diagram languageSee LD.

LANA local area network local area network is a short-distance communications network that is implemented in a home, office, or institutional environment.

latching inputA latching input module interfaces with devices that transmit messages in short pulses. Incoming pulses are captured and recorded for later examination by the application.

LCDliquid crystal display

LDA program in the ladder diagram language includes a graphical representation of instructions of a controller program with symbols for contacts, coils, and blocks in a series of rungs executed sequentially by a controller. IEC 61131-3 compliant.

LEDA light emitting diode is an indicator that lights up when electricity passes through it.

LINTLong integer is a 64-bit variable (4 times INT or two times DINT).

LMClexium motion control

located variableA located variable has an address. (See unlocated variable.)

134 EIO0000000363 05/2010

Page 135: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

LRClongitudinal redundancy checking

LREALLong real is a 64-bit variable.

LSBThe least significant bit (or least significant byte) is the part of a number, address, or field that is written as the right-most single value in conventional hexadecimal or binary notation.

LWORDA long word type is encoded in a 64-bit format.

M

MAC addressThe media access control address is a unique 48-bit number associated with a specific piece of hardware. The MAC address is programmed into each network card or device when it is manufactured.

MachineA Machine consists of several functions and/or equipments which build the machine.

MagelisMagelis is the commercial name for Schneider Electric's range of HMI terminals.

MASTA master (MAST) task is a processor task that is run through its programming software. The MAST task has two sections:

IN: Inputs are copied to the IN section before execution of the MAST task.OUT: Outputs are copied to the OUT section after execution of the MAST task.

master/slaveThe single direction of control in a network that implements the master/slave model is always from a master device or process to one or more slave devices.

EIO0000000363 05/2010 135

Page 136: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

MIBThe management information base is an object database that is monitored by a network management system like SNMP. SNMP monitors devices that are defined by their MIBs. Schneider has obtained a private MIB, groupeschneider (3833).

minimum I/O update timeThe minimum I/O update time is the minimum time it takes for the bus cycle to shut down to force an I/O update at each cycle.

ModbusThe Modbus communication protocol allows communications between many devices connected to the same network.

Modbus SLModbus serial line

MSBThe most significant bit (or most significant byte) is the part of a number, address, or field that is written as the left-most single value in conventional hexadecimal or binary notation.

N

NAKnegative acknowledge

NCA normally closed contact is a contact pair that is closed when the actuor is de-energized (no power is applied) and open when the actuor is energized (power is applied).

NECThe national electric code standard dictates the safe installation of electrical wiring and equipment.

136 EIO0000000363 05/2010

Page 137: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

NEMAThe national electrical manufacturers association publishes standards for the performance of various classes of electrical enclosures. The NEMA standards cover corrosion resistance, ability to protect from rain and submersion, etc. For IEC member countries, the IEC 60529 standard classifies the ingress protection rating for enclosures.

networkA network includes interconnected devices that share a common data path and protocol for communications.

NibbleA Nibble is a Halfbyte (representing 4 bits of a byte).

NMTNetwork management protocols provide services for network initialization, error control, and device status control.

NMT state machineA network management state machine defines the communication behavior of any CANopen device. The CANopen NMT state machine consists of an initialization state, a pre-operational state, an Operational state, and a stopped state. After power-on or reset, the device enters the initialization state. After the device initialization is finished, the device automatically enters the pre-operational state and announces the state transition by sending the boot-up message. In this manner, the device indicates that it is ready to work. A device that stays in pre-operational state may start to transmit SYNC-, Time Stamp-, or Heartbeat message. In this state, the device cannot communicate through a PDO; it must do so with an SDO. In the operational state, the device can use all supported communication objects.

NOA normally open contact is a contact pair that is open when the actuor is de-energized (no power is applied) and closed when the actuor is energized (power is applied).

nodeA node is an addressable device on a communication network.

EIO0000000363 05/2010 137

Page 138: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

O

ODVAThe open deviceNet vendors association supports the family of network technologies that are built on CIP (EtherNet/IP, DeviceNet, and CompoNet).

OSOperating system. Can be used for Firmware that can be uploaded/downloaded by the user.

OSIThe open system interconnection reference model is a 7-layer model that describes network protocol communications. Each abstract layer receives services from the layer below it and provides services to the layer above.

OTBOptimized terminal block, used in the context of Advantys IO distributed module

output terminalAn output terminal connects output signals to output devices (such as electrome-chanical relays and solenoid valves).

P

palletA pallet is a portable platform, which is used for storing or moving goods.

PCIA peripheral component interconnect is an industry-standard bus for attaching peripherals.

PDMA power distribution module distributes either AC or DC field power to a cluster of I/O modules.

138 EIO0000000363 05/2010

Page 139: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

PDOA process data object is transmitted as an unconfirmed broadcast message or sent from a producer device to a consumer device in a CAN-based network. The transmit PDO from the producer device has a specific identifier that corresponds to the receive PDO of the consumer devices.

PDUprotocol data unit

PEProtective ground is a return line across the bus for fault currents generated at a sensor or actuator device in the control system.

periodic executionThe master task is executed either cyclically or periodically. In periodic mode, you determine a specific time (period) in which the master task must be executed. If it is executed under this time, a waiting time is generated before the next cycle. If it is executed over this time, a control system indicates the overrun. If the overrun is too high, the controller is stopped.

persistent dataValue of persistent data that will be used at next application change or cold start. Only get re-initialized at a reboot of the controller or reset origin. Especially they maintain their values after a download.

PIproportional integral

PIDproportional, integral and derivative control

PLCThe programmable logic controller is the “brain” of an industrial manufacturing process. It automates a process, used instead of relay control systems. PLCs are computers suited to survive the harsh conditions of the industrial environment.

EIO0000000363 05/2010 139

Page 140: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

PLCopenThe PLCopen standard brings efficiency, flexibility, and manufacturer independence to the automation and control industry through the standardization of tools, libraries, and modular approaches to software programming.

PLIpulse latch input

post-configurationPost-configuration files contain machine-independent parameters, including:

machine namedevice name or IP addressModbus serial line addressrouting table

POUA program organization unit includes a variable declaration in source code and the corresponding instruction set. POUs facilitate the modular reuse of software programs, functions, and function blocks. Once declared, POUs are available to one another. SoMachine programming requires the utilization of POUs.

POU FBProgram organization unit function block types are user programs that can be defined by the user in the ST, IL, LD, or FBD languages. You can use POU FB types in an application to:

simplify the design and entry of the programmake the program easier to readsimplify debuggingreduce the amount of generated code

power supply terminalsThe power supply is connected to these terminals to provide power to the controller.

protocolA protocol is a convention or standard that controls or enables the connection, communication, and data transfer between two computing endpoints.

140 EIO0000000363 05/2010

Page 141: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

Pt100/Pt1000Platinum resistance thermometer are characterized by their nominal resistance R0 at a temperature of 0° C.

Pt100 (R0 = 100 Ohm)Pt1000 (R0 = 1 kOhm)

PTOPulse train outputs are used to control for instance stepper motors in open loop.

PWMPulse width modulation is used for regulation processes (e.g. actuators for temperature control) where a pulse signal is modulated in its length. For these kind of signals, transistor outputs are used.

R

RAMrandom access memory

REALReal is a numeric data type. The REAL type is encoded in a 32-bit format.

real-time clock (RTC)See RTC

reflex outputIn a counting mode, the high speed counter’s current value is measured against its configured thresholds to determine the state of these dedicated outputs.

retained dataA retained data value is used in the next power-on or warm start. The value is retained even after an uncontrolled shutdown of the controller or a normal switch-off of the controller.

RFIDRadio-frequency identification is an automatic identification method that relies on the storage and remote retrieval of data using RFID tags or transponders.

EIO0000000363 05/2010 141

Page 142: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

RJ-45This registered jack is a modular connector that is commonly implemented in communication networks.

RPDOA receive PDO sends data to a device in a CAN-based network.

RPMrevolutions per minute

RPSrevolutions per second

RS-232RS-232 (also known as EIA RS-232C or V.24) is a standard type of serial communication bus, based on three wires.

RS-485RS-485 (also known as EIA RS-485) is a standard type of serial communication bus, based on two wires.

RTCThe real-time clock option keeps the time for a limited amount of time even when the controller is not powered.

RTSRequest to send is a data transmission signal and will be acknowledged by the CTS signal from the destination node.

RTUA remote terminal unit is a device that interfaces with objects in the physical world to a distributed control system or SCADA system by transmitting telemetry data to the system and/or altering the state of connected objects based on control messages received from the system.

RxDreceiving data (data transmission signal)

142 EIO0000000363 05/2010

Page 143: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

S

SCADAA supervisory control and data acquisition system monitors, manages, and controls industrial applications or processes.

scanA controller’s scanning program performs 3 basic functions: [1] It reads inputs and places these values in memory; [2] it executes the application program 1 instruction at a time and stores results in memory; [3] It uses the results to update outputs.

SDOA service data object message is used by the fieldbus master to access (read/write) the object directories of network nodes in CAN-based networks. SDO types include service SDOs (SSDOs) and client SDOs (CSDOs).

SEL-VA system that follows IEC 61140 guidelines for safety extra low voltage is protected in such a way that voltage between any 2 accessible parts (or between 1 accessible part and the PE terminal for Class 1 equipment) does not exceed a specified value under normal conditions or under single-fault conditions.

Sequential Function ChartSee SFC.

SFCA program written in the sequential function chart language can be used for processes that can be split into steps. SFC is composed of steps with associated actions, transitions with associated logic condition, and directed links between steps and transitions. (The SFC standard is defined in IEC 848. It is IEC 61131-3 compliant.)

sink inputA sink input is a wiring arrangement in which the device provides current to the input electronic module. A sink input is referenced to 0 Vdc.

SINTSigned integer is a 16-bit value.

EIO0000000363 05/2010 143

Page 144: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

SLserial line

SMSThe short message service is a standard communication service for telephones (or other devices) that send short text messages over the mobile communications system.

SNMPThe simple network management protocol can control a network remotely by polling the devices for their status, performing security tests, and viewing information relating to data transmission. It can also be used to manage software and databases remotely. The protocol also permits active management tasks, such as modifying and applying a new configuration

source outputA source output is a wiring arrangement in which the output electronic module provides current to the device. A source output is referenced to +24 Vdc.

SSISerial synchronous interface is a common interface for relative and absolute measurement systems like encoders.

STSee structured text.

STNscan twisted nematics (also known as passive matrix)

STRINGA STRING variable is a series of ASCII characters.

Structured TextA program written in the structured text (ST) language includes complex statements and nested instructions (such as iteration loops, conditional executions, or functions). ST is compliant with IEC 61131-3.

144 EIO0000000363 05/2010

Page 145: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

symbolA symbol is a string of a maximum of 32 alphanumeric characters, of which the first character is alphabetic. It allows you to personalize a controller object to facilitate the maintainability of the application.

symbolic addressingThe indirect method of addressing memory objects, including physical inputs and outputs, used in programming instructions as operands and parameters by first defining symbols for them using these symbols in association with the programming instructions.

In contrast to immediate addressing, this is the recommended method because if the program’s configuration changes, symbols are automatically updated with their new immediate address associations, whereas any immediate addresses used as operands or parameters are not. (See immediate addressing.)

system timeAn internal clock provides a device with the system time.

system variableA system variable structure provides controller data and diagnostic information and allows sending commands to the controller.

T

TAPA terminal access point is a junction box connected to the trunk cable that allows you to plug in drop cables.

taskA 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 consequence.

A controller can have several tasks.

EIO0000000363 05/2010 145

Page 146: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

TCPA transmission control protocol is a connection-based transport layer protocol that provides a reliable simultaneous bi-directional transmission of data. TCP is part of the TCP/IP protocol suite.

terminal blockThe terminal block is the component that mounts in an electronic module and provides electrical connections between the controller and the field devices.

TFTthin film transmission (also known as active matrix)

threshold outputThreshold outputs are controlled directly by the HSC according to the settings established during configuration.

TPA touch probe is a position capture that is triggered by a fast input signal (quick sensor). On the rising edge of the touch probe input the position of an encoder is captured. Example: This is used for packaging machines to capture the position of a printmark on a film to cut always on the same position.

TPDOA transmit PDO reads data from a device in a CAN-based system.

trunk cableA trunk cable is the main cable that is terminated at both physical ends with line termination resistors.

TVDAtested validated documented architectures

TxDTxD represents a transmit signal.

146 EIO0000000363 05/2010

Page 147: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

U

UDINTAn unsigned double integer is encoded in 32 bits.

UDPThe user datagram protocol is a connectionless mode protocol (defined by IETF RFC 768) in which messages are delivered in a datagram (data telegram) to a destination computer on an IP network. The UDP protocol is typically bundled with the Internet Protocol. UDP/IP messages do not expect a response, and are therefore ideal for applications in which dropped packets do not require retransmission (such as streaming video and networks that demand real-time performance).

UINTAn unsigned integer is encoded in 16 bits.

ULUnderwriters laboratories, US organization for product testing and safety certification.

unlocated variableAn unlocated variable does not have an address. (See located variable.)

UTCcoordinated universal time

V

VSDvariable speed drive

W

WORDThe WORD type is encoded in a 16-bit format.

EIO0000000363 05/2010 147

Page 148: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Glossary

148 EIO0000000363 05/2010

Page 149: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Index

EIO0000000363 05/2010

CBA

Index

AAdjusting

PTO, 63Adjusting functions

PTOGetParam, 64PTOSetParam, 66

BBusy

Management of Status Variables, 103

CClockWise/CounterClockWise

PTO Output Modes, 26CommandAborted

Management of Status Variables, 103Configuration

Frequency Generator, 81PTO, 22PWM, 92

CounterClockWise/ClockWisePTO Output Modes, 26

DDate Unit Types

PTO_DIRECTION_TYPE, 114PTO_PARAMETER_TYPE, 115PTO_REF_TYPE, 116PTOPWM_ERR_TYPE, 117

EIO0000000363 05/2010

Dedicated Functions, 102Diagnostic functions

PTOGetDiag, 70Direction/Pulse

PTO Output Modes, 26Done

Management of Status Variables, 103

EEmbedded Functions Configuration

Embedded PTO_PWM Configuration, 13ErrID

Error Handling, 103Management of Status Variables, 103

ErrorError Handling, 103Management of Status Variables, 103

Error HandlingErrID, 103Error, 103

ExecuteManagement of Status Variables, 103

FFrequency Generator

Configuration, 81Functionalities, 80

FrequencyGeneratorFunction Blocks, 84

149

Page 150: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Index

FunctionEnable, 77

FunctionalitiesFrequency Generator, 80PTO, 19PWM, 90

FunctionsDifferences Between a Function and a Function Block, 106How to Use a Function or a Function Block in IL Language, 107How to Use a Function or a Function Block in ST Language, 110

MManagement of Status Variables

Busy, 103CommandAborted, 103Done, 103ErrID, 103Error, 103Execute, 103

Motion BlocksPTOHome, 39PTOmoveRelative, 49PTOMoveVelocity, 54PTOStop, 44

PProgramming

PTOHome, 37PTOMoveRelative, 48PTOMoveVelocity, 53PTOStop, 43PWM, 97Sequence of Command, 58, 59

PTOAdjusting, 63Configuration, 22Functionalities, 19

PTO BlocksPTOSimple, 30

150

PTO Output ModesClockWise/CounterClockWise, 26CounterClockWise/ClockWise, 26Direction/Pulse, 26Pulse/Direction, 26

PTO_DIRECTION_TYPEDate Unit Types, 114

PTO_PARAMETER_TYPEDate Unit Types, 115

PTO_REF_TYPEDate Unit Types, 116

PTOGetDiagFunction Blocks, 70

PTOGetParamFunction Blocks, 64

PTOHomeFunction Blocks, 39Programming, 37

PTOmoveRelativeFunction Blocks, 49

PTOMoveRelativeProgramming, 48

PTOMoveVelocityFunction Blocks, 54Programming, 53

PTOPWM_ERR_TYPEDate Unit Types, 117

PTOSetParamFunction Blocks, 66

PTOSimpleFunction Blocks, 30

PTOStopFunction Blocks, 44Programming, 43

Pulse/DirectionPTO Output Modes, 26

PWMConfiguration, 92Function Blocks, 95Functionalities, 90Programming, 97

EIO0000000363 05/2010

Page 151: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Index

SSequence of Command

allowed, 59Motion State Diagram, 58

Synchronization, 77

EIO0000000363 05/2010

151
Page 152: EIO0000000363 05/2010 Modicon M238 Logic Controller · EIO0000000363.03 EIO0000000363 05/2010 Modicon M238 Logic Controller Pulse Train Output, Pulse Width Modulation M238 PTOPWM

Index

152 EIO0000000363 05/2010