Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
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
Manual
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.
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
Preface
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=
iii
Preface
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.
iv
Preface
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
Preface
The languages of the SIMATIC Hotlines and the authorization hotline are generally German and English.
vi
Preface
vii
Preface
viii
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 . . . . . . . . . . . . . . . . . . . . . . .
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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
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
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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A B C
Glossary-1
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Index-1
xii
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
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
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
xv
Contents
xvi
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
1-1
Product Overview
1.1
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
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.
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
Product Overview
1.2
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.
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
Gate Belt B
Figure 1-1
1-6
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
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).
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
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
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
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
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.
1-11
Product Overview
1-12
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
2-1
2.1
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
2.2
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.
2-3
Figure 2-1
2-4
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.
Further Notes Manual /1/ contains further notes on installing and removing modules.
2-5
2-6
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
3-1
3.1
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 connector
SF CR DIR
1 2 3 4 5 6 7 8 9 1 0
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
3-2
Encoder supply ground 5.2 V encoder supply 24 V encoder supply Encoder signal A* Direction signal
3-3
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
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
3-5
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
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
3.2
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.
3-7
Shield on housing
6 8 10 5 3
A* B* N* 24VDC 1M
Figure 3-3
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
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
3-9
3.3
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
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
Page 4-2
4-1
4.1
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!
Note If you selected a directory other than SIEMENS\STEP7 when you installed STEP 7, that directory will be entered.
4-2
4-3
4-4
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
5-1
Exchange of Data between the User Program and FM 350-1 with FCs
The figure below illustrates the exchange of data
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
5-2
5.1
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.
5-3
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
L T L T L T
// 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
:= :=
, ,
DB_NO
OT_ERR
SW_GATE
:= := :=
, , ,
:= := := := := := :=
, , , , , , )
5-4
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
sets this
sets this
Initiation bit for parameter change Delete Synchronization status bit Delete Zero pass status bit
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)
5-5
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
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
5 PROFIBUS DP cycles
5 PROFIBUS DP cycles after initiation 6 PROFIBUS DP cycles after initiation 7 PROFIBUS DP cycles after initiation
5-7
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
LOAD_VAL Lower limit; load with function parameter: LOAD_VAL Behavior of DO0; define with function parameter:
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
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.
5-9
5.2
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
5.3
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 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
5-11
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).
:=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);
// // // // // // // // // // // // // // // // // // // // // // // // // // //
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
5-13
5-14
5.5
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
5-15
5.6
5.6.1
5-16
Table 5-5
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
Hysteresis (value range 0...255) Pulse duration (value range 0..250) Reserved = 0 Comparison value 1; load with bit: T_CMP_V1
5-17
Table 5-5
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
Byte 14
Byte 15
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
5-19
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
5-20
Table 5-7
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
5-21
FM_NEUST
FM_NEUSTQ
OT_ERR
PARA
STS_C_DOPARA
STS_COMP2
STS_DIR
This bit indicates the status of the gate. 0 =Gate closed 1 = Gate open
5-22
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
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
5-23
5.6.2
LOAD_VAL LOAD_VAL
Load lower limit with bit: Define behavior of DO0 with bit:
L_PREPAR C_DOPARA
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
Table 5-9
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)
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.
5-25
5-26
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
5-27
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_NEUST
FM_NEUSTQ
OT_ERR
PARA
STS_C_DOPARA
This bit indicates the status of the gate. 0 = Gate closed 1 = Gate open
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
5-29
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
5.6.3
Definition
The complete acknowledgement principle (see figure 5-2) is always used to control the FM 350-1 from the user program.
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.
5-31
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:
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
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.
4 PROFIBUS DP cycles
4 PROFIBUS DP cycles after initiation 5 PROFIBUS DP cycles after initiation 6 PROFIBUS DP cycles after initiation
5-33
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:
Status bit
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
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
5-35
5.7
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.
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.
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
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
6-1
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
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.
6-3
6.2
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
6.3
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.
6-5
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
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.
6-7
6.4
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
6.5
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.
6-9
6.6
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
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.
6-11
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
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.
6-13
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
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
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
7-1
7.1
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
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
7-2
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)
Terminal 13 14 15 17 18
Terminal 1 2 19 20
7-3
7.2
7-4
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)
7-5
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
7-7
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
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
8-1
8.1
8-2
8.2
Isochrone Mode
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.
8-3
8.3
Count Modes
8.3.1
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
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.
8-5
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.
Counter value
8-6
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.
Designation Open and close gate Set counter Latch/retrigger Latch Measure times between two edges
8-7
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).
Current counter limit Lower count limit Gate start Figure 8-1 Continuous counting with gate control Gate stop Time
8-8
When the hardware gate opens, the counting operation resumes with the current counter level.
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.
8-9
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
STS_OFLW
Load value 0 Max. count range Max Lower count limit Gate start Gate start Automatic gate stop STS_ZERO
Figure 8-2
8-10
Counter level Set upper count limit Set count range Load value STS_OFLW
8-11
Load value
Lower count limit = 0 Gate start Gate start Automatic gate stop Figure 8-4
STS_UFLW
Single counting with main counting direction down; Cancel gate function
8-12
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
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.
8-14
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
STS_OFLW
Load value Max. count range Max Lower count limit Gate start Gate stop 0 STS_ZERO
STS_UFLW Time
Figure 8-6
8-15
Counter level Set upper count limit Load value Set count range STS_OFLW
Figure 8-7
8-16
Set count range Load value Lower count limit = 0 Gate start Gate stop
STS_UFLW Time
Figure 8-8
8-17
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
8-19
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.
8-20
8.3.7
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.
Figure 8-10
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.
8-21
Counter status 4
Open gate
DI Stop
Close gate
Figure 8-11
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.
8-22
Figure 8-12
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.
8-23
Counter level (1) Upper count limit Load value Lower count limit Gate start Gate stop Gate start Time
Figure 8-13
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
8-24
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 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)
8-25
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
8.3.8
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.
...Is Enabled By
8-27
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
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:
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:
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:
t = pulse duration
8-29
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
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
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.
8-31
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
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
Count pulses
DO1 does not switch Count value= Comparsion value Figure 8-19 Reactions of an output for a pulse duration 0 ms
8-33
Default Setting
The outputs are switched off in the default setting.
8-34
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.
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.
8-35
Count value
Comparison value = 5
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
Figure 8-21
8-36
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
Figure 8-22
8-37
8.3.9
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
8-38
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.
8-39
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.
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.
DI Set
ENSET_UP
Counter set
8-40
DI Set
ENSET_UP
Counter set
Counter set
8-41
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.
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.
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
8-42
Count pulses
Zero mark
DI Set
ENSET_UP
Counter set
Counter set
Counter set
Counter set
Figure 8-26
8-43
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.
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
Count pulses
GATE_STP
SW_GATE
DI-Start
Counter level
Latch value
Figure 8-27
8-45
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.
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
Count pulses
GATE_STP
SW_GATE
DI-Start
Counter level
Latch value
Figure 8-28
8-47
8.3.12
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
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
8.4
Measure Modes
8.4.1
You must set the FM 350-1 parameters in order to run one of these operating modes (see the 4 and 7 section).
8-49
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
Update time
Update time
Update time
Dynamic meas. time Dynamic meas. time Dynamic meas. timet Figure 8-29 Measuring principle
8-50
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.
8-51
1 Update time Figure 8-30 Principle of continuous measurement (example of a frequency measurement)
8-52
STS_OFLW
STS_UFLW
0 Figure 8-31
Lower limit
Upper limit
Measured value
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.
8-53
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.
8-54
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
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
Figure 8-32
8-55
8-56
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
n 10 ms n TDP n TDP
1 ( 10 ms/TDP [ms] ) +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.
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
Figure 8-33
8-57
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
8-58
8.4.5
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
n 10 ms n TDP n TDP
1 ( 10 ms/TDP [ms] ) +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.
Update time
Internal gate Start of continuous periodic measurement Figure 8-34 Periodic measurement of the gate function End of continuous periodic measurement
8-59
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
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)
8-60
8-61
8.4.6
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.
Pulses
DI-Start Mesasurement Opening of the gate Figure 8-35 Closing of the 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
Pulses DI-Start DI-Start Mesasurement Opening of the gate Figure 8-36 Closing of the 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.
8-63
Pulses
Figure 8-37
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.
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
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 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)
8-65
8.4.7
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.
8-66
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
Measured value < Lower limit Measured value > Upper limit
Under lower limit DO0 is set if
8-67
Limit values
Not exceeded
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
8-68
8.5
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.
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.
8-69
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
Default Setting
No process interrupt is parameterized in the default setting.
8-70
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
9-1
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
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
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.
9-3
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
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
9-5
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
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.
Up Single Evaluation
Down
Figure 9-3
9-7
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.
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
9-8
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)
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
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)
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
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
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
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
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
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
11.1
M7CntDisableOut
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.
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.
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.
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
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
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.
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
11-6
11.5
M7CntInit
Syntax #include <m7cnt.h> M7ERR_CODE M7CntInit( M7IO_BASEADDR Baddr , UBYTE PType, UBYTE Channel, M7CNT_LOGCHANNEL_PTR pLogChannel);
Description
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
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
/* 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
11.6
M7CntLoadAndStart
Function Load and start counter channel (for operating modes with software gate control)
Description
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
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
11-10
11.7
M7CntLoadComp
Syntax #include <m7cnt.h> M7ERR_CODE M7CntLoadComp( M7CNT_LOGCHANNEL LogChannel, DWORD CmpV1, DWORD CmpV2, BOOL SelCmp1, BOOL SelCmp2);
Description
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
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.
if ((Err = M7CntLoadComp (Ch5, CmpValue1, CmpValue2, TRUE, TRUE)) != M7CNT_DONE) {...error handling...}
11-12
11.8
M7CntLoadDirect
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.
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
11-14
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.
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
11-16
11.10
M7CntPar
Description
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
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 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
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.
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
11-20
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.
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.
11-21
11.13
M7CntReadLoadValue
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-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.
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.
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
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.
if ((Err = M7CntReadStatus (Ch5, &CntStatus)) != M7CNT_DONE) {...error handling...} See Also Function: M7CntInit, M7CntResetStatus, Structure: M7CNT_STATUS
11-25
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.
11.17
M7CntStart
Function Start Counter Channel - for Operating Modes with Software Gate Control
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
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
11.18
M7CntStop
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.
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
Example #include M7CNT.H M7CNT_LOGCHANNEL Ch5; if ((Err = M7CntStop (Ch5)) != M7CNT_DONE) {...error handling...}
11-29
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
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 */
11-31
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
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.
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
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
Operating mode
Hysteresis
Pulse duration
Synchronization type
Count limits
WORD { 0 : 500 } D
BOOL
BOOL
BOOL
BOOL
BOOL
BOOL
BOOL
BOOL
{ disabled | free }
{ disabled | free }
{ disabled | enabled }
{level-controlled| edge-controlled}
{ single | periodic }
{ 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
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
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
11-37
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
11-38
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**
*
**
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.
11-39
11-40
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
12-1
12.1
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:
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
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
12.2
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.
12-3
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
12-4
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.
12-5
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.
12-6
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
12-7
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
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
How are Operator Errors Acknowledged? Acknowledge the error with the input parameter OT_ERR_A in FC CNT_CTL1.
12-9
12-10
Technical Specifications
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
A-1
Technical Specifications
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
Switching current
Switching time
A-2
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
A-3
Technical Specifications
A-4
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
B-1
Spare Parts
B-2
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
C-1
References
C-2
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.
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.
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
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.
Glossary-3
Glossary
Glossary-4
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
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
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
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
Index-3
Index
Index-4