Sei sulla pagina 1di 256

Preface, Contents User Information Product Overview Installing and Removing the FM 350-1 Wiring the FM 350-1 Assigning

Parameters to the FM 350-1 Programming the FM 350-1 Programming in M7 with the Counter Function Library Starting Up the FM 350-1 Reference Information Operating Modes, Settings, Parameters and Commands Encoder Signals and Their Evaluation DB Assignments M7 Reference Counter Function Library Faults and Diagnostics Appendices Technical Specifications Spare Parts
This manual is part of the documentation package with the order number:

1 2 3 4 5 6 7 8 9 10 11 12 A B C

SIMATIC FM 350-1 Function Module

Manual

References Glossary, Index

6ES7350-1AH00-8BG0

Edition 01/2003
A5E00073040-02

Safety Guidelines
This manual contains notices which you should observe to ensure your own personal safety, as well as to protect the product and connected equipment. These notices are highlighted in the manual by a warning triangle and are marked as follows according to the level of danger:

! ! !

Danger
indicates that death, severe personal injury or substantial property damage will result if proper precautions are not taken.

Warning
indicates that death, severe personal injury or substantial property damage can result if proper precautions are not taken.

Caution
indicates that minor personal injury or property damage can result if proper precautions are not taken.

Note
draws your attention to particularly important information on the product, handling the product, or to a particular part of the documentation.

Qualified Personnel
Only qualified personnel should be allowed to install and work on this equipment. Qualified persons are defined as persons who are authorized to commission, to ground, and to tag circuits, equipment, and systems in accordance with established safety practices and standards.

Correct Usage Note the following:

Warning
This device and its components may only be used for the applications described in the catalog or the technical descriptions, and only in connection with devices or components from other manufacturers which have been approved or recommended by Siemens. This product can only function correctly and safely if it is transported, stored, set up, and installed correctly, and operated and maintained as recommended.

Trademarks
SIMATIC, SIMATIC HMI and SIMATIC NET are registered trademarks of SIEMENS AG. Some of other designations used in these documents are also registered trademarks; the owners rights may be violated if they are used by third parties for their own purposes.

Copyright { Siemens AG 2000-2002 All rights reserved The reproduction, transmission or use of this document or its contents is not permitted without express written authority. Offenders will be liable for damages. All rights, including rights created by patent grant or registration of a utility model or design, are reserved. Siemens AG Bereich Automation and Drives Geschaeftsgebiet Industrial Automation Systems Postfach 4848, D- 90327 Nuernberg

Disclaimer of Liability We have checked the contents of this manual for agreement with the hardware and software described. Since deviations cannot be precluded entirely, we cannot guarantee full agreement. However, the data in this manual are reviewed regularly and any necessary corrections included in subsequent editions. Suggestions for improvement are welcomed. Siemens AG 2000-2002 Technical data subject to change. A5E00073040-02

Index-2 Siemens Aktiengesellschaft

FM 350-1 Function Module 07/2000

Preface

Purpose of the Manual


This manual gives you a complete overview of FM 350-1 function module. It helps you during installation and commissioning. The procedures involved in installation, wiring, parameter assignment and programming are described. This manual is intended for the programmers of STEP 7 programs and for those responsible for configuring, commissioning, and servicing automation systems.

Required Basic Knowledge


You require a general knowledge in the field of automation engineering to be able to understand this manual. In addition, you should know how to use computers or devices with similar functions (e.g programming devices) under Windows 95/98/2000 or NT operating systems.

Where is this Manual valid?


The present manual contains the description of function module FM 350-1 applicable at the time the manual was published. We reserve the right to describe changes of FM 350-1 functionality in a Product Information Leaflet.

The Contents of the Manual.... Man al Without latch without measuring operating modes without isochrone mode without measuring operating modes without isochrone mode

... Apply to the FM 350-1 MLFB 6ES7 350-1AH00-0AE0 6ES7 350-1AH01-0AE0 Release

1=

2 3 4

6ES7 350-1AH02-0AE0

1=
6ES7 350-1AH03-0AE0

2 3 4 2 3 4

1=

FM 350-1 Function Module A5E00073040-02

iii

Preface

Changes compared to the previous version


FM 350-1 features the following enhancements: Frequency measurement Rotation speed measurement Period measurement Isochrone mode in a modular slave (ET 200M) System modification during operation using CiR /3/ More latch edges Hysteresis for counting modes Firmware update

Certification
Underwriters Laboratories, Inc.: UL 508 registered (Industrial Control Equipment) Canadian Standards Association: CSA C22.2 number 142, (Process Control Equipment) Factory Mutual Research: Approval Standard Class Number 3611.

CE Labeling
SIMATIC S7-300 products fulfil the requirements and protection guidelines of the following EU directives: EC Directive 73/23/EEC Low-voltage directive EC Directive 89/336/EWG EMC directive

CTick Mark
SIMATIC products S7-300 are compliant with requirements of the AS/NZS 2064 (Australian) standard.

Standards
SIMATIC S7-300 products fulfil the requirements and criteria of IEC 61131-2.

Place of this Documentation in the Information Environment


This manual is acomponent of the documentation package 6ES7350-1AH00-8BG0.

iv

FM 350-1 Function Module A5E00073040-02

Preface

Recycling and Disposal


FM 350-1 is recycleable due to its non-toxic materials. Please contact a company certified in the disposal of electronic scrap for environmentally safe recycling and disposal of your old device.

Further Support
If you have any technical questions, please get in touch with your Siemens representative or agent responsible. http://www.siemens.com/automation/partner

Training Centers
Siemens offers a number of training courses to familiarize you with the SIMATIC S7 automation system. Please contact your regional training center or our central training center in D 90327 Nuremberg, Germany for details: Telephone: Internet: +49 (911) 895-3200. http://www.sitrain.com

FM 350-1 Function Module A5E00073040-02

Preface

A&D Technical Support


Worldwide, available 24 hours a day:

Nuernberg Johnson City Beijing

Technical Support Worldwide (Nuernberg) Technical Support


24 hours a day, 365 days a year Phone: Fax: E-Mail: GMT: +49 (0) 180 5050-222 +49 (0) 180 5050-223 adsupport@ siemens.com +1:00

Europe / Africa (Nuernberg) Authorization


Local time: Mon.-Fri. 7:00 to 17:00 Phone: Fax: E-Mail: GMT: +49 (0) 180 5050222 +49 (0) 180 5050-223 adautorisierung@ siemens.com +1:00

United States (Johnson City) Technical Support and Authorization


Local time: Mon.-Fri. 8:00 to 17:00 Phone: Fax: E-Mail: GMT: +1 (0) 423 262 2522 +1 (0) 423 262 2289 simatic.hotline@ sea.siemens.com 5:00

Asia / Australia (Beijing) Technical Support and Authorization


Local time: Mon.-Fri. 8:30 to 17:30 Phone: Fax: E-Mail: GMT: +86 10 64 75 75 75 +86 10 64 74 74 74 adsupport.asia@ siemens.com +8:00

The languages of the SIMATIC Hotlines and the authorization hotline are generally German and English.

vi

FM 350-1 Function Module A5E00073040-02

Preface

Service & Support on the Internet


In addition to our documentation, we offer our Know-how online on the internet at: http://www.siemens.com/automation/service&support where you will find the following: The newsletter, which constantly provides you with up-to-date information on your products. The right documents via our Search function in Service & Support. A forum, where users and experts from all over the world exchange their experiences. Your local representative for Automation & Drives via our representatives database. Information on field service, repairs, spare parts and more under Services.

FM 350-1 Function Module A5E00073040-02

vii

Preface

viii

FM 350-1 Function Module A5E00073040-02

Contents
1 Product Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1 1.2 1.3 1.4 2 What Can the FM 350-1 Do? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Application Areas of the FM 350-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . FM 350-1 Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . FM 350-1 Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1 1-2 1-5 1-7 1-10 2-1 2-2 2-3 3-1 3-2 3-7 3-10 4-1 4-2 5-1 5-3 5-10 5-11 5-12 5-15 5-16 5-16 5-24 5-31 5-35 5-36

Installing and Removing the FM 350-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1 2.2 Preparing the Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Installing and Removing the FM 350-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Wiring the FM 350-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1 3.2 3.3 Terminal Assignments of the Front Connector . . . . . . . . . . . . . . . . . . . . . . . . Wiring the Front Connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Module Status After Switching On . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Assigning Parameters to the FM 350-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1 Installing and Calling Parameter Assignment Screen Forms . . . . . . . . . . .

Programming the FM 350-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1 5.2 5.3 5.4 5.5 5.6 5.6.1 5.6.2 5.6.3 5.6.4 5.7 The CNT_CTL1 Function (FC 2) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The CNT_CTL2 Function (FC 3) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The DIAG_INF Function (FC 1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Application Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Technical Data for the Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Programming the FM 350-1 without FCs . . . . . . . . . . . . . . . . . . . . . . . . . . . . Control and Check-back Interface for the Count Modes . . . . . . . . . . . . . . . Control and Check-back Interface for the Measure Modes . . . . . . . . . . . . . Using the Interface with the Complete Acknowledgement Principle . . . . . Restart Coordination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Reaction to CPU STOP and CPU STOP-RUN . . . . . . . . . . . . . . . . . . . . . . .

FM 350-1 Function Module A5E00073040-02

ix

Contents

Programming in M7 with the Counter Function Library . . . . . . . . . . . . . . . . . . . . . 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Basic Program Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Initializing and Parameterizing the Counter Channel . . . . . . . . . . . . . . . . . . Transferring the Load Value and Comparison Values . . . . . . . . . . . . . . . . . Control of the Digital Inputs and Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . Starting and Stopping the Counter Channel . . . . . . . . . . . . . . . . . . . . . . . . . Reading the Counter Value and the Load Value, Scanning and Resetting the Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Processing Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Processing Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

6-1 6-2 6-4 6-5 6-8 6-9 6-10 6-12 6-13 6-14 7-1 7-2 7-4 8-1 8-2 8-3 8-4 8-4 8-5 8-8 8-10 8-15 8-20 8-21 8-27 8-38 8-44 8-46 8-48 8-49 8-49 8-50 8-55 8-57 8-59 8-62 8-66 8-69

Starting Up the FM 350-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.1 7.2 Mechanical Installation Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Parameter Assignment Checklist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Operating Modes, Parameters and Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.1 8.2 8.3 8.3.1 8.3.2 8.3.3 8.3.4 8.3.5 8.3.6 8.3.7 8.3.8 8.3.9 8.3.10 8.3.11 8.3.12 8.4 8.4.1 8.4.2 8.4.3 8.4.4 8.4.5 8.4.6 8.4.7 8.5 Basic Information on Calling Operating Modes, Settings and Commands Isochrone Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Count Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . What are the Count Modes? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Continuous Counting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Single Counting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Periodic Counting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Count Range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Command: Open and Close Gate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Behavior of the Digital Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Command: Set Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Command: Latch/Retrigger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Command: Latch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Command: Measure the Times Between two Edges . . . . . . . . . . . . . . . . . . Measure Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . What are the Measure Modes? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Frequency Measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . RPM Measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Continuous Periodic Measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Command: Open and Close Gate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Behavior of the Digital Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Initiating a Process Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

FM 350-1 Function Module A5E00073040-02

Contents

Encoder Signals and Their Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.1 9.2 9.3 9.4 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 V Differential Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 V Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Pulse Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

9-1 9-2 9-3 9-5 9-7 10-1 11-1 11-2 11-3 11-4 11-5 11-7 11-9

10 11

DB Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . M7 Reference Counter Function Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.1 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 11.10 11.11 11.12 11.13 11.14 11.15 11.16 11.17 11.18 11.19 11.20 11.21 11.22 11.23 M7CntDisableOut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . M7CntDisableSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . M7CntEnableOut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . M7CntEnableSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . M7CntInit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . M7CntLoadAndStart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

M7CntLoadComp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-11 M7CntLoadDirect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-13 M7CntLoadPrep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-15 M7CntPar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-17 M7CntRead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-19 M7CntReadDiag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-21 M7CntReadLoadValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-22 M7CntReadParError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-23 M7CntReadStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-24 M7CntResetStatus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-26 M7CntStart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-27 M7CntStop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-28 M7CntStopAndRead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-30 M7CNT_DIAGINFO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-31 M7CNT_PARAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-33 M7CNT_STATUS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-36 Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-37

FM 350-1 Function Module A5E00073040-02

xi

Contents

12

Faults and Diagnostics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.1 12.2 12.3 12.4 Fault Indication via the Group Error LED . . . . . . . . . . . . . . . . . . . . . . . . . . . . Initiation of Diagnostics Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Data Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Operator Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

12-1 12-2 12-3 12-7 12-9 A-1 B-1 C-1

A B C

Technical Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Spare Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Glossary-1

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Index-1

xii

FM 350-1 Function Module A5E00073040-02

Contents

Figures
1-1 1-2 1-3 2-1 3-1 3-2 3-3 3-4 5-1 5-2 5-3 5-4 5-5 8-1 8-2 8-3 8-4 8-5 8-6 8-7 8-8 8-9 8-10 8-11 8-12 8-13 8-14 8-15 8-16 8-17 8-18 8-19 8-20 8-21 8-22 8-23 8-24 8-25 8-26 8-27 8-28 8-29 8-30 8-31 8-32 8-33 8-34 Example for Using an FM 350-1 in the S7-300 . . . . . . . . . . . . . . . . . . . . . . . FM 350-1 Module View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . SIMATIC S7-300 configuration with an FM 350-1 . . . . . . . . . . . . . . . . . . . . . Installing the Coding Connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Front Connector of the FM 350-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Details Regarding the Connection of an Incremental 5V Encoder . . . . . . . Details Regarding the Connection of an Incremental 24V Encoder . . . . . . FM 350-1 with Shielded Cables and the Shield Support . . . . . . . . . . . . . . . Exchange of Data between the User Program and FM 350-1 with FCs . . Complete acknowledgement principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Transfer of values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Resetting the status bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Restart sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Continuous counting with gate control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Single counting without main counting direction; Cancel gate function . . . Single counting without main counting direction; Cancel gate function . . . Single counting with main counting direction down; Cancel gate function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Single Counting with Load Value and gate control . . . . . . . . . . . . . . . . . . . . Periodic counting without main counting direction . . . . . . . . . . . . . . . . . . . . Periodic counting with main counting direction up . . . . . . . . . . . . . . . . . . . . Periodic counting with main counting direction down . . . . . . . . . . . . . . . . . . Periodic Counting with Load Value and gate control . . . . . . . . . . . . . . . . . . Level-Controlled Opening and Closing of the Hardware Gate . . . . . . . . . . Edge-Controlled Opening and Closing of the Hardware Gate . . . . . . . . . . Opening and Closing of the Software Gate . . . . . . . . . . . . . . . . . . . . . . . . . . Continuous counting, down, Cancel gate function . . . . . . . . . . . . . . . . . . . . Continuous counting, down, Interrupt gate function . . . . . . . . . . . . . . . . . . . Starting and stopping the counting operation with the SW gate (SW_GATE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Starting and stopping the counting process with the HW gate (HW_GATE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . At the start of the counting process, V2 > V1 . . . . . . . . . . . . . . . . . . . . . . . . . At the start of the counting process, V1 > V2 . . . . . . . . . . . . . . . . . . . . . . . . . Reactions of an output for a pulse duration 0 ms . . . . . . . . . . . . . . . . . . . . . Example showing the effect of hysteresis . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example in response to a change of direction at the comparison value . . Example showing the effect of hysteresis . . . . . . . . . . . . . . . . . . . . . . . . . . . . Single Setting with DI Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Multiple Setting with DI Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Single Setting of the Counter with the Zero Mark . . . . . . . . . . . . . . . . . . . . . Multiple Setting of the Counter with the Zero Mark . . . . . . . . . . . . . . . . . . . . Latch/Retrigger when load value = 0 and a positive edge at Start DI . . . . Latch when load value = 0 and a positive edge at Start DI . . . . . . . . . . . . . Measuring principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Principle of continuous measurement (example of a frequency measurement) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Limit value monitoring in Measure modes . . . . . . . . . . . . . . . . . . . . . . . . . . . Frequency measurement with gate function . . . . . . . . . . . . . . . . . . . . . . . . . RPM measurement with gate function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Periodic measurement of the gate function . . . . . . . . . . . . . . . . . . . . . . . . . . 1-6 1-7 1-10 2-4 3-2 3-7 3-8 3-9 5-2 5-31 5-32 5-34 5-35 8-8 8-10 8-11 8-12 8-13 8-15 8-16 8-17 8-18 8-21 8-22 8-23 8-24 8-24 8-25 8-25 8-31 8-32 8-33 8-36 8-36 8-37 8-40 8-41 8-42 8-43 8-45 8-47 8-50 8-52 8-53 8-55 8-57 8-59

FM 350-1 Function Module A5E00073040-02

xiii

Contents

8-35 8-36 8-37 8-38 8-39 9-1 9-2 9-3 9-4 9-5

Level-controlled opening and closing of the HW gate . . . . . . . . . . . . . . . . . Edge-controlled opening and closing of the HW gate . . . . . . . . . . . . . . . . . Level-controlled opening and closing of the SW gate . . . . . . . . . . . . . . . . . Starting and stopping the counting process with the SW gate (SW_GATE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Starting and stopping the counting process with the HW gate (HW_GATE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Signals of the Incremental 5 V encoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Signals of a 24 V Pulse Encoder with Direction Level . . . . . . . . . . . . . . . . . Single Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Double Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Quadruple Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

8-62 8-63 8-64 8-65 8-65 9-3 9-5 9-7 9-8 9-8

xiv

FM 350-1 Function Module A5E00073040-02

Contents

Tables
1-1 3-1 3-2 3-3 5-1 5-2 5-3 5-4 5-5 5-6 5-7 5-8 5-9 5-10 5-11 5-12 5-13 8-1 8-2 8-3 8-4 8-5 8-6 8-7 8-8 8-9 8-10 8-11 8-12 8-13 8-14 8-15 8-16 8-17 9-1 9-2 9-3 10-1 11-1 11-2 11-3 11-4 12-1 12-2 12-3 12-4 B-1 Input Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Front Connector Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Input Filters for 24 V Encoder Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Input Filters for Digital Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Parameters for transferring values in the DB (Count modes) . . . . . . . . . . Parameters for transferring values in the DB (Measure modes) . . . . . . . . DIAG_INF function parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Symbols in Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Control interface for Count modes (outputs) . . . . . . . . . . . . . . . . . . . . . . . . . Explanation of the control bits for the Count modes . . . . . . . . . . . . . . . . . . Check-back interface for Count modes (inputs) . . . . . . . . . . . . . . . . . . . . . . Explanation of the check-back bits for the Count modes . . . . . . . . . . . . . . Control interface for Measure modes (outputs) . . . . . . . . . . . . . . . . . . . . . . Explanation of the control bits for the Measure modes . . . . . . . . . . . . . . . . Check-back interface for Measure modes (inputs) . . . . . . . . . . . . . . . . . . . Explanation of the check-back bits for the Measure modes . . . . . . . . . . . . Data record DS 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The FM 350-1 Count modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Starting count . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The FM 350-1 commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Output DO0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Output DO1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Marginal conditions for the behavior of the digital outputs . . . . . . . . . . . . . Effect of the hysteresis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The FM 350-1 Measure modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Starting count . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The FM 350-1 commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Calculating the update time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Calculating the update time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Calculating the update time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Behavior of digital output DO0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Output DO0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Output DO1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Assignment of the bits of the variable OB40_POINT_ADDR . . . . . . . . . . . Encoders for the FM 350-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Count Direction in Dependence on the Input Parameterization . . . . . . . . . Input Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . DB Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Detailed Specifications of the Parameterization Data . . . . . . . . . . . . . . . . . Operator Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Counter Function Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Parameterization Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Assignments of Diagnostics Data Set DS0 . . . . . . . . . . . . . . . . . . . . . . . . . . Assignments of the Bits of Bytes 4 to 11 of Diagnostics Data Set . . . . . . . Data Error Numbers and their Meanings . . . . . . . . . . . . . . . . . . . . . . . . . . . . Numbers of the Operator Errors and their Meaning . . . . . . . . . . . . . . . . . . . Accessories and Spare Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3 3-3 3-5 3-6 5-8 5-9 5-11 5-13 5-17 5-19 5-20 5-22 5-24 5-26 5-27 5-29 5-34 8-4 8-6 8-7 8-30 8-30 8-34 8-35 8-49 8-53 8-54 8-55 8-57 8-59 8-67 8-68 8-68 8-70 9-2 9-6 9-6 10-1 11-34 11-37 11-38 11-39 12-4 12-5 12-7 12-9 B-1

FM 350-1 Function Module A5E00073040-02

xv

Contents

xvi

FM 350-1 Function Module A5E00073040-02

Product Overview

Chapter Overview This chapter gives you an overview of the FM 350-1 function module. You will learn what the FM 350-1 can do. You will become familiar with the application areas of the FM 350-1 through examples. You will learn how the FM 350-1 is linked into the S7-300/M7-300 programmable controller and you will become familiar with the most important components of the FM 350-1.
Section 1.1 1.2 1.3 1.4 Description What Can the FM 350-1 Do? Application Areas of the FM 350-1 FM 350-1 Hardware FM 350-1 Software Page 1-2 1-5 1-7 1-10

FM 350-1 Function Module A5E00073040-02

1-1

Product Overview

1.1

What Can the FM 350-1 Do?

What Can the FM 350-1 Do? The FM 350-1 function module is a high-speed counter module for use in the S7-300/M7-300 programmable controller. There is one counter on the module that can operate in the following ranges: 0 to 4,294,967,295 (0 to 232 1) or 2,147,483,648 to + 2,147,483,647 (231 to 231 1).

The maximum input frequency of the counter signals is up to 500 kHz depending on the encoder signal. You can use the FM 350-1 for the following tasks: Continuous counting Single counting Periodic counting Frequency measurement Rotational speed measurement Period measurement You can start and stop each mode either via the user program (software gate) or via external signals (hardware gate).

Comparison Values You can store two comparison values on the module assigned to the two relevant outputs on the module. If the counter status reaches one of the two comparison values, the relevant output can be set to initiate control actions direct in the process.

Load Value
You can specify a value on the FM 350-1 from which it should begin counting. This value is called the load value. Any value within the count limits can be set for the load value.

Process Interrupts The FM 350-1 can trigger a process interrupt in the CPU if the comparison values are reached, or in the case of overflow, underflow and/or in the case of zero pass of a counter.

1-2

FM 350-1 Function Module A5E00073040-02

Product Overview

Diagnostics Interrupts The FM 350-1 can trigger a diagnostics interrupt if any of the following occur: Fault in external auxiliary voltage Fault in 5.2 VDC encoder supply Module not parameterized or errors in parameterization Watchdog triggered RAM defective Process interrupt lost Fault in signal A, B or N Pulse Duration You can specify a pulse duration for the digital outputs of the FM 350-1. The pulse duration specifies how long the relevant digital output is to be set. You can specify a value between 0 and 500 ms for the pulse duration. This value applies for both outputs. You can adapt the FM 350-1 to existing actuators by specifying a pulse duration. Which Signals can the FM 350-1 Register? The FM 350-1 can register the signals from the following sources: Incremental 5 V encoders Incremental 24 V encoders 24 V pulse encoders with direction level 24 V initiators without direction level for example, light barrier or BERO Internal 1 MHz time base Input Filter For the purpose of suppressing interference, you can parameterize input filters (RC elements) with a uniform filter time for the 24 V inputs A*, B* and N* and for the digital inputs. The following two input filters are available:
Table 1-1 Input Filters Features Typical input delay Maximum counting frequency Minimum pulse width of the count signals Input Filter 1 (Default) 1 ms 200 kHz 2.5 ms Input Filter 2 15 ms 20 kHz 25 ms

Central Operation
You can apply the FM 350-1 in S7-300 and M7-300 systems centrally.

FM 350-1 Function Module A5E00073040-02

1-3

Product Overview

Distributed Operation
You can use the FM 350-1 via IM 153-1, IM 153-2 and IM 153-3 distributed in ET 200M. Examples of application are: ET 200M with single backplane bus ET 200M with active backplane bus ET 200M as moduled clocked mode slave ET 200M in one-sided mode in an H system ET 200M in interconnected mode in an H system

Firmware Update
For upgrades and bugfixes it is possible with the help of STEP 7 HW Config (as of V 5.2) to download firmware updates to the operating system memory of FM 350-1. Notice Starting the firmware updates deletes the old FM 350-1 firmware. If the firmware update is interupted or terminated by any means, the FM 350-1 will no longer be available. Please start the firmware update again and wait until it is successfully completed.

CiR
The FM 350-1 is CiR-compatible, i. e. via configuration modification at RUN of the CPU you can change the FM 350-1parameters. Parameter changes resets the FM 350-1 and is essentially a reconfiguration. FM 350-1 allows parameter changes during operation of the user program (see chapter 4).

Isochrone Mode
Depending on your STEP 7 V 5.2 configuration, you can work with the FM 350-1 either in non-isochrone or isochrone mode.

1-4

FM 350-1 Function Module A5E00073040-02

Product Overview

1.2

Application Areas of the FM 350-1

Where Can You Use the FM 350-1? The main application area of the FM 350-1 is where signals with high frequencies are counted and high-speed responses have to be triggered to predefined counter statuses. Examples include: Packaging plants Sorting plants Dosing or proportioning plants.

FM 350-1 Function Module A5E00073040-02

1-5

Product Overview

Example for the Use of an FM 350-1 In this example, a carton must be filled with a specific number of parts. One counter of the FM 350-1 counts the parts and controls the motor for transporting the parts and the motor for transporting the carton. If the carton is in the correct position, conveyor belt A is stopped via the light barrier, the count is started and the motor for conveyor belt B is switched on. When the carton contains the programmed number of parts, the FM 350-1 stops the motor for conveyor belt B and switches on the motor for conveyor belt A for removal of the carton. The count can start again when the next carton reaches the light barrier.

FM 350-1

Belt A Motor Lightbarrier Motor

Gate Belt B

Figure 1-1

Example for Using an FM 350-1 in the S7-300

1-6

FM 350-1 Function Module A5E00073040-02

Product Overview

1.3

FM 350-1 Hardware

View of Module Figure 1-2 shows the FM 350-1 module with a front connector and the expansion bus with the front panel closed.

Type plate Front connector with front connector coding Diagnostics and status LEDs

Coding connector

Expansion bus SIMATIC interface Labeling strips

Order number Figure 1-2 FM 350-1 Module View

Version

Front Connector The FM 350-1 offers the following connection possibilities via the front connector: 5 V or 24 V encoder signals Encoder supply Digital input signals for starting, stopping and setting the counter Digital output signals Q0 and Q1 Auxiliary voltage 1L+ for generating the encoder supply voltages Load voltage 2L+ for supplying the digital outputs The front connector must be ordered separately (see Appendix B).

FM 350-1 Function Module A5E00073040-02

1-7

Product Overview

Front Connector Coding When you press the front connector from the wiring position to the operating position, the front connector coding engages. Thereafter, this front connector can only be attached to an FM 350-1 module.

Coding Connector The coding connector is used to set the FM 350-1 to the encoder signals used. The following settings are possible:
Coding Connector at Setting... A D ...Corresponds to the Following Encoder Signals 5 V differential signals (state as supplied) 24 V signals

The coding connector is located on the left side of the FM 350-1.

Labeling Strips Enclosed with the module is a labeling strip on which you can write your relevant signal names. The pin assignments are printed on the inside of the front panel.

Order Number and Version The order number and the version of the FM 350-1 are given at the bottom of the front panel.

Firmware Version
The firmware version indicates the version at the time of delivery. It can be updated with a firmware update.

Expansion Bus Communications within one tier of the S7-300/M7-300 takes place over the expansion bus. The expansion bus is supplied with the FM 350-1.

1-8

FM 350-1 Function Module A5E00073040-02

Product Overview

Status and Diagnostics LEDs The FM 350-1 has eight LEDs that can be used both for diagnostics and for indicating the status of the FM 350-1 and its digital inputs and outputs. The following table lists the LEDs with their labeling, color and function.

Label SF CR DIR I0 I1 I2 Q0 Q1

Color Red Green Green Green Green Green Green Green Group error

Function

Counter running; status of the least significant bit of the counter Direction of count; LED lights up, if the counter is counting down Status of DI Start Status of DI Stop Status of DI Set Status of output DO0 Status of output DO1

FM 350-1 Function Module A5E00073040-02

1-9

Product Overview

1.4

FM 350-1 Software

Configuration Package To integrate the FM 350-1 into the S7-300, use the configuration package on the supplied CD . This contains: Parameter assignment software with parameter dialogs Software for the CPU (blocks) Documentation The software for integrating the FM 350-1 into the M7-300 is described in Chapters 6 and 11. Figure 1-3 shows an S7-300 configuration with an FM 350-1 and several signal modules.

PC/PG with STEP 7 Configuration package with parameter dialogs, blocks and manual

CPU with user program and FCs of the FM 350-1

FM 350-1

Figure 1-3 SIMATIC S7-300 configuration with an FM 350-1

Parameter Assignment Screen Forms The FM 350-1 is adapted to the task in hand via parameters. These parameter are stored in an SDB and transferred to the module from the CPU. You can specify the parameters via parameter assignment screen forms. These parameter assignment screen forms are installed on your programming device and called up within STEP 7.
FM 350-1 Function Module A5E00073040-02

1-10

Product Overview

Software for the S7-300 CPU The software for the CPU consists of the FC CNT_CTL1 function called in the user program of the CPU. This FC enables communication between the CPU and the FM 350-1. There is also the FC DIAG_INF function for the FM 350-1, with which you can transfer diagnostics information into the DB of the FC CNT_CTL1.

FM 350-1 Function Module A5E00073040-02

1-11

Product Overview

1-12

FM 350-1 Function Module A5E00073040-02

Installing and Removing the FM 350-1

Installing and Removing the FM 350-1

This Chapter... This chapter contains information on installing and removing the FM 350-1. You will learn what you must look out for when installing. You will get notes and hints on configuring, arranging and installing an FM 350-1. You will learn, step-by-step, how to install and remove an FM 350-1.

Chapter Overview
Section 2.1 2.2 Preparing the Installation Installing and Removing the FM 350-1 Description Page 2-2 2-3

FM 350-1 Function Module A5E00073040-02

2-1

Installing and Removing the FM 350-1

2.1

Preparing the Installation

Important Safety Rules There are important rules you must observe for integrating an S7-300 with an FM 350-1 into a plant or a system. These rules and regulations are explained in manual /1/.

Vertical or Horizontal Arrangement Horizontal arrangement is preferable. For vertical arrangement, you must observe the restricted ambient temperatures (max. 40 C).

Defining the Slots The 350-1 function module can be installed like a signal module in any of slots 4 to 11.

Mechanical Configuration Manual /1/ describes the possibilities open to you for mechanical installation and how to proceed when configuring. The following gives only a few supplementary notes. 1. A maximum of eight SMs or FMs are permissible per rack. 2. The maximum number is restricted by the width of the modules or the length of your mounting rail. The FM 350-1 requires an installation width of 40 mm. 3. The maximum number is restricted by the total current consumptions of all modules to the right of the CPU from the 5 V backplane bus supply. The current consumption of the FM 350-1 is 160 mA. 4. The maximum number is restricted by the memory required by the CPU software for communications with the FM 350-1.

2-2

FM 350-1 Function Module A5E00073040-02

Installing and Removing the FM 350-1

2.2

Installing and Removing the FM 350-1

Rules No special protection measures (ESD guidelines) are required for installing an FM 350-1.

Tools Required You require a 4.5 mm flat-bladed screwdriver for installing and removing the FM 350-1.

Setting the Signal Type (Coding Key)


Before mounting an FM 350-1 on the mounting rail, you must place the coding key in the correct position. The following table assigns the position of the coding key to the signal type used. (refer also to /1/)
Position of the Coding Connector A D Signal Type 5 V differential signals 24 V signals

FM 350-1 Function Module A5E00073040-02

2-3

Installing and Removing the FM 350-1

The letter of the coding connector must point to the arrow.

Figure 2-1

Installing the Coding Connector

2-4

FM 350-1 Function Module A5E00073040-02

Installing and Removing the FM 350-1

Installation Procedure How to mount the FM 350-1 on the mounting rail: 1. Switch the CPU to the STOP state. 2. The FM 350-1 is supplied with an expansion bus. Plug this into the bus connector of the module to the left of the FM 350-1. (The bus connector is located on the back and you may have to loosen the neighboring module.) 3. Hang the FM 350-1 onto the rail and swing it down. 4. Tighten the screw on the FM 350-1 (tightening torque approximately 0.8 to 1.1 Nm). If further modules are to be installed to the right of the FM 350-1, first connect the expansion bus of the next module to the right-hand backplane bus connector of the FM 350-1. If the FM 350-1 is the last module in the rack, do not connect an expansion bus! 5. Label the FM 350-1 with its slot number. Use the number wheel supplied with the CPU for this purpose. Manual /1/ describes the numbering scheme you must use and how to connect the slot numbers. 6. Install the shield attachment.

Procedure for Removal/Replacement of Modules


How to remove the FM 350-1: 1. Switch off the auxiliary voltage and the load voltage at the front connector. 2. Switch the CPU to the STOP state. 3. Open the front panel. If necessary, remove the labeling strip. 4. Release the front connector and pull it out. 5. Loosen the fixing screw on the module. 6. Swing the module out of the mounting rail and unhook it. 7. Install the new module if applicable.

Further Notes Manual /1/ contains further notes on installing and removing modules.

FM 350-1 Function Module A5E00073040-02

2-5

Installing and Removing the FM 350-1

2-6

FM 350-1 Function Module A5E00073040-02

Wiring the FM 350-1

Wiring the FM 350-1

Chapter Overview This chapter contains the following information on wiring the FM 350-1: Terminal assignments of the front connector. The function of the connections. Notes on selecting cables. The steps you must execute when wiring the front connector. The status of the module after wiring and switching on the power supply.
Section 3.1 3.2 3.3 Description Terminal Assignments of the Front Connector Wiring the Front Connector Module Status After Switching On Page 3-2 3-7 3-10

FM 350-1 Function Module A5E00073040-02

3-1

Wiring the FM 350-1

3.1

Terminal Assignments of the Front Connector

Front Connector You connect the count signals, the digital inputs and outputs, the encoder supply and the auxiliary voltage and load voltage via the 20-pin front connector. Figure 3-1 shows the front of the module, the front connector and the inside of the front panel with the pin assignments.

Front of the module


FM 350-1
COUNTER MODULE

Front connector

Inside of the front panel

SF CR DIR

1 2 3 4 5 6 7 8 9 1 0

1 2 3 4 5 6 7 8 9 10 1L+ 1M 1M DC 5,2 V SUPPLY DC 24 V A A* A B B* B N N*

1 1 I0 I1 I2 1 1 1 1 Q0 Q1 1 1 1 2 350-1AH03-0AE0

1 2 3 4 5 6 7 8 9 0

11

13 14 15

17 18 19 20 2 L+ 2M

Figure 3-1

Front Connector of the FM 350-1

3-2

FM 350-1 Function Module A5E00073040-02

Wiring the FM 350-1

Front Connector Assignments


Table 3-1 Conection Front Connector Assignments Name Input/ Output Auxiliary voltage 1 2 1L+ 1M INP INP 5 V encoder RS 422, symmetric 3 4 5 6 7 8 9 10 11 12 1M 5.2VDC 24VDC A A* A B B* B N N* N OUTP OUTP OUTP INP INP INP INP INP INP Digital inputs and digital outputs 13 14 15 16 17 18 I0 I1 I2 Q0 Q1 INP INP INP OUTP OUTP Load voltage 19 20 2L+ 2M INP INP 24 V load voltage Load voltage ground for the digital inputs and outputs Digital input DI Start Digital input DI Stop Digital input DI Set Digital output DO0 Digital output DO1 Encoder signal A Encoder signal A Encoder signal B Encoder signal B Encoder signal N Encoder signal N Encoder signal N* Encoder signal B* 24 V auxiliary voltage Auxiliary voltage ground 24 V encoder, asymmetric 24 V pulse generator with direction level 24 V initiator Function

Encoder supply ground 5.2 V encoder supply 24 V encoder supply Encoder signal A* Direction signal

FM 350-1 Function Module A5E00073040-02

3-3

Wiring the FM 350-1

Note The circuits for the counter inputs (encoder supply, encoder signals) are non-isolated to the ground of the CPU, that is, terminal 2 (1M) must have a low-resistance connection to CPU ground. If you supply the encoders externally, you must also connect the ground of this external voltage with the ground of the CPU.

Auxiliary Voltage 1L+, 1M Connect a direct voltage of 24 V to the 1L+ and 1M terminals for the voltage supply of the 5 V and 24 V encoders. An integral diode protects the module from reverse polarity of the auxiliary voltage. The module monitors the connection of the auxiliary voltage.

5.2 VDC Encoder Supply The module generates a voltage of 5.2 V from the auxiliary voltage 1L+/1M at a maximum current of 300 mA that is available at the 5.2 VDC connection for the short-circuit-proof supply of a 5 V encoder. The encoder supply is checked for short-circuit.

24 VDC Encoder Supply For the 24 V voltage supply of an encoder, the voltage 1L+/1M is made available and short-circuit proof at the 24 VDC output. The encoder supply is monitored for short-circuit.

5 V Encoder Signals A/A, B/B, N and N You can connect incremental encoders with 5 V differential signals to the front connector in accordance with RS 422, that is, incremental encoders with the differential signals, A/A, B/B, N and N. The signals A/A, B/B, N and N are connected via the terminals so labeled. The signals N and N are only connected if you want to set the counter to the zero mark of the encoder. The inputs are not electrically isolated from the bus of the S7-300 (refer to the note on this page).

3-4

FM 350-1 Function Module A5E00073040-02

Wiring the FM 350-1

24 V Encoder Signals A*, B* and N* 24 V signals are represented by the letters A*, B* and N*. You can connect three different encoder types to each counter: Incremental encoders with 24 V signals: The signals A*, B* and N* are connected via the terminals so labeled. Pulse encoders without direction level: The signal is connected to terminal A*. Pulse encoders with direction level: The count signal is connected to terminal A*. The direction level is connected to terminal B*. The inputs are not galvanically isolated from the S7-300 bus (see note on page 3-3).

Input Filter for 24 V Encoder Signals For the purpose of suppressing interference, you can parameterize input filters (RC elements) with a uniform filter time for the 24 V inputs A*, B* and N. The following input filters are available:
Table 3-2 Input Filters for 24 V Encoder Signals Features Typical input delay Maximum counting frequency Minimum pulse width of the count signals Input Filter 1 (Default) 1 ms 200 kHz 2.5 ms Input Filter 2 15 ms 20 kHz 25 ms

Digital Inputs DI Start, DI Stop and DI Set


You can use digital inputs DI Start and DI Stop for the gate control of the counter. Gate control can be both level-controlled and edge-controlled (refer to Chapter 8). Digital input DI Set is used to set the counter to the load value. The digital inputs are operated with a nominal voltage of 24 V. The digital inputs are galvanically isolated from the bus of the S7-300 and the counter inputs.

FM 350-1 Function Module A5E00073040-02

3-5

Wiring the FM 350-1

Input Filter for Digital Inputs For the purpose of suppressing interference, you can parameterize input filters (RC elements) with a uniform filter time for digital inputs I0, I1 and I2. The following two input filters are available.
Table 3-3 Input Filters for Digital Inputs Features Typical input delay Maximum frequency of the input signals Minimum pulse width of the input signals Input Filter 1 (Default) 1 ms 200 kHz 2.5 ms Input Filter 2 15 ms 20 kHz 25 ms

Digital Outputs DO0 and DO1


The FM 350-1 features two digital outputs, DO0 and DO1, for directly triggering control processes. The digital outputs are supplied with the 2L+ load voltage. The digital outputs are galvanically isolated from the S7-300 bus and the counter inputs. The digital outputs are source outputs and can be loaded with a load current of 0.5 A. They are protected from overload and short-circuit. Note Relays and contactors can be connected direct without external circuitry.

The time characteristics of the digital outputs depend on the parameterization and are explained in more detail in Chapter 8.

Load Voltage 2L+/ 2M For supplying digital outputs DO0 and DO1, a load voltage of 24 V must be supplied to the module via terminals 2L+ and 2M. An integral diode protects the module from polarity reversal of the load voltage. The load voltage 2L+/2M is not monitored by the FM 350-1.

3-6

FM 350-1 Function Module A5E00073040-02

Wiring the FM 350-1

3.2

Wiring the Front Connector

Cables There are some rules for you to observe when selecting cables: The cables for digital inputs DI Start, DI Stop and DI Set must be shielded. The cable for the counter signals must be shielded. You must apply the shields of the counter signal cables both at the pulse encoder and in the immediate vicinity of the module via the shield attachment, for example. The cables A/A, B/B and N/N of the incremental 5 V encoder must be twisted in pairs.
Shield on shield support Front connector 6 7 8 9 10 11 4 3 A A B B N N 5.2VDC 1M Shield on housing

Twisted cables Figure 3-2 Details Regarding the Connection of an Incremental 5V Encoder

Terminal 2 (1M) of the front connector must have a low-resistance connection to the ground of the CPU. If you supply the encoder with an external voltage, you must also connect the ground of this external voltage with the ground of the CPU.

FM 350-1 Function Module A5E00073040-02

3-7

Wiring the FM 350-1

Shield on shield support Front connector

Shield on housing

6 8 10 5 3

A* B* N* 24VDC 1M

Figure 3-3

Details Regarding the Connection of an Incremental 24V Encoder

Use flexible cables with cross-sections of 0.25 to 1.5 mm. Note If the encoders are supplied via the module, the cable cross-section must be large enough to carry the required voltage to the encoder despite voltage drops over the cable. This applies especially in the case of incremental 5 V encoders. A wire end ferrule is not required. If you use wire end ferrules then use only those without insulation collar in accordance with DIN 46228 Form A, short version!

3-8

FM 350-1 Function Module A5E00073040-02

Wiring the FM 350-1

Wiring Steps Proceed as follows when wiring the front connector: Warning There is a danger of personal injury. If you wire the front connector of the FM 350-1 when the power is switched on, you are in danger of injury from electric shock. Wire the FM 350-1 only when the power is switched off!

1. Open the front panel and place the front connector in the wiring position. 2. Strip the conductors (length 6 mm). 3. Are you using wire end ferrules? If so: Press-fit the wire end ferrules onto the conductors. 4. Feed the enclosed strain relief clamp into the front connector. 5. If the wires leave the module at the bottom, begin wiring at the bottom, otherwise begin at the top. Also tighten unassigned terminals (tightening torque 0.6 to 0.8 Nm). 6. Tighten the strain relief clamp for the cable chain. 7. Push the front connector into the operating position. 8. Apply the cable shields to the shield attachment or to the shield bar. 9. Label the terminals on the labeling strip.

Figure 3-4

FM 350-1 with Shielded Cables and the Shield Support

FM 350-1 Function Module A5E00073040-02

3-9

Wiring the FM 350-1

3.3

Module Status After Switching On

Default Setting
The state in which the module is after the power supply is turned on when parameters are still not being transmitted: No gate in other words, gate open Counter inputs with default setting for 5 V differential signals, track B not inverted; single evaluation (see 9-4); Count limit 32 bits Counter status zero Counter setting with input DI Set (and zero mark) inhibited Input delay for digital inputs I0, I1 and I2: typically 1 ms (max. frequency: 200 kHz, minimum pulse width: 2.5 ms) Input delay for 24 V counter inputs: typically 1 s (max. frequency: 200 kHz, minimum pulse width: 2.5 ms) Outputs DO0 and DO1 disabled Pulse duration = 0 No process interrupts set Operating mode Continuous count set Status signals are updated

3-10

FM 350-1 Function Module A5E00073040-02

Assigning Parameters to the FM 350-1

Assigning Parameters to the FM 350-1

Chapter Overview In this chapter, you will learn how to install and start parameter assignment screen forms. The parameter assignment screen forms have an integral help function that supports you in parameterizing and starting up the FM 350-1.

Section 4.1

Description Installing and Calling Parameter Assignment Screen Forms

Page 4-2

FM 350-1 Function Module A5E00073040-02

4-1

Assigning Parameters to the FM 350-1

4.1

Installing and Calling Parameter Assignment Screen Forms

Marginal Conditions The following conditions apply for transferring parameter assignment data to the CPU: STEP 7 (version 5.0) is correctly installed on your PG. The following instructions refer specifically to STEP 7 (version 5.2) The programming device must be correctly connected to the CPU The CPU must be in STOP Note You must not plug in or remove any S7-300 modules during data exchange over the MPI!

Installing the Parameter Assignment Screens


The whole configuration package is located on the enclosed CD. To install the configuration package, perform the following steps: 1. Uninstall your present configuration package, if any. 2. Insert the CD into the CD drive on your PG or PC. 3. In Windows 95/Windows NT/Windows 98, open the dialog box for installing software by double-clicking on the Software icon on the Control Panel. 4. In the dialog box, select the CD drive and, in the directory called FMx50-1\Disk1, select the Setup.exe file and start the installation operation. 5. Follow the successive instructions displayed by the installation program. Result: The components of the configuration package are installed in the following directories: SIEMENS\STEP7\S7LIBS\FMx50LIB: FCs, UDTs SIEMENS\STEP7\S7FCOUNT: configuration software, Readme, online Help SIEMENS\STEP7\EXAMPLES: Examples SIEMENS\STEP7\S7MANUAL\S7FCOUNT: Getting Started, manuals

Note If you selected a directory other than SIEMENS\STEP7 when you installed STEP 7, that directory will be entered.

4-2

FM 350-1 Function Module A5E00073040-02

Assigning Parameters to the FM 350-1

Calling the Parameter Assignment Screens


To call the parameter assignment screens of the FM 350-1, perform the following steps: 1. Place the order number on a vacant slot. 2. Double-click on the order number. 3. Acknowledge with OK any dialog box which may appear and prompt you to save the configuration.

FM 350-1 Function Module A5E00073040-02

4-3

Assigning Parameters to the FM 350-1

4-4

FM 350-1 Function Module A5E00073040-02

Programming the FM 350-1

Chapter Overview This chapter contains all the information necessary for programming the FM 350-1 in the S7-300. For linking the FM 350-1 into a user program, you are provided with STEP 7 blocks that make handling the desired functions easy for you. This chapter describes these blocks.
Block Number FC 2 FC 3 FC 1 Block Name CNT_CTL1 CNT_CTL2 DIAG_INF Meaning Controlling of the FM 350-1 Controlling of the FM 350-1 (only in isochrone mode) Read diagnostics data set 1 from the FM 350-1

Use of the blocks is illustrated in an example program. The example program shows block calls and contains the necessary data block. You can also operate the FM 350-1 without FCs, in which case you control and monitor the FM 350-1 via the control and check-back interface.
Section 5.1 5.2 5.3 5.4 5.5 5.6 5.6.1 5.6.2 5.6.3 5.6.4 5.7 Description The CNT_CTL1 Function (FC 2) The CNT_CTL2 Function (FC 3) The DIAG_INF Function (FC 1) Application Example Technical Data for the Blocks Programming the FM 350-1 without FCs Control and Check-back Interface for the Count Modes Control and Check-back Interface for the Measure Modes Using the Interface with the Complete Acknowledgement Principle Restart Coordination Reaction to CPU STOP and CPU STOP-RUN Page 5-3 5-10 5-11 5-12 5-15 5-16 5-16 5-24 5-31 5-35 5-36

FM 350-1 Function Module A5E00073040-02

5-1

Programming the FM 350-1

Exchange of Data between the User Program and FM 350-1 with FCs
The figure below illustrates the exchange of data

User program in the CPU


Program
FC2 DBx

Data

FM 350-1

Instructions

Control Interface

Feedback Interface

. . . .

Figure 5-1

Exchange of Data between the User Program and FM 350-1 with FCs

Accessing the Control and Check-back Interface with STEP 7 Programming


You can access the FM 350-1 control and feedback interface from the user program either using standard FCs or with load and transfer commands. Mixed operation is not permitted.
Standard FC Control interface Feedback interface Write with or Read with or CNT_CTL1 CNT_CTL2 CNT_CTL1 CNT_CTL2 Load and transfer commands Transfer command, e.g. T PAD Load command, e.g. L PED

5-2

FM 350-1 Function Module A5E00073040-02

Programming the FM 350-1

5.1

The CNT_CTL1 Function (FC 2)

Requirement
The data required for the CNT_CTL1 function is stored in a DB on the CPU. The CNT_CTL1 function transfers data cyclically from this DB to the FM and fetches data from the FM. You create the DB under STEP 7 as a data block with assigned user-specific data type. Select UDT 2 as the source file. UDT 2 was copied to the block library called FMx50LIB when the FCs were installed. You must not modify UDT 2. Copy UDT 2 together with the FCs into your project. Before programming the FM 350-1, the following valid data must be assigned to the DB of the CNT_CTL1 function: Module address You set the module address (base address of the FM 350-1) when configuring your hardware. You can enter the address automatically in the DB by selecting the module in HW Config, and then selecting a data block from the Properties dialog by clicking on the Mod Addr button. Channel address The channel address is the same as the module address in pointer format. User data length The user data length is 16. You can save these data by means of a parameter assignment screen (refer to the leaflet Getting Started with Commissioning) or by means of the user program in the DB.

FM 350-1 Function Module A5E00073040-02

5-3

Programming the FM 350-1

Example
You will find below an example of how to implement the transfer of the module address, the channel address and the user data length in OB100. The symbol table contains the following assignments for this example:
CNT_CHAN1 DB 1 DB with the counter data

Program the transfer as follows in STL:


STL Explanation

L T L T L T

512 CNT_CHAN1.MOD_ADR P# 512.0 CNT_CHAN1.CH_ADR 16 CNT_CHAN1.U_D_LGTH

// Module address = 512 // Transfer of module address // Module address in pointer format // Transfer of the channel address // User data length = 16 // Transfer of the user data length

Call
The CNT_CTL1 function can be called either cyclically or in a time-controlled or isochrone interrupt OB. You cannot call the CNT_CTL1 function in an event-controlled interrupt program. The CNT_CTL1 function call in the STL and LAD notations is given below.


STL notation
CALL

LAD notation

CNT_CTL1 DB_NO

:= :=

, ,

CNT_CTL1

SW_GATE

EN

ENO

GATE_STP OT_ERR_A SET_DO0 SET_DO1 OT_ERR

:= :=

, ,

DB_NO

OT_ERR

SW_GATE

:= := :=

, , ,

GATE_STP OT_ERR_A SET_DO0 SET_DO1

L_DIRECT L_PREPAR T_CMP_V1 T_CMP_V2 C_DOPARA RES_SYNC RES_ZERO

:= := := := := := :=

, , , , , , )

L_DIRECT L_PREPAR T_CMP_V1 T_CMP_V2 C_DOPARA RES_SYNC RES_ZERO

5-4

FM 350-1 Function Module A5E00073040-02

Programming the FM 350-1

CNT_CTL1 Function Parameters


Name DB_NO SW_GATE GATE_STP OT_ERR_A SET_DO0 SET_DO1 OT_ERR L_DIRECT 2) Declaration Type INPUT INPUT INPUT INPUT INPUT INPUT OUTPUT IN-OUT Data Type INT BOOL BOOL BOOL BOOL BOOL BOOL BOOL Meaning Number of the data block with the counter data Counter control bit SW gate (start/stop) Counter control bit Gate stop Acknowledge operator error Set/Reset DO0 Set/Reset DO1 Operator error occurred Count: Initiation bit for direct and preparatory loading of a counter Measure: Must NOT be set L_PREPAR 2) IN-OUT BOOL Count: Initiation bit for preparatory loading of a counter Measure: Transmission of the lower limit T_CMP_V1 2) IN-OUT BOOL Count: Initiation bit for transferring the comparison value 1 Measure: Transmission of the upper limit T_CMP_V2 2) IN-OUT BOOL Count: Initiation bit for transferring the comparison value 2 Measure: Update time C_DOPARA RES_SYNC RES_ZERO
1)

The User... enters this sets and resets this sets and resets this sets and resets this sets and resets this sets and resets this scans this sets this

The Block... scans this scans this scans this scans this scans this scans this sets and resets this scans and resets this

sets this

scans and resets this

sets this

scans and resets this

sets this

scans and resets this

IN-OUT IN-OUT IN-OUT

BOOL BOOL BOOL

Initiation bit for parameter change Delete Synchronization status bit Delete Zero pass status bit

sets this sets this sets this

scans and resets this scans and resets this scans and resets this

This parameter must not be set at the same time as the L_DIRECT, L_PREPAR, T_CMP_V1 or T_CMP_V2 parameter. This parameter must not be set at the same time as the C_DOPARA parameter.

2)

FM 350-1 Function Module A5E00073040-02

5-5

Programming the FM 350-1

Editing Jobs
You make a job request for the FM 350-1 via the relevant FC parameters L_DIRECT, L_PREPAR, T_CMP_V1, T_CMP_V2, C_DOPARA, RES_SYNC, RES_ZERO, and OT_ERR_A. You must enter the appropriate values for the job (load value, comparison values, lower limit, upper limit, update time) before you call the FC in the DB. A set in/out parameter (L_DIRECT, L_PREPAR, T_CMP_V1, T_CMP_V2, C_DOPARA, RES_SYNC and RES_ZERO) is deleted again by the CNT_CTL1 function after completion of the job. You can see from this that processing of the job has been completed by the FM 350-1. If necessary, you can incorporate this information in your user program.

Transferring Values
Depending on the operating mode, you can transfer values by setting this function parameter.
Operating mode Count Measure Function parameter L_DIRECT, L_PREPAR, T_CMP_V1, T_CMP_V2, C_DOPARA L_PREPAR, T_CMP_V1, T_CMP_V2, C_DOPARA

You can transfer several values at the same time:


In Count mode ... you can transfer at the same time

Measure mode

Load value Comparison value 1 Comparison value 2 Lower limit Upper limit Update time

(DB parameter LOAD_VAL) (DB parameter CMP_V1) (DB parameter CMP_V2) (DB parameter LOAD_VAL) (DB parameter CMP_V1) (DB parameter CMP_V2)

If a value is incorrect, you must first acknowledge this operator error with OT_ERR_A before the FM 350-1 can accept any further values. You should then correct the value rejected with the operator error and transfer it again.

Note If you use the function parameter L_DIRECT, L_PREPAR, T_CMP_V1 or T_CMP_V2 to load the value LOAD_VAL, CMP_V1 or CMP_V2, you cannot change the parameter assignments at the same time using function parameter C_DOPARA. This would lead to an OT_ERR operator error that you would have to acknowledge with OT_ERR_A.

5-6

FM 350-1 Function Module A5E00073040-02

Programming the FM 350-1

Time Required to Transfer Values


The time required to transfer values is shown in the table below:
Use of the FM 350-1 Centralized Decentralized (non-isochrone mode) Decentralized (isochrone mode) Time required At least 4 OB 1 cycles At least 5 PROFIBUS DP cycles

Transfer of just one value If the transfer of several values is


initiated at the same time the values below reach FM 350-1 the 1st value: the 2nd value: the 3rd value:

5 PROFIBUS DP cycles

5 PROFIBUS DP cycles after initiation 6 PROFIBUS DP cycles after initiation 7 PROFIBUS DP cycles after initiation

Parameters for Transferring Values in the DB (Count Modes)


Table 5-1 shows the range of the DB in which you transfer the LOAD_VAL, CMP_V1 and CMP_V2 parameters. The LOAD_VAL parameter (bytes 14 to 17) has two meanings: If you set function parameter L_DIRECT or L_PREPAR, LOAD_VAL is interpreted as a load value. If you set function parameter C_DOPARA, you can use byte 14 to define the behavior of outputs DO0 and DO1. Bytes 15 and 16 are interpreted as hysteresis and pulse duration.

FM 350-1 Function Module A5E00073040-02

5-7

Programming the FM 350-1

Table 5-1 DB address 14.0

Parameters for transferring values in the DB (Count modes) Parameter Meaning

LOAD_VAL Load value; direct and preparatory loading with function parameter: L_DIRECT Load value; preparatory loading with function parameter: L_PREPAR

14.0

LOAD_VAL The behavior of outputs DO0 and DO1, hysteresis and pulse duration, are defined using function parameter: C_DOPARA Bit 3 x x x x x x Bit 2 0 0 0 0 1 1 Bit 1 0 0 1 1 0 0 Bit 0 0 1 0 1 0 1 Behavior of output DO0 Inactive Active from comparison value to overflow Active from comparison value to underflow Active on reaching the comparison value for pulse duration (up/down) Active on reaching the comparison value for pulse duration (up) Active on reaching the comparison value for pulse duration (down)

x = irrelevant Bit 7 x x x x x x x Bit 6 0 0 0 0 1 1 1 Bit 5 0 0 1 1 0 0 1 Bit 4 0 1 0 1 0 1 0 Behavior of output DO1 Inactive Active from comparison value to overflow Active from comparison value to underflow Active on reaching the comparison value for pulse duration (up/down) Active on reaching the comparison value for pulse duration (up) Active on reaching the comparison value for pulse duration (down) Switch to comparison value

x = irrelevant 15.0 16.0 17.0 18.0 22.0 CMP_V1 CMP_V2 Hysteresis (value range 0...255) Pulse duration (value range 0..250) Reserved = 0 Comparison value 1; load with function parameter: T_CMP_V1 Comparison value 2; load with function parameter: T_CMP_V2

5-8

FM 350-1 Function Module A5E00073040-02

Programming the FM 350-1

Parameters for Transferring Values in the DB (Measure Modes)


Table 5-2 shows the range of the DB in which you transfer the LOAD_VAL, CMP_V1 and CMP_V2 parameters. The LOAD_VAL parameter (bytes 14 to 17) has two meanings: If you set function parameter L_PREPAR, LOAD_VAL is interpreted as a lower limit If you set function parameter C_DOPARA, byte 14 is used to define the behavior of output DO0. You must not set the L_DIRECT parameter for a Measure mode.
Table 5-2 DB address 14.0 14.0 Parameters for transferring values in the DB (Measure modes) Parameter Meaning L_PREPAR C_DOPARA

LOAD_VAL Lower limit; load with function parameter: LOAD_VAL Behavior of DO0; define with function parameter:

Bits 2 to 7 irrelevant irrelevant irrelevant irrelevant

Bit 1 0 0 1 1

Bit 0 0 1 0 1

Behavior of output DO0 No comparison Exceeds limits Under lower limit Above upper limit

15.0 16.0 17.0 18.0 20.0 CMP_V1 CMP_V2

Reserved = 0 Reserved = 0 Reserved = 0 Upper limit 1; Load with function parameter: Update time; Load with function parameter: T_CMP_V1 T_CMP_V2

Restart Characteristics
As soon as the CNT_CTL1 function detects a restart (CPU restart or FM restart), any pending job is deferred and the restart is acknowledged first. Any job already initiated by you is continued only after the restart has been completed and will not be lost.

Error Messages
If an operator error occurs in the case of an FC call, this is reported in the OT_ERR parameter. The error information can then be read out in DB1 (OT_ERR_B variable). With the help of the OT_ERR_A parameter, you can then acknowledge operator errors. No new operator error will be reported until you have acknowledged the previous one.

FM 350-1 Function Module A5E00073040-02

5-9

Programming the FM 350-1

5.2

The CNT_CTL2 Function (FC 3)

Functionality
The CNT_CTL2 function essentially has the same functionality as the CNT_CTL1 function (see section 5.1). The differences compared to the CNT_CTL1 function are explained below.

Possible Uses
The CNT_CTL2 function only works in an isochrone OB. If you call the CNT_CTL2 function in a non-isochrone OB, you will generate operator error no. 91. You will then not be able to exchange data with the FM 350-1.

Mode of Operation
The CNT_CTL2 function is particularly suitable for applications in which you want to send the same job (e.g. Load comparison value) to the FM 350-1 several times in quick succession. While the CNT_CTL1 function is ideally used to initiate a new job in every fifth PROFIBUS DP cycle, with the CNT_CTL2 function, this occurs in every second PROFIBUS DP cycle. The block is ready for a job when the relevant initiation bit is set to 0. Completion of a job is not displayed separately. If a communication problem or a data or operator error occurs, it cannot be assigned to a particular job, so the block will stop processing the job and will generate an operator error no. 90, which can be acknowledged. Once you have acknowledged the error by setting the OT_ERR_A parameter, any outstanding jobs will be (further) processed. Acknowledgement of an operator error is deemed to be successful if the OT_ERR parameter is reset. You should therefore leave the OT_ERR_A parameter set to guarantee acknowledgement. There is no point in initiating further jobs until the acknowledgement is successful.

Note In isochrone mode, you cannot start several value transfers at the same time using the CNT_CTL2 function.

5-10

FM 350-1 Function Module A5E00073040-02

Programming the FM 350-1

5.3

The DIAG_INF Function (FC 1)

Functionality
The DIAG_INF function reads data set DS1 from the FM 350-1 and makes it available to you in the DB of the CNT_CTL1 function. The transfer works as follows: If the initiation parameter is set (IN_DIAG = TRUE), DS1 is read out from the FM 350-1. DS1 is entered in the DB of the CNT_CTL1 function from DW 54. DS1 is transferred with the help of the SFC RDSYSST. The return code of the SFC (RET_VAL) is copied to the RET_VAL parameter of the DIAG_INF function . As soon as the function has been executed, the IN_DIAG initiation parameter is reset and the transfer is reported to be complete. Manual /2/ contains a full description of the SFC RDSYSST.

Call
The DIAG_INF function can be called in the cycle and in the interrupt program. There is no point in calling it in the time-controlled program. The DIAG_INF function call is given in the STL and LAD notations below.


STL notation
CALL

LAD notation

DIAG_INF( DB_NO

:= := :=

, ,

DIAG_INF

RET_VAL IN_DIAG

EN

ENO

);

DB_NO

RET_VAL

IN_DIAG

DIAG_INF Function Parameters


Table 5-3 Name DB_NO RET_VAL IN_DIAG

DIAG_INF function parameters Declaration Type INPUT OUTPUT IN-OUT Data Type INT INT BOOL Meaning Number of the CNT_CTL1 function data block Return code of the SFC 51 Initiation bit read diagnostics data set DS1 The User... enters this scans this sets and scans this The Block... scans this enters this resets this

FM 350-1 Function Module A5E00073040-02

5-11

Programming the FM 350-1

5.4

Application Example

Introduction
The example below shows how the CNT_CTL1 function can be used for the functions Transfer load value to FM 350-1 and Start counter. These functions are representative of all functions here.
STL L T A S R CALL #1000; CNT_CHAN1.LOAD_VAL; INITIATE; LOAD_DIRECT; INITIATE; CNT_CTL1, ( DB_NO SW_GATE GATE_STP OT_ERR_A SET_DO0 SET_DO OT_ERR L_DIRECT L_PREPAR T_CMP_V1 T_CMP_V2 C_DOPARA RES_SYNC RES_ZERO OT_ERR; CONT; Explanation // Enter load value in // the DB 1 (double integer).

// DIRECT input parameter

:=1 :=SW_GATE :=GATE_STP :=CON_OT_ERR, :=SET_DO0, :=SET_DO1, :=OTT_ERR, :=L_DIRECT, :=L_PREPAR, :=T_CMP_V1, :=T_CMP_V2, :=C_DOPARA, :=RES_SYNC, :=RES_ZERO);

AN JC L T SET S ... JU CONT: .. AN S END:

CNT_CHAN1.OT_ERR_B; OUTPUT; CON_OT_ERR END; L_DIRECT; SW_GATE;

// // // // // // // // // // // // // // // // // // // // // // // // // // //

FC call with the DB 1 Channel 1 Control software gate Stop gate Acknowledge operator error SET outpour DO0 SET output DO1 Operator error occurred Load new counter value Prepare new counter value Load new comparison value 1 Load new comparison value 2 Initiate parameter change Delete synchronization status bit Delete zero pass status bit If no error has occurred, CONTinue *** Error evaluation START *** Read and display additional information. Generate RLO 1 Acknowledge error Further error response ***Error evaluation END *** Continue with normal execution Load direct function is ready Open software gate;

5-12

FM 350-1 Function Module A5E00073040-02

Programming the FM 350-1

Description of the Symbols


Table 5-4 lists the symbols used in the example. You define your own symbol assignments in the S7 Symbol Table.
Table 5-4 Symbols in Example Symbols CNT_CHAN1 CNT_CHAN1.LOAD_VAL TRIGGER SW_GATE GATE_STP OT_ERR_A SET_DO0 SET_DO1 OT_ERR L_DIRECT L_PREPAR T_CMP_V1 T_CMP_V2 C_DOPARA RES_SYNC RES_ZERO CNT_CHAN1.OT_ERR_B Absolute (Example) DB 1 DB1.DBD14 M 10.0 M 20.0 M 20.1 M 20.2 M 20.3 M 20.4 M 20.5 M 20.6 M 20.7 M 21.0 M 21.1 M 21.2 M 21.3 M 21.4 DB1.DBB40.0 Comment Data block for CNT_CTL1 function Counter value specification in DB 1 (double word) Trigger memory marker formed as a result of the technological requirement Start counter Close counter gate Acknowledge operator error Set output DO0 Set output DO1 Operator error occurred Direct and preparatory loading of counter value Load value of counter in preparation Load comparison value 1 Load comparison value 2 Initiate parameter change Reset synchronization status bit Reset zero pass, overflow, underflow and comparator or end of measurement status bit Operator error information in DB 1

FM 350-1 Function Module A5E00073040-02

5-13

Programming the FM 350-1

Description of the Procedure


Requirement The value to be transferred must have been entered in DB 1. Load value is transferred and started The load value of the channel is transferred to the FM 350-1 by means of the FC call. There are two parameters available for transferring the load value to the FM 350-1. When calling the CNT_CTL1 function, the parameter selected is either L_DIRECT or L_PREPAR. Parameter L_DIRECT defines that the load value is transferred directly and in preparation to the counter (you set the trigger bit L_DIRECT=1 in your user program). Parameter L_PREPAR defines that the load value is only loaded in preparation (you have to set the trigger bit L_PREPAR=1 in your user program). The load value loaded in preparation is then applied at the next cause that sets the counter. The FC must therefore be called until the FC has reset the selected trigger bit (L_DIRECT or L_PREPAR). The in/out parameter remains set during the transfer. With regard to the exchange of data with the FM, the CNT_CTL1 function does not issue an error message. If the trigger bit you set has been reset by the CNT_CTL1 function, the FM 350-1 has applied the load value. The read load value stored in DB 1 is updated by the CNT_CTL1 function (applicable only if you are working without the latch setting). It takes at least four FC calls to transfer the load value.

5-14

FM 350-1 Function Module A5E00073040-02

Programming the FM 350-1

5.5

Technical Data for the Blocks


Technical data CNT_CTRL function FC 0 3.0 456 bytes 538 bytes CNT_CTL1 function FC 2 3.0 796 bytes 950 bytes CNT_CTL2 function FC 3 3.0 1426 bytes 1578 bytes DIAG_INF function FC 1 3.0 246 bytes 326 bytes

Block number Version Size in RAM Size in load memory Size in data area Size in local data area System function called Processing time in the CPU 316-2 DP (FM 350-1 centralized) Processing time in the CPU 316-2 DP (FM 350-1 decentralized) Processing time in the CPU 416-2 DP (FM 350-1 decentralized) Isochrone mode Non-isochrone mode

70 bytes long data block that is specified when the FC is called. 4 bytes 0.98 ms 46 bytes SFC 6 (RD_INFO) 1.25 ms 46 bytes SFC 6 (RD_INFO) 2.12 ms 38 bytes SFC 51 RDSYSST 3.19 ms

0.78 ms

1.06 ms

1.99 ms

0.87 ms

30 ms

70 ms

92 ms

134 ms

no yes

yes yes

yes no

yes yes

FM 350-1 Function Module A5E00073040-02

5-15

Programming the FM 350-1

5.6

Programming the FM 350-1 without FCs


If you want to operate the FM 350-1 without FCs, you can control and monitor the FM 350-1 directly via the control and check-back interface (working data interface). The working data interface starts at the modules starting address and is 16 bytes long. Load commands allow you to read the check-back interface. Transfer commands are used to write to the control interface. Mixed use of load / transfer commands and programming with FCs is not permitted.

5.6.1

Control and Check-back Interface for the Count Modes

Control Interface for Count Modes


The LOAD_VAL parameter (bytes 0 to 3) has two meanings: If you set the L_DIRECT or L_PREPAR bit, LOAD_VAL is interpreted as a load value. If you set the C_DOPARA bit, you can use byte 0 to define the behavior of outputs DO0 and DO1. Bytes 1 and 2 are interpreted as hysteresis and pulse duration.

5-16

FM 350-1 Function Module A5E00073040-02

Programming the FM 350-1

Table 5-5

Control interface for Count modes (outputs) Parameter Meaning

Offset from starting address Bytes 0 to 3

LOAD_VAL

Load value; direct and preparatory loading with bit: L_DIRECT Load value; preparatory loading with bit: L_PREPAR

Byte 0

LOAD_VAL

The behavior of outputs DO0 and DO1, hysteresis and pulse duration, are defined using bit: C_DOPARA

Bit 3 x x x x x x

Bit 2 0 0 0 0 1 1

Bit 1 0 0 1 1 0 0

Bit 0 0 1 0 1 0 1

Behavior of output DO0 Inactive Active from comparison value to overflow Active from comparison value to underflow Active on reaching the comparison value for pulse duration (up/down) Active on reaching the comparison value for pulse duration (up) Active on reaching the comparison value for pulse duration (down)

x = irrelevant

Bit 7 x x x x x x x

Bit 6 0 0 0 0 1 1 1

Bit 5 0 0 1 1 0 0 1

Bit 4 0 1 0 1 0 1 0

Behavior of output DO1 Inactive Active from comparison value to overflow Active from comparison value to underflow Active on reaching the comparison value for pulse duration (up/down) Active on reaching the comparison value for pulse duration (up) Active on reaching the comparison value for pulse duration (down) Switch to comparison value

x = irrelevant

Byte 1 Byte 2 Byte 3 Bytes 4 to 7 CMP_V1

Hysteresis (value range 0...255) Pulse duration (value range 0..250) Reserved = 0 Comparison value 1; load with bit: T_CMP_V1

FM 350-1 Function Module A5E00073040-02

5-17

Programming the FM 350-1

Table 5-5

Control interface for Count modes (outputs), continued Parameter Meaning

Offset from starting address Bytes 8 to 11 Byte 12

CMP_V2 NEUSTQ OT_ERR_A

Comparison value 2; load with bit: Bit 7: Bit 6: Bit 5: Bit 4: Bit 3: Bit 2: Bit 1: Bit 0: Bit 7: Bit 6: Bit 5: Bit 4: Bit 3: Bit 2: Bit 1: Bit 0: Bit 7: Bit 6: Bit 5: Bit 4: Bit 3: Bit 2: Bit 1: Bit 0: Bit 7:
1)

T_CMP_V2

Reserved = 0 Restart acknowledgement Reserved = 0 Reserved = 0 Operator error acknowledgement Reserved = 0 Reserved = 0 Reserved = 0 Reserved = 0 Reserved = 0 Reserved = 0 Reserved = 0 SW gate control bit General gate stop Enable synchronization down Enable synchronization up Reserved = 0 Reserved = 0 Reserved = 0 Reserved = 0 Control bit DO1 Control bit DO0 Enable DO1 Enable DO0 Reserved = 0 Change function of DO0/DO1, hysteresis or pulse duration Reset status bits for zero pass, overflow, underflow and comparator Reset status bit for synchronization Load comparison value 2 Load comparison value 1 Preparatory loading of counter Direct and preparatory loading of counter

Byte 13

SW_GATE GATE_STP ENSET_DN ENSET_UP

Byte 14

SET_DO1 SET_DO0 CTRL_DO1 CTRL_DO0

Byte 15

C_DOPARA RES_ZERO RES_SYNC T_CMP_V2 T_CMP_V1 L_PREPAR


2) 2) 2)

Bit 6: Bit 5: Bit 4: Bit 3: Bit 2: Bit 1: Bit 0:

L_DIRECT 2)
1) 2)

You must not set this bit at the same time as bit 0, 1, 2 or 3 of byte 15. You must not set this bit at the same time as bit 6 of byte 15.

5-18

FM 350-1 Function Module A5E00073040-02

Programming the FM 350-1

Explanation of the Control Bits for the Count Modes


Table 5-6 Explanation of the control bits for the Count modes Explanation Modify function and behavior of DO0/DO1, hysteresis or pulse duration The values from bytes 0 to 2 are accepted as a new function, hysteresis and pulse duration of DO0, DO1. You must transfer the old values if you do not wish the values to change. CTRL_DO0 Enable DO0 This bit is used to enable output DO0. CTRL_DO1 Enable DO1 This bit is used to enable output DO1. ENSET_DN ENSET_UP GATE_STP L_DIRECT L_PREPAR NEUSTQ This bit enables loading of the counter for counting down This bit enables loading of the counter for counting up This bit closes the internal gate. This bit is used for direct and preparatory loading of the counter. This bit is used for preparatory loading of the counter. This bit acknowledges start-up of the FM 350-1. After a restart, the FM 350-1 does not recognize any control or data input until this bit has been set. The NEUSTQ bit is set by the CNT_CNTL1 function as soon as the check-back signal FM_NEUST is set and the check-back signal FM_NEUSTQ = 0. It is reset by the CNT_CNTL1 function if the FM_NEUST bit has been reset and the FM_NEUSTQ bit has been set by the FM 350-1. If you do not use the CNT_CNTL1, then you will have to coordinate the restart via the user program. OT_ERR_A This bit is used to acknowledge an operator error. If you require detailed operator error information, you must read it from the check-back interface before you acknowledge the error. The error message is no longer valid after it is acknowledged. RES_SYNC RES_ZERO SET_DO0 SET_DO1 SW_GATE T_CMP_V1 T_CMP_V2 This bit is used to reset and acknowledge the check-back bit STS_SYNC so that the counter can be loaded by the synchronization input DI-Set. This bit is used to reset the check back bits STS_ZERO, STS_OFLW, STS_UFLW, STS_COMP1 and STS_COMP2. This bit is used to switch digital output DO0 on and off if you have set the output behavior to Inactive and if the enable bit CRTL_DO0 is set. This bit is used to switch digital output DO1 on and off if you have set the output behavior to Inactive and if the enable bit CRTL_DO1 is set. This bit opens and closes the SW gate. This bit is used to load the value from bytes 0 to 3 to comparison value 1. This bit is used to load the value from bytes 0 to 3 to comparison value 2.

Control bits C_DOPARA

FM 350-1 Function Module A5E00073040-02

5-19

Programming the FM 350-1

Check-back Interface for Count Modes


Table 5-7 Check-back interface for Count modes (inputs) Parameter Meaning

Offset from starting address Bytes 0 to 3 Bytes 4 to 7 Bytes 8 to 9 Byte 10 Byte 11

LATCH_LOAD ACT_CNTV DA_ERR_W OT_ERR_B PARA FM_NEUST FM_NEUSTQ DATA_ERR OT_ERR DIAG

Returnable load value or stored counter value for the latch function at the digital input Counter value Data error Operator error Bit 7: Bit 6: Bit 5: Bit 4: Bit 3: Bit 2: Bit 1: Bit 0: Bit 7: Bit 6: Bit 5: Bit 4: Bit 3: Bit 2: Bit 1: Bit 0: Parameter assignments completed Restart request Restart acknowledgement completed Data error Operator error Diagnostic event Reserved = 0 Reserved = 0 Reserved = 0 Reserved = 0 Reserved = 0 Reserved = 0 Reserved = 0 Reserved = 0 Status of the SW gate Status of the gate Synchronization Underflow Overflow Zero pass Direction bit Counter running

Byte 12

Byte 13

STS_SW_GATE STS_GATE STS_SYNC STS_UFLW STS_OFLW STS_ZERO STS_DIR STS_RUN

Bit 7: Bit 6: Bit 5: Bit 4: Bit 3: Bit 2: Bit 1: Bit 0:

5-20

FM 350-1 Function Module A5E00073040-02

Programming the FM 350-1

Table 5-7

Check-back interface for Count modes (inputs), continued Parameter Meaning

Offset from starting address Byte 14

STS_COMP2 STS_COMP1 STS_CMP2 STS_CMP1 STS_STP STS_STA STS_LATCH STS_SET

Bit 7: Bit 6: Bit 5: Bit 4: Bit 3: Bit 2: Bit 1: Bit 0: Bit 7: Bit 6: Bit 5: Bit 4: Bit 3: Bit 2: Bit 1: Bit 0:

Remanent status of comparator 2 Remanent status of comparator 1 Status of output DO1 Status of output DO0 Status of digital input Stop DI Status of digital input Start DI New latch value for isochrone mode Status of digital input Set DI Reserved = 0 Change function of DO0/DO1, hysteresis or pulse duration Reset status bits for zero pass, overflow, underflow or comparator Reset synchronization status bit Load comparison value 2 Load comparison value 1 Preparatory loading of counter Direct and preparatory loading of counter

Byte 15

STS_C_DOPARA STS_RES_ZERO STS_RES_SYNC STS_T_CMP_V2 STS_T_CMP_V1 STS_L_PREPAR STS_L_DIRECT

FM 350-1 Function Module A5E00073040-02

5-21

Programming the FM 350-1

Explanation of the Check-back Bits for the Count Modes


Table 5-8 Explanation of the check-back bits for the Count modes Explanation This bit indicates that a data error (parameter assignment error) was entered in the check-back interface. The bit is set when diagnostic record DS1 is updated in order to signal a diagnostic event. The bit is reset once record DS1 has been read. If no diagnostic interrupt is enabled, this bit may be used as an initiation bit for the DIAG_INF function incorporated into the OB1. The FM 350-1 sets this bit whenever it performs a restart or detects a system start-up, regardless of whether the system starts up automatically or manually. The bit FM_NEUST is reset by the next positive edge at the bit NEUSTQ. The FM 350-1 is then controllable, and values can be read from it and sent to it. The FM 350-1 clears this bit whenever it performs a restart or detects a system start-up, regardless of whether the system starts up automatically or manually. It is set when the bit FM_NEUST is reset. This bit is set when an operator error is entered in the check-back interface. It is reset when the bit OT_ERR_A is reset. No further operator errors can be signaled while the bit OT_ERR is set. This bit is set when the modules parameter assignments have been carried out without error. The parameter record is on the module without errors. The bit is not set, however, until the bit FM_NEUSTQ has been reset. From that moment on, the values in the check-back interface are valid and current. Acknowledgement bit for simultaneous changing of the behavior of DO0 and DO1, hysteresis and pulse duration. You must transfer the old values if you do not wish the values to change. Status of output DO0 Status of output DO1 Acknowledgement bit for loading of comparison value 1 Acknowledgement bit for loading of comparison value 2 This bit indicates the stored status that output DO0 was set. This also applies if output DO0 was not enabled with CTRL_DO0. The stored status is reset by acknowledging with RES_ZERO. This bit indicates the stored status that output DO1 was set. This also applies if output DO1 was not enabled with CTRL_DO1. The stored status is reset by acknowledging with RES_ZERO. This bit indicates the counting direction of the counter: 0 = up 1 = down STS_GATE (LED DIR is off) (LED DIR is lit)

Check-back bits DATA_ERR DIAG

FM_NEUST

FM_NEUSTQ

OT_ERR

PARA

STS_C_DOPARA

STS_CMP1 STS_CMP2 STS_T_CMP_V1 STS_T_CMP_V2 STS_COMP1

STS_COMP2

STS_DIR

This bit indicates the status of the gate. 0 =Gate closed 1 = Gate open

5-22

FM 350-1 Function Module A5E00073040-02

Programming the FM 350-1

Table 5-8

Explanation of the check-back bits for the Count modes, continued Explanation This bit indicates in isochrone mode whether at least one new latch value was stored between the penultimate Ti and the last Ti. If the bit is set, LATCH_LOAD contains the last latch value. If no new latch value was stored, the bit is not set. The bit is not set in non-isochrone mode. Acknowledgement bit for direct and preparatory loading of the counter and load value. Acknowledgement bit for preparatory loading of the load value. This bit indicates that an overflow has occurred. The stored status is reset with RES_ZERO by acknowledging. Resets the check-back bit STS_SYNC. Acknowledgement bit for resetting of the stored statuses in the check-back bits STS_ZERO, STS_OFLW, STS_UFLW, STS_COMP1 and STS_COMP2 This bit corresponds to counter bit 2. 0 = LED CR is off 1 = LED CR is lit

Check-back bits STS_LATCH

STS_L_DIRECT STS_L_PREPAR STS_OFLW STS_RES_SYNC STS_RES_ZERO STS_RUN

STS_SET STS_STA STS_STP STS_UFLW STS_SYNC

Status of digital input Set DI Status of digital input Start DI Status of digital input Stop DI This bit indicates that an underflow has occurred. The stored status is reset with RES_ZERO by acknowledging. This bit indicates the stored status that the counter was loaded by an event at Set DI (synchronization). The stored status is reset with RES_SYNC by acknowledging. This bit indicates the stored status that the counter level has passed through zero. The stored status is reset with RES_ZERO by acknowledging.

STS_ZERO

FM 350-1 Function Module A5E00073040-02

5-23

Programming the FM 350-1

5.6.2

Control and Check-back Interface for the Measure Modes

Control Interface for Measure Modes


The LOAD_VAL parameter (bytes 0 to 3) has two meanings: If you set the L_PREPAR bit, LOAD_VAL is interpreted as a lower limit. If you set the C_DOPARA bit, byte 0 is used to define the behavior of output DO0.
Table 5-9 Control interface for Measure modes (outputs) Parameter Assignment

Offset from starting address Bytes 0 to 3 Byte 0

LOAD_VAL LOAD_VAL

Load lower limit with bit: Define behavior of DO0 with bit:

L_PREPAR C_DOPARA

Bits 2 to 7 irrelevant irrelevant irrelevant irrelevant

Bit 1 0 0 1 1

Bit 0 0 1 0 1

Behavior of output DO0 No comparison Exceeds limits Under lower limit Above upper limit

Byte 1 Byte 2 Byte 3 Bytes 4 to 7 Bytes 8 to 9 Bytes 10 to 11 Byte 12 CMP_V1 CMP_V2 NEUSTQ OT_ERR_A

Reserved = 0 Reserved = 0 Reserved = 0 Upper limit; load with bit: Update time; load with bit: Bit 7: Bit 6: Bit 5: Bit 4: Bit 3: Bit 2: Bit 1: Bit 0: Reserved = 0 Restart acknowledgement Reserved = 0 Reserved = 0 Operator error acknowledgement Reserved = 0 Reserved = 0 Reserved = 0 T_CMP_V1 T_CMP_V2

5-24

FM 350-1 Function Module A5E00073040-02

Programming the FM 350-1

Table 5-9

Control interface for Measure modes (outputs), continued Parameter Assignment

Offset from starting address Byte 13

Bit 7: Bit 6: Bit 5: Bit 4: Bit 3: Bit 2: Bit 1: Bit 2: Bit 7: Bit 6: Bit 5: Bit 4: Bit 3: Bit 2: Bit 1: Bit 0: Bit 7:
1)

Reserved = 0 Reserved = 0 Reserved = 0 Reserved = 0 SW gate control bit General gate stop Reserved = 0 Reserved = 0 Reserved = 0 Reserved = 0 Control bit DO1 Control bit DO0 Enable DO1 Enable DO0 Reserved = 0 Change DO0 function Reset status bits for overflow, underflow and end of measurement Reserved = 0 Change update time Load upper limit Load lower limit

SW_GATE GATE_STP Byte 14 SET_DO1 SET_DO0 CTRL_DO1 CTRL_DO0 Byte 15 C_DOPARA RES_ZERO T_CMP_V2
2)

Bit 6: Bit 5: Bit 4: Bit 3: Bit 2: Bit 1: Bit 0:

T_CMP_V1 2) L_PREPAR 2)
1) 2)

You must not set this bit at the same time as bit 1, 2 or 3 of byte 15. You must not set this bit at the same time as bit 6 of byte 15.

FM 350-1 Function Module A5E00073040-02

5-25

Programming the FM 350-1

Explanation of the Control Bits for the Measure Modes


Table 5-10 Explanation of the control bits for the Measure modes Control bits C_DOPARA Explanation Change function and behavior of DO0 The values from byte 0 are accepted as a new function by DO0. You must transfer the old values if you do not wish the values to change. CTRL_DO0 Enable DO0 This bit is used to enable output DO0. CTRL_DO1 Enable DO1 This bit is used to enable output DO1. GATE_STP L_PREPAR NEUSTQ This bit closes the internal gate. This bit is used to load the lower limit. This bit acknowledges start-up of the FM 350-1. After a restart, the FM 350-1 does not recognize any control or data input until this bit has been set. The NEUSTQ bit is set by the CNT_CNTL1 function as soon as the check-back signal FM_NEUST is set and the check-back signal FM_NEUSTQ = 0. It is reset by the CNT_CNTL1 function if the FM_NEUST bit has been reset and the FM_NEUSTQ bit has been set by the FM 350-1. If you do not use the CNT_CNTL1, then you will have to coordinate the restart via the user program. OT_ERR_A This bit is used to acknowledge an operator error. If you require detailed operator error information, you must read it from the check-back interface before you acknowledge the error. The error message is no longer valid after it is acknowledged. RES_ZERO SET_DO0 SET_DO1 SW_GATE T_CMP_V1 T_CMP_V2 This bit is used to reset the check back bits STS_OFLW, STS_UFLW and STS_COMP1. This bit is used to switch digital output DO0 on and off if you have set the output behavior to Inactive and if the enable bit CRTL_DO0 is set. This bit is used to switch digital output DO1 on and off if you have set the output behavior to Inactive and if the enable bit CRTL_DO1 is set. This bit opens and closes the SW gate. This bit is used to load the upper limit. This bit is used to load the update time.

5-26

FM 350-1 Function Module A5E00073040-02

Programming the FM 350-1

Check-back Interface for Measure Modes


Table 5-11 Check-back interface for Measure modes (inputs) Offset from starting address Bytes 0 to 3 Bytes 4 to 7 Bytes 8 to 9 Byte 10 Byte 11 Parameter Assignment

LATCH_LOAD ACT_CNTV DA_ERR_W OT_ERR_B PARA FM_NEUST FM_NEUSTQ DATA_ERR OT_ERR DIAG

Measured value Counter value Data error Operator error Bit 7: Bit 6: Bit 5: Bit 4: Bit 3: Bit 2: Bit 1: Bit 0: Bit 7: Bit 6: Bit 5: Bit 4: Bit 3: Bit 2: Bit 1: Bit 0: Parameter assignments completed Restart request Restart acknowledgement completed Data error Operator error Diagnostic event Reserved = 0 Reserved = 0 Reserved = 0 Reserved = 0 Reserved = 0 Reserved = 0 Reserved = 0 Reserved = 0 Status of the gate Underflow Overflow End of measurement Direction bit Counter running

Byte 12

Byte 13

STS_GATE STS_UFLW STS_OFLW STS_COMP1 STS_DIR STS_RUN

Bit 7: Bit 6: Bit 5: Bit 4: Bit 3: Bit 2: Bit 1: Bit 0:

FM 350-1 Function Module A5E00073040-02

5-27

Programming the FM 350-1

Table 5-11 Check-back interface for Measure modes (inputs), continued Offset from starting address Byte 14 STS_CMP2 STS_CMP1 STS_STP STS_STA STS_SET Byte 15 STS_C_DOPARA STS_RES_ZERO STS_T_CMP_V2 STS_T_CMP_V1 STS_L_PREPAR Parameter Assignment

Bit 7: Bit 6: Bit 5: Bit 4: Bit 3: Bit 2: Bit 1: Bit 0: Bit 7: Bit 6: Bit 5: Bit 4: Bit 3: Bit 2: Bit 1: Bit 0:

Status of output DO1 Status of output DO0 Status of digital input Stop DI Status of digital input Start DI Status of digital input Set DI Reserved = 0 Change DO0 function Reset end of measurement status bit Change update time Load upper limit Load lower limit

5-28

FM 350-1 Function Module A5E00073040-02

Programming the FM 350-1

Explanation of the Check-back Bits for the Measure Modes


Table 5-12 Explanation of the check-back bits for the Measure modes Check-back bits DATA_ERR DIAG Explanation This bit indicates that a data error was entered in the check-back interface. The bit is set when diagnostic record DS1 is updated in order to signal a diagnostic event. The bit is reset once record DS1 has been read. If no diagnostic interrupt is enabled, this bit may be used as an initiation bit for the DIAG_INF function incorporated into the OB1. The FM 350-1 sets this bit whenever it performs a restart or detects a system start-up, regardless of whether the system starts up automatically or manually. The bit FM_NEUST is reset by the next positive edge at the bit NEUSTQ. The FM 350-1 is then controllable, and values can be read from it and sent to it. The FM 350-1 clears this bit whenever it performs a restart or detects a system start-up, regardless of whether the system starts up automatically or manually. It is set when the bit FM_NEUST is reset. This bit is set when an operator error is entered in the check-back interface. It is reset when the bit OT_ERR_A is reset. No further operator errors can be signaled while the bit OT_ERR is set. This bit is set when the modules parameter assignments have been carried out without error. The parameter record is on the module without errors. The bit is not set, however, until the bit FM_NEUSTQ has been reset. From that moment on, the values in the check-back interface are valid and current. Acknowledgement bit for simultaneous changing of the behavior of DO0 and DO1, hysteresis and pulse duration. You must transfer the old values if you do not wish the values to change. Status of output DO0 Status of output DO1 Acknowledgement bit for loading of the upper limit Acknowledgement bit for loading of the update time This bit indicates the counting direction of the counter: 0 = up 1 = down STS_GATE (LED DIR is off) (LED DIR is lit)

FM_NEUST

FM_NEUSTQ

OT_ERR

PARA

STS_C_DOPARA

STS_CMP1 STS_CMP2 STS_CMP_T_VAL1 STS_CMP_T_VAL2 STS_DIR

This bit indicates the status of the gate. 0 = Gate closed 1 = Gate open

STS_L_PREPAR STS_OFLW STS_RES_ZERO STS_RUN

Acknowledgement bit for loading of the lower limit This bit indicates the stored status that a measured value was greater than the upper limit. The stored status is reset with RES_ZERO by acknowledging. Acknowledgement bit for resetting of the stored statuses in the check-back bits STS_OFLW, STS_UFLW and STS_COMP1 This bit corresponds to counter bit 2. 0 = LED CR is off 1 = LED CR is lit

FM 350-1 Function Module A5E00073040-02

5-29

Programming the FM 350-1

Table 5-12 Explanation of the check-back bits for the Measure modes, continued Check-back bits STS_SET STS_STA STS_STP STS_UFLW Status of digital input Set DI Status of digital input Start DI Status of digital input Stop DI This bit indicates the stored status that a measured value was less than the lower limit. The stored status is reset with RES_ZERO by acknowledging. Explanation

5-30

FM 350-1 Function Module A5E00073040-02

Programming the FM 350-1

5.6.3

Using the Interface with the Complete Acknowledgement Principle

Definition
The complete acknowledgement principle (see figure 5-2) is always used to control the FM 350-1 from the user program.

Control bit 1. Check-back bit 2. Figure 5-2 Complete acknowledgement principle 4. t 3. t

The sequence is as follows: 1. If the check-back bit = 0, you can request processing via the user program by setting the control bit. 2. The FM 350-1 detects the request, acknowledges it by setting the check-back bit and starts the processing. 3. Once the FM 350-1 has set the check-back bit, you can reset the control bit. 4. At the end of processing, the FM 350-1 responds to the resetting of the control bit by resetting the check-back bit.

FM 350-1 Function Module A5E00073040-02

5-31

Programming the FM 350-1

Transferring Values
With the FM 350-1 values are also transferred using the complete acknowledgement principle. If incorrect values are transferred, the FM 350-1 signals an operator error with the check-back bit OT_ERR. You must then first acknowledge the operator error bit OT_ERR with the operator error acknowledgement OT_ERR_A before you can transfer a new, correct value. Figure 5-3 shows an example of this sequence for the preparatory loading of the counter. Depending on the operating mode, you can transfer values with the following control bits:

Operating mode Count Measure

Control bits L_DIRECT, L_PREPAR, T_CMP_V1, T_CMP_V2, C_DOPARA L_PREPAR, T_CMP_V1, T_CMP_V2, C_DOPARA

The sequence over time when transferring values is shown in figure 5-3:

Op. error bit OT_ERR t Op. error acknowledgement OT_ERR_A t Control bit L_PREPAR t Check-back bit STS_L_PREPAR t The value is accepted. If the value is not correct, the operator error bit is set. Removal of request and acceptance of values by the FM 350-1. Detection of an operator error The FM 350-1 acknowledges the request Request value transfer and make value available Figure 5-3 Transfer of values

5-32

FM 350-1 Function Module A5E00073040-02

Programming the FM 350-1

You can transfer several values at the same time:


In Count ... you can transfer at the same time

Load value Comparison value 1 Comparison value 2 Lower limit Upper limit Update time

(Parameter LOAD_VAL) (parameter CMP_V1) (Parameter CMP_V2) (Parameter LOAD_VAL) (parameter CMP_V1) (Parameter CMP_V2)

Measure

If a value is incorrect, you must first acknowledge this operator error with OT_ERR_A before the FM 350-1 can accept any further values. You should then correct the value rejected with the operator error and transfer it again.

Note If you use the control bits L_DIRECT, L_PREPAR, T_CMP_V1 or T_CMP_V2 to load the value LOAD_VAL, CMP_V1 or CMP_V2, you cannot change the parameter assignments at the same time using the C_DOPARA control bit. This would lead to an OT_ERR operator error that you would have to acknowledge with OT_ERR_A.

Time Required to Transfer Values


The time required to transfer values is shown in the table below:
Use of the FM 350-1 Centralized Decentralized (non-isochrone mode) Decentralized (isochrone mode) Time required At least 3 OB 1 cycles At least 4 PROFIBUS DP cycles

Transfer of just one value If the transfer of several values is


initiated at the same time the values below reach FM 350-1 the 1st value: the 2nd value: the 3rd value:

4 PROFIBUS DP cycles

4 PROFIBUS DP cycles after initiation 5 PROFIBUS DP cycles after initiation 6 PROFIBUS DP cycles after initiation

FM 350-1 Function Module A5E00073040-02

5-33

Programming the FM 350-1

Reading Back Values


The FM 350-1 has data record DS 2 which you can read using the RD_REC special function. The DS 2 has the following structure:
Table 5-13 Data record DS 2 Address Count Bytes 0 to 3 Bytes 4 to 7 Bytes 8 to 11 Load value Comparison value 1 Comparison value 2 Value Measure Lower limit Upper limit Update time

Resetting the Status Bits


With the FM 350-1, the status bits are also reset using the complete acknowledgement principle. This applies to the following status bits, depending on the operating mode:

Operating mode Count Measure

Status bits STS_ZERO, STS_OFLW, STS_UFLW, STS_COMP1, STS_COMP2 STS_OFLW, STS_UFLW, STS_COMP1

The sequence over time when resetting the status bits is shown in figure 5-4:

On resetting, event is still occurring

Status bit

Control bit RES_ZERO

Check-back bit STS_RES_ZERO t Reset is carried out Removal of reset request The FM 350-1 acknowledges the reset request and resets the status bit Request reset Figure 5-4 Resetting the status bits

5-34

FM 350-1 Function Module A5E00073040-02

Programming the FM 350-1

5.6.4

Restart Coordination

Restart Coordination
Whenever the FM 350-1 performs a restart or detects a system start-up, it sets the check-back bit FM_NEUST. If you are not using a function, then you will have to coordinate the restart via the user program. Acknowledge the FM_NEUST bit by setting the NEUSTQ control bit. The FM 350-1 then resets the FM_NEUST check-back bit and sets the FM_NEUSTQ check-back bit. Once the FM 350-1 has reset the FM_NEUST check-back bit, you can reset the NEUSTQ control bit. Figure 5-5 illustrates the restart coordination sequence.

Restart, FM 350-1 starts up Check-back bit FM_NEUST t Ctrl bit NEUSTQ t Check-back bit FM_NEUSTQ t Figure 5-5 Restart sequence

If you use a function, this function automatically coordinates the restart.

FM 350-1 Function Module A5E00073040-02

5-35

Programming the FM 350-1

5.7

Reaction to CPU STOP and CPU STOP-RUN

Reaction to CPU STOP


The behavior of the FM 350-1 when the higher-level controller fails is set using the Basic Parameters dialog.

Basic parameter STOP Continue Exit active job

FM 350-1 reaction to CPU STOP The FM cancels the counting operation and switches off the outputs. The FM continues working and does not switch off the outputs. For single counting, the counting operation is continued until it is ended by reaching the counting limit. For periodic counting, the current counting operation is continued until it is ended by reaching the counting limit. Measurements are cancelled immediately. The FM then switches off the outputs.

Substitute value

The current Count mode is cancelled. The module outputs the set substitute values to the digital outputs. The substitute values are retained after the CPU STOP-RUN transition until the next time the digital outputs are used. The outputs are reset when you change the Reaction to CPU STOP with new parameters. The current Measure mode is cancelled, and the outputs are reset.

Keep last value

The current Count mode or Measure mode is cancelled. The module outputs at the digital outputs the values that were valid at the time of canceling until the next time the digital outputs are used after the CPU STOP-RUN transition.

Reaction to New Parameters


The FM 350-1 behavior at the CPU transition from STOP to RUN if the job is continued or in response to plant changes during operation using CiR is set using the Basic Parameters dialog.

Basic parameter Always reset Only reset when parameters have been changed

FM 350-1 reaction to new parameters at the CPU STOP-RUN transition The FM cancels the counting and measuring operations, resets itself and accepts the new parameters. The FM only cancels the counting and measuring operations if the parameters have changed.

5-36

FM 350-1 Function Module A5E00073040-02

Programming in M7 with the Counter Function Library

Chapter Overview
If you use an FM 350-1, FM 450-1 counter module or an IF 961-CT1 interface submodule with a CPU from the M7-300/400 product range, you can create your application in the C programming language. This chapter describes how to create C application programs with the help of the counter function library. You will learn: which functions are available to you which structural principle a C application program has for the counter module how you use the functions of the counter function library in the program how to handle any errors occurring in the program sequence
Section 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 Overview Basic Program Structure Initializing and Parameterizing the Counter Channel Transferring the Load Value and Comparison Values Control of the Digital Inputs and Outputs Starting and Stopping the Counter Channel Reading the Counter Value and the Load Value, Scanning and Resetting the Status Processing Interrupts Processing Error Messages Descrition Page 6-2 6-4 6-5 6-8 6-9 6-10 6-12 6-13 6-14

FM 350-1 Function Module A5E00073040-02

6-1

Programming in M7 with the Counter Function Library

6.1

Overview

Overview of the Functions The counter function library offers you functions with which you can do the following: Initialize and parameterize the counter channel Transfer the load value and the comparison values Start and stop the counter channel Control digital inputs and outputs of the counter module Scan and reset the counter status Read the counter value Scan the diagnostics and error information The table below lists the functions in alphabetical order:

6-2


Function Description M7CntDisableOut M7CntDisableSet M7CntEnableOut M7CntEnableSet M7CntInit Disable outputs Disable SET input Enable outputs Enable SET input Initialize counter channel M7CntLoadAndStart M7CntLoadComp M7CntLoadDirect M7CntLoadPrep M7CntPar Load and start counter channel Transfer comparison values Load counter channel Prepare loading Parameterize counter channel Read counter value M7CntRead M7CntReadDiag Read diagnostics information Read load value M7CntReadLoadValue M7CntReadParError M7CntReadStatus Read parameterization error Read counter status M7CntResetStatus M7CntStart M7CntStop Reset counter status Start counter channel Stop counter channel M7CntStopAndRead Stop counter channel and read counter value
FM 350-1 Function Module A5E00073040-02

Programming in M7 with the Counter Function Library

In the following sections you will learn how to use these functions in the user program. This chapter does not contain a detailed description of the individual parameters or function arguments. Please see Chapter 11 for these.

Programming Environment All the system functions and standard functions of the M7-300/400 system software are available to you for programming in the Borland C/C++ development environment in STEP 7. System functions support you in the following, for example: Task management Memory management Communications Interrupt processing Diagnostics processing Responding to system states Accessing process I/O In addition, you can use the standard functions of the RMOS CRUN library. You will find descriptions of these functions in the M7-300/400 system software manuals.

Header File When creating a C program for counter control, you must link in the header file M7CNT.H in the declaration section. All other necessary header files are already linked when you work with Borland C programs.

FM 350-1 Function Module A5E00073040-02

6-3

Programming in M7 with the Counter Function Library

6.2

Basic Program Structure

Sequence The program structure for the counter module must be adapted to the requirements of your application. In most cases however, the program will contain the following functions in the sequence given, with most of the functions being optional. The only strict requirement is that you call the M7CntInit function once per channel before all other funcitons in the count library.

1 2 3 4

5 6 7 8

9 10

You can use all further functions of the counter function library if required in the user program in the sequence necessary for your application. The first two functions belong to the M7-API library.

Example The software package includes an example program that clearly illustrates use of the counter functions and makes it easier for you to start programming.

6-4


M7LinkIOAlarm (from M7-API) Trigger and handle process interrupts. Otherwise, no process interrupts are reported. M7LinkDiagAlarm (from M7-API) M7CntInit Trigger and handle diagnostics interrupts. Otherwise, no diagnostics interrupts are reported. Initialize counter channel (mandatory) M7CntPar Parameterize counter channel via the program. Otherwise, you can parameterize the counter channel under STEP 7 (see Parameter Assignment chapter 4). Communicate a load value to the counter channel. Otherwise, the counter channel starts with the value 0. Communicate comparison values to the counter channel. Otherwise, the comparison values are at 0. M7CntLoadDirect M7CntLoadComp M7CntEnableOut M7CntStart Enable outputs if you want to use the digital outputs of the counter channel. Start counter channel if you have set an operating mode with software gate. In the case of operating modes with hardware gate, you start the counter channel via the START digital input. Stop counter channel M7CntStop M7CntRead Read counter value, for example, for test purposes or further processing.
FM 350-1 Function Module A5E00073040-02

Function

Explanation

Programming in M7 with the Counter Function Library

6.3

Initializing and Parameterizing the Counter Channel

M7CntInit Initializing the Counter Channel Counter channels are initialized via the M7CntInit function. The M7CntInit function must be called once for each counter channel used. It assigns a logical channel number to the address of the counter channel. You specify the address of the counter channel as a parameter. It consists of the following: The module starting address With M7-300, you can specify the slot-dependent default starting address or an address parameterized with STEP 7. With M7-400, you specify the starting address parameterized with STEP 7. If you have assigned a symbol to the address, you can import this symbol into your user program (see ProC/C++ for M7-300/400 User Manual). Input type (always M7IO_IN or M7IO_OUT, it doesnt matter which) Channel number The channel number can take the following values: in the FM 350-1 and IF counters the value is equal to 1 (1 channel) in the FM 350-1 the value is {1/2} (2 channels)

Logical Channel Number The function supplies the logical channel number that you use for all further accesses to this counter channel.

Example
M7CntInit (CNTMODULEADDRESS, M7IO_IN, 1, &LogChannel)

The parameter &LogChannel contains the return value of the function, the logical channel number.

FM 350-1 Function Module A5E00073040-02

6-5

Programming in M7 with the Counter Function Library

Parameterizing the Counter Channel Parameterizing sets the counter module to the requirements of your application. You select the following, for example: The operating mode (with software gate or hardware gate) The sensor type (24 V or 5 V) The interrupt characteristics of the counter channel, etc. See Chapter 8 for explanations of the settings. The counter module must be parameterized. If a counter channel is not parameterized, you will receive an error message. There are two basic methods of parameterizing the counter channel: With STEP 7 With the M7CntPar function

Parameterizing with STEP 7 You can parameterize the counter module in a user-friendly manner via screen forms in STEP 7 (see Chapter 4). The parameterization data set with STEP 7 are transferred to the counter module when the M7-300/400 is started up. This means that you must execute a SIMATIC M7 restart each time you change the parameterization data. Note The parameters valid at any one time cannot be read out using STEP 7.

Parameterizing the Counter Channel with M7CntPar You can parameterize and reparameterize a counter channel via the user program using the M7CntPar function. You specify the new parameterization data in the M7CNT_PARAM structure when you call the M7CntPar function (see the function library). The function transfers the parameterization data to the counter module and the new settings become effective immediately.

6-6

FM 350-1 Function Module A5E00073040-02

Programming in M7 with the Counter Function Library

Note When you call the M7CntPar function, all the current parameterization data are always completely overwritten and no part parameterizations can be made. When reparameterizations are made, any previously stored input or output enables are lost. This means that the M7CntEnableSet and, for example, M7CntEnableOut functions may have to be called again after M7CntPar. Reparameterization overwrites already set comparison values and the load value. When reparameterizing with the M7CntPar function, counter pulses can also be lost. Reparameterization does not affect the other counter channel in the FM 350-1.

Parameterization Data Table 11-1 (page 11-34) shows you the assignments between the components of the M7CNT_PARAM structure and the parameterization data, data type, value range and default value.

FM 350-1 Function Module A5E00073040-02

6-7

Programming in M7 with the Counter Function Library

6.4

Transferring the Load Value and Comparison Values

Load Value You can specify a starting value, the load value (LoadVal) to the counter channel. The default load value is 0.

M7CntLoadDirect M7CntLoadPrep The load value can be transferred direct to the counter channel or it can be stored temporarily in the counter-internal load register. The counter channel can be loaded direct with the M7CntLoadDirect function. With the M7CntLoadPrep function, the load value is not transferred direct to the counter channel, but stored temporarily in the counter channel. The counter channel accepts the load value if: a hardware pulse exists at the SET or START input an overflow or underflow takes place and a periodic operating mode is set the M7CntStart function is called

Comparison Values You can use the comparison values to control the digital outputs and to trigger interrupts: As soon as the comparison value has been reached, an output can be set, thus triggering a control action. In addition, you can stipulate that a process interrupt is to be triggered as soon as a specific comparison value has been reached. You determine the behavior of the digital outputs via parameterization. chapter 8 contains a description of the possible settings and their effects. If you control the digital outputs with the comparison values, you must enable the digital outputs with the M7CntEnableOut function. This call is also required after reparameterization of the counter channel.

M7CntLoadComp You can transfer one or two comparison values to the counter channel with the M7CntLoadComp.

6-8

FM 350-1 Function Module A5E00073040-02

Programming in M7 with the Counter Function Library

6.5

Control of the Digital Inputs and Outputs

Digital Inputs The counter module has the digital inputs START, STOP, RESET (IF 961-CT1 only) and SET. If an operating mode with hardware gate control has been set, you can control the counter module via hardware signals. Using the SET digital input, the counter channel can be set to the load value via an external signal (see Chapter 8).

M7CntEnableSet The SET input is enabled with the M7CntEnableSet function. The SET input (or the associated loading of the counter channel) can be enabled for the up count direction, the down count direction or both count directions with only one function call.

M7CntDisableSet Analogously, the SET input can be disabled via the M7CntDisableSet function. The SET input can be disabled for the up count direction, the down count direction or both count directions with only one function call in the same way as it could be enabled.

Digital Outputs The counter module has two digital outputs (per counter channel) that you can use to trigger responses in the process independently of the CPU.

M7CntEnableOut With the M7CntEnableOut function, one output or two of two possible outputs can be enabled with a single function call. The function enables the physical output.

M7CntDisableOut With the M7CntDisableOut function, each output can be disabled individually or both outputs can be disabled simultaneously with a single function call.

FM 350-1 Function Module A5E00073040-02

6-9

Programming in M7 with the Counter Function Library

6.6

Starting and Stopping the Counter Channel

Starting the Counter Channel Depending on the operating mode, with hardware or software gate control, there are two methods of starting the counter channel: 1. Via the software gate with the M7CntStart function 2. Via the hardware gate by a signal at the START digital input. You set the operating mode via parameterization.

M7CntStart Using the M7CntStart, the counter channel is started via the software gate. The function opens the software gate.

M7CntLoadAndStart In addition, the counter channel can be started via the M7CntLoadAndStart function. When called, this function transfers a load value direct to the counter channel. Like M7CntStart, this function also starts the counter channel via the software gate. Note In the case of the operating modes with hardware gate control, the M7CntStart and M7CntLoadAndStart functions initiate a message pointing out an operator error.

Stopping the Counter Channel There are two methods of stopping the counter channel: 1. Via the software gate with one of the M7CntStop or M7CntStopandRead functions. 2. Via the hardware gate by a signal at the STOP digital input

M7CntStop The counter channel is stopped with the M7CntStop function. The gate stop function of the counter channel is switched on with this function. The function operates independent of the method of gate control (hardware gate or software gate).

6-10

FM 350-1 Function Module A5E00073040-02

Programming in M7 with the Counter Function Library

Note If a counter channel with hardware gate control is stopped with the M7CntStop function, the counter channel cannot be started until parameterization or reparameterization (M7CntPar function) has taken place.

M7CntStopAndRead The counter channel can also be stopped via the M7CntStopAndRead function. This function stops the counter channel and reads the counter status. The function is possible in all operating modes with gate control.

FM 350-1 Function Module A5E00073040-02

6-11

Programming in M7 with the Counter Function Library

6.7

Reading the Counter Value and the Load Value, Scanning and Resetting the Status

Scanning Information The functions listed below are used for scanning information such as Counter value Load value Counter status The counter status can be reset if required.

M7CntRead The counter status can be read with M7CntRead. The current status of the counter channel is read and stored in the pActCntV return parameter.

M7CntStop AndRead The M7CntStopAndRead function stops the counter channel and reads the counter status simultaneously. The current counter status is then stored in pActCntV.

M7CntRead LoadValue The load value of a counter channel can be read with M7CntReadLoadValue.

Scanning the Counter Status You can scan the status of the counter channel with the M7CntReadStatus function. The function returns the counter status. See the description of M7CntReadStatus in Chapter 11 for the meaning of the individual bits in the counter status. The function can be used, for example, to scan the zero pass to see if the counter channel is running, if the counter overflow has taken place, which counter direction is in force, etc.

Resetting the Counter Status Bits that have been set in M7CntReadStatus can be reset again via the M7CntResetStatus, in order, for example, to detect a renewed zero pass or a renewed counter synchronization (multiple setting via SET digital input).

6-12

FM 350-1 Function Module A5E00073040-02

Programming in M7 with the Counter Function Library

6.8

Processing Interrupts

Registering at the Interrupt Server Depending on the parameters assigned, the counter module can initiate process interrupts and/or diagnostics interrupts. In order to receive process interrupts and diagnostics interrupts, the counter channel must be registered with the interrupt server. For this purpose, you must call the following functions: M7LinkIOAlarm, to receive process interrupts M7LinkDiagAlarm, to receive diagnostics interrupts See the System Software for M7-300 and M7-400 Programming Manual for details of how to work with the interrupt server.

Evaluating Process Interrupts Your parameter assignments determine if the counter module is to initiate process interrupts and if so which process interrupts it is to initiate (see Table11-1). If required, you define the responses to process interrupts in the program.

Evaluating Diagnostics Interrupts If a diagnostics interrupt is signaled by the interrupt server you must evaluate the signal (data set DS0) in order to determine the cause of the interrupt. You can call the following functions from the counter function library to get additional information: M7CntReadDiag, if the diagnosis is Error in one channel. M7CntReadParError, if the diagnosis is Parameter assignment error.

M7CntReadDiag By calling the M7CntReadDiag function, you can scan additional information on the channel error. When the function is called, the diagnostics data set DS1 is read. Data set DS1 contains the additional channel-specific diagnostics information. The first 4 bytes of DS1 contain the current DS0 data set. The diagnostics interrupts and data sets DS0 and DS1 are explained in Chapter 12.

FM 350-1 Function Module A5E00073040-02

6-13

Programming in M7 with the Counter Function Library

M7CntRead ParError If the cause of the diagnostics interrupt is a parameter assignment error, you can scan more detailed information with the M7CntReadParError function. The M7CntReadParError function returns an error number that indicates a data error in the M7CNT_PARAM structure. From this you can determine which parameterization datum contains the error or has been assigned an illegal value and you can reparameterize the counter module accordingly.

6.9

Processing Error Messages

Error Messages If an error occurs during execution of a function, the function supplies an error number as a return value. You can determine the exact cause of the error with the help of this error number. See Chapter 12 for exact descriptions of the error numbers.

Error Numbers The table shows the ranges of the error numbers and tells you where you can find more detailed information on evaluating the error numbers:

6-14


Return Value Meaning Description in.. 0 No error 1 to 99 Operator error Chapter 12 Chapter 12 200 to 400 1 to 999 Parameter assignment error M7API function error (e.g. I/O configuration error) System Software for M7-300 and M7-400 Reference Manual Chapter 12 1000 to 1100 Error in the counter function library (e.g. channel number invalid)
FM 350-1 Function Module A5E00073040-02

Starting Up the FM 350-1

Chapter Overview This chapter contains the checklists for starting up the FM 350-1. These checklists enable you to: check all working steps prior to operating the module avoid operating faults in the module
Section 7.1 7.2 Description Mechanical Installation Checklist Parameter Assignment Checklist Page 7-2 7-4

FM 350-1 Function Module A5E00073040-02

7-1

Starting Up the FM 350-1

7.1

Mechanical Installation Checklist

Checklist Use the checklist below to check and document the working steps for mechanical installation of the FM 350-1.

Working Step Determine slot Slot 4 to 11 in rack 0 Slot 4 to 11 in rack 1 Slot 4 to 11 in rack 2 Slot 4 to 11 in rack 3 Determine counter signals (coding connector) Install FM 350-1 5V differential signals 24V signals

Options/Procedure

(X)

Position A Position D

1. 2. 3. 4.

Loosen neighboring module and connect expansion bus Hang module into position and tighten screw Attach slot number Install shield attachment

Select cables Connect 5 V encoders

Observe rules and specifications in Section 3.2 Incremental 5 V encoder with differential signals A, A, B, B, N and N Terminal 3 4 6 7 8 9 10 11 Name 1M AA* A BB* B NN* N Function Encoder supply ground Encoder signal A Encoder signal A Encoder signal B Encoder signal B Encoder signal N Encoder signal N

5.2 VDC 5.2 V encoder supply

7-2

FM 350-1 Function Module A5E00073040-02

Starting Up the FM 350-1

Working Step Connect 24 V encoders Incremental 24 V encoder

Options/Procedure Terminal 3 5 6 8 10 24 V pulse encoder without direction level (initiator/BERO) Terminal 3 5 6 24 V pulse encoder with direction level Terminal 3 5 6 8 Name 1M 24 VDC AA* BB* NN* Name 1M 24 VDC AA* Name 1M 24 VDC AA* BB* Name I0 I1 I2 Q0 Q1 Name 1L+ 1M 2L+ 2M Function Encoder supply ground 24 V encoder supply Encoder signal A * Encoder signal B * Encoder signal N * Function Encoder supply ground 24 V encoder supply Encoder signal A * Function Encoder supply ground 24 V encoder supply Encoder signal A * Direction level B* Function Digital input DI Start Digital input DI Stop Digital input DI Set Digital output DO0 Digital output DO1 Function 24 V auxiliary voltage Auxiliary voltage ground 24 V load voltage Load voltage ground

(X)

Wire digital inputs and digital outputs

Digital inputs and digital outputs

Terminal 13 14 15 17 18

Connecting the auxiliary voltage and the load voltage

Auxiliary voltage and load voltage

Terminal 1 2 19 20

FM 350-1 Function Module A5E00073040-02

7-3

Starting Up the FM 350-1

7.2

Parameter Assignment Checklist


Use the checklists below to check and document the working steps for parameterizing the FM 350-1.

Checklist for counting operating mode


Working Step Assign parameters to FM 350 1 in 350-1 HW CONFIG Options/Procedure Select encoders 5 V encoders with symmetric signals Monitoring A+B+N A+B A Non 24 V encoders with asymmetric signals ti i l max.count frequency v 200 kHz/w 2.5 ms v 20 kHz/w 25 ms Encoder inputs Sink output Source output/ pushpull 24 V encoders with pulse p lse train and direction signal max.count frequency v 200 kHz/w 2.5 ms v 20 kHz/w 25 ms Encoder inputs Sink output Source output/ pushpull 24 V initiator max.count frequency v 200 kHz/w 2.5 ms v 20 kHz/w 25 ms Encoder inputs Sink output Source output/ pushpull (X)

Internal 1 MHz time base


Signal evaluation Single Double Quadruple Frequency and direction Count direction normal inverted Set operating mode Continuous counting Single counting Periodic counting Set count range 0 to +32 Bit

7-4

FM 350-1 Function Module A5E00073040-02

Starting Up the FM 350-1

Working Step Set count range Assign parameters to 350-1 FM 350 1 in HW CONFIG Main counting direction (only with single counting or periodic eriodic counting) Gate control

Options/Procedure 31 to +31 Bit non up down Gateless Continuous counting only SW gate HW gate Latch Latch/retrigger Gate function cancel interrupt Latch positive edge negative edge both edges Determine the behavior of the digital inputs Hardware gate Level-controlled Hardware gate Edge-controlled Hardware gate Minimum pulse width w 2.5 ms w 25 ms Set counter Setting once Multiple setting Evaluate zero mark for setting Determine the behavior of the digital outputs Pulse duration Hysteresis Output DO0 0 to 500 ms 0 to 255 Inactive Active from comparison value 1 to overflow Active from comparison value 1 to underflow Active for Pulse duration when comparison value 1 is reached in up or down direction Active for Pulse duration when comparison value 1 is reached in up direction Active for Pulse duration when comparison value 1 is reached in down direction Substitute value for CPU stop 0 1

(X)

FM 350-1 Function Module A5E00073040-02

7-5

Starting Up the FM 350-1

Working Step Assign parameters to FM 350 1 350-1 in HWCONFIG In the S7 user proro gram Output DO1

Options/Procedure Inactive Active from comparison value 2 to overflow Active from comparison value 2 to underflow Active for Pulse duration when comparison value 2 is reached in up or down direction Active for Pulse duration when comparison value 2 is reached in up direction Active for Pulse duration when comparison value 2 is reached in down direction Switch at comparison values Substitute value for CPU stop t Select interrupts Interrupt on opening the gate (Hardware or software gate) Interrupt on closing the gate (Hardware or software gate) Interrupt in event of overflow Interrupt in event of underflow Interrupt in event of zero pass Interrupt on reaching comparison value 1 in up direction Interrupt on reaching comparison value 1 in down direction Interrupt on reaching comparison value 2 in up direction nterrupt on reaching comparison value 2 in down direction Interrupt on setting counter Interrupt on latch Enable digital outputs CTRL_DO0 in DB CTRL_DO1 in DB Enable synchronization ENSETUP in DB ENSETDN in DB Determine load value and comparison values and enter in DB Load value Comparison value 1 Comparison value 2 Link FCs into user program Link in FC CNT_CTL1 or FC CNT_CTL2 Link in FC DIAG_INF 0 1

(X)

7-6

FM 350-1 Function Module A5E00073040-02

Starting Up the FM 350-1

Checklist for measuring operating mode


Working Step Assign parameters to FM 350 1 i 350-1 in 5 V encoders with symHW CONFIG metric signals ti i l Options/Procedure Select encoders Monitoring A+B+N A+B A Non 24 V encoders with asymmetric signals ti i l max. count frequency f Encoder inputs v 200 kHz/w 2.5 ms v 20 kHz/w 25 ms Sink output Source output/ pushpull 24 V encoders with pulse p lse train and direction signal max. count frequency freq enc Encoder inputs v 200 kHz/w 2.5 ms v 20 kHz/w 25 ms Sink output Source output/ pushpull Count direction normal inverted Set operating mode Frequency measurement Rotational speed measurement Period measurement Update time Impulses per encoder revolution Resolution of period 1 ms 1/16 ms Gate control Gate control SW gate HW gate (X)

FM 350-1 Function Module A5E00073040-02

7-7

Starting Up the FM 350-1

Working Step

Options/Procedure

(X)

Assign parameters to Determine the behavior of the digital inputs FM 350 1 350-1 Hardware gate Level-controlled hardware gate in HWCONFIG Edge-controlled hardware gate Minimum pulse width w 2.5 ms w 25 ms Determine the behavior of the digital outputs Output DO0 Lower limit Upper limit No comparison Outside the range Below the lower limut Above the upper limit Select interrupts Interrupt on opening the gate (hardware or software gate) Interrupt on closing the gate (hardware or software gate) Interrupt on violation lower limit Interrupt on violation upper limit Interrupt at end of measurement In the S7 user program Enable digital outputs CTRL_DO0 in DB CTRL_DO1 in DB Determine load value and comparison values and enter in DB Lower limit Upper limit Update time Link FCs into user program Link in FC CNT_CTL1 or FC CNT_CTL2 Link in FC DIAG_INF

7-8

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

Chapter Overview You will find the following in this chapter: A description of the operating modes A description of the commands Marginal conditions and notes you must observe.
Section 8.1 8.2 8.3 8.3.1 8.3.2 8.3.3 8.3.4 8.3.5 8.3.6 8.3.7 8.3.8 8.3.9 8.3.10 8.3.11 8.3.12 8.4 8.4.1 8.4.2 8.4.3 8.4.4 8.4.5 8.4.6 8.4.7 8.5 Description Basic Information on Calling Operating Modes, Settings and Commands Isochrone Mode Count Modes What are the Count Modes? Definitions Continuous Counting Single Counting Periodic Counting Count Range Command: Open and Close Gate Behavior of the Digital Outputs Command: Set Counter Command: Latch/Retrigger Command: Latch Command: Measure the Times Between two Edges Measure Modes What are the Measure Modes? Definitions Frequency Measurement RPM Measurement Continuous Periodic Measurement Command: Open and Close Gate Behavior of the Digital Outputs Initiating a Process Interrupt Page 8-2 8-3 8-4 8-4 8-5 8-8 8-10 8-15 8-20 8-21 8-27 8-38 8-44 8-46 8-48 8-49 8-49 8-50 8-55 8-57 8-59 8-62 8-66 8-69

FM 350-1 Function Module A5E00073040-02

8-1

Operating Modes, Parameters and Commands

8.1

Basic Information on Calling Operating Modes, Settings and Commands

How Do You Select the Operating Modes?


You select the operating modes in the parameter assignment screen forms of the FM 350-1. The parameter assignment data are saved on the programming device and transferred automatically to the rack SDB. You will find information on how to install the parameter assignment screens and assign parameters to the FM 350-1 in the section entitled Assigning Parameters to the FM 350-1 and, after the software has been installed, in the online Help as well.

How Do You Change Operating Modes and Settings?


You can change an operating mode or setting in the parameter assignment screen forms. The new operating mode or setting becomes valid after the next FM 350-1 start-up.

How Do You Give Commands?


The commands are given either via hardware signals connected to the front connector, or you set the relevant input parameter of the FC CNT_CTL1 in the user program in order to influence the count. The input parameters are stored as control bits in the DB of the FC CNT_CTL1.

Control Bits and Status Bits in the DB


In addition to the control bits, there are status bits in the DB that signal the status of the counting and measuring processes. The DB has two bytes for the control bits and two bytes for the status bits (see Chapter 10).

Transferring the Control Bits and the Status Bits


You transfer the status bits and the control bits between the CPU and the module with the FC CNT_CTRL that you must link into your user program: The control bits and status bits should, if possible, be addressed symbolically in the user program. The symbolic names are used in the description of the FC in this chapter. You will find the precise description of the FC CNT_CTL1 in Chapter LEERER MERKER, Programming the FM 350-1 and you will find the DB assignments in Chapter 10.

8-2

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

8.2

Isochrone Mode

Note The principles of isochrone mode are described in a separate manual.

Hardware Requirements
To use the FM 350-1 in isochrone mode, you will need: a CPU that supports isochrone mode a DP master that support the equidistant bus cycle

Properties
Depending on the configuration, the FM 350-1 works in either non-isochrone or isochrone mode. The default is non-isochrone mode. If configured appropriately, the FM 350-1 automatically switches to isochrone mode without signaling the change. In isochrone mode, the exchange of data between the DP master and FM 350-1 is isochronous with the PROFIBUS DP cycle, i.e.: All control signals transferred to the FM 350-1 take effect at the time To within the same PROFIBUS DP cycle. All values and FM 350-1 status bits recorded at the time Ti are made available at the feedback interface in the same PROFIBUS DP cycle. In isochrone mode, all 16 bytes of the feedback interface are consistent, i.e. the values and status bits always match one another. The counter value, which is affected by digital input signals, such as Load counter by opening the hardware gate, Load counter by synchronization, Latch and latch/retrigger a counter value can then only take effect in the same PROFIBUS DP cycle if the event occurred before time Ti within this PROFIBUS DP cycle. A parameter assignment error will prevent the FM 350-1 switching to isochrone mode. If isochrone mode is lost due to a fault or due to failure / delay of Global Control (GC), the FM 350-1 returns to isochrone mode in the next cycle without responding to the fault. The feedback interface is not updated if isochrone mode is lost.

FM 350-1 Function Module A5E00073040-02

8-3

Operating Modes, Parameters and Commands

8.3

Count Modes

8.3.1

What are the Count Modes?


When you specify an operating mode, you decide the functionality with which the FM 350-1 is to work. Table 8-1 contains an overview of the Count modes.
Table 8-1 The FM 350-1 Count modes Designation Continuous counting with or without SW gate or HW gate See section 8.3.3, page 8-8 Single counting with SW gate or HW gate See section 8.3.4, page 8-10 Periodic counting with SW gate or HW gate See section 8.3.5, page 8-15 When the gate opens, the FM 350-1 counts between the load value and the counting limit. When the gate opens, the FM 350-1 counts from the load value to the counting limit. Description The FM 350-1 counts continuously from the current counter level.

You must set the FM 350-1 parameters in order to run one of these operating modes (see the 4 and 7 section).

8-4

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

8.3.2

Definitions

Load Value
You can assign a load value LOAD_VAL to the FM 350-1 during operation. This will overwrite the starting count. You can assign this load value directly (control signal L_DIRECT). It is then accepted directly by the FM 350-1 as a new counter value and loaded in preparation. You can load the load value in preparation only (control signal L_PREPAR). A load value that is loaded in preparation is accepted by the FM 350-1 as a new counter value in response to the following events: In the single counting and periodic counting Count modes When the upper or lower limit is reached if no main counting direction is set. When the set upper counting limit is reached for main counting direction up. When 0 is reached for main counting direction down. In all Count modes The counting process is started by the interrupting SW or HW gate (the load value is not accepted when the counting continues). Synchronization Latch/retrigger

Gate Control
You can use the hardware gate (HW gate) and software gate (SW gate) to control the FM 350-1 counting processes.

FM 350-1 Function Module A5E00073040-02

8-5

Operating Modes, Parameters and Commands

Maximum Count Range without Main Counting Direction


The 32-bit binary counter of the FM 350-1 can work in two different modes, depending on the parameter assignments: 0 to +32-bit mode (32-bit unsigned) Hexadecimal count range: 0000 0000 Decimal count range: 0 to FFFF FFFF to +4 294 967 295

An overflow is detected when the counter value (hexadecimal) changes from FFFF FFFF to 0, and an underflow is detected when it changes from 0 to FFFF FFFF. 31 to +31-bit mode (31-bit signed) Hexadecimal count range: 8000 0000 to 7FFF FFFF Decimal count range: 2 147 483 648 to +2 147 483 647 An overflow is detected when the counter value (hexadecimal) changes from 7 FFF FFFF to 8000 000, and an underflow is detected when it changes from 8 000 0000 to 7FFF FFFF.

Main Counting Direction:


When you set a main counting direction (up or down), you can limit the maximum count range to a smaller range by setting the upper count limit. The set count range is then between 0 and the set upper counter limit. This can be used to create incrementing or decrementing counting applications, for example. The set main counting direction has no effect on the direction evaluation when the count pulses are detected.

Starting Counts According to Parameter Assignment


Table 8-2 Starting count Value Load value Main counting direction: none up down none up down Starting count 0 0 set upper count limit 0 0 set upper count limit 0 0 set upper count limit 0 0 set upper count limit

Counter value

Comparison value 1 and 2 none up down Latch value none up down

8-6

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

Isochrone Mode
In isochrone mode, the FM 350-1 accepts control bits and control values from the control interface in each PROFIBUS DP cycle and returns its response to them within the same cycle. In each cycle, the FM 350-1 sends the counter value or latch value that was valid at the time Ti and the status bits that were valid at the time Ti. Thus, a counter level that is affected by hardware input signals can only be transferred in the same cycle if the input signal occurs before the time Ti.

What are the Commands?


You can apply five commands to the FM 350-1 counting process during operation. Table 8-3 contains an overview of these commands.
Table 8-3 The FM 350-1 commands Description The counting process starts when a gate opens and ends when it closes. The counter can be set to the load value using various signals. Saves the counter level and loads the counter with the load value in response to a positive edge at Start DI. Saves the counter level in response to a positive edge at Start DI. Measures the times between two immediately successive edges at the Start DI digital input.

Designation Open and close gate Set counter Latch/retrigger Latch Measure times between two edges

FM 350-1 Function Module A5E00073040-02

8-7

Operating Modes, Parameters and Commands

8.3.3

Continuous Counting

Definition
In this operating mode, the FM 350-1 counts continuously from the count: If the counter reaches the upper limit when counting up and a further count pulse is received, it jumps to the lower count limit and continues to count from there without any pulse losses. If the counter reaches the lower limit when counting down and a further count pulse is received, it jumps to the upper limit and continues to count from there without any pulse losses. The upper count limit is set to +2,147,483,647 (231 1). The lower count limit is set to 2,147,483,648 (231).

Behavior at the Count Limits


If the counter reaches the upper or lower count limit and a further count pulse is received, then the counter is set to the other count limit. An appropriate status bit is set in the DB.
Count limit reached Upper count limit Lower count limit Status bit in the DB STS_OFLW is set STS_UFLW is set

Selecting the Gate Control


You can select the gate control in this mode. The following options are available: Without gate (default) Software gate Hardware gate, level-controlled or edge-controlled
Counter status Upper count limit

Current counter limit Lower count limit Gate start Figure 8-1 Continuous counting with gate control Gate stop Time

8-8

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

Opening and Closing the Software Gate


You open and close the software gate of the counter in each case with the input parameter SW_GATE of the FC CNT_CTL1.
Action Open software gate Close software gate ...Is Initiated By Setting SW_GATE Resetting SW_GATE

Opening and Closing the Hardware Gate


You open and close the hardware gate by applying the relevant signals to or removing the signals from digital inputs DI Start and DI Stop.
Action Open hardware gate (level-controlled) Close hardware gate (level-controlled) Open hardware gate (edge-controlled) Close hardware gate (edge-controlled) ...Is Initiated By Apply signal to digital input DI Start Remove signal from digital input DI Start Apply positive pulse edge across digital input DI Start Apply positive pulse edge across digital input DI Stop

When the hardware gate opens, the counting operation resumes with the current counter level.

Terminating the Count with the Gate Stop Function


You can also terminate the count when counting with the software gate or hardware gate by using the gate stop function. Set input parameter GATE_STP of FC CNT_CTL1 (see Section 5.3) for this purpose.

Effects of the Latch Setting on the Counter at the Beginning of a Count Operation
See section 8.3.10 on page 8-44 and section 8.3.11 on page 8-46.

FM 350-1 Function Module A5E00073040-02

8-9

Operating Modes, Parameters and Commands

8.3.4

Single Counting

Overview
In this operating mode, the FM 350-1 counts once in the set main counting direction. You can program the following behavior: Single counting No main counting direction Single counting Main counting direction up Single counting Main counting direction down

Single Counting No Main Counting Direction


In single counting mode without a main counting direction, when the gate is opened, the FM 350-1 counts up or down from the load value until one of the count limit is exceeded. If one of the count limit is exceeded, the gate is closed, the STS_OFLW or STS_UFLW bit in the feedback interface is set, the counter is loaded to the other count limit. The count limits are fixed at the maximum count range. The STS_ZERO bit is set if the counter level is zero. You must open the gate again to restart the counting.

Counter level Max. upper count limit

STS_OFLW

Load value 0 Max. count range Max Lower count limit Gate start Gate start Automatic gate stop STS_ZERO

STS_UFLW Time Automatic gate stop

Figure 8-2

Single counting without main counting direction; Cancel gate function

8-10

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

Single Counting - Main Counting Direction Up


In single counting mode with main counting direction up, when the gate is opened, the FM 350-1 counts up or down from the load value until the upper count limit is exceeded. If the upper count limit is exceeded, the gate is closed, the STS_OFLW bit in the feedback interface is set, the counter is loaded with the load value. The upper count limit can be set. The load value has a starting count and can be changed. You must open the gate again to restart the counting.

Counter level Set upper count limit Set count range Load value STS_OFLW

Lower count limit = 0

Gate start Gate start Automatic gate stop Figure 8-3

Time Automatic gate stop

Single counting without main counting direction; Cancel gate function

FM 350-1 Function Module A5E00073040-02

8-11

Operating Modes, Parameters and Commands

Single Counting - Main Counting Direction Down


In single counting mode with main counting direction down, when the gate is opened, the FM 350-1 counts up or down from the load value until the lower count limit is exceeded. If the lower count limit is under-run, the gate is closed, the STS_UFLW bit in the feedback interface is set, the counter is loaded with the load value. The lower count limit is 0. The load value has a starting count and can be changed. You must open the gate again to restart the counting.

Counter level Set upper count limit Set count range

Load value

Lower count limit = 0 Gate start Gate start Automatic gate stop Figure 8-4

STS_UFLW

Time Automatic gate stop

Single counting with main counting direction down; Cancel gate function

8-12

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

Selecting the Gate Control


You can select the gate control in this mode. The following options are available: Software gate Hardware gate, level-controlled or edge-controlled
Counter level STS_OFLW Upper count limit Load value Lower count limit Gate start Gate stop Figure 8-5 Gate start Time

Single Counting with Load Value and gate control

Opening and Closing the Software Gate


You open and close the software gate and set the counter to the load value with the input parameter SW_GATE of the FC CNT_CTL1.
Action Open software gate Close software gate ...Is Initialized By Setting SW_GATE Resetting SW_GATE

Opening and Closing the Hardware Gate


You open and close the hardware gate and set the counter to the load value by applying and removing the corresponding signals to and from digital inputs DI Start and DI Stop.
Action Open hardware gate (level-controlled) Open hardware gate (edge-controlled) Close hardware gate (level-controlled) Close hardware gate (edge-controlled) ...Is Initiated By Apply signal to digital input DI Start Apply positive pulse edge across digital input DI Start Remove signal from digital input DI Start Apply positive pulse edge across digital input DI Stop

With a level-controlled hardware gate, the renewed opening of the gate and setting of the counter to the load value is performed by a signal across DI Start. If a positive pulse edge is reapplied across DI Start in the case of an edge-controlled hardware gate, the counter will again start counting from the load value, irrespective of whether the gate is closed or still open (retrigger); that is, provided that the DI Stop is not set.
FM 350-1 Function Module A5E00073040-02

8-13

Operating Modes, Parameters and Commands

Behavior at the Count Limits


If the counter has reached the upper or lower count limit and a further count pulse is received, the counter is set to the other count limit when counting without a main counting direction to the load value when counting with a main counting direction The gate is then closed and the count is terminated even if the SW_GATE parameter is still set or the hardware gate is still open. An appropriate status bit is set in the DB.
Count Limit Reached Upper count limit Lower count limit

Status bit in the DB


STS_OFLW is set STS_UFLW is set

If you wish to restart the counter, you must reset the SW_GATE parameter or reopen the HW gate. The counting process is then continued from the load value.

Terminating the Count with the Gate Stop Function


You can also terminate the count at any time with the gate stop function. For this purpose, set the input parameter GATE_STP of the FC CNT_CTL1.

8-14

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

8.3.5

Periodic Counting

Overview
In this operating mode, the FM 350-1 counts periodically when the gate is open. You can program the following behavior: Periodic counting No main counting direction Periodic counting Main counting direction up Periodic counting Main counting direction down

Periodic Counting No Main Counting Direction


In periodic counting mode without a main counting direction, when the gate is opened, the FM 350-1 counts up or down from the load value until one of the count limit is exceeded. If one of the count limit is exceeded, the STS_OFLW or STS_UFLW bit in the feedback interface is set, the counter is set to the load value from which it resumes counting. The count limits are fixed at the maximum count range. The STS_ZERO bit is set if the counter level is zero. The counting is resumed when the gate is closed.

Counter level Max. upper count limit

STS_OFLW

Load value Max. count range Max Lower count limit Gate start Gate stop 0 STS_ZERO

STS_UFLW Time

Figure 8-6

Periodic counting without main counting direction

FM 350-1 Function Module A5E00073040-02

8-15

Operating Modes, Parameters and Commands

Periodic Counting - Main Counting Direction Up


In periodic counting mode with main counting direction up, when the gate is opened, the FM 350-1 counts up or down from the load value until the upper count limit is exceeded. If the upper count limit is exceeded, the STS_OFLW bit in the feedback interface is set, the counter is set to the load value from which it resumes counting. The upper count limit can be set. The load value has a starting count and can be changed. The counting is resumed when the gate is closed.

Counter level Set upper count limit Load value Set count range STS_OFLW

Lower count limit = 0 Gate start Gate stop Time

Figure 8-7

Periodic counting with main counting direction up

8-16

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

Periodic Counting - Main Counting Direction Down


In periodic counting mode with main counting direction down, when the gate is opened, the FM 350-1 counts up or down from the load value until the lower count limit is exceeded. If the lower count limit is under-run, the STS_UFLW bit in the feedback interface is set, the counter is set to the load value from which it resumes counting. The lower count limit is 0. The load value has a starting count and can be changed. The counting is resumed when the gate is closed.

Counter level Set upper count limit

Set count range Load value Lower count limit = 0 Gate start Gate stop

STS_UFLW Time

Figure 8-8

Periodic counting with main counting direction down

FM 350-1 Function Module A5E00073040-02

8-17

Operating Modes, Parameters and Commands

Selecting the Gate Control


You can select the gate control in this mode. The following options are available: Software gate Hardware gate, level-controlled or edge-controlled
Counter level Upper count limit Load value Lower count limit Gate start Figure 8-9 Gate stop Time

Periodic Counting with Load Value and gate control

Opening and Closing the Software Gate


You open and close the software gate and set the counter to the load value with input parameter SW-GATE of the FC CNT_CTL1.
Action Open software gate Close software gate ...Is Initiated By Setting SW_GATE Resetting SW_GATE

Opening and Closing the Hardware Gate


You open and close the hardware gate and set the counter to the load value by applying and removing the corresponding signals to and from digital inputs DI Start and DI Stop.
Action Open hardware gate (level-controlled) Open hardware gate (edge-controlled) Close hardware gate (level-controlled) Close hardware gate (edge-controlled) ...Is Initiated By Apply signal to digital input DI Start Apply positive pulse edge across digital input DI Start Remove signal from digital input DI Start Apply positive pulse edge across digital input DI Stop

With a level-controlled hardware gate, the renewed opening of the gate and setting of the counter to the load value is performed by a signal across DI Start. If a positive pulse edge is reapplied across DI Start in the case of an edge-controlled hardware gate, the counter will again start counting from the load value, irrespective of whether the gate is closed or still open (retrigger); that is, provided that the DI Stop is not set.
FM 350-1 Function Module A5E00073040-02

8-18

Operating Modes, Parameters and Commands

Behavior at the Count Limits


If the counter has reached the upper or lower count limit and a further count pulse is received, the counter is set to the other count limit when counting without a main counting direction to the load value when counting with a main counting direction The gate is then closed and the count is terminated even if the SW_GATE parameter is still set or the hardware gate is still open. An appropriate status bit is set in the DB.
Count Limit Reached Upper count limit Lower count limit Status bit in the DB STS_OFLW is set STS_UFLW is set

Ending the Counting Operation with the Gate Stop Function


You can also end the counting operation using the gate stop function by setting the GATE_STP input parameters of the CNT_CTL1 function.

FM 350-1 Function Module A5E00073040-02

8-19

Operating Modes, Parameters and Commands

8.3.6

Count Range

Introduction
There is a 32-bit wide count register on the module. With the Count range, you select whether the module is to count only in the positive range or whether the 32nd bit is interpreted as a sign bit thus allowing negative numbers to be represented. You can only select a count range if no main counting direction is set.

Count Ranges
The FM 350-1 counts in different count ranges at the two count range limits. An overflow or an underflow is detected at the respective count limits. In the 31 to +31 Bit count mode, the counter status is represented in 2s complement.
Count range 0 to +32 bit* 31 to +31 bit 0 to 4,294,967,295 0 to FFFF FFFFH 2,147,483,648 to 2,147,483,647 8000 0000H to 7FFF FFFFH Overflow When the counter status changes from 4,294,967,295 to 0 When the counter status changes from +2,147,483,647 to 2,147,483,648 Underflow When the counter status changes from 0 to 4,294,967,295 When the counter status changes from to 2,147,483,648 to +2,147,483,647

*In this count range, you can only specify and evaluate hexadecimal values.

Overflow, Underflow and Zero Pass


At both count limits, a bit is set in the DB of the FC CNT_CTRL1 in the event of overflow and underflow (see Chapter 10). At the 31 to +31-bit count range limit, a bit is similarly set in the DB with a zero pass. At the 0 to +32bit count range limit, an overflow or underflow, depending on the direction of counting, is additionally indicated upon zero pass.
Event Overflow Underflow Zero pass Status Bit in DB STS_OFLW is set STS_UFLW is set STS_ZERO is set

Initiating Process Interrupts


You can also signal the overflow, underflow and zero pass events via process interrupts.
FM 350-1 Function Module A5E00073040-02

8-20

Operating Modes, Parameters and Commands

8.3.7

Command: Open and Close Gate

Introduction
The FM 350-1 has the following gates: A hardware gate that you can operate either with level control or with edge control. A software gate that you can open and close via control bits in the user program.

Selecting the Gate


When you select the operating mode, you define which gate you want to use for the count. The figures below represent the different methods of opening and closing the gates of the FM 350-1.

Level-Controlled Opening and Closing of the Hardware Gate


Figure 8-10 shows level-controlled opening and closing of the hardware gate.

Counter status 1 Count pulses DI Start Open gate Close gate 2 3 4 4

Figure 8-10

Level-Controlled Opening and Closing of the Hardware Gate

The count pulses can reach the counter and are counted while digital input DI Start is set. The gate is closed if the Start DI digital input is reset. The count pulses are no longer counted, the counter comes to a halt. If the gate is closed by an overflow or an underflow, you must first reset digital input DI Start and then set it back again in order to open the gate once more. The level-controlled hardware gate becomes active upon the first positive pulse edge across DI Start following parameter assignment. With this parameter assignment, the Stop DI input is not evaluated. It is merely displayed in the status bit STS_STP.

FM 350-1 Function Module A5E00073040-02

8-21

Operating Modes, Parameters and Commands

Edge-Controlled Opening and Closing of the Hardware Gate


Figure 8-11 shows edge-controlled opening and closing of the hardware gate.

1 Count pulses DI Start

Counter status 4

Open gate

DI Stop
Close gate

Figure 8-11

Edge-Controlled Opening and Closing of the Hardware Gate

With the edge-controlled gate, the hardware gate is opened by a positive pulse edge at digital input DI Start. The gate is closed by a positive pulse edge at digital input DI Stop. With simultaneous positive pulse edges at both inputs, an open gate is closed and a closed gate remains closed. If digital input DI Stop is set, a positive pulse edge at digital input DI Start cannot open the gate.

Status of Inputs DI Start and DI Stop


The status of the two inputs DI Start and DI Stop is indicated on green LEDs I0 and I1 and within the user program in bits STS_STA and STS_STP of the DB of the FC CNT_CTL1.

Status of the Gate


The status of the gate is indicated within the user program in the STS_GATE bit.

8-22

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

Opening and Closing the Software Gate


Figure 8-12 shows opening and closing of the software gate.

Counter status 1 Count pulses SW_GATE Bit set Bit reset 2 3 4 4

Figure 8-12

Opening and Closing of the Software Gate

The software gate is opened and closed by setting and resetting the SW_GATE input parameter of the FC CNT_CTL1. The closed gate can be reopened by setting input parameter SW_GATE again. Edge-controlled opening and closing of the software gate is not possible.

Status of the Software Gate


The status of the software gate is indicated in bit STS_SW_G of the DB of the FC CNT_CTL1.

FM 350-1 Function Module A5E00073040-02

8-23

Operating Modes, Parameters and Commands

Cancel and Interrupt Gate Function


When you program the gate function, you can define whether the gate should cancel or interrupt the counting process. With a Cancel gate function, the counting starts when the gate is closed, and starts again from the load value at the next gate start (time (1) in figure 8-13):

Counter level (1) Upper count limit Load value Lower count limit Gate start Gate stop Gate start Time

Figure 8-13

Continuous counting, down, Cancel gate function

With an Interrupt gate function, the counting starts when the gate is closed, and continues from the last current counter value at the next gate start (time (1) in figure 8-14):

Counter level Upper count limit Load value Lower count limit Gate start

(1)

Gate stop

Gate start

Time

Figure 8-14

Continuous counting, down, Interrupt gate function

Terminating the Count with the Gate Stop Function


You can also terminate the count with the gate stop function of the relevant counter regardless of the signals applied or the status of the software gate. For this purpose, set the GATE_STP input parameter of the FC_CNT_CTL1. If you reset this parameter, you can only open the gate again by means of a positive pulse edge at digital input DI Start (hardware gate) or by setting the input parameter SW_GATE (software gate) once more.

8-24

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

Gate Control in Isochrone Mode


Gate control with the SW gate: For control with the SW gate, you set and reset the SW_GATE control bit in the user program. The counting process then starts and ends at the time To in the next PROFIBUS DP cycle after the control bit is changed (Figure 8-15).

DP cycle TDP To SW_GATE Ti

DP cycle TDP To Ti

DP cycle TDP To Ti

DP cycle TDP To Ti

DP cycle TDP To Ti

STS_GATE

Count

1)

1)

1)

1)

2)

1) Availability of current count value 2) Availability of count value that was valid at end of the counting operation Figure 8-15 Starting and stopping the counting operation with the SW gate (SW_GATE)

Gate control with the HW gate: For control with the HW gate, the counting process starts and ends immediately after the HW gate is opened or closed (Figure 8-16).

DP cycle TDP To HWGate Ti

DP cycle TDP To Ti

DP cycle TDP To Ti

DP cycle TDP To Ti

DP cycle TDP To Ti

STS_GATE

Count

1)

1)

2)

1)

1)

1) Availability of current count value 2) Availability of count value that was valid at end of the counting operation Figure 8-16 Starting and stopping the counting process with the HW gate (HW_GATE)

FM 350-1 Function Module A5E00073040-02

8-25

Operating Modes, Parameters and Commands

Process Interrupt
Opening and closing of a gate (hardware or software) can be used to initiate a process interrupt (see Chapter 8.5).

Default Setting
In the default setting, all gates are open and the count pulses are counted.

8-26

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

8.3.8

Behavior of the Digital Outputs

Introduction
You can store two comparison values (comparison value 1 and 2) on the module for each counter. These comparison values are assigned to the two digital outputs (comparison value 1: DO0 , comparison value 2: DO1). The relevant output can be set depending on the counter status and the comparison value. This section describes the behavior of the outputs.

Comparison Values 1 and 2


You enter the two comparison values in the DB of the FC CNT_CTL1 (CMP_V1, CMP_V2) and transfer them to the FM 350-1 by setting the bits T_CMP_V1 or T_CMP_V2 (see Chapter 10). The count is not affected by this. The comparison values must be within the limits of the selected count range. The comparison value is interpreted according to the selected count range. If you give FFFF FFFF H, for example, as the comparison value, the number is interpreted as 4,294,967,295 in 32-bit mode, and as 1 in +31-bit mode. The following ranges of values are permitted for the comparison values:
Range of values for comparison values Lower limit Upper limit Main counting direction: None Maximum lower count limit Maximum upper count limit Up 231 Programmed upper count limit 1 Down 1 231 1

Enabling the Outputs


Before the outputs can be set, you must enable them first by setting the relevant bits in the DB (see Chapter 10). If you reset one of these bits the associated output is switched off immediately even if you have parameterized a pulse duration for them. Output
DO0 DO1 CTRL_DO0 CTRL_DO1

...Is Enabled By

FM 350-1 Function Module A5E00073040-02

8-27

Operating Modes, Parameters and Commands

Setting and Resetting the Outputs


If you set the behavior of an output to Inactive, you can set and reset enabled outputs using the appropriate bits in the DB.
Output DO0 DO1 is set by SET_DO0 = 1 SET_DO1 = 1 is reset by SET_DO0 = 0 SET_DO1 = 0

Behavior of the Outputs


For both digital outputs you can program one of 6 possible responses to reaching the comparison value. The various possibilities are shown in the table below.

Digital output parameter assignments Inactive

Behavior of the digital outputs

Underflow

Comparison value

Overflow

The output remains deactivated and is not affected by the comparison value, zero pass, overflow or underflow events. The output DOx may be used purely as a digital output. When enabled, it can be set and reset with the SET_DOx bit. Active from comparison value to overflow *
Underflow Comparison value Overflow

The output is activated if the counter is in the range between the comparison value n and overflow. Setting the counter to a value between the comparison value and overflow activates the output. Active from comparison value to underflow *
Underflow Comparison value Overflow

The output is activated if the counter is in the range between the comparison value and underflow. Setting the counter to a value between the comparison value and underflow activates the output. Active when up limit exceeded *
Underflow

Comparison value

Overflow

8-28

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

Digital output parameter assignments

Behavior of the digital outputs

The output is set to 1 for the period of the pulse duration when the counter reaches the comparison value while counting up. This requires either:

Main counting direction, none Main counting direction, up


Active when down limit exceeded *
Underflow t

Comparison value

Overflow

The output is set to 1 for the period of the pulse duration when the counter reaches the comparison value while counting down. This requires either:

Main counting direction, none Main counting direction, down


Active when up/down limit exceeded *
Up t t Down

Underflow Comparison value Overflow

Underflow Comparison value Overflow

The output is set to 1 for the period of the pulse duration, regardless of the counting direction, when the counter reaches the comparison value while counting down. Requirement:

Main counting direction, none


DO1: Switch to comparison value This deactivates DO0 Output DO1 switches when the counter level is between two comparison values (see figures 8-17 and 8-18 on pages 8-31 and 8-32).
Underflow Comp. value 1 Overflow Comp. value 2 Underflow Overflow

Comp. value 2 Comp. value 1

* Please note the marginal conditions on the next page


= output active

t = pulse duration

FM 350-1 Function Module A5E00073040-02

8-29

Operating Modes, Parameters and Commands

Status of the outputs and status bits


The status of the two outputs is indicated by the green LEDs and the corresponding status bits in the DB.
Table 8-4 Output DO0 Enable bit CTRL_DO0 0 1 Fulfilled 0 1 Status bit STS_COMP1 0 0 1 1 Status bit STS_CMP1/Ou tput DO0 0 0 0 1 LED DO0

Comparison condition Not fulfilled

Out Out Out Lit

Table 8-5

Output DO1 Enable bit CTRL_DO1 0 1 Status bit STS_COMP2 0 0 1 1 Status bit STS_CMP2/Ou tput DO1 0 0 0 1 LED DO1

Comparison condition Not fulfilled

Out Out Out Lit

Fulfilled

0 1

Status bits STS_CMP1 and STS_CMP2 indicate the current status of outputs DO0 and DO1. If enabled, they are set by CTRL_DO0 and CTRL_DO1 if a comparison condition is fulfilled and are reset if the condition is not fulfilled. Status bits STS_COMP1 and STS_COMP2 are set by CTRL_DO0 and CTRL_DO1 if a comparison condition is fulfilled, regardless of whether they are enabled, and remain set until you acknowledge the status bits with RES_ZERO.

8-30

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

Switch to Comparison Value


Output DO1 switches at two comparison values if the following conditions are fulfilled: You have set the behavior of DO0 to Inactive. You have set the behavior of DO1 to Active for switching to comparison values. You have loaded the two comparison values CMP_V1 and CMP_2. You have enabled output DO1 with CRTL_DO1. The following table shows when DO1 is activated and deactivated:
Comparison values CMP_V1 and CMP_V2 CMP_V1 < CMP_V2 (see figure 8-17) CMP_V1 = CMP_V2 CMP_V1 > CMP_V2 (see figure 8-18) DO1 is activated if CMP_V1 counter level CMP_V2 CMP_V1 = counter level = CMP_V2 Counter level < CMP_V2 or counter level > CMP_V1 DO1 is deactivated if Counter level < CMP_V1 or counter level > CMP_V2 CMP_V1 counter level CMP_V2 CMP_V2 counter level CMP_V1

The result of the comparison is indicated by the status bit STS_COMP2. You cannot acknowledge and thus reset the status bit STS_COMP2 until the comparison condition is no longer fulfilled. The status of the DO1 output is indicated by the status bit STS_CMP2. There is no hysteresis with this output behavior. With this output behavior, it is not possible to control output DO1 with the SET_DO1 control bit.

Counter level CMP_V2 CMP_V1

DO1 t Figure 8-17 At the start of the counting process, V2 > V1

FM 350-1 Function Module A5E00073040-02

8-31

Operating Modes, Parameters and Commands

Counter level CMP_V1 CMP_V2

DO1 t Figure 8-18 At the start of the counting process, V1 > V2

Pulse Duration
You can set a pulse duration in order to adapt to the actuators (contactors, actuators, etc) used in your process. The pulse duration indicates how long outputs DO0 and DO1 are active when a comparison value is reached. If main counting direction up or main counting direction down is set, then the pulse duration is only active in the main counting direction. If no main counting direction is set, then the pulse duration can be active in both counting directions. The pulse duration starts when the output is set. The inaccuracy of the pulse duration is less than 1 ms. A value between 0 and 500 ms may be set for the pulse duration. This value applies to both outputs together. If the pulse duration = 0 ms, the output is set when the comparison value is reached and is reset at the next count pulse. The default pulse duration is 0.

8-32

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

Note If you set pulse duration = 0 ms, the output remains active until the counter level is equal to the comparison value.Control pulses may be lost at the outputs if the time interval between the count pulses is less than the switching times of the digital outputs (up to 300 ms). You should therefore make sure that the interval between the count pulses is greater than the switching times of the digital outputs.

Switching time 300 ms max. Count pulses DO1 switches with max. 300 ms delay

Switching time 300 ms max.

Count pulses

DO1 does not switch Count value= Comparsion value Figure 8-19 Reactions of an output for a pulse duration 0 ms

FM 350-1 Function Module A5E00073040-02

8-33

Operating Modes, Parameters and Commands

Marginal conditions for the behavior of the digital outputs


If you parameterize the behavior of the digital outputs, you must observe the following marginal conditions.
Table 8-6 Marginal conditions for the behavior of the digital outputs If... ...you want to parameterize an output Active from comparison value to overflow or underflow Then... ...you must ensure that the time between these events is greater than the minimum switching time of the outputs (switching time: 300 ms); otherwise, the control pulses at the outputs are lost. If the counter status reaches the relevant comparison value again while the output is still active, no new pulse is initiated. A further pulse can only be initiated when the output is no longer active. ...you want to parameterize an output Active ...you must not enable a process interrupt on from comparison value to overflow Reaching the relevant comparison value up or down. ...you want to parameterize an output Active ...you must not enable a process interrupt on from comparison value to underflow Reaching the relevant comparison value up or down. ...you want to parameterize an output Active on exceeding up limit ...you want to parameterize an output Active on exceeding down limit ...you must not enable a process interrupt on Reaching the relevant comparison value down. ...you must not enable a process interrupt on Reaching the (relevant) comparison value up.

Default Setting
The outputs are switched off in the default setting.

Behavior of the Digital Outputs in Isochrone Mode


In isochrone mode, the outputs DO0 and DO1 switch immediately after the comparison conditions are fulfilled, and are thus independent of the PROFIBUS DP cycle. Exception: If you have set the behavior of the digital outputs to inactive and, after enabling with CTRL_DO0 or CTRL_DO1, you activate the outputs with the control signal SET_DO0 or SET_DO1, the outputs are set and reset at the time To.

8-34

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

Hysteresis
An encoder can stop at a certain position, and then oscillate around this position. This causes the counter level to fluctuate around a certain value. If there is a comparison value, for example, within this fluctuation range the associated output would be switched on and off in time with these fluctuations. The FM 350-1 is equipped with a programmable hysteresis in order to prevent this switching in response to small fluctuations. A value between 0 and 255 may be set for the hysteresis.
Table 8-7 Effect of the hysteresis Effect The hysteresis has no effect (switched off) The output responds to the smallest change in the counter level. 2 hysteresis value n 255 The hysteresis takes effect. The output does not respond until the counter level is n units away from the comparison value.

Hysteresis Hysteresis value n = 0.1

The hysteresis applies to both overflow and underflow.

How the Hysteresis Works for a Setting of Active from Comparison Value to Overflow/Underflow
Figure 8-20 illustrates the effect of the hysteresis. This diagram shows the differences between the behavior of an output for a set hysteresis of 0 (= switched off) and a hysteresis of 3. In the example, the comparison value = 5. The parameter assignments for this example are: Main counting direction, up Active from comparison value to overflow The hysteresis becomes active when the comparison condition (counter level = 5) is fulfilled. If hysteresis is active, the comparison result remains unchanged. If the counter value leaves the hysteresis range (at counter value 2 or 8 in the example), hysteresis ceases to be active. The comparator switches again according to its comparison conditions - at counter value 5 in the example.

FM 350-1 Function Module A5E00073040-02

8-35

Operating Modes, Parameters and Commands

Count value

Comparison value = 5

Hysteresis range shaded gray

8 7 6 5 4 3 2 1 0 Output for hysteresis = 0 Output for hysteresis = 3 Figure 8-20 Example showing the effect of hysteresis

Note If the counter level is equal to the comparison value and hysteresis is active, the FM 350-1 resets the output when the counting direction is changed at the comparison value (see figure 8-21).

Count value

Comparison value = 5

Hysteresis range shaded gray

Change in counting direction at the comparison value

8 7 6 5 4 3 2 1 0 Output for hysteresis = 3

Figure 8-21

Example in response to a change of direction at the comparison value

8-36

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

How Hysteresis Works for a Setting of Active on Reaching the Comparison Value Up/Down for Pulse Duration
Figure 8-22 illustrates the effect of the hysteresis. This diagram shows the differences between the behavior of an output for a set hysteresis of 0 (= switched off) and a hysteresis of 3. In the example, the comparison value = 5. The parameter assignments for this example are: Main counting direction, none Active on reaching the comparison value for pulse duration (up) Pulse duration > 0 The hysteresis becomes active when the comparison condition (counter level = 5) is fulfilled, and a pulse of the set duration is output. If the counter value leaves the hysteresis range, hysteresis ceases to be active. If hysteresis is active, the FM 350-1 saves the counting direction. A pulse is output if the hysteresis range is left against the stored direction.

Count value

Comparison value = 5

Hysteresis range shaded gray

8 7 6 5 4 3 2 1 0 Output for hysteresis = 0 Output for hysteresis = 3 Set pulse duration

Figure 8-22

Example showing the effect of hysteresis

FM 350-1 Function Module A5E00073040-02

8-37

Operating Modes, Parameters and Commands

8.3.9

Command: Set Counter

Introduction
If you want to start the count from a specific value (the load value), you must parameterize the signal that is to be used to set this counter to the load value. You can set the counter as follows: With the L_DIRECT or L_PREPAR input parameter of the FC_CNT_CTL1 With an external signal, either via the DI Set input or via DI Set in connection with the zero pass of the encoder This section describes the different methods and the time sequence when setting a counter.

Load Value
Any number within the limits of the count range can be set for the count range. The load value is interpreted according to the selected count range. If, for example, you specify FFFF FFFF H as the load value, this is interpreted as 4 294 967 295 within the count range from 0 to +32 bit and as 1 within the count range from 31 to +31 bit. Enter the load value in the DB of the CNT_CTL1 function and transfer it with the CNT_CTL1 function to the module. The counter is then set to the load value: directly and in preparation if input parameter L_DIRECT is set, in preparation only if input parameter L_PREPAR is set, The following ranges of values are permitted for the load value:
Range of values for load values Lower limit Upper limit Main counting direction: None Maximum lower count limit Maximum upper count limit Up 231 +1 Down 2 231 1

Programmed upper count limit 2

Setting the Counter via the User Program


You can set a counter with the FC CNT_CTL1 using the L_DIRECT input parameter regardless of external events. This can also be done while a count is in progress. If you set the counter via the FC_CNT_CTL1 call, this can initiate a process interrupt.

8-38

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

Setting the Counter with an External Signal


You can select two different external signals with which you can set a counter to the load value: Input I2 only Input I2 and zero mark of the encoder You use the zero mark of the encoder if you want to synchronize the counter to a specific counter status at a specific point in your process. This achieves greater accuracy in the loading operation. The counter is set independently of the Count mode. After the counter has been set with an external signal, bit STS_SYNC in the DB is set.

Note Synchronization of a counter with zero mark only makes sense if the gate is open. If you have only enabled one count direction when setting a counter with an external signal, you must note that when the gate is closed the current count direction is saved (frozen). This enables synchronization of the counter against the enabled count

Process Interrupt
Setting the counter with an external signal can be used to initiate a process interrupt.

Setting the Counter with DI Set


The counter can be loaded with the load value by means of a rising pulse edge across DI Set. By means of the tags ENSET_UP and ENSET_DN in the DB of the FC CNT_CTL1 and by parameter assignment, you can set the response of the FM 350-1 to a positive pulse edge across DI Set.
Bit ENSET_UP set ENSET_DN set ENSET_UP and ENSET_DN set Behavior of the FM 350-1 The counter is only set in the case of up counting The counter is only set in the case of down counting The counter is set in the case of up and down counting

FM 350-1 Function Module A5E00073040-02

8-39

Operating Modes, Parameters and Commands

Bit Parameterization Single setting of counter

Behavior of the FM 350-1 The counter is set only for the first rising edge across DI Set. If the counter is to be set again, you must first set ENSET_UP or ENSET_DN again. The counter is then set again with the next positive edge at input I2. The counter is set at every rising edge at input I2 as long as ENSET_UP and/or ENSET_DN are set.

Multiple setting of counter parameter

Note In any case, you have to set one of the two tags ENSET_UP or/and ENSET_DN so that the counter can be set via digital input Set DI.

Single Setting with DI Set


Figure 8-23 shows single setting of the counter with digital input DI Set. The case illustrated is that only ENSET_UP is set - in other words, the counter is set when counting up. With the first rising pulse edge at digital input DI Set, the counter is set provided that ENSET_UP is similarly set. If you want to set the counter again, you must first reset ENSET_UP and then set it again. The next positive pulse edge at digital input DI Set will then result in the counter being set.
Count pulses

DI Set

ENSET_UP

Counter set Figure 8-23 Single Setting with DI Set

Counter not set

Counter not set

Counter set

8-40

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

Multiple Setting with Input DI Set


Figure 8-24 shows multiple setting of the counter with digital input DI Set. In the situation represented, only ENSET_UP is set, that is, the counter is set in the case of up counting. With every rising pulse edge at digital input DI Set, the counter is set provided that ENSET_UP is similarly set. If you reset ENSET_UP, the counter will not be set by input I2. Only when you have set ENSET_UP again, will the next positive edge at input I2 result in the setting of the counter.
Count pulses

DI Set

ENSET_UP

Counter set Figure 8-24 Multiple Setting with DI Set

Counter set

Counter not set

Counter set

Setting the Counter with DI Set and Zero Mark


If you parameterize setting of a counter with the zero mark of the encoder, the counter will be set with the rising edge of the zero mark. Setting is performed only if DI Set is additionally set at the time of the rising pulse edge of the zero mark. You can determine the behavior of the FM 350-1 in the case of a rising edge of the zero mark via the ENSET_UP and ENSET_DN variables in the DB of the FC CNT_CTL1 and via parameterization.
Parameterization ENSET_UP set ENSET_DN set ENSET_UP and ENSET_DN set Behavior of the FM 350-1 The counter is only set in the case of up counting The counter is only set in the case of down counting The counter is set in the case of up and down counting

FM 350-1 Function Module A5E00073040-02

8-41

Operating Modes, Parameters and Commands

Parameterization Parameterization Single setting of counter

Behavior of the FM 350-1 The counter is set only at the first rising of the zero mark. If the counter is to be set again, you must first set ENSET_UP or ENSET_DN again (edge evaluation). The counter is then set again with the next rising edge of the zero mark. The counter is set at every rising edge of the zero mark as long as ENSET_UP and/or ENSET_DN are set.

Parameterization Multiple setting of counter

Note You must always set one of the two variables ENSET_UP and/or ENSET_DN so that the counter can be set with the zero mark.

Single Setting of the Counter with DI Set and Zero Mark


Figure 8-25 shows single setting of the counter with the zero mark. In the situation represented, only ENSET_UP is set, that is, the counter is set in the case of up counting. With the first rising pulse edge of the zero mark, the counter is set provided that ENSET_UP and DI Set are similarly set. If you want to set the counter again, you must first reset ENSET_UP and then set it again. If DI Set is not set, setting is performed with the first zero mark after DI Set has been set. If DI Set is set, setting is performed with the next zero mark.

Count pulses

Zero mark

DI Set

ENSET_UP Counter set Counter not set Counter not set Counter not set Counter not set Counter set

Figure 8-25

Single Setting of the Counter with the Zero Mark

8-42

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

Multiple Setting of the Counter with DI Set and Zero Mark


Figure 8-26 shows multiple setting of the counter with the zero mark. In the situation represented, only ENSET_UP is set, that is, the counter is set in the case of up counting. With every rising pulse edge of the zero mark, the counter is set provided that ENSET_UP and DI Set are set.

Count pulses

Zero mark

DI Set

ENSET_UP

Counter set

Counter set

Counter not set

Counter set

Counter not set

Counter set

Figure 8-26

Multiple Setting of the Counter with the Zero Mark

FM 350-1 Function Module A5E00073040-02

8-43

Operating Modes, Parameters and Commands

8.3.10

Command: Latch/Retrigger

Definition
The Latch/Retrigger command is used to save (latch) counter levels with edges at the Start DI digital input. Whenever the level is saved, the counter is set to the load value and resumes counting from the load value (retrigger).

Requirement
You will need the SW gate in order to use this command. The minimum interval between latch edges is 1 ms. If the interval between the edges is less, then values may be lost.

Selecting the Edges


You can program the following behavior: Latch/Retrigger in response to a positive edge at Start DI. Latch/Retrigger in response to a negative edge at Start DI. Latch/Retrigger in response to both edges at Start DI.

How it Works
The counter function is enabled when the SW gate opens. The counter level and latch value both have their starting count. This is not changed when the SW gate opens. They remain unchanged when the software gate is opened. Not until the first pulse edge across DI Start does the count operation begin with the load value. The load value is always reloaded for every other pulse edge across DI Start. The latch value is always precisely the counter status at the time of the pulse edge. The status of DI Start is always indicated in the DB by the status bit STS_STA. The latch value is displayed in the DB by means of LATCH_LOAD.

8-44

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

Count pulses

GATE_STP

SW_GATE

DI-Start

Counter level

Latch value

Figure 8-27

Latch/Retrigger when load value = 0 and a positive edge at Start DI

Interrupting and Terminating the Command


If you close the software gate, it only has an interruptive effect. In other words, when the software gate is opened again, the count operation is resumed. Edges at Start DI can be used to store counter levels, even if the SW gate is closed. The counting process is cancelled if you close the SW gate with the GATE_STP in the CNT_CTL1 function, however. The Start DI then cannot store any more counter levels.

Hardware Interrupt with Latch/Retrigger


A hardware interrupt may occur whenever counter values are stored with a Latch/Retrigger. This may mean that a larger interval is required between the edges. If the interrupts occur faster than they can be acknowledged by the system, hardware interrupts are lost. This is signaled by a diagnostic interrupt.

FM 350-1 Function Module A5E00073040-02

8-45

Operating Modes, Parameters and Commands

8.3.11

Command: Latch

Definition
The Latch command is used to save (latch) counter levels with edges at the Start DI digital input. The counter level remains unchanged.

Requirement
You will need the SW gate in order to use this command. The minimum interval between latch edges is 1 ms. If the interval between the edges is less, then values may be lost.

Selecting the Edges


You can program the following behavior: Latch in response to a positive edge at Start DI. Latch in response to a negative edge at Start DI. Latch in response to both edges at Start DI.

How it Works
The counter level and latch value both have their starting count. The counter function is started when the SW gate opens. The counter starts with the load value. The latch value is always exactly the same as the counter level at the moment the edge was received. The status of the Start DI is indicated by the status bit STS_STA in the DB. The latch value is indicated by LATCH_LOAD in the DB.

8-46

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

Count pulses

GATE_STP

SW_GATE

DI-Start

Counter level

Latch value

Figure 8-28

Latch when load value = 0 and a positive edge at Start DI

Interrupting and Terminating the Command


If you close the software gate, it has an cancelling effect. Edges at Start DI can be used to store counter levels, even if the SW gate is closed. The counting process is cancelled if you close the SW gate with the GATE_STP in the CNT_CTL1 function, however. The Start DI then cannot store any more counter levels.

Hardware Interrupt with Latch


A hardware interrupt can also occur whenever counter values are stored by latching. This may mean that a larger interval is required between the edges. If the interrupts occur faster than they can be acknowledged by the system, hardware interrupts are lost. This is signaled by a diagnostic interrupt.

FM 350-1 Function Module A5E00073040-02

8-47

Operating Modes, Parameters and Commands

8.3.12

Command: Measure the Times Between two Edges

Definition
You can use this command to measure the time between two immediately successive edges at the Start DI digital input.

Requirement
The following requirements must be fulfilled in order to use this command: There must be no encoders connected to the FM 350-1. Set the operating mode to any count mode. For Gate Control, set: Latch/Retrigger. For Encoder, set: Internal time Base 1 MHz

Selecting the Edges


To measure the time between two immediately successive ... rising edges at Start DI falling edges at Start DI any edges at Start DI ... program latch with positive edge latch with negative edge latch with both edges

Mode of Operation
The FM 350-1 uses an internal time base of 1 MHz in order to measure times. The time measurement starts with the first edge at Start DI. With every further edge at Start DI, the time in ms that has elapsed since the last edge is always saved as the latch value LATCH_LOAD in the feedback interface.

8-48

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

8.4

Measure Modes

8.4.1

What are the Measure Modes?


When you specify an operating mode, you decide the functionality with which the FM 350-1 is to work. Table 8-8 contains an overview of the Measure modes.
Table 8-8 The FM 350-1 Measure modes Designation Frequency measurement See section 8.4.3, page 8-55 RPM measurement See section 8.4.4, page 8-57 Continuous periodic measurement See section 8.4.5, page 8-59 The FM 350-1 counts the pulses that are received from a tacho generator within a dynamic measuring time, and calculates the speed from this value with the number of pulses per encoder revolution. The FM 350-1 indicates the dynamic measuring time as a period. If the period is less than the update time, then an average is calculated for the period. Description The FM 350-1 counts the pulses that occur within a dynamic measuring time.

You must set the FM 350-1 parameters in order to run one of these operating modes (see the 4 and 7 section).

FM 350-1 Function Module A5E00073040-02

8-49

Operating Modes, Parameters and Commands

8.4.2

Definitions

Measuring Principle
The FM 350-1 counts each rising edge of a pulse and assigns a time value in ms to it. The dynamic measuring time is defined as the difference between two time values. For a pulse train with one or more pulses per update interval: Dynamic measuring time = Time value of the last pulse in the current update interval minus Time value of the last pulse in the previous update interval

After the dynamic measuring time is calculated, if update intervals without pulses occur, then the measuring time is extended by these update intervals. If the value 1 pulse per dynamic measuring time is smaller than the last measured value, then this value is output as the new value.

Update time

Update time

Update time

Dynamic meas. time

Dynamic meas. time

Dynamic meas. time

Update time

Update time

Update time

Dynamic meas. time Dynamic meas. time Dynamic meas. timet Figure 8-29 Measuring principle

8-50

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

Measurement Sequence
The FM 350-1 measures continuously. When you assign the parameters, you specify an update time. The value -1 is returned in the time up to the end of the first elapsed update time. The first update time starts when the gate is opened. The continuous measurement starts when the gate is opened with the first pulse of the pulse train to be measured. The first measured value can be calculated no earlier than after the second pulse. Whenever the update time expires, a measured value is output at the feedback interface (frequency, period or speed). The end of a measurement is signaled by the STS_COMP1 status bit. This bit is reset by the RES_ZERO and STS_RES_ZERO bits using the complete acknowledgement principle. If a change of direction occurs during an update time, the measured value is not determined for this measurement period. You can respond to any irregularities in the process by evaluating the feedback bit STS_DIR (direction evaluation). Figure 8-30 illustrates the principle of continuous measurement with reference to a frequency measurement.

FM 350-1 Function Module A5E00073040-02

8-51

Operating Modes, Parameters and Commands

Gate Pulse train Measured value 3

1 Update time Figure 8-30 Principle of continuous measurement (example of a frequency measurement)

8-52

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

Limit Value Monitoring


Whenever the update time expires, the measured value (frequency, speed or period) is compared against the set lower and upper limit. If the current measured value is below the set lower limit (measured value < lower limit), the bit STS_UFLW = 1 is set in the status (see figure 8-31). A hardware interrupt may also be generated. If the current measured value is above the set upper limit (measured value upper limit), the bit STS_OFLW = 1 is set in the status (see figure 8-31). A hardware interrupt may also be generated.

STS_OFLW

STS_UFLW

0 Figure 8-31

Lower limit

Upper limit

Measured value

Limit value monitoring in Measure modes

You must reset the STS_OFLW and STS_UFLW bits with the RES_ZERO and STS_RES_ZERO by applying the complete acknowledgement principle. After the acknowledgement, if the measured value is still or has returned outside the limits, the corresponding status bit is set again. If programmed accordingly, you also can use the limit value monitoring to switch the DO0 output.

Gate Control
You can use the hardware gate (HW gate) and software gate (SW gate) to control the FM 350-1 measuring processes.

Starting Counts According to Parameter Assignment


Table 8-9 Starting count Value Lower limit Upper limit Update time Set value Set value Set value Starting count

FM 350-1 Function Module A5E00073040-02

8-53

Operating Modes, Parameters and Commands

Isochrone Mode
In isochrone mode, the FM 350-1 accepts the control signals from the control interface at time To in every PROFIBUS DP cycle. As a result, all the controllers run in isochrone mode and take effect at the time To. The response to the controller is returned in the same PROFIBUS DP cycle. The FM 350-1 provides a measured value and the status bits at time Ti in every PROFIBUS DP cycle. Each measurement starts and ends at time Ti.

Note In non-isochrone mode, you can specify the update time in integer multiples of 10 ms, compared to integer multiples of the PROFIBUS DP cycle time in isochrone mode, so you must always adapt the Update time parameter when you switch between the two modes if you wish to retain the actual update time. See also tables 8-11, 8-12 and 8-13 on pages 8-55, 8-57 and 8-59.

What are the Commands?


You can apply the following commands to the FM 350-1 measuring process.
Table 8-10 The FM 350-1 commands Description The measuring process starts when a gate opens and ends when it closes.

Designation Open and close gate

8-54

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

8.4.3

Frequency Measurement

Definition
In the frequency measurement operating mode, the FM 350-1 counts the pulses that occur within a dynamic measuring time.

Update Time
The FM 350-1 updates the measured values cyclically. The update time is set using the Update Time parameter (see table 8-11). You can change the update time during operation.
Table 8-11 Calculating the update time Update time nmin Non-isochrone mode Isochrone mode Any TDP TDP < 10 ms TDP 10 ms
1)

Associated conditions

Value range of n nmax 1000 1000 10000 ms/TDP [ms] 1)

n 10 ms n TDP n TDP

1 ( 10 ms/TDP [ms] ) +1 1) 1

The decimal places obtained after division by TDP are omitted. These limits must not be exceeded. If these limits are exceeded, the FM 350-1 generates a parameter assignment error and does not switch to isochrone mode.

Frequency Measurement
The value of the calculated frequency is displayed in units of Hz*103. You can read the measured frequency value at the feedback interface (bytes 0 to 3).

Update time

Update time

Count pulses

Internal gate Start of frequency measurement End of frequency measurement

Figure 8-32

Frequency measurement with gate function

FM 350-1 Function Module A5E00073040-02

8-55

Operating Modes, Parameters and Commands

Limit Value Monitoring


The following value ranges are permitted for limit value monitoring:
Encoder type 5V encoder 24V encoder Lower limit fu 0 to 499,999,999 Hz*103 0 to 199,999,999 Hz*103 Upper limit fo fu+1 to 500,000,000 Hz*103 fu+1 to 200,000,000 Hz*103

Possible Measuring Ranges with Error Information


Frequency 0.1 Hz 1 Hz 10 Hz 100 Hz Absolute error 0.001 Hz 0.001 Hz 0.003 Hz 0,02 Hz Frequency 1 000 Hz 10 000 Hz 100 000 Hz 500 000 Hz Absolute error 0.18 Hz 1.8 Hz 18 Hz 90 Hz

Function of the Start DI and Stop DI Digital Inputs


You can choose between the following functions for the digital inputs: Level-controlled hardware gate Edge-controlled hardware gate (see section 8.4.6)

Function of Digital Output DO0


You can choose between the following functions for digital output DO0: No comparison (no switching by limit value monitoring) Measured value outside limits Measured value under lower limit Measured value above upper limit (see section 8.4.7)

Variable Values during Operation:


Lower limit (L_PREPAR) Upper limit (T_CMP_V1) Update time (T_CMP_V2) Function of digital output DO0 (C_DOPARA) (see section 8.4.7 and 5.6.2)

8-56

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

8.4.4
Definition

RPM Measurement

In the RPM measurement operating mode, the FM 350-1 counts the pulses that are received from a tacho generator within a dynamic measuring time, and calculates the speed from this value with the number of pulses per encoder revolution.

Update Time
The FM 350-1 updates the measured values cyclically. The update time is set using the Update Time parameter (see table 8-12). You can change the update time during operation.
Table 8-12 Calculating the update time Update time nmin Non-isochrone mode Isochrone mode Any TDP TDP < 10 ms TDP 10 ms
1)

Associated conditions

Value range of n nmax 1000


1)

n 10 ms n TDP n TDP

1 ( 10 ms/TDP [ms] ) +1 1

1000 10000 ms/TDP [ms] 1)

The decimal places obtained after division by TDP are omitted. These limits must not be exceeded. If these limits are exceeded, the FM 350-1 generates a parameter assignment error and does not switch to isochrone mode.

RPM Measurement
For the RPM measurement mode, you must also set the pulses per encoder revolution. This returns the speed expressed in units of 1x103 /min.

Update time

Update time

Count pulses

Internal gate Start of RPM measurement End of RPM measurement

Figure 8-33

RPM measurement with gate function

FM 350-1 Function Module A5E00073040-02

8-57

Operating Modes, Parameters and Commands

Limit Value Monitoring


The following value ranges are permitted for limit value monitoring:
Lower limit nu 0 to 24 999 999 *103 /min Upper limit no nu+1 to 25 000 000 *103 /min

Possible Measuring Ranges with Error Information (for Number of Pulses per Encoder Revolution = 60)
Speed 1 /min 10 /min 100 /min Absolute error 0.04 /min 0.04 /min 0.05 /min Speed 1,000 /min 10,000 /min 25,000 /min Absolute error 0.21 /min 1.82 /min 4.5 /min

Function of the Start DI and Stop DI Digital Inputs


You can choose between the following functions for the digital inputs: Level-controlled hardware gate Edge-controlled hardware gate (see section 8.4.6)

Function of Digital Output DO0


You can choose between the following functions for digital output DO0: No comparison (no switching by limit value monitoring) Measured value outside limits Measured value under lower limit Measured value above upper limit (see section 8.4.7)

Variable Values during Operation:


Lower limit (L_PREPAR) Upper limit (T_CMP_V1) Update time (T_CMP_V2) Function of digital output DO0 (C_DOPARA) (see section 8.4.7 and 5.6.2)

8-58

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

8.4.5

Continuous Periodic Measurement

Definition
In the continuous periodic measurement operating mode, the FM 350-1 indicates the dynamic measuring time as a period. If the period is less than the update time, then an average is calculated for the period.

Update Time
The FM 350-1 updates the measured values cyclically. The update time is set using the Update Time parameter (see table 8-13). You can change the update time during operation.
Table 8-13 Calculating the update time Update time nmin Non-isochrone mode Isochrone mode Any TDP TDP < 10 ms TDP 10 ms
1)

Associated conditions

Value range of n nmax 12000


1)

n 10 ms n TDP n TDP

1 ( 10 ms/TDP [ms] ) +1 1

12000 120000 ms/TDP [ms] 1)

The decimal places obtained after division by TDP are omitted. These limits must not be exceeded. If these limits are exceeded, the FM 350-1 generates a parameter assignment error and does not switch to isochrone mode.

Continuous Periodic Measurement


The value of the calculated period is displayed in units of 1 ms and 1/16 ms. You can read the measured period at the feedback interface (bytes 0 to 3).

Update time Period Count pulses

Update time

Internal gate Start of continuous periodic measurement Figure 8-34 Periodic measurement of the gate function End of continuous periodic measurement

FM 350-1 Function Module A5E00073040-02

8-59

Operating Modes, Parameters and Commands

Limit Value Monitoring


The following value ranges are permitted for limit value monitoring: Resolution 1 ms
Lower limit Tu 0 to 119,999,999 ms Upper limit To Tu+1 to 120,000,000 ms

Resolution 1/16 ms
Lower limit Tu 0 to 1,919,999,999 ms Upper limit To Tu+1 to 1,920,000,000 ms

Possible Measuring Ranges with Error Information


Resolution 1ms Period T Absolute error 1 ms* (10 0) 1 ms* (100 0) 1 ms* (1 000 0) 1 ms* (10 000 1) Period T Absolute error 1 ms* (100 000 10) 1 ms* (1 000 000 100) 1 ms* (10 000 000 1 002) 1 ms* (100 000 000 10 020)

Resolution 1/16 ms Period T Absolute error 1/16 ms* (160 1) 1/16 ms* (1 600 1) 1/16 ms* (16 000 3) 1/16 ms* (160 000 20) Period T Absolute error 1/16 ms* (1 600 000 160) 1/16 ms* (16 000 000 1 600) 1/16 ms* (160 000 000 16 000) 1/16 ms* (1 600 000 000 160 000)

Function of the Start DI and Stop DI Digital Inputs


You can choose between the following functions for the digital inputs: Level-controlled hardware gate Edge-controlled hardware gate (see section 8.4.6)

8-60

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

Function of Digital Output DO0


You can choose between the following functions for digital output DO0: No comparison (no switching by limit value monitoring) Measured value outside limits Measured value under lower limit Measured value above upper limit (see section 8.4.7)

Variable Values during Operation:


Lower limit (L_PREPAR) Upper limit (T_CMP_V1) Update time (T_CMP_V2) Function of digital output DO0 (C_DOPARA) (see section 8.4.7 and 5.6.2)

FM 350-1 Function Module A5E00073040-02

8-61

Operating Modes, Parameters and Commands

8.4.6

Command: Open and Close Gate

Introduction
The FM 350-1 has the following gates: A hardware gate (HW gate) that can either be level-controlled or edge-controlled. A software gate (SW gate) that you can open and close using control bits in the user program.

Selecting a Gate
In the Operating mode dialog (see section 8.3.2), specify which gate you wish to use for the counting operation. The following diagrams illustrate the various options for opening and closing the gates of the FM 350-1.

Level-Controlled Opening and Closing of the HW Gate


Figure 8-35 illustrates level-controlled opening and closing of the HW gate.

Pulses

DI-Start Mesasurement Opening of the gate Figure 8-35 Closing of the gate

Level-controlled opening and closing of the HW gate

The HW gate is opened and the measurement is started by setting the digital input Start DI. The HW gate is closed and the measurement is ended by resetting the digital input Start DI. The measured value at the time the HW gate is closed is retained at the feedback interface. The level-controlled HW gate takes effect at the first positive edge at the Start DI after the parameter assignment. With this parameter assignment, the Stop DI input is not evaluated. It is merely displayed in the status bit STS_STP.

8-62

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

Edge-Controlled Opening and Closing of the HW Gate


Figure 8-36 illustrates edge-controlled opening and closing of the HW gate.

Pulses DI-Start DI-Start Mesasurement Opening of the gate Figure 8-36 Closing of the gate

Edge-controlled opening and closing of the HW gate

The HW gate is opened and the measurement is started by a positive edge at the digital input Start DI. The HW gate is closed and the measurement is ended by a positive edge at the digital input Stop DI. The measured value at the time the HW gate is closed is retained at the feedback interface. If there are positive edges at both inputs at the same time, an open gate is closed or a closed gate remains closed. If the Stop DI digital input is set, a positive edge at the Start DI digital input cannot open the gate.

Status of the Start DI and Stop DI Inputs


The statuses of the Start DI and Stop DI inputs is displayed by the green LEDs I0 and I1 and in the user program by the STS_STA and STS_STP bits of the DB of the CNT_CTL1 function.

Status of the Gate


The status of the gate is displayed in the STS_GATE bit in the user program.

FM 350-1 Function Module A5E00073040-02

8-63

Operating Modes, Parameters and Commands

Opening and Closing of the SW Gate


Figure 8-37 illustrates the opening and closing of the SW gate.

Pulses

SW_GATE Mesasurement Set bit Reset bit

Figure 8-37

Level-controlled opening and closing of the SW gate

The SW gate is opened and the measurement is started by setting the SW_GATE input parameter of the CNT_CTL1 function. The SW gate is closed and the measurement is ended by resetting SW_GATE. The measured value at the time the SW gate is closed is retained at the feedback interface. The closed gate can be reopened by resetting the SW_GATE input parameter. Edge-controlled opening and closing of the SW gate is not possible.

Status of the SW Gate


The status of the SW gate is indicated by the STS_SW_G bit of the DB for the CNT_CTL1 function.

Ending the Measurement with the Gate Stop Function


You can also use the Gate Stop function to end the measurement regardless of the signals applied or the status of the SW gate by setting the GATE_STP input parameter of the CNT_CTL1 function. If you reset this parameter, you cannot open the gate again until a positive edge is present at the Start DI digital input (HW gate) or until the SW_GATE input parameter is set again.

Hardware Interrupt
Opening and closing a gate (HW or SW gate) may be used to trigger a hardware interrupt (see section 8.5).

Default Setting
The SW gate is active by default.

8-64

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

Gate Control in Isochrone Mode


Gate control with the SW gate: For control with the SW gate, you set and reset the SW_GATE control bit in the user program. The measuring process then starts and ends at the time Ti in the next PROFIBUS DP cycle after the control bit is changed (Figure 8-38).

DP cycle TDP To SW_GATE Ti

DP cycle TDP To Ti

DP cycle TDP To Ti

DP cycle TDP To Ti

DP cycle TDP To Ti

STS_GATE

Count

1)

2)

2)

2)

3)

1) Meas. value = 1 2) Availability of current measured value 3) Availability of measured value that was valid at end of measuring operation Figure 8-38 Starting and stopping the counting process with the SW gate (SW_GATE)

Gate Control with the HW Gate: For control with the HW gate, the measuring process starts and ends at the time Ti immediately after the HW gate is opened or closed (Figure 8-39).

DP cycle TDP To HW-Tor Ti

DP cycle TDP To Ti

DP cycle TDP To Ti

DP cycle TDP To Ti

DP cycle TDP To Ti

STS_GATE

Count

1)

2)

2)

3)

2)

1) Meas. value = 1 2) Availability of current measured value 3) Availability of measured value that was valid at end of measuring operation Figure 8-39 Starting and stopping the counting process with the HW gate (HW_GATE)

FM 350-1 Function Module A5E00073040-02

8-65

Operating Modes, Parameters and Commands

8.4.7

Behavior of the Digital Outputs

Introduction
You can store an upper and a lower limit value for the frequency measurement, RPM measurement or continuous periodic measurement. This will be activated when digital output DO0 is exceeded. You can set these limit values and modify them via the load function. You can use digital output DO1 as a normal digital output.

Enabling Output Parameters


Before you can activate the outputs, you must first enable them by setting the appropriate bits in the DB (see Chapter 10). When you reset one of these bits, the associated output is switched off immediately.
Output DO0 DO1 is enabled by enable bit CTRL_DO0 CTRL_DO1

8-66

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

Behavior of Digital Output DO0


For digital output DO0, you can set 4 possible reactions to reaching the limit values. The various options are shown in the table below.
Table 8-14 Behavior of digital output DO0 Behavior of digital output DO0 Switching time Isochrone mode Non-isochrone mode

Parameter assignments for digital output DO0 No comparison

Not affected by the monitoring of limit values. If output DO0 is already set, it can be reset by changing the parameter to No comparison. You can use output DO0 freely as a digital output and set and reset it with the control signal SET_DO0 if you have enabled it with the control signal CTRL_DO0. At time To Immediately after setting or resetting the output

Exceeds limits

DO0 is set in both of the following cases:

Measured value < Lower limit Measured value > Upper limit
Under lower limit DO0 is set if

Measured value < Lower limit


Above upper limit DO0 is set if

At the end of the update time at time Ti

At the end of the update time

Measured value > Upper limit

Behavior of Digital Output DO1


You can use output DO1 freely as a digital output and set and reset it with the control signal SET_DO1, provided that it has been enabled. DO1 is not affected by limit value monitoring. In non-isochrone mode, DO1 switches immediately after the output is set or reset. In isochrone mode, DO1 switches at the end of the update time at time To.

FM 350-1 Function Module A5E00073040-02

8-67

Operating Modes, Parameters and Commands

Status of the Outputs and Status Bits


The status of the two outputs is indicated by the green LEDs and the corresponding status bits in the DB.
Table 8-15 Output DO0 Enable bit CTRL_DO0 0 1 Exceeded 0 1 Status bit STS_CMP1/Output DO0 0 0 0 1 LED DO0

Limit values

Not exceeded

Out Out Out Lit

Table 8-16

Output DO1 Enable bit CTRL_DO1 0 1 1 0 1 Status bit STS_CMP2/Output DO1 0 0 0 1 LED DO1

Control bit SET_DO1 0

Out Out Out Lit

8-68

FM 350-1 Function Module A5E00073040-02

Operating Modes, Parameters and Commands

8.5

Initiating a Process Interrupt

Introduction
With the FM 350-1, you can set which events are to initiate a process interrupt. For this purpose, parameterize the FM 350-1 interrupts in the parameter assignment screen forms.

What is a Process Interrupt


If you want to program a response to a specific event independently of the CPU cycle, each counter of the FM 350-1 can initiate a process interrupt. The CPU interrupts the cyclic program on receiving the interrupts and executes the process interrupt OB.

Which Events Can Initiate a Process Interrupt?


The following events during operation of the FM 350-1 can initiate a process interrupt:
Count modes Measure modes

Opening of the gate (in the operating modes with hardware or software gate) Closing of the gate (in the operating modes with hardware or software gate) Overflow Underflow Zero pass Reaching comparison value 1 or 2 in the up direction Reaching comparison value 1 or 2 in the down direction Setting the counter with an external signal Latch Measured value outside limits End of measurement

You can select any number of events for process interrupt initiation. For process interrupts on reaching the comparison value, you must observe the marginal conditions on page 8-34.

Enabling the Process Interrupt


You enable the interrupts for the module in the parameter assignment screen forms when configuring the hardware and you decide whether the module is to initiate a diagnostics interrupt and/or a process interrupt.

FM 350-1 Function Module A5E00073040-02

8-69

Operating Modes, Parameters and Commands

Process Interrupt OB, OB 40


If a process interrupt occurs, the user program is interrupted, the data is transferred from the module to the start information of OB40 and OB40 is called. The process interrupt is acknowledged by exiting OB40. If there is no OB40 programmed, the CPU goes to STOP. If you then switch back to RUN, the process interrupt requirements are deleted.

Start Information
The temporary variable OB40_POINT_ADDR is written in the start information of OB40. The variable OB40_POINT_ADDR (bytes 8 to 11) consists of four bytes. The information concerning the event that has initiated the process interrupt is entered in bytes 8 and 9. Table 8-17 shows which bits are set for which interrupt. All unlisted bits are not significant and are set to zero.
Table 8-17 Byte 8 Assignment of the bits of the variable OB40_POINT_ADDR Bit 0 1 2 Meaning: Interrupt in the Case of... Opening the gate Closing the gate Overflow (Count mode) Measured value outside limits (Measure mode) 3 Underflow (Count mode) End of measurement (Measure mode) 4 5 6 7 9 0 5 7 Reaching comparison value 1 in the up direction Reaching comparison value 1 in the down direction Reaching comparison value 2 in the up direction Reaching comparison value 2 in the down direction Zero pass Sets the counter with an external signal (synchronization) Latch

Lost Process Interrupt


If an event occurs that is to initiate a process interrupt and the same previous event has not yet been acknowledged, no further process interrupt is initiated; the process interrupt is lost. This may lead to the Hardware interrupt lost diagnostic interrupt, depending on the parameter assignments.

Default Setting
No process interrupt is parameterized in the default setting.

8-70

FM 350-1 Function Module A5E00073040-02

Encoder Signals and Their Evaluation

This Chapter... This chapter describes the following: The encoders you can connect to the counters of the FM 350-1. The time sequence of the signals of the different encoders. How the FM 350-1 can perform multiple evaluations of the encoder signals. How the module monitors the different encoder signals. The signals for which you can parameterize input filters.

Chapter Overview
Section 9.1 9.2 9.3 9.4 Overview 5 V Differential Signals 24 V Signals Pulse Evaluation Description Page 9-2 9-3 9-5 9-7

FM 350-1 Function Module A5E00073040-02

9-1

Encoder Signals and Their Evaluation

9.1

Overview

Introduction The count signals that the FM 350-1 can process are rectangular signals generated either by incremental encoders or by signal encoders. Incremental encoders scan a grating and so generate rectangular electrical pulses. They differ in pulse height and in the number of signals. Pulse encoders such as light barriers or initiators (BEROs) supply only a rectangular signal with a specific voltage level.

Connecting Different Encoders You can connect different encoders to the FM 350-1 for supplying the pulses for the count signals. Table 9-1 gives an overview of the different encoders and the corresponding signals.
Table 9-1 Encoders for the FM 350-1 Encoder Incremental 5 V encoder Incremental 24 V encoder 24 V pulse encoder 24 V initiator Signal Differential signals A/A, B/B and N/N A*, B* and N* 24 V with direction level 24 V without direction level

9-2

FM 350-1 Function Module A5E00073040-02

Encoder Signals and Their Evaluation

9.2

5 V Differential Signals

Incremental 5 V Encoder The incremental 5 V encoder supplies the differential signals A/A, B/B and N/N to the module in accordance with RS 422, where the signals A, B and N are the inverted signals of A, B and N. The signals A and B are phase-shifted by 90 each. In the case of the incremental 5 V encoder, tracks A and B are used for counting. Track N is used for setting the counter to the load value if parameterized accordingly. Encoders with these six signals are known as symmetric encoders. Figure 9-1 shows the time sequence of these signals.
Signal A Signal A Signal B Signal B Signal N Signal N Direction of count Figure 9-1 Up Down

Signals of the Incremental 5 V encoder

The module recognizes the direction of count from the ratio of signal A to B. The figures in the next section (Pulse Evaluation) show which edges of signals A and B are counted in the down or up direction.

Changing the Count Direction You can change the count direction with the parameter Count direction normal and Count direction inverted without changing the wiring.

FM 350-1 Function Module A5E00073040-02

9-3

Encoder Signals and Their Evaluation

How are the Signals Monitored? The module monitors for cable connection and for wirebreak or short-circuit. Via parameterization, you can determine which of the three signal pairs are monitored. You therefore need not wire unused signals if diagnostics for this signal pair has been switched off via parameterization (set counter with zero mark). If all three signals report errors, either the encoder is defective, there is a short-circuit in the 5.2 VDC encoder supply or there is no encoder connected. If the module detects an error after you have assigned your parameters, an entry is made in the diagnostics data sets DS0 and DS1. This can result in a diagnostics interrupt if the relevant parameters have been assigned.

Coding Connector For this encoder, you must set the coding connector to position A.

9-4

FM 350-1 Function Module A5E00073040-02

Encoder Signals and Their Evaluation

9.3

24 V Signals

24 V Incremental Encoder The incremental 24 V encoder supplies the signals A*, B* and N* in the same time ratio as the signals A, B and N in the case of the 5 V incremental encoder. Signals with a voltage of 24 V are indicated with an asterisk (*). The signals A* and B* are phase-shifted by 90 each. Encoders that do not supply inverse signals are known as asymmetric encoders. In the case of the inputs of 24 V encoder signals, you decide via parameterization whether you connect source outputs or sink outputs to the counters. See the encoder description for further information on this point. You can change the count direction with the parameter Count direction normal and Count direction inverted without changing the wiring.

24 V Pulse Encoder Without/With Direction Level The encoder, for example an initiator (BERO) or a light barrier, supplies only one count signal that must be connected to terminal A* of the front connector. Additionally to this, you can connect a signal for direction detection to terminal B* of the affected counter. If your encoder does not supply a corresponding signal, you can generate and connect a corresponding ID within the S7 or you can use a corresponding process signal. Figure 9-2 shows the sequence over time of the signals of a 24 V pulse encoder with direction level and the resulting count pulses.

Signal A* Signal B * as direction level Up count pulses Down count pulses Down Up

Figure 9-2

Signals of a 24 V Pulse Encoder with Direction Level

FM 350-1 Function Module A5E00073040-02

9-5

Encoder Signals and Their Evaluation

Parameterization of the Encoder Inputs


The count direction is defined via the parameterization of the encoder inputs. Table 9-2 shows the count direction changes in dependence on the parameterization.
Table 9-2 Count Direction in Dependence on the Input Parameterization Terminal B* Unswitched 24 V connected Current sinking Unswitched Short-circuited to ground Up Down Down Up Count Direction

Input Parameterization Current sourcing

For parameterization, select 24 V pulse and direction for the encoder selection. Changing direction by inverting the B* signal is not possible with these count signals. Note With this type of evaluation, the count value in the case of an oscillating count signal can run away at the edge since all the signals are added together.

Input Filters for 24 V Count Inputs To suppress interference, you can parameterize input filters with a uniform filter time for the 24 V inputs A*, B* and N* and for the digital inputs. The following input filters are available:
Table 9-3 Input Filters Features Typical input delay Maximum count frequency Minimum pulse width of the count signals Input Filter 1 (Default) 1 ms 200 kHz 2.5 ms Input Filter 2 15 ms 20 kHz 25 ms

How are the Signals Monitored? 24 V count signals are not monitored for wirebreak or short-circuit.

Coding Connector For this encoder, you must set the coding connector to position B.

9-6

FM 350-1 Function Module A5E00073040-02

Encoder Signals and Their Evaluation

9.4

Pulse Evaluation

Introduction The counters of the FM 350-1 can count the edges of the signals. Normally, the edge at A (A*) is evaluated (single evaluation). To achieve a higher resolution, you can decide via parameterization whether the signals are to have single, double or quadruple evaluation. Multiple evaluation is only possible in the case of incremental 5 V encoders with signals A and B displaced by 90, or in the case of incremental 24 V encoders with signals A* and B* displaced by 90.

Single Evaluation Single evaluation means that only one edge of A is evaluated; up count pulses are captured on a rising edge of A and low level at B, and down count pulses are captured on a falling edge of A and low level at B. Figure 9-3 shows single evaluation of the signals.

Signal A (A*) Signal B (B*) Up count pulses Down count pulses

Up Single Evaluation

Down

Figure 9-3

FM 350-1 Function Module A5E00073040-02

9-7

Encoder Signals and Their Evaluation

Double Evaluation Double evaluation means that the rising and falling edge of signal A are evaluated; whether up or down count pulses are generated depends on the level of signal B. Figure 9-4 shows double evaluation of the signals.

Signal A (A*) Signal B (B*) Up count pulses Down count pulses

Up Double Evaluation

Down

Figure 9-4

Quadruple Evaluation Quadruple evaluation means that the rising and falling edges of A and B are evaluated; whether up or down count pulses are generated, depends on the levels of signals A and B. Figure 9-5 shows quadruple evaluation of signals.

Signal A (A*) Signal B (B*) Up count pulses Down count pulses Figure 9-5 Up Quadruple Evaluation Down

Default Value Single evaluation is set as the default.

9-8

FM 350-1 Function Module A5E00073040-02

DB Assignments

10

DB for the FC CNT_CTL1 All data belonging to one channel of the module are stored in the DB of the FC CNT_CTL1. The data structure and the length of the DB are defined by the UDT 2. Before the module is parameterized, the DB must be assigned the following valid data (see Section 5.1 Prerequisite): Module address (address 6.0) Channel starting address (address 8.0) User data length (address 12.0) The DB has been generated from the UDT 2 as a data block with the associated user-specific data type. The DB assignments resulting from this are shown below. The variables in the DB for which you have read and write rights are shaded gray in Table 10-1.
Table 10-1 DB Assignments Address Variable Data type Intial value al e Comments Count Measurement

FC Parameters, Addresses 0.0 4.0 5.0 6.0 8.0 12.0 13.0 AR1_BUFFER FP RESERVED MOD_ADR CH_ADR U_D_LGTH A_BYTE_0 DWORD BYTE BYTE WORD DWORD BYTE BYTE DW#16#0 B#16#0 B#16#0 W#16#0 DW#16#0 B#16#0 B#16#0 AR1 buffer Flag byte Reserved Module address Channel address User data length Reserved AR1 buffer Flag byte Reserved Module address Channel address User data length Reserved

Transfer area for write values 14.0 18.0 22.0 LOAD_VAL CMP_V1 CMP_V2 DINT DINT DINT L#0 L#0 L#0 New load value (write user) Lower limit (write user)

New comparison value Upper limit (write user) 1 (write user) New comparison value Update time(write 2 (write user) user)

FM 350-1 Function Module A5E00073040-02

10-1

DB Assignments

Table 10-1 DB Assignments, Continued Address Variable Data type Intial value Comments Count Measurement

Control interface 26.0 26.1 26.2 26.3 26.4 26.5 26.6 26.7 27.0 27.1 27.2 27.3 27.4 27.5 27.6 27.7 28.0 28.1 28.2 28.3 28.4 28.5 28.6 28.7 29.0 29.1 29.2 29.3 29.4 29.5 29.6 A_BIT0_0 A_BIT0_1 A_BIT0_2 A_BIT0_3 A_BIT0_4 A_BIT0_5 A_BIT0_6 A_BIT0_7 ENSET_UP ENSET_DN A_BIT1_2 A_BIT1_3 A_BIT1_4 A_BIT1_5 A_BIT1_6 A_BIT1_7 CTRL_DO0 CTRL_DO1 A_BIT2_2 A_BIT2_3 A_BIT2_4 A_BIT2_5 A_BIT2_6 A_BIT2_7 A_BIT3_0 A_BIT3_1 A_BIT3_2 A_BIT3_3 A_BIT3_4 A_BIT3_5 A_BIT3_6 BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Enable setting in up direction (write user) Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved

Enable setting in down direction (write user) Reserved Reserved Reserved Reserved Reserved Reserved Monitor digital output DO0 (write user) Monitor digital output DO1 (write user) Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Monitor digital output DO0 (write user) Monitor digital output DO1 (write user) Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved

10-2

FM 350-1 Function Module A5E00073040-02

DB Assignments

Table 10-1 DB Assignments, Continued Address Variable Data type Intial value FALSE Comments Count Reserved Measurement Reserved

29.7

A_BIT3_7

BOOL

Transfer area for read values 30.0 34.0 LATCH_LOAD ACT_CNTV DINT DINT L#0 L#0 Current load or latch value (read user) Current count value (read user) Current measured value (read user) Current count value (read user)

Error numbers 38.0 40.0 DA_ERR_W OT_ERR_B WORD BYTE W#16#0 B#16#0 Data error word (read user) Operation error byte (read user) Data error word (read user) Operation error byte (read user)

Feedback interface 41.0 41.1 41.2 41.3 41.4 41.5 41.6 41.7 42.0 43.0 43.1 43.2 43.3 43.4 43.5 E_BIT0_0 E_BIT0_1 E_BIT0_2 E_BIT0_3 DATA_ERR E_BIT0_5 E_BIT0_6 PARA E_BYTE_0 STS_RUN STS_DIR STS_ZERO STS_OFLW STS_UFLW STS_SYNC BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BYTE BOOL BOOL BOOL BOOL BOOL BOOL FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE B#16#0 FALSE FALSE FALSE FALSE FALSE FALSE Reserved Reserved Reserved Reserved Data error bit (read user) Reserved Reserved Module parameterized (read user) Reserved Status counter working Status count direction (read user) Reserved Reserved Reserved Reserved Data error bit (read user) Reserved Reserved Module parameterized (read user) Reserved Status counter working Status count direction (read user)

Status zero pass (read Full scale (read user) user) Status overflow (read user) Status overflow (read user)

Status underflow (read Status underflow (read user) user) Status counter synchronized (read user) Status internal gate (read user) Status software gate (read user)

43.6 43.7

STS_GATE STS_SW_G

BOOL BOOL

FALSE FALSE

Status internal gate (read user) Status software gate (read user)

FM 350-1 Function Module A5E00073040-02

10-3

DB Assignments

Table 10-1 DB Assignments, Continued Address Variable Data type Intial value FALSE FALSE Comments Count Status digital input SET (read user) New latch value (only in clock synchronous mode) Status digital input START (read user) Status digital input STOP (read user) Status output comparison value 1 (read user) Status output comparison value 2 (read user) Stored status of comparator 1 Stored status of comparator 1 Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved Measurement Status digital input SET (read user)

44.0 44.1

STS_SET STS_LATCH

BOOL BOOL

44.2 44.3 44.4

STS_STA STS_STP STS_CMP1

BOOL BOOL BOOL

FALSE FALSE FALSE

Status digital input START (read user) Status digital input STOP (read user) Status output comparison value 1 (read user) Status output comparison value 2 (read user) Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved

44.5

STS_CMP2

BOOL

FALSE

44.6 44.7 45.0 45.1 45.2 45.3 45.4 45.5 45.6 45.7

STS_COMP1 STS_COMP1 E_BIT3_0 E_BIT3_1 E_BIT3_2 E_BIT3_3 E_BIT3_4 E_BIT3_5 E_BIT3_6 E_BIT3_7

BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL

FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE

Parameters for FM 450 46.0 50.0 ACT_CMP1 ACT_CMP2 DINT DINT L#0 L#0 Reserved Reserved Reserved Reserved

The following diagnostics data are entered by the FC DIAG_INF 54.0 54.1 54.2 54.3 MDL_DEFECT INT_FAULT EXT_FAULT PNT_INFO BOOL BOOL BOOL BOOL FALSE FALSE FALSE FALSE Module error Internal fault External fault Channel fault (decoded from DW 58 onward) Auxiliary voltage fault Front connector Module error Internal fault External fault Channel fault (decoded from DW 58 onward) Auxiliary voltage fault Front connector

54.4 54.5

EXT_VOLTAGE FLD_CNNCTR

BOOL BOOL

FALSE FALSE

10-4

FM 350-1 Function Module A5E00073040-02

DB Assignments

Table 10-1 DB Assignments, Continued Address Variable Data type Intial value FALSE FALSE B#16#0 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE B#16#0 B#16#0 B#16#0 FALSE FALSE FALSE FALSE FALSE FALSE FALSE Comments Count No parameterization Parameterization faulty Module type Interface module wrong or missing Communication error RUN/STOP LED display Watchdog (FM) Internal power supply fault Battery monitoring Defective backup Reserved Rack fault CPU fault EPROM fault RAM fault ADC fault Fuse Process interrupt lost Reserved Channel type Diagnostics data length per channel Channel number Group error channel 1 Not assigned on the FM 350-1 DS1 byte 7 bit 2 DS1 byte 7 bit 3 DS1 byte 7 bit 4 DS1 byte 7 bit 5 DS1 byte 7 bit 6 Measurement No parameterization Parameterization faulty Module type Interface module wrong or missing Communication error RUN/STOP LED display Watchdog (FM) Internal power supply fault Battery monitoring Defective backup Reserved Rack fault CPU fault EPROM fault RAM fault ADC fault Fuse Process interrupt lost Reserved Channel type Diagnostics data length per channel Channel number Group error channel 1 Not assigned on the FM 350-1 DS1 byte 7 bit 2 DS1 byte 7 bit 3 DS1 byte 7 bit 4 DS1 byte 7 bit 5 DS1 byte 7 bit 6

54.6 54.7 55.0 56.0 56.1 56.2 56.3 56.4 56.5 56.6 56.7 57.0 57.1 57.2 57.3 57.4 57.5 57.6 57.7 58.0 59.0 60.0 61.0 61.1 61.2 61.3 61.4 61.5 61.6

NO_CONFIG CONFIG_ERR MDL_TYPE SUB_MDL_ERR COMM_FAULT MDL_STOP WTCH_DOG_F AULT INT_PS_FLT PRIM_BATT_FL T BCKUP_BATT_ FLT RESERVED_2 RACK_FLT PROC_FLT EPROM_FLT RAM_FLT ADU_FLT FUSE_FLT HW_INTR_FLT RESERVED_3 CH_TYPE LGTH_DIA CH_NO GRP_ERR1 GRP_ERR2 D_BIT7_2 D_BIT7_3 D_BIT7_4 D_BIT7_5 D_BIT7_6

BOOL BOOL BYTE BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BYTE BYTE BYTE BOOL BOOL BOOL BOOL BOOL BOOL BOOL

FM 350-1 Function Module A5E00073040-02

10-5

DB Assignments

Table 10-1 DB Assignments, Continued Address Variable Data type Intial value FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE B#16#0 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE B#16#0 B#16#0 B#16#0 B#16#0 B#16#0 Comments Count DS1 byte 7 bit 7 Measurement DS1 byte 7 bit 7

61.7 62.0 62.1 62.2 62.3 62.4 62.5 62.6 62.7 63.0 64.0 64.1 64.2 64.3 64.4 64.5 64.6 64.7 65.0 66.0 67.0 68.0 69.0

D_BIT7_7 CH1_SIGA CH1_SIGB CH1_SIGZ CH1_BETW CH1_5V2 D_BIT8_5 D_BIT8_6 D_BIT8_7 D_BYTE9 CH2_SIGA CH2_SIGB CH2_SIGZ CH2_BETW CH2_5V2 D_BIT10_5 D_BIT10_6 D_BIT10_7 D_BYTE11 D_BYTE12 D_BYTE13 D_BYTE14 D_BYTE15

BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BYTE BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BYTE BYTE BYTE BYTE BYTE

Channel 1, error signal Channel 1, error signal A A Channel 1, error signal Channel 1, error signal B B Channel 1, error signal Channel 1, error signal zero zero Channel 1, error between channels Channel 1, error in 5.2 V encoder supply DS1 byte 8 bit 5 DS1 byte 8 bit 6 DS1 byte 8 bit 7 DS1 byte 9 Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved DS1 byte 11 DS1 byte 12 DS1 byte 13 DS1 byte 14 DS1 byte 15 Channel 1, error between channels Channel 1, error in 5.2 V encoder supply DS1 byte 8 bit 5 DS1 byte 8 bit 6 DS1 byte 8 bit 7 DS1 byte 9 Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved DS1 byte 11 DS1 byte 12 DS1 byte 13 DS1 byte 14 DS1 byte 15

10-6

FM 350-1 Function Module A5E00073040-02

M7 Reference Counter Function Library

11
Page 11-2 11-3 11-4 11-5 11-7 11-9 11-11 11-13 11-15 11-17 11-19 11-21 11-22 11-23 11-24 11-26 11-27 11-28 11-30 11-31 11-33 11-36 11-37

Chapter Overview This chapter contains the descriptions of the functions in alphabetical order as well as the data structures and error codes. It is designed as a reference chapter.

Section 11.1 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 11.10 11.11 11.12 11.13 11.14 11.15 11.16 11.17 11.18 11.19 11.20 11.21 11.22 11.23

You Will Find M7CntDisableOut M7CntDisableSet M7CntEnableOut M7CntEnableSet M7CntInit M7CntLoadAndStart M7CntLoadComp M7CntLoadDirect M7CntLoadPrep M7CntPar M7CntRead M7CntReadDiag M7CntReadLoadValue M7CntReadParError M7CntReadStatus M7CntResetStatus M7CntStart M7CntStop M7CntStopAndRead M7CNT_DIAGINFO M7CNT_PARAM M7CNT_STATUS Error codes

FM 350-1 Function Module A5E00073040-02


Description Disable outputs Disable SET input Enable outputs Enable SET input Initialize counter channel Load and start counter channel Transfer comparison values Load counter channel Prepare loading Parameterize counter channel Read counter value Read diagnostics information Read load value Read parameterization error Read counter status Reset counter status Start counter channel Stop counter channel Stop counter channel and read counter value Contains diagnostics information Contains parameterization data Contains status information Error messages

11-1

M7 Reference Counter Function Library

11.1

M7CntDisableOut

Function Disable outputs

Syntax #include <m7cnt.h> M7ERR_CODE M7CntDisableOut( M7CNT_LOGCHANNEL LogChannel, BOOL SelOut0, BOOL SelOut1);

Description

Return Value 0 0 The function has been executed successfully An error has occurred
Error Code M7CNTE_NO_LOGCHANNEL Meaning The channel specified when calling (LogChannel parameter) is not valid.

See Also Function: M7CntInit, M7CntEnableOut

11-2


Parameter Meaning LogChannel SelOut0 SelOut1 Logical channel number, detected by M7CntInit Selection bit for output 0 Selection bit for output 1

The two outputs of the counter channel can be disabled with this function. The two bits SelOut0 and SelOut1 define which of the two outputs is to be disabled. To disable an output, the desired bit must be set (= TRUE) when the function is called. Both outputs can also be disabled in just one function call. If the bit of an output = FALSE, the status of the output will not be changed: an enabled output remains enabled and a disabled output remains disabled. Default: both outputs are disabled.

FM 350-1 Function Module A5E00073040-02

M7 Reference Counter Function Library

11.2
Function

M7CntDisableSet

Disable SET input Syntax #include <m7cnt.h> M7ERR_CODE M7CntDisableSet( M7CNT_LOGCHANNEL LogChannel, BOOL SelSetUp, BOOL SelSetDn):

Description

Return Value 0 0 The function has been executed successfully An error has occurred
Error Code M7CNTE_NO_LOGCHANNEL Meaning The channel specified when calling (LogChannel parameter) is not valid.

See Also Function: M7CntInit, M7CntEnableSet

FM 350-1 Function Module A5E00073040-02


Parameter Meaning LogChannel SelSetUp SelSetDn Logical channel number, detected by M7CntInit Disable SET input for up count direction Disable SET input for down count direction

The SET digital input for setting each counter channel is disabled with this function. The two bits SelSetUp (up) and SelSetDn (down) determine for which count direction the SET input is to be disabled. To implement the disable function, the desired bit must be set (= TRUE) when the function is called. Both count directions can also be disabled with just one function call (SelSetUp = TRUE and SelSetDn = TRUE). If the bit of a count direction = FALSE, the status of the SET input is not changed: an enabled SET input remains enabled and a disabled SET input remains disabled. Default: the SET input is disabled in both directions.

11-3

M7 Reference Counter Function Library

11.3
Function

M7CntEnableOut

Enable outputs Syntax #include <m7cnt.h> M7ERR_CODE M7CntEnableOut ( M7CNT_LOGCHANNEL LogChannel, BOOL SelOut0, BOOL SelOut1);

Description

Return Value 0 0 The function has been executed successfully An error has occurred
Error Code M7CNTE_NO_LOGCHANNEL Meaning The channel specified when calling (LogChannel parameter) is not valid.

See Also Function: M7CntInit, M7CntDisableOut Example #include M7CNT.H M7CNT_LOGCHANNEL Ch5; if ((Err = M7CntEnableOut (Ch5, TRUE, TRUE)) != M7CNT_DONE) {...error handling...}

11-4


Parameter Meaning LogChannel SelOut0 SelOut1 Logical channel number, detected by M7CntInit Selection bit for output 0 Selection bit for output 1

The two outputs of the counter channel in each case can be enabled with this function. The two bits SelOut0 and SelOut1 (down) determine which of the two outputs is to be enabled. To enable an output, the desired bit must be set (= TRUE) when the function is called. Both outputs can also be enabled with just one function call. If the bit of an output = FALSE, the status of the output is not changed: an enabled output remains enabled and a disabled output remains disabled. Default: both outputs are disabled

FM 350-1 Function Module A5E00073040-02

M7 Reference Counter Function Library

11.4
Function

M7CntEnableSet

Enable SET input Syntax #include <m7cnt.h> M7ERR_CODE M7CntEnableSet( M7CNT_LOGCHANNEL LogChannel, BOOL SelSetUp, BOOL SelSetDn)

Description

Return Value 0 0 The function has been executed successfully An error has occurred
Error Code M7CNTE_NO_LOGCHANNEL Meaning The channel specified when calling (LogChannel parameter) is not valid.

FM 350-1 Function Module A5E00073040-02


Parameter Meaning LogChannel SelSetUp SelSetDn Logical channel number, detected by M7CntInit Enable SET input for up count direction Enable SET input for down count direction

The SET digital input for setting the counter channel in each case is enabled with this function. The two bits SelSetUp (up) and SelSetDn (down) determine for which count direction the SET input is to be enabled. To implement the enable function, the desired bit must be set (= TRUE) when the function is called. Both count directions can also be enabled with just one function call (SelSetUp = TRUE and SelSetDn = TRUE). If the bit of a count direction = FALSE, the status of the SET input is not changed: an enabled SET input remains enabled and a disabled SET input remains disabled. The actual setting of the counter channel is carried out, depending on parameterization, either with the rising edge at the SET input or with the zero mark signal with simultaneously active SET signal. Default: the SET input is disabled in both directions.

11-5

M7 Reference Counter Function Library

See Also Function: M7CntInit, M7CntEnableSet

11-6

FM 350-1 Function Module A5E00073040-02

M7 Reference Counter Function Library

11.5

M7CntInit

Function Initialize counter channel

Syntax #include <m7cnt.h> M7ERR_CODE M7CntInit( M7IO_BASEADDR Baddr , UBYTE PType, UBYTE Channel, M7CNT_LOGCHANNEL_PTR pLogChannel);

Description

FM 350-1 Function Module A5E00073040-02


Parameter Meaning Baddr Base address of the interface submodule or the counter module PType I/O type of the counter channel. (Please specify one of the values M7IO_IN or M7IO_OUT, it does not matter which) Channel number: Channel In the case of single-channel counter modules/submodules, this is always 1 In the case of multi-channel counter modules, this is the number of the counter channel Logical channel number (return signal) pLogChannel

The function must be called once for each counter channel used. Baddr, Ptype and Channel identify a counter channel. The function assigns a logical channel number to this counter channel. This logical channel number is used to access this channel by all other functions of the counter function library.

11-7

M7 Reference Counter Function Library

Return Value 0 0 The function has been executed successfully An error has occurred
Error Code M7CNTE_CHANNEL_WRONG M7CNTE_PTYPE_WRONG M7CNTE_TIMEOUT Meaning The channel number specified when calling the function (Channel parameter) is wrong The I/O type specified when calling the function (Ptype parameter) is wrong A time overflow has occurred while accessing the counter channel since the counter channel has not responded. The submodule/module at the address specified is not a counter submodule/module. There is no submodule/module at the address specified

M7CNTE_NO_COUNTER M7CNTE_INVALID_BADDR

Example #include M7CNT.H #define CNT_BADDR M7CNT_LOGCHANNEL 320 Ch5;

/* Initialize counter channel 1 of the counter module */ /* The counter channel has I/O type M7IO_IN.*/ /* The logical channel number is returned in Ch5. */ if ((M7CntRet = M7CntInit(CNT_BADDR, M7IO_IN,1,&Ch5)) != M7CNT_DONE) {...error handling...}

11-8

FM 350-1 Function Module A5E00073040-02

M7 Reference Counter Function Library

11.6

M7CntLoadAndStart

Function Load and start counter channel (for operating modes with software gate control)

Syntax #include <m7cnt.h> M7ERR_CODE M7CntLoadAndStart( M7CNT_LOGCHANNEL LogChannel, DWORD LoadVal);

Description

FM 350-1 Function Module A5E00073040-02


Parameter Meaning LogChannel LoadVal Logical channel number, detected by M7CntInit Load value

The function transfers the load value specified at the time of calling direct to the counter channel. Thereafter, the counter channel is started via the software gate. The function only works error-free in the counter operating modes with software gate control. In the operating modes with hardware gate control, an operating error is signaled but the load value is transferred anyway. In the case of the operating modes with hardware gate control, use the M7CntLoadDirect or M7CntLoadPrep functions to load the counter channel. Default: the counter channel is preset with 0 and stopped.

Note The load value is interpreted depending on the count mode set for the counter channel. Please ensure that the load value specified is within the count range.

11-9

M7 Reference Counter Function Library

Return Value 0 0 The function has been executed successfully An error has occurred

Return Value 0 0 The function has been executed successfully An error has occurred
Error Code Meaning The counter channel cannot be started in this operating mode (with hardware gate control). The channel specified when calling (LogChannel parameter) is not valid.

M7CNTE_FS_NO_START
M7CNTE_NO_LOGCHANNEL

See Also Function: M7CntInit, M7CntLoadDirect, M7CntLoadPrep, M7CntStart, M7CntReadLoadValue

11-10

FM 350-1 Function Module A5E00073040-02

M7 Reference Counter Function Library

11.7

M7CntLoadComp

Function Transfer Comparison Value

Syntax #include <m7cnt.h> M7ERR_CODE M7CntLoadComp( M7CNT_LOGCHANNEL LogChannel, DWORD CmpV1, DWORD CmpV2, BOOL SelCmp1, BOOL SelCmp2);

Description

FM 350-1 Function Module A5E00073040-02


Parameter Meaning LogChannel CmpV1 CmpV2 Logical channel number, detected by M7CntInit Comparison value 1 Comparison value 2 SelCmp1 SelCmp2 Selection bit for comparison value 1 Selection bit for comparison value 2

You can transfer the two comparison values CmpV1 and CmpV2 to the counter channel in each case using this function. The selection bits SelCmp1 and SelCmp2 determine whether the associated comparison value is to be transferred (SelCmpx = TRUE) or not (SelCmpx = FALSE). - If SelCmp1 = TRUE and SelCmp2 = TRUE, both comparison values can also be transferred simultaneously in one function call. If one selection bit is FALSE, the associated comparison value will not be transferred and the old value is retained. Default setting: The comparison values are set to 0 as default.

11-11

M7 Reference Counter Function Library

Note The comparison values are interpreted in accordance with the count mode set for the counter channel. Please ensure that the comparsion values specified are within the count range.

Return Value 0 0 The function has been executed successfully An error has occurred
Error Code M7CNTE_NO_LOGCHANNEL Meaning The channel specified when calling (LogChannel parameter) is not valid.

See Also Function: M7CntInit

Example #include M7CNT.H M7CNT_LOGCHANNEL DWORD DWORD Ch5; CmpValue1=100; CmpValue2=200;

if ((Err = M7CntLoadComp (Ch5, CmpValue1, CmpValue2, TRUE, TRUE)) != M7CNT_DONE) {...error handling...}

11-12

FM 350-1 Function Module A5E00073040-02

M7 Reference Counter Function Library

11.8

M7CntLoadDirect

Function Load Counter Channel

Syntax #include <m7cnt.h> M7ERR_CODE M7CntLoadDirect( M7CNT_LOGCHANNEL LogChannel, DWORD LoadVal);

Description

Return Value 0 0 The function has been executed successfully An error has occurred
Error Code M7CNTE_NO_LOGCHANNEL Meaning The channel specified when calling (LogChannel parameter) is not valid.

FM 350-1 Function Module A5E00073040-02


Parameter Meaning LogChannel LoadVal Logical channel number, detected by M7CntInit Load value

The function transfers the load value (LoadVal) specified when the call was made, direct to the counter channel in each case. The function is also executed while the counter channel is operating. Default: the counter channel is set to 0 and stopped as default.

Note The load value is interpreted in accordance with the count mode set for the counter channel. Please ensure that the load value specified is within the count range.

11-13

M7 Reference Counter Function Library

See Also Function: M7CntInit, M7CntLoadAndStart, M7CntLoadPrep, M7CntReadLoadValue

Example #include M7CNT.H M7CNT_LOGCHANNEL DWORD Ch5; LoadValue=100;

if ((Err = M7CntLoadDirect (Ch5, LoadValue)) != M7CNT_DONE) {...error handling...}

11-14

FM 350-1 Function Module A5E00073040-02

M7 Reference Counter Function Library

11.9
Function

M7CntLoadPrep

Prepare Loading of the Counter Channel Syntax #include <m7cnt.h> M7ERR_CODE M7CntLoadPrep( M7CNT_LOGCHANNEL LogChannel, DWORD LoadVal);

Description

Return Value 0 0 The function has been executed successfully An error has occurred
Error Code M7CNTE_NO_LOGCHANNEL Meaning The channel specified when calling (LogChannel parameter) is not valid.

FM 350-1 Function Module A5E00073040-02


Parameter Meaning LogChannel LoadVal Logical channel number, detected by M7CntInit Load value

The function transfers the load value (LoadVal) specified when the call was made, into the counter-internal load register. From there, the load value is transferred into the counter channel and counted further from there if: a hardware pulse is present at the SET or START input an overflow or an underflow occurs (and a periodic operating mode is set) the M7CntStart function is called

Note The load value is interpreted in accordance with the count mode set for the counter channel. Please ensure that the load value specified is within the count range of the count mode set.

You can then read the current load value with the M7CntReadLoadValue function. However, the function only supplies the new load value when one of the three conditions has occurred and one count pulse has been received.

11-15

M7 Reference Counter Function Library

See Also Function: M7CntInit, M7CntLoadAndStart, M7CntLoadDirect, M7CntReadLoadValue

11-16

FM 350-1 Function Module A5E00073040-02

M7 Reference Counter Function Library

11.10

M7CntPar

Function Parameterize Counter Channel

Syntax #include <m7cnt.h> M7ERR_CODE M7CntPar( M7CNT_LOGCHANNEL LogChannel, M7CNT_PARAM_PTR pCntParam);

Description

FM 350-1 Function Module A5E00073040-02


Parameter Meaning LogChannel pCntParam Logical channel number, detected by M7CntInit Pointer to the structure M7CNT_PARAM with the parameterization data

The function is called if the current parameters of the counter channel are to be changed. Before calling the function, you must enter the desired parameterization data in the M7CNT_PARAM structure. After this, the function is called to parameterize the counter channel specified. The new settings become effective immediately.

Note When the M7CntPar function is called, the current parameterization data are always completely overwritten and part parameterizations cannot be made.

When the M7CntPar function is called, the current parameterization data are always completely overwritten and part parameterizations cannot be made. Any previously stored enable of the inputs or outputs will also be lost as a result of reparameterization. This means that the M7CntEnableSet or M7CntEnableOut functions, for example, may need to be called again after M7CntPar Reparameterization overwrites already set comparison values and the load value. In addition, counter pulses may be lost when reparameterizing with the M7CntPar function. In the FM 450-1, the other channel remains unaffected by reparameterization. Errors in parameter assignment result in initiation of a diagnostics interrupt.

11-17

M7 Reference Counter Function Library

Return Value 0 0 The function has been executed successfully An error has occurred
Error Code M7CNTE_NO_LOGCHANNEL Meaning The channel specified when calling (LogChannel parameter) is not valid.

See Also Function: M7CntInit Structure: M7CNT_PARAM

Example
#include <m7cnt.h> M7CNT_LOGCHANNEL LogChannel; M7CNT_PARAM DS128; /*******Initialization of DS128def*******/ DS128.IntMask= M7CNT_NO_INT; /*Int. mask bits: no interrupt enabled*/ DS128.EncSel= M7CNT_ENC_5V; /*Receiver select.: 5-V cnt signal*/ DS128.WireBrk= M7CNT_WIRE_NON; /*Diagn. active: no diagn.*/ DS128.SigEval= M7CNT_SIG_1; /*Signal evaluation: single*/ DS128.FilCnt= M7CNT_FCNT_200KHZ; /*Filter cnt inp.: 200 kHz*/ DS128.FilDI= M7CNT_FDI_200KHZ; /*Filter dig. inp.: 200 kHz*/ DS128.CntMod= M7CNT_CNTMOD_32BIT; /*Cnt mode: 32 bits w/o sign*/ DS128.SynMod= M7CNT_SYNMOD_ONE; /*Synch. type: single*/ DS128.SynZero= M7CNT_SYNZERO_NO; /*Zero mark synch.: w/o zero mark*/ DS128.SigInv= M7CNT_SIGINV_NO; /*Direction change track B: not inv.*/ DS128.ModHWG= M7CNT_HWGATE_LEVEL; /*Gate setting HW gate: level-contr.*/ DS128.ConGate= M7CNT_CONGATE_NO; /*Gate contr. f. cont. cnt.: disabled*/ DS128.ConHWG= M7CNT_CONHWG_NO; /*HW gate for cont. cnt: disabled*/ DS128.ConSWG= M7CNT_CONSWG_NO; /*SW gate for cont. cnt: disabled*/ DS128.MethDQ0= M7CNT_DQ_AB; /*Behavior of output OUT0: switch off*/ DS128.MethDQ1= M7CNT_DQ_AB; /*Behavior of output OUT1: switch off*/ DS128.PulsDur= 200; /*Pulse duration: 200 ms*/ DS128.HystVal= 0x0; /*Hysteresis: 0 pulses*/ DS128.OpMod= M7CNT_CMOD_BA0; /*Mode: continuous counting*/ DS128.Reserved12= 0x0; DS128.Reserved13= 0x0; DS128.Reserved14= 0x0; DS128.Reserved15= 0x0; /******Parameterization of the counter******/ if (M7CntPar(LogChannel,&DS128)!=M7CNT_DONE) { /*error handling*/ }

11-18

FM 350-1 Function Module A5E00073040-02

M7 Reference Counter Function Library

11.11
Function

M7CntRead

Read Counter Value Syntax #include <m7cnt.h> M7ERR_CODE M7CntRead( M7CNT_LOGCHANNEL LogChannel, DWORD_PTR pActCntV);

Description

Return Value 0 0 The function has been executed successfully An error has occurred
Error Code M7CNTE_NO_LOGCHANNEL Meaning The channel specified when calling (LogChannel parameter) is not valid.

See Also Function: M7CntInit, M7CntStopAndRead

FM 350-1 Function Module A5E00073040-02


Parameter Meaning LogChannel pActCntV Logical channel number, detected by M7CntInit Pointer to current counter status

The current counter status of the counter channel is read and stored in pActCntV.

Note The macros M7InitISADesc and M7LoadISADWord from the M7-API are available for reading the counter status of an IF counter submodule. Access is via the high-speed ISA bus.

11-19

M7 Reference Counter Function Library

Example #include M7CNT.H M7CNT_LOGCHANNEL DWORD Ch5; ZaehlerStand;

if ((M7CntRet = M7CntRead (Ch5, &ZaehlerStand)) != M7CNT_DONE) {...error handling...}

11-20

FM 350-1 Function Module A5E00073040-02

M7 Reference Counter Function Library

11.12
Function

M7CntReadDiag

Read Diagnostics Information Syntax #include <m7cnt.h> M7ERR_CODE M7CntReadDiag( M7CNT_LOGCHANNEL LogChannel, M7CNT_DIAGINFO_PTR pDiagInfo);

Description

Return Value 0 0 The function has been executed successfully An error has occurred
Error Code M7CNTE_NO_LOGCHANNEL Meaning The channel specified when calling (LogChannel parameter) is not valid.

Example #include M7CNT.H M7CNT_LOGCHANNEL M7CNT_DIAGINFO Ch5; CntDiagInfo;

See Also Function: M7CntInit, M7CntReadParError Structure: M7CNT_DIAGINFO

FM 350-1 Function Module A5E00073040-02


Parameter Meaning LogChannel pDiagInfo Logical channel number, detected by M7CntInit Pointer to M7CNT_DIAGINFO structure with the diagnostics information

When this function is called, the diagnostics data set DS1 is read and stored in pDiagInfo. You should then call the M7CntReadDiag function if you receive a diagnostics interrupt Error on the channel (diagnostics byte 0, bit 3=1). The M7CNT_DIAGINFO structure supplies you with the diagnostics data set DS1 which contains additional channel-specific diagnostics information. The structure of the diagnostics data set DS1 is explained in Chapter 12.

if ((Err = M7CntReadDiag(Ch5, &CntDiagInfo)) != M7CNT_DONE) {...error handling...}

11-21

M7 Reference Counter Function Library

11.13

M7CntReadLoadValue

Function Read Load Value

Syntax #include <m7cnt.h> M7ERR_CODE M7CntReadLoadValue( M7CNT_LOGCHANNEL LogChannel, DWORD_PTR pActLoad);

Description

Return Value 0 0 The function has been executed successfully An error has occurred
Error Code M7CNTE_NO_LOGCHANNEL Meaning The channel specified when calling (LogChannel parameter) is not valid.

See Also Function: M7CntInit, M7CntLoadAndStart, M7CntLoadDirect, M7CntLoadPrep

11-22


Parameter Meaning LogChannel pActLoad Logical channel number, detected by M7CntInit Pointer to the ActLoad load value

The function reads the current load value of the counter channel and stores it in pActLoad.

FM 350-1 Function Module A5E00073040-02

M7 Reference Counter Function Library

11.14
Function

M7CntReadParError

Read Parameterization Error Syntax #include <m7cnt.h> M7ERR_CODE M7CntReadParError( M7CNT_LOGCHANNEL LogChannel, WORD_PTR pParError);

Description

Return Value 0 0 The function has been executed successfully An error has occurred
Error Code M7CNTE_NO_LOGCHANNEL Meaning The channel specified when calling (LogChannel parameter) is not valid.

See Also Function: M7CntInit, M7CntPar, M7CntReadDiag, Structure: M7CNT_DIAGINFO Error Codes, Tabelle 11-4.

FM 350-1 Function Module A5E00073040-02


Parameter Meaning LogChannel pParError Logical channel number, detected by M7CntInit Pointer to pParError parameterization error

You call this function if you have received a diagnostics interrupt (diagnostics byte 0, bit 7==1) due to a parameterization error. The function reads the last occurring parameterization error and stores it in pParError. See Table 11-4 for the meanings of the parameterization errors.

11-23

M7 Reference Counter Function Library

Example #include M7CNT.H M7CNT_LOGCHANNEL WORD Ch5; ParError;

if ((Err = M7CntReadParError (Ch5, &pParError)) != M7CNT_DONE) {...error handling...}

11.15
Function

M7CntReadStatus

Read Counter Status Syntax #include <m7cnt.h> M7ERR_CODE M7CntReadStatus( M7CNT_LOGCHANNEL LogChannel, M7CNT_STATUS pCntStatus);

Description

Return Value 0 0 The function has been executed successfully An error has occurred
Error Code M7CNTE_NO_LOGCHANNEL Meaning The channel specified when calling (LogChannel parameter) is not valid.

11-24


Parameter Meaning LogChannel pCntStatus Logical channel number, detected by M7CntInit Pointer to the M7CNT_STATUS structure with the counter status

When this function is called, the counter status byte and the status of the inputs and outputs are read and stored in the M7CNT_STATUS structure. The structure is designed so that you can access the information bit-by-bit.

FM 350-1 Function Module A5E00073040-02

M7 Reference Counter Function Library

Example #include M7CNT.H M7CNT_LOGCHANNEL Ch5;

if ((Err = M7CntReadStatus (Ch5, &CntStatus)) != M7CNT_DONE) {...error handling...} See Also Function: M7CntInit, M7CntResetStatus, Structure: M7CNT_STATUS

FM 350-1 Function Module A5E00073040-02

11-25

M7 Reference Counter Function Library

11.16
Function

M7CntResetStatus

Reset Counter Status Syntax #include <m7cnt.h> M7ERR_CODE M7CntResetStatus( M7CNT_LOGCHANNEL LogChannel, BOOL SelSynr, BOOL SelCmpStatus);

Description

Return Value 0 0 The function has been executed successfully An error has occurred
Error Code M7CNTE_NO_LOGCHANNEL Meaning The channel specified when calling (LogChannel parameter) is not valid.

See Also Function: M7CntInit, M7CntReadStatus, Structure: M7CNT_STATUS Example #include M7CNT.H M7CNT_LOGCHANNEL Ch5;

11-26


Parameter Meaning LogChannel SelSynr Logical channel number, detected by M7CntInit The Counter synchronization reached status bit is reset (TRUE) or not reset (FALSE) SelCmpStatus The Zero pass, Overflow, Underflow status bits are reset (TRUE) or not reset (FALSE)

The Counter synchronization reached, Zero pass, Overflow, and Underflow status bits of the counter channel can be reset using this function.

if ((Err = M7CntResetStatus (Ch5, TRUE, TRUE)) != M7CNT_DONE) {...error handling...}

FM 350-1 Function Module A5E00073040-02

M7 Reference Counter Function Library

11.17

M7CntStart

Function Start Counter Channel - for Operating Modes with Software Gate Control

Syntax #include <m7cnt.h> M7ERR_CODE M7CntStart(M7CNT_LOGCHANNEL LogChannel);

Description

Return Value 0 0 The function has been executed successfully An error has occurred
Error Code M7CNTE_NO_LOGCHANNEL Meaning The channel specified when calling (LogChannel parameter) is not valid. Operator error: the counter channel cannot be started in this operating mode

See Also Function: M7CntInit, M7CntLoadAndStart

FM 350-1 Function Module A5E00073040-02


Parameter Meaning LogChannel Logical channel number, detected by M7CntInit

The counter channel is started via the software gate with this function. The function only works error-free in the counter modes with software gate control. In the case of the operating modes with hardware gate control, an operator error is signaled.

M7CNTE_FS_NO_START

11-27

M7 Reference Counter Function Library

Example #include M7CNT.H M7CNT_LOGCHANNEL Ch5;

if ((Err = M7CntStart (Ch5)) != M7CNT_DONE) {...error handling...}

11.18

M7CntStop

Function Stop Counter Channel

Syntax #include <m7cnt.h> M7ERR_CODE M7CntStop(M7CNT_LOGCHANNEL LogChannel);

Description

11-28


Parameter Meaning LogChannel Logical channel number, detected by M7CntInit

The counter channel is stopped with this function. The function is effective in all operating modes with gate control (hardware and software gate control). In the continuous counting without gate control mode, an operator error is signaled. In the operating modes with software gate control, the counter channel can be restarted with the M7CntLoadAndStart or M7CntStart functions. The counter channel then starts alternative with the load value (M7CntStart) already in the load register the load value transferred when the M7CntLoadAndStart function was called

Note When the M7CntStop function is called in the operating modes with hardware gate control, the counter channel cannot be started until the parameters have been reassigned.

FM 350-1 Function Module A5E00073040-02

M7 Reference Counter Function Library

Return Value 0 0 The function has been executed successfully An error has occurred
Error Code M7CNTE_NO_LOGCHANNEL Meaning The channel specified when calling (LogChannel parameter) is not valid. Operator error: the counter channel cannot be stopped in this operating mode

M7CNTE_FS_NO_STOP

See Also Function: M7CntInit, M7CntLoadAndStart, M7CntStart, M7CntStopAndRead

Example #include M7CNT.H M7CNT_LOGCHANNEL Ch5; if ((Err = M7CntStop (Ch5)) != M7CNT_DONE) {...error handling...}

FM 350-1 Function Module A5E00073040-02

11-29

M7 Reference Counter Function Library

11.19
Function

M7CntStopAndRead

Stop Counter Channel and Read Counter Value Syntax #include <m7cnt.h> M7ERR_CODE M7CntStopAndRead( M7CNT_LOGCHANNEL LogChannel, DWORD_PTR pActCntV);

Description

Return Value 0 0 The function has been executed successfully An error has occurred
Error Code M7CNTE_NO_LOGCHANNEL Meaning The channel specified when calling (LogChannel parameter) is not valid. Operator error: the counter channel cannot be stoped in this operating mode.

11-30


Parameter Meaning LogChannel pActCntV Logical channel number, detected by M7CntInit Pointer to current counter status

This function stops the counter channel and reads the counter status. The function is effective in all operating modes with gate control (hardware and software gate control). In the continuous counting without gate control mode, an operator error is signaled. In the operating modes with software gate control, the counter channel can be restarted with the M7CntLoadAndStart or M7CntStart functions. The counter channel then starts alternative with the load value (M7CntStart) already in the load register

the load value transferred when the M7CntLoadAndStart function was called

Note When the M7CntStopAndRead function is called in the operating modes with hardware gate control, the counter channel cannot be started until the parameters have been reassigned.

M7CNTE_FS_NO_STOP

FM 350-1 Function Module A5E00073040-02

M7 Reference Counter Function Library

See Also Function: M7CntInit, M7CntStop, M7CntStart, M7CntLoadAndStart

11.20
Function

M7CNT_DIAGINFO

The structure is used for evaluating diagnostics messages with the M7CntReadDiag function.

Syntax
struct { unsigned MdlDef:1; unsigned IntFlt:1; unsigned ExtFlt:1; unsigned PntInfo:1; unsigned ExtVolt:1; unsigned FldConn:1; unsigned NoConfig:1; unsigned ConfigEr:1; unsigned MdlType:4; unsigned ChInfo:1; unsigned ModInfo:1; unsigned :2; unsigned SubMdlEr:1; unsigned CommFlt:1; unsigned MdlStop:1; unsigned WtchDogF:1; unsigned IntPSFlt:1; unsigned PrimBat:1; unsigned BckupBat:1; unsigned :1; unsigned RackFlt:1; unsigned ProcFlt:1; unsigned EpromFlt:1; unsigned RamFlt:1; unsigned ADUFlt:1; unsigned FuseFlt:1; unsigned HWIntrF:1; unsigned :1; UBYTE ChType; UBYTE LgthDia; UBYTE ChNo; unsigned GrpErr1:1; /* /* /* /* /* /* /* /* /* /* /* /* /* /* /* /* /* /* /* /* /* /* /* /* /* /* /* /* /* /* /* /* Module fault */ Fault, internal */ Fault, external */ Fault in one channel */ Ext. aux. voltage */ Front connector missing */ Parameterization missing*/ Parameterization error */ Type class */ Channel information*/ Module information */ Reserve */ Wrong/missing interf. submod. */ Communications fault */ RUN/STOP operating state */ Watchdog tripped */ Intern. volt. failure */ Battery empty */ Backup failed*/ Reserve */ Rack fault */ Processor fault*/ EPROM fault */ RAM fault */ ADC/DAC fault*/ Fuse tripped */ Process interrupt lost */ Reserve */ Channel type */ Diagn. info length per channel*/ Channel number */ Channel group error 1 */

FM 350-1 Function Module A5E00073040-02

11-31

M7 Reference Counter Function Library

unsigned GrpErr2:1; unsigned :6; unsigned Ch1SigA:1; unsigned Ch1SigB:1; unsigned Ch1SigZ:1; unsigned Ch1Betw:1; unsigned Ch15V2:1; unsigned :3; unsigned Ch2SigA:1; unsigned Ch2SigB:1; unsigned Ch2SigZ:1; unsigned Ch2Betw:1; unsigned Ch25V2:1; unsigned :3; UBYTE Reserved11; } M7CNT_DIAGINFO;

/* /* /* /* /* /* /* /* /* /* /* /* /* /* /*

Channel Reserve Channel Channel Channel Channel Channel Reserve Channel Channel Channel Channel Channel Reserve Reserve

group error 2 */ */ 1, signal A fault */ 1, signal B fault */ 1, signal N fault */ 1, fault between channels*/ 1, 5.2 V encoder supply */ */ 2, signal A fault */ 2, signal B fault */ 2, signal N fault */ 2, fault between channels*/ 2, 5.2-V encoder supply */ */ */

11-32

FM 350-1 Function Module A5E00073040-02

M7 Reference Counter Function Library

11.21

M7CNT_PARAM

Function The structure is used for parameterizing the counter channel with the M7CntPar function.

Syntax
struct { UWORD IntMask; /* Bit 0: IOpenGate /* Bit 1: ICloseGate /* Bit 2: Ioflw /* Bit 3: Iuflw /* Bit 4: ICmp1Up /* Bit 5: ICmp1Dn /* Bit 6: ICmp2Up /* Bit 7: ICmp2Dn /* Bit 8: Izero /* Bit 9 bis 11: /* Bit 12: Isync /* Bit 13 bis 15: UWORD EncSel; UWORD WireBrk; UWORD SigEval; UWORD FilCnt; UWORD FilDI; unsigned CntMod:1; unsigned SynMod:1; unsigned SynZero:1; unsigned SigInv:1; unsigned ModHWG:1; unsigned ConGate:1; unsigned ConHWG:1; unsigned ConSWG:1; unsigned : 8; UWORD MethDQ0; UWORD MethDQ1; UWORD PulsDur; UWORD HystVal; UWORD OpMod; UWORD Reserved12; UWORD Reserved13; UWORD Reserved14; UWORD Reserved15; } M7CNT_PARAM; /* Interrupt mask bits */ Int. on opening the gate */ Int. on closing the gate */ Int. on overflow*/ Int. on underflow */ Int. on reaching comp. val.1 up*/ Int. on reaching comp. val.1 down*/ Int. on reaching comp. val.2 up*/ Int. on reaching comp. val.2 down*/ Int. on zero pass */ Reserve */ Int. on synchronization */ Reserve */ /* Encoder selection */ /* Activate wirebreak detector*/ /* Evaluation of the signals */ /* Input filter counter inputs*/ /* Input filter digital inputs*/ /* Count mode */ /* Synchronization type */ /* Zero mark on synchronization */ /* Inv. of cnt inp. signals */ /* Gate setting HW gate */ /* Gate contr. for cont. cnt*/ /* HW gate for cont. cnt */ /* SW gate for cont. cnt */ /* Reserve */ /* Behavior of output DO0 */ /* Bahavior of output DO1 */ /* Pulse duration */ /* Hysteresis */ /* Operating mode */ /* Reserve */ /* Reserve */ /* Reserve */ /* Reserve */

Note The reserve bits and words of the structure must be initialized with 0, otherwise the counter channel could enter an undefined state. The hysteresis value cannot be set and the HystVal parameter is not evaluated.

FM 350-1 Function Module A5E00073040-02

11-33


M7 Reference Counter Function Library
Table 11-1 Detailed Specifications of the Parameterization Data FilDI FilCnt; SigEval WireBrk EncSel Isync Izero ICmp2Dn ICmp2Up ICmp1Dn ICmp1Up Iuflw Ioflw ICloseGate Interrupt on closing the internal gate IOpenGate Interrupt mask bits (word 0) Parameter Input filter for digital inputs Input filter for counter WORD { 200 kHz | 50 kHz } inputs with IF 961-CT1 Evaluation of the signals Diagnostics active for wirebreak detection on signal pair Receiver selection Interrupt on synchronization Interrupt on zero pass Interrupt on reaching comparison value 2 in down direction Interrupt on reaching comparison value 2 in up direction Interrupt on reaching comparison value 1 in down direction Interrupt on reaching comparison value 1 in up direction Interrupt on underflow Interrupt on overflow Interrupt on opening the internal gate Meaning WORD { 200 kHz | 50 kHz } with IF 961-CT1 WORD {single | double | quadruple | clock | direction} WORD { A, B, N | A | A,B | no diagnostics} WORD {5V count signal | 24V count signal} with IF 961-CT1 BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL BOOL Data Type { 200 kHz | 20 kHz } with FM 350, 450-1 { 200 kHz | 20 kHz } with FM 350, 450-1 {5 V count signal 24 V count signal source output 24 V count signal sink output} with FM 350/4 {masked | free} {masked | free} {masked | free} {masked | free} {masked | free} {masked | free} {masked | free} {masked | free} {masked | free} {masked | free} Value Range {0|1} {0|1} {0|1| 2 |3} {0|1| 2|3} {0|1|2} {0|1} {0|1} {0|1} {0|1} {0|1} {0|1} {0|1} {0|1} {0|1} {0|1} {0|1} Coding 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Default 12 8 7 6 4 3 2 1 0 5 Bit

11-34

FM 350-1 Function Module A5E00073040-02

FM 350-1 Function Module A5E00073040-02

Table 11-1 Detailed Specifications of the Parameterization Data, continued Parameter Meaning Data Value Range Type

OpMod

HystVal

PulsDur

MethDQ1

MethDQ0

ConSWG

ConHWG

ConGate

ModHWG

SigInv

SynZero

SynMod

CntMod

See Section 8 Behavior of the Digital Outputs

Operating mode

Hysteresis

Pulse duration

Behavior of output DO1

Behavior of output DO0

Software gate for continuous counting mode

Hardware gate for continuous counting mode

Gate control for continuous counting mode

Gate setting hardware gate

Change of direction with track B

Zero mark on synchronization

Synchronization type

Count limits

WORD { Continuous counting (with or without gate) |

WORD { 0 : 255 } D cannot be set, the parameter is not evaluated

WORD { 0 : 500 } D

active for Pulse duration on WORD overrange up direction |

WORD { switch off |

BOOL

BOOL

BOOL

BOOL

BOOL

BOOL

BOOL

BOOL

periodic counting with HW gate }

periodic counting with SW gate |

single counting with HW gate|

single counting with SW gate |

active for Pulse duration on overrange or underrange }*

active for Pulse duration on underrange down direction |

active from comparison value to underflow |

active from comparison value to overflow |

{ disabled | free }

{ disabled | free }

{ disabled | enabled }

{level-controlled| edge-controlled}

{ not inverted | inverted }

{with zero mark | without zero mark }

{ 32 bit (without sign) | +/ 31 bit }

{ single | periodic }

M7 Reference Counter Function Library

{ 0:FF } H

{0:1F4}H

{0|

{0|1}

{0|1}

{0|1}

{0|1}

{0|1}

{0|1}

{0|1}

{0|1}

{0|

1|

Coding

3|

4}

3|

2|

1|

5}

4|

2|

Default

11-35
7 6 5 4 3 2 1 0 Bit

M7 Reference Counter Function Library

11.22

M7CNT_STATUS

Function The structure is used for status scanning with the M7CntReadStatus function.

Syntax
struct { unsigned unsigned unsigned unsigned unsigned StsSet:1; :1; StsSta:1; StsStp:1; StsCmp1:1; /* /* /* /* /* /* /* /* /* /* /* /* /* /* /* Status: SET input 1 = active */ Filler bit*/ Status: START input 1 = active */ Status: STOP input 1 = active */ Status:Output comparator 1 1 = on */ Status: Output comparator 2 1 = on */ Reserve */ Status: Counter is running */ Status: Direction of count, 0 = up, 1 = down*/ Status: Zero pass 1 = occurred*/ Status:Counter overflow 1 = occurred*/ Status: Counter underflow 1 = occurred */ Status: Counter synchronization 1 = carried out */ Status gate, 1 = open*/ Status SW gate, 1 = open */

unsigned StsCmp2:1; unsigned :2; unsigned StsRun:1; unsigned StsDir:1; unsigned StsZero:1; unsigned StsOflw:1; unsigned StsUflw:1; unsigned StsSync:1; unsigned StsGate:1; unsigned StsSWG:1; } M7CNT_STATUS;

11-36

FM 350-1 Function Module A5E00073040-02

M7 Reference Counter Function Library

11.23

Error Codes

Return Value The success or failure of a function is indicated by the return value. The return value is of the M7ERR_CODE data type. The function supplies the following return values: M7CNT_DONE: !=M7CNT_DONE: Function completed successfully Error in execution

If an error occurs, the return value will not equal 0. The cause of the error can be limited with the help of this value. Definitions for the error codes are stored in the header file M7CNT.H.


Return Value Meaning 0 No error 1 to 99 Operator error 200 to 400 1 to 999 Parameterization error M7API function error (e.g. I/O configuration error) 1000 to 1100 Error in the counter function (e.g. invalid channel number) Table 11-2 Operator Errors Error Code M7CNTE_FS_NO_START No. 1 Meaning The counter cannot be started in this operating mode The counter cannot be stopped in this operating mode Remedy Select an operating mode with software gate control Select an operating mode with software gate control M7CNTE_FS_NO_STOP

FM 350-1 Function Module A5E00073040-02

11-37

M7 Reference Counter Function Library

Table 11-3 Counter Function Errors Error Code M7CNTE_CHANNEL_WRONG No. 1000 Meaning The channel number (Channel parameter) specified at the call is wrong The I/O type (Ptype parameter) specified at the call is wrong The channel (LogChannel parameter) specified at the call is invalid A time overflow has occurred when accessing the counter channel since the counter has not responded The submodule/module at the address specified is not a counter submodule/module Remedy Channel = 1 for IF counters and FM 350 Channel = {1 | 2} for FM 450-1 PType={M7IO_IN|M7IO_OUT}

M7CNTE_PTYPE_WRONG

1001

M7CNTE_NO_LOGCHANNEL

1002

Call the M7CntInit function for the counter channel and use the returned logical channel number Check to see if the accessed submodule is a counter module or a counter interface submodule or if the submodule is defective Check to see if the correct starting address of the counter module or the counter interface submodule has been specified in the Baddr parameter of the M7CntInit function Check to see if the correct starting address of the counter module or the counter interface submodule has been specified in the Baddr parameter of the M7CntInit function

M7CNTE_TIMEOUT

1003

M7CNTE_NO_COUNTER

1004

M7CNTE_INVALID_BADDR

1005

There is no submodule/module at the address specified

11-38

FM 350-1 Function Module A5E00073040-02

M7 Reference Counter Function Library

Table 11-4 Parameterization Errors Error Code M7CNTE_PAR_ENC_SEL No. 201 Meaning Coding for receiver selection wrong Remedy Please change the relevant parameter of the M7CNT_PARAM* structure or in the case of the FM 350 the coding key.


M7CNTE_PAR_WIRE_BRK M7CNTE_PAR_SIG_EVAL M7CNTE_PAR_FIL_CNT M7CNTE_PAR_FIL_DI 202 203 204 205 206 207 208 209 210 211 Coding for diagnostics of the signal pair wrong Coding for the evaluation of the signals wrong Coding for input filter counter input 24 V wrong Coding for input filter digital inputs wrong Change of direction not permissible M7CNTE_PAR_SIG_INV M7CNTE_PAR_METH_DQ0 M7CNTE_PAR_METH_DQ1 M7CNTE_PAR_PULS_DUR M7CNTE_PAR_HYST_VAL M7CNTE_PAR_OP_MOD Coding for behavior of Q0 wrong Coding for behavior of Q1 wrong Pulse duration too long Hysteresis too great Please change the relevant parameter of th t f the M7CNT PARAM structure* M7CNT_PARAM structure Wrong operating mode M7CNTE_PAR_SW_HW_GAT 212 E M7CNTE_PAR_DIR_IMP_AL 215 Both gate types or no gate type specified Direction for pulse output and process interrupt must be same Interrupts from internal gate only possible in operating mode with gate M7CNTE_PAR_AL_GATE 216 M7CNTE_PAR_AL_METH_D Q 217 Output behavior and interrupt mask (first word) do not match**
*

See M7CNT_PARAM structure, Table 11-1

**

With IF 961-CT1 counter submodule only: if both digital outputs are enabled, the same behavior (pulse behavior or range behavior) must be parameterized for both. If only one digital output is enabled any behavior can be parameterized for it.

FM 350-1 Function Module A5E00073040-02

11-39

M7 Reference Counter Function Library

11-40

FM 350-1 Function Module A5E00073040-02

Faults and Diagnostics

12

Chapter Overview Operator errors, incorrect wiring or contradictory parameterization (position of the coding connector does not match parameterization) can cause faults that the module must indicate to the user. Faults are divided into the following classes on the module: Faults displayed by the group error LED that indicate internal and external module faults. Faults that can initiate a diagnostics interrupt. Operator errors. These different classes of faults are indicated and displayed at different positions and must be acknowledged in different ways. You will find the following described in this chapter: The faults that can occur Where these faults are indicated How you acknowledge the faults.
Section 12.1 12.2 12.3 12.4 Description Fault Indication via the Group Error LED Initiation of Diagnostics Interrupts Data Errors Operator Errors Page 12-2 12-3 12-7 12-9

FM 350-1 Function Module A5E00073040-02

12-1

Faults and Diagnostics

12.1

Fault Indication via the Group Error LED

Where is the Fault Indicated? If the red group error LED lights up, a fault has occurred either on the module (internal fault) or at the cable connections (external fault).

Which Faults are Indicated? The following faults are indicated by the group error LED lighting up:

Type of Fault/LED Internal faults

Cause of Fault Fault in EPROM TEST Fault in RAM TEST Watchdog tripped Lost process interrupt Module parameterization missing

Remedy Change module Change module Change module Increase time between the interrupt causes Assign parameters and transfer Correct the position of the coding connector Correct connection

External faults

Coding connector wrongly connected Auxiliary voltage 1L+/1M not connected or 24 VDC encoder supply short-circuited 5.2 VDC encoder supply short-circuited or overloaded Fault in 5 V encoder signals (wirebreak, short-circuit, cable missing) Module parameterization does not match the position of the coding connector

Correct connection Correct connection

Correct parameterization and transfer, or reconnect the coding connector

Initiating a Diagnostics Interrupt All faults except the EPROM test fault, can initiate a diagnostics interrupt provided you have enabled the diagnostics interrupt in the relevant parameter assignment screen form. You can see which fault has caused the LED to light up from the diagnostics data sets DS0 and DS1. The assignments of the diagnostics data sets DS0 and DS1 are described in the next section.

12-2

FM 350-1 Function Module A5E00073040-02

Faults and Diagnostics

12.2

Initiation of Diagnostics Interrupts

What is a Diagnostics Interrupt? If a user program is to respond to an internal or external fault, you can parameterize a diagnostics interrupt that stops the cyclical program of the CPU and calls the diagnostics interrupt OB (OB82).

Which Events Can Initiate a Diagnostics Interrupt? The list shows you which events can initiate a diagnostics interrupt: External auxiliary voltage 1L+/1M short-circuited or overloaded Fault in 5.2 VDC encoder supply Module parameterization missing Error in module parameterization Watchdog tripped RAM defective Process interrupt lost Fault in signal A (wirebreak, short-circuit, cable missing) Fault in signal B (wirebreak, short-circuit, cable missing) Fault in signal N (wirebreak, short-circuit, cable missing)

Enabling the Diagnostics Interrupt You disable or enable the interrupts for the module in the parameter assignment screen forms and you decide there whether the module is to initiate a diagnostics interrupt and/or a process interrupt.

Responses to a Diagnostics Interrupt If an event occurs that can initiate a diagnostics interrupt, the following happens: The diagnostics information is stored in diagnostics data sets DS0 and DS1. The group error LED lights up The diagnostics interrupt OB is called (OB82). The diagnostics data set DS0 is entered in the start information of the diagnostics interrupt OB. The count continues unchanged. If OB82 has not been programmed, the CPU goes to STOP.

FM 350-1 Function Module A5E00073040-02

12-3

Faults and Diagnostics

Diagnostics Data Set DS0 and DS1 The information as to which event has initiated a diagnostics interrupt is stored in the diagnostics data sets DS0 and DS1. The diagnostics data set DS0 comprises four bytes; DS1 comprises 16 bytes with the first four bytes being identical to DS0.

Reading the Data Set from the Module The diagnostics data set DS0 is automatically transferred to the start information when the diagnostics OB is called.These four bytes are stored there in the local date (bytes 8 to 11) of OB82. You can read out diagnostics data set DS1 (and so also the contents of DS 0) from the module with the FC DIAG_INF. It only makes sense to do this, if a fault in a channel is signaled in DS0.

Assignments of the Diagnostics Data Set DS0 in the Start Information Table 12-1 shows the assignments of diagnostics data set DS0 in the start information. All unlisted bits are insignificant and take the value zero.
Table 12-1 Assignments of Diagnostics Data Set DS0 Byte 0 0 1 Bit Meaning Module in fault Internal fault Remarks Set for every diagnostics event Set for all internal faults: Event No. 8:x:00 8:x:01

Faults in the RAM test Watchdog tripped Lost process interrupt


2 External fault Set for all external faults: 8:x:02

Auxiliary voltage 1L+/1M


not connected or 5.2 VDC encoder supply short-circuited

5.2 VDC encoder supply


short-circuited or overloaded

Fault in 5 V signals Parameterization error


3 4 6 7 Fault in one channel Fault in external auxiliary voltage Parameterization missing Error in parameterization See DS1, byte 4 for further breakdown Check voltage Execute parameterization See Section 12.3 Data Errors for further breakdown 8:x:03 8:x.04 8:x:06 8:x:07

12-4

FM 350-1 Function Module A5E00073040-02

Faults and Diagnostics

Table 12-1 Assignments of Diagnostics Data Set DS0, continued Byte 1 Bit 0 ... 3 4 2 3 3 3 6 Meaning Type class Channel information Watchdog tripped RAM defective Process interrupt lost Remarks Always assigned 8 Always assigned 1 Module defective or strong interference Module defective or strong interference Check configuration. Process interrupt event has been detected and cannot be signaled since the same event has not yet been acknowledged by the user program/CPU 8:x:33 8:x:43 8:x:46 Event No.

Diagnostics Data Set DS1 The diagnostics data set DS1 consists of 16 bytes. The first 4 bytes are identical with diagnostics data set DS0. Table 12-2 shows the assignments of the remaining bytes. All unlisted bits are insignificant and take the value zero. This data set is entered in the DB of the FC CNT_CTRL1 from DW54 by the FC DIAG_INF.
Table 12-2 Assignments of the Bits of Bytes 4 to 11 of Diagnostics Data Set Byte 4 Bit 0 ... 6 7 5 6 7 8 0 ... 7 0 ... 7 0 0 1 2 4 5 ... 7 9 ... 15 Meaning Channel type Further channel types Diagnostics information length Number of channels Channel fault vector Fault in signal A Fault in signal B Fault in signal N Fault in 5.2 V encoder supply Reserved Reserved Remarks Always assigned 76H Always assigned 0 Always assigned 10H Always assigned 1 Assigned 1 for channel error 8:x:B0 8:x:B1 8:x:B2 8:x:B4 Event No.

FM 350-1 Function Module A5E00073040-02

12-5

Faults and Diagnostics

How Does the Diagnostics Text Appear in the Diagnostics Buffer? If you want to enter the diagnostics message in the diagnostics buffer, you must call the SFC 52 Enter user-specific message in diagnostics buffer in the user program. The event number of the diagnostics message in each case is specified in the input parameter EVENTN. The interrupt is entered in the diagnostics buffer with x=1 as incoming and with x=0 as outgoing. The diagnostics buffer contains the relevant diagnostics text in the Meaning column as well as the time of the entry.

Default Setting The diagnostics interrupt is disabled in the default setting.

12-6

FM 350-1 Function Module A5E00073040-02

Faults and Diagnostics

12.3

Data Errors

When Do Data Errors Occur? If new parameters are transferred to the module, the FM 350 checks these parameters. If errors occur during this check, the module signals these data errors Wrong parameters are not accepted by the module.

Where are Data Errors Indicated? The FC CNT_CTL1 enters the data errors with their error numbers in the DB of the FC CNT_CTL1. You can access this data word in the user program via variable identifier DA_ERR_W. Table 12-3 shows the number of the data errors and the meaning of these errors.
Table 12-3 Data Error Numbers and their Meanings No. 0 200 201 202 203 204 205 206 207 208 209 211 212 213 214 215 No error Coding connector wrongly connected or missing Incorrect value for receiver selection Incorrect value for diagnostics of signal pair Incorrect value for signal evaluation Incorrect value for input filter of the 24 V counter signals Incorrect value for the input filter of the digital inputs Reverse direction not allowed Incorrect parameter for reaction of DO0 Incorrect parameter for reaction of DO1 Range violatoin for pulse length Incorrect operating mode No gate specified or both gates specified Incorrect parameter for main count direction Upper limit range violation When parameterizing the process interrupt Reaching the comparison value in up or down count direction, a different count direction was specified to that specified in the parameterization of the behavior of the outputs Output active for one pulse duration in up or down direction. The directions must agree. Interrupts from the gate control only possible in the operating modes with gate control. Interrupt at reaching comparison values is not allowed as reaction for the outputs Active from comparison value to overflow or Active from comparison value to underflow. Meaning

216 217

FM 350-1 Function Module A5E00073040-02

12-7

Faults and Diagnostics

Table 12-3 Data Error Numbers and their Meanings, continued No. 218 219 220 221 222 223 224 Interrupt at zero crossing not allowed Coding of Latch Setting wrong Incorrect parameter for gate control Range violation for lower limit or load value Range violation for upper limt or comparsion value1 Range violation for update time or comparsion value 2 Range violation for pulses per encoder revolution Meaning

How are Data Errors Acknowledged? Correct the values for the parameters in accordance with the specifications. Transfer the corrected parameter set again to the FM 350. The FM 350 checks the parameters again and deletes the data error in DB.

12-8

FM 350-1 Function Module A5E00073040-02

Faults and Diagnostics

12.4

Operator Errors

When Do Operator Errors Occur? Operator errors occur when you operate the module wrongly by setting incorrect control signals.

Where are the Operator Errors Indicated? The operator error numbers are entered in DB by the FC CNT_CTL1. When the output parameter OT_ERR is set, FC_CNT_CTL1 indicates that an operation error has occured. You can access this data word in your program via the variable identifier OT_ERR_B

What Operator Errors Exist?


Table 12-4 Numbers of the Operator Errors and their Meaning Error Number 0 1 2 4 5 6 10 11 12 20 21 22 90 91 No error Operating mode cannot be started with software gate Operating mode cannot be aborted Only permissible if OD is active Nur das Steuerbit fr das Parametrieren darf gesetzt werden Nonallowed job Range violation for lower limit or load value Range violation for upper limt or comparsion value1 Range violation for update time or comparsion value 2 Incorrect parameter for reaction of DO0 Incorrect parameter for reaction of DO1 Range violation for pulse length See Chapter 5.2, FC CNT_CTL2 (FC 3) See Chapter 5.2, FC CNT_CTL2 (FC 3) Meaning

How are Operator Errors Acknowledged? Acknowledge the error with the input parameter OT_ERR_A in FC CNT_CTL1.

FM 350-1 Function Module A5E00073040-02

12-9

Faults and Diagnostics

12-10

FM 350-1 Function Module A5E00073040-02

Technical Specifications

General Technical Specifications


The following technical specifications are described in the Reference Manual Programmable Controllers S7-300/M7-300, Module Specifications. Electromagnetic compatibility Shipping and storage conditions Mechanical and climatic ambient conditions Details of insulation tests, safety class and degree of protection Certifications, approvals and standards

Warning Personal injury and material damage may occur. In potentially explosive areas, personal injury and material damage can occur if you unplug plug-and-socket connections while an S7-300 is operating. Always de-energize the S7-300 in potentially explosive areas before you undo plug-and-socket connections.

Warning WARNING - DO NOT DISCONNECT WHILE CIRCUIT IS LIVE UNLESS LOCATION IS KNOWN TO BE NONHAZARDOUS

FM 350-1 Function Module A5E00073040-02

A-1

Technical Specifications

Technical Specifications of the FM 350-1


Dimensions and weight Dimensions W Weight H D (mm) 40 125 120

Approx. 250 g Current, voltage and rating

Current input (from backplane bus) Power loss Auxiliary voltage for the encoder power supply Polarity protection Encoder power supply

Max. 160 mA Typically 4.5 W Auxiliary voltage: 24 VDC (permissible range: 20.4 to 28.8V) Yes

Current input from 1L+ (no load):


max. 20 mA

Encoder power supply 24 V


1L+ 3V max. 400 mA, short-circuit-proof 5.2V "2% max. 300 mA, short-circuit-proof

Encoder power supply 5.2V

Permissible difference between input (ground)


and central ground connection of the CPU: 1 VDC Auxiliary voltage for the load current power supply Polarity protection Auxiliary voltage: 24 VDC (permissible range: 20.4 to 28.8V) Yes Digital inputs Low level High level Input current Minimum pulse width (max. input frequency) 30 to + 5 V + 11 to + 30 V Typically 9 mA w 2.5 ms (200 kHz), w 25 ms (20 kHz) (parameterizable) Digital outputs Power supply Electrically isolated Output voltage High-level signal 1 Low-Level signal 0 Rated value Range Min. 2L+ 1.5 V Max. 3 V 0.5 A 5 mA to 0.6 A Max. 300 ms 2L+ / 2M Yes, from all others except the digital inputs

Switching current

Switching time

A-2

FM 350-1 Function Module A5E00073040-02

Technical Specifications

Digital outputs Circuit interruption voltage (ind.) Short-circuit-proof Limited to 2L+ (45..55 V) Yes Count inputs 5 V Level Terminating resistor Differential input voltage Max. counting frequency Electrically isolated from S7-300 bus Input frequency and length of cable for asymmetrical encoder (count or digital inputs) Input frequency and length of cable for asymmetrical encoder (count or digital inputs) To RS 422 Approx. 220 ohm Min. 1.3 V 500 kHz No Max. 500 kHz for 32 m length of cable, shielded Max. 500 kHz for 100 m length of cable, shielded

Count inputs 24 V Low level High level Input current Minimum pulse width (max. counting frequency) Electrically isolated from S7-300 bus Input frequency and length of cable for asymmetrical encoder (count or digital inputs) Input frequency and length of cable for asymmetrical encoder (count or digital inputs) 30 to + 5 V + 11 to + 30 V Typically 9 mA w 2.5 ms (200 kHz), w 25 ms (20 kHz) (parameterizable) No Max. 200 kHz for 20 m length of cable, shielded Max. 20 kHz for 100 m length of cable, shielded

FM 350-1 Function Module A5E00073040-02

A-3

Technical Specifications

A-4

FM 350-1 Function Module A5E00073040-02

Spare Parts

B
Accessories and Spare Parts Parts for the S7-300 Order Number 6ES7 390-0AA00-0AA0 6ES7 392-2XX00-0AA0 6ES7 912-0AA00-0AA0 6ES7 392-1AJ00-0AA0 6ES7 390-5AA00-0AA0 6ES7 390-5AB00-0AA0 6ES7 390-5BA00-0AA0 6ES7 390-5CA00-0AA0 6ES7 974-0AA00-0AA0

Spare Parts Table B-1 lists all spare parts of the S7-300 that you can order for the FM 350 either additionally or later.
Table B-1

Expansion bus Labelling strips Slot number plate Screw-type front connector (20-pin) Shield attachment (with 2 screw-type bolts) Shield connection terminals for

2 cables with 2 to 6 mm shield diameter


each

1 cable with 3 to 8 mm shield diameter 1 cable with 4 to 13 mm shield diameter


Measuring range submodule for analog modules (coding connector)

FM 350-1 Function Module A5E00073040-02

B-1

Spare Parts

B-2

FM 350-1 Function Module A5E00073040-02

References

C
Titel

Supplementary references
The table below lists all the manuals referred to in this manual.
Nr. /1/ /2/ /3/

SIMATIC S7; S7-300 Programmable Controller; Hardware and Installation SIMATIC; System Software for S7300 and S7400 System and Standard Functions Modifying the System during Operation via CiR Cannot be ordered separately. Online help and electronic manual as component of STEP 7

FM 350-1 Function Module A5E00073040-02

C-1

References

C-2

FM 350-1 Function Module A5E00073040-02

Glossary

Configuration
Assignment of modules to racks, slots and addresses. For configuration of the hardware, the user fills in a configuration table in STEP 7.

Double evaluation
Double evaluation means that on an incremental encoder the rising pulse edges of pulse series A and B are evaluated.

Encoder
Encoders are used for the accurate detection of square-wave signals, paths, positions, velocities, operating speeds, grounds, etc.

Encoders with asymmetrical output signals


Encoders with asymmetrical output signals supply two pulse series with phase quadrature and, possibly, a zero mark signal.

Encoders with symmetrical output signals


Encoders with symmetrical output signals supply two pulse series with phase quadrature, perhaps a zero mark signal, and the associated inverted signals.

Function (FC)
A function (FC), as defined in IEC 1131-3, is a code block without static data. A function features the option of transferring parameters in the user program. In this way, functions are suitable for programming frequently recurring complex functions.

Function module (FM)


A function module (FM) is a module which relieves the central processing unit (CPU) on programmable logic controllers S7 and M7 of time-critical tasks of process signal processing involving high memory requirements . FMs normally use the internal communication bus for a high-speed exchange of data with the CPU. Examples of FM usage are counting, positioning, and instrumentation and control.

FM 350-1 Function Module A5E00073040-02

Glossary-1

Glossary

Initiator
An initiator is a simple BERO proximity switch without directional information. It thus merely provides a count signal. In this instance, only the rising pulse edges of signal A are counted. The direction of counting must be specified by the user.

Pulse duration
With the pulse duration, you specify the minimum time an output should be set.

PushPull
The output of the encoder actively switches to 0 V (ground) and actively to +24 V.

Quadruple evaluation
Quadruple evaluation means that on an incremental encoder all the pulse edges of pulse series A and B are evaluated.

SFC
An SFC (system function) is a function that is integrated in the operating system of the CPU and can be called, if required, in the STEP 7 user program.

Single evaluation Single evaluation means that on an incremental encoder the rising pulse edge of pulse series A is evaluated.

Sink output
The output of the encoder actively switches to 0 V (ground).

Source output
The output of the encoder actively switches to +24 V.

STOP
STOP as an international expression for example, as an operating mode command.

STOPP
STOPP as an expression in the manual when a command is not meant (STOPP is German for STOP).

Glossary-2

FM 350-1 Function Module A5E00073040-02

Glossary

Zero mark
The zero mark is located on the third track of an incremental encoder. After each rotation, the zero mark supplies a zero mark signal.

Zero mark signal


The zero mark signal is read out by an incremental encoder after every rotation.

FM 350-1 Function Module A5E00073040-02

Glossary-3

Glossary

Glossary-4

FM 350-1 Function Module A5E00073040-02

Index
Symbols
+/31Bit counting range limit, 8-20 Command:Latch, 8-46 Command:Measuring times, 8-48 Command:Open and close gate, 8-62 Commands, 8-7, 8-54 give, 8-2 Comparison value, 8-27 Connection incremental 24V Encoder, 3-8 incremental 5 V encoder, 3-7 Continuous periodic measurement, 8-59 Continuous periodic measurement mode, 8-59 Control bits, 8-2 Control interface Count modes, 5-16 Measure modes, 5-24 Control- and check-back interface, Accessing with STEP 7 programming, 5-2 Count modes, 8-4 Check-back interface, 5-20 Control interface, 5-16 Count range, maximum, 8-6 Counter signals, cables, 3-7 CPU STOP, Behaviour, 5-36

Numbers
24 V encoder signals, 3-5 input filter, 1-3, 3-5, 9-6 24 V signals, 9-5 24 VDC encoder supply, 3-4 32Bit counting range limit, 8-20 5 V differential signals, 9-3 5.2 VDC encoder supply, 3-4

A
Acknowledgement principle, complete, 5-31 Auxiliary voltage 1L+, 1M, 3-4

B
Behavior of the digital outputs, marginal conditions, 8-34

D C
Cables, 3-7 cross-section, 3-8 Calling, 4-3 Central Operation, 1-3 Check-back interface Count modes, 5-20 Measure modes, 5-27 Checklist mechanical installation, 7-2 parameterization, 7-4 CNT_CTL2 function, 5-10 Coding connector, 1-8 Coding key, correct position, 2-3 Command: Latch/Retrigger, 8-44 Command: open and close gate, 8-21 Command: set counter, 8-38 Data errors, 12-7 DB parameters for counting, transferring values, 5-7 DB parameters for measuring, transferring values, 5-9 DI Set. See digital inputs DI Start. See digital inputs DI Stop. See digital inputs Diagnostic data set DS0, assignments, 12-4 Diagnostics data set DS1, assignments, 12-5 Diagnostics interrupt, 12-2, 12-3 enabling, 12-3 OB 82, 12-3 Digital input DI Start, Status, 8-22 Digital input DI Stop, Status, 8-22 Digital input Start DI, Status, 8-63 Digital input Stop DI, Status, 8-63

FM 350-1 Function Module A5E00073040-02

Index-1

Index

Digital inputs, 3-5 cables, 3-7 cables, shielded, 3-7 input filter, 3-6 Digital outputs, 3-6 behaviour, 8-67 enable, 8-66 enabling, 8-27 setting and resetting, 8-28 status, 8-30, 8-68

HW gate:level-controlled opening and closing, 8-62 Hysteresis, 1-3, 8-35

I
Input delay, 3-6 Input filter, 3-6 Internal faults, 12-2

E
ENSET_DN, 8-39 ENSET_UP, 8-39 Ersatzteile, C-1 External faults, 12-2

L
Labeling strips, 1-8 Latch, 8-46 LEDs, function, 1-9 Load value, 1-2, 8-38 Load voltage, 3-6

F
FM 350-1 Count modes, 8-4 Measure modes, 8-49 Overview of the commands, 8-7, 8-54 FM 350-1, S7-400 configuration, 1-10 Frequency measurement, 8-55 Frequency measurement mode , 8-55 Front connector, 1-7 terminal assignments, 3-2 wiring, 3-9 Front connector coding, 1-8 Front connector of the FM 350-1, 3-2 Functions, Technical data, 5-15

M
Main application area, 1-5 Maximum number, of FM 350-1 used, 2-2 Measure Frequency, 8-55 Period, 8-59 RPM, 8-57 Measure modes, 8-49 Check-back interface, 5-27 Control interface, 5-24 Measuring times, 8-48 Mechanical configuration, 2-2

O G
Gate Stop function, 8-64 Gate stop function, 8-14, 8-24 Group error LED, 12-2 OB 40, 8-70 start information, 8-70 OB82, 12-3 Open and close the hardware gate, 8-13 Open and close the software gate, 8-18 Opening and closing the software gate, 8-9, 8-13 Operating modes, select, 8-2 Operator errors, 12-9 Order number, 1-8 Overflow, 8-20

H
Hardware gate edge-controlled opening and closing, 8-22 level-controlled opening and closing, 8-21 status, 8-22 HW gate, Status , 8-63 HW gate:edge-controlled opening and closing, 8-63

Index-2

FM 350-1 Function Module A5E00073040-02

Index

P
Periodic counting mode, 8-15 Process interrupt, 1-2, 8-69 enabling, 8-69 initiate, 8-69 OB 40, 8-70 Programming, without FCs, 5-16 Pulse duration default value, 8-32 range of values, 8-32

Software gate opening and closing, 8-23 status, 8-23 Status bits, 8-2 Resetting, 5-34 SW gate Opening and closing, 8-64 Status , 8-64 Symmetric encoders, 9-3

T Q
Q0. See digital outputs Q1. See digital output Quadruple evaluation, 9-8 Terminal assignment, 1-8 Transferring values DB parameters for counting, 5-7 DB parameters for measuring, 5-9 time required (with function), 5-7 time required (without function), 5-33 with function, 5-6 without function, 5-32

R
Restart coordination, 5-35 RPM measurement, 8-57 RPM measurement mode, 8-57

U
Underflow, 8-20

S
Safety rules, 2-2 Selecting the gate function, 8-8, 8-13, 8-18 SET, 8-38 Set counter, with digital input I2, 8-39 Setting the counter via the user program, 8-38 with an external signal, 8-39 with the zero mark, 8-41 Setting: behavior of the digital outputs, 8-27 Setting: counting range limit, 8-20 Setting:Behaviour of the digital outputs, 8-66 Settings, select, 8-2 Single counting mode, 8-10 Slots, permitted, 2-2

V
Values, Reading back, 5-34 Version, 1-8 View of module, 1-7 Voltage supply, of the encoders, 3-4

W
Wire end ferrule, 3-8

Z
Zero pass, 8-20

FM 350-1 Function Module A5E00073040-02

Index-3

Index

Index-4

FM 350-1 Function Module A5E00073040-02

Potrebbero piacerti anche